aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGround.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-11 14:47:38 -0500
committermegamage <none@none>2009-04-11 14:47:38 -0500
commit3120221deb93af2125a9baefe745cbbab8426ffe (patch)
tree6ebfc7364a8fc73eb234074d33477fbfe3fe08b6 /src/game/BattleGround.cpp
parentf4d69d1b3b8fe6d26195b14f0ec2133b872c735c (diff)
*Note: this patch may do not have any use for TC.
[7645] Fixed problems wit temporary unsummoned pets and cleanup code. Author: VladimirMangos * Save temporary unsummoned pet to current slot (instead non_in_slot mode) and prevent save as current pet summoned while temporay unsummon (arena) * Prevent overwrite temporary summoned pet data * At player loading set temporary unsummoned pet data instead pet loading if pet expected to be temporary unsummoned in current player state (loading in taxi flight/etc) * Restore proper pet at arena leave and unsummon in arena summoned. --HG-- branch : trunk
Diffstat (limited to 'src/game/BattleGround.cpp')
-rw-r--r--src/game/BattleGround.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index b3f74457063..fffedb56ad8 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -951,15 +951,9 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
- // summon old pet if there was one and there isn't a current pet
- if(!plr->GetGuardianPet() && plr->GetTemporaryUnsummonedPetNumber())
- {
- Pet* NewPet = new Pet(plr);
- if(!NewPet->LoadPetFromDB(plr, 0, (plr)->GetTemporaryUnsummonedPetNumber(), true))
- delete NewPet;
-
- (plr)->SetTemporaryUnsummonedPetNumber(0);
- }
+ // unsummon current and summon old pet if there was one and there isn't a current pet
+ plr->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT);
+ plr->ResummonPetTemporaryUnSummonedIfAny();
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
@@ -1113,19 +1107,7 @@ void BattleGround::AddPlayer(Player *plr)
}
plr->DestroyConjuredItems(true);
-
- Pet* pet = plr->GetPet();
- if (pet)
- {
- if (pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)
- {
- (plr)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
- (plr)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
- }
- (plr)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT);
- }
- else
- (plr)->SetTemporaryUnsummonedPetNumber(0);
+ plr->UnsummonPetTemporaryIfAny();
if(GetStatus() == STATUS_WAIT_JOIN) // not started yet
{