aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp2
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp14
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.cpp12
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.h2
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp8
-rw-r--r--src/server/game/Chat/Channels/Channel.cpp3
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp2
-rw-r--r--src/server/game/Conditions/ConditionMgr.h2
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp2
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp7
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp7
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp5
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp4
-rw-r--r--src/server/game/Entities/GameObject/GameObjectData.h30
-rw-r--r--src/server/game/Entities/Item/Container/Bag.cpp8
-rw-r--r--src/server/game/Entities/Item/Item.cpp12
-rw-r--r--src/server/game/Entities/Object/Object.cpp9
-rw-r--r--src/server/game/Entities/Object/Object.h3
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp12
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h99
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp15
-rw-r--r--src/server/game/Entities/Player/Player.cpp241
-rw-r--r--src/server/game/Entities/Player/Player.h30
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp2
-rw-r--r--src/server/game/Globals/ObjectAccessor.cpp4
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp24
-rw-r--r--src/server/game/Globals/ObjectMgr.h3
-rw-r--r--src/server/game/Groups/Group.cpp16
-rw-r--r--src/server/game/Guilds/Guild.cpp6
-rw-r--r--src/server/game/Handlers/AddonHandler.cpp139
-rw-r--r--src/server/game/Handlers/AddonHandler.h37
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp2
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp5
-rw-r--r--src/server/game/Handlers/MailHandler.cpp4
-rw-r--r--src/server/game/Mails/Mail.cpp2
-rw-r--r--src/server/game/Maps/Map.cpp4
-rw-r--r--src/server/game/Maps/Map.h4
-rw-r--r--src/server/game/Maps/TransportMgr.cpp5
-rw-r--r--src/server/game/Pools/PoolMgr.cpp2
-rw-r--r--src/server/game/Tickets/TicketMgr.cpp8
-rw-r--r--src/server/game/Tools/PlayerDump.cpp2
-rw-r--r--src/server/scripts/Commands/cs_character.cpp4
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp6
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp5
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp4
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-rw-r--r--src/server/shared/SharedDefines.h86
48 files changed, 369 insertions, 540 deletions
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index a0b7bf1e23d..2b3b9da3116 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -95,7 +95,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId)
{
do
{
- ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt32());
+ ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt32());
// Kick if player is online
if (Player* p = ObjectAccessor::FindConnectedPlayer(guid))
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index cd3e61a6fcf..04683c746a3 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -126,7 +126,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, CharacterDatabas
return;
uint32 bidderAccId = 0;
- ObjectGuid bidderGuid(HighGuid::Player, auction->bidder);
+ ObjectGuid bidderGuid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
Player* bidder = ObjectAccessor::FindConnectedPlayer(bidderGuid);
// data for gm.log
std::string bidderName;
@@ -147,7 +147,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, CharacterDatabas
if (logGmTrade)
{
- ObjectGuid ownerGuid = ObjectGuid(HighGuid::Player, auction->owner);
+ ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
std::string ownerName;
if (!sCharacterCache->GetCharacterNameByGuid(ownerGuid, ownerName))
ownerName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
@@ -188,7 +188,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, CharacterDatabas
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, CharacterDatabaseTransaction trans)
{
- ObjectGuid owner_guid(HighGuid::Player, auction->owner);
+ ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
uint32 owner_accId = sCharacterCache->GetCharacterAccountIdByGuid(owner_guid);
// owner exist (online or offline)
@@ -209,7 +209,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, Characte
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, CharacterDatabaseTransaction trans)
{
- ObjectGuid owner_guid(HighGuid::Player, auction->owner);
+ ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
uint32 owner_accId = sCharacterCache->GetCharacterAccountIdByGuid(owner_guid);
// owner exist
@@ -240,7 +240,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, CharacterDat
if (!pItem)
return;
- ObjectGuid owner_guid(HighGuid::Player, auction->owner);
+ ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
uint32 owner_accId = sCharacterCache->GetCharacterAccountIdByGuid(owner_guid);
// owner exist
@@ -263,7 +263,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, CharacterDat
//this function sends mail to old bidder
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, CharacterDatabaseTransaction trans)
{
- ObjectGuid oldBidder_guid(HighGuid::Player, auction->bidder);
+ ObjectGuid oldBidder_guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
Player* oldBidder = ObjectAccessor::FindConnectedPlayer(oldBidder_guid);
uint32 oldBidder_accId = 0;
@@ -285,7 +285,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
//this function sends mail, when auction is cancelled to old bidder
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, CharacterDatabaseTransaction trans, Item* item)
{
- ObjectGuid bidder_guid = ObjectGuid(HighGuid::Player, auction->bidder);
+ ObjectGuid bidder_guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
Player* bidder = ObjectAccessor::FindConnectedPlayer(bidder_guid);
uint32 bidder_accId = 0;
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 82cf70a1ff6..414fb49eb81 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -195,7 +195,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result)
TeamId = fields[0].GetUInt32();
TeamName = fields[1].GetString();
- CaptainGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32());
+ CaptainGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
Type = fields[3].GetUInt8();
BackgroundColor = fields[4].GetUInt32();
EmblemStyle = fields[5].GetUInt8();
@@ -234,7 +234,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
break;
ArenaTeamMember newMember;
- newMember.Guid = ObjectGuid(HighGuid::Player, fields[1].GetUInt32());
+ newMember.Guid = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt32());
newMember.WeekGames = fields[2].GetUInt16();
newMember.WeekWins = fields[3].GetUInt16();
newMember.SeasonGames = fields[4].GetUInt16();
@@ -890,7 +890,7 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32
}
}
-void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
+void ArenaTeam::UpdateArenaPointsHelper(std::map<ObjectGuid, uint32>& playerPoints)
{
// Called after a match has ended and the stats are already modified
// Helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
@@ -908,15 +908,15 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
if (itr->WeekGames >= requiredGames)
pointsToAdd = GetPoints(itr->PersonalRating);
- std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(itr->Guid.GetCounter());
+ std::map<ObjectGuid, uint32>::iterator plr_itr = playerPoints.find(itr->Guid);
if (plr_itr != playerPoints.end())
{
// Check if there is already more points
if (plr_itr->second < pointsToAdd)
- playerPoints[itr->Guid.GetCounter()] = pointsToAdd;
+ playerPoints[itr->Guid] = pointsToAdd;
}
else
- playerPoints[itr->Guid.GetCounter()] = pointsToAdd;
+ playerPoints[itr->Guid] = pointsToAdd;
}
}
diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h
index c6ee45a5125..67940e6be0d 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.h
+++ b/src/server/game/Battlegrounds/ArenaTeam.h
@@ -179,7 +179,7 @@ class TC_GAME_API ArenaTeam
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
- void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
+ void UpdateArenaPointsHelper(std::map<ObjectGuid, uint32> & PlayerPoints);
bool FinishWeek(); // returns true if arena team played this week
void FinishGame(int32 mod);
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index 0e96a915918..7a69a6d410c 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -143,7 +143,7 @@ void ArenaTeamMgr::DistributeArenaPoints()
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
// Temporary structure for storing maximum points to add values for all players
- std::map<uint32, uint32> PlayerPoints;
+ std::map<ObjectGuid, uint32> PlayerPoints;
// At first update all points for all team members
for (auto [teamId, team] : ArenaTeamStore)
@@ -154,16 +154,16 @@ void ArenaTeamMgr::DistributeArenaPoints()
CharacterDatabasePreparedStatement* stmt;
// Cycle that gives points to all players
- for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
+ for (std::map<ObjectGuid, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
{
// Add points to player if online
- if (Player* player = ObjectAccessor::FindConnectedPlayer(ObjectGuid(HighGuid::Player, playerItr->first)))
+ if (Player* player = ObjectAccessor::FindConnectedPlayer(playerItr->first))
player->ModifyArenaPoints(playerItr->second, trans);
else // Update database
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_CHAR_ARENA_POINTS);
stmt->setUInt32(0, playerItr->second);
- stmt->setUInt32(1, playerItr->first);
+ stmt->setUInt32(1, playerItr->first.GetCounter());
trans->Append(stmt);
}
}
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 0669b966826..73837d61448 100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -76,7 +76,8 @@ Channel::Channel(std::string const& name, uint32 team /*= 0*/, std::string const
{
for (std::string_view guid : Trinity::Tokenize(banList, ' ', false))
{
- ObjectGuid banned(Trinity::StringTo<uint64>(guid).value_or(0));
+ ObjectGuid banned;
+ banned.SetRawValue(Trinity::StringTo<uint64>(guid).value_or(0));
if (!banned)
continue;
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index e79f6605fb1..37ec4388560 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -260,7 +260,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
condMeets = instance->GetData(ConditionValue1) == ConditionValue2;
break;
case INSTANCE_INFO_GUID_DATA:
- condMeets = instance->GetGuidData(ConditionValue1) == ObjectGuid(uint64(ConditionValue2));
+ condMeets = instance->GetGuidData(ConditionValue1).GetRawValue() == uint64(ConditionValue2);
break;
case INSTANCE_INFO_BOSS_STATE:
condMeets = instance->GetBossState(ConditionValue1) == EncounterState(ConditionValue2);
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index ff4ccf61559..9a1721ef556 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -36,7 +36,7 @@ struct Condition;
enum ConditionTypes
{ // value1 value2 value3
CONDITION_NONE = 0, // 0 0 0 always true
- CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex
+ CONDITION_AURA = 1, // spell_id effindex 0 true if target has aura of spell_id with effect effindex
CONDITION_ITEM = 2, // item_id count bank true if has #count of item_ids (if 'bank' is set it searches in bank slots too)
CONDITION_ITEM_EQUIPPED = 3, // item_id 0 0 true if has item_id equipped
CONDITION_ZONEID = 4, // zone_id 0 0 true if in zone_id
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 96ae15543b8..5befeb341a5 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -76,7 +76,7 @@ void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid)
if (!guid.IsGroup())
return;
- SetLeader(guid, ObjectGuid(HighGuid::Player, fields[0].GetUInt32()));
+ SetLeader(guid, ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32()));
uint32 dungeon = fields[17].GetUInt32();
uint8 state = fields[18].GetUInt8();
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 8fe0383633c..642ab421d5f 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -65,7 +65,7 @@ void Corpse::RemoveFromWorld()
bool Corpse::Create(ObjectGuid::LowType guidlow)
{
- Object::_Create(guidlow, 0, HighGuid::Corpse);
+ Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(guidlow));
return true;
}
@@ -82,7 +82,8 @@ bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner)
return false;
}
- WorldObject::_Create(guidlow, HighGuid::Corpse, owner->GetPhaseMask());
+ Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(guidlow));
+ SetPhaseMask(owner->GetPhaseMask(), false);
SetObjectScale(1.0f);
SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID());
@@ -159,7 +160,7 @@ bool Corpse::LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields)
float o = fields[3].GetFloat();
uint32 mapId = fields[4].GetUInt16();
- Object::_Create(guid, 0, HighGuid::Corpse);
+ Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(guid));
SetObjectScale(1.0f);
SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].GetUInt32());
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 9e13f3d295b..efa1c3216f6 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -700,7 +700,7 @@ void Creature::Update(uint32 diff)
break; // Will be rechecked on next Update call after delay expires
}
- ObjectGuid dbtableHighGuid(HighGuid::Unit, GetEntry(), m_spawnId);
+ ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(GetEntry(), m_spawnId);
time_t linkedRespawnTime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (!linkedRespawnTime) // Can respawn
Respawn();
@@ -1568,7 +1568,10 @@ bool Creature::CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, Creatu
SetOriginalEntry(entry);
- Object::_Create(guidlow, entry, (vehId || cinfo->VehicleId) ? HighGuid::Vehicle : HighGuid::Unit);
+ if (vehId || cinfo->VehicleId)
+ Object::_Create(ObjectGuid::Create<HighGuid::Vehicle>(entry, guidlow));
+ else
+ Object::_Create(ObjectGuid::Create<HighGuid::Unit>(entry, guidlow));
if (!UpdateEntry(entry, data))
return false;
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 017b79e5ffa..505aba37e5f 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -92,10 +92,11 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste
return false;
}
- WorldObject::_Create(guidlow, HighGuid::DynamicObject, caster->GetPhaseMask());
+ WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(guidlow));
+ SetPhaseMask(caster->GetPhaseMask(), false);
SetEntry(spell->Id);
- SetObjectScale(1);
+ SetObjectScale(1.0f);
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
SetByteValue(DYNAMICOBJECT_BYTES, 0, type);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id);
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 1b3b30e5dc2..962efe036c5 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -296,7 +296,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
m_updateFlag = (m_updateFlag | UPDATEFLAG_TRANSPORT) & ~UPDATEFLAG_POSITION;
- Object::_Create(guidlow, goinfo->entry, HighGuid::GameObject);
+ Object::_Create(ObjectGuid::Create<HighGuid::GameObject>(goinfo->entry, guidlow));
m_goInfo = goinfo;
m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(name_id);
@@ -574,7 +574,7 @@ void GameObject::Update(uint32 diff)
time_t now = GameTime::GetGameTime();
if (m_respawnTime <= now) // timer expired
{
- ObjectGuid dbtableHighGuid(HighGuid::GameObject, GetEntry(), m_spawnId);
+ ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::GameObject>(GetEntry(), m_spawnId);
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (linkedRespawntime) // Can't respawn, the master is dead
{
diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h
index 7cba8baeabd..bef00906a39 100644
--- a/src/server/game/Entities/GameObject/GameObjectData.h
+++ b/src/server/game/Entities/GameObject/GameObjectData.h
@@ -203,7 +203,7 @@ struct GameObjectTemplate
uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
uint32 pause1EventID; //3
uint32 pause2EventID; //4
- uint32 mapID; //5
+ int32 mapID; //5
} transport;
//12 GAMEOBJECT_TYPE_AREADAMAGE
struct
@@ -236,7 +236,7 @@ struct GameObjectTemplate
uint32 startEventID; //3
uint32 stopEventID; //4
uint32 transportPhysics; //5
- uint32 mapID; //6
+ int32 mapID; //6
uint32 worldState1; //7
uint32 canBeStopped; //8
} moTransport;
@@ -271,7 +271,7 @@ struct GameObjectTemplate
struct
{
uint32 spellId; //0
- uint32 charges; //1
+ int32 charges; //1
uint32 partyOnly; //2
uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1)
uint32 large; //4
@@ -361,14 +361,14 @@ struct GameObjectTemplate
//31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
struct
{
- uint32 mapID; //0
+ int32 mapID; //0
uint32 difficulty; //1
} dungeonDifficulty;
//32 GAMEOBJECT_TYPE_BARBER_CHAIR
struct
{
uint32 chairheight; //0
- uint32 heightOffset; //1
+ int32 heightOffset; //1
} barberChair;
//33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
struct
@@ -380,21 +380,21 @@ struct GameObjectTemplate
uint32 empty2; //4
uint32 damagedNumHits; //5
uint32 empty3; //6
- uint32 empty4; //7
- uint32 empty5; //8
+ int32 empty4; //7
+ int32 empty5; //8
uint32 damagedEvent; //9
- uint32 empty6; //10
- uint32 empty7; //11
- uint32 empty8; //12
- uint32 empty9; //13
+ int32 empty6; //10
+ int32 empty7; //11
+ int32 empty8; //12
+ int32 empty9; //13
uint32 destroyedEvent; //14
- uint32 empty10; //15
+ int32 empty10; //15
uint32 rebuildingTimeSecs; //16
- uint32 empty11; //17
+ int32 empty11; //17
uint32 destructibleData; //18
uint32 rebuildingEvent; //19
- uint32 empty12; //20
- uint32 empty13; //21
+ int32 empty12; //20
+ int32 empty13; //21
uint32 damageEvent; //22
uint32 empty14; //23
} building;
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 267ee1f691a..31485ac6471 100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -75,14 +75,14 @@ bool Bag::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner
if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
return false;
- Object::_Create(guidlow, 0, HighGuid::Container);
+ Object::_Create(ObjectGuid::Create<HighGuid::Container>(guidlow));
SetEntry(itemid);
SetObjectScale(1.0f);
if (owner)
{
- SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
+ SetOwnerGUID(owner->GetGUID());
SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
}
@@ -96,7 +96,7 @@ bool Bag::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner
// Cleaning 20 slots
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
- SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid::Empty);
+ SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid::Empty);
m_bagslot[i] = nullptr;
}
@@ -165,7 +165,7 @@ void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
m_bagslot[slot] = pItem;
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
- pItem->SetGuidValue(ITEM_FIELD_OWNER, GetOwnerGUID());
+ pItem->SetOwnerGUID(GetOwnerGUID());
pItem->SetContainer(this);
pItem->SetSlot(slot);
}
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 0d9648ca7e4..4480ab0dbd7 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -266,14 +266,14 @@ Item::Item()
bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemId, Player const* owner)
{
- Object::_Create(guidlow, 0, HighGuid::Item);
+ Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
SetEntry(itemId);
SetObjectScale(1.0f);
if (owner)
{
- SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
+ SetOwnerGUID(owner->GetGUID());
SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
}
@@ -413,7 +413,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
// create item before any checks for store correct guid
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
- Object::_Create(guid, 0, HighGuid::Item);
+ Object::_Create(ObjectGuid::Create<HighGuid::Item>(guid));
// Set entry, MUST be before proto check
SetEntry(entry);
@@ -431,8 +431,10 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
SetOwnerGUID(owner_guid);
bool need_save = false; // need explicit save data at load fixes
- SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HighGuid::Player, fields[0].GetUInt32()));
- SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HighGuid::Player, fields[1].GetUInt32()));
+ if (uint32 creator = fields[0].GetUInt32())
+ SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(creator));
+ if (uint32 giftCreator = fields[1].GetUInt32())
+ SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Create<HighGuid::Player>(giftCreator));
SetCount(fields[2].GetUInt32());
uint32 duration = fields[3].GetUInt32();
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index f5d7ae63f4d..91c8b83a720 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -106,11 +106,10 @@ void Object::_InitValues()
m_objectUpdated = false;
}
-void Object::_Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
+void Object::_Create(ObjectGuid const& guid)
{
if (!m_uint32Values) _InitValues();
- ObjectGuid guid(guidhigh, entry, guidlow);
SetGuidValue(OBJECT_FIELD_GUID, guid);
SetUInt32Value(OBJECT_FIELD_TYPE, m_objectType);
m_PackGUID.Set(guid);
@@ -1026,12 +1025,6 @@ void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
transport->RemovePassenger(this);
}
-void WorldObject::_Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
-{
- Object::_Create(guidlow, 0, guidhigh);
- m_phaseMask = phaseMask;
-}
-
void WorldObject::UpdatePositionData()
{
PositionFullTerrainStatus data;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index f9587e64f4d..c161f221e54 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -219,7 +219,7 @@ class TC_GAME_API Object
Object();
void _InitValues();
- void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh);
+ void _Create(ObjectGuid const& guid);
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
[[nodiscard]] bool _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count);
@@ -341,7 +341,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
virtual void Update(uint32 /*time_diff*/) { }
- void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask);
void AddToWorld() override;
void RemoveFromWorld() override;
diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp
index cb0f4e5ab4d..07161787eeb 100644
--- a/src/server/game/Entities/Object/ObjectGuid.cpp
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -117,17 +117,7 @@ std::string ObjectGuid::ToHexString() const
return Trinity::StringFormat("0x{:016X}", _guid);
}
-ObjectGuid ObjectGuid::Global(HighGuid type, LowType counter)
-{
- return ObjectGuid(type, counter);
-}
-
-ObjectGuid ObjectGuid::MapSpecific(HighGuid type, uint32 entry, LowType counter)
-{
- return ObjectGuid(type, entry, counter);
-}
-
-void PackedGuid::Set(ObjectGuid guid)
+void PackedGuid::Set(ObjectGuid const& guid)
{
_packedSize = 1;
uint64 raw = guid.GetRawValue();
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index 4c26d2a87cd..5674a9bf7ee 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -15,14 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ObjectGuid_h__
-#define ObjectGuid_h__
+#ifndef TRINITYCORE_OBJECT_GUID_H
+#define TRINITYCORE_OBJECT_GUID_H
#include "Define.h"
+#include "EnumFlag.h"
#include <array>
#include <functional>
#include <list>
-#include <memory>
#include <set>
#include <stdexcept>
#include <string>
@@ -76,39 +76,47 @@ enum class HighGuid
Group = 0x1F50,
};
+enum class ObjectGuidSequenceSource
+{
+ None = 0x0,
+ Global = 0x1,
+ Map = 0x2
+};
+
+DEFINE_ENUM_FLAG(ObjectGuidSequenceSource);
+
+enum class ObjectGuidFormatType
+{
+ OnlyCounter,
+ CounterAndEntry
+};
+
template<HighGuid high>
struct ObjectGuidTraits
{
- static bool const Global = false;
- static bool const MapSpecific = false;
+ static constexpr EnumFlag<ObjectGuidSequenceSource> SequenceSource = ObjectGuidSequenceSource::None;
+ using Format = std::integral_constant<ObjectGuidFormatType, ObjectGuidFormatType::OnlyCounter>;
};
-#define GUID_TRAIT_GLOBAL(highguid) \
- template<> struct ObjectGuidTraits<highguid> \
+#define MAKE_GUID_TRAIT(high, sequence, format) \
+ template<> struct ObjectGuidTraits<high> \
{ \
- static bool const Global = true; \
- static bool const MapSpecific = false; \
- };
+ static constexpr EnumFlag<ObjectGuidSequenceSource> SequenceSource = sequence; \
+ using Format = std::integral_constant<ObjectGuidFormatType, format>; \
+ }
-#define GUID_TRAIT_MAP_SPECIFIC(highguid) \
- template<> struct ObjectGuidTraits<highguid> \
- { \
- static bool const Global = false; \
- static bool const MapSpecific = true; \
- };
-
-GUID_TRAIT_GLOBAL(HighGuid::Player)
-GUID_TRAIT_GLOBAL(HighGuid::Item)
-GUID_TRAIT_GLOBAL(HighGuid::Mo_Transport)
-GUID_TRAIT_GLOBAL(HighGuid::Group)
-GUID_TRAIT_GLOBAL(HighGuid::Instance)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::Transport)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::Unit)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::Vehicle)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::Pet)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::GameObject)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::DynamicObject)
-GUID_TRAIT_MAP_SPECIFIC(HighGuid::Corpse)
+MAKE_GUID_TRAIT(HighGuid::Item, ObjectGuidSequenceSource::Global, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::Player, ObjectGuidSequenceSource::Global, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::GameObject, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::CounterAndEntry);
+MAKE_GUID_TRAIT(HighGuid::Transport, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::Unit, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::CounterAndEntry);
+MAKE_GUID_TRAIT(HighGuid::Pet, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::CounterAndEntry);
+MAKE_GUID_TRAIT(HighGuid::Vehicle, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::CounterAndEntry);
+MAKE_GUID_TRAIT(HighGuid::DynamicObject, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::Corpse, ObjectGuidSequenceSource::Map, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::Mo_Transport, ObjectGuidSequenceSource::Global, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::Instance, ObjectGuidSequenceSource::Global, ObjectGuidFormatType::OnlyCounter);
+MAKE_GUID_TRAIT(HighGuid::Group, ObjectGuidSequenceSource::Global, ObjectGuidFormatType::OnlyCounter);
class ByteBuffer;
class ObjectGuid;
@@ -133,16 +141,7 @@ class TC_GAME_API ObjectGuid
typedef uint32 LowType;
- template<HighGuid type>
- static typename std::enable_if<ObjectGuidTraits<type>::Global, ObjectGuid>::type Create(LowType counter) { return Global(type, counter); }
-
- template<HighGuid type>
- static typename std::enable_if<ObjectGuidTraits<type>::MapSpecific, ObjectGuid>::type Create(uint32 entry, LowType counter) { return MapSpecific(type, entry, counter); }
-
- ObjectGuid() : _guid(0) { }
- explicit ObjectGuid(uint64 guid) : _guid(guid) { }
- ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) { }
- ObjectGuid(HighGuid hi, LowType counter) : _guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) { }
+ constexpr ObjectGuid() = default;
PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
@@ -221,8 +220,14 @@ class TC_GAME_API ObjectGuid
std::string ToString() const;
std::string ToHexString() const;
+ template<HighGuid type, std::enable_if_t<ObjectGuidTraits<type>::Format::value == ObjectGuidFormatType::OnlyCounter, int32> = 0>
+ static constexpr ObjectGuid Create(LowType counter) { return ObjectGuid(counter ? uint64(counter) | (uint64(type) << 48) : 0); }
+
+ template<HighGuid type, std::enable_if_t<ObjectGuidTraits<type>::Format::value == ObjectGuidFormatType::CounterAndEntry, int32> = 0>
+ static constexpr ObjectGuid Create(uint32 entry, LowType counter) { return ObjectGuid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(type) << 48) : 0); }
+
private:
- static bool HasEntry(HighGuid high)
+ static constexpr bool HasEntry(HighGuid high)
{
switch (high)
{
@@ -246,14 +251,9 @@ class TC_GAME_API ObjectGuid
bool HasEntry() const { return HasEntry(GetHigh()); }
- static ObjectGuid Global(HighGuid type, LowType counter);
- static ObjectGuid MapSpecific(HighGuid type, uint32 entry, LowType counter);
-
- explicit ObjectGuid(uint32 const&) = delete; // no implementation, used to catch wrong type assignment
- ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
- ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
+ explicit ObjectGuid(uint64 guid) : _guid(guid) { }
- uint64 _guid;
+ uint64 _guid = 0;
};
// Some Shared defines
@@ -273,7 +273,7 @@ class TC_GAME_API PackedGuid
explicit PackedGuid() : _packedSize(1), _packedGuid() { }
explicit PackedGuid(ObjectGuid guid) { Set(guid); }
- void Set(ObjectGuid guid);
+ void Set(ObjectGuid const& guid);
std::size_t size() const { return _packedSize; }
@@ -343,4 +343,5 @@ struct formatter<ObjectGuid, char, void>
};
}
}
-#endif // ObjectGuid_h__
+
+#endif // TRINITYCORE_OBJECT_GUID_H
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index e2855e6fdce..23cd4626355 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -222,9 +222,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
}
Map* map = owner->GetMap();
- ObjectGuid::LowType guid = map->GenerateLowGuid<HighGuid::Pet>();
-
- if (!Create(guid, map, owner->GetPhaseMask(), petInfo->CreatureId, petInfo->PetNumber))
+ if (!Create(map->GenerateLowGuid<HighGuid::Pet>(), map, owner->GetPhaseMask(), petInfo->CreatureId, petInfo->PetNumber))
return false;
setPetType(petInfo->Type);
@@ -1232,6 +1230,7 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff)
{
TC_LOG_DEBUG("entities.pet", "Loading auras for pet {}", GetGUID().ToString());
+ ObjectGuid casterGuid;
if (result)
{
do
@@ -1239,10 +1238,10 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff)
int32 damage[3];
int32 baseDamage[3];
Field* fields = result->Fetch();
- ObjectGuid caster_guid(fields[0].GetUInt64());
+ casterGuid.SetRawValue(fields[0].GetUInt64());
// NULL guid stored - pet is the caster of the spell - see Pet::_SaveAuras
- if (!caster_guid)
- caster_guid = GetGUID();
+ if (!casterGuid)
+ casterGuid = GetGUID();
uint32 spellid = fields[1].GetUInt32();
uint8 effmask = fields[2].GetUInt8();
uint8 recalculatemask = fields[3].GetUInt8();
@@ -1286,7 +1285,7 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff)
AuraCreateInfo createInfo(spellInfo, effmask, this);
createInfo
- .SetCasterGUID(caster_guid)
+ .SetCasterGUID(casterGuid)
.SetBaseAmount(baseDamage);
if (Aura* aura = Aura::TryCreate(createInfo))
@@ -1878,7 +1877,7 @@ bool Pet::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32
SetMap(map);
SetPhaseMask(phaseMask, false);
- Object::_Create(guidlow, petId, HighGuid::Pet);
+ Object::_Create(ObjectGuid::Create<HighGuid::Pet>(petId, guidlow));
m_originalEntry = Entry;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index b1602d30929..456353f8019 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -109,63 +109,6 @@
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
-#define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_INFO_1_1 + ((x)*3))
-#define PLAYER_SKILL_VALUE_INDEX(x) (PLAYER_SKILL_INDEX(x)+1)
-#define PLAYER_SKILL_BONUS_INDEX(x) (PLAYER_SKILL_INDEX(x)+2)
-
-#define SKILL_VALUE(x) PAIR32_LOPART(x)
-#define SKILL_MAX(x) PAIR32_HIPART(x)
-#define MAKE_SKILL_VALUE(v, m) MAKE_PAIR32(v, m)
-
-#define SKILL_TEMP_BONUS(x) int16(PAIR32_LOPART(x))
-#define SKILL_PERM_BONUS(x) int16(PAIR32_HIPART(x))
-#define MAKE_SKILL_BONUS(t, p) MAKE_PAIR32(t, p)
-
-enum CharacterFlags
-{
- CHARACTER_FLAG_NONE = 0x00000000,
- CHARACTER_FLAG_UNK1 = 0x00000001,
- CHARACTER_FLAG_UNK2 = 0x00000002,
- CHARACTER_LOCKED_FOR_TRANSFER = 0x00000004,
- CHARACTER_FLAG_UNK4 = 0x00000008,
- CHARACTER_FLAG_UNK5 = 0x00000010,
- CHARACTER_FLAG_UNK6 = 0x00000020,
- CHARACTER_FLAG_UNK7 = 0x00000040,
- CHARACTER_FLAG_UNK8 = 0x00000080,
- CHARACTER_FLAG_UNK9 = 0x00000100,
- CHARACTER_FLAG_UNK10 = 0x00000200,
- CHARACTER_FLAG_HIDE_HELM = 0x00000400,
- CHARACTER_FLAG_HIDE_CLOAK = 0x00000800,
- CHARACTER_FLAG_UNK13 = 0x00001000,
- CHARACTER_FLAG_GHOST = 0x00002000,
- CHARACTER_FLAG_RENAME = 0x00004000,
- CHARACTER_FLAG_UNK16 = 0x00008000,
- CHARACTER_FLAG_UNK17 = 0x00010000,
- CHARACTER_FLAG_UNK18 = 0x00020000,
- CHARACTER_FLAG_UNK19 = 0x00040000,
- CHARACTER_FLAG_UNK20 = 0x00080000,
- CHARACTER_FLAG_UNK21 = 0x00100000,
- CHARACTER_FLAG_UNK22 = 0x00200000,
- CHARACTER_FLAG_UNK23 = 0x00400000,
- CHARACTER_FLAG_UNK24 = 0x00800000,
- CHARACTER_FLAG_LOCKED_BY_BILLING = 0x01000000,
- CHARACTER_FLAG_DECLINED = 0x02000000,
- CHARACTER_FLAG_UNK27 = 0x04000000,
- CHARACTER_FLAG_UNK28 = 0x08000000,
- CHARACTER_FLAG_UNK29 = 0x10000000,
- CHARACTER_FLAG_UNK30 = 0x20000000,
- CHARACTER_FLAG_UNK31 = 0x40000000,
- CHARACTER_FLAG_UNK32 = 0x80000000
-};
-
-enum CharacterCustomizeFlags
-{
- CHAR_CUSTOMIZE_FLAG_NONE = 0x00000000,
- CHAR_CUSTOMIZE_FLAG_CUSTOMIZE = 0x00000001, // name, gender, etc...
- CHAR_CUSTOMIZE_FLAG_FACTION = 0x00010000, // name, gender, faction, etc...
- CHAR_CUSTOMIZE_FLAG_RACE = 0x00100000 // name, gender, race, etc...
-};
-
// corpse reclaim times
#define DEATH_EXPIRE_STEP (5*MINUTE)
#define MAX_DEATH_COUNT 3
@@ -442,7 +385,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
//FIXME: outfitId not used in player creating
/// @todo need more checks against packet modifications
- Object::_Create(guidlow, 0, HighGuid::Player);
+ Object::_Create(ObjectGuid::Create<HighGuid::Player>(guidlow));
m_name = createInfo->Name;
@@ -1365,7 +1308,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
Field* fields = result->Fetch();
- ObjectGuid::LowType guid = fields[0].GetUInt32();
+ ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32());
uint8 playerRace = fields[2].GetUInt8();
uint8 playerClass = fields[3].GetUInt8();
uint8 gender = fields[4].GetUInt8();
@@ -1382,7 +1325,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
return false;
}
- *data << ObjectGuid(HighGuid::Player, guid);
+ *data << guid;
*data << fields[1].GetString(); // name
*data << uint8(playerRace); // race
*data << uint8(playerClass); // class
@@ -1407,7 +1350,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
- stmt->setUInt32(1, guid);
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
atLoginFlags |= AT_LOGIN_CUSTOMIZE;
}
@@ -4110,7 +4053,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
{
do
{
- if (Player* playerFriend = ObjectAccessor::FindPlayer(ObjectGuid(HighGuid::Player, 0, (*resultFriends)[0].GetUInt32())))
+ if (Player* playerFriend = ObjectAccessor::FindPlayer(ObjectGuid::Create<HighGuid::Player>((*resultFriends)[0].GetUInt32())))
{
playerFriend->GetSocial()->RemoveFromSocialList(playerguid, SOCIAL_FLAG_ALL);
sSocialMgr->SendFriendStatus(playerFriend, FRIEND_REMOVED, playerguid);
@@ -4347,7 +4290,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
do
{
Field* fields = result->Fetch();
- Player::DeleteFromDB(ObjectGuid(HighGuid::Player, fields[0].GetUInt32()), fields[1].GetUInt32(), true, true);
+ Player::DeleteFromDB(ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32()), fields[1].GetUInt32(), true, true);
}
while (result->NextRow());
}
@@ -5481,21 +5424,17 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step)
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return false;
- uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
- uint32 data = GetUInt32Value(valueIndex);
- uint32 value = SKILL_VALUE(data);
- uint32 max = SKILL_MAX(data);
+ uint16 value = GetSkillRankByPos(itr->second.pos);
+ uint16 max = GetSkillMaxRankByPos(itr->second.pos);
- if ((!max) || (!value) || (value >= max))
+ if (!max || !value || value >= max)
return false;
if (value < max)
{
- uint32 new_value = value + step;
- if (new_value > max)
- new_value = max;
+ uint16 new_value = std::min(uint16(value + step), max);
- SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, max));
+ SetSkillRank(itr->second.pos, new_value);
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
@@ -5638,11 +5577,8 @@ bool Player::UpdateSkillPro(uint16 skillId, int32 chance, uint32 step)
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return false;
- uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
-
- uint32 data = GetUInt32Value(valueIndex);
- uint16 value = SKILL_VALUE(data);
- uint16 max = SKILL_MAX(data);
+ uint16 value = GetSkillRankByPos(itr->second.pos);
+ uint16 max = GetSkillMaxRankByPos(itr->second.pos);
if (!max || !value || value >= max)
return false;
@@ -5659,7 +5595,7 @@ bool Player::UpdateSkillPro(uint16 skillId, int32 chance, uint32 step)
if (new_value > max)
new_value = max;
- SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, max));
+ SetSkillRank(itr->second.pos, new_value);
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
@@ -5756,16 +5692,10 @@ void Player::ModifySkillBonus(uint32 skillid, int32 val, bool talent)
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return;
- uint32 bonusIndex = PLAYER_SKILL_BONUS_INDEX(itr->second.pos);
-
- uint32 bonus_val = GetUInt32Value(bonusIndex);
- int16 temp_bonus = SKILL_TEMP_BONUS(bonus_val);
- int16 perm_bonus = SKILL_PERM_BONUS(bonus_val);
-
if (talent) // permanent bonus stored in high part
- SetUInt32Value(bonusIndex, MAKE_SKILL_BONUS(temp_bonus, perm_bonus+val));
+ SetSkillPermBonus(itr->second.pos, GetSkillPermBonusByPos(itr->second.pos) + val);
else // temporary/item bonus stored in low part
- SetUInt32Value(bonusIndex, MAKE_SKILL_BONUS(temp_bonus+val, perm_bonus));
+ SetSkillTempBonus(itr->second.pos, GetSkillTempBonusByPos(itr->second.pos) + val);
}
void Player::UpdateSkillsForLevel()
@@ -5788,10 +5718,7 @@ void Player::UpdateSkillsForLevel()
if (GetSkillRangeType(rcEntry) != SKILL_RANGE_LEVEL)
continue;
- uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
- uint32 data = GetUInt32Value(valueIndex);
- uint32 max = SKILL_MAX(data);
- uint32 val = SKILL_VALUE(data);
+ uint16 max = GetSkillMaxRankByPos(itr->second.pos);
/// update only level dependent max skill values
if (max != 1)
@@ -5799,13 +5726,14 @@ void Player::UpdateSkillsForLevel()
/// maximize skill always
if (alwaysMaxSkill || (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE))
{
- SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(maxSkill, maxSkill));
+ SetSkillRank(itr->second.pos, maxSkill);
+ SetSkillMaxRank(itr->second.pos, maxSkill);
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
}
else if (max != maxconfskill) /// update max skill value if current max skill not maximized
{
- SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(val, maxSkill));
+ SetSkillMaxRank(itr->second.pos, maxSkill);
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
}
@@ -5823,13 +5751,12 @@ void Player::UpdateWeaponsSkillsToMaxSkillsForLevel()
uint32 pskill = itr->first;
if (IsProfessionOrRidingSkill(pskill))
continue;
- uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
- uint32 data = GetUInt32Value(valueIndex);
- uint32 max = SKILL_MAX(data);
+
+ uint16 max = GetSkillMaxRankByPos(itr->second.pos);
if (max > 1)
{
- SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(max, max));
+ SetSkillRank(itr->second.pos, max);
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
}
@@ -5851,16 +5778,18 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
//has skill
if (itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED)
{
- currVal = SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
+ currVal = GetSkillRankByPos(itr->second.pos);
if (newVal)
{
// if skill value is going down, update enchantments before setting the new value
if (newVal < currVal)
UpdateSkillEnchantments(id, currVal, newVal);
// update step
- SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), MAKE_PAIR32(id, step));
+ SetSkillStep(itr->second.pos, step);
// update value
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_SKILL_VALUE(newVal, maxVal));
+ SetSkillRank(itr->second.pos, newVal);
+ SetSkillMaxRank(itr->second.pos, maxVal);
+
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
LearnSkillRewardedSpells(id, newVal);
@@ -5875,9 +5804,12 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
//remove enchantments needing this skill
UpdateSkillEnchantments(id, currVal, 0);
// clear skill fields
- SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), 0);
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), 0);
- SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos), 0);
+ SetSkillLineId(itr->second.pos, 0);
+ SetSkillStep(itr->second.pos, 0);
+ SetSkillRank(itr->second.pos, 0);
+ SetSkillMaxRank(itr->second.pos, 0);
+ SetSkillTempBonus(itr->second.pos, 0);
+ SetSkillPermBonus(itr->second.pos, 0);
// mark as deleted or simply remove from map if not saved yet
if (itr->second.uState != SKILL_NEW)
@@ -5894,9 +5826,9 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
else if (newVal) //add
{
currVal = 0;
- for (int i=0; i < PLAYER_MAX_SKILLS; ++i)
+ for (uint32 i = 0; i < PLAYER_MAX_SKILLS; ++i)
{
- if (!GetUInt32Value(PLAYER_SKILL_INDEX(i)))
+ if (!GetSkillLineIdByPos(i))
{
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
if (!pSkill)
@@ -5906,8 +5838,10 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
return;
}
- SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id, step));
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i), MAKE_SKILL_VALUE(newVal, maxVal));
+ SetSkillLineId(i, id);
+ SetSkillStep(i, step);
+ SetSkillRank(i, newVal);
+ SetSkillMaxRank(i, maxVal);
UpdateSkillEnchantments(id, currVal, newVal);
// insert new entry or update if not deleted old entry yet
@@ -5920,7 +5854,8 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
mSkillStatus.insert(SkillStatusMap::value_type(id, SkillStatusData(i, SKILL_NEW)));
// apply skill bonuses
- SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i), 0);
+ SetSkillTempBonus(i, 0);
+ SetSkillPermBonus(i, 0);
// temporary bonuses
AuraEffectList const& mModSkill = GetAuraEffectsByType(SPELL_AURA_MOD_SKILL);
@@ -5962,7 +5897,7 @@ uint16 Player::GetSkillStep(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- return PAIR32_HIPART(GetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos)));
+ return GetSkillStepByPos(itr->second.pos);
}
uint16 Player::GetSkillValue(uint32 skill) const
@@ -5974,11 +5909,9 @@ uint16 Player::GetSkillValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
-
- int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
- result += SKILL_TEMP_BONUS(bonus);
- result += SKILL_PERM_BONUS(bonus);
+ int32 result = int32(GetSkillRankByPos(itr->second.pos));
+ result += int32(GetSkillTempBonusByPos(itr->second.pos));
+ result += int32(GetSkillPermBonusByPos(itr->second.pos));
return result < 0 ? 0 : result;
}
@@ -5991,11 +5924,9 @@ uint16 Player::GetMaxSkillValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
-
- int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
- result += SKILL_TEMP_BONUS(bonus);
- result += SKILL_PERM_BONUS(bonus);
+ int32 result = int32(GetSkillMaxRankByPos(itr->second.pos));
+ result += int32(GetSkillTempBonusByPos(itr->second.pos));
+ result += int32(GetSkillPermBonusByPos(itr->second.pos));
return result < 0 ? 0 : result;
}
@@ -6008,7 +5939,7 @@ uint16 Player::GetPureMaxSkillValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- return SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
+ return GetSkillMaxRankByPos(itr->second.pos);
}
uint16 Player::GetBaseSkillValue(uint32 skill) const
@@ -6020,8 +5951,8 @@ uint16 Player::GetBaseSkillValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
- result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
+ int32 result = int32(GetSkillRankByPos(itr->second.pos));
+ result += int32(GetSkillPermBonusByPos(itr->second.pos));
return result < 0 ? 0 : result;
}
@@ -6034,7 +5965,7 @@ uint16 Player::GetPureSkillValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- return SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
+ return GetSkillRankByPos(itr->second.pos);
}
int16 Player::GetSkillPermBonusValue(uint32 skill) const
@@ -6046,7 +5977,7 @@ int16 Player::GetSkillPermBonusValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- return SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
+ return GetSkillPermBonusByPos(itr->second.pos);
}
int16 Player::GetSkillTempBonusValue(uint32 skill) const
@@ -6058,7 +5989,7 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const
if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
return 0;
- return SKILL_TEMP_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
+ return GetSkillTempBonusByPos(itr->second.pos);
}
void Player::SendActionButtons(uint32 state) const
@@ -11848,7 +11779,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
m_items[slot] = pItem;
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
- pItem->SetGuidValue(ITEM_FIELD_OWNER, GetGUID());
+ pItem->SetOwnerGUID(GetGUID());
pItem->SetSlot(slot);
pItem->SetContainer(nullptr);
@@ -12096,7 +12027,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem)
m_items[slot] = pItem;
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
- pItem->SetGuidValue(ITEM_FIELD_OWNER, GetGUID());
+ pItem->SetOwnerGUID(GetGUID());
pItem->SetSlot(slot);
pItem->SetContainer(nullptr);
@@ -13152,6 +13083,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->SellPrice * pItem->GetCount());
else
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
+
SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime);
// move to next (for non filled list is move most optimized choice)
@@ -17041,7 +16973,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
return false;
}
- Object::_Create(guid.GetCounter(), 0, HighGuid::Player);
+ Object::_Create(guid);
m_name = fields[2].GetString();
@@ -17269,7 +17201,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
// currently we do not support transport in bg
else if (transLowGUID)
{
- ObjectGuid transGUID(HighGuid::Mo_Transport, transLowGUID);
+ ObjectGuid transGUID = ObjectGuid::Create<HighGuid::Mo_Transport>(transLowGUID);
Transport* transport = nullptr;
if (Transport* go = HashMapHolder<Transport>::Find(transGUID))
@@ -17961,8 +17893,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
uint32 zoneId = GetZoneId();
- std::map<ObjectGuid::LowType, Bag*> bagMap; // fast guid lookup for bags
- std::map<ObjectGuid::LowType, Item*> invalidBagMap; // fast guid lookup for bags
+ std::map<ObjectGuid, Bag*> bagMap; // fast guid lookup for bags
+ std::map<ObjectGuid, Item*> invalidBagMap; // fast guid lookup for bags
std::list<Item*> problematicItems;
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
@@ -17973,7 +17905,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Field* fields = result->Fetch();
if (Item* item = _LoadItem(trans, zoneId, timeDiff, fields))
{
- ObjectGuid::LowType bagGuid = fields[11].GetUInt32();
+ ObjectGuid bagGuid = fields[11].GetUInt32() ? ObjectGuid::Create<HighGuid::Item>(fields[11].GetUInt32()) : ObjectGuid::Empty;
uint8 slot = fields[12].GetUInt8();
InventoryResult err = EQUIP_ERR_OK;
@@ -18010,18 +17942,18 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
if (IsBagPos(item->GetPos()))
if (Bag* pBag = item->ToBag())
- bagMap[item->GetGUID().GetCounter()] = pBag;
+ bagMap[item->GetGUID()] = pBag;
}
else
if (IsBagPos(item->GetPos()))
if (item->IsBag())
- invalidBagMap[item->GetGUID().GetCounter()] = item;
+ invalidBagMap[item->GetGUID()] = item;
}
else
{
item->SetSlot(NULL_SLOT);
// Item is in the bag, find the bag
- std::map<ObjectGuid::LowType, Bag*>::iterator itr = bagMap.find(bagGuid);
+ std::map<ObjectGuid, Bag*>::iterator itr = bagMap.find(bagGuid);
if (itr != bagMap.end())
{
ItemPosCountVec dest;
@@ -18031,7 +17963,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
- std::map<ObjectGuid::LowType, Item*>::iterator invalidBagItr = invalidBagMap.find(bagGuid);
+ std::map<ObjectGuid, Item*>::iterator invalidBagItr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(), problematicItems.end(), invalidBagItr->second) != problematicItems.end())
err = EQUIP_ERR_INTERNAL_BAG_ERROR;
}
@@ -18453,9 +18385,6 @@ void Player::_LoadQuestStatusRewarded(PreparedQueryResult result)
void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
{
- for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
- SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx, 0);
-
m_DFQuests.clear();
//QueryResult* result = CharacterDatabase.PQuery("SELECT quest, time FROM character_queststatus_daily WHERE guid = '{}'", GetGUID().GetCounter());
@@ -18467,7 +18396,8 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
do
{
Field* fields = result->Fetch();
- if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(fields[0].GetUInt32()))
+ uint32 quest_id = fields[0].GetUInt32();
+ if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(quest_id))
{
if (qQuest->IsDFQuest())
{
@@ -18483,8 +18413,6 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
break;
}
- uint32 quest_id = fields[0].GetUInt32();
-
// save _any_ from daily quest times (it must be after last reset anyway)
m_lastDailyQuestTime = time_t(fields[1].GetUInt32());
@@ -19986,9 +19914,8 @@ void Player::_SaveSkills(CharacterDatabaseTransaction trans)
continue;
}
- uint32 valueData = GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos));
- uint16 value = SKILL_VALUE(valueData);
- uint16 max = SKILL_MAX(valueData);
+ uint16 value = GetSkillRankByPos(itr->second.pos);
+ uint16 max = GetSkillMaxRankByPos(itr->second.pos);
switch (itr->second.uState)
{
@@ -24895,10 +24822,12 @@ void Player::_LoadSkills(PreparedQueryResult result)
}
}
- SetUInt32Value(PLAYER_SKILL_INDEX(count), MAKE_PAIR32(skill, skillStep));
-
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(count), MAKE_SKILL_VALUE(value, max));
- SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(count), 0);
+ SetSkillLineId(count, skill);
+ SetSkillStep(count, skillStep);
+ SetSkillRank(count, value);
+ SetSkillMaxRank(count, max);
+ SetSkillTempBonus(count, 0);
+ SetSkillPermBonus(count, 0);
mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
loadedSkillValues[skill] = value;
@@ -24919,13 +24848,6 @@ void Player::_LoadSkills(PreparedQueryResult result)
for (auto& skill : loadedSkillValues)
LearnSkillRewardedSpells(skill.first, skill.second);
- for (; count < PLAYER_MAX_SKILLS; ++count)
- {
- SetUInt32Value(PLAYER_SKILL_INDEX(count), 0);
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(count), 0);
- SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(count), 0);
- }
-
if (HasSkill(SKILL_FIST_WEAPONS))
SetSkill(SKILL_FIST_WEAPONS, 0, GetSkillValue(SKILL_UNARMED), GetMaxSkillValueForLevel());
}
@@ -25618,6 +25540,13 @@ void Player::SendEquipmentSetList()
size_t count_pos = data.wpos();
data << uint32(count); // count placeholder
+ static ObjectGuid const IgnoredSlot = []
+ {
+ ObjectGuid guid;
+ guid.SetRawValue(1);
+ return guid;
+ }();
+
for (EquipmentSetContainer::value_type const& eqSet : _equipmentSets)
{
if (eqSet.second.State == EQUIPMENT_SET_DELETED)
@@ -25632,7 +25561,7 @@ void Player::SendEquipmentSetList()
{
// ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HighGuid::Item
if (eqSet.second.Data.IgnoreMask & (1 << i))
- data << ObjectGuid(UI64LIT(1)).WriteAsPacked();
+ data << IgnoredSlot.WriteAsPacked();
else
data << eqSet.second.Data.Pieces[i].WriteAsPacked();
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 9b4d0e89dbb..dd7d0cf12d3 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -84,7 +84,23 @@ enum LootType : uint8;
typedef std::deque<Mail*> PlayerMails;
-#define PLAYER_MAX_SKILLS 128
+#define PLAYER_MAX_SKILLS 128
+enum SkillFieldOffset
+{
+ SKILL_ID_FIELD_OFFSET = 0,
+ SKILL_ID_SHORT_OFFSET = 0,
+ SKILL_STEP_FIELD_OFFSET = 0,
+ SKILL_STEP_SHORT_OFFSET = 1,
+ SKILL_RANK_FIELD_OFFSET = 1,
+ SKILL_RANK_SHORT_OFFSET = 0,
+ SKILL_MAX_RANK_FIELD_OFFSET = 1,
+ SKILL_MAX_RANK_SHORT_OFFSET = 1,
+ SKILL_TEMP_BONUS_FIELD_OFFSET = 2,
+ SKILL_TEMP_BONUS_SHORT_OFFSET = 0,
+ SKILL_PERM_BONUS_FIELD_OFFSET = 2,
+ SKILL_PERM_BONUS_SHORT_OFFSET = 1
+};
+
#define PLAYER_MAX_DAILY_QUESTS 25
#define PLAYER_EXPLORED_ZONES_SIZE 128
@@ -1793,6 +1809,18 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
uint16 GetSkillStep(uint32 skill) const; // 0...6
bool HasSkill(uint32 skill) const;
void LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue);
+ uint16 GetSkillLineIdByPos(uint32 pos) const { return GetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_ID_FIELD_OFFSET, SKILL_ID_SHORT_OFFSET); }
+ void SetSkillLineId(uint32 pos, uint16 skillLineId) { SetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_ID_FIELD_OFFSET, SKILL_ID_SHORT_OFFSET, skillLineId); }
+ uint16 GetSkillStepByPos(uint32 pos) const { return GetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_STEP_FIELD_OFFSET, SKILL_STEP_SHORT_OFFSET); };
+ void SetSkillStep(uint32 pos, uint16 step) { SetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_STEP_FIELD_OFFSET, SKILL_STEP_SHORT_OFFSET, step); };
+ uint16 GetSkillRankByPos(uint32 pos) const { return GetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_RANK_FIELD_OFFSET, SKILL_RANK_SHORT_OFFSET); }
+ void SetSkillRank(uint32 pos, uint16 rank) { SetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_RANK_FIELD_OFFSET, SKILL_RANK_SHORT_OFFSET, rank); }
+ uint16 GetSkillMaxRankByPos(uint32 pos) const { return GetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_MAX_RANK_FIELD_OFFSET, SKILL_MAX_RANK_SHORT_OFFSET); }
+ void SetSkillMaxRank(uint32 pos, uint16 max) { SetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_MAX_RANK_FIELD_OFFSET, SKILL_MAX_RANK_SHORT_OFFSET, max); }
+ int16 GetSkillTempBonusByPos(uint32 pos) const { return GetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_TEMP_BONUS_FIELD_OFFSET, SKILL_TEMP_BONUS_SHORT_OFFSET); }
+ void SetSkillTempBonus(uint32 pos, int16 bonus) { SetInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_TEMP_BONUS_FIELD_OFFSET, SKILL_TEMP_BONUS_SHORT_OFFSET, bonus); }
+ uint16 GetSkillPermBonusByPos(uint32 pos) const { return GetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_PERM_BONUS_FIELD_OFFSET, SKILL_PERM_BONUS_SHORT_OFFSET); }
+ void SetSkillPermBonus(uint32 pos, uint16 bonus) { SetUInt16Value(PLAYER_SKILL_INFO_1_1 + pos * 3 + SKILL_PERM_BONUS_FIELD_OFFSET, SKILL_PERM_BONUS_SHORT_OFFSET, bonus); }
WorldLocation& GetTeleportDest() { return m_teleport_dest; }
uint32 GetTeleportOptions() const { return m_teleport_options; }
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 0dd8860bf58..b37a554adc9 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -57,7 +57,7 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid,
return false;
}
- Object::_Create(guidlow, 0, HighGuid::Mo_Transport);
+ Object::_Create(ObjectGuid::Create<HighGuid::Mo_Transport>(guidlow));
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index 49003603cff..d80e7408ec9 100644
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -120,7 +120,7 @@ WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid con
case HighGuid::Pet: return GetPet(p, guid);
case HighGuid::DynamicObject: return GetDynamicObject(p, guid);
case HighGuid::Corpse: return GetCorpse(p, guid);
- default: return nullptr;
+ default: return nullptr;
}
}
@@ -250,7 +250,7 @@ Player* ObjectAccessor::FindPlayerByName(std::string_view name)
Player* ObjectAccessor::FindPlayerByLowGUID(ObjectGuid::LowType lowguid)
{
- ObjectGuid guid(HighGuid::Player, lowguid);
+ ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(lowguid);
return ObjectAccessor::FindPlayer(guid);
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 6fa4f1788d9..634e597ed89 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1892,8 +1892,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = ObjectGuid(HighGuid::Unit, slave->id, guidLow);
- linkedGuid = ObjectGuid(HighGuid::Unit, master->id, linkedGuidLow);
+ guid = ObjectGuid::Create<HighGuid::Unit>(slave->id, guidLow);
+ linkedGuid = ObjectGuid::Create<HighGuid::Unit>(master->id, linkedGuidLow);
break;
}
case LINKED_RESPAWN_CREATURE_TO_GO:
@@ -1929,8 +1929,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = ObjectGuid(HighGuid::Unit, slave->id, guidLow);
- linkedGuid = ObjectGuid(HighGuid::GameObject, master->id, linkedGuidLow);
+ guid = ObjectGuid::Create<HighGuid::Unit>(slave->id, guidLow);
+ linkedGuid = ObjectGuid::Create<HighGuid::GameObject>(master->id, linkedGuidLow);
break;
}
case LINKED_RESPAWN_GO_TO_GO:
@@ -1966,8 +1966,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = ObjectGuid(HighGuid::GameObject, slave->id, guidLow);
- linkedGuid = ObjectGuid(HighGuid::GameObject, master->id, linkedGuidLow);
+ guid = ObjectGuid::Create<HighGuid::GameObject>(slave->id, guidLow);
+ linkedGuid = ObjectGuid::Create<HighGuid::GameObject>(master->id, linkedGuidLow);
break;
}
case LINKED_RESPAWN_GO_TO_CREATURE:
@@ -2003,8 +2003,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = ObjectGuid(HighGuid::GameObject, slave->id, guidLow);
- linkedGuid = ObjectGuid(HighGuid::Unit, master->id, linkedGuidLow);
+ guid = ObjectGuid::Create<HighGuid::GameObject>(slave->id, guidLow);
+ linkedGuid = ObjectGuid::Create<HighGuid::Unit>(master->id, linkedGuidLow);
break;
}
}
@@ -2024,7 +2024,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(ObjectGuid::LowType guidLow, ObjectGuid
CreatureData const* master = GetCreatureData(guidLow);
ASSERT(master);
- ObjectGuid guid(HighGuid::Unit, master->id, guidLow);
+ ObjectGuid guid = ObjectGuid::Create<HighGuid::Unit>(master->id, guidLow);
if (!linkedGuidLow) // we're removing the linking
{
@@ -2056,7 +2056,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(ObjectGuid::LowType guidLow, ObjectGuid
return false;
}
- ObjectGuid linkedGuid(HighGuid::Unit, slave->id, linkedGuidLow);
+ ObjectGuid linkedGuid = ObjectGuid::Create<HighGuid::Unit>(slave->id, linkedGuidLow);
_linkedRespawnStore[guid] = linkedGuid;
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_LINKED_RESPAWN);
@@ -6443,7 +6443,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{
Field* fields = result->Fetch();
ObjectGuid::LowType receiver = fields[3].GetUInt32();
- if (serverUp && ObjectAccessor::FindConnectedPlayer(ObjectGuid(HighGuid::Player, receiver)))
+ if (serverUp && ObjectAccessor::FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(receiver)))
continue;
Mail* m = new Mail;
@@ -7248,7 +7248,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
{
uint32 oldMSTime = getMSTime();
- _areaTriggerStore.clear(); // need for reload case
+ _areaTriggerStore.clear(); // need for reload case
// 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT ID, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ca43d66d9c8..162feb35b3e 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -1251,7 +1251,8 @@ class TC_GAME_API ObjectMgr
template<HighGuid type>
ObjectGuidGenerator& GetGenerator()
{
- static_assert(ObjectGuidTraits<type>::Global, "Only global guid can be generated in ObjectMgr context");
+ static_assert(ObjectGuidTraits<type>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Global),
+ "Only global guid can be generated in ObjectMgr context");
return GetGuidSequenceGenerator(type);
}
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index ca11a2fe24e..c9993f95f40 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -152,7 +152,7 @@ bool Group::Create(Player* leader)
{
ObjectGuid leaderGuid = leader->GetGUID();
- m_guid = ObjectGuid(HighGuid::Group, sGroupMgr->GenerateGroupId());
+ m_guid = ObjectGuid::Create<HighGuid::Group>(sGroupMgr->GenerateGroupId());
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
@@ -221,15 +221,15 @@ bool Group::Create(Player* leader)
void Group::LoadGroupFromDB(Field* fields)
{
m_dbStoreId = fields[16].GetUInt32();
- m_guid = ObjectGuid(HighGuid::Group, sGroupMgr->GenerateGroupId());
- m_leaderGuid = ObjectGuid(HighGuid::Player, fields[0].GetUInt32());
+ m_guid = ObjectGuid::Create<HighGuid::Group>(sGroupMgr->GenerateGroupId());
+ m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32());
// group leader not exist
if (!sCharacterCache->GetCharacterNameByGuid(m_leaderGuid, m_leaderName))
return;
m_lootMethod = LootMethod(fields[1].GetUInt8());
- m_looterGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32());
+ m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
m_lootThreshold = ItemQualities(fields[3].GetUInt8());
for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
@@ -251,7 +251,7 @@ void Group::LoadGroupFromDB(Field* fields)
else
m_raidDifficulty = Difficulty(r_diff);
- m_masterLooterGuid = ObjectGuid(HighGuid::Player, fields[15].GetUInt32());
+ m_masterLooterGuid = fields[15].GetUInt32() ? ObjectGuid::Create<HighGuid::Player>(fields[15].GetUInt32()) : ObjectGuid::Empty;
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
@@ -260,7 +260,7 @@ void Group::LoadGroupFromDB(Field* fields)
void Group::LoadMemberFromDB(ObjectGuid::LowType guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
{
MemberSlot member;
- member.guid = ObjectGuid(HighGuid::Player, guidLow);
+ member.guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
// skip non-existed member
if (!sCharacterCache->GetCharacterNameByGuid(member.guid, member.name))
@@ -1084,7 +1084,6 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
if (item->Quality >= uint32(m_lootThreshold))
{
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
-
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1169,7 +1168,6 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
}
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
-
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1235,7 +1233,6 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
if (item->Quality >= uint32(m_lootThreshold))
{
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
-
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
@@ -1309,7 +1306,6 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
item = sObjectMgr->GetItemTemplate(i->itemid);
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
-
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 9f65db7d038..59bf3314f1b 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -488,7 +488,7 @@ bool Guild::BankTab::SetItem(CharacterDatabaseTransaction trans, uint8 slotId, I
trans->Append(stmt);
item->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty);
- item->SetGuidValue(ITEM_FIELD_OWNER, ObjectGuid::Empty);
+ item->SetOwnerGUID(ObjectGuid::Empty);
item->FSetState(ITEM_NEW);
item->SaveToDB(trans); // Not in inventory and can be saved standalone
}
@@ -1917,7 +1917,7 @@ bool Guild::LoadFromDB(Field* fields)
{
m_id = fields[0].GetUInt32();
m_name = fields[1].GetString();
- m_leaderGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32());
+ m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
m_emblemInfo.LoadFromDB(fields);
m_info = fields[8].GetString();
m_motd = fields[9].GetString();
@@ -1947,7 +1947,7 @@ void Guild::LoadRankFromDB(Field* fields)
bool Guild::LoadMemberFromDB(Field* fields)
{
ObjectGuid::LowType lowguid = fields[1].GetUInt32();
- ObjectGuid playerGuid(HighGuid::Player, lowguid);
+ ObjectGuid playerGuid(ObjectGuid::Create<HighGuid::Player>(lowguid));
auto [memberIt, isNew] = m_members.try_emplace(playerGuid, m_id, playerGuid, fields[2].GetUInt8());
if (!isNew)
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
deleted file mode 100644
index 02f8dc683f2..00000000000
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "zlib.h"
-#include "AddonHandler.h"
-#include "Opcodes.h"
-#include "Log.h"
-
-AddonHandler* AddonHandler::instance()
-{
- static AddonHandler instance;
- return &instance;
-}
-
-bool AddonHandler::BuildAddonPacket(WorldPacket* source, WorldPacket* target)
-{
- ByteBuffer AddOnPacked;
- uLongf AddonRealSize;
- uint32 CurrentPosition;
- uint32 TempValue;
-
- // broken addon packet, can't be received from real client
- if (source->rpos() + 4 > source->size())
- return false;
-
- *source >> TempValue; // get real size of the packed structure
-
- // empty addon packet, nothing process, can't be received from real client
- if (!TempValue)
- return false;
-
- AddonRealSize = TempValue; // temp value because ZLIB only excepts uLongf
-
- CurrentPosition = source->rpos(); // get the position of the pointer in the structure
-
- AddOnPacked.resize(AddonRealSize); // resize target for zlib action
-
- if (uncompress(AddOnPacked.contents(), &AddonRealSize, source->contents() + CurrentPosition, source->size() - CurrentPosition) == Z_OK)
- {
- target->Initialize(SMSG_ADDON_INFO);
-
- uint32 addonsCount;
- AddOnPacked >> addonsCount; // addons count?
-
- for (uint32 i = 0; i < addonsCount; ++i)
- {
- std::string addonName;
- uint8 enabled;
- uint32 crc, unk2;
-
- // check next addon data format correctness
- if (AddOnPacked.rpos()+1 > AddOnPacked.size())
- return false;
-
- AddOnPacked >> addonName;
-
- // recheck next addon data format correctness
- if (AddOnPacked.rpos()+1+4+4 > AddOnPacked.size())
- return false;
-
- AddOnPacked >> enabled >> crc >> unk2;
-
- TC_LOG_DEBUG("network", "ADDON: Name: {}, Enabled: 0x{:x}, CRC: 0x{:x}, Unknown2: 0x{:x}", addonName, enabled, crc, unk2);
-
- uint8 state = (enabled ? 2 : 1);
- *target << uint8(state);
-
- uint8 unk1 = (enabled ? 1 : 0);
- *target << uint8(unk1);
- if (unk1)
- {
- uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
- *target << uint8(unk);
- if (unk)
- {
- unsigned char tdata[256] =
- {
- 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
- 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
- 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
- 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
- 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
- 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
- 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
- 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
- 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
- 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
- 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
- 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
- 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
- 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
- 0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
- 0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
- };
- target->append(tdata, sizeof(tdata));
- }
-
- *target << uint32(0);
- }
-
- uint8 unk3 = (enabled ? 0 : 1);
- *target << uint8(unk3);
- if (unk3)
- {
- // String, 256 (null terminated?)
- *target << uint8(0);
- }
- }
-
- uint32 unk4;
- AddOnPacked >> unk4;
-
- uint32 count = 0;
- *target << uint32(count);
-
- if (AddOnPacked.rpos() != AddOnPacked.size())
- TC_LOG_DEBUG("network", "packet under read!");
- }
- else
- {
- TC_LOG_ERROR("network", "Addon packet uncompress error :(");
- return false;
- }
- return true;
-}
diff --git a/src/server/game/Handlers/AddonHandler.h b/src/server/game/Handlers/AddonHandler.h
deleted file mode 100644
index 82077557146..00000000000
--- a/src/server/game/Handlers/AddonHandler.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ADDONHANDLER_H
-#define __ADDONHANDLER_H
-
-#include "Common.h"
-#include "Config.h"
-#include "WorldPacket.h"
-
-class AddonHandler
-{
- public:
- static AddonHandler* instance();
-
- bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target);
-
- private:
- AddonHandler() { }
- ~AddonHandler() { }
-};
-#define sAddOnHandler AddonHandler::instance()
-#endif
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 1880194278d..fa6020ad84d 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -489,7 +489,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
}
// impossible have online own another character (use this for speedup check in case online owner)
- ObjectGuid ownerGuid(HighGuid::Player, auction->owner);
+ ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
Player* auction_owner = ObjectAccessor::FindPlayer(ownerGuid);
if (!auction_owner && sCharacterCache->GetCharacterAccountIdByGuid(ownerGuid) == player->GetSession()->GetAccountId())
{
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 98adad41a51..5f8a4abd36e 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -229,7 +229,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
{
do
{
- ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt32());
+ ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt32());
TC_LOG_INFO("network", "Loading {} from account {}.", guid.ToString(), GetAccountId());
if (Player::BuildEnumData(result, &data))
{
@@ -984,9 +984,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
if (pCurrChar->IsGameMaster())
SendNotification(LANG_GM_ON);
- std::string IP_str = GetRemoteAddress();
TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Login Character:[{}] {} Level: {}, XP: {}/{} ({} left)",
- GetAccountId(), IP_str, pCurrChar->GetName(), pCurrChar->GetGUID().ToString(), pCurrChar->GetLevel(),
+ GetAccountId(), GetRemoteAddress(), pCurrChar->GetName(), pCurrChar->GetGUID().ToString(), pCurrChar->GetLevel(),
_player->GetXP(), _player->GetXPForNextLevel(), std::max(0, (int32)_player->GetXPForNextLevel() - (int32)_player->GetXP()));
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 951a5cfe808..e3f5cbd8a7b 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -440,7 +440,7 @@ void WorldSession::HandleMailTakeItem(WorldPackets::Mail::MailTakeItem& takeItem
if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail
{
- ObjectGuid sender_guid(HighGuid::Player, m->sender);
+ ObjectGuid sender_guid = ObjectGuid::Create<HighGuid::Player>(m->sender);
Player* receiver = ObjectAccessor::FindConnectedPlayer(sender_guid);
uint32 sender_accId = 0;
@@ -588,7 +588,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPackets::Mail::MailCreateTextIt
bodyItem->SetText(m->body);
if (m->messageType == MAIL_NORMAL)
- bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HighGuid::Player, m->sender));
+ bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(m->sender));
bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK);
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index c580d794426..2ccac032ad9 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -144,7 +144,7 @@ void MailDraft::deleteIncludedItems(CharacterDatabaseTransaction trans, bool inD
void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender_guid, ObjectGuid::LowType receiver_guid, CharacterDatabaseTransaction trans)
{
- ObjectGuid receiverGuid(HighGuid::Player, receiver_guid);
+ ObjectGuid receiverGuid = ObjectGuid::Create<HighGuid::Player>(receiver_guid);
Player* receiver = ObjectAccessor::FindConnectedPlayer(receiverGuid);
uint32 rc_account = 0;
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index bf4a8d1b197..5f65a14f262 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3082,7 +3082,9 @@ bool Map::CheckRespawn(RespawnInfo* info)
}
// next, check linked respawn time
- ObjectGuid thisGUID = ObjectGuid((info->type == SPAWN_TYPE_GAMEOBJECT) ? HighGuid::GameObject : HighGuid::Unit, info->entry, info->spawnId);
+ ObjectGuid thisGUID = info->type == SPAWN_TYPE_GAMEOBJECT
+ ? ObjectGuid::Create<HighGuid::GameObject>(info->entry, info->spawnId)
+ : ObjectGuid::Create<HighGuid::Unit>(info->entry, info->spawnId);
if (time_t linkedTime = GetLinkedRespawnTime(thisGUID))
{
time_t now = GameTime::GetGameTime();
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index f82420e49e3..05d55cbacc8 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -586,14 +586,14 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
template<HighGuid high>
inline ObjectGuid::LowType GenerateLowGuid()
{
- static_assert(ObjectGuidTraits<high>::MapSpecific, "Only map specific guid can be generated in Map context");
+ static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be generated in Map context");
return GetGuidSequenceGenerator(high).Generate();
}
template<HighGuid high>
inline ObjectGuid::LowType GetMaxLowGuid()
{
- static_assert(ObjectGuidTraits<high>::MapSpecific, "Only map specific guid can be retrieved in Map context");
+ static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be generated in Map context");
return GetGuidSequenceGenerator(high).GetNextAfterMaxUsed();
}
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index bd5b12e3e7e..5a16c8b9550 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -72,10 +72,13 @@ void TransportMgr::LoadTransportTemplates()
if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size())
{
- TC_LOG_ERROR("sql.sql", "Transport {} (name: {}) has an invalid path specified in `gameobject_template`.`data0` ({}) field, skipped.", entry, goInfo->name, goInfo->moTransport.taxiPathId);
+ TC_LOG_ERROR("sql.sql", "Transport {} (name: {}) has an invalid path specified in `gameobject_template`.`Data0` ({}) field, skipped.", entry, goInfo->name, goInfo->moTransport.taxiPathId);
continue;
}
+ if (!goInfo->moTransport.taxiPathId)
+ continue;
+
// paths are generated per template, saves us from generating it again in case of instanced transports
TransportTemplate& transport = _transportTemplates[entry];
transport.entry = entry;
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 5d5a3d52728..d4a8a23cfbe 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -464,7 +464,7 @@ void PoolMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- ObjectGuid::LowType guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt32();
uint32 pool_id = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index 84b68176f21..dc935cda33b 100644
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -68,7 +68,7 @@ bool GmTicket::LoadFromDB(Field* fields)
uint8 index = 0;
_id = fields[ index].GetUInt32();
_type = TicketType(fields[++index].GetUInt8());
- _playerGuid = ObjectGuid(HighGuid::Player, fields[++index].GetUInt32());
+ _playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++index].GetUInt32());
_playerName = fields[++index].GetString();
_message = fields[++index].GetString();
_createTime = fields[++index].GetUInt32();
@@ -77,8 +77,8 @@ bool GmTicket::LoadFromDB(Field* fields)
_posY = fields[++index].GetFloat();
_posZ = fields[++index].GetFloat();
_lastModifiedTime = fields[++index].GetUInt32();
- _closedBy = ObjectGuid(uint64(fields[++index].GetInt32()));
- _assignedTo = ObjectGuid(HighGuid::Player, fields[++index].GetUInt32());
+ _closedBy = fields[++index].GetUInt32() ? ObjectGuid::Create<HighGuid::Player>(fields[index].GetUInt32()) : ObjectGuid::Empty;
+ _assignedTo = fields[++index].GetUInt32() ? ObjectGuid::Create<HighGuid::Player>(fields[index].GetUInt32()) : ObjectGuid::Empty;
_comment = fields[++index].GetString();
_response = fields[++index].GetString();
_completed = fields[++index].GetBool();
@@ -105,7 +105,7 @@ void GmTicket::SaveToDB(CharacterDatabaseTransaction trans) const
stmt->setFloat (++index, _posY);
stmt->setFloat (++index, _posZ);
stmt->setUInt32(++index, uint32(_lastModifiedTime));
- stmt->setInt32 (++index, int32(_closedBy.GetCounter()));
+ stmt->setUInt32(++index, _closedBy.GetCounter());
stmt->setUInt32(++index, _assignedTo.GetCounter());
stmt->setString(++index, _comment);
stmt->setString(++index, _response);
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index d9e78dadf4c..dc47910c3f1 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -953,7 +953,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std::
CharacterDatabase.CommitTransaction(trans);
// in case of name conflict player has to rename at login anyway
- sCharacterCache->AddCharacterCacheEntry(ObjectGuid(HighGuid::Player, guid), account, name, gender, race, playerClass, level);
+ sCharacterCache->AddCharacterCacheEntry(ObjectGuid::Create<HighGuid::Player>(guid), account, name, gender, race, playerClass, level);
sObjectMgr->GetGenerator<HighGuid::Item>().Set(sObjectMgr->GetGenerator<HighGuid::Item>().GetNextAfterMaxUsed() + items.size());
sObjectMgr->_mailId += mails.size();
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index aef0b9a73bf..58b9614f65e 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -140,7 +140,7 @@ public:
DeletedInfo info;
- info.guid = ObjectGuid(HighGuid::Player, fields[0].GetUInt32());
+ info.guid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32());
info.name = fields[1].GetString();
info.accountId = fields[2].GetUInt32();
@@ -946,7 +946,7 @@ public:
if (characterGUID)
{
- if (sCharacterCache->GetCharacterCacheByGuid(ObjectGuid(HighGuid::Player, *characterGUID)))
+ if (sCharacterCache->GetCharacterCacheByGuid(ObjectGuid::Create<HighGuid::Player>(*characterGUID)))
{
handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, *characterGUID);
handler->SetSentErrorMessage(true);
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index a99ad2e8752..37e3db1aac9 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -1055,7 +1055,7 @@ public:
static bool HandleDebugGetItemValueCommand(ChatHandler* handler, ObjectGuid::LowType guid, uint32 index)
{
- Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
+ Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid::Create<HighGuid::Item>(guid));
if (!i)
return false;
@@ -1072,7 +1072,7 @@ public:
static bool HandleDebugSetItemValueCommand(ChatHandler* handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
{
- Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
+ Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid::Create<HighGuid::Item>(guid));
if (!i)
return false;
@@ -1087,7 +1087,7 @@ public:
static bool HandleDebugItemExpireCommand(ChatHandler* handler, ObjectGuid::LowType guid)
{
- Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
+ Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid::Create<HighGuid::Item>(guid));
if (!i)
return false;
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 7775ad5b543..8d62192ec5a 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -538,10 +538,7 @@ public:
type = gameObjectInfo->type;
displayId = gameObjectInfo->displayId;
name = gameObjectInfo->name;
- if (type == GAMEOBJECT_TYPE_CHEST)
- lootId = gameObjectInfo->chest.lootId;
- else if (type == GAMEOBJECT_TYPE_FISHINGHOLE)
- lootId = gameObjectInfo->fishinghole.lootId;
+ lootId = gameObjectInfo->GetLootId();
// If we have a real object, send some info about it
if (thisGO)
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index 80d7f6f576f..5db99bdca31 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -159,7 +159,7 @@ public:
return true;
}
- sTicketMgr->ResolveAndCloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(0)));
+ sTicketMgr->ResolveAndCloseTicket(ticket->GetId(), Object::GetGUID(player));
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", nullptr, nullptr, nullptr, nullptr);
@@ -262,7 +262,7 @@ public:
Player* gm = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
- ticket->SetResolvedBy(gm ? gm->GetGUID() : ObjectGuid(uint64(0)));
+ ticket->SetResolvedBy(Object::GetGUID(gm));
ticket->SetCompleted();
ticket->SaveToDB(trans);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index 8cbd1263d76..6702d39a6b5 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -381,8 +381,8 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
case NPC_ZAFOD_BOOMBOX:
if (GameObjectTemplate const* go = sObjectMgr->GetGameObjectTemplate(GO_THE_SKYBREAKER_A))
- if ((TeamInInstance == ALLIANCE && data->mapId == go->moTransport.mapID) ||
- (TeamInInstance == HORDE && data->mapId != go->moTransport.mapID))
+ if ((TeamInInstance == ALLIANCE && int32(data->mapId) == go->moTransport.mapID) ||
+ (TeamInInstance == HORDE && int32(data->mapId) != go->moTransport.mapID))
return entry;
return 0;
case NPC_IGB_MURADIN_BRONZEBEARD:
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index 56437f61bc0..3a38ad1f01d 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -981,7 +981,7 @@ struct go_celestial_planetarium_access : public GameObjectAI
return true;
bool hasKey = true;
- if (LockEntry const* lock = sLockStore.LookupEntry(me->GetGOInfo()->goober.lockId))
+ if (LockEntry const* lock = sLockStore.LookupEntry(me->GetGOInfo()->GetLockId()))
{
hasKey = false;
for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h
index 8da68af81c1..321f65c3d2e 100644
--- a/src/server/shared/SharedDefines.h
+++ b/src/server/shared/SharedDefines.h
@@ -110,15 +110,24 @@ enum Races
// max+1 for player race
#define MAX_RACES 12
-#define RACEMASK_ALL_PLAYABLE \
- ((1<<(RACE_HUMAN-1)) |(1<<(RACE_ORC-1)) |(1<<(RACE_DWARF-1)) | \
- (1<<(RACE_NIGHTELF-1))|(1<<(RACE_UNDEAD_PLAYER-1))|(1<<(RACE_TAUREN-1)) | \
- (1<<(RACE_GNOME-1)) |(1<<(RACE_TROLL-1)) |(1<<(RACE_BLOODELF-1))| \
+#define RACEMASK_ALL_PLAYABLE \
+ ((1<<(RACE_HUMAN-1)) | \
+ (1<<(RACE_ORC-1)) | \
+ (1<<(RACE_DWARF-1)) | \
+ (1<<(RACE_NIGHTELF-1)) | \
+ (1<<(RACE_UNDEAD_PLAYER-1)) | \
+ (1<<(RACE_TAUREN-1)) | \
+ (1<<(RACE_GNOME-1)) | \
+ (1<<(RACE_TROLL-1)) | \
+ (1<<(RACE_BLOODELF-1)) | \
(1<<(RACE_DRAENEI-1)))
-#define RACEMASK_ALLIANCE \
- ((1<<(RACE_HUMAN-1)) | (1<<(RACE_DWARF-1)) | (1<<(RACE_NIGHTELF-1)) | \
- (1<<(RACE_GNOME-1)) | (1<<(RACE_DRAENEI-1)))
+#define RACEMASK_ALLIANCE \
+ ((1<<(RACE_HUMAN-1)) | \
+ (1<<(RACE_DWARF-1)) | \
+ (1<<(RACE_NIGHTELF-1)) | \
+ (1<<(RACE_GNOME-1)) | \
+ (1<<(RACE_DRAENEI-1)))
#define RACEMASK_HORDE RACEMASK_ALL_PLAYABLE & ~RACEMASK_ALLIANCE
@@ -143,11 +152,17 @@ enum Classes
// max+1 for player class
#define MAX_CLASSES 12
-#define CLASSMASK_ALL_PLAYABLE \
- ((1<<(CLASS_WARRIOR-1))|(1<<(CLASS_PALADIN-1))|(1<<(CLASS_HUNTER-1))| \
- (1<<(CLASS_ROGUE-1)) |(1<<(CLASS_PRIEST-1)) |(1<<(CLASS_SHAMAN-1))| \
- (1<<(CLASS_MAGE-1)) |(1<<(CLASS_WARLOCK-1))|(1<<(CLASS_DRUID-1)) | \
- (1<<(CLASS_DEATH_KNIGHT-1)))
+#define CLASSMASK_ALL_PLAYABLE \
+ ((1<<(CLASS_WARRIOR-1)) | \
+ (1<<(CLASS_PALADIN-1)) | \
+ (1<<(CLASS_HUNTER-1)) | \
+ (1<<(CLASS_ROGUE-1)) | \
+ (1<<(CLASS_PRIEST-1)) | \
+ (1<<(CLASS_DEATH_KNIGHT-1)) | \
+ (1<<(CLASS_SHAMAN-1)) | \
+ (1<<(CLASS_MAGE-1)) | \
+ (1<<(CLASS_WARLOCK-1)) | \
+ (1<<(CLASS_DRUID-1)))
#define MAX_TALENT_TREES 3
@@ -196,7 +211,7 @@ enum UnitClass
#define CLASSMASK_ALL_CREATURES ((1<<(UNIT_CLASS_WARRIOR-1)) | (1<<(UNIT_CLASS_PALADIN-1)) | (1<<(UNIT_CLASS_ROGUE-1)) | (1<<(UNIT_CLASS_MAGE-1)))
-#define CLASSMASK_WAND_USERS ((1<<(CLASS_PRIEST-1))|(1<<(CLASS_MAGE-1))|(1<<(CLASS_WARLOCK-1)))
+#define CLASSMASK_WAND_USERS ((1<<(CLASS_PRIEST-1)) | (1<<(CLASS_MAGE-1)) | (1<<(CLASS_WARLOCK-1)))
#define PLAYER_MAX_BATTLEGROUND_QUEUES 2
@@ -733,6 +748,51 @@ enum SheathTypes
#define MAX_SHEATHETYPE 8
+enum CharacterFlags
+{
+ CHARACTER_FLAG_NONE = 0x00000000,
+ CHARACTER_FLAG_UNK1 = 0x00000001,
+ CHARACTER_FLAG_UNK2 = 0x00000002,
+ CHARACTER_LOCKED_FOR_TRANSFER = 0x00000004,
+ CHARACTER_FLAG_UNK4 = 0x00000008,
+ CHARACTER_FLAG_UNK5 = 0x00000010,
+ CHARACTER_FLAG_UNK6 = 0x00000020,
+ CHARACTER_FLAG_UNK7 = 0x00000040,
+ CHARACTER_FLAG_UNK8 = 0x00000080,
+ CHARACTER_FLAG_UNK9 = 0x00000100,
+ CHARACTER_FLAG_UNK10 = 0x00000200,
+ CHARACTER_FLAG_HIDE_HELM = 0x00000400,
+ CHARACTER_FLAG_HIDE_CLOAK = 0x00000800,
+ CHARACTER_FLAG_UNK13 = 0x00001000,
+ CHARACTER_FLAG_GHOST = 0x00002000,
+ CHARACTER_FLAG_RENAME = 0x00004000,
+ CHARACTER_FLAG_UNK16 = 0x00008000,
+ CHARACTER_FLAG_UNK17 = 0x00010000,
+ CHARACTER_FLAG_UNK18 = 0x00020000,
+ CHARACTER_FLAG_UNK19 = 0x00040000,
+ CHARACTER_FLAG_UNK20 = 0x00080000,
+ CHARACTER_FLAG_UNK21 = 0x00100000,
+ CHARACTER_FLAG_UNK22 = 0x00200000,
+ CHARACTER_FLAG_UNK23 = 0x00400000,
+ CHARACTER_FLAG_UNK24 = 0x00800000,
+ CHARACTER_FLAG_LOCKED_BY_BILLING = 0x01000000,
+ CHARACTER_FLAG_DECLINED = 0x02000000,
+ CHARACTER_FLAG_UNK27 = 0x04000000,
+ CHARACTER_FLAG_UNK28 = 0x08000000,
+ CHARACTER_FLAG_UNK29 = 0x10000000,
+ CHARACTER_FLAG_UNK30 = 0x20000000,
+ CHARACTER_FLAG_UNK31 = 0x40000000,
+ CHARACTER_FLAG_UNK32 = 0x80000000
+};
+
+enum CharacterCustomizeFlags
+{
+ CHAR_CUSTOMIZE_FLAG_NONE = 0x00000000,
+ CHAR_CUSTOMIZE_FLAG_CUSTOMIZE = 0x00000001, // name, gender, etc...
+ CHAR_CUSTOMIZE_FLAG_FACTION = 0x00010000, // name, gender, faction, etc...
+ CHAR_CUSTOMIZE_FLAG_RACE = 0x00100000 // name, gender, race, etc...
+};
+
enum CharacterSlot
{
SLOT_HEAD = 0,