diff options
-rw-r--r-- | src/game/Creature.h | 1 | ||||
-rw-r--r-- | src/game/Object.cpp | 9 | ||||
-rw-r--r-- | src/game/Pet.cpp | 3 | ||||
-rw-r--r-- | src/game/Pet.h | 1 | ||||
-rw-r--r-- | src/game/Player.cpp | 14 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 22 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 33 | ||||
-rw-r--r-- | src/game/TemporarySummon.cpp | 40 | ||||
-rw-r--r-- | src/game/TemporarySummon.h | 12 | ||||
-rw-r--r-- | src/game/Unit.cpp | 5 |
11 files changed, 86 insertions, 56 deletions
diff --git a/src/game/Creature.h b/src/game/Creature.h index 2f583e25be0..c22d670556b 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -161,6 +161,7 @@ enum SummonMask SUMMON_MASK_TOTEM = 0x00000008, SUMMON_MASK_PET = 0x00000010, SUMMON_MASK_VEHICLE = 0x00000020, + SUMMON_MASK_PUPPET = 0x00000040, }; // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform diff --git a/src/game/Object.cpp b/src/game/Object.cpp index bc697d14f11..cd7b902ceca 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1768,6 +1768,8 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a || properties->Type == SUMMON_TYPE_VEHICLE || properties->Type == SUMMON_TYPE_VEHICLE2) mask = SUMMON_MASK_VEHICLE; + else if(properties->Category == SUMMON_CATEGORY_PUPPET) + mask = SUMMON_MASK_PUPPET; else if(properties->Type == SUMMON_TYPE_MINIPET) mask = SUMMON_MASK_MINION; } @@ -1785,6 +1787,7 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a { case SUMMON_MASK_SUMMON: summon = new TempSummon (properties, summoner); break; case SUMMON_MASK_GUARDIAN: summon = new Guardian (properties, summoner); break; + case SUMMON_MASK_PUPPET: summon = new Puppet (properties, summoner); break; case SUMMON_MASK_TOTEM: summon = new Totem (properties, summoner); break; case SUMMON_MASK_MINION: summon = new Minion (properties, summoner); break; default: return NULL; @@ -1934,9 +1937,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy switch(petType) { - case POSSESSED_PET: - pet->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - break; case SUMMON_PET: // this enables pet details window (Shift+P) pet->GetCharmInfo()->SetPetNumber(pet_number, true); @@ -1953,9 +1953,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy switch(petType) { - case POSSESSED_PET: - pet->SetCharmedOrPossessedBy(this, true); - break; case SUMMON_PET: pet->InitPetCreateSpells(); pet->InitTalentForLevel(); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 300106eb2c3..ca4035e81b8 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -51,9 +51,6 @@ m_declinedname(NULL), m_owner(owner) m_regenTimer = 4000; owner->SetPetAtLoginFlag(0); - - if(type == POSSESSED_PET) // always passive - SetReactState(REACT_PASSIVE); } Pet::~Pet() diff --git a/src/game/Pet.h b/src/game/Pet.h index d66e13edf0c..b95b92c7eab 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -29,7 +29,6 @@ enum PetType { SUMMON_PET = 0, HUNTER_PET = 1, - POSSESSED_PET = 2, MAX_PET_TYPE = 4, }; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 88932020d38..8b41206928e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16643,15 +16643,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) } // only if current pet in slot - switch(pet->getPetType()) - { - case POSSESSED_PET: - pet->RemoveCharmedOrPossessedBy(NULL); - break; - default: - pet->SavePetToDB(mode); - break; - } + pet->SavePetToDB(mode); SetMinion(pet, false); @@ -16681,8 +16673,8 @@ void Player::StopCastingCharm() if(charm->GetTypeId() == TYPEID_UNIT) { - if(((Creature*)charm)->isPet() && ((Pet*)charm)->getPetType() == POSSESSED_PET) - ((Pet*)charm)->Remove(PET_SAVE_AS_DELETED); + if(((Creature*)charm)->HasSummonMask(SUMMON_MASK_PUPPET)) + ((Puppet*)charm)->UnSummon(); } if(GetCharmGUID()) { diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 052d98f56c8..7389f9b7906 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2405,7 +2405,7 @@ enum SummonCategory SUMMON_CATEGORY_WILD = 0, SUMMON_CATEGORY_ALLY = 1, SUMMON_CATEGORY_PET = 2, - SUMMON_CATEGORY_POSSESSED = 3, + SUMMON_CATEGORY_PUPPET = 3, SUMMON_CATEGORY_VEHICLE = 4, }; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d25aa7ac1fd..abf4a5e897f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2985,21 +2985,11 @@ void Spell::finish(bool ok) // Unsummon summon as possessed creatures on spell cancel if(IsChanneledSpell(m_spellInfo) && m_caster->GetTypeId() == TYPEID_PLAYER) { - if (Unit * charm = m_caster->GetCharm()) - for(int i = 0; i < 3; ++i) - { - if(m_spellInfo->Effect[i] == SPELL_EFFECT_SUMMON) - if(SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i])) - if(SummonProperties->Category == SUMMON_CATEGORY_POSSESSED) - { - if(charm->GetTypeId() == TYPEID_UNIT) - { - if(((Creature*)charm)->isPet() && ((Pet*)charm)->getPetType() == POSSESSED_PET) - ((Pet*)charm)->Remove(PET_SAVE_AS_DELETED); - break; - } - } - } + if(Unit *charm = m_caster->GetCharm()) + if(charm->GetTypeId() == TYPEID_UNIT + && ((Creature*)charm)->HasSummonMask(SUMMON_MASK_PUPPET) + && charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id) + ((Puppet*)charm)->UnSummon(); } // other code related only to successfully finished spells @@ -4544,7 +4534,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SUMMON_CATEGORY_PET: if(m_caster->GetPetGUID()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; - case SUMMON_CATEGORY_POSSESSED: + case SUMMON_CATEGORY_PUPPET: if(m_caster->GetCharmGUID()) return SPELL_FAILED_ALREADY_HAVE_CHARM; break; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index b5f0fe6ef47..961dd3aa9e9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3367,23 +3367,9 @@ void Spell::EffectSummonType(uint32 i) case SUMMON_CATEGORY_PET: SummonGuardian(entry, properties); break; - case SUMMON_CATEGORY_POSSESSED: - { - if(m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - float x, y, z; - m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - - int32 duration = GetSpellDuration(m_spellInfo); - - Pet* pet = ((Player*)m_caster)->SummonPet(entry, x, y, z, m_caster->GetOrientation(), POSSESSED_PET, duration); - if(!pet) - return; - - pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); + case SUMMON_CATEGORY_PUPPET: + summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), properties, duration, m_originalCaster); break; - } case SUMMON_CATEGORY_VEHICLE: { float x, y, z; @@ -4877,6 +4863,21 @@ void Spell::EffectScriptEffect(uint32 effIndex) m_originalCaster->CastSpell(m_originalCaster, damage, false); break; } + // Summon Ghouls On Scarlet Crusade + case 51904: + { + if(!m_targets.HasDst()) + return; + + float x, y, z; + float radius = GetSpellRadius(m_spellInfo, effIndex, true); + for(uint32 i = 0; i < 15; ++i) + { + m_caster->GetRandomPoint(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, radius, x, y, z); + m_caster->CastSpell(x, y, z, 54522, true); + } + break; + } // Death Gate case 52751: { diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 993ece988a0..5c7ca2a48ea 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -314,3 +314,43 @@ void Guardian::InitStats(uint32 duration) SetReactState(REACT_AGGRESSIVE); } + +Puppet::Puppet(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner) +{ + assert(owner->GetTypeId() == TYPEID_PLAYER); + m_owner = (Player*)owner; + m_summonMask |= SUMMON_MASK_PUPPET; + InitCharmInfo(); +} + +void Puppet::InitStats(uint32 duration) +{ + Minion::InitStats(duration); + + m_charmInfo->InitPossessCreateSpells(); + SetReactState(REACT_PASSIVE); +} + +void Puppet::InitSummon() +{ + Minion::InitSummon(); + SetCharmedOrPossessedBy(m_owner, true); +} + +void Puppet::Update(uint32 time) +{ + Minion::Update(time); + //check if caster is channelling? + if(IsInWorld()) + { + } +} + +void Puppet::RemoveFromWorld() +{ + if(!IsInWorld()) + return; + + RemoveCharmedOrPossessedBy(NULL); + Minion::RemoveFromWorld(); +} diff --git a/src/game/TemporarySummon.h b/src/game/TemporarySummon.h index e089c77c96e..f434b1d9dfb 100644 --- a/src/game/TemporarySummon.h +++ b/src/game/TemporarySummon.h @@ -71,5 +71,17 @@ class Guardian : public Minion int32 m_bonusdamage; }; +class Puppet : public Minion +{ + public: + Puppet(SummonPropertiesEntry const *properties, Unit *owner); + void InitStats(uint32 duration); + void InitSummon(); + void Update(uint32 time); + void RemoveFromWorld(); + protected: + Player *m_owner; +}; + #endif diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9fce2306774..dc0dfb7d102 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8341,7 +8341,7 @@ void Unit::SetMinion(Minion *minion, bool apply) } } - //if(minion->HasSummonMask(SUMMON_MASK_GUARDIAN)) + if(minion->HasSummonMask(SUMMON_MASK_GUARDIAN)) { if(AddUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID())) { @@ -8470,7 +8470,8 @@ void Unit::SetCharm(Unit* charm, bool apply) if(!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) sLog.outCrash("Unit %u is being uncharmed, but it has another charmer %u", charm->GetEntry(), charm->GetCharmerGUID()); - m_Controlled.erase(charm); + if(!charm->GetOwnerGUID() == GetGUID()) + m_Controlled.erase(charm); } } |