• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Loot_Template maxcount/mincount

Status
Not open for further replies.

Visa

Sexy Member
For TrinityCore 3.3.5, creature_loot_template for example has the following columns:

MinCount
MaxCount

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.
 

Tommy

Founder
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/Trin...cd/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/Trin...26cd/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/Trin...7354326cd/src/server/game/Loot/LootMgr.h#L148
 

Visa

Sexy Member
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
 

Kaev

Super Moderator
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/Trin...7354326cd/src/server/game/Loot/LootMgr.h#L165
 

Visa

Sexy Member
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 :/
 

Visa

Sexy Member
LootMgr.cpp
Code:
        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();
        [COLOR="#00FF00"]uint16 mincount            = fields[7].GetUInt16();[/COLOR]
        [COLOR="#00FF00"]uint16 maxcount            = fields[8].GetUInt16();[/COLOR]

LootMgr.h
Code:
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;
    [COLOR="#00FF00"]uint16   mincount;[/COLOR]                                       // mincount for drop items
    [COLOR="#00FF00"]uint16   maxcount;[/COLOR]                                       // max drop count for the item mincount or Ref multiplicator
    ConditionList conditions;                               // additional loot condition
Code:
    // 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, [COLOR="#00FF00"]uint16 _mincount[/COLOR], [COLOR="#00FF00"]uint16 _maxcount[/COLOR])
        : 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
};
Code:
struct LootItem
{
    uint32  itemid;
    uint32  randomSuffix;
    int32   randomPropertyId;
    ConditionList conditions;                               // additional loot condition
    AllowedLooterSet allowedGUIDs;
    [COLOR="#00FF00"]uint16   count[/COLOR]             : 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;
 

Visa

Sexy Member
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
 
Status
Not open for further replies.
Top