aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_account.cpp16
-rw-r--r--src/server/scripts/Commands/cs_arena.cpp8
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp2
-rw-r--r--src/server/scripts/Commands/cs_character.cpp12
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp51
-rw-r--r--src/server/scripts/Commands/cs_go.cpp12
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp63
-rw-r--r--src/server/scripts/Commands/cs_group.cpp2
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp2
-rw-r--r--src/server/scripts/Commands/cs_list.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp14
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp4
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp38
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp2
-rw-r--r--src/server/scripts/Commands/cs_send.cpp6
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp27
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp36
-rw-r--r--src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp4
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp24
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp12
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp10
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp74
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp80
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp164
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp14
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h23
-rw-r--r--src/server/scripts/Northrend/isle_of_conquest.cpp2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp83
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp20
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp23
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.h2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp6
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp9
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp23
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.h4
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp42
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp2
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp67
44 files changed, 589 insertions, 418 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 5668c20d6b0..04520101d15 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -135,7 +135,7 @@ public:
{
TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (GUID: %u) created Account %s (Email: '%s')",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(),
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(),
accountName, email.c_str());
}
break;
@@ -381,7 +381,7 @@ public:
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided email [%s] is not equal to registration email [%s].",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(),
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(),
email, oldEmail);
return false;
}
@@ -393,7 +393,7 @@ public:
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter());
return false;
}
@@ -412,7 +412,7 @@ public:
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter());
return false;
}
@@ -425,7 +425,7 @@ public:
sScriptMgr->OnEmailChange(handler->GetSession()->GetAccountId());
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Email from [%s] to [%s].",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(),
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(),
oldEmail, email);
break;
case AOR_EMAIL_TOO_LONG:
@@ -479,7 +479,7 @@ public:
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the provided old password is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter());
return false;
}
@@ -492,7 +492,7 @@ public:
handler->SetSentErrorMessage(true);
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the entered email [%s] is wrong.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(),
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(),
emailConfirmation);
return false;
}
@@ -515,7 +515,7 @@ public:
sScriptMgr->OnPasswordChange(handler->GetSession()->GetAccountId());
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.",
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter());
break;
case AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp
index 4993a7484dd..4cafb651add 100644
--- a/src/server/scripts/Commands/cs_arena.cpp
+++ b/src/server/scripts/Commands/cs_arena.cpp
@@ -144,7 +144,7 @@ public:
arena->Disband();
if (handler->GetSession())
TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] disbanded arena team type: %u [Id: %u].",
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), arena->GetType(), teamId);
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), arena->GetType(), teamId);
else
TC_LOG_DEBUG("bg.arena", "Console: disbanded arena team type: %u [Id: %u].", arena->GetType(), teamId);
@@ -209,7 +209,7 @@ public:
handler->PSendSysMessage(LANG_ARENA_RENAME, arena->GetId(), oldArenaStr, newArenaStr);
if (handler->GetSession())
TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] rename arena team \"%s\"[Id: %u] to \"%s\"",
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), oldArenaStr, arena->GetId(), newArenaStr);
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), oldArenaStr, arena->GetId(), newArenaStr);
else
TC_LOG_DEBUG("bg.arena", "Console: rename arena team \"%s\"[Id: %u] to \"%s\"", oldArenaStr, arena->GetId(), newArenaStr);
@@ -285,10 +285,10 @@ public:
handler->PSendSysMessage(LANG_ARENA_CAPTAIN, arena->GetName().c_str(), arena->GetId(), oldCaptainNameData->m_name.c_str(), target->GetName().c_str());
if (handler->GetSession())
TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]",
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), target->GetName().c_str(), target->GetGUIDLow(), arena->GetName().c_str(), arena->GetId());
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), target->GetName().c_str(), target->GetGUID().GetCounter(), arena->GetName().c_str(), arena->GetId());
else
TC_LOG_DEBUG("bg.arena", "Console: promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]",
- target->GetName().c_str(), target->GetGUIDLow(), arena->GetName().c_str(), arena->GetId());
+ target->GetName().c_str(), target->GetGUID().GetCounter(), arena->GetName().c_str(), arena->GetId());
return true;
}
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index 4b90a672c82..fc246898186 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -318,7 +318,7 @@ public:
targetGuid = (*resultCharacter)[0].GetUInt32();
}
else
- targetGuid = target->GetGUIDLow();
+ targetGuid = target->GetGUID().GetCounter();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
stmt->setUInt32(0, targetGuid);
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 4ef4454be99..405f6fde624 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -133,7 +133,7 @@ public:
DeletedInfo info;
- info.guid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ info.guid = ObjectGuid(HighGuid::Player, fields[0].GetUInt32());
info.name = fields[1].GetString();
info.accountId = fields[2].GetUInt32();
@@ -483,7 +483,7 @@ public:
{
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
- stmt->setUInt32(1, target->GetGUIDLow());
+ stmt->setUInt32(1, target->GetGUID().GetCounter());
}
else
{
@@ -511,7 +511,7 @@ public:
{
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
- stmt->setUInt32(1, target->GetGUIDLow());
+ stmt->setUInt32(1, target->GetGUID().GetCounter());
}
else
{
@@ -539,7 +539,7 @@ public:
/// @todo add text into database
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
- stmt->setUInt32(1, target->GetGUIDLow());
+ stmt->setUInt32(1, target->GetGUID().GetCounter());
}
else
{
@@ -921,7 +921,7 @@ public:
return false;
}
- if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid(HIGHGUID_PLAYER, guid)))
+ if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid(HighGuid::Player, guid)))
{
handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
handler->SetSentErrorMessage(true);
@@ -969,7 +969,7 @@ public:
ObjectGuid guid;
// character name can't start from number
if (isNumeric(playerStr))
- guid = ObjectGuid(HIGHGUID_PLAYER, uint32(atoi(playerStr)));
+ guid = ObjectGuid(HighGuid::Player, uint32(atoi(playerStr)));
else
{
std::string name = handler->extractPlayerNameFromLink(playerStr);
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 7c2ce1a13ec..422104fedd5 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -502,7 +502,7 @@ public:
return false;
handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s",
- target->GetName().c_str(), target->GetGUIDLow(), target->GetDBTableGUIDLow(),
+ target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetSpawnId(),
target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient");
return true;
}
@@ -597,7 +597,7 @@ public:
break;
}
- handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bagSlot, item->GetSlot(), item->GetGUIDLow(), st.c_str());
+ handler->PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bagSlot, item->GetSlot(), item->GetGUID().GetCounter(), st.c_str());
}
if (updateQueue.empty())
handler->PSendSysMessage("The player's updatequeue is empty");
@@ -618,7 +618,7 @@ public:
if (item->GetSlot() != i)
{
- handler->PSendSysMessage("Item with slot %d and guid %d has an incorrect slot value: %d", i, item->GetGUIDLow(), item->GetSlot());
+ handler->PSendSysMessage("Item with slot %d and guid %d has an incorrect slot value: %d", i, item->GetGUID().GetCounter(), item->GetSlot());
error = true;
continue;
}
@@ -642,28 +642,28 @@ public:
uint16 qp = item->GetQueuePos();
if (qp > updateQueue.size())
{
- handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUIDLow(), qp);
+ handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUID().GetCounter(), qp);
error = true;
continue;
}
if (updateQueue[qp] == NULL)
{
- handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp);
+ handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().GetCounter(), qp);
error = true;
continue;
}
if (updateQueue[qp] != item)
{
- handler->PSendSysMessage("The item with slot %d and guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
+ handler->PSendSysMessage("The item with slot %d and guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUID().GetCounter(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().GetCounter());
error = true;
continue;
}
}
else if (item->GetState() != ITEM_UNCHANGED)
{
- handler->PSendSysMessage("The item with slot %d and guid %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUIDLow(), item->GetState());
+ handler->PSendSysMessage("The item with slot %d and guid %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUID().GetCounter(), item->GetState());
error = true;
continue;
}
@@ -678,7 +678,7 @@ public:
if (item2->GetSlot() != j)
{
- handler->PSendSysMessage("The item in bag %d and slot %d (guid: %d) has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot());
+ handler->PSendSysMessage("The item in bag %d and slot %d (guid: %d) has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUID().GetCounter(), item2->GetSlot());
error = true;
continue;
}
@@ -710,28 +710,28 @@ public:
uint16 qp = item2->GetQueuePos();
if (qp > updateQueue.size())
{
- handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
+ handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp);
error = true;
continue;
}
if (updateQueue[qp] == NULL)
{
- handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
+ handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp);
error = true;
continue;
}
if (updateQueue[qp] != item2)
{
- handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
+ handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().GetCounter());
error = true;
continue;
}
}
else if (item2->GetState() != ITEM_UNCHANGED)
{
- handler->PSendSysMessage("The item in bag %d at slot %d having guid %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState());
+ handler->PSendSysMessage("The item in bag %d at slot %d having guid %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), item2->GetState());
error = true;
continue;
}
@@ -806,14 +806,14 @@ public:
ThreatContainer::StorageType const &threatList = target->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator itr;
uint32 count = 0;
- handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName().c_str(), target->GetGUIDLow());
+ handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName().c_str(), target->GetGUID().GetCounter());
for (itr = threatList.begin(); itr != threatList.end(); ++itr)
{
Unit* unit = (*itr)->getTarget();
if (!unit)
continue;
++count;
- handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUIDLow(), (*itr)->getThreat());
+ handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUID().GetCounter(), (*itr)->getThreat());
}
handler->SendSysMessage("End of threat list.");
return true;
@@ -826,13 +826,13 @@ public:
target = handler->GetSession()->GetPlayer();
HostileReference* ref = target->getHostileRefManager().getFirst();
uint32 count = 0;
- handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName().c_str(), target->GetGUIDLow());
+ handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName().c_str(), target->GetGUID().GetCounter());
while (ref)
{
if (Unit* unit = ref->GetSource()->GetOwner())
{
++count;
- handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat());
+ handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUID().GetCounter(), ref->getThreat());
}
ref = ref->next();
}
@@ -929,7 +929,7 @@ public:
Map* map = handler->GetSession()->GetPlayer()->GetMap();
- if (!v->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_VEHICLE), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, x, y, z, o, nullptr, id))
+ if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, x, y, z, o, nullptr, id))
{
delete v;
return false;
@@ -974,7 +974,7 @@ public:
uint32 guid = (uint32)atoi(e);
uint32 index = (uint32)atoi(f);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
if (!i)
return false;
@@ -1005,7 +1005,7 @@ public:
uint32 index = (uint32)atoi(f);
uint32 value = (uint32)atoi(g);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
if (!i)
return false;
@@ -1029,7 +1029,7 @@ public:
uint32 guid = (uint32)atoi(e);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
if (!i)
return false;
@@ -1054,7 +1054,7 @@ public:
static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/)
{
if (Unit* unit = handler->getSelectedUnit())
- handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName().c_str(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not ");
+ handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName().c_str(), unit->GetGUID().GetCounter(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not ");
return true;
}
@@ -1199,7 +1199,7 @@ public:
if (opcode >= handler->GetSession()->GetPlayer()->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, handler->GetSession()->GetPlayer()->GetGUIDLow(), handler->GetSession()->GetPlayer()->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), handler->GetSession()->GetPlayer()->GetValuesCount());
return false;
}
@@ -1249,13 +1249,13 @@ public:
{
value = unit->GetUInt32Value(updateIndex);
- handler->PSendSysMessage(LANG_UPDATE, unit->GetGUIDLow(), updateIndex, value);
+ handler->PSendSysMessage(LANG_UPDATE, unit->GetGUID().GetCounter(), updateIndex, value);
return true;
}
value = atoi(val);
- handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUIDLow(), updateIndex, value);
+ handler->PSendSysMessage(LANG_UPDATE_CHANGE, unit->GetGUID().GetCounter(), updateIndex, value);
unit->SetUInt32Value(updateIndex, value);
@@ -1410,11 +1410,12 @@ public:
if (!map)
map = player->GetMap();
+ handler->PSendSysMessage("Loading all cells (mapId: %u). Current next GameObject %u, Creature %u", map->GetId(), map->GetMaxLowGuid<HighGuid::GameObject>(), map->GetMaxLowGuid<HighGuid::Unit>());
for (uint32 cellX = 0; cellX < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellX++)
for (uint32 cellY = 0; cellY < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellY++)
map->LoadGrid((cellX + 0.5f - CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL, (cellY + 0.5f - CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL);
- handler->PSendSysMessage("Cells loaded (mapId: %u)", map->GetId());
+ handler->PSendSysMessage("Cells loaded (mapId: %u) After load - Next GameObject %u, Creature %u", map->GetId(), map->GetMaxLowGuid<HighGuid::GameObject>(), map->GetMaxLowGuid<HighGuid::Unit>());
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 1ddfaa4bfd8..ce1a42e6e78 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -135,21 +135,9 @@ public:
float z = fields[2].GetFloat();
float o = fields[3].GetFloat();
uint32 mapId = fields[4].GetUInt16();
- uint32 guid = fields[5].GetUInt32();
- uint32 id = fields[6].GetUInt32();
Transport* transport = NULL;
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, id, guid), (Creature*)NULL))
- {
- x = creature->GetPositionX();
- y = creature->GetPositionY();
- z = creature->GetPositionZ();
- o = creature->GetOrientation();
- mapId = creature->GetMapId();
- transport = creature->GetTransport();
- }
-
if (!MapManager::IsValidMapCoord(mapId, x, y, z, o) || sObjectMgr->IsTransportMap(mapId))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 0142cfa0e52..0a45506c736 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -150,7 +150,7 @@ public:
Map* map = player->GetMap();
GameObject* object = new GameObject;
- uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
+ uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
@@ -166,6 +166,8 @@ public:
// fill the gameobject data and save to the db
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn());
+ guidLow = object->GetSpawnId();
+
// delete the old object and do a clean load from DB with a fresh new GameObject instance.
// this is required to avoid weird behavior and memory leaks
delete object;
@@ -324,7 +326,7 @@ public:
return false;
}
- GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, id, guidLow));
+ GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HighGuid::GameObject, id, guidLow));
handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase);
@@ -373,7 +375,7 @@ public:
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
if (!owner || !ownerGuid.IsPlayer())
{
- handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUID().GetCounter());
handler->SetSentErrorMessage(true);
return false;
}
@@ -385,7 +387,7 @@ public:
object->Delete();
object->DeleteFromDB();
- handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetGUID().GetCounter());
return true;
}
@@ -426,16 +428,26 @@ public:
o = player->GetOrientation();
}
+ Map* map = object->GetMap();
+
object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o);
object->UpdateRotationFields();
- object->DestroyForNearbyPlayers();
- object->UpdateObjectVisibility();
-
object->SaveToDB();
- object->Refresh();
- handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow(), o);
+ // Generate a completely new spawn with new guid
+ // 3.3.5a client caches recently deleted objects and brings them back to life
+ // when CreateObject block for this guid is received again
+ // however it entirely skips parsing that block and only uses already known location
+ object->Delete();
+
+ object = new GameObject();
+ if (!object->LoadGameObjectFromDB(guidLow, map))
+ {
+ delete object;
+ return false;
+ }
+ handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetSpawnId());
return true;
}
@@ -468,21 +480,20 @@ public:
char* toY = strtok(NULL, " ");
char* toZ = strtok(NULL, " ");
+ float x, y, z;
if (!toX)
{
Player* player = handler->GetSession()->GetPlayer();
- object->Relocate(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), object->GetOrientation());
- object->DestroyForNearbyPlayers();
- object->UpdateObjectVisibility();
+ player->GetPosition(x, y, z);
}
else
{
if (!toY || !toZ)
return false;
- float x = (float)atof(toX);
- float y = (float)atof(toY);
- float z = (float)atof(toZ);
+ x = (float)atof(toX);
+ y = (float)atof(toY);
+ z = (float)atof(toZ);
if (!MapManager::IsValidMapCoord(object->GetMapId(), x, y, z))
{
@@ -490,17 +501,27 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
- object->Relocate(x, y, z, object->GetOrientation());
- object->DestroyForNearbyPlayers();
- object->UpdateObjectVisibility();
}
+ Map* map = object->GetMap();
+
+ object->Relocate(x, y, z, object->GetOrientation());
object->SaveToDB();
- object->Refresh();
- handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow());
+ // Generate a completely new spawn with new guid
+ // 3.3.5a client caches recently deleted objects and brings them back to life
+ // when CreateObject block for this guid is received again
+ // however it entirely skips parsing that block and only uses already known location
+ object->Delete();
+
+ object = new GameObject();
+ if (!object->LoadGameObjectFromDB(guidLow, map))
+ {
+ delete object;
+ return false;
+ }
+ handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetSpawnId());
return true;
}
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index c0a4b2cfead..8152508c5df 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -269,7 +269,7 @@ public:
const char* onlineState = "";
// Parse the guid to uint32...
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atoul(args)));
+ ObjectGuid parseGUID(HighGuid::Player, uint32(atoul(args)));
// ... and try to extract a player out of it.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
index 8bb64a454d2..2de22714a15 100644
--- a/src/server/scripts/Commands/cs_lfg.cpp
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -80,7 +80,7 @@ public:
ObjectGuid guidTarget;
std::string nameTarget;
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atoul(args)));
+ ObjectGuid parseGUID(HighGuid::Player, uint32(atoul(args)));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
{
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 3e4b46804ff..fb051832d7b 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -476,7 +476,7 @@ public:
if (!*args)
return false;
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atoul(args)));
+ ObjectGuid parseGUID(HighGuid::Player, uint32(atoul(args)));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 7baef489865..dfb1d84c6cc 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -641,7 +641,7 @@ public:
return false;
}
- handler->PSendSysMessage(LANG_OBJECT_GUID, guid.GetCounter(), guid.GetHigh());
+ handler->PSendSysMessage(LANG_OBJECT_GUID, guid.ToString().c_str());
return true;
}
@@ -1421,7 +1421,7 @@ public:
PreparedStatement* stmt = NULL;
// To make sure we get a target, we convert our guid to an omniversal...
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atoul(args)));
+ ObjectGuid parseGUID(HighGuid::Player, uint32(atoul(args)));
// ... and make sure we get a target, somehow.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
@@ -2018,7 +2018,7 @@ public:
return false;
}
- handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
+ handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().GetCounter());
MotionMaster* motionMaster = unit->GetMotionMaster();
float x, y, z;
@@ -2061,9 +2061,9 @@ public:
if (!target)
handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
else if (target->GetTypeId() == TYPEID_PLAYER)
- handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUIDLow());
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUID().GetCounter());
else
- handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUIDLow());
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUID().GetCounter());
break;
}
case FOLLOW_MOTION_TYPE:
@@ -2077,9 +2077,9 @@ public:
if (!target)
handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
else if (target->GetTypeId() == TYPEID_PLAYER)
- handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUIDLow());
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUID().GetCounter());
else
- handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUIDLow());
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUID().GetCounter());
break;
}
case HOME_MOTION_TYPE:
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 9fd0260ed2e..bf82b81a8b7 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -292,7 +292,7 @@ public:
uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
- handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
+ handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
return true;
}
@@ -328,7 +328,7 @@ public:
return false;
}
- handler->PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
+ handler->PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
target->setFaction(factionid);
target->SetUInt32Value(UNIT_FIELD_FLAGS, flag);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 09a41fd82b5..dcf75d0c5db 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -260,7 +260,7 @@ public:
if (Transport* trans = chr->GetTransport())
{
- uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
+ uint32 guid = map->GenerateLowGuid<HighGuid::Unit>();
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
data.id = id;
data.phaseMask = chr->GetPhaseMaskForSpawn();
@@ -278,7 +278,7 @@ public:
}
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
{
delete creature;
return false;
@@ -286,7 +286,7 @@ public:
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
- uint32 db_guid = creature->GetDBTableGUIDLow();
+ uint32 db_guid = creature->GetSpawnId();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
// current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
@@ -494,7 +494,7 @@ public:
return false;
if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
- unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, cr_data->id, lowguid));
+ unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, cr_data->id, lowguid));
}
else
unit = handler->getSelectedCreature();
@@ -705,7 +705,7 @@ public:
std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);
- handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), target->GetGUIDLow(), faction, npcflags, Entry, displayid, nativeid);
+ handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetSpawnId(), target->GetGUID().GetCounter(), faction, npcflags, Entry, displayid, nativeid);
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
@@ -823,7 +823,7 @@ public:
}
else
{
- lowguid = creature->GetDBTableGUIDLow();
+ lowguid = creature->GetSpawnId();
}
float x = handler->GetSession()->GetPlayer()->GetPositionX();
@@ -833,7 +833,7 @@ public:
if (creature)
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
{
const_cast<CreatureData*>(data)->posX = x;
const_cast<CreatureData*>(data)->posY = y;
@@ -977,7 +977,7 @@ public:
creature = handler->getSelectedCreature();
if (!creature || creature->IsPet())
return false;
- lowguid = creature->GetDBTableGUIDLow();
+ lowguid = creature->GetSpawnId();
}
else // case .setmovetype #creature_guid $move_type (with selected creature)
{
@@ -985,7 +985,7 @@ public:
/* impossible without entry
if (lowguid)
- creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_UNIT));
+ creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HighGuid::Unit));
*/
// attempt check creature existence by DB data
@@ -1001,7 +1001,7 @@ public:
}
else
{
- lowguid = creature->GetDBTableGUIDLow();
+ lowguid = creature->GetSpawnId();
}
}
@@ -1104,7 +1104,7 @@ public:
uint32 guidLow = 0;
if (creature)
- guidLow = creature->GetDBTableGUIDLow();
+ guidLow = creature->GetSpawnId();
else
return false;
@@ -1153,7 +1153,7 @@ public:
uint32 guidLow = 0;
if (creature)
- guidLow = creature->GetDBTableGUIDLow();
+ guidLow = creature->GetSpawnId();
else
return false;
@@ -1282,7 +1282,7 @@ public:
return false;
}
- ObjectGuid receiver_guid(HIGHGUID_PLAYER, uint32(atoul(receiver_str)));
+ ObjectGuid receiver_guid(HighGuid::Player, uint32(atoul(receiver_str)));
// check online security
Player* receiver = ObjectAccessor::FindPlayer(receiver_guid);
@@ -1417,14 +1417,14 @@ public:
uint32 leaderGUID = (uint32) atoi((char*)args);
Creature* creature = handler->getSelectedCreature();
- if (!creature || !creature->GetDBTableGUIDLow())
+ if (!creature || !creature->GetSpawnId())
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
- uint32 lowguid = creature->GetDBTableGUIDLow();
+ uint32 lowguid = creature->GetSpawnId();
if (creature->GetFormation())
{
handler->PSendSysMessage("Selected creature is already member of group %u", creature->GetFormation()->GetId());
@@ -1477,21 +1477,21 @@ public:
return false;
}
- if (!creature->GetDBTableGUIDLow())
+ if (!creature->GetSpawnId())
{
- handler->PSendSysMessage("Selected creature %u isn't in creature table", creature->GetGUIDLow());
+ handler->PSendSysMessage("Selected creature %u isn't in creature table", creature->GetGUID().GetCounter());
handler->SetSentErrorMessage(true);
return false;
}
- if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetDBTableGUIDLow(), linkguid))
+ if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetSpawnId(), linkguid))
{
handler->PSendSysMessage("Selected creature can't link with guid '%u'", linkguid);
handler->SetSentErrorMessage(true);
return false;
}
- handler->PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, creature->GetDBTableGUIDLow());
+ handler->PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, creature->GetSpawnId());
return true;
}
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 9ad12bd0943..82904efc949 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -243,7 +243,7 @@ public:
// prepare Quest Tracker datas
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE);
stmt->setUInt32(0, quest->GetQuestId());
- stmt->setUInt32(1, player->GetGUIDLow());
+ stmt->setUInt32(1, player->GetGUID().GetCounter());
// add to Quest Tracker
CharacterDatabase.Execute(stmt);
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index e7ea4bc99d7..57ea44a67bf 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -77,7 +77,7 @@ public:
std::string text = msgText;
// from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
/// @todo Fix poor design
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -176,7 +176,7 @@ public:
}
// from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
// fill mail
MailDraft draft(subject, text);
@@ -236,7 +236,7 @@ public:
std::string text = msgText;
// from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index 5fc3cc618e5..b609dfe18dd 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -113,7 +113,7 @@ public:
// If assigned to different player other than current, leave
//! Console can override though
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
@@ -146,7 +146,7 @@ public:
// Ticket should be assigned to the player who tries to close it.
// Console can override though
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
@@ -190,7 +190,7 @@ public:
// Cannot comment ticket assigned to someone else
//! Console excluded
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
@@ -220,7 +220,9 @@ public:
if (!*args)
return false;
- uint32 ticketId = atoi(args);
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
{
@@ -228,6 +230,21 @@ public:
return true;
}
+ char* response = strtok(NULL, "\n");
+ if (response)
+ {
+ // Cannot add response to ticket, assigned to someone else
+ //! Console excluded
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ ticket->AppendResponse(response);
+ }
+
if (Player* player = ticket->GetPlayer())
ticket->SendResponse(player->GetSession());
@@ -476,7 +493,7 @@ public:
// Cannot add response to ticket, assigned to someone else
//! Console excluded
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index c9da1ed9635..00b8bec51c8 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -179,7 +179,7 @@ public:
return true;
}
- guidLow = target->GetDBTableGUIDLow();
+ guidLow = target->GetSpawnId();
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_ADDON_BY_GUID);
@@ -246,7 +246,7 @@ public:
return true;
}
- uint32 guildLow = target->GetDBTableGUIDLow();
+ uint32 guildLow = target->GetSpawnId();
if (target->GetCreatureAddon())
{
@@ -568,7 +568,7 @@ public:
}
// The visual waypoint
- wpGuid = target->GetGUIDLow();
+ wpGuid = target->GetGUID().GetCounter();
// User did select a visual waypoint?
@@ -579,7 +579,7 @@ public:
if (!result)
{
- handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow());
+ handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUID().GetCounter());
// Select waypoint number from database
// Since we compare float values, we have to deal with
// some difficulties.
@@ -628,7 +628,7 @@ public:
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
if (wpGuid != 0)
- if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid)))
+ if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, VISUAL_WAYPOINT, wpGuid)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -661,7 +661,7 @@ public:
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
- if (Creature* wpCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid)))
+ if (Creature* wpCreature = map->GetCreature(ObjectGuid(HighGuid::Unit, VISUAL_WAYPOINT, wpGuid)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -669,7 +669,7 @@ public:
}
// re-create
Creature* wpCreature2 = new Creature();
- if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
+ if (!wpCreature2->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
@@ -680,7 +680,7 @@ public:
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
/// @todo Should we first use "Create" then use "LoadFromDB"?
- if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetDBTableGUIDLow(), map))
+ if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetSpawnId(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
@@ -782,7 +782,7 @@ public:
}
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
- stmt->setUInt32(0, target->GetGUIDLow());
+ stmt->setUInt32(0, target->GetGUID().GetCounter());
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -842,7 +842,7 @@ public:
{
Field* fields = result2->Fetch();
uint32 wpguid = fields[0].GetUInt32();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpguid));
+ Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, VISUAL_WAYPOINT, wpguid));
if (!creature)
{
@@ -886,7 +886,7 @@ public:
float o = chr->GetOrientation();
Creature* wpCreature = new Creature();
- if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!wpCreature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
@@ -895,14 +895,14 @@ public:
// Set "wpguid" column to the visual waypoint
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
- stmt->setInt32(0, int32(wpCreature->GetGUIDLow()));
+ stmt->setInt32(0, int32(wpCreature->GetGUID().GetCounter()));
stmt->setUInt32(1, pathid);
stmt->setUInt32(2, point);
WorldDatabase.Execute(stmt);
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
- if (!wpCreature->LoadCreatureFromDB(wpCreature->GetDBTableGUIDLow(), map))
+ if (!wpCreature->LoadCreatureFromDB(wpCreature->GetSpawnId(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
@@ -948,7 +948,7 @@ public:
Map* map = chr->GetMap();
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete creature;
@@ -956,7 +956,7 @@ public:
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
- if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
+ if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete creature;
@@ -997,7 +997,7 @@ public:
Map* map = chr->GetMap();
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, chr->GetPhaseMaskForSpawn(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
delete creature;
@@ -1005,7 +1005,7 @@ public:
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
- if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
+ if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
delete creature;
@@ -1038,7 +1038,7 @@ public:
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, guid));
+ Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, VISUAL_WAYPOINT, guid));
if (!creature)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
index ab2e82171f1..427d4bae217 100644
--- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
@@ -272,7 +272,7 @@ public:
if (killer->GetGUID() == legoso->GetGUID() ||
(group && group->IsMember(killer->GetGUID())) ||
- killer->GetGUIDLow() == legoso->AI()->GetData(DATA_EVENT_STARTER_GUID))
+ killer->GetGUID().GetCounter() == legoso->AI()->GetData(DATA_EVENT_STARTER_GUID))
legoso->AI()->DoAction(ACTION_LEGOSO_SIRONAS_KILLED);
}
}
@@ -370,7 +370,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ENDING_THEIR_WORLD)
{
- SetData(DATA_EVENT_STARTER_GUID, player->GetGUIDLow());
+ SetData(DATA_EVENT_STARTER_GUID, player->GetGUID().GetCounter());
Start(true, true, player->GetGUID(), quest);
}
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index abeaff421cf..aeaf8a70ba5 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -376,7 +376,7 @@ class boss_prince_keleseth_icc : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetDBTableGUIDLow()))
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
if (data->curhealth)
_spawnHealth = data->curhealth;
@@ -591,7 +591,7 @@ class boss_prince_taldaram_icc : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetDBTableGUIDLow()))
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
if (data->curhealth)
_spawnHealth = data->curhealth;
@@ -815,7 +815,7 @@ class boss_prince_valanar_icc : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetDBTableGUIDLow()))
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
if (data->curhealth)
_spawnHealth = data->curhealth;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
index 68430f6f0f7..78730b535aa 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -492,7 +492,7 @@ public:
_caster->CastSpell(_caster, _spellId, true);
_caster->GetTransport()->AddObjectToRemoveList();
- if (GameObject* go = HashMapHolder<GameObject>::Find(_otherTransport))
+ if (Transport* go = HashMapHolder<Transport>::Find(_otherTransport))
go->AddObjectToRemoveList();
return true;
@@ -770,9 +770,8 @@ class npc_gunship : public CreatureScript
if (isVictory)
{
- if (GameObject* go = HashMapHolder<GameObject>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
- if (Transport* otherTransport = go->ToTransport())
- otherTransport->EnableMovement(true);
+ if (Transport* otherTransport = HashMapHolder<Transport>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ otherTransport->EnableMovement(true);
me->GetTransport()->EnableMovement(true);
@@ -1035,9 +1034,8 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
if (Transport* orgrimsHammer = me->GetTransport())
orgrimsHammer->SummonPassenger(NPC_TELEPORT_PORTAL, OrgrimsHammerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000);
- if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
- if (Transport* skybreaker = go->ToTransport())
- skybreaker->SummonPassenger(NPC_TELEPORT_EXIT, SkybreakerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
+ if (Transport* skybreaker = HashMapHolder<Transport>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ skybreaker->SummonPassenger(NPC_TELEPORT_EXIT, SkybreakerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
_events.ScheduleEvent(EVENT_ADDS_BOARD_YELL, 6000);
_events.ScheduleEvent(EVENT_ADDS, 60000);
@@ -1308,9 +1306,8 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
if (Transport* skybreaker = me->GetTransport())
skybreaker->SummonPassenger(NPC_TELEPORT_PORTAL, SkybreakerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000);
- if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
- if (Transport* orgrimsHammer = go->ToTransport())
- orgrimsHammer->SummonPassenger(NPC_TELEPORT_EXIT, OrgrimsHammerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
+ if (Transport* orgrimsHammer = HashMapHolder<Transport>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ orgrimsHammer->SummonPassenger(NPC_TELEPORT_EXIT, OrgrimsHammerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
_events.ScheduleEvent(EVENT_ADDS_BOARD_YELL, 6000);
_events.ScheduleEvent(EVENT_ADDS, 60000);
@@ -1454,9 +1451,8 @@ struct npc_gunship_boarding_addAI : public gunship_npc_AI
if (!myTransport)
return;
- if (GameObject* go = HashMapHolder<GameObject>::Find(Instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
- if (Transport* destTransport = go->ToTransport())
- destTransport->CalculatePassengerPosition(x, y, z, &o);
+ if (Transport* destTransport = HashMapHolder<Transport>::Find(Instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ destTransport->CalculatePassengerPosition(x, y, z, &o);
float angle = frand(0, float(M_PI) * 2.0f);
x += 2.0f * std::cos(angle);
@@ -2352,7 +2348,7 @@ class spell_igb_gunship_fall_teleport : public SpellScriptLoader
void SelectTransport(WorldObject*& target)
{
if (InstanceScript* instance = target->GetInstanceScript())
- target = HashMapHolder<GameObject>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE));
+ target = HashMapHolder<Transport>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE));
}
void RelocateDest(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index e908d088554..65d99b022dc 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -648,7 +648,7 @@ class npc_spinestalker : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -671,7 +671,7 @@ class npc_spinestalker : public CreatureScript
void JustRespawned() override
{
ScriptedAI::JustRespawned();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
}
void JustDied(Unit* /*killer*/) override
@@ -784,7 +784,7 @@ class npc_rimefang : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -807,7 +807,7 @@ class npc_rimefang : public CreatureScript
void JustRespawned() override
{
ScriptedAI::JustRespawned();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
}
void JustDied(Unit* /*killer*/) override
@@ -951,7 +951,7 @@ class npc_sindragosa_trash : public CreatureScript
if (!me->isDead())
{
if (me->GetEntry() == NPC_FROSTWING_WHELP)
- _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(_frostwyrmId, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -974,7 +974,7 @@ class npc_sindragosa_trash : public CreatureScript
// Increase add count
if (me->GetEntry() == NPC_FROSTWING_WHELP)
- _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(_frostwyrmId, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
}
void SetData(uint32 type, uint32 data) override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 7af550582a0..f0835135890 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -156,7 +156,7 @@ class RisenArchmageCheck
bool operator()(Creature* creature)
{
return creature->IsAlive() && creature->GetEntry() == NPC_RISEN_ARCHMAGE &&
- creature->GetDBTableGUIDLow() && !creature->IsInCombat();
+ creature->GetSpawnId() && !creature->IsInCombat();
}
};
@@ -244,7 +244,7 @@ class ValithriaDespawner : public BasicEvent
creature->DespawnOrUnsummon();
return;
case NPC_RISEN_ARCHMAGE:
- if (!creature->GetDBTableGUIDLow())
+ if (!creature->GetSpawnId())
{
creature->DespawnOrUnsummon();
return;
@@ -297,7 +297,7 @@ class boss_valithria_dreamwalker : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetDBTableGUIDLow()))
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
if (data->curhealth)
_spawnHealth = data->curhealth;
@@ -712,7 +712,7 @@ class npc_risen_archmage : public CreatureScript
void EnterCombat(Unit* /*target*/) override
{
me->FinishSpell(CURRENT_CHANNELED_SPELL, false);
- if (me->GetDBTableGUIDLow() && _canCallEnterCombat)
+ if (me->GetSpawnId() && _canCallEnterCombat)
{
std::list<Creature*> archmages;
RisenArchmageCheck check;
@@ -750,7 +750,7 @@ class npc_risen_archmage : public CreatureScript
void UpdateAI(uint32 diff) override
{
if (!me->IsInCombat())
- if (me->GetDBTableGUIDLow())
+ if (me->GetSpawnId())
if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
DoCast(me, SPELL_CORRUPTION);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index ab1450a87ea..f05fc48c074 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -545,7 +545,7 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript
case EVENT_MURADIN_RUN:
case EVENT_SAURFANG_RUN:
if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC))
- factionNPC->GetMotionMaster()->MovePath(factionNPC->GetDBTableGUIDLow()*10, false);
+ factionNPC->GetMotionMaster()->MovePath(factionNPC->GetSpawnId() * 10, false);
me->setActive(false);
_damnedKills = 3;
break;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index 992ca0b4d74..5354d1772b6 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -417,14 +417,14 @@ class instance_icecrown_citadel : public InstanceMapScript
if (creature->AI()->GetData(1/*DATA_FROSTWYRM_OWNER*/) == DATA_SPINESTALKER)
{
- SpinestalkerTrash.erase(creature->GetDBTableGUIDLow());
+ SpinestalkerTrash.erase(creature->GetSpawnId());
if (SpinestalkerTrash.empty())
if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID))
spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM);
}
else
{
- RimefangTrash.erase(creature->GetDBTableGUIDLow());
+ RimefangTrash.erase(creature->GetSpawnId());
if (RimefangTrash.empty())
if (Creature* spinestalk = instance->GetCreature(RimefangGUID))
spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM);
@@ -439,7 +439,7 @@ class instance_icecrown_citadel : public InstanceMapScript
if (GetBossState(DATA_SINDRAGOSA) == DONE)
return;
- FrostwyrmGUIDs.erase(creature->GetDBTableGUIDLow());
+ FrostwyrmGUIDs.erase(creature->GetSpawnId());
if (FrostwyrmGUIDs.empty())
{
instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY());
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index f5842181358..7c85c5f73b9 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -21,7 +21,7 @@
enum Spells
{
- SPELL_HATEFUL_STRIKE = 41926,
+ SPELL_HATEFUL_STRIKE = 28308,
SPELL_FRENZY = 28131,
SPELL_BERSERK = 26662,
SPELL_SLIME_BOLT = 32309
@@ -33,7 +33,7 @@ enum Yells
SAY_SLAY = 1,
SAY_DEATH = 2,
EMOTE_BERSERK = 3,
- EMOTE_ENRAGE = 4
+ EMOTE_FRENZY = 4
};
enum Events
@@ -49,6 +49,11 @@ enum Misc
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286
};
+enum HatefulThreatAmounts
+{
+ HATEFUL_THREAT_AMT = 1000,
+};
+
class boss_patchwerk : public CreatureScript
{
public:
@@ -92,8 +97,8 @@ public:
_EnterCombat();
Enraged = false;
Talk(SAY_AGGRO);
- events.ScheduleEvent(EVENT_HATEFUL, 1000);
- events.ScheduleEvent(EVENT_BERSERK, 360000);
+ events.ScheduleEvent(EVENT_HATEFUL, 1 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_BERSERK, 6 * MINUTE * IN_MILLISECONDS);
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
}
@@ -111,37 +116,68 @@ public:
{
case EVENT_HATEFUL:
{
- //Cast Hateful strike on the player with the highest
- //amount of HP within melee distance
- uint32 MostHP = 0;
- Unit* pMostHPTarget = NULL;
+ // Hateful Strike targets the highest non-MT threat in melee range on 10man
+ // and the higher HP target out of the two highest non-MT threats in melee range on 25man
+ float MostThreat = 0.0f;
+ Unit* secondThreatTarget = NULL;
+ Unit* thirdThreatTarget = NULL;
+
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i)
- {
+ { // find second highest
Unit* target = (*i)->getTarget();
- if (target->IsAlive() && target != me->GetVictim() && target->GetHealth() > MostHP && me->IsWithinMeleeRange(target))
+ if (target->IsAlive() && target != me->GetVictim() && (*i)->getThreat() >= MostThreat && me->IsWithinMeleeRange(target))
+ {
+ MostThreat = (*i)->getThreat();
+ secondThreatTarget = target;
+ }
+ }
+
+ if (secondThreatTarget && Is25ManRaid())
+ { // find third highest
+ MostThreat = 0.0f;
+ i = me->getThreatManager().getThreatList().begin();
+ for (; i != me->getThreatManager().getThreatList().end(); ++i)
{
- MostHP = target->GetHealth();
- pMostHPTarget = target;
+ Unit* target = (*i)->getTarget();
+ if (target->IsAlive() && target != me->GetVictim() && target != secondThreatTarget && (*i)->getThreat() >= MostThreat && me->IsWithinMeleeRange(target))
+ {
+ MostThreat = (*i)->getThreat();
+ thirdThreatTarget = target;
+ }
}
}
- if (!pMostHPTarget)
- pMostHPTarget = me->GetVictim();
+ Unit* pHatefulTarget = NULL;
+ if (!thirdThreatTarget)
+ pHatefulTarget = secondThreatTarget;
+ else if (secondThreatTarget)
+ pHatefulTarget = (secondThreatTarget->GetHealth() < thirdThreatTarget->GetHealth()) ? thirdThreatTarget : secondThreatTarget;
+
+ if (!pHatefulTarget)
+ pHatefulTarget = me->GetVictim();
+
+ DoCast(pHatefulTarget, SPELL_HATEFUL_STRIKE, true);
- DoCast(pMostHPTarget, SPELL_HATEFUL_STRIKE, true);
+ // add threat to highest threat targets
+ if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()))
+ me->getThreatManager().addThreat(me->GetVictim(), HATEFUL_THREAT_AMT);
+ if (secondThreatTarget)
+ me->getThreatManager().addThreat(secondThreatTarget, HATEFUL_THREAT_AMT);
+ if (thirdThreatTarget)
+ me->getThreatManager().addThreat(thirdThreatTarget, HATEFUL_THREAT_AMT); // this will only ever be used in 25m
- events.ScheduleEvent(EVENT_HATEFUL, 1000);
+ events.ScheduleEvent(EVENT_HATEFUL, 1 * IN_MILLISECONDS);
break;
}
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK, true);
Talk(EMOTE_BERSERK);
- events.ScheduleEvent(EVENT_SLIME, 2000);
+ events.ScheduleEvent(EVENT_SLIME, 2 * IN_MILLISECONDS);
break;
case EVENT_SLIME:
DoCastVictim(SPELL_SLIME_BOLT, true);
- events.ScheduleEvent(EVENT_SLIME, 2000);
+ events.ScheduleEvent(EVENT_SLIME, 2 * IN_MILLISECONDS);
break;
}
}
@@ -149,7 +185,7 @@ public:
if (!Enraged && HealthBelowPct(5))
{
DoCast(me, SPELL_FRENZY, true);
- Talk(EMOTE_ENRAGE);
+ Talk(EMOTE_FRENZY);
Enraged = true;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index ee482c23d1b..02a7aa570e5 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -43,6 +43,7 @@ enum Spells
SPELL_BERSERK = 26662,
SPELL_DIES = 29357,
SPELL_CHILL = 28547,
+ SPELL_CHECK_RESISTS = 60539,
};
enum Phases
@@ -67,7 +68,8 @@ enum Events
EVENT_EXPLOSION,
EVENT_LAND,
EVENT_GROUND,
- EVENT_BIRTH
+ EVENT_BIRTH,
+ EVENT_CHECK_RESISTS
};
enum Misc
@@ -90,10 +92,9 @@ class boss_sapphiron : public CreatureScript
struct boss_sapphironAI : public BossAI
{
boss_sapphironAI(Creature* creature) :
- BossAI(creature, BOSS_SAPPHIRON), _map(me->GetMap())
+ BossAI(creature, BOSS_SAPPHIRON), _iceboltCount(0), _map(me->GetMap())
{
Initialize();
- _iceboltCount = 0;
}
void Initialize()
@@ -101,7 +102,6 @@ class boss_sapphiron : public CreatureScript
_phase = PHASE_NULL;
_canTheHundredClub = true;
- _checkFrostResistTimer = 5 * IN_MILLISECONDS;
}
void InitializeAI() override
@@ -123,7 +123,16 @@ class boss_sapphiron : public CreatureScript
_Reset();
if (_phase == PHASE_FLIGHT)
+ {
ClearIceBlock();
+ me->SetReactState(REACT_AGGRESSIVE);
+ if (me->IsHovering())
+ {
+ me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
+ me->SetHover(false);
+ }
+ me->SetDisableGravity(false);
+ }
Initialize();
}
@@ -134,22 +143,30 @@ class boss_sapphiron : public CreatureScript
me->CastSpell(me, SPELL_FROST_AURA, true);
+ DoCast(me, SPELL_CHECK_RESISTS);
+ events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_BERSERK, 15 * MINUTE * IN_MILLISECONDS);
EnterPhaseGround();
-
- CheckPlayersFrostResist();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
- if (spell->Id == SPELL_ICEBOLT)
+ switch(spell->Id)
{
- IceBlockMap::iterator itr = _iceblocks.find(target->GetGUID());
- if (itr != _iceblocks.end() && !itr->second)
+ case SPELL_ICEBOLT:
{
- if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25))
- itr->second = iceblock->GetGUID();
+ IceBlockMap::iterator itr = _iceblocks.find(target->GetGUID());
+ if (itr != _iceblocks.end() && !itr->second)
+ {
+ if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25))
+ itr->second = iceblock->GetGUID();
+ }
+ break;
}
+ case SPELL_CHECK_RESISTS:
+ if (target && target->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
+ _canTheHundredClub = false;
+ break;
}
}
@@ -157,8 +174,6 @@ class boss_sapphiron : public CreatureScript
{
_JustDied();
me->CastSpell(me, SPELL_DIES, true);
-
- CheckPlayersFrostResist();
}
void MovementInform(uint32 /*type*/, uint32 id) override
@@ -176,22 +191,6 @@ class boss_sapphiron : public CreatureScript
}
}
- void CheckPlayersFrostResist()
- {
- if (_canTheHundredClub && _map && _map->IsRaid())
- {
- Map::PlayerList const &players = _map->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (itr->GetSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
- {
- _canTheHundredClub = false;
- break;
- }
- }
- }
- }
-
void EnterPhaseGround()
{
_phase = PHASE_GROUND;
@@ -235,23 +234,16 @@ class boss_sapphiron : public CreatureScript
if ((_phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom())
return;
- if (_canTheHundredClub)
- {
- if (_checkFrostResistTimer <= diff)
- {
- CheckPlayersFrostResist();
- _checkFrostResistTimer = 5 * IN_MILLISECONDS;
- }
- else
- _checkFrostResistTimer -= diff;
- }
-
if (_phase == PHASE_GROUND)
{
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
+ case EVENT_CHECK_RESISTS:
+ DoCast(me, SPELL_CHECK_RESISTS);
+ events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS);
+ return;
case EVENT_BERSERK:
Talk(EMOTE_ENRAGE);
DoCast(me, SPELL_BERSERK);
@@ -270,7 +262,6 @@ class boss_sapphiron : public CreatureScript
return;
case EVENT_BLIZZARD:
{
- //DoCastAOE(SPELL_SUMMON_BLIZZARD);
if (Creature* summon = DoSummon(NPC_BLIZZARD, me, 0.0f, urand(25, 30) * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN))
summon->GetMotionMaster()->MoveRandom(40);
events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20, 7) * IN_MILLISECONDS, 0, PHASE_GROUND);
@@ -300,9 +291,14 @@ class boss_sapphiron : public CreatureScript
{
switch (eventId)
{
+ case EVENT_CHECK_RESISTS:
+ DoCast(me, SPELL_CHECK_RESISTS);
+ events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS);
+ return;
case EVENT_LIFTOFF:
Talk(EMOTE_AIR_PHASE);
me->SetDisableGravity(true);
+ me->SetHover(true);
events.ScheduleEvent(EVENT_ICEBOLT, 1500);
_iceboltCount = RAID_MODE(2, 3);
return;
@@ -346,6 +342,7 @@ class boss_sapphiron : public CreatureScript
case EVENT_LAND:
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
Talk(EMOTE_GROUND_PHASE);
+ me->SetHover(false);
me->SetDisableGravity(false);
events.ScheduleEvent(EVENT_GROUND, 1500);
return;
@@ -406,7 +403,6 @@ class boss_sapphiron : public CreatureScript
uint32 _iceboltCount;
IceBlockMap _iceblocks;
bool _canTheHundredClub;
- uint32 _checkFrostResistTimer;
Map* _map;
};
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index 7c99fe40e32..d1f2be5525d 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -80,7 +80,7 @@ public:
void SpawnGameObject(uint32 entry, Position const& pos)
{
GameObject* go = new GameObject();
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
+ if (!go->Create(instance->GenerateLowGuid<HighGuid::GameObject>(), entry, instance,
PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
0, 0, 0, 0, 120, GO_STATE_READY))
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index 61d64413178..b31436f656a 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -97,9 +97,6 @@ enum Creatures
NPC_MIMIRON_TARGET_BEACON = 33369,
NPC_HODIR_TARGET_BEACON = 33108,
NPC_FREYA_TARGET_BEACON = 33366,
- NPC_LOREKEEPER = 33686, // Hard mode starter
- NPC_BRANZ_BRONZBEARD = 33579,
- NPC_DELORAH = 33701,
NPC_ULDUAR_GAUNTLET_GENERATOR = 33571, // Trigger tied to towers
};
@@ -1167,9 +1164,49 @@ class npc_freya_ward_summon : public CreatureScript
}
};
-//npc lore keeper
-#define GOSSIP_ITEM_1 "Activate secondary defensive systems"
-#define GOSSIP_ITEM_2 "Confirmed"
+enum BrannBronzebeardGossips
+{
+ GOSSIP_MENU_BRANN_BRONZEBEARD = 10355,
+ GOSSIP_OPTION_BRANN_BRONZEBEARD = 0
+};
+
+class npc_brann_bronzebeard_ulduar_intro : public CreatureScript
+{
+ public:
+ npc_brann_bronzebeard_ulduar_intro() : CreatureScript("npc_brann_bronzebeard_ulduar_intro") { }
+
+ struct npc_brann_bronzebeard_ulduar_introAI : public ScriptedAI
+ {
+ npc_brann_bronzebeard_ulduar_introAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ }
+
+ void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
+ {
+ if (menuId == GOSSIP_MENU_BRANN_BRONZEBEARD && gossipListId == GOSSIP_OPTION_BRANN_BRONZEBEARD)
+ {
+ player->PlayerTalkClass->SendCloseGossip();
+ if (Creature* loreKeeper = _instance->GetCreature(DATA_LORE_KEEPER_OF_NORGANNON))
+ loreKeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ }
+ }
+
+ private:
+ InstanceScript* _instance;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetUlduarAI<npc_brann_bronzebeard_ulduar_introAI>(creature);
+ }
+};
+
+enum LoreKeeperGossips
+{
+ GOSSIP_MENU_LORE_KEEPER = 10477,
+ GOSSIP_OPTION_LORE_KEEPER = 0
+};
class npc_lorekeeper : public CreatureScript
{
@@ -1180,6 +1217,7 @@ class npc_lorekeeper : public CreatureScript
{
npc_lorekeeperAI(Creature* creature) : ScriptedAI(creature)
{
+ _instance = creature->GetInstanceScript();
}
void DoAction(int32 action) override
@@ -1187,66 +1225,42 @@ class npc_lorekeeper : public CreatureScript
// Start encounter
if (action == ACTION_SPAWN_VEHICLES)
{
- for (int32 i = 0; i < RAID_MODE(2, 5); ++i)
+ for (uint8 i = 0; i < RAID_MODE(2, 5); ++i)
DoSummon(VEHICLE_SIEGE, PosSiege[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
- for (int32 i = 0; i < RAID_MODE(2, 5); ++i)
+ for (uint8 i = 0; i < RAID_MODE(2, 5); ++i)
DoSummon(VEHICLE_CHOPPER, PosChopper[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
- for (int32 i = 0; i < RAID_MODE(2, 5); ++i)
+ for (uint8 i = 0; i < RAID_MODE(2, 5); ++i)
DoSummon(VEHICLE_DEMOLISHER, PosDemolisher[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
- return;
}
}
- };
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- player->CLOSE_GOSSIP_MENU();
- InstanceScript* instance = creature->GetInstanceScript();
- if (!instance)
- return true;
- switch (action)
+ void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
{
- case GOSSIP_ACTION_INFO_DEF+1:
- player->PrepareGossipMenu(creature);
- instance->instance->LoadGrid(364, -16); //make sure leviathan is loaded
+ if (menuId == GOSSIP_MENU_LORE_KEEPER && gossipListId == GOSSIP_OPTION_LORE_KEEPER)
+ {
+ player->PlayerTalkClass->SendCloseGossip();
+ _instance->instance->LoadGrid(364, -16); // make sure leviathan is loaded
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- if (Creature* leviathan = instance->instance->GetCreature(instance->GetGuidData(BOSS_LEVIATHAN)))
+ if (Creature* leviathan = _instance->instance->GetCreature(_instance->GetGuidData(BOSS_LEVIATHAN)))
{
leviathan->AI()->DoAction(ACTION_START_HARD_MODE);
- creature->SetVisible(false);
- creature->AI()->DoAction(ACTION_SPAWN_VEHICLES); // spawn the vehicles
- if (Creature* Delorah = creature->FindNearestCreature(NPC_DELORAH, 1000, true))
+ me->SetVisible(false);
+ DoAction(ACTION_SPAWN_VEHICLES); // spawn the vehicles
+ if (Creature* delorah = _instance->GetCreature(DATA_DELLORAH))
{
- if (Creature* Branz = creature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true))
+ if (Creature* brann = _instance->GetCreature(DATA_BRANN_BRONZEBEARD_INTRO))
{
- Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ());
- /// @todo Delorah->AI()->Talk(xxxx, Branz->GetGUID()); when reached at branz
+ delorah->GetMotionMaster()->MovePoint(0, brann->GetPositionX() - 4, brann->GetPositionY(), brann->GetPositionZ());
+ /// @todo delorah->AI()->Talk(xxxx, brann->GetGUID()); when reached at branz
}
}
}
- break;
+ }
}
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- InstanceScript* instance = creature->GetInstanceScript();
- if (instance && instance->GetData(BOSS_LEVIATHAN) != DONE && player)
- {
- player->PrepareGossipMenu(creature);
-
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- }
- return true;
- }
+ private:
+ InstanceScript* _instance;
+ };
CreatureAI* GetAI(Creature* creature) const override
{
@@ -1254,56 +1268,6 @@ class npc_lorekeeper : public CreatureScript
}
};
-//enable hardmode
-////npc_brann_bronzebeard this requires more work involving area triggers. if reached this guy speaks through his radio..
-//#define GOSSIP_ITEM_1 "xxxxx"
-//#define GOSSIP_ITEM_2 "xxxxx"
-//
-/*
-class npc_brann_bronzebeard : public CreatureScript
-{
-public:
- npc_brann_bronzebeard() : CreatureScript("npc_brann_bronzebeard") { }
-
- //bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
- //{
- // player->PlayerTalkClass->ClearMenus();
- // switch (action)
- // {
- // case GOSSIP_ACTION_INFO_DEF+1:
- // if (player)
- // {
- // player->PrepareGossipMenu(creature);
- //
- // player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- // player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- // }
- // break;
- // case GOSSIP_ACTION_INFO_DEF+2:
- // if (player)
- // player->CLOSE_GOSSIP_MENU();
- // if (Creature* Lorekeeper = creature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon
- // Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- // break;
- // }
- // return true;
- //}
- //bool OnGossipHello(Player* player, Creature* creature) override
- //{
- // InstanceScript* instance = creature->GetInstanceScript();
- // if (instance && instance->GetData(BOSS_LEVIATHAN) !=DONE)
- // {
- // player->PrepareGossipMenu(creature);
- //
- // player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- // player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- // }
- // return true;
- //}
- //
-}
-*/
-
class go_ulduar_tower : public GameObjectScript
{
public:
@@ -1836,8 +1800,8 @@ void AddSC_boss_flame_leviathan()
new npc_hodirs_fury();
new npc_freyas_ward();
new npc_freya_ward_summon();
+ new npc_brann_bronzebeard_ulduar_intro();
new npc_lorekeeper();
- // new npc_brann_bronzebeard();
new go_ulduar_tower();
new achievement_three_car_garage_demolisher();
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 818bb0041a9..6958b5d78a5 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -749,8 +749,8 @@ class boss_elder_brightleaf : public CreatureScript
case EVENT_SOLAR_FLARE:
{
uint8 stackAmount = 0;
- if (me->GetAura(SPELL_FLUX_AURA))
- stackAmount = me->GetAura(SPELL_FLUX_AURA)->GetStackAmount();
+ if (Aura* aura = me->GetAura(SPELL_FLUX_AURA))
+ stackAmount = aura->GetStackAmount();
me->CastCustomSpell(SPELL_SOLAR_FLARE, SPELLVALUE_MAX_TARGETS, stackAmount, me, false);
events.ScheduleEvent(EVENT_SOLAR_FLARE, urand(5000, 10000));
break;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 0c7df100f60..f2edfa816a0 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -54,6 +54,15 @@ MinionData const minionData[] =
{ 0, 0, }
};
+ObjectData const creatureData[] =
+{
+ { NPC_BRANN_BRONZEBEARD_INTRO, DATA_BRANN_BRONZEBEARD_INTRO },
+ { NPC_LORE_KEEPER_OF_NORGANNON, DATA_LORE_KEEPER_OF_NORGANNON },
+ { NPC_HIGH_EXPLORER_DELLORAH, DATA_DELLORAH },
+ { NPC_BRONZEBEARD_RADIO, DATA_BRONZEBEARD_RADIO },
+ { 0, 0, }
+};
+
class instance_ulduar : public InstanceMapScript
{
public:
@@ -68,6 +77,7 @@ class instance_ulduar : public InstanceMapScript
LoadDoorData(doorData);
LoadMinionData(minionData);
+ LoadObjectData(creatureData, nullptr);
_algalonTimer = 61;
_maxArmorItemLevel = 0;
@@ -420,6 +430,8 @@ class instance_ulduar : public InstanceMapScript
algalon->AI()->JustSummoned(creature);
break;
}
+
+ InstanceScript::OnCreatureCreate(creature);
}
void OnCreatureRemove(Creature* creature) override
@@ -446,6 +458,8 @@ class instance_ulduar : public InstanceMapScript
default:
break;
}
+
+ InstanceScript::OnCreatureRemove(creature);
}
void OnGameObjectCreate(GameObject* gameObject) override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index 9f640c410ef..834ab32864f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -80,6 +80,23 @@ enum UlduarNPCs
NPC_YOGG_SARON = 33288,
NPC_ALGALON = 32871,
+ // Flame Leviathan
+ NPC_ULDUAR_COLOSSUS = 33237,
+ NPC_BRANN_BRONZEBEARD_INTRO = 33579,
+ NPC_BRANN_BRONZEBEARD_FLYING_MACHINE = 34119,
+ NPC_BRANN_S_FLYING_MACHINE = 34120,
+ NPC_ARCHMAGE_PENTARUS = 33624,
+ NPC_ARCHMAGE_RHYDIAN = 33696,
+ NPC_LORE_KEEPER_OF_NORGANNON = 33686,
+ NPC_HIGH_EXPLORER_DELLORAH = 33701,
+ NPC_BRONZEBEARD_RADIO = 34054,
+ NPC_FLAME_LEVIATHAN = 33113,
+ NPC_FLAME_LEVIATHAN_SEAT = 33114,
+ NPC_FLAME_LEVIATHAN_TURRET = 33139,
+ NPC_LEVIATHAN_DEFENSE_TURRET = 33142,
+ NPC_OVERLOAD_CONTROL_DEVICE = 33143,
+ NPC_ORBITAL_SUPPORT = 34286,
+
// Mimiron
NPC_LEVIATHAN_MKII = 33432,
NPC_VX_001 = 33651,
@@ -382,6 +399,12 @@ enum UlduarData
DATA_UNIVERSE_GLOBE,
DATA_ALGALON_TRAPDOOR,
DATA_BRANN_BRONZEBEARD_ALG,
+
+ // Misc
+ DATA_BRANN_BRONZEBEARD_INTRO,
+ DATA_LORE_KEEPER_OF_NORGANNON,
+ DATA_DELLORAH,
+ DATA_BRONZEBEARD_RADIO
};
enum UlduarWorldStates
diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp
index f5514cc51a5..79a20da9702 100644
--- a/src/server/scripts/Northrend/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/isle_of_conquest.cpp
@@ -248,7 +248,7 @@ class spell_ioc_launch : public SpellScriptLoader
x = GetExplTargetDest()->GetPositionX();
y = GetExplTargetDest()->GetPositionY();
z = GetExplTargetDest()->GetPositionZ();
- GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(x, y, z, GetHitPlayer()->GetGUIDLow()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500));
+ GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(x, y, z, GetHitPlayer()->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500));
}
void Register() override
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
index dec236e5f33..9224817b699 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "MapManager.h"
#include "ScriptMgr.h"
#include "OutdoorPvPEP.h"
#include "WorldPacket.h"
@@ -70,16 +71,14 @@ void OPvPCapturePointEP_EWT::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_EWT_FLAGS]);
- if (flag)
- {
- flag->SetGoArtKit(artkit);
- }
- if (flag2)
- {
- flag2->SetGoArtKit(artkit);
- }
+ Map* map = sMapMgr->FindMap(0, 0);
+ auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
+
+ bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_EWT_FLAGS]);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
UpdateTowerState();
@@ -180,16 +179,14 @@ void OPvPCapturePointEP_NPT::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_FLAGS]);
- if (flag)
- {
- flag->SetGoArtKit(artkit);
- }
- if (flag2)
- {
- flag2->SetGoArtKit(artkit);
- }
+ Map* map = sMapMgr->FindMap(0, 0);
+ auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
+
+ bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_FLAGS]);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
UpdateTowerState();
@@ -223,9 +220,12 @@ void OPvPCapturePointEP_NPT::SummonGO(uint32 team)
m_SummonedGOSide = team;
DelObject(EP_NPT_BUFF);
AddObject(EP_NPT_BUFF, EP_NPT_LordaeronShrine.entry, EP_NPT_LordaeronShrine.map, EP_NPT_LordaeronShrine.x, EP_NPT_LordaeronShrine.y, EP_NPT_LordaeronShrine.z, EP_NPT_LordaeronShrine.o, EP_NPT_LordaeronShrine.rot0, EP_NPT_LordaeronShrine.rot1, EP_NPT_LordaeronShrine.rot2, EP_NPT_LordaeronShrine.rot3);
- GameObject* go = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_BUFF]);
- if (go)
- go->SetUInt32Value(GAMEOBJECT_FACTION, (team == ALLIANCE ? 84 : 83));
+
+ Map* map = sMapMgr->FindMap(0, 0);
+ auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_BUFF]);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ if (GameObject* go = itr->second)
+ go->SetUInt32Value(GAMEOBJECT_FACTION, (team == ALLIANCE ? 84 : 83));
}
}
@@ -274,16 +274,14 @@ void OPvPCapturePointEP_CGT::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_CGT_FLAGS]);
- if (flag)
- {
- flag->SetGoArtKit(artkit);
- }
- if (flag2)
- {
- flag2->SetGoArtKit(artkit);
- }
+ Map* map = sMapMgr->FindMap(0, 0);
+ auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
+
+ bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_CGT_FLAGS]);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
UpdateTowerState();
@@ -375,16 +373,14 @@ void OPvPCapturePointEP_PWT::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]);
- if (flag)
- {
- flag->SetGoArtKit(artkit);
- }
- if (flag2)
- {
- flag2->SetGoArtKit(artkit);
- }
+ Map* map = sMapMgr->FindMap(0, 0);
+ auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
+
+ bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_PWT_FLAGS]);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
UpdateTowerState();
@@ -479,6 +475,7 @@ bool OutdoorPvPEP::SetupOutdoorPvP()
AddCapturePoint(new OPvPCapturePointEP_PWT(this));
AddCapturePoint(new OPvPCapturePointEP_CGT(this));
AddCapturePoint(new OPvPCapturePointEP_NPT(this));
+ SetMapFromZone(EPBuffZones[0]);
return true;
}
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index f8a7647a1d5..a639962efde 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "MapManager.h"
#include "ScriptMgr.h"
#include "OutdoorPvPHP.h"
#include "OutdoorPvP.h"
@@ -58,6 +59,7 @@ OutdoorPvPHP::OutdoorPvPHP()
m_TypeId = OUTDOOR_PVP_HP;
m_AllianceTowersControlled = 0;
m_HordeTowersControlled = 0;
+ SetMapFromZone(OutdoorPvPHPBuffZones[0]);
}
bool OutdoorPvPHP::SetupOutdoorPvP()
@@ -238,16 +240,14 @@ void OPvPCapturePointHP::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[m_TowerType]);
- if (flag)
- {
- flag->SetGoArtKit(artkit);
- }
- if (flag2)
- {
- flag2->SetGoArtKit(artkit2);
- }
+ Map* map = sMapMgr->FindMap(530, 0);
+ auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
+
+ bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[m_TowerType]);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit2);
// send world state update
if (field)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 761e12b226c..8664acdfc57 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "MapManager.h"
#include "ScriptMgr.h"
#include "OutdoorPvPNA.h"
#include "Player.h"
@@ -43,7 +44,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed)
uint32 OPvPCapturePointNA::GetAliveGuardsCount()
{
uint32 cnt = 0;
- for (std::map<uint32, ObjectGuid>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
+ for (std::map<uint32, uint32>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
{
switch (itr->first)
{
@@ -62,10 +63,13 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount()
case NA_NPC_GUARD_13:
case NA_NPC_GUARD_14:
case NA_NPC_GUARD_15:
- if (Creature const* const cr = HashMapHolder<Creature>::Find(itr->second))
- if (cr->IsAlive())
+ {
+ auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(itr->second);
+ for (auto itr2 = bounds.first; itr2 != bounds.second; ++itr2)
+ if (itr2->second->IsAlive())
++cnt;
break;
+ }
default:
break;
}
@@ -186,6 +190,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
{
// m_TypeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup
// add the zones affected by the pvp buff
+ SetMapFromZone(NA_BUFF_ZONE);
RegisterZone(NA_BUFF_ZONE);
// halaa
@@ -372,9 +377,9 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
return false;
}
-int32 OPvPCapturePointNA::HandleOpenGo(Player* player, ObjectGuid guid)
+int32 OPvPCapturePointNA::HandleOpenGo(Player* player, GameObject* go)
{
- int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid);
+ int32 retval = OPvPCapturePoint::HandleOpenGo(player, go);
if (retval >= 0)
{
const go_type * gos = NULL;
@@ -567,11 +572,9 @@ void OPvPCapturePointNA::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- if (flag)
- {
- flag->SetGoArtKit(artkit);
- }
+ auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
UpdateHalaaWorldState();
}
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
index fac9d8fa357..07bf6919b7a 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
@@ -269,7 +269,7 @@ class OPvPCapturePointNA : public OPvPCapturePoint
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go) override;
- int32 HandleOpenGo(Player* player, ObjectGuid guid) override;
+ int32 HandleOpenGo(Player* player, GameObject* go) override;
uint32 GetAliveGuardsCount();
uint32 GetControllingFaction() const;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index f052824538e..94ec7acba1f 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -58,6 +58,8 @@ void OutdoorPvPSI::UpdateWorldState()
bool OutdoorPvPSI::SetupOutdoorPvP()
{
+ SetMapFromZone(OutdoorPvPSIBuffZones[0]);
+
for (uint8 i = 0; i < OutdoorPvPSIBuffZonesNum; ++i)
RegisterZone(OutdoorPvPSIBuffZones[i]);
return true;
@@ -166,7 +168,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
return true;
}
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
+ if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{
delete go;
return true;
@@ -200,7 +202,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
return true;
}
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
+ if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{
delete go;
return true;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
index 17736c7747b..0b68a45f8a5 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "MapManager.h"
#include "ScriptMgr.h"
#include "OutdoorPvPTF.h"
#include "OutdoorPvPMgr.h"
@@ -227,6 +228,8 @@ bool OutdoorPvPTF::SetupOutdoorPvP()
second_digit = 0;
first_digit = 0;
+ SetMapFromZone(OutdoorPvPTFBuffZones[0]);
+
// add the zones affected by the pvp buff
for (uint8 i = 0; i < OutdoorPvPTFBuffZonesNum; ++i)
RegisterZone(OutdoorPvPTFBuffZones[i]);
@@ -310,9 +313,9 @@ void OPvPCapturePointTF::ChangeState()
break;
}
- GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
- if (flag)
- flag->SetGoArtKit(artkit);
+ auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ for (auto itr = bounds.first; itr != bounds.second; ++itr)
+ itr->second->SetGoArtKit(artkit);
UpdateTowerState();
}
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index ee86d8efc90..54aa815617e 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "MapManager.h"
#include "ScriptMgr.h"
#include "OutdoorPvPZM.h"
#include "ObjectMgr.h"
@@ -151,6 +152,8 @@ bool OutdoorPvPZM::SetupOutdoorPvP()
m_AllianceTowersControlled = 0;
m_HordeTowersControlled = 0;
+ SetMapFromZone(OutdoorPvPZMBuffZones[0]);
+
// add the zones affected by the pvp buff
for (uint8 i = 0; i < OutdoorPvPZMBuffZonesNum; ++i)
RegisterZone(OutdoorPvPZMBuffZones[i]);
@@ -181,9 +184,9 @@ bool OPvPCapturePointZM_GraveYard::Update(uint32 /*diff*/)
return retval;
}
-int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, ObjectGuid guid)
+int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go)
{
- int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid);
+ int32 retval = OPvPCapturePoint::HandleOpenGo(player, go);
if (retval >= 0)
{
if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A)
@@ -297,8 +300,8 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/)
{
- ObjectGuid guid = c->GetGUID();
- std::map<ObjectGuid, uint32>::iterator itr = m_CreatureTypes.find(guid);
+ std::map<uint32, uint32>::iterator itr = m_CreatureTypes.find(c->GetSpawnId());
+
if (itr != m_CreatureTypes.end())
{
if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
@@ -309,25 +312,23 @@ bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, Gossip
return false;
}
-bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, ObjectGuid guid, uint32 /*gossipid*/)
+bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/)
{
- std::map<ObjectGuid, uint32>::iterator itr = m_CreatureTypes.find(guid);
+ std::map<uint32, uint32>::iterator itr = m_CreatureTypes.find(creature->GetSpawnId());
+
if (itr != m_CreatureTypes.end())
{
- Creature* cr = HashMapHolder<Creature>::Find(guid);
- if (!cr)
- return true;
// if the flag is already taken, then return
if (m_FlagCarrierGUID)
return true;
if (itr->second == ZM_ALLIANCE_FIELD_SCOUT)
{
- cr->CastSpell(player, ZM_BATTLE_STANDARD_A, true);
+ creature->CastSpell(player, ZM_BATTLE_STANDARD_A, true);
m_FlagCarrierGUID = player->GetGUID();
}
else if (itr->second == ZM_HORDE_FIELD_SCOUT)
{
- cr->CastSpell(player, ZM_BATTLE_STANDARD_H, true);
+ creature->CastSpell(player, ZM_BATTLE_STANDARD_H, true);
m_FlagCarrierGUID = player->GetGUID();
}
UpdateTowerState();
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
index a07905b3ae6..4be0d0eedb7 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
@@ -192,11 +192,11 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint
void UpdateTowerState();
- int32 HandleOpenGo(Player* player, ObjectGuid guid) override;
+ int32 HandleOpenGo(Player* player, GameObject* go) override;
void SetBeaconState(uint32 controlling_team); // not good atm
- bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid) override;
+ bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipid) override;
bool HandleDropFlag(Player* player, uint32 spellId) override;
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 68c115f9faf..0ab7c2fcb54 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -614,6 +614,47 @@ class spell_gen_burn_brutallus : public SpellScriptLoader
}
};
+// 48750 - Burning Depths Necrolyte Image
+class spell_gen_burning_depths_necrolyte_image : public SpellScriptLoader
+{
+ public:
+ spell_gen_burning_depths_necrolyte_image() : SpellScriptLoader("spell_gen_burning_depths_necrolyte_image") { }
+
+ class spell_gen_burning_depths_necrolyte_image_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_burning_depths_necrolyte_image_AuraScript);
+
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->Effects[EFFECT_2].CalcValue())))
+ return false;
+ return true;
+ }
+
+ void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(GetTarget(), uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()));
+ }
+
+ void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()), GetCasterGUID());
+ }
+
+ void Register() override
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_burning_depths_necrolyte_image_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_gen_burning_depths_necrolyte_image_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_gen_burning_depths_necrolyte_image_AuraScript();
+ }
+};
+
enum CannibalizeSpells
{
SPELL_CANNIBALIZE_TRIGGERED = 20578
@@ -4093,6 +4134,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_break_shield("spell_gen_break_shield");
new spell_gen_break_shield("spell_gen_tournament_counterattack");
new spell_gen_burn_brutallus();
+ new spell_gen_burning_depths_necrolyte_image();
new spell_gen_cannibalize();
new spell_gen_chaos_blast();
new spell_gen_clone();
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index da50f471f1c..23a6cdee8a9 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -233,7 +233,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
if (!spellInfo)
{
- TC_LOG_ERROR("spells", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]);
+ TC_LOG_ERROR("spells", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUID().GetCounter(), enchant->spellid[s]);
continue;
}
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
index 50195887ec2..4a60a80ee5a 100644
--- a/src/server/scripts/World/action_ip_logger.cpp
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -201,7 +201,7 @@ class CharacterActionIpLogger : public PlayerScript
// We declare all the required variables
uint32 playerGuid = player->GetSession()->GetAccountId();
- uint32 characterGuid = player->GetGUIDLow();
+ uint32 characterGuid = player->GetGUID().GetCounter();
const std::string currentIp = player->GetSession()->GetRemoteAddress();
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it...
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 57346443390..22eabd3dd65 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -57,6 +57,7 @@ EndContentData */
#include "SpellAuras.h"
#include "Pet.h"
#include "CreatureTextMgr.h"
+#include "SmartAI.h"
/*########
# npc_air_force_bots
@@ -2321,6 +2322,71 @@ public:
}
};
+enum StableMasters
+{
+ SPELL_MINIWING = 54573,
+ SPELL_JUBLING = 54611,
+ SPELL_DARTER = 54619,
+ SPELL_WORG = 54631,
+ SPELL_SMOLDERWEB = 54634,
+ SPELL_CHIKEN = 54677,
+ SPELL_WOLPERTINGER = 54688,
+
+ STABLE_MASTER_GOSSIP_SUB_MENU = 9820
+};
+
+class npc_stable_master : public CreatureScript
+{
+ public:
+ npc_stable_master() : CreatureScript("npc_stable_master") { }
+
+ struct npc_stable_masterAI : public SmartAI
+ {
+ npc_stable_masterAI(Creature* creature) : SmartAI(creature) { }
+
+ void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
+ {
+ SmartAI::sGossipSelect(player, menuId, gossipListId);
+ if (menuId != STABLE_MASTER_GOSSIP_SUB_MENU)
+ return;
+
+ switch (gossipListId)
+ {
+ case 0:
+ player->CastSpell(player, SPELL_MINIWING, false);
+ break;
+ case 1:
+ player->CastSpell(player, SPELL_JUBLING, false);
+ break;
+ case 2:
+ player->CastSpell(player, SPELL_DARTER, false);
+ break;
+ case 3:
+ player->CastSpell(player, SPELL_WORG, false);
+ break;
+ case 4:
+ player->CastSpell(player, SPELL_SMOLDERWEB, false);
+ break;
+ case 5:
+ player->CastSpell(player, SPELL_CHIKEN, false);
+ break;
+ case 6:
+ player->CastSpell(player, SPELL_WOLPERTINGER, false);
+ break;
+ default:
+ return;
+ }
+
+ player->PlayerTalkClass->SendCloseGossip();
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_stable_masterAI(creature);
+ }
+};
+
void AddSC_npcs_special()
{
new npc_air_force_bots();
@@ -2343,4 +2409,5 @@ void AddSC_npcs_special()
new npc_firework();
new npc_spring_rabbit();
new npc_imp_in_a_ball();
+ new npc_stable_master();
}