diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-04-28 23:00:41 +0200 |
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-04-28 23:00:41 +0200 |
| commit | 65ae868cc813adc7e2d319c017ed61e87257fb40 (patch) | |
| tree | 40be11a5322720de8ec793909ed74c25b812879b /src/server/game | |
| parent | f4fd258ad1e3831ab157aebc01db34726bce61a8 (diff) | |
| parent | ba8959b733a49c5f51585636bdcf5fe822e970df (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Entities/Pet/Pet.cpp
src/server/game/Entities/Player/Player.cpp
src/server/scripts/Commands/cs_npc.cpp
src/server/scripts/Commands/cs_wp.cpp
src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
Diffstat (limited to 'src/server/game')
30 files changed, 179 insertions, 267 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 5949484cd23..6c250fdfba6 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -972,7 +972,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); + (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature); delete targets; break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 78a26e7e836..e69a11d57e5 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -453,7 +453,7 @@ enum SMART_ACTION SMART_ACTION_CALL_KILLEDMONSTER = 33, // CreatureId, SMART_ACTION_SET_INST_DATA = 34, // Field, Data SMART_ACTION_SET_INST_DATA64 = 35, // Field, - SMART_ACTION_UPDATE_TEMPLATE = 36, // Entry, Team + SMART_ACTION_UPDATE_TEMPLATE = 36, // Entry SMART_ACTION_DIE = 37, // No Params SMART_ACTION_SET_IN_COMBAT_WITH_ZONE = 38, // No Params SMART_ACTION_CALL_FOR_HELP = 39, // Radius, With Emote @@ -702,7 +702,6 @@ struct SmartAction struct { uint32 creature; - uint32 team; } updateTemplate; struct diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 8a5c6937ca0..d8f61a22314 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -348,13 +348,8 @@ bool AccountMgr::normalizeString(std::string& utf8String) size_t maxLength = MAX_ACCOUNT_STR; if (!Utf8toWStr(utf8String, buffer, maxLength)) return false; -#ifdef _MSC_VER -#pragma warning(disable: 4996) -#endif + std::transform(&buffer[0], buffer+maxLength, &buffer[0], wcharToUpperOnlyLatin); -#ifdef _MSC_VER -#pragma warning(default: 4996) -#endif return WStrToUtf8(buffer, maxLength, utf8String); } diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index bd5ffc057dc..a136ed8a438 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -783,7 +783,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, const Position& pos, TeamId t return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team); } -Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team) +Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId /*team*/) { //Get map object Map* map = sMapMgr->CreateBaseMap(m_MapId); @@ -794,7 +794,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl } Creature* creature = new Creature(); - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, x, y, z, o)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; @@ -809,9 +809,6 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: entry %u does not exist.", entry); return NULL; } - // force using DB speeds -- do we really need this? - creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); - creature->SetSpeed(MOVE_RUN, cinfo->speed_run); // Set creature in world map->AddToMap(creature); diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 1781209e779..4e2e28f124c 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -287,7 +287,7 @@ class Battlefield : public ZoneScript BfGraveyard* GetGraveyardById(uint32 id) const; // Misc methods - Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); + virtual Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); Creature* SpawnCreature(uint32 entry, const Position& pos, TeamId team); GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 2ab98795f36..24e01cf5b37 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1652,7 +1652,7 @@ void Battleground::SpawnBGObject(uint32 type, uint32 respawntime) } } -Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime) +Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId /*teamId = TEAM_NEUTRAL*/, uint32 respawntime /*= 0*/) { // If the assert is called, means that BgCreatures must be resized! ASSERT(type < BgCreatures.size()); @@ -1662,7 +1662,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f return NULL; Creature* creature = new Creature(); - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, x, y, z, o)) { TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); @@ -1680,9 +1680,6 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f delete creature; return NULL; } - // Force using DB speeds - creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); - creature->SetSpeed(MOVE_RUN, cinfo->speed_run); if (!map->AddToMap(creature)) { @@ -1698,9 +1695,9 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f return creature; } -Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, Position const& pos, uint32 respawntime /*= 0*/) +Creature* Battleground::AddCreature(uint32 entry, uint32 type, Position const& pos, TeamId teamId /*= TEAM_NEUTRAL*/, uint32 respawntime /*= 0*/) { - return AddCreature(entry, type, teamval, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), respawntime); + return AddCreature(entry, type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamId, respawntime); } bool Battleground::DelCreature(uint32 type) @@ -1739,13 +1736,11 @@ bool Battleground::DelObject(uint32 type) return false; } -bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team) +bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId /*= TEAM_NEUTRAL*/) { - uint32 entry = (team == ALLIANCE) ? - BG_CREATURE_ENTRY_A_SPIRITGUIDE : - BG_CREATURE_ENTRY_H_SPIRITGUIDE; + uint32 entry = (teamId == TEAM_ALLIANCE) ? BG_CREATURE_ENTRY_A_SPIRITGUIDE : BG_CREATURE_ENTRY_H_SPIRITGUIDE; - if (Creature* creature = AddCreature(entry, type, team, x, y, z, o)) + if (Creature* creature = AddCreature(entry, type, x, y, z, o, teamId)) { creature->setDeathState(DEAD); creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID()); @@ -1766,6 +1761,11 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float return false; } +bool Battleground::AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId /*= TEAM_NEUTRAL*/) +{ + return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamId); +} + void Battleground::SendMessageToAll(int32 entry, ChatMsg type, Player const* source) { if (!entry) diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 0aad3f24c6c..2feb15e2ee6 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -513,13 +513,14 @@ class Battleground BGObjects BgObjects; BGCreatures BgCreatures; void SpawnBGObject(uint32 type, uint32 respawntime); - bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); + virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); bool AddObject(uint32 type, uint32 entry, Position const& pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); - Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0); - Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, Position const& pos, uint32 respawntime = 0); + virtual Creature* AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL, uint32 respawntime = 0); + Creature* AddCreature(uint32 entry, uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL, uint32 respawntime = 0); bool DelCreature(uint32 type); bool DelObject(uint32 type); - bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team); + virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL); + bool AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL); int32 GetObjectType(uint64 guid); void DoorOpen(uint32 type); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index c05bd98b908..38b0e3e084b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -23,7 +23,6 @@ #include "BattlegroundMgr.h" #include "Creature.h" #include "Language.h" -#include "Object.h" #include "Player.h" #include "Util.h" #include "WorldSession.h" @@ -381,7 +380,7 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node) void BattlegroundAB::_NodeOccupied(uint8 node, Team team) { - if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team)) + if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node], GetTeamIndexByTeamId(team))) TC_LOG_ERROR("bg.battleground", "Failed to spawn spirit guide! point: %u, team: %u, ", node, team); if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points @@ -397,9 +396,9 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team) if (capturedNodes >= 4) CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team); - Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL;//0-6 spirit guides + Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL; // 0-6 spirit guides if (!trigger) - trigger = AddCreature(WORLD_TRIGGER, node+7, team, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]); + trigger = AddCreature(WORLD_TRIGGER, node+7, BG_AB_NodePositions[node], GetTeamIndexByTeamId(team)); //add bonus honor aura trigger creature when node is accupied //cast bonus aura (+50% honor in 25yards) @@ -578,34 +577,33 @@ bool BattlegroundAB::SetupBattleground() { for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { - if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) -) + if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)) { TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn some object Battleground not created!"); return false; } } + if (!AddObject(BG_AB_OBJECT_GATE_A, BG_AB_OBJECTID_GATE_A, BG_AB_DoorPositions[0][0], BG_AB_DoorPositions[0][1], BG_AB_DoorPositions[0][2], BG_AB_DoorPositions[0][3], BG_AB_DoorPositions[0][4], BG_AB_DoorPositions[0][5], BG_AB_DoorPositions[0][6], BG_AB_DoorPositions[0][7], RESPAWN_IMMEDIATELY) - || !AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY) -) + || !AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY)) { TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn door object Battleground not created!"); return false; } + //buffs for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) -) + || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)) TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn buff object!"); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 9ed34691adf..9abc7627b24 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -20,6 +20,7 @@ #define __BATTLEGROUNDAB_H #include "Battleground.h" +#include "Object.h" enum BG_AB_WorldStates { @@ -184,8 +185,7 @@ enum BG_AB_Objectives #define AB_EVENT_START_BATTLE 9158 // Achievement: Let's Get This Done -// x, y, z, o -const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = +Position const BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT] = { {1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables {977.0156f, 1046.616f, -44.80923f, -2.600541f}, // blacksmith @@ -218,8 +218,7 @@ const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {1146.62f, 816.94f, -98.49f, 6.14f} // gold mine }; -// x, y, z, o -const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = +Position const BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT] = { {1200.03f, 1171.09f, -56.47f, 5.15f}, // stables {1017.43f, 960.61f, -42.95f, 4.88f}, // blacksmith diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 610e0bcecc7..16576aa888e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -289,7 +289,6 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) cinfoid=uint16(BG_AV_StaticCreaturePos[type][4]); creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0], (type+AV_CPLACE_MAX), - BG_AV_StaticCreatureInfo[cinfoid][1], BG_AV_StaticCreaturePos[type][0], BG_AV_StaticCreaturePos[type][1], BG_AV_StaticCreaturePos[type][2], @@ -303,11 +302,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) { creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0], type, - BG_AV_CreatureInfo[cinfoid][1], - BG_AV_CreaturePos[type][0], - BG_AV_CreaturePos[type][1], - BG_AV_CreaturePos[type][2], - BG_AV_CreaturePos[type][3]); + BG_AV_CreaturePos[type]); level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3]) ? BG_AV_CreatureInfo[cinfoid][2] : urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]); @@ -365,11 +360,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) { if (Creature* trigger = AddCreature(WORLD_TRIGGER, triggerSpawnID, - BG_AV_CreatureInfo[creature->GetEntry()][1], - BG_AV_CreaturePos[triggerSpawnID][0], - BG_AV_CreaturePos[triggerSpawnID][1], - BG_AV_CreaturePos[triggerSpawnID][2], - BG_AV_CreaturePos[triggerSpawnID][3])) + BG_AV_CreaturePos[triggerSpawnID])) { trigger->setFaction(newFaction); trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); @@ -782,7 +773,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) //spiritguide if (BgCreatures[node]) DelCreature(node); - if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) + if (!AddSpiritGuide(node, BG_AV_CreaturePos[node], GetTeamIndexByTeamId(owner))) TC_LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node %i", node); } for (uint8 i=0; i<4; i++) @@ -795,11 +786,8 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) { trigger = AddCreature(WORLD_TRIGGER, node + 302, - owner, - BG_AV_CreaturePos[node + 302][0], - BG_AV_CreaturePos[node + 302][1], - BG_AV_CreaturePos[node + 302][2], - BG_AV_CreaturePos[node + 302][3]); + BG_AV_CreaturePos[node + 302], + GetTeamIndexByTeamId(owner)); } //add bonus honor aura trigger creature when node is accupied @@ -1219,15 +1207,10 @@ WorldSafeLocsEntry const* BattlegroundAV::GetClosestGraveYard(Player* player) bool BattlegroundAV::SetupBattleground() { // Create starting objects - if ( - // alliance gates - !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, - BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], - 0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY) + if (// alliance gates + !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0], 0, 0, std::sin(BG_AV_DoorPositons[0].GetOrientation()/2), std::cos(BG_AV_DoorPositons[0].GetOrientation()/2), RESPAWN_IMMEDIATELY) // horde gates - || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, - BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], - 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) + || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1], 0, 0, std::sin(BG_AV_DoorPositons[1].GetOrientation()/2), std::cos(BG_AV_DoorPositons[1].GetOrientation()/2), RESPAWN_IMMEDIATELY)) { TC_LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1"); return false; @@ -1504,8 +1487,8 @@ bool BattlegroundAV::SetupBattleground() AddAVCreature(0, i + AV_CPLACE_MAX); //mainspiritguides: TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning spiritguides creatures"); - AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE); - AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE); + AddSpiritGuide(7, BG_AV_CreaturePos[7], TEAM_ALLIANCE); + AddSpiritGuide(8, BG_AV_CreaturePos[8], TEAM_HORDE); //spawn the marshals (those who get deleted, if a tower gets destroyed) TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning marshal creatures"); for (i = AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 716e675a840..03dd0ffcf5c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -20,6 +20,7 @@ #define __BATTLEGROUNDAV_H #include "Battleground.h" +#include "Object.h" #define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!" #define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!" @@ -528,7 +529,7 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = {-951.394f, -193.695f, 67.634f, 0.802851f} }; -const float BG_AV_DoorPositons[2][4] = +Position const BG_AV_DoorPositons[2] = { {780.487f, -493.024f, 99.9553f, 3.0976f}, //alliance {-1375.193f, -538.981f, 55.2824f, 0.72178f} //horde @@ -624,8 +625,7 @@ enum BG_AV_CreaturePlace AV_CPLACE_MAX = 321 }; -//x, y, z, o -const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = +Position const BG_AV_CreaturePos[AV_CPLACE_MAX] = { //spiritguides {643.000000f, 44.000000f, 69.740196f, -0.001854f}, diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 3eb52945236..9e9e82b32b8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -223,16 +223,16 @@ bool BattlegroundDS::SetupBattleground() // gates if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95f, 817.2f, 20.8096f, 3.15f, 0, 0, 0.99627f, 0.0862864f, RESPAWN_IMMEDIATELY) || !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65f, 764.913f, 20.0729f, 6.3f, 0, 0, 0.0310211f, -0.999519f, RESPAWN_IMMEDIATELY) - // water + // water || !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120) || !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120) - // buffs + // buffs || !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120) || !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120) - // knockback creatures - || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_WATERFALL_KNOCKBACK, 0, 1292.587f, 790.2205f, 7.19796f, 3.054326f, RESPAWN_IMMEDIATELY) - || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY) - || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY)) + // knockback creatures + || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_WATERFALL_KNOCKBACK, 1292.587f, 790.2205f, 7.19796f, 3.054326f, TEAM_NEUTRAL, RESPAWN_IMMEDIATELY) + || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, TEAM_NEUTRAL, RESPAWN_IMMEDIATELY) + || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 1212.833f, 765.3871f, 16.09484f, 0.0f, TEAM_NEUTRAL, RESPAWN_IMMEDIATELY)) { TC_LOG_ERROR("sql.sql", "BatteGroundDS: Failed to spawn some object!"); return false; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index bc684aed176..213a91bea88 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -23,7 +23,6 @@ #include "BattlegroundMgr.h" #include "Creature.h" #include "Language.h" -#include "Object.h" #include "Player.h" #include "Util.h" @@ -523,14 +522,14 @@ bool BattlegroundEY::SetupBattleground() WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE); - if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) + if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, TEAM_ALLIANCE)) { TC_LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); return false; } sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE); - if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) + if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE)) { TC_LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); return false; @@ -768,7 +767,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); - if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) + if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, GetTeamIndexByTeamId(Team))) TC_LOG_ERROR("bg.battleground", "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", Point, Team, m_CapturingPointTypes[Point].GraveYardId); @@ -782,7 +781,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) Creature* trigger = GetBGCreature(Point + 6, false);//0-5 spirit guides if (!trigger) - trigger = AddCreature(WORLD_TRIGGER, Point+6, Team, BG_EY_TriggerPositions[Point][0], BG_EY_TriggerPositions[Point][1], BG_EY_TriggerPositions[Point][2], BG_EY_TriggerPositions[Point][3]); + trigger = AddCreature(WORLD_TRIGGER, Point+6, BG_EY_TriggerPositions[Point], GetTeamIndexByTeamId(Team)); //add bonus honor aura trigger creature when node is accupied //cast bonus aura (+50% honor in 25yards) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index baa75129c1e..9e5088d7ba5 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -19,8 +19,9 @@ #ifndef __BATTLEGROUNDEY_H #define __BATTLEGROUNDEY_H -#include "Language.h" #include "Battleground.h" +#include "Language.h" +#include "Object.h" enum BG_EY_Misc { @@ -255,8 +256,7 @@ struct BattlegroundEYPointIconsStruct uint32 WorldStateHordeControlledIndex; }; -// x, y, z, o -const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = +Position const BG_EY_TriggerPositions[EY_POINTS_MAX] = { {2044.28f, 1729.68f, 1189.96f, 0.017453f}, // FEL_REAVER center {2048.83f, 1393.65f, 1194.49f, 0.20944f}, // BLOOD_ELF center diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 7940aaf0585..9e9cc6c63ee 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -369,20 +369,20 @@ bool BattlegroundIC::SetupBattleground() for (uint8 i = 2; i < MAX_NORMAL_NPCS_SPAWNS; ++i) { - if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].team, + if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y, BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o, - RESPAWN_ONE_DAY)) + BG_IC_NpcSpawnlocs[i].team, RESPAWN_ONE_DAY)) { TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry); return false; } } - if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+5, BG_IC_SpiritGuidePos[5][0], BG_IC_SpiritGuidePos[5][1], BG_IC_SpiritGuidePos[5][2], BG_IC_SpiritGuidePos[5][3], ALLIANCE) - || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+6, BG_IC_SpiritGuidePos[6][0], BG_IC_SpiritGuidePos[6][1], BG_IC_SpiritGuidePos[6][2], BG_IC_SpiritGuidePos[6][3], HORDE) - || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], ALLIANCE) - || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], HORDE)) + if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+5, BG_IC_SpiritGuidePos[5], TEAM_ALLIANCE) + || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+6, BG_IC_SpiritGuidePos[6], TEAM_HORDE) + || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7], TEAM_ALLIANCE) + || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8], TEAM_HORDE)) { TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn initial spirit guide!"); return false; @@ -607,10 +607,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) { if (nodePoint->nodeType != NODE_TYPE_REFINERY && nodePoint->nodeType != NODE_TYPE_QUARRY) { - if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2, - BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1], - BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3], - (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE))) + if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2, BG_IC_SpiritGuidePos[nodePoint->nodeType], nodePoint->faction)) TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction); } @@ -625,9 +622,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) { uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u; if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), - BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), - BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), - 0, 0, 0, 0, RESPAWN_ONE_DAY)) + BG_IC_HangarTeleporters[u], 0, 0, 0, 0, RESPAWN_ONE_DAY)) { TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1+u); } @@ -688,11 +683,9 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive()) continue; - if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, nodePoint->faction, - BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(), - BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(), - RESPAWN_ONE_DAY)) - GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); + if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, + BG_IC_DocksVehiclesGlaives[i], nodePoint->faction, RESPAWN_ONE_DAY)) + GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); } // spawning catapults @@ -703,11 +696,8 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive()) continue; - if (AddCreature(NPC_CATAPULT, type, nodePoint->faction, - BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(), - BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(), - RESPAWN_ONE_DAY)) - GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); + if (AddCreature(NPC_CATAPULT, type, BG_IC_DocksVehiclesCatapults[i], nodePoint->faction, RESPAWN_ONE_DAY)) + GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); } break; case BG_IC_GO_WORKSHOP_BANNER: @@ -738,10 +728,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive()) continue; - if (AddCreature(NPC_DEMOLISHER, type, nodePoint->faction, - BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(), - BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(), - RESPAWN_ONE_DAY)) + if (AddCreature(NPC_DEMOLISHER, type, BG_IC_WorkshopVehicles[i], nodePoint->faction, RESPAWN_ONE_DAY)) GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); } @@ -761,10 +748,8 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H); if (!GetBGCreature(siegeType, false) || !GetBGCreature(siegeType)->IsAlive()) { - AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, nodePoint->faction, - BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), - BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(), - RESPAWN_ONE_DAY); + AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, + BG_IC_WorkshopVehicles[4], nodePoint->faction, RESPAWN_ONE_DAY); if (Creature* siegeEngine = GetBGCreature(siegeType)) { @@ -784,7 +769,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i)) { seaforiumBombs->SetRespawnTime(10); - seaforiumBombs->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); + seaforiumBombs->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); } } break; @@ -830,12 +815,12 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) if (go->GetEntry() == GO_HORDE_GATE_1 || go->GetEntry() == GO_HORDE_GATE_2 || go->GetEntry() == GO_HORDE_GATE_3) { - if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].team, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].o, RESPAWN_ONE_DAY)) + if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].o, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].team, RESPAWN_ONE_DAY)) TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry); } else if (go->GetEntry() == GO_ALLIANCE_GATE_1 || go->GetEntry() == GO_ALLIANCE_GATE_2 || go->GetEntry() == GO_ALLIANCE_GATE_3) { - if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].team, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].o, RESPAWN_ONE_DAY)) + if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].o, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].team, RESPAWN_ONE_DAY)) TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 9bed8cdc2cd..091a75e7449 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -204,7 +204,7 @@ struct ICNpc { uint32 type; uint32 entry; - uint32 team; + TeamId team; float x; float y; float z; @@ -783,7 +783,7 @@ const uint32 BG_IC_GraveyardIds[MAX_NODE_TYPES+2] = {0, 0, 1480, 1481, 1482, 148 const Position TransportMovementInfo = {7.305609f, -0.095246f, 34.51022f, 0.0f}; const Position TeleportToTransportPosition = {661.0f, -1244.0f, 288.0f, 0.0f}; -const float BG_IC_SpiritGuidePos[MAX_NODE_TYPES+2][4] = +Position const BG_IC_SpiritGuidePos[MAX_NODE_TYPES+2] = { {0.0f, 0.0f, 0.0f, 0.0f}, // no grave {0.0f, 0.0f, 0.0f, 0.0f}, // no grave @@ -819,7 +819,7 @@ struct ICNodePoint { uint32 gameobject_type; // with this we will get the GameObject of that point uint32 gameobject_entry; // what gameobject entry is active here. - uint8 faction; // who has this node + TeamId faction; // who has this node ICNodePointType nodeType; // here we can specify if it is graveyards, hangar etc... uint32 banners[4]; // the banners that have this point bool needChange; // this is used for the 1 minute time period after the point is captured diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 470bc549be5..c2586e8aa64 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -103,7 +103,7 @@ bool BattlegroundSA::ResetObjs() for (uint8 i = 0; i < 6; i++) GateStatus[i] = BG_SA_GATE_OK; - AddCreature(BG_SA_NpcEntries[BG_SA_NPC_KANRETHAD], BG_SA_NPC_KANRETHAD, 0, BG_SA_NpcSpawnlocs[BG_SA_NPC_KANRETHAD]); + AddCreature(BG_SA_NpcEntries[BG_SA_NPC_KANRETHAD], BG_SA_NPC_KANRETHAD, BG_SA_NpcSpawnlocs[BG_SA_NPC_KANRETHAD]); for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++) { @@ -148,7 +148,7 @@ bool BattlegroundSA::ResetObjs() //By capturing GYs. for (uint8 i = 0; i < BG_SA_DEMOLISHER_5; i++) { - if (!AddCreature(BG_SA_NpcEntries[i], i, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), BG_SA_NpcSpawnlocs[i], 600)) + if (!AddCreature(BG_SA_NpcEntries[i], i, BG_SA_NpcSpawnlocs[i], Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE, 600)) return false; } @@ -185,12 +185,12 @@ bool BattlegroundSA::ResetObjs() if (i == BG_SA_BEACH_GY) { GraveyardStatus[i] = Attackers; - AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE)? HORDE : ALLIANCE)); + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], Attackers); } else { GraveyardStatus[i] = ((Attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE); - if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE)? ALLIANCE : HORDE))) + if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], Attackers == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE)) TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn GY: %u", i); } } @@ -681,7 +681,7 @@ void BattlegroundSA::DemolisherStartState(bool start) } } -void BattlegroundSA::DestroyGate(Player* player, GameObject* go) +void BattlegroundSA::DestroyGate(Player* /*player*/, GameObject* /*go*/) { } @@ -766,7 +766,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) return; } - AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], GraveyardStatus[i]); uint32 npc = 0; uint32 flag = 0; @@ -779,20 +779,19 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) BG_SA_ObjSpawnlocs[flag], 0, 0, 0, 0, RESPAWN_ONE_DAY); npc = BG_SA_NPC_RIGSPARK; - if (Creature* rigspark = AddCreature(BG_SA_NpcEntries[npc], npc, Attackers, BG_SA_NpcSpawnlocs[npc])) + if (Creature* rigspark = AddCreature(BG_SA_NpcEntries[npc], npc, BG_SA_NpcSpawnlocs[npc], Attackers)) rigspark->AI()->Talk(TEXT_SPARKLIGHT_RIGSPARK_SPAWN); for (uint8 j = BG_SA_DEMOLISHER_7; j <= BG_SA_DEMOLISHER_8; j++) { - AddCreature(BG_SA_NpcEntries[j], j, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), - BG_SA_NpcSpawnlocs[j], 600); + AddCreature(BG_SA_NpcEntries[j], j, BG_SA_NpcSpawnlocs[j], (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), 600); if (Creature* dem = GetBGCreature(j)) dem->setFaction(BG_SA_Factions[Attackers]); } - UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); - UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); + UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[i] == TEAM_ALLIANCE); + UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[i] == TEAM_HORDE); if (Creature* c = Source->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f)) SendChatMessage(c, Source->GetTeamId() == TEAM_ALLIANCE ? TEXT_WEST_GRAVEYARD_CAPTURED_A : TEXT_WEST_GRAVEYARD_CAPTURED_H, Source); @@ -805,20 +804,19 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) BG_SA_ObjSpawnlocs[flag], 0, 0, 0, 0, RESPAWN_ONE_DAY); npc = BG_SA_NPC_SPARKLIGHT; - if (Creature* sparklight = AddCreature(BG_SA_NpcEntries[npc], npc, Attackers, BG_SA_NpcSpawnlocs[npc])) + if (Creature* sparklight = AddCreature(BG_SA_NpcEntries[npc], npc, BG_SA_NpcSpawnlocs[npc], Attackers)) sparklight->AI()->Talk(TEXT_SPARKLIGHT_RIGSPARK_SPAWN); for (uint8 j = BG_SA_DEMOLISHER_5; j <= BG_SA_DEMOLISHER_6; j++) { - AddCreature(BG_SA_NpcEntries[j], j, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), - BG_SA_NpcSpawnlocs[j], 600); + AddCreature(BG_SA_NpcEntries[j], j, BG_SA_NpcSpawnlocs[j], Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE, 600); if (Creature* dem = GetBGCreature(j)) dem->setFaction(BG_SA_Factions[Attackers]); } - UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); - UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); + UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[i] == TEAM_ALLIANCE); + UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[i] == TEAM_HORDE); if (Creature* c = Source->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f)) SendChatMessage(c, Source->GetTeamId() == TEAM_ALLIANCE ? TEXT_EAST_GRAVEYARD_CAPTURED_A : TEXT_EAST_GRAVEYARD_CAPTURED_H, Source); @@ -830,8 +828,8 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag], 0, 0, 0, 0, RESPAWN_ONE_DAY); - UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); - UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); + UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[i] == TEAM_ALLIANCE); + UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[i] == TEAM_HORDE); if (Creature* c = Source->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f)) SendChatMessage(c, Source->GetTeamId() == TEAM_ALLIANCE ? TEXT_SOUTH_GRAVEYARD_CAPTURED_A : TEXT_SOUTH_GRAVEYARD_CAPTURED_H, Source); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 4814728c26d..eb5ffed657f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -711,14 +711,14 @@ bool BattlegroundWS::SetupBattleground() } WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); - if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) + if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, TEAM_ALLIANCE)) { TC_LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!"); return false; } sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); - if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) + if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE)) { TC_LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!"); return false; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 5c25b9454cb..03e32028232 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -257,7 +257,7 @@ void Creature::RemoveCorpse(bool setSpawnTime) /** * change the entry of creature until respawn */ -bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data) +bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) { CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(entry); if (!normalInfo) @@ -334,10 +334,10 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); SetFloatValue(UNIT_MOD_CAST_HASTE, 1.0f); - SetSpeed(MOVE_WALK, cinfo->speed_walk); - SetSpeed(MOVE_RUN, cinfo->speed_run); - SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate - SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate + SetSpeed(MOVE_WALK, cinfo->speed_walk); + SetSpeed(MOVE_RUN, cinfo->speed_run); + SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate + SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate // Will set UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH SetObjectScale(cinfo->scale); @@ -355,9 +355,9 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data return true; } -bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) +bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/) { - if (!InitEntry(Entry, team, data)) + if (!InitEntry(entry, data)) return false; CreatureTemplate const* cInfo = GetCreatureTemplate(); @@ -368,7 +368,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) if (!GetCreatureAddon()) SetSheath(SHEATH_STATE_MELEE); - setFaction(cInfo->faction); + setFaction(cInfo->faction); uint32 npcflag, unit_flags, dynamicflags; ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data); @@ -734,16 +734,16 @@ void Creature::Motion_Initialize() GetMotionMaster()->Initialize(); } -bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data) +bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/) { ASSERT(map); SetMap(map); SetPhaseMask(phaseMask, false); - CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - TC_LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); + TC_LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry); return false; } @@ -751,13 +751,12 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, //! returning correct zone id for selecting OutdoorPvP/Battlefield script Relocate(x, y, z, ang); - //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0; - if (!CreateFromProto(guidlow, Entry, vehId, team, data)) + if (!CreateFromProto(guidlow, entry, data, vehId)) return false; if (!IsPositionValid()) { - TC_LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); + TC_LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, entry, x, y, z, ang); return false; } @@ -809,9 +808,6 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); } - if (Entry == VISUAL_WAYPOINT) - SetVisible(false); - return true; } @@ -819,10 +815,12 @@ void Creature::InitializeReactState() { if (IsTotem() || IsTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER || IsSpiritService()) SetReactState(REACT_PASSIVE); + /* + else if (IsCivilian()) + SetReactState(REACT_DEFENSIVE); + */ else SetReactState(REACT_AGGRESSIVE); - /*else if (IsCivilian()) - SetReactState(REACT_DEFENSIVE);*/; } bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const @@ -1163,35 +1161,35 @@ float Creature::GetSpellDamageMod(int32 Rank) const } } -bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData* data) +bool Creature::CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/) { SetZoneScript(); if (GetZoneScript() && data) { - Entry = GetZoneScript()->GetCreatureEntry(guidlow, data); - if (!Entry) + entry = GetZoneScript()->GetCreatureEntry(guidlow, data); + if (!entry) return false; } - CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - TC_LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); + TC_LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry); return false; } - SetOriginalEntry(Entry); + SetOriginalEntry(entry); if (!vehId) vehId = cinfo->VehicleId; - Object::_Create(guidlow, Entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT); + Object::_Create(guidlow, entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT); - if (!UpdateEntry(Entry, team, data)) + if (!UpdateEntry(entry, data)) return false; if (vehId) - CreateVehicleKit(vehId, Entry); + CreateVehicleKit(vehId, entry); return true; } @@ -1215,8 +1213,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) else guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT); - uint16 team = 0; - if (!Create(guid, map, data->phaseMask, data->id, 0, team, data->posX, data->posY, data->posZ, data->orientation, data)) + if (!Create(guid, map, data->phaseMask, data->id, data->posX, data->posY, data->posZ, data->orientation, data)) return false; //We should set first home position, because then AI calls home movement diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 2db17b6fa1d..587567ba158 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -439,7 +439,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject void DisappearAndDie(); - bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data = NULL); + bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0); bool LoadCreaturesAddon(bool reload = false); void SelectLevel(); void LoadEquipment(int8 id = 1, bool force = false); @@ -497,7 +497,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject bool HasSpell(uint32 spellID) const; - bool UpdateEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); + bool UpdateEntry(uint32 entry, CreatureData const* data = nullptr); void UpdateMovementFlags(); @@ -671,8 +671,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject void ReleaseFocus(Spell const* focusSpell); protected: - bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData* data = NULL); - bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); + bool CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const* data = nullptr, uint32 vehId = 0); + bool InitEntry(uint32 entry, CreatureData const* data = nullptr); // vendor items VendorItemCounts m_vendorItemCounts; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 42176df7a67..a7ebde51372 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2330,13 +2330,8 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert } uint32 phase = PHASEMASK_NORMAL; - uint32 team = 0; if (summoner) - { phase = summoner->GetPhaseMask(); - if (summoner->GetTypeId() == TYPEID_PLAYER) - team = summoner->ToPlayer()->GetTeam(); - } TempSummon* summon = NULL; switch (mask) @@ -2358,7 +2353,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert break; } - if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation())) + if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId)) { delete summon; return NULL; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 79f95e5db18..7f4bead4656 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -40,7 +40,7 @@ Pet::Pet(Player* owner, PetType type) : m_petType(type), m_duration(0), m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) { - ASSERT(m_owner->GetTypeId() == TYPEID_PLAYER); + ASSERT(GetOwner()); m_unitTypeMask |= UNIT_MASK_PET; if (type == HUNTER_PET) @@ -383,8 +383,6 @@ void Pet::SavePetToDB(PetSaveMode mode) return; Player* owner = GetOwner(); - if (!owner) - return; // not save pet as current if another pet temporary unsummoned if (mode == PET_SAVE_AS_CURRENT && owner->GetTemporaryUnsummonedPetNumber() && @@ -555,7 +553,7 @@ void Pet::Update(uint32 diff) { // unsummon pet that lost owner Player* owner = GetOwner(); - if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityRange()) && !isPossessed()) || (isControlled() && !owner->GetPetGUID())) + if ((!IsWithinDistInMap(owner, GetMap()->GetVisibilityRange()) && !isPossessed()) || (isControlled() && !owner->GetPetGUID())) //if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID())) { Remove(PET_SAVE_NOT_IN_SLOT, true); @@ -803,8 +801,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) if (IsPet() && GetOwner()->GetTypeId() == TYPEID_PLAYER) { if (GetOwner()->getClass() == CLASS_WARLOCK - || GetOwner()->getClass() == CLASS_SHAMAN // Fire Elemental - || GetOwner()->getClass() == CLASS_DEATH_KNIGHT) // Risen Ghoul + || GetOwner()->getClass() == CLASS_SHAMAN // Fire Elemental + || GetOwner()->getClass() == CLASS_DEATH_KNIGHT) // Risen Ghoul { petType = SUMMON_PET; } @@ -1108,7 +1106,7 @@ void Pet::_LoadSpellCooldowns() } while (result->NextRow()); - if (!cooldowns.empty() && GetOwner()) + if (!cooldowns.empty()) { BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, cooldowns); GetOwner()->GetSession()->SendPacket(&data); @@ -1587,12 +1585,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab) if (clear_ab && !learn_prev && m_charmInfo->RemoveSpellFromActionBar(spell_id)) { if (!m_loading) - { - // need update action bar for last removed rank - if (Unit* owner = GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->ToPlayer()->PetSpellInitialize(); - } + GetOwner()->PetSpellInitialize(); // need update action bar for last removed rank } return true; @@ -1627,13 +1620,11 @@ void Pet::InitPetCreateSpells() bool Pet::resetTalents() { - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return false; + Player* player = GetOwner(); // not need after this call - if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) - owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true); + if (player->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) + player->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true); CreatureTemplate const* ci = GetCreatureTemplate(); if (!ci) @@ -1643,8 +1634,6 @@ bool Pet::resetTalents() if (!pet_family || pet_family->petTalentType < 0) return false; - Player* player = owner->ToPlayer(); - uint8 level = getLevel(); uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level); @@ -1789,20 +1778,15 @@ void Pet::InitTalentForLevel() SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount); - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; - if (!m_loading) - owner->ToPlayer()->SendTalentsInfoData(true); + GetOwner()->SendTalentsInfoData(true); } uint8 Pet::GetMaxTalentPointsForLevel(uint8 level) { uint8 points = (level >= 20) ? ((level - 16) / 4) : 0; // Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS - if (Unit* owner = GetOwner()) - points+=owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS); + points += GetOwner()->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS); return points; } @@ -1927,11 +1911,9 @@ void Pet::LearnPetPassives() void Pet::CastPetAuras(bool current) { - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; + Player* owner = GetOwner(); - if (!IsPermanentPetFor(owner->ToPlayer())) + if (!IsPermanentPetFor(owner)) return; for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();) @@ -1963,10 +1945,7 @@ void Pet::CastPetAura(PetAura const* aura) bool Pet::IsPetAura(Aura const* aura) { - Unit* owner = GetOwner(); - - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return false; + Player* owner = GetOwner(); // if the owner has that pet aura, return true for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end(); ++itr) @@ -1987,9 +1966,7 @@ void Pet::learnSpellHighRank(uint32 spellid) void Pet::SynchronizeLevelWithOwner() { - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; + Player* owner = GetOwner(); switch (getPetType()) { @@ -2039,9 +2016,7 @@ void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) if (!cooldowns.empty()) { BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, cooldowns); - - if (Player* owner = GetOwner()) - owner->GetSession()->SendPacket(&data); + GetOwner()->GetSession()->SendPacket(&data); } } @@ -2057,8 +2032,6 @@ void Pet::SetDisplayId(uint32 modelId) if (!isControlled()) return; - if (Unit* owner = GetOwner()) - if (Player* player = owner->ToPlayer()) - if (player->GetGroup()) - player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MODEL_ID); + if (GetOwner()->GetGroup()) + GetOwner()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MODEL_ID); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3c16cf0df4e..45dd7f1b641 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -664,15 +664,8 @@ void KillRewarder::Reward() // we can disable this warning for this since it only // causes undefined behavior when passed to the base class constructor -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif Player::Player(WorldSession* session): Unit(true), phaseMgr(this) { -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - m_speakTime = 0; m_speakCount = 0; diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 8099dc1bc8e..d7af98b47d1 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -382,13 +382,8 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu } uint32 phase = PHASEMASK_NORMAL; - uint32 team = 0; if (summoner) - { phase = summoner->GetPhaseMask(); - if (summoner->GetTypeId() == TYPEID_PLAYER) - team = summoner->ToPlayer()->GetTeam(); - } TempSummon* summon = NULL; switch (mask) @@ -414,7 +409,7 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu pos.GetPosition(x, y, z, o); CalculatePassengerPosition(x, y, z, &o); - if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, vehId, team, x, y, z, o)) + if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, x, y, z, o, nullptr, vehId)) { delete summon; return NULL; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 32882de75ea..f016b226ee2 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -157,9 +157,6 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, // we can disable this warning for this since it only // causes undefined behavior when passed to the base class constructor -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0), @@ -169,9 +166,6 @@ Unit::Unit(bool isWorldObject) : m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this), _lastDamagedTime(0) { -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif m_objectType |= TYPEMASK_UNIT; m_objectTypeId = TYPEID_UNIT; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 676023507f8..7204b821138 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -720,7 +720,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->trainer_class != difficultyInfo->trainer_class) { - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, trainer_class: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, trainer_class: %u) has different `trainer_class` in difficulty %u mode (Entry: %u, trainer_class: %u).", cInfo->Entry, cInfo->trainer_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->trainer_class); TC_LOG_ERROR("sql.sql", "Possible FIX: UPDATE `creature_template` SET `trainer_class`=%u WHERE `entry`=%u;", cInfo->trainer_class, cInfo->DifficultyEntry[diff]); @@ -1876,7 +1876,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, const Position& pos) return true; } -uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay) +uint32 ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay /*= 0*/) { CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index e19bda45e4a..f5bd18a2609 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1184,7 +1184,7 @@ class ObjectMgr void AddGameobjectToGrid(uint32 guid, GameObjectData const* data); void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data); uint32 AddGOData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0); - uint32 AddCreData(uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0); + uint32 AddCreData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0); bool MoveCreData(uint32 guid, uint32 map, const Position& pos); // reserved names diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 1d33747d1e9..974f06975fa 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -633,9 +633,8 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) pet->SetName(name); - Player* owner = pet->GetOwner(); - if (owner && owner->GetGroup()) - owner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); + if (pet->GetOwner()->GetGroup()) + pet->GetOwner()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 01ee5238789..cacec14d5e6 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -103,9 +103,9 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, return false; } -bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay) +bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, TeamId /*teamId = TEAM_NEUTRAL*/, uint32 spawntimedelay /*= 0*/) { - if (uint32 guid = sObjectMgr->AddCreData(entry, team, map, x, y, z, o, spawntimedelay)) + if (uint32 guid = sObjectMgr->AddCreData(entry, map, x, y, z, o, spawntimedelay)) { AddCre(type, guid, entry); return true; diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index c2248c72fd0..577d70021a6 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -67,7 +67,6 @@ struct go_type struct creature_type { uint32 entry; - uint32 teamval; uint32 map; float x; float y; @@ -144,7 +143,7 @@ class OPvPCapturePoint bool AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3); - bool AddCreature(uint32 type, uint32 entry, uint32 teamval, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0); + virtual bool AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL, uint32 spawntimedelay = 0); bool DelCreature(uint32 type); bool DelObject(uint32 type); @@ -248,6 +247,19 @@ class OutdoorPvP : public ZoneScript void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); + static TeamId GetTeamIdByTeam(uint32 team) + { + switch (team) + { + case ALLIANCE: + return TEAM_ALLIANCE; + case HORDE: + return TEAM_HORDE; + default: + return TEAM_NEUTRAL; + } + } + protected: // the map of the objectives belonging to this outdoorpvp |
