Merge pull request #76 from ValeTheVioletMote/ValeTheVioletMote-rolling-fix

Segmentation Fault on Bot Loot Rolling - Fix
This commit is contained in:
Foereaper 2019-06-01 18:20:07 +02:00 committed by GitHub
commit 03e2f85820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 21 deletions

View File

@ -463,7 +463,6 @@ class Group
#ifdef ENABLE_PLAYERBOTS
ObjectGuid GetTargetIcon(int index) { return m_targetIcons[index]; }
Rolls GetRolls() { return RollId; }
#endif
protected:

View File

@ -23,27 +23,20 @@ bool LootRollAction::Execute(Event event)
return false;
RollVote vote = ROLL_PASS;
for (vector<Roll*>::iterator i = group->GetRolls().begin(); i != group->GetRolls().end(); ++i)
{
if ((*i)->isValid() && (*i)->lootedTargetGUID == guid && (*i)->itemSlot == slot)
{
uint32 itemId = (*i)->itemid;
ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(itemId);
if (!proto)
continue;
switch (proto->Class)
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_ARMOR:
if (QueryItemUsage(proto))
vote = ROLL_NEED;
break;
default:
if (IsLootAllowed(itemId))
vote = ROLL_NEED;
break;
}
ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(guid.GetEntry());
if(proto)
{
switch (proto->Class)
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_ARMOR:
if (QueryItemUsage(proto))
vote = ROLL_NEED;
break;
default:
if (IsLootAllowed(guid.GetEntry()))
vote = ROLL_NEED;
break;
}
}