feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)

This commit is contained in:
UltraNix
2021-04-25 22:18:03 +02:00
committed by GitHub
parent 91081f4ad8
commit f4c226423d
568 changed files with 10655 additions and 11019 deletions

View File

@@ -92,20 +92,20 @@ private:
class MailReceiver
{
public: // Constructors
explicit MailReceiver(uint32 receiver_lowguid) : m_receiver(nullptr), m_receiver_lowguid(receiver_lowguid) {}
explicit MailReceiver(ObjectGuid::LowType receiver_lowguid) : m_receiver(nullptr), m_receiver_lowguid(receiver_lowguid) {}
MailReceiver(Player* receiver);
MailReceiver(Player* receiver, uint32 receiver_lowguid);
MailReceiver(Player* receiver, ObjectGuid::LowType receiver_lowguid);
public: // Accessors
[[nodiscard]] Player* GetPlayer() const { return m_receiver; }
[[nodiscard]] uint32 GetPlayerGUIDLow() const { return m_receiver_lowguid; }
[[nodiscard]] ObjectGuid::LowType GetPlayerGUIDLow() const { return m_receiver_lowguid; }
private:
Player* m_receiver;
uint32 m_receiver_lowguid;
ObjectGuid::LowType m_receiver_lowguid;
};
class MailDraft
{
typedef std::map<uint32, Item*> MailItemMap;
typedef std::map<ObjectGuid, Item*> MailItemMap;
public: // Constructors
explicit MailDraft(uint16 mailTemplateId, bool need_items = true)
@@ -126,7 +126,7 @@ public: // modifiers
MailDraft& AddCOD(uint32 COD) { m_COD = COD; return *this; }
public: // finishers
void SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, SQLTransaction& trans);
void SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender_guid, ObjectGuid::LowType receiver_guid, SQLTransaction& trans);
void SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, MailSender const& sender, MailCheckMask checked = MAIL_CHECK_MASK_NONE, uint32 deliver_delay = 0, uint32 custom_expiration = 0, bool deleteMailItemsFromDB = false, bool sendMail = true);
private:
@@ -146,7 +146,7 @@ private:
struct MailItemInfo
{
uint32 item_guid;
ObjectGuid::LowType item_guid;
uint32 item_template;
};
typedef std::vector<MailItemInfo> MailItemInfoVec;
@@ -158,7 +158,7 @@ struct Mail
uint8 stationery;
uint16 mailTemplateId;
uint32 sender;
uint32 receiver;
ObjectGuid::LowType receiver;
std::string subject;
std::string body;
std::vector<MailItemInfo> items;
@@ -170,7 +170,7 @@ struct Mail
uint32 checked;
MailState state;
void AddItem(uint32 itemGuidLow, uint32 item_template)
void AddItem(ObjectGuid::LowType itemGuidLow, uint32 item_template)
{
MailItemInfo mii;
mii.item_guid = itemGuidLow;
@@ -178,7 +178,7 @@ struct Mail
items.push_back(mii);
}
bool RemoveItem(uint32 item_guid)
bool RemoveItem(ObjectGuid::LowType item_guid)
{
for (MailItemInfoVec::iterator itr = items.begin(); itr != items.end(); ++itr)
{