View Full Version : [SOLVED] Loot_Template maxcount/mincount

11-04-2015, 05:00 PM
For TrinityCore 3.3.5, creature_loot_template for example has the following columns:


both in which are using TINYINT (0-255 unsigned)
I want them to use SMALLINT (0-65535 unsigned), but in order to do this I need to do a core edit
like with bypassing the item stat_value limit of 32767 and changing uint8 to uin32, where is this
specific "mincount, maxcount" located?

Purpose of this is to increase the amount of loot dropped by X item, an amount over 255.. for example 1,000.

11-04-2015, 09:25 PM
This is where they are loaded (pretty sure all of the loot tables are loaded here, so you might have to do edits to the other loot tables too): https://github.com/TrinityCore/TrinityCore/blob/db0c48c17fdf61b8816cc229dcfec907354326cd/src/server/game/Loot/LootMgr.cpp#L155-L156

And in LootMgr.cpp under LootStoreItem, you'll find min/max count variables in the struct: https://github.com/TrinityCore/TrinityCore/blob/db0c48c17fdf61b8816cc229dcfec907354326cd/src/server/game/Loot/LootMgr.h#L142-L143

In the same struct via the constructor there is min/max count parameters that are uint8 and you will need to change those too: https://github.com/TrinityCore/TrinityCore/blob/db0c48c17fdf61b8816cc229dcfec907354326cd/src/server/game/Loot/LootMgr.h#L148

11-05-2015, 04:47 AM
It's funny I made all of those edits on my own already by searching for it but it changed nothing I changed most of the uint8 to unit16 but it didn't work anything over 255 loots a random number below 255, ex: Setting 1,000 loot bugs to 16 drop everytime

11-05-2015, 05:49 AM
You could debug the server and look through which functions it will go and mark every place that you still need to edit (if there are some).
It's probably just a uint8 somewhere left, because the i don't believe that the value is random. uint8 goes from 0 to 255, which means if you set it to 256 it will be 0, 257 will be 1 and so on.

If not done yet, try to edit the LootItem struct too, count is also uint8 there: https://github.com/TrinityCore/TrinityCore/blob/db0c48c17fdf61b8816cc229dcfec907354326cd/src/server/game/Loot/LootMgr.h#L165

11-05-2015, 07:49 PM
Ive changed all the multiple things edited in LootMgr.cpp and LootMgr.h above and it still doesn't wanna go over its 255(uint8) cap. I changed all of them to uint16 which should go all the way up to 60K. I don't know where else to look :/

11-05-2015, 09:23 PM
Can you show us your edits? You probably missed something.

11-05-2015, 10:56 PM

uint32 entry = fields[0].GetUInt32();
uint32 item = fields[1].GetUInt32();
uint32 reference = fields[2].GetUInt32();
float chance = fields[3].GetFloat();
bool needsquest = fields[4].GetBool();
uint16 lootmode = fields[5].GetUInt16();
uint8 groupid = fields[6].GetUInt8();
uint16 mincount = fields[7].GetUInt16();
uint16 maxcount = fields[8].GetUInt16();


struct LootStoreItem
uint32 itemid; // id of the item
uint32 reference; // referenced TemplateleId
float chance; // chance to drop for both quest and non-quest items, chance to be used for refs
uint16 lootmode;
bool needs_quest : 1; // quest drop (quest is required for item to drop)
uint8 groupid : 7;
uint16 mincount; // mincount for drop items
uint16 maxcount; // max drop count for the item mincount or Ref multiplicator
ConditionList conditions; // additional loot condition

// Constructor
// displayid is filled in IsValid() which must be called after
LootStoreItem(uint32 _itemid, uint32 _reference, float _chance, bool _needs_quest, uint16 _lootmode, uint8 _groupid, uint16 _mincount, uint16 _maxcount)
: itemid(_itemid), reference(_reference), chance(_chance), lootmode(_lootmode),
needs_quest(_needs_quest), groupid(_groupid), mincount(_mincount), maxcount(_maxcount)
{ }

bool Roll(bool rate) const; // Checks if the entry takes it's chance (at loot generation)
bool IsValid(LootStore const& store, uint32 entry) const;
// Checks correctness of values

struct LootItem
uint32 itemid;
uint32 randomSuffix;
int32 randomPropertyId;
ConditionList conditions; // additional loot condition
AllowedLooterSet allowedGUIDs;
uint16 count : 8;
bool is_looted : 1;
bool is_blocked : 1;
bool freeforall : 1; // free for all
bool is_underthreshold : 1;
bool is_counted : 1;
bool needs_quest : 1; // quest drop
bool follow_loot_rules : 1;
bool canSave;

11-06-2015, 01:21 AM
Are you sure you changed the column type in the database? Might want to double check.

11-06-2015, 02:23 PM
Yes, it would give me an error if I tried to set it above anything 255 anyway, right? It's currently set to SMALLINT and I have a specific loot template of 1000 still not working

11-07-2015, 06:46 AM
Try to change this one too: https://github.com/TrinityCore/TrinityCore/blob/db0c48c17fdf61b8816cc229dcfec907354326cd/src/server/game/Loot/LootMgr.h#L323