mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-20 04:22:25 +00:00
(Performance) Corpse drag will now fetch entity by ID
This commit is contained in:
parent
754d70d513
commit
808977f69a
@ -6045,11 +6045,10 @@ void Client::NPCSpawn(NPC *target_npc, const char *identifier, uint32 extra)
|
||||
}
|
||||
}
|
||||
|
||||
bool Client::IsDraggingCorpse(const char *CorpseName)
|
||||
bool Client::IsDraggingCorpse(uint16 CorpseID)
|
||||
{
|
||||
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
|
||||
{
|
||||
if(!strcasecmp((*Iterator).c_str(), CorpseName))
|
||||
for (auto It = DraggedCorpses.begin(); It != DraggedCorpses.end(); ++It) {
|
||||
if (It->second == CorpseID)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -6058,20 +6057,22 @@ bool Client::IsDraggingCorpse(const char *CorpseName)
|
||||
|
||||
void Client::DragCorpses()
|
||||
{
|
||||
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
|
||||
{
|
||||
Mob* corpse = entity_list.GetMob((*Iterator).c_str());
|
||||
for (auto It = DraggedCorpses.begin(); It != DraggedCorpses.end(); ++It) {
|
||||
Mob *corpse = entity_list.GetMob(It->second);
|
||||
|
||||
if(corpse && corpse->IsPlayerCorpse() && (DistNoRootNoZ(*corpse) <= RuleR(Character, DragCorpseDistance)))
|
||||
if (corpse && corpse->IsPlayerCorpse() &&
|
||||
(DistNoRootNoZ(*corpse) <= RuleR(Character, DragCorpseDistance)))
|
||||
continue;
|
||||
|
||||
if(!corpse || !corpse->IsPlayerCorpse() || corpse->CastToCorpse()->IsBeingLooted() || !corpse->CastToCorpse()->Summon(this, false, false))
|
||||
{
|
||||
if (!corpse || !corpse->IsPlayerCorpse() ||
|
||||
corpse->CastToCorpse()->IsBeingLooted() ||
|
||||
!corpse->CastToCorpse()->Summon(this, false, false)) {
|
||||
Message_StringID(MT_DefaultText, CORPSEDRAG_STOP);
|
||||
Iterator = DraggedCorpses.erase(Iterator);
|
||||
It = DraggedCorpses.erase(It);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration)
|
||||
{
|
||||
if(!target || !IsValidSpell(spell_id) || this->GetID() == target->GetID())
|
||||
|
||||
@ -1078,7 +1078,7 @@ public:
|
||||
void ClearHover();
|
||||
inline bool IsBlockedBuff(int16 SpellID) { return PlayerBlockedBuffs.find(SpellID) != PlayerBlockedBuffs.end(); }
|
||||
inline bool IsBlockedPetBuff(int16 SpellID) { return PetBlockedBuffs.find(SpellID) != PetBlockedBuffs.end(); }
|
||||
bool IsDraggingCorpse(const char* CorpseName);
|
||||
bool IsDraggingCorpse(uint16 CorpseID);
|
||||
inline bool IsDraggingCorpse() { return (DraggedCorpses.size() > 0); }
|
||||
void DragCorpses();
|
||||
inline void ClearDraggedCorpses() { DraggedCorpses.clear(); }
|
||||
@ -1481,7 +1481,7 @@ private:
|
||||
|
||||
std::set<uint32> PlayerBlockedBuffs;
|
||||
std::set<uint32> PetBlockedBuffs;
|
||||
std::list<std::string> DraggedCorpses;
|
||||
std::list<std::pair<std::string, uint16> > DraggedCorpses;
|
||||
|
||||
uint8 MaxXTargets;
|
||||
bool XTargetAutoAddHaters;
|
||||
|
||||
@ -12379,7 +12379,7 @@ void Client::Handle_OP_CorpseDrag(const EQApplicationPacket *app)
|
||||
if(!corpse || !corpse->IsPlayerCorpse() || corpse->CastToCorpse()->IsBeingLooted())
|
||||
return;
|
||||
|
||||
Client *c = entity_list.FindCorpseDragger(cds->CorpseName);
|
||||
Client *c = entity_list.FindCorpseDragger(corpse->GetID());
|
||||
|
||||
if(c)
|
||||
{
|
||||
@ -12394,7 +12394,7 @@ void Client::Handle_OP_CorpseDrag(const EQApplicationPacket *app)
|
||||
if(!corpse->CastToCorpse()->Summon(this, false, true))
|
||||
return;
|
||||
|
||||
DraggedCorpses.push_back(cds->CorpseName);
|
||||
DraggedCorpses.push_back(std::pair<std::string, uint16>(cds->CorpseName, corpse->GetID()));
|
||||
|
||||
Message_StringID(MT_DefaultText, CORPSEDRAG_BEGIN, cds->CorpseName);
|
||||
}
|
||||
@ -12408,9 +12408,9 @@ void Client::Handle_OP_CorpseDrop(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
|
||||
for (auto Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
|
||||
{
|
||||
if(!strcasecmp((*Iterator).c_str(), (const char *)app->pBuffer))
|
||||
if(!strcasecmp(Iterator->first.c_str(), (const char *)app->pBuffer))
|
||||
{
|
||||
Message_StringID(MT_DefaultText, CORPSEDRAG_STOP);
|
||||
Iterator = DraggedCorpses.erase(Iterator);
|
||||
|
||||
@ -4512,11 +4512,11 @@ void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height,
|
||||
}
|
||||
}
|
||||
|
||||
Client *EntityList::FindCorpseDragger(const char *CorpseName)
|
||||
Client *EntityList::FindCorpseDragger(uint16 CorpseID)
|
||||
{
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
if (it->second->IsDraggingCorpse(CorpseName))
|
||||
if (it->second->IsDraggingCorpse(CorpseID))
|
||||
return it->second;
|
||||
++it;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public:
|
||||
|
||||
Spawn2* GetSpawnByID(uint32 id);
|
||||
|
||||
Client* FindCorpseDragger(const char *CorpseName);
|
||||
Client* FindCorpseDragger(uint16 CorpseID);
|
||||
|
||||
inline Object *GetObjectByID(uint16 id)
|
||||
{ return object_list.count(id) ? object_list.at(id) : nullptr; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user