mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Loot roll config
This commit is contained in:
@@ -162,6 +162,10 @@ AiPlayerbot.AddClassCommand = 1
|
|||||||
# Default: 0 (disabled)
|
# Default: 0 (disabled)
|
||||||
AiPlayerbot.FreeMethodLoot = 0
|
AiPlayerbot.FreeMethodLoot = 0
|
||||||
|
|
||||||
|
# Bots loot roll level (0 = pass, 1 = greed, 2 = need)
|
||||||
|
# Default: 1 (greed)
|
||||||
|
AiPlayerbot.LootRollLevel = 1
|
||||||
|
|
||||||
# Bots pick their quest reward (yes = picks first useful item, no = list all rewards, ask = pick useful item and lists if multiple)
|
# Bots pick their quest reward (yes = picks first useful item, no = list all rewards, ask = pick useful item and lists if multiple)
|
||||||
AiPlayerbot.AutoPickReward = no
|
AiPlayerbot.AutoPickReward = no
|
||||||
|
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
|
|
||||||
// SPP automation
|
// SPP automation
|
||||||
freeMethodLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeMethodLoot", false);
|
freeMethodLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeMethodLoot", false);
|
||||||
|
lootRollLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.LootRollLevel", 1);
|
||||||
autoPickReward = sConfigMgr->GetOption<std::string>("AiPlayerbot.AutoPickReward", "yes");
|
autoPickReward = sConfigMgr->GetOption<std::string>("AiPlayerbot.AutoPickReward", "yes");
|
||||||
autoEquipUpgradeLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoEquipUpgradeLoot", true);
|
autoEquipUpgradeLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoEquipUpgradeLoot", true);
|
||||||
equipUpgradeThreshold = sConfigMgr->GetOption<float>("AiPlayerbot.EquipUpgradeThreshold", 1.1f);
|
equipUpgradeThreshold = sConfigMgr->GetOption<float>("AiPlayerbot.EquipUpgradeThreshold", 1.1f);
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ class PlayerbotAIConfig
|
|||||||
uint32 botActiveAlone;
|
uint32 botActiveAlone;
|
||||||
|
|
||||||
bool freeMethodLoot;
|
bool freeMethodLoot;
|
||||||
|
int32 lootRollLevel;
|
||||||
std::string autoPickReward;
|
std::string autoPickReward;
|
||||||
bool autoEquipUpgradeLoot;
|
bool autoEquipUpgradeLoot;
|
||||||
float equipUpgradeThreshold;
|
float equipUpgradeThreshold;
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include "LootRollAction.h"
|
#include "LootRollAction.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
#include "Group.h"
|
||||||
#include "ItemUsageValue.h"
|
#include "ItemUsageValue.h"
|
||||||
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "LootAction.h"
|
#include "LootAction.h"
|
||||||
|
|
||||||
@@ -16,16 +18,62 @@ bool LootRollAction::Execute(Event event)
|
|||||||
if (!group)
|
if (!group)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WorldPacket p(event.getPacket()); //WorldPacket packet for CMSG_LOOT_ROLL, (8+4+1)
|
std::vector<Roll*> rolls = group->GetRolls();
|
||||||
ObjectGuid guid;
|
for (Roll* &roll : rolls) {
|
||||||
uint32 slot;
|
if (roll->playerVote.find(bot->GetGUID())->second != NOT_EMITED_YET) {
|
||||||
uint8 rollType;
|
continue;
|
||||||
p.rpos(0); //reset packet pointer
|
}
|
||||||
p >> guid; //guid of the item rolled
|
ObjectGuid guid = roll->itemGUID;
|
||||||
p >> slot; //number of players invited to roll
|
uint32 slot = roll->itemSlot;
|
||||||
p >> rollType; //need,greed or pass on roll
|
uint32 itemId = roll->itemid;
|
||||||
|
|
||||||
RollVote vote = PASS;
|
RollVote vote = PASS;
|
||||||
|
ItemTemplate const *proto = sObjectMgr->GetItemTemplate(itemId);
|
||||||
|
if (!proto)
|
||||||
|
continue;
|
||||||
|
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemId);
|
||||||
|
switch (proto->Class)
|
||||||
|
{
|
||||||
|
case ITEM_CLASS_WEAPON:
|
||||||
|
case ITEM_CLASS_ARMOR:
|
||||||
|
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE) {
|
||||||
|
vote = NEED;
|
||||||
|
}
|
||||||
|
else if (usage != ITEM_USAGE_NONE) {
|
||||||
|
vote = GREED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (StoreLootAction::IsLootAllowed(itemId, botAI))
|
||||||
|
vote = NEED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (sPlayerbotAIConfig->lootRollLevel == 0) {
|
||||||
|
vote = PASS;
|
||||||
|
} else if (sPlayerbotAIConfig->lootRollLevel == 1) {
|
||||||
|
if (vote == NEED) {
|
||||||
|
vote = GREED;
|
||||||
|
} else if (vote == GREED) {
|
||||||
|
vote = PASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (group->GetLootMethod())
|
||||||
|
{
|
||||||
|
case MASTER_LOOT:
|
||||||
|
case FREE_FOR_ALL:
|
||||||
|
group->CountRollVote(bot->GetGUID(), guid, PASS);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
group->CountRollVote(bot->GetGUID(), guid, vote);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// WorldPacket p(event.getPacket()); //WorldPacket packet for CMSG_LOOT_ROLL, (8+4+1)
|
||||||
|
// p.rpos(0); //reset packet pointer
|
||||||
|
// p >> guid; //guid of the item rolled
|
||||||
|
// p >> slot; //number of players invited to roll
|
||||||
|
// p >> rollType; //need,greed or pass on roll
|
||||||
|
|
||||||
|
|
||||||
// std::vector<Roll*> rolls = group->GetRolls();
|
// std::vector<Roll*> rolls = group->GetRolls();
|
||||||
// bot->Say("guid:" + std::to_string(guid.GetCounter()) +
|
// bot->Say("guid:" + std::to_string(guid.GetCounter()) +
|
||||||
@@ -74,17 +122,6 @@ bool LootRollAction::Execute(Event event)
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
switch (group->GetLootMethod())
|
|
||||||
{
|
|
||||||
case MASTER_LOOT:
|
|
||||||
case FREE_FOR_ALL:
|
|
||||||
group->CountRollVote(bot->GetGUID(), guid, PASS);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
group->CountRollVote(bot->GetGUID(), guid, vote);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user