Fixes and cleanups in loot code. Author: VladimirMangos
* Move not-normal loot tables generation in single place (Loot::FillLoot function) for group and non group case.
* Simplify LootView code.
--HG--
branch : trunk
This commit is contained in:
+15
-13
@@ -210,17 +210,19 @@ class LootValidatorRefManager : public RefManager<Loot, LootValidatorRef>
|
||||
};
|
||||
|
||||
//=====================================================
|
||||
struct LootView;
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li);
|
||||
ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv);
|
||||
|
||||
struct Loot
|
||||
{
|
||||
friend ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv);
|
||||
|
||||
QuestItemMap const& GetPlayerQuestItems() const { return PlayerQuestItems; }
|
||||
QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; }
|
||||
QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
|
||||
|
||||
QuestItemList* FillFFALoot(Player* player);
|
||||
QuestItemList* FillQuestLoot(Player* player);
|
||||
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player);
|
||||
|
||||
std::vector<LootItem> items;
|
||||
std::vector<LootItem> quest_items;
|
||||
uint32 gold;
|
||||
@@ -267,13 +269,19 @@ struct Loot
|
||||
void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
|
||||
|
||||
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
|
||||
void FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner);
|
||||
void FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal);
|
||||
|
||||
// Inserts the item into the loot (called by LootTemplate processors)
|
||||
void AddItem(LootStoreItem const & item);
|
||||
|
||||
LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = NULL);
|
||||
|
||||
private:
|
||||
void FillNotNormalLootFor(Player* player);
|
||||
QuestItemList* FillFFALoot(Player* player);
|
||||
QuestItemList* FillQuestLoot(Player* player);
|
||||
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player);
|
||||
|
||||
std::set<uint64> PlayersLooting;
|
||||
QuestItemMap PlayerQuestItems;
|
||||
QuestItemMap PlayerFFAItems;
|
||||
@@ -281,19 +289,15 @@ struct Loot
|
||||
|
||||
// All rolls are registered here. They need to know, when the loot is not valid anymore
|
||||
LootValidatorRefManager i_LootValidatorRefManager;
|
||||
|
||||
};
|
||||
|
||||
struct LootView
|
||||
{
|
||||
Loot &loot;
|
||||
QuestItemList *qlist;
|
||||
QuestItemList *ffalist;
|
||||
QuestItemList *conditionallist;
|
||||
Player *viewer;
|
||||
PermissionTypes permission;
|
||||
LootView(Loot &_loot, QuestItemList *_qlist, QuestItemList *_ffalist, QuestItemList *_conditionallist, Player *_viewer,PermissionTypes _permission = ALL_PERMISSION)
|
||||
: loot(_loot), qlist(_qlist), ffalist(_ffalist), conditionallist(_conditionallist), viewer(_viewer), permission(_permission) {}
|
||||
LootView(Loot &_loot, Player *_viewer,PermissionTypes _permission = ALL_PERMISSION)
|
||||
: loot(_loot), viewer(_viewer), permission(_permission) {}
|
||||
};
|
||||
|
||||
extern LootStore LootTemplates_Creature;
|
||||
@@ -339,6 +343,4 @@ inline void LoadLootTables()
|
||||
LoadLootTemplates_Reference();
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li);
|
||||
ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user