Core/Entities: Changed a few lowguid uses to ObjectGuid::LowType
This commit is contained in:
@@ -363,7 +363,7 @@ void AuctionHouseMgr::AddAItem(Item* it)
|
||||
mAitems[it->GetGUID().GetCounter()] = it;
|
||||
}
|
||||
|
||||
bool AuctionHouseMgr::RemoveAItem(uint64 id, bool deleteItem)
|
||||
bool AuctionHouseMgr::RemoveAItem(ObjectGuid::LowType id, bool deleteItem)
|
||||
{
|
||||
ItemMap::iterator i = mAitems.find(id);
|
||||
if (i == mAitems.end())
|
||||
|
||||
@@ -177,7 +177,7 @@ class AuctionHouseMgr
|
||||
void LoadAuctions();
|
||||
|
||||
void AddAItem(Item* it);
|
||||
bool RemoveAItem(uint64 id, bool deleteItem = false);
|
||||
bool RemoveAItem(ObjectGuid::LowType id, bool deleteItem = false);
|
||||
|
||||
void Update();
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ void CalendarMgr::RemoveAllPlayerEventsAndInvites(ObjectGuid guid)
|
||||
RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
|
||||
}
|
||||
|
||||
void CalendarMgr::RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId)
|
||||
void CalendarMgr::RemovePlayerGuildEventsAndSignups(ObjectGuid guid, ObjectGuid::LowType guildId)
|
||||
{
|
||||
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
|
||||
if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
|
||||
@@ -579,7 +579,7 @@ void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calend
|
||||
Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);
|
||||
|
||||
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
|
||||
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
|
||||
ObjectGuid::LowType inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
|
||||
|
||||
data << inviteeGuid.WriteAsPacked();
|
||||
data << uint8(inviteeLevel);
|
||||
|
||||
@@ -204,13 +204,13 @@ struct CalendarEvent
|
||||
_description = calendarEvent.GetDescription();
|
||||
}
|
||||
|
||||
CalendarEvent(uint64 eventId, ObjectGuid creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
|
||||
CalendarEvent(uint64 eventId, ObjectGuid creatorGUID, ObjectGuid::LowType guildId, CalendarEventType type, int32 dungeonId,
|
||||
time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
|
||||
_eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
|
||||
_eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
|
||||
_description(description) { }
|
||||
|
||||
CalendarEvent() : _eventId(1), _creatorGUID(), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
|
||||
CalendarEvent() : _eventId(1), _creatorGUID(), _guildId(UI64LIT(0)), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
|
||||
_flags(0), _timezoneTime(0), _title(""), _description("") { }
|
||||
|
||||
~CalendarEvent();
|
||||
@@ -221,8 +221,8 @@ struct CalendarEvent
|
||||
void SetCreatorGUID(ObjectGuid guid) { _creatorGUID = guid; }
|
||||
ObjectGuid GetCreatorGUID() const { return _creatorGUID; }
|
||||
|
||||
void SetGuildId(uint32 guildId) { _guildId = guildId; }
|
||||
uint32 GetGuildId() const { return _guildId; }
|
||||
void SetGuildId(ObjectGuid::LowType guildId) { _guildId = guildId; }
|
||||
ObjectGuid::LowType GetGuildId() const { return _guildId; }
|
||||
|
||||
void SetTitle(const std::string& title) { _title = title; }
|
||||
std::string GetTitle() const { return _title; }
|
||||
@@ -254,7 +254,7 @@ struct CalendarEvent
|
||||
private:
|
||||
uint64 _eventId;
|
||||
ObjectGuid _creatorGUID;
|
||||
uint32 _guildId;
|
||||
ObjectGuid::LowType _guildId;
|
||||
CalendarEventType _type;
|
||||
int32 _dungeonId;
|
||||
time_t _eventTime;
|
||||
@@ -317,7 +317,7 @@ class CalendarMgr
|
||||
void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
|
||||
|
||||
void RemoveAllPlayerEventsAndInvites(ObjectGuid guid);
|
||||
void RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId);
|
||||
void RemovePlayerGuildEventsAndSignups(ObjectGuid guid, ObjectGuid::LowType guildId);
|
||||
|
||||
void SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
|
||||
void SendCalendarEventInvite(CalendarInvite const& invite);
|
||||
|
||||
@@ -81,7 +81,8 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
|
||||
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
|
||||
{
|
||||
std::string bannedGuidStr(*i);
|
||||
ObjectGuid banned_guid(HIGHGUID_PLAYER, uint64(strtoull(bannedGuidStr.substr(0, 16).c_str(), NULL, 16)), uint64(strtoull(bannedGuidStr.substr(16).c_str(), NULL, 16)));
|
||||
ObjectGuid banned_guid;
|
||||
banned_guid.SetRawValue(uint64(strtoull(bannedGuidStr.substr(0, 16).c_str(), NULL, 16)), uint64(strtoull(bannedGuidStr.substr(16).c_str(), NULL, 16)));
|
||||
if (!banned_guid.IsEmpty())
|
||||
{
|
||||
TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore %s", name.c_str(), banned_guid.ToString().c_str());
|
||||
|
||||
@@ -104,6 +104,7 @@ class ObjectGuid
|
||||
|
||||
std::vector<uint8> GetRawValue() const;
|
||||
void SetRawValue(std::vector<uint8> const& guid);
|
||||
void SetRawValue(uint64 high, uint64 low) { _high = high; _low = low; }
|
||||
void Clear() { _low = 0; }
|
||||
|
||||
PackedGuid WriteAsPacked() const;
|
||||
|
||||
@@ -5434,7 +5434,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
|
||||
|
||||
if (guildBank)
|
||||
{
|
||||
if (GetGuildId() == 0)
|
||||
if (!GetGuildId())
|
||||
{
|
||||
TC_LOG_DEBUG("entities.player.items", "You are not member of a guild");
|
||||
return TotalCost;
|
||||
@@ -26413,6 +26413,8 @@ void Player::BuildEnchantmentsInfoData(WorldPacket* data)
|
||||
|
||||
void Player::SendEquipmentSetList()
|
||||
{
|
||||
ObjectGuid ignoredItemGuid;
|
||||
ignoredItemGuid.SetRawValue(0, 1);
|
||||
uint32 count = 0;
|
||||
WorldPacket data(SMSG_EQUIPMENT_SET_LIST, 4);
|
||||
size_t count_pos = data.wpos();
|
||||
@@ -26429,7 +26431,7 @@ void Player::SendEquipmentSetList()
|
||||
{
|
||||
// ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM
|
||||
if (itr->second.IgnoreMask & (1 << i))
|
||||
data << ObjectGuid(uint64(0), uint64(1));
|
||||
data << ignoredItemGuid;
|
||||
else
|
||||
data << ObjectGuid(HIGHGUID_ITEM, itr->second.Items[i]);
|
||||
}
|
||||
|
||||
@@ -2702,10 +2702,10 @@ bool Guild::AddMember(ObjectGuid guid, uint8 rankId)
|
||||
// Player cannot be in guild
|
||||
if (player)
|
||||
{
|
||||
if (player->GetGuildId() != 0)
|
||||
if (player->GetGuildId())
|
||||
return false;
|
||||
}
|
||||
else if (Player::GetGuildIdFromDB(guid) != 0)
|
||||
else if (Player::GetGuildIdFromDB(guid))
|
||||
return false;
|
||||
|
||||
// Remove all player signs from another petitions
|
||||
|
||||
@@ -43,7 +43,7 @@ void GuildMgr::SaveGuilds()
|
||||
itr->second->SaveToDB();
|
||||
}
|
||||
|
||||
uint32 GuildMgr::GenerateGuildId()
|
||||
ObjectGuid::LowType GuildMgr::GenerateGuildId()
|
||||
{
|
||||
if (NextGuildId >= 0xFFFFFFFE)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ Guild* GuildMgr::GetGuildByGuid(ObjectGuid guid) const
|
||||
// Full guids are only used when receiving/sending data to client
|
||||
// everywhere else guild id is used
|
||||
if (guid.IsGuild())
|
||||
if (uint32 guildId = guid.GetCounter())
|
||||
if (ObjectGuid::LowType guildId = guid.GetCounter())
|
||||
return GetGuildById(guildId);
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -432,7 +432,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
|
||||
ObjectGuid inviteeGuid;
|
||||
uint32 inviteeTeam = 0;
|
||||
uint32 inviteeGuildId = 0;
|
||||
ObjectGuid::LowType inviteeGuildId = UI64LIT(0);
|
||||
|
||||
recvData >> eventId >> inviteId >> name >> isPreInvite >> isGuildEvent;
|
||||
|
||||
|
||||
@@ -1553,13 +1553,16 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
|
||||
eqSet.IconName = iconName;
|
||||
eqSet.state = EQUIPMENT_SET_NEW;
|
||||
|
||||
ObjectGuid ignoredItemGuid;
|
||||
ignoredItemGuid.SetRawValue(0, 1);
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
ObjectGuid itemGuid;
|
||||
recvData >> itemGuid.ReadAsPacked();
|
||||
|
||||
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
|
||||
if (itemGuid == ObjectGuid(uint64(0), uint64(1)))
|
||||
if (itemGuid == ignoredItemGuid)
|
||||
{
|
||||
// ignored slots saved as bit mask because we have no free special values for Items[i]
|
||||
eqSet.IgnoreMask |= 1 << i;
|
||||
@@ -1594,6 +1597,8 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_USE");
|
||||
|
||||
ObjectGuid ignoredItemGuid;
|
||||
ignoredItemGuid.SetRawValue(0, 1);
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
ObjectGuid itemGuid;
|
||||
@@ -1605,7 +1610,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
|
||||
TC_LOG_DEBUG("entities.player.items", "%s: srcbag %u, srcslot %u", itemGuid.ToString().c_str(), srcbag, srcslot);
|
||||
|
||||
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
||||
if (itemGuid == ObjectGuid(uint64(0), uint64(1)))
|
||||
if (itemGuid == ignoredItemGuid)
|
||||
continue;
|
||||
|
||||
// Only equip weapons in combat
|
||||
|
||||
@@ -102,7 +102,7 @@ WorldSession::WorldSession(uint32 id, uint32 battlenetAccountId, std::shared_ptr
|
||||
m_muteTime(mute_time),
|
||||
m_timeOutTime(0),
|
||||
AntiDOS(this),
|
||||
m_GUIDLow(0),
|
||||
m_GUIDLow(UI64LIT(0)),
|
||||
_player(NULL),
|
||||
m_Socket(sock),
|
||||
_security(sec),
|
||||
|
||||
@@ -453,9 +453,13 @@ void SpellCastTargets::Update(Unit* caster)
|
||||
if (m_targetMask & TARGET_FLAG_ITEM)
|
||||
m_itemTarget = player->GetItemByGuid(m_itemTargetGUID);
|
||||
else if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
|
||||
if (m_itemTargetGUID == ObjectGuid(uint64(0), uint64(TRADE_SLOT_NONTRADED))) // here it is not guid but slot. Also prevents hacking slots
|
||||
{
|
||||
ObjectGuid nonTradedGuid;
|
||||
nonTradedGuid.SetRawValue(uint64(0), uint64(TRADE_SLOT_NONTRADED));
|
||||
if (m_itemTargetGUID == nonTradedGuid) // here it is not guid but slot. Also prevents hacking slots
|
||||
if (TradeData* pTrade = player->GetTradeData())
|
||||
m_itemTarget = pTrade->GetTraderData()->GetItem(TRADE_SLOT_NONTRADED);
|
||||
}
|
||||
|
||||
if (m_itemTarget)
|
||||
m_itemTargetEntry = m_itemTarget->GetEntry();
|
||||
|
||||
@@ -62,7 +62,12 @@ bool GmTicket::LoadFromDB(Field* fields)
|
||||
_posY = fields[++index].GetFloat();
|
||||
_posZ = fields[++index].GetFloat();
|
||||
_lastModifiedTime = fields[++index].GetUInt32();
|
||||
_closedBy = ObjectGuid(uint64(0), uint64(fields[++index].GetInt64()));
|
||||
int64 closedBy = fields[++index].GetInt64();
|
||||
if (closedBy < 0)
|
||||
_closedBy.SetRawValue(0, uint64(closedBy));
|
||||
else
|
||||
_closedBy = ObjectGuid(HIGHGUID_PLAYER, uint64(closedBy));
|
||||
|
||||
_assignedTo = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt64());
|
||||
_comment = fields[++index].GetString();
|
||||
_response = fields[++index].GetString();
|
||||
|
||||
@@ -3244,7 +3244,7 @@ void World::LoadCharacterNameData()
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()), fields[1].GetString(),
|
||||
AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64()), fields[1].GetString(),
|
||||
fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt8() /*level*/);
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
@@ -153,7 +153,13 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(HIGHGUID_PLAYER, uint64(0), uint64(-1)));
|
||||
ObjectGuid closedByGuid;
|
||||
if (player)
|
||||
closedByGuid = player->GetGUID();
|
||||
else
|
||||
closedByGuid.SetRawValue(0, uint64(-1));
|
||||
|
||||
sTicketMgr->CloseTicket(ticket->GetId(), closedByGuid);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
|
||||
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user