diff options
author | megamage <none@none> | 2009-03-21 09:48:44 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-21 09:48:44 -0600 |
commit | a84e757793e6310c84af8b05f9b27f1ee5abd188 (patch) | |
tree | 1605f4fd9a6122c826048c1abc2220dcae68a788 /src/game/Object.cpp | |
parent | 55695eda786667a34d6c0ae59496d787dfba4b3e (diff) |
*Update summon system. Show pet bar for guardians. Allow multiple charms/guardians.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 770c2d14899..63ad7de7c75 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1595,8 +1595,6 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a mask = SUMMON_MASK_VEHICLE; } - TempSummon *summon = NULL; - bool ok = true; uint32 phase = PHASEMASK_NORMAL, team = 0; if(summoner) { @@ -1605,27 +1603,15 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a team = ((Player*)summoner)->GetTeam(); } + TempSummon *summon = NULL; switch(mask) { - case SUMMON_MASK_SUMMON: - summon = new TempSummon(properties, summoner); - ok = summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, team); - break; - case SUMMON_MASK_GUARDIAN: - summon = new Guardian(properties, summoner); - team = objmgr.GeneratePetNumber(); - ok = summon->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), this, phase, entry, team); - // this enables pet details window (Shift+P) - summon->GetCharmInfo()->SetPetNumber(team, false); - break; - case SUMMON_MASK_TOTEM: - summon = new Totem(properties, summoner); - ok = summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, team); - break; - default: - return NULL; + case SUMMON_MASK_SUMMON: summon = new TempSummon (properties, summoner); break; + case SUMMON_MASK_GUARDIAN: summon = new Guardian (properties, summoner); break; + case SUMMON_MASK_TOTEM: summon = new Totem (properties, summoner); break; + default: return NULL; } - if(!ok) + if(!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, team)) { delete summon; return NULL; @@ -1639,9 +1625,8 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a return NULL; } - summon->InitSummon(duration); - Add((Creature*)summon); + summon->InitSummon(duration); return summon; } @@ -1779,11 +1764,12 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy pet->SetUInt32Value(UNIT_FIELD_BYTES_1,0); pet->InitStatsForLevel(getLevel()); + SetPet(pet, true); + switch(petType) { case POSSESSED_PET: pet->SetUInt32Value(UNIT_FIELD_FLAGS,0); - AddGuardian(pet); break; case SUMMON_PET: pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); @@ -1793,7 +1779,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); pet->InitPetCreateSpells(); pet->SavePetToDB(PET_SAVE_AS_CURRENT); - SetPet(pet); PetSpellInitialize(); break; } |