Mob* HateList::GetDamageTop(Mob* hater) { _ZP(HateList_GetDamageTop); Mob* current = NULL; Group* grp = NULL; Raid* r = NULL; uint32 dmg_amt = 0; LinkedListIterator<tHateEntry*> iterator(list); iterator.Reset(); while(iterator.MoreElements()) { grp = NULL; r = NULL; if(iterator.GetData()->ent && iterator.GetData()->ent->IsClient()){ r = entity_list.GetRaidByClient(iterator.GetData()->ent->CastToClient()); } grp = entity_list.GetGroupByMob(iterator.GetData()->ent); if(iterator.GetData()->ent && r){ if(r->GetTotalRaidDamage(hater) >= dmg_amt) { current = iterator.GetData()->ent; dmg_amt = r->GetTotalRaidDamage(hater); } } else if (iterator.GetData()->ent != NULL && grp != NULL) { if (grp->GetTotalGroupDamage(hater) >= dmg_amt) { current = iterator.GetData()->ent; dmg_amt = grp->GetTotalGroupDamage(hater); } } else if (iterator.GetData()->ent != NULL && (uint32)iterator.GetData()->damage >= dmg_amt) { current = iterator.GetData()->ent; dmg_amt = iterator.GetData()->damage; } iterator.Advance(); } return current; }
Mob* HateList::GetDamageTop(Mob* hater) { Mob* current = nullptr; Group* grp = nullptr; Raid* r = nullptr; uint32 dmg_amt = 0; auto iterator = list.begin(); while(iterator != list.end()) { grp = nullptr; r = nullptr; if((*iterator)->ent && (*iterator)->ent->IsClient()){ r = entity_list.GetRaidByClient((*iterator)->ent->CastToClient()); } grp = entity_list.GetGroupByMob((*iterator)->ent); if((*iterator)->ent && r){ if(r->GetTotalRaidDamage(hater) >= dmg_amt) { current = (*iterator)->ent; dmg_amt = r->GetTotalRaidDamage(hater); } } else if ((*iterator)->ent != nullptr && grp != nullptr) { if (grp->GetTotalGroupDamage(hater) >= dmg_amt) { current = (*iterator)->ent; dmg_amt = grp->GetTotalGroupDamage(hater); } } else if ((*iterator)->ent != nullptr && (uint32)(*iterator)->damage >= dmg_amt) { current = (*iterator)->ent; dmg_amt = (*iterator)->damage; } ++iterator; } return current; }