aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-09-20 11:05:30 +0200
committerShauren <shauren.trinity@gmail.com>2014-09-20 11:05:30 +0200
commit8e288dd6731ed608d8285f9f966783ee9b46eebf (patch)
treea0dfb3e110f4ba63214ccde1ade6d633294e4746 /src/server/scripts/Commands
parent7cbaa028cd3192725ed47226c08fb3e6f82f02d3 (diff)
parent050d56ac21fff48d260908e72e430f212e1d770d (diff)
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Achievements/AchievementMgr.cpp src/server/game/Battlefield/Battlefield.h src/server/game/Battlegrounds/ArenaScore.h src/server/game/Battlegrounds/ArenaTeam.cpp src/server/game/Battlegrounds/ArenaTeam.h src/server/game/Battlegrounds/ArenaTeamMgr.cpp src/server/game/Battlegrounds/BattlegroundMgr.cpp src/server/game/Battlegrounds/BattlegroundMgr.h src/server/game/Battlegrounds/BattlegroundQueue.h src/server/game/Battlegrounds/BattlegroundScore.h src/server/game/Battlegrounds/Zones/BattlegroundAB.h src/server/game/Battlegrounds/Zones/BattlegroundAV.h src/server/game/Battlegrounds/Zones/BattlegroundEY.h src/server/game/Battlegrounds/Zones/BattlegroundIC.h src/server/game/Battlegrounds/Zones/BattlegroundSA.h src/server/game/Battlegrounds/Zones/BattlegroundWS.h src/server/game/DungeonFinding/LFG.h src/server/game/DungeonFinding/LFGMgr.cpp src/server/game/DungeonFinding/LFGMgr.h src/server/game/DungeonFinding/LFGQueue.cpp src/server/game/DungeonFinding/LFGQueue.h src/server/game/Entities/Corpse/Corpse.cpp src/server/game/Entities/Creature/Creature.cpp src/server/game/Entities/Creature/GossipDef.cpp src/server/game/Entities/Creature/GossipDef.h src/server/game/Entities/Creature/TemporarySummon.cpp src/server/game/Entities/DynamicObject/DynamicObject.cpp src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Object/Object.h src/server/game/Entities/Object/ObjectDefines.h src/server/game/Entities/Object/Updates/UpdateData.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Player/Player.h src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Globals/ObjectAccessor.cpp src/server/game/Globals/ObjectAccessor.h src/server/game/Globals/ObjectMgr.cpp src/server/game/Groups/Group.cpp src/server/game/Groups/Group.h src/server/game/Guilds/Guild.cpp src/server/game/Guilds/Guild.h src/server/game/Handlers/AuctionHouseHandler.cpp src/server/game/Handlers/BattleGroundHandler.cpp src/server/game/Handlers/CalendarHandler.cpp src/server/game/Handlers/CharacterHandler.cpp src/server/game/Handlers/ChatHandler.cpp src/server/game/Handlers/GroupHandler.cpp src/server/game/Handlers/GuildHandler.cpp src/server/game/Handlers/ItemHandler.cpp src/server/game/Handlers/LFGHandler.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Handlers/MiscHandler.cpp src/server/game/Handlers/MovementHandler.cpp src/server/game/Handlers/NPCHandler.cpp src/server/game/Handlers/PetHandler.cpp src/server/game/Handlers/QueryHandler.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Handlers/TradeHandler.cpp src/server/game/Handlers/VehicleHandler.cpp src/server/game/Movement/Spline/MoveSplineInit.cpp src/server/game/Server/WorldSession.cpp src/server/game/Server/WorldSession.h src/server/game/Spells/Spell.cpp src/server/scripts/Commands/cs_debug.cpp src/server/scripts/Commands/cs_gm.cpp src/server/scripts/Commands/cs_misc.cpp src/server/scripts/Commands/cs_modify.cpp src/server/scripts/Commands/cs_reset.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp src/server/scripts/Kalimdor/zone_azshara.cpp src/server/scripts/Kalimdor/zone_durotar.cpp src/server/scripts/Kalimdor/zone_moonglade.cpp src/server/scripts/Kalimdor/zone_orgrimmar.cpp src/server/scripts/Kalimdor/zone_ungoro_crater.cpp src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp src/server/scripts/Spells/spell_dk.cpp src/server/scripts/Spells/spell_generic.cpp src/server/shared/Packets/ByteBuffer.h
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_account.cpp2
-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.cpp74
-rw-r--r--src/server/scripts/Commands/cs_cheat.cpp2
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp44
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp2
-rw-r--r--src/server/scripts/Commands/cs_go.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp8
-rw-r--r--src/server/scripts/Commands/cs_group.cpp24
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp10
-rw-r--r--src/server/scripts/Commands/cs_honor.cpp6
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp2
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp4
-rw-r--r--src/server/scripts/Commands/cs_list.cpp16
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp65
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp44
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp10
-rw-r--r--src/server/scripts/Commands/cs_pet.cpp2
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp4
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp12
-rw-r--r--src/server/scripts/Commands/cs_send.cpp12
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp10
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp8
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp8
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp8
26 files changed, 196 insertions, 193 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index bef9ae9532e..e398e54ad19 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -774,7 +774,7 @@ public:
if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
return false;
- if (strcmp(password, passwordConfirmation))
+ if (strcmp(password, passwordConfirmation) != 0)
{
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
handler->SetSentErrorMessage(true);
diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp
index 5658701bd54..4db7c088d35 100644
--- a/src/server/scripts/Commands/cs_arena.cpp
+++ b/src/server/scripts/Commands/cs_arena.cpp
@@ -103,7 +103,7 @@ public:
}
sArenaTeamMgr->AddArenaTeam(arena);
- handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain());
+ handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter());
}
else
{
@@ -232,7 +232,7 @@ public:
return false;
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid))
return false;
@@ -275,7 +275,7 @@ public:
arena->SetCaptain(targetGuid);
- CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(GUID_LOPART(arena->GetCaptain()));
+ CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(arena->GetCaptain());
if (!oldCaptainNameData)
{
handler->SetSentErrorMessage(true);
@@ -313,7 +313,7 @@ public:
handler->PSendSysMessage(LANG_ARENA_INFO_HEADER, arena->GetName().c_str(), arena->GetId(), arena->GetRating(), arena->GetType(), arena->GetType());
for (ArenaTeam::MemberList::iterator itr = arena->m_membersBegin(); itr != arena->m_membersEnd(); ++itr)
- handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), GUID_LOPART(itr->Guid), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : ""));
+ handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), itr->Guid.GetCounter(), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : ""));
return true;
}
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index 880cf1eac1f..e11ee0008d2 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -340,7 +340,7 @@ public:
bool permanent = (fields[1].GetUInt32() == uint32(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
- fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
+ TimeToTimestampStr(fields[0].GetUInt32()).c_str(), banTime.c_str(), active ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
}
while (result->NextRow());
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 0c6d495a360..8254d08558a 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -79,7 +79,7 @@ public:
// Stores informations about a deleted character
struct DeletedInfo
{
- uint32 lowGuid; ///< the low GUID from the character
+ ObjectGuid guid; ///< the GUID from the character
std::string name; ///< the character name
uint32 accountId; ///< the account id
std::string accountName; ///< the account name
@@ -133,7 +133,7 @@ public:
DeletedInfo info;
- info.lowGuid = fields[0].GetUInt32();
+ info.guid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
info.name = fields[1].GetString();
info.accountId = fields[2].GetUInt32();
@@ -173,11 +173,11 @@ public:
if (!handler->GetSession())
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
- itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
+ itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
else
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
- itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
+ itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
}
@@ -199,7 +199,7 @@ public:
{
if (delInfo.accountName.empty()) // account not exist
{
- handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
}
@@ -207,29 +207,29 @@ public:
uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
if (charcount >= 10)
{
- handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
}
if (sObjectMgr->GetPlayerGUIDByName(delInfo.name))
{
- handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_RESTORE_DELETE_INFO);
stmt->setString(0, delInfo.name);
stmt->setUInt32(1, delInfo.accountId);
- stmt->setUInt32(2, delInfo.lowGuid);
+ stmt->setUInt32(2, delInfo.guid.GetCounter());
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
- stmt->setUInt32(0, delInfo.lowGuid);
+ stmt->setUInt32(0, delInfo.guid.GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
- sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
+ sWorld->AddCharacterNameData(delInfo.guid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
}
- static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
+ static void HandleCharacterLevel(Player* player, ObjectGuid playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
{
if (player)
{
@@ -252,7 +252,7 @@ public:
// Update level and reset XP, everything else will be updated at login
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
stmt->setUInt8(0, uint8(newLevel));
- stmt->setUInt32(1, GUID_LOPART(playerGuid));
+ stmt->setUInt32(1, playerGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -303,7 +303,7 @@ public:
static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -318,7 +318,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
playerOldName = target->GetName();
@@ -368,7 +368,7 @@ public:
// Remove declined name from db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
- stmt->setUInt32(0, targetGuid);
+ stmt->setUInt32(0, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
if (target)
@@ -382,7 +382,7 @@ public:
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
stmt->setString(0, newName);
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -396,14 +396,14 @@ public:
sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), playerOldName.c_str(), sObjectMgr->GetPlayerAccountIdByGUID(targetGuid));
}
else
- sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (GUID: %u)", playerOldName.c_str(), newName.c_str(), GUID_LOPART(targetGuid));
+ sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (%s)", playerOldName.c_str(), newName.c_str(), targetGuid.ToString().c_str());
}
else
{
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
@@ -416,11 +416,11 @@ public:
return false;
std::string oldNameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -444,7 +444,7 @@ public:
}
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -472,7 +472,7 @@ public:
static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -488,8 +488,8 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
- handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -499,7 +499,7 @@ public:
static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
@@ -516,8 +516,8 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
+ stmt->setUInt32(1, targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -527,7 +527,7 @@ public:
static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -545,8 +545,8 @@ public:
{
std::string oldNameLink = handler->playerLink(targetName);
/// @todo add text into database
- handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
+ stmt->setUInt32(1, targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -721,7 +721,7 @@ public:
// Call the appropriate function to delete them (current account for deleted characters is 0)
for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
- Player::DeleteFromDB(itr->lowGuid, 0, false, true);
+ Player::DeleteFromDB(itr->guid, 0, false, true);
return true;
}
@@ -773,7 +773,7 @@ public:
if (!normalizePlayerName(characterName))
return false;
- uint64 characterGuid;
+ ObjectGuid characterGuid;
uint32 accountId;
Player* player = sObjectAccessor->FindPlayerByName(characterName);
@@ -799,7 +799,7 @@ public:
AccountMgr::GetName(accountId, accountName);
Player::DeleteFromDB(characterGuid, accountId, true, true);
- handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), characterGuid.GetCounter(), accountName.c_str(), accountId);
return true;
}
@@ -818,7 +818,7 @@ public:
}
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -921,7 +921,7 @@ public:
return false;
}
- if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid(HIGHGUID_PLAYER, guid)))
{
handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
handler->SetSentErrorMessage(true);
@@ -966,10 +966,10 @@ public:
if (!fileStr || !playerStr)
return false;
- uint64 guid;
+ ObjectGuid guid;
// character name can't start from number
if (isNumeric(playerStr))
- guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER);
+ guid = ObjectGuid(HIGHGUID_PLAYER, uint32(atoi(playerStr)));
else
{
std::string name = handler->extractPlayerNameFromLink(playerStr);
diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp
index 1fe7c6adf5b..54db5c2af51 100644
--- a/src/server/scripts/Commands/cs_cheat.cpp
+++ b/src/server/scripts/Commands/cs_cheat.cpp
@@ -228,7 +228,7 @@ public:
if (!chr)
chr = handler->GetSession()->GetPlayer();
- else if (handler->HasLowerSecurity(chr, 0)) // check online security
+ else if (handler->HasLowerSecurity(chr, ObjectGuid::Empty)) // check online security
return false;
if (argstr == "on")
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 4ff7efd2f0a..4b555fcf625 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -240,7 +240,7 @@ public:
return false;
SellResult msg = SellResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendSellError(msg, 0, 0);
+ handler->GetSession()->GetPlayer()->SendSellError(msg, nullptr, ObjectGuid::Empty);
return true;
}
@@ -250,7 +250,7 @@ public:
return false;
BuyResult msg = BuyResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendBuyError(msg, 0, 0, 0);
+ handler->GetSession()->GetPlayer()->SendBuyError(msg, nullptr, 0, 0);
return true;
}
@@ -321,7 +321,7 @@ public:
std::string type;
parsedStream >> type;
- if (type == "")
+ if (type.empty())
break;
if (type == "uint8")
@@ -362,11 +362,11 @@ public:
}
else if (type == "appitsguid")
{
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
}
else if (type == "appmyguid")
{
- data.append(player->GetPackGUID());
+ data << player->GetPackGUID();
}
else if (type == "appgoguid")
{
@@ -378,7 +378,7 @@ public:
ifs.close();
return false;
}
- data.append(obj->GetPackGUID());
+ data << obj->GetPackGUID();
}
else if (type == "goguid")
{
@@ -559,10 +559,10 @@ public:
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
if (Item* item2 = bag->GetItemByPos(j))
if (item2->GetState() == state)
- handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()));
+ handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter());
}
else if (item->GetState() == state)
- handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()));
+ handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter());
}
}
}
@@ -624,7 +624,7 @@ public:
if (item->GetOwnerGUID() != player->GetGUID())
{
- handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
+ handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow());
error = true;
continue;
}
@@ -684,7 +684,7 @@ public:
if (item2->GetOwnerGUID() != player->GetGUID())
{
- handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow());
+ handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter(), player->GetGUIDLow());
error = true;
continue;
}
@@ -746,7 +746,7 @@ public:
if (item->GetOwnerGUID() != player->GetGUID())
{
- handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
+ handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow());
error = true;
continue;
}
@@ -990,7 +990,7 @@ public:
uint32 guid = (uint32)atoi(e);
uint32 index = (uint32)atoi(f);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
if (!i)
return false;
@@ -1021,7 +1021,7 @@ public:
uint32 index = (uint32)atoi(f);
uint32 value = (uint32)atoi(g);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
if (!i)
return false;
@@ -1045,7 +1045,7 @@ public:
uint32 guid = (uint32)atoi(e);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
if (!i)
return false;
@@ -1124,12 +1124,12 @@ public:
return false;
}
- uint64 guid = target->GetGUID();
+ ObjectGuid guid = target->GetGUID();
uint32 field = (uint32)atoi(x);
if (field >= target->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, GUID_LOPART(guid), target->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetCounter(), target->GetValuesCount());
return false;
}
@@ -1141,13 +1141,13 @@ public:
{
uint32 value = (uint32)atoi(y);
target->SetUInt32Value(field, value);
- handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), field, value);
+ handler->PSendSysMessage(LANG_SET_UINT_FIELD, guid.GetCounter(), field, value);
}
else
{
float value = (float)atof(y);
target->SetFloatValue(field, value);
- handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), field, value);
+ handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.GetCounter(), field, value);
}
return true;
@@ -1172,12 +1172,12 @@ public:
return false;
}
- uint64 guid = target->GetGUID();
+ ObjectGuid guid = target->GetGUID();
uint32 opcode = (uint32)atoi(x);
if (opcode >= target->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, guid.GetCounter(), target->GetValuesCount());
return false;
}
@@ -1188,12 +1188,12 @@ public:
if (isInt32)
{
uint32 value = target->GetUInt32Value(opcode);
- handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), opcode, value);
+ handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetCounter(), opcode, value);
}
else
{
float value = target->GetFloatValue(opcode);
- handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value);
+ handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetCounter(), opcode, value);
}
return true;
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index d12ba9ad9b4..27ec4835ce6 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -208,7 +208,7 @@ public:
if (param == "on")
{
- if (_player->HasAura(VISUAL_AURA, 0))
+ if (_player->HasAura(VISUAL_AURA))
_player->RemoveAurasDueToSpell(VISUAL_AURA);
_player->SetGMVisible(true);
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 6c321a66c48..a7fa77fbe97 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -140,7 +140,7 @@ public:
Transport* transport = NULL;
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT), (Creature*)NULL))
+ if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, id, guid), (Creature*)NULL))
{
x = creature->GetPositionX();
y = creature->GetPositionY();
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index d7b7adc05ba..c8168a1391a 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -327,7 +327,7 @@ public:
return false;
}
- GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(guidLow, id, HIGHGUID_GAMEOBJECT));
+ 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);
@@ -370,13 +370,13 @@ public:
return false;
}
- uint64 ownerGuid = object->GetOwnerGUID();
+ ObjectGuid ownerGuid = object->GetOwnerGUID();
if (ownerGuid)
{
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
- if (!owner || !IS_PLAYER_GUID(ownerGuid))
+ if (!owner || !ownerGuid.IsPlayer())
{
- handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUIDLow());
handler->SetSentErrorMessage(true);
return false;
}
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index 470eb27bad2..e39aca6f6a7 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -57,7 +57,7 @@ public:
return false;
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
Group* group = target->GetGroup();
@@ -95,7 +95,7 @@ public:
continue;
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
std::string plNameLink = handler->GetNameLink(player);
@@ -147,7 +147,7 @@ public:
{
Player* player = NULL;
Group* group = NULL;
- uint64 guid = 0;
+ ObjectGuid guid;
char* nameStr = strtok((char*)args, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
@@ -173,7 +173,7 @@ public:
{
Player* player = NULL;
Group* group = NULL;
- uint64 guid = 0;
+ ObjectGuid guid;
char* nameStr = strtok((char*)args, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
@@ -194,7 +194,7 @@ public:
{
Player* player = NULL;
Group* group = NULL;
- uint64 guid = 0;
+ ObjectGuid guid;
char* nameStr = strtok((char*)args, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
@@ -220,8 +220,8 @@ public:
Player* playerTarget = NULL;
Group* groupSource = NULL;
Group* groupTarget = NULL;
- uint64 guidSource = 0;
- uint64 guidTarget = 0;
+ ObjectGuid guidSource;
+ ObjectGuid guidTarget;
char* nameplgrStr = strtok((char*)args, " ");
char* nameplStr = strtok(NULL, " ");
@@ -263,18 +263,18 @@ public:
// Get ALL the variables!
Player* playerTarget;
uint32 phase = 0;
- uint64 guidTarget;
+ ObjectGuid guidTarget;
std::string nameTarget;
std::string zoneName;
const char* onlineState = "";
// Parse the guid to uint32...
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
// ... and try to extract a player out of it.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
{
- playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ playerTarget = ObjectAccessor::FindPlayer(parseGUID);
guidTarget = parseGUID;
}
// If not, we return false and end right away.
@@ -292,7 +292,7 @@ public:
if (!groupTarget)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER);
- stmt->setUInt32(0, guidTarget);
+ stmt->setUInt32(0, guidTarget.GetCounter());
PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt);
if (resultGroup)
groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32());
@@ -368,7 +368,7 @@ public:
// Now we can print those informations for every single member of each group!
handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState,
- zoneName.c_str(), phase, GUID_LOPART(slot.guid), flags.c_str(),
+ zoneName.c_str(), phase, slot.guid.GetCounter(), flags.c_str(),
lfg::GetRolesString(slot.roles).c_str());
}
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index 362f16d29a3..e06fbde868c 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -132,7 +132,7 @@ public:
return false;
// if not guild name only (in "") then player name
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid))
return false;
@@ -156,7 +156,7 @@ public:
static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
@@ -181,7 +181,7 @@ public:
return false;
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string target_name;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
return false;
@@ -251,7 +251,7 @@ public:
{
Guild* guild = nullptr;
- if (args && strlen(args) > 0)
+ if (args && args[0] != '\0')
{
if (isNumeric(args))
{
@@ -275,7 +275,7 @@ public:
std::string guildMasterName;
if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))
- handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID()); // Guild Master
+ handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID().GetCounter()); // Guild Master
// Format creation date
char createdDateStr[20];
diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp
index 6b76f753403..eeaee40fea9 100644
--- a/src/server/scripts/Commands/cs_honor.cpp
+++ b/src/server/scripts/Commands/cs_honor.cpp
@@ -71,7 +71,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
uint32 amount = (uint32)atoi(args);
@@ -91,7 +91,7 @@ public:
// check online security
if (Player* player = target->ToPlayer())
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
@@ -109,7 +109,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
target->UpdateHonorFields();
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
index 464d58ad908..a426c49a5f7 100644
--- a/src/server/scripts/Commands/cs_instance.cpp
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -125,7 +125,7 @@ public:
uint16 counter = 0;
uint16 MapId = 0;
- if (strcmp(map, "all"))
+ if (strcmp(map, "all") != 0)
{
MapId = uint16(atoi(map));
if (!MapId)
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
index 2f6afd29e9f..1a4cce16d68 100644
--- a/src/server/scripts/Commands/cs_lfg.cpp
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -27,7 +27,7 @@ void GetPlayerInfo(ChatHandler* handler, Player* player)
if (!player)
return;
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
lfg::LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid);
std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
@@ -86,7 +86,7 @@ public:
return true;
}
- uint64 guid = grp->GetGUID();
+ ObjectGuid guid = grp->GetGUID();
std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(),
state.c_str(), sLFGMgr->GetDungeon(guid));
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index ff0a5519495..f12fbee44b5 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -447,8 +447,8 @@ public:
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
- (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
- GUID_LOPART(aura->GetCasterGUID()));
+ (talent ? talentStr : ""), aura->GetCasterGUID().IsPlayer() ? "player" : "creature",
+ aura->GetCasterGUID().GetCounter());
}
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
@@ -469,25 +469,25 @@ public:
static bool HandleListMailCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
PreparedStatement* stmt = NULL;
if (!*args)
return false;
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ target = ObjectAccessor::FindPlayer(parseGUID);
targetGuid = parseGUID;
}
else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT);
- stmt->setUInt32(0, targetGuid);
+ stmt->setUInt32(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
{
@@ -495,11 +495,11 @@ public:
uint32 countMail = fields[0].GetUInt64();
std::string nameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid);
+ handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid.GetCounter());
handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
- stmt->setUInt32(0, targetGuid);
+ stmt->setUInt32(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 319151141b7..9277956262f 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -135,7 +135,7 @@ public:
WorldObject* object = NULL;
if (*args)
{
- uint64 guid = handler->extractGuidFromLink((char*)args);
+ ObjectGuid guid = handler->extractGuidFromLink((char*)args);
if (guid)
object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
@@ -180,9 +180,8 @@ public:
GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
- // 63? WHY?
- int gridX = 63 - gridCoord.x_coord;
- int gridY = 63 - gridCoord.y_coord;
+ int gridX = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
+ int gridY = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
@@ -198,10 +197,12 @@ public:
else
handler->PSendSysMessage(LANG_GPS_NO_VMAP);
+ char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
+
handler->PSendSysMessage(LANG_MAP_POSITION,
- mapId, (mapEntry ? mapEntry->name : handler->GetTrinityString(LANG_UNKNOWN)),
- zoneId, (zoneEntry ? zoneEntry->area_name : handler->GetTrinityString(LANG_UNKNOWN)),
- areaId, (areaEntry ? areaEntry->area_name : handler->GetTrinityString(LANG_UNKNOWN)),
+ mapId, (mapEntry ? mapEntry->name : unknown),
+ zoneId, (zoneEntry ? zoneEntry->area_name : unknown),
+ areaId, (areaEntry ? areaEntry->area_name : unknown),
object->GetPhaseMask(),
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
@@ -265,7 +266,7 @@ public:
static bool HandleAppearCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -281,7 +282,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string chrNameLink = handler->playerLink(targetName);
@@ -408,7 +409,7 @@ public:
static bool HandleSummonCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -425,7 +426,7 @@ public:
{
std::string nameLink = handler->playerLink(targetName);
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
if (target->IsBeingTeleported())
@@ -538,7 +539,7 @@ public:
}
if (Player* player = target->ToPlayer())
- if (handler->HasLowerSecurity(player, 0, false))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
return false;
if (target->IsAlive())
@@ -555,7 +556,7 @@ public:
static bool HandleReviveCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
@@ -598,16 +599,16 @@ public:
static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
{
- uint64 guid = handler->GetSession()->GetPlayer()->GetTarget();
+ ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget();
- if (guid == 0)
+ if (guid.IsEmpty())
{
handler->SendSysMessage(LANG_NO_SELECTION);
handler->SetSentErrorMessage(true);
return false;
}
- handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
+ handler->PSendSysMessage(LANG_OBJECT_GUID, guid.GetCounter(), guid.GetHigh());
return true;
}
@@ -704,7 +705,7 @@ public:
if (*args)
{
- uint64 guid = handler->extractGuidFromLink((char*)args);
+ ObjectGuid guid = handler->extractGuidFromLink((char*)args);
if (guid)
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
@@ -738,7 +739,7 @@ public:
return false;
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
if (target->IsBeingTeleported())
@@ -806,7 +807,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON);
@@ -1381,17 +1382,17 @@ public:
{
// Define ALL the player variables!
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
PreparedStatement* stmt = NULL;
// To make sure we get a target, we convert our guid to an omniversal...
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
// ... and make sure we get a target, somehow.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ target = ObjectAccessor::FindPlayer(parseGUID);
targetGuid = parseGUID;
}
// if not, then return false. Which shouldn't happen, now should it ?
@@ -1433,7 +1434,7 @@ public:
// Account data print variables
std::string userName = handler->GetTrinityString(LANG_ERROR);
uint32 accId = 0;
- uint32 lowguid = GUID_LOPART(targetGuid);
+ uint32 lowguid = targetGuid.GetCounter();
std::string eMail = handler->GetTrinityString(LANG_ERROR);
std::string regMail = handler->GetTrinityString(LANG_ERROR);
uint32 security = 0;
@@ -1487,7 +1488,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
accId = target->GetSession()->GetAccountId();
@@ -1712,7 +1713,9 @@ public:
}
if (target)
- handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name, (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
+ handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name,
+ (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)),
+ (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
// Output XVII. - XVIX. if they are not empty
if (!guildName.empty())
@@ -1797,7 +1800,7 @@ public:
muteReasonStr = muteReason;
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -1860,7 +1863,7 @@ public:
static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -2116,7 +2119,7 @@ public:
}
if (Player* player = target->ToPlayer())
- if (handler->HasLowerSecurity(player, 0, false))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
return false;
if (!target->IsAlive())
@@ -2188,7 +2191,7 @@ public:
{
Player* target = NULL;
- if (args && strlen(args) > 0)
+ if (args && args[0] != '\0')
{
target = sObjectAccessor->FindPlayerByName(args);
if (!target)
@@ -2206,7 +2209,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
target->CombatStop();
@@ -2221,7 +2224,7 @@ public:
return false;
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
// Repair items
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 36182a535a7..d88e1670a09 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -107,7 +107,7 @@ public:
return false;
}
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_HP, handler->GetNameLink(target).c_str(), hp, hpm);
@@ -145,7 +145,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_MANA, handler->GetNameLink(target).c_str(), mana, manam);
@@ -194,7 +194,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_ENERGY, handler->GetNameLink(target).c_str(), energy/10, energym/10);
@@ -245,7 +245,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_RAGE, handler->GetNameLink(target).c_str(), rage/10, ragem/10);
@@ -399,7 +399,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, handler->GetNameLink(target).c_str());
@@ -437,7 +437,7 @@ public:
if (target->GetTypeId() == TYPEID_PLAYER)
{
// check online security
- if (handler->HasLowerSecurity(target->ToPlayer(), 0))
+ if (handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
target->ToPlayer()->SetFreeTalentPoints(tp);
target->ToPlayer()->SendTalentsInfoData(false);
@@ -449,7 +449,7 @@ public:
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
{
// check online security
- if (handler->HasLowerSecurity(owner->ToPlayer(), 0))
+ if (handler->HasLowerSecurity(owner->ToPlayer(), ObjectGuid::Empty))
return false;
((Pet*)target)->SetFreeTalentPoints(tp);
owner->ToPlayer()->SendTalentsInfoData(true);
@@ -486,7 +486,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -534,7 +534,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -579,7 +579,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -624,7 +624,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -669,7 +669,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, handler->GetNameLink(target).c_str());
@@ -706,7 +706,7 @@ public:
if (Player* player = target->ToPlayer())
{
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink(player).c_str());
@@ -954,7 +954,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_GIVE_MOUNT, handler->GetNameLink(target).c_str());
@@ -965,14 +965,14 @@ public:
target->Mount(mId);
WorldPacket data(SMSG_MOVE_SET_RUN_SPEED, (8+4+1+4));
- data.append(target->GetPackGUID());
+ data << target->GetPackGUID();
data << (uint32)0;
data << (uint8)0; //new 2.1.0
data << float(speed);
target->SendMessageToSet(&data, true);
data.Initialize(SMSG_MOVE_SET_SWIM_SPEED, (8+4+4));
- data.append(target->GetPackGUID());
+ data << target->GetPackGUID();
data << (uint32)0;
data << float(speed);
target->SendMessageToSet(&data, true);
@@ -995,7 +995,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
int64 moneyToAdd = 0;
@@ -1066,7 +1066,7 @@ public:
}
// check online security
- if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
char* pField = strtok((char*)args, " ");
@@ -1120,7 +1120,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
int32 amount = (uint32)atoi(args);
@@ -1161,7 +1161,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
char* factionTxt = handler->extractKeyFromLink((char*)args, "Hfaction");
@@ -1260,7 +1260,7 @@ public:
target = handler->GetSession()->GetPlayer();
// check online security
- else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
target->SetDisplayId(display_id);
@@ -1365,7 +1365,7 @@ public:
target = handler->GetSession()->GetPlayer();
// check online security
- else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
target->DeMorph();
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index df80429f6de..85bc6db46f5 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -527,7 +527,7 @@ public:
return false;
if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
- unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT));
+ unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, cr_data->id, lowguid));
}
else
unit = handler->getSelectedCreature();
@@ -689,8 +689,8 @@ public:
}
creature->AI()->SetData(data_1, data_2);
- std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
- handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
+ std::string AIorScript = !creature->GetAIName().empty() ? "AI type: " + creature->GetAIName() : (!creature->GetScriptName().empty() ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
+ handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().GetCounter(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
return true;
}
@@ -1323,11 +1323,11 @@ public:
return false;
}
- uint64 receiver_guid = atol(receiver_str);
+ ObjectGuid receiver_guid(HIGHGUID_PLAYER, uint32(atol(receiver_str)));
// check online security
Player* receiver = ObjectAccessor::FindPlayer(receiver_guid);
- if (handler->HasLowerSecurity(receiver, 0))
+ if (handler->HasLowerSecurity(receiver, ObjectGuid::Empty))
return false;
creature->Whisper(text, LANG_UNIVERSAL, receiver);
diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp
index 82f99501a58..bb5e0764f2f 100644
--- a/src/server/scripts/Commands/cs_pet.cpp
+++ b/src/server/scripts/Commands/cs_pet.cpp
@@ -85,7 +85,7 @@ public:
creatureTarget->RemoveCorpse();
creatureTarget->SetHealth(0); // just for nice GM-mode view
- pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+ pet->SetGuidValue(UNIT_FIELD_CREATEDBY, player->GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 08603279824..dc75e0aedab 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -206,11 +206,11 @@ public:
{
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature))
for (uint16 z = 0; z < creatureCount; ++z)
- player->KilledMonster(creatureInfo, 0);
+ player->KilledMonster(creatureInfo, ObjectGuid::Empty);
}
else if (creature < 0)
for (uint16 z = 0; z < creatureCount; ++z)
- player->KillCreditGO(creature, 0);
+ player->KillCreditGO(creature);
}
// If the quest requires reputation to complete
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index 495dc522414..faf87adc7b6 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -59,14 +59,14 @@ public:
static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
if (target)
target->ResetAchievements();
else
- AchievementMgr<Player>::DeleteFromDB(GUID_LOPART(targetGuid));
+ AchievementMgr<Player>::DeleteFromDB(targetGuid);
return true;
}
@@ -155,7 +155,7 @@ public:
static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -172,7 +172,7 @@ public:
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str());
@@ -202,7 +202,7 @@ public:
static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
{
@@ -246,7 +246,7 @@ public:
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
std::string nameLink = handler->playerLink(targetName);
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index 486645df290..e27f09278fd 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -51,7 +51,7 @@ public:
{
// format: name "subject text" "mail text"
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -82,7 +82,7 @@ public:
/// @todo Fix poor design
SQLTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft(subject, text)
- .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
+ .SendMailTo(trans, MailReceiver(target, targetGuid.GetCounter()), sender);
CharacterDatabase.CommitTransaction(trans);
@@ -96,7 +96,7 @@ public:
{
// format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
Player* receiver;
- uint64 receiverGuid;
+ ObjectGuid receiverGuid;
std::string receiverName;
if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
return false;
@@ -192,7 +192,7 @@ public:
}
}
- draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ draft.SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender);
CharacterDatabase.CommitTransaction(trans);
std::string nameLink = handler->playerLink(receiverName);
@@ -205,7 +205,7 @@ public:
/// format: name "subject text" "mail text" money
Player* receiver;
- uint64 receiverGuid;
+ ObjectGuid receiverGuid;
std::string receiverName;
if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
return false;
@@ -242,7 +242,7 @@ public:
MailDraft(subject, text)
.AddMoney(money)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender);
CharacterDatabase.CommitTransaction(trans);
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index ad77464b6e1..6b4fb7d104d 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -123,7 +123,7 @@ public:
return false;
Player* target;
- uint64 target_guid;
+ ObjectGuid target_guid;
std::string target_name;
if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
return false;
@@ -135,7 +135,7 @@ public:
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
- stmt->setUInt32(0, target_guid);
+ stmt->setUInt32(0, target_guid.GetCounter());
PreparedQueryResult resultDB = CharacterDatabase.Query(stmt);
if (resultDB)
@@ -166,7 +166,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string chrNameLink = handler->playerLink(target_name);
@@ -225,7 +225,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
@@ -263,7 +263,7 @@ public:
continue;
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
std::string plNameLink = handler->GetNameLink(player);
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index cbf0ae51a82..674658f41ff 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -95,7 +95,7 @@ public:
return true;
}
- uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target);
+ ObjectGuid targetGuid = sObjectMgr->GetPlayerGUIDByName(target);
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
// Target must exist and have administrative rights
if (!AccountMgr::HasPermission(accountId, rbac::RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, realmID))
@@ -153,7 +153,7 @@ public:
return true;
}
- sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
+ sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(-1)));
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL);
@@ -376,7 +376,7 @@ public:
security = assignedPlayer->GetSession()->GetSecurity();
else
{
- uint64 guid = ticket->GetAssignedToGUID();
+ ObjectGuid guid = ticket->GetAssignedToGUID();
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
security = AccountMgr::GetSecurity(accountId, realmID);
}
@@ -434,7 +434,7 @@ public:
return false;
// Detect target's GUID
- uint64 guid = 0;
+ ObjectGuid guid;
if (Player* player = sObjectAccessor->FindPlayerByName(name))
guid = player->GetGUID();
else
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index b1e5bd0ca98..0826e0ca476 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -80,7 +80,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
@@ -124,7 +124,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
@@ -170,7 +170,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
@@ -218,7 +218,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
uint64 titles2 = titles;
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 5698366acc9..f158b9aa59e 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -631,7 +631,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(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
+ if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -664,7 +664,7 @@ public:
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
- if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
+ if (Creature* wpCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -848,7 +848,7 @@ public:
{
Field* fields = result2->Fetch();
uint32 wpguid = fields[0].GetUInt32();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
+ Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpguid));
if (!creature)
{
@@ -1053,7 +1053,7 @@ public:
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
+ Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, guid));
if (!creature)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);