Created
August 30, 2013 10:16
-
-
Save Sar777/6388415 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else if (GetPlayer()->IsInCombat() && GetPlayer()->GetMap()) | |
{ | |
GetPlayer()->CombatStop(); | |
GetPlayer()->getHostileRefManager().setOnlineOfflineState(false); | |
GetPlayer()->RemoveAllAurasOnDeath(); | |
// build set of player who attack _player or who have pet attacking of _player | |
std::set<Player*> aset; | |
// GuidSet& attackers = GetPlayer()->GetMap()->GetAttackersFor(GetPlayer()->GetObjectGuid()); | |
// | |
// for (GuidSet::const_iterator itr = attackers.begin(); itr != attackers.end();) | |
// { | |
// Unit* attacker = GetPlayer()->GetMap()->GetUnit(*itr++); | |
// if (!attacker) | |
// continue; | |
// | |
// Unit* owner = attacker->GetOwner(); // including player controlled case | |
// if(owner) | |
// { | |
// if(owner->GetTypeId() == TYPEID_PLAYER) | |
// aset.insert((Player*)owner); | |
// } | |
// else | |
// if(attacker->GetTypeId() == TYPEID_PLAYER) | |
// aset.insert((Player*)(attacker)); | |
// } | |
GetPlayer()->SetPvPDeath(!aset.empty()); | |
GetPlayer()->KillPlayer(); | |
GetPlayer()->BuildPlayerRepop(); | |
GetPlayer()->RepopAtGraveyard(); | |
// give honor to all attackers from set like group case | |
for(std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr) | |
(*itr)->RewardHonor(GetPlayer(),aset.size()); | |
// give bg rewards and update counters like kill by first from attackers | |
// this can't be called for all attackers. | |
if(!aset.empty()) | |
if(BattleGround *bg = GetPlayer()->GetBattleGround()) | |
bg->HandleKillPlayer(GetPlayer(),*aset.begin()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment