mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 15:16:24 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -4,11 +4,12 @@
|
||||
#include "Common.h"
|
||||
#include "EventProcessor.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
class AuctionListOwnerItemsDelayEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
AuctionListOwnerItemsDelayEvent(uint64 _creatureGuid, uint64 guid, bool o) : creatureGuid(_creatureGuid), playerguid(guid), owner(o) {}
|
||||
AuctionListOwnerItemsDelayEvent(ObjectGuid _creatureGuid, ObjectGuid guid, bool o) : creatureGuid(_creatureGuid), playerguid(guid), owner(o) {}
|
||||
~AuctionListOwnerItemsDelayEvent() override {}
|
||||
|
||||
bool Execute(uint64 e_time, uint32 p_time) override;
|
||||
@@ -16,22 +17,22 @@ public:
|
||||
bool getOwner() { return owner; }
|
||||
|
||||
private:
|
||||
uint64 creatureGuid;
|
||||
uint64 playerguid;
|
||||
ObjectGuid creatureGuid;
|
||||
ObjectGuid playerguid;
|
||||
bool owner;
|
||||
};
|
||||
|
||||
class AuctionListItemsDelayEvent
|
||||
{
|
||||
public:
|
||||
AuctionListItemsDelayEvent(uint32 msTimer, uint64 playerguid, uint64 creatureguid, std::string searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, uint32 auctionSlotID, uint32 auctionMainCategory, uint32 auctionSubCategory, uint32 quality, uint8 getAll) :
|
||||
AuctionListItemsDelayEvent(uint32 msTimer, ObjectGuid playerguid, ObjectGuid creatureguid, std::string searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, uint32 auctionSlotID, uint32 auctionMainCategory, uint32 auctionSubCategory, uint32 quality, uint8 getAll) :
|
||||
_msTimer(msTimer), _playerguid(playerguid), _creatureguid(creatureguid), _searchedname(searchedname), _listfrom(listfrom), _levelmin(levelmin), _levelmax(levelmax), _usable(usable), _auctionSlotID(auctionSlotID), _auctionMainCategory(auctionMainCategory), _auctionSubCategory(auctionSubCategory), _quality(quality), _getAll(getAll) { }
|
||||
|
||||
bool Execute();
|
||||
|
||||
uint32 _msTimer;
|
||||
uint64 _playerguid;
|
||||
uint64 _creatureguid;
|
||||
ObjectGuid _playerguid;
|
||||
ObjectGuid _creatureguid;
|
||||
std::string _searchedname;
|
||||
uint32 _listfrom;
|
||||
uint8 _levelmin;
|
||||
|
||||
@@ -210,7 +210,7 @@ BanReturn BanManager::BanCharacter(std::string const& CharacterName, std::string
|
||||
{
|
||||
Player* target = ObjectAccessor::FindPlayerByName(CharacterName, false);
|
||||
uint32 DurationSecs = TimeStringToSecs(Duration);
|
||||
uint32 TargetGUID = 0;
|
||||
ObjectGuid TargetGUID;
|
||||
|
||||
/// Pick a player to ban if not online
|
||||
if (!target)
|
||||
@@ -220,15 +220,15 @@ BanReturn BanManager::BanCharacter(std::string const& CharacterName, std::string
|
||||
return BAN_NOTFOUND;
|
||||
}
|
||||
else
|
||||
TargetGUID = target->GetGUIDLow();
|
||||
TargetGUID = target->GetGUID();
|
||||
|
||||
// make sure there is only one active ban
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BAN);
|
||||
stmt->setUInt32(0, TargetGUID);
|
||||
stmt->setUInt32(0, TargetGUID.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_BAN);
|
||||
stmt->setUInt32(0, TargetGUID);
|
||||
stmt->setUInt32(0, TargetGUID.GetCounter());
|
||||
stmt->setUInt32(1, DurationSecs);
|
||||
stmt->setString(2, Author);
|
||||
stmt->setString(3, Reason);
|
||||
@@ -297,19 +297,19 @@ bool BanManager::RemoveBanIP(std::string const& IP)
|
||||
bool BanManager::RemoveBanCharacter(std::string const& CharacterName)
|
||||
{
|
||||
Player* pBanned = ObjectAccessor::FindPlayerByName(CharacterName, false);
|
||||
uint32 guid = 0;
|
||||
ObjectGuid guid;
|
||||
|
||||
/// Pick a player to ban if not online
|
||||
if (!pBanned)
|
||||
guid = sWorld->GetGlobalPlayerGUID(CharacterName);
|
||||
else
|
||||
guid = pBanned->GetGUIDLow();
|
||||
guid = pBanned->GetGUID();
|
||||
|
||||
if (!guid)
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BAN);
|
||||
stmt->setUInt32(0, guid);
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ void WhoListCacheMgr::Update()
|
||||
m_whoOpcodeList.reserve(sWorld->GetPlayerCount() + 1);
|
||||
|
||||
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||
HashMapHolder<Player>::MapType const& m = ObjectAccessor::GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->second->FindMap() || itr->second->GetSession()->PlayerLoading())
|
||||
@@ -43,4 +43,4 @@ void WhoListCacheMgr::Update()
|
||||
|
||||
m_whoOpcodeList.push_back( WhoListPlayerInfo(itr->second->GetTeamId(), itr->second->GetSession()->GetSecurity(), itr->second->getLevel(), itr->second->getClass(), itr->second->getRace(), (itr->second->IsSpectator() ? 4395 /*Dalaran*/ : itr->second->GetZoneId()), itr->second->getGender(), wpname, wgname, aname, pname, gname) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user