diff options
-rwxr-xr-x | src/server/game/AI/CoreAI/UnitAI.h | 2 | ||||
-rwxr-xr-x | src/server/game/AI/CreatureAI.cpp | 3 | ||||
-rwxr-xr-x | src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/AI/EventAI/CreatureEventAIMgr.h | 6 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 2 | ||||
-rwxr-xr-x | src/server/game/Entities/Item/Item.cpp | 3 | ||||
-rwxr-xr-x | src/server/game/Entities/Pet/Pet.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Entities/Transport/Transport.cpp | 11 | ||||
-rwxr-xr-x | src/server/game/Entities/Vehicle/Vehicle.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Entities/Vehicle/Vehicle.h | 2 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 23 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellMgr.cpp | 2 |
12 files changed, 33 insertions, 31 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 29804fb2899..6c3f2264473 100755 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -120,7 +120,7 @@ class UnitAI virtual void DoAction(int32 const /*param*/) {} virtual uint32 GetData(uint32 /*id = 0*/) { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} - virtual void SetGUID(uint64 const/*guid*/, int32 /*id*/ = 0) {} + virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {} virtual uint64 GetGUID(int32 /*id*/ = 0) { return 0; } Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 1932710a43e..ee822d9df40 100755 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -22,6 +22,9 @@ #include "World.h" #include "SpellMgr.h" #include "Vehicle.h" +#include "Log.h" +#include "MapReference.h" +#include "Player.h" //Disable CreatureAI when charmed void CreatureAI::OnCharmed(bool /*apply*/) diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 3f1b2d71da1..6c3765252f0 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -68,7 +68,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() continue; } - // range negative (don't must be happen, loaded from same table) + // range negative (must not happen, loaded from same table) if (!sObjectMgr->GetTrinityStringLocale(i)) { sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i); diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.h b/src/server/game/AI/EventAI/CreatureEventAIMgr.h index 18cb1fb2f0d..50af460541f 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.h +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.h @@ -25,10 +25,12 @@ class CreatureEventAIMgr { friend class ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>; - CreatureEventAIMgr(){}; - public: + + private: + CreatureEventAIMgr(){}; ~CreatureEventAIMgr(){}; + public: void LoadCreatureEventAI_Texts(); void LoadCreatureEventAI_Summons(); void LoadCreatureEventAI_Scripts(); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index e26d125b442..5a41de6becc 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -157,7 +157,7 @@ class SmartAI : public CreatureAI void SetData(uint32 id, uint32 value); // Used in scripts to share variables - void SetGUID(const uint64 guid, int32 id = 0); + void SetGUID(uint64 guid, int32 id = 0); // Used in scripts to share variables uint64 GetGUID(int32 id = 0); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 0478bf6a71b..efc5bbcbebc 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -438,8 +438,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr need_save = true; } - std::string enchants = fields[6].GetString(); - _LoadIntoDataField(enchants.c_str(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET); + _LoadIntoDataField(fields[6].GetCString(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET); SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].GetInt16()); // recalculate suffix factor if (GetItemRandomPropertyId() < 0) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 0f8da71ccaa..bea3395c860 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -266,13 +266,13 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c // Send fake summon spell cast - this is needed for correct cooldown application for spells // Example: 46584 - without this cooldown (which should be set always when pet is loaded) isn't set clientside // TODO: pets should be summoned from real cast instead of just faking it? - if (GetUInt32Value(UNIT_CREATED_BY_SPELL)) + if (summon_spell_id) { WorldPacket data(SMSG_SPELL_GO, (8+8+4+4+2)); data.append(owner->GetPackGUID()); data.append(owner->GetPackGUID()); data << uint8(0); - data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); + data << uint32(summon_spell_id); data << uint32(256); // CAST_FLAG_UNKNOWN3 data << uint32(0); owner->SendMessageToSet(&data, true); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 577bc63fbb8..705ce0aac6f 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -52,21 +52,17 @@ void MapManager::LoadTransports() uint32 period = fields[3].GetUInt32(); uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString()); - Transport *t = new Transport(period, scriptId); - const GameObjectTemplate *goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str()); - delete t; continue; } if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT) { sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str()); - delete t; continue; } @@ -74,6 +70,7 @@ void MapManager::LoadTransports() std::set<uint32> mapsUsed; + Transport *t = new Transport(period, scriptId); if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed)) // skip transports with empty waypoints list { @@ -119,7 +116,7 @@ void MapManager::LoadTransports() uint32 guid = fields[0].GetUInt32(); uint32 entry = fields[1].GetUInt32(); std::string name = fields[2].GetString(); - sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid); + sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid); } while (result->NextRow()); } @@ -173,10 +170,10 @@ void MapManager::LoadTransportNPCs() sLog->outString(); } -Transport::Transport(uint32 period, uint32 script) : GameObject(), m_period(period), ScriptId(script) +Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), +currenttguid(0), m_period(period), ScriptId(script), m_nextNodeTime(0) { m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION); - currenttguid = 0; } Transport::~Transport() diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 6d84d78f095..bbba91b2658 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -187,13 +187,13 @@ void Vehicle::RemoveAllPassengers() // Passengers always cast an aura with SPELL_AURA_CONTROL_VEHICLE on the vehicle // We just remove the aura and the unapply handler will make the target leave the vehicle. - // We don't need to iterate over m_Seats + // We don't need to iterate over Seats _me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE); // Following the above logic, this assertion should NEVER fail. // Even in 'hacky' cases, there should at least be VEHICLE_SPELL_RIDE_HARDCODED on us. // SeatMap::const_iterator itr; - // for (itr = m_Seats.begin(); itr != m_Seats.end(); ++itr) + // for (itr = Seats.begin(); itr != Seats.end(); ++itr) // ASSERT(!itr->second.passenger); } diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 6838d9edaec..49e04d6223a 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -118,7 +118,7 @@ class Vehicle Unit* GetBase() const { return _me; } VehicleEntry const* GetVehicleInfo() const { return _vehicleInfo; } - uint32 const GetCreatureEntry() const { return _creatureEntry; } + uint32 GetCreatureEntry() const { return _creatureEntry; } bool HasEmptySeat(int8 seatId) const; Unit* GetPassenger(int8 seatId) const; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 32859cb3a19..e5098c6b493 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1185,9 +1185,13 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (unitTarget->GetEntry() != 29402) return; - m_caster->SummonGameObject(192693, unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), unitTarget->GetOrientation(), 0, 0, 0, 0, 100); + m_caster->SummonGameObject(192693, unitTarget->GetPositionX(), unitTarget->GetPositionY(), + unitTarget->GetPositionZ(), unitTarget->GetOrientation(), 0, 0, 0, 0, 100); + for (uint8 i = 0; i < 4; ++i) - m_caster->SummonGameObject(191567, float(unitTarget->GetPositionX() + irand(-7, 7)), float(unitTarget->GetPositionY() + irand(-7, 7)), unitTarget->GetPositionZ(), unitTarget->GetOrientation(), 0, 0, 0, 0, 100); + m_caster->SummonGameObject(191567, float(unitTarget->GetPositionX() + irand(-7, 7)), + float(unitTarget->GetPositionY() + irand(-7, 7)), unitTarget->GetPositionZ(), unitTarget->GetOrientation(), + 0, 0, 0, 0, 100); unitTarget->Kill(unitTarget); return; @@ -1394,7 +1398,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (AuraEffect *dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1)) AddPctN(damage, dummy->GetAmount()); - m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); + m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); return; } // Mana Spring Totem @@ -3706,9 +3710,8 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) Player* owner = NULL; if (m_originalCaster) { - if (m_originalCaster->GetTypeId() == TYPEID_PLAYER) - owner = (Player*)m_originalCaster; - else if (m_originalCaster->ToCreature()->isTotem()) + owner = m_originalCaster->ToPlayer(); + if (!owner && m_originalCaster->ToCreature()->isTotem()) owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself(); } @@ -3845,9 +3848,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex /*effIndex*/) void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex) { - if (!unitTarget) - return; - if (!unitTarget->isAlive()) + if (!unitTarget || !unitTarget->isAlive()) return; // multiple weapon dmg effect workaround @@ -6366,7 +6367,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (m_caster->GetTypeId() == TYPEID_PLAYER) { pGameObj->AddUniqueUse(m_caster->ToPlayer()); - m_caster->AddGameObject(pGameObj); // will removed at spell cancel + m_caster->AddGameObject(pGameObj); // will be removed at spell cancel } break; } @@ -6961,7 +6962,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex) uint32 button_id = m_spellInfo->Effects[effIndex].MiscValue + 132; uint32 n_buttons = m_spellInfo->Effects[effIndex].MiscValueB; - for (; n_buttons; n_buttons--, button_id++) + for (; n_buttons; --n_buttons, ++button_id) { ActionButton const* ab = p_caster->GetActionButton(button_id); if (!ab || ab->GetType() != ACTION_BUTTON_SPELL) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c3218743315..802e37e89ad 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3345,4 +3345,4 @@ void SpellMgr::LoadDbcDataCorrections() sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); -}
\ No newline at end of file +} |