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
+13 -11
View File
@@ -10,12 +10,14 @@
#include "ByteBuffer.h"
#include "ConditionMgr.h"
#include "ItemEnchantmentMgr.h"
#include "ObjectGuid.h"
#include "RefManager.h"
#include "SharedDefines.h"
#include <list>
#include <map>
#include <vector>
enum RollType
{
ROLL_PASS = 0,
@@ -135,7 +137,7 @@ struct LootStoreItem
// Checks correctness of values
};
typedef std::set<uint32> AllowedLooterSet;
typedef GuidSet AllowedLooterSet;
struct LootItem
{
@@ -144,7 +146,7 @@ struct LootItem
int32 randomPropertyId;
ConditionList conditions; // additional loot condition
AllowedLooterSet allowedGUIDs;
uint64 rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list!
ObjectGuid rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list!
uint8 count : 8;
bool is_looted : 1;
bool is_blocked : 1;
@@ -183,7 +185,7 @@ class LootTemplate;
typedef std::vector<QuestItem> QuestItemList;
typedef std::vector<LootItem> LootItemList;
typedef std::map<uint32, QuestItemList*> QuestItemMap;
typedef std::map<ObjectGuid, QuestItemList*> QuestItemMap;
typedef std::list<LootStoreItem*> LootStoreItemList;
typedef std::unordered_map<uint32, LootTemplate*> LootTemplateMap;
@@ -306,11 +308,11 @@ struct Loot
std::vector<LootItem> quest_items;
uint32 gold;
uint8 unlootedCount{0};
uint64 roundRobinPlayer{0}; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
LootType loot_type{LOOT_NONE}; // required for achievement system
ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
LootType loot_type{LOOT_NONE}; // required for achievement system
// GUIDLow of container that holds this loot (item_instance.entry), set for items that can be looted
uint32 containerId{0};
// GUID of container that holds this loot (item_instance.entry), set for items that can be looted
ObjectGuid containerGUID;
Loot(uint32 _gold = 0) : gold(_gold) { }
~Loot() { clear(); }
@@ -341,7 +343,7 @@ struct Loot
quest_items.clear();
gold = 0;
unlootedCount = 0;
roundRobinPlayer = 0;
roundRobinPlayer.Clear();
i_LootValidatorRefManager.clearReferences();
loot_type = LOOT_NONE;
}
@@ -352,8 +354,8 @@ struct Loot
void NotifyItemRemoved(uint8 lootIndex);
void NotifyQuestItemRemoved(uint8 questIndex);
void NotifyMoneyRemoved();
void AddLooter(uint64 GUID) { PlayersLooting.insert(GUID); }
void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
void AddLooter(ObjectGuid GUID) { PlayersLooting.insert(GUID); }
void RemoveLooter(ObjectGuid GUID) { PlayersLooting.erase(GUID); }
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
bool FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError = false, uint16 lootMode = LOOT_MODE_DEFAULT);
@@ -373,7 +375,7 @@ private:
QuestItemList* FillQuestLoot(Player* player);
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting);
typedef std::set<uint64> PlayersLootingSet;
typedef GuidSet PlayersLootingSet;
PlayersLootingSet PlayersLooting;
QuestItemMap PlayerQuestItems;
QuestItemMap PlayerFFAItems;