root/trunk/src/arcemu-world/LootMgr.h @ 3153

Revision 3153, 4.5 kB (checked in by Hoffa, 7 months ago)

Applied 3.3.2 misc fixes by Terrorblade -> http://arcemu.org/forums/index.php?showtopic=20707

  • Property svn:eol-style set to native
  • Property ff set to
    *.cpp = svn:eol-style=native
    Makefile = svn:eol-style=native
    README = svn:eol-style=native
    CHANGELOG = svn:eol-style=native
    LICENSE = svn:eol-style=native
  • Property svn:keywords set to Date Author Rev
Line 
1/*
2 * ArcEmu MMORPG Server
3 * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/>
4 * Copyright (C) 2008-2010 <http://www.ArcEmu.org/>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef _LOOTMGR_H
22#define _LOOTMGR_H
23
24
25enum LOOTTYPE{
26        LOOT_NORMAL10,          // normal dungeon / old raid  (10/25/40 men) / normal 10 raid
27        LOOT_NORMAL25,          // heroic dungeon / normal 25 raid
28        LOOT_HEROIC10,          // heroic 10 men raid
29        LOOT_HEROIC25,          // heroic 25 men raid
30        NUM_LOOT_TYPES
31};
32
33struct ItemPrototype;
34class MapMgr;
35class LootRoll : public EventableObject
36{
37public:
38        LootRoll(uint32 timer, uint32 groupcount, uint64 guid, uint32 slotid, uint32 itemid, uint32 itemunk1, uint32 itemunk2, MapMgr * mgr);
39        ~LootRoll();
40        void PlayerRolled(Player *player, uint8 choice);
41        void Finalize();
42
43        int32 event_GetInstanceID();
44
45private:
46        std::map<uint32, uint32> m_NeedRolls;
47        std::map<uint32, uint32> m_GreedRolls;
48        set<uint32> m_passRolls;
49        uint32 _groupcount;
50        uint32 _slotid;
51        uint32 _itemid;
52        uint32 _randomsuffixid;
53        uint32 _randompropertyid;
54        uint32 _remaining;
55        uint64 _guid;
56        MapMgr * _mgr;
57};
58
59typedef vector<pair<RandomProps*, float> > RandomPropertyVector;
60typedef vector<pair<ItemRandomSuffixEntry*, float> > RandomSuffixVector;
61
62typedef struct
63{
64        ItemPrototype * itemproto;
65        uint32 displayid;
66}_LootItem;
67
68typedef std::set<uint32> LooterSet;
69
70typedef struct
71{
72        _LootItem item;
73        uint32 iItemsCount;
74        RandomProps * iRandomProperty;
75        ItemRandomSuffixEntry * iRandomSuffix;
76        LootRoll *roll;
77        bool passed;
78        LooterSet has_looted;
79        uint32 ffa_loot;
80}__LootItem;
81
82
83typedef struct
84{
85        _LootItem item;         // the item that drops
86        float chance;           // normal dungeon / normal 10men raid / old raid (10,25, or 40 men )
87        float chance2;          // heroic dungeon / normal 25men raid
88        float chance3;          // heroic 10men raid
89        float chance4;          // heroic 25men raid
90        uint32 mincount;        // minimum quantity to drop
91        uint32 maxcount;        // maximum quantity to drop
92        uint32 ffa_loot;        // can everyone from the group loot the item?
93}StoreLootItem;
94
95
96typedef struct 
97{
98        uint32 count;
99        StoreLootItem*items;
100}StoreLootList;
101
102typedef struct
103{
104        std::vector<__LootItem> items;
105        uint32 gold;
106        LooterSet looters;
107}Loot;
108
109struct tempy
110{
111        uint32 itemid;
112        float chance;
113        float chance_2;
114        float chance3;
115        float chance4;
116        uint32 mincount;
117        uint32 maxcount;
118        uint32 ffa_loot;
119};
120
121
122//////////////////////////////////////////////////////////////////////////////////////////
123
124
125typedef HM_NAMESPACE::hash_map<uint32, StoreLootList > LootStore; 
126
127#define PARTY_LOOT_FFA    0
128#define PARTY_LOOT_MASTER   2
129#define PARTY_LOOT_RR      1
130#define PARTY_LOOT_NBG    4
131#define PARTY_LOOT_GROUP        3
132
133
134
135class SERVER_DECL LootMgr : public Singleton < LootMgr >
136{
137public:
138        LootMgr();
139        ~LootMgr();
140
141        void AddLoot(Loot * loot, uint32 itemid, uint32 mincount, uint32 maxcount, uint32 ffa_loot);
142
143        void FillCreatureLoot(Loot * loot,uint32 loot_id, uint32 type );
144        void FillGOLoot(Loot * loot,uint32 loot_id, uint32 type );
145        void FillItemLoot(Loot *loot, uint32 loot_id);
146        void FillFishingLoot(Loot * loot,uint32 loot_id);
147        void FillSkinningLoot(Loot * loot,uint32 loot_id);
148        void FillPickpocketingLoot(Loot *loot, uint32 loot_id);
149
150        bool CanGODrop(uint32 LootId,uint32 itemid);
151        bool IsPickpocketable(uint32 creatureId);
152        bool IsSkinnable(uint32 creatureId);
153        bool IsFishable(uint32 zoneid);
154
155        void LoadLoot();
156        void LoadLootProp();
157       
158        LootStore       CreatureLoot;
159        LootStore       FishingLoot;
160        LootStore       SkinningLoot;
161        LootStore       GOLoot;
162        LootStore       ItemLoot;
163        LootStore       PickpocketingLoot;
164        std::map<uint32, std::set<uint32> > quest_loot_go;
165
166        RandomProps * GetRandomProperties(ItemPrototype * proto);
167        ItemRandomSuffixEntry * GetRandomSuffix(ItemPrototype * proto);
168
169        bool is_loading;
170
171private:
172        void LoadLootTables(const char * szTableName,LootStore * LootTable);
173        void PushLoot(StoreLootList *list,Loot * loot, uint32 type );
174       
175        map<uint32, RandomPropertyVector> _randomprops;
176        map<uint32, RandomSuffixVector> _randomsuffix;
177};
178
179#define lootmgr LootMgr::getSingleton()
180
181#endif
Note: See TracBrowser for help on using the browser.