Skip to content
Permalink
Browse files

Merge pull request #76 from ValeTheVioletMote/ValeTheVioletMote-rolli…

…ng-fix

Segmentation Fault on Bot Loot Rolling - Fix
  • Loading branch information...
Foereaper committed Jun 1, 2019
2 parents a521df1 + f6fc8b6 commit 03e2f858201a96ee0d78b979679bd586b1bade86
Showing with 12 additions and 20 deletions.
  1. +0 −1 src/game/WorldHandlers/Group.h
  2. +12 −19 src/modules/Bots/playerbot/strategy/actions/LootRollAction.cpp
@@ -463,7 +463,6 @@ class Group

#ifdef ENABLE_PLAYERBOTS
ObjectGuid GetTargetIcon(int index) { return m_targetIcons[index]; }
Rolls GetRolls() { return RollId; }
#endif

protected:
@@ -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)

ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(guid.GetEntry());
if(proto)
{
if ((*i)->isValid() && (*i)->lootedTargetGUID == guid && (*i)->itemSlot == slot)
switch (proto->Class)
{
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;
}
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_ARMOR:
if (QueryItemUsage(proto))
vote = ROLL_NEED;
break;
default:
if (IsLootAllowed(guid.GetEntry()))
vote = ROLL_NEED;
break;
}
}

0 comments on commit 03e2f85

Please sign in to comment.
You can’t perform that action at this time.