mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Add additional trading options (#1186)
* Add addclass bots to trading list, differentiate between buying and selling. * typos * Try calling playerguid * point IsAddclassBot to IsRandomBot * typo * Fix through IsAddClassbot * Working Version * Minor typos.
This commit is contained in:
@@ -544,7 +544,8 @@ AiPlayerbot.DisableDeathKnightLogin = 0
|
||||
# Default: 0
|
||||
AiPlayerbot.LimitTalentsExpansion = 0
|
||||
|
||||
# Allow random bots to trade
|
||||
# Configure random bots and addClass bot trading (0: Disabled, 1: Enabled, 2: Only buy, 3: Only Sell)
|
||||
# Default: 1 (Enabled)
|
||||
AiPlayerbot.EnableRandomBotTrading = 1
|
||||
#
|
||||
#
|
||||
|
||||
@@ -506,7 +506,7 @@ bool PlayerbotAIConfig::Initialize()
|
||||
limitGearExpansion = sConfigMgr->GetOption<int32>("AiPlayerbot.LimitGearExpansion", 1);
|
||||
randombotStartingLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.RandombotStartingLevel", 5);
|
||||
enablePeriodicOnlineOffline = sConfigMgr->GetOption<bool>("AiPlayerbot.EnablePeriodicOnlineOffline", false);
|
||||
enableRandomBotTrading = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableRandomBotTrading", true);
|
||||
enableRandomBotTrading = sConfigMgr->GetOption<int32>("AiPlayerbot.EnableRandomBotTrading", 1);
|
||||
periodicOnlineOfflineRatio = sConfigMgr->GetOption<float>("AiPlayerbot.PeriodicOnlineOfflineRatio", 2.0);
|
||||
gearscorecheck = sConfigMgr->GetOption<bool>("AiPlayerbot.GearScoreCheck", false);
|
||||
randomBotPreQuests = sConfigMgr->GetOption<bool>("AiPlayerbot.PreQuests", true);
|
||||
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
bool autoLearnQuestSpells;
|
||||
bool autoTeleportForLevel;
|
||||
bool randomBotGroupNearby;
|
||||
bool enableRandomBotTrading;
|
||||
int32 enableRandomBotTrading;
|
||||
uint32 tweakValue; // Debugging config
|
||||
|
||||
uint32 randomBotArenaTeamCount;
|
||||
|
||||
@@ -2204,6 +2204,19 @@ bool RandomPlayerbotMgr::IsRandomBot(ObjectGuid::LowType bot)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool RandomPlayerbotMgr::IsAddclassBot(Player* bot)
|
||||
{
|
||||
if (bot && GET_PLAYERBOT_AI(bot))
|
||||
{
|
||||
if (GET_PLAYERBOT_AI(bot)->IsRealPlayer())
|
||||
return false;
|
||||
}
|
||||
if (bot)
|
||||
{
|
||||
return IsAddclassBot(bot->GetGUID().GetCounter());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RandomPlayerbotMgr::IsAddclassBot(ObjectGuid::LowType bot)
|
||||
{
|
||||
|
||||
@@ -112,6 +112,7 @@ public:
|
||||
static bool HandlePlayerbotConsoleCommand(ChatHandler* handler, char const* args);
|
||||
bool IsRandomBot(Player* bot);
|
||||
bool IsRandomBot(ObjectGuid::LowType bot);
|
||||
bool IsAddclassBot(Player* bot);
|
||||
bool IsAddclassBot(ObjectGuid::LowType bot);
|
||||
void Randomize(Player* bot);
|
||||
void Clear(Player* bot);
|
||||
|
||||
@@ -32,7 +32,7 @@ bool TradeStatusAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sPlayerbotAIConfig->enableRandomBotTrading && sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (sPlayerbotAIConfig->enableRandomBotTrading == 0 && (sRandomPlayerbotMgr->IsRandomBot(bot)|| sRandomPlayerbotMgr->IsAddclassBot(bot)))
|
||||
{
|
||||
bot->Whisper("Trading is disabled", LANG_UNIVERSAL, trader);
|
||||
return false;
|
||||
@@ -171,7 +171,6 @@ bool TradeStatusAction::CheckTrade()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool isGettingItem = false;
|
||||
for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot)
|
||||
{
|
||||
@@ -215,7 +214,16 @@ bool TradeStatusAction::CheckTrade()
|
||||
int32 botMoney = bot->GetTradeData()->GetMoney() + botItemsMoney;
|
||||
int32 playerItemsMoney = CalculateCost(trader, false);
|
||||
int32 playerMoney = trader->GetTradeData()->GetMoney() + playerItemsMoney;
|
||||
|
||||
if (botItemsMoney > 0 && sPlayerbotAIConfig->enableRandomBotTrading == 2 && (sRandomPlayerbotMgr->IsRandomBot(bot)|| sRandomPlayerbotMgr->IsAddclassBot(bot)))
|
||||
{
|
||||
bot->Whisper("Selling is disabled.", LANG_UNIVERSAL, trader);
|
||||
return false;
|
||||
}
|
||||
if (playerItemsMoney && sPlayerbotAIConfig->enableRandomBotTrading == 3 && (sRandomPlayerbotMgr->IsRandomBot(bot)|| sRandomPlayerbotMgr->IsAddclassBot(bot)))
|
||||
{
|
||||
bot->Whisper("Buying is disabled.", LANG_UNIVERSAL, trader);
|
||||
return false;
|
||||
}
|
||||
for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot)
|
||||
{
|
||||
Item* item = bot->GetTradeData()->GetItem((TradeSlots)slot);
|
||||
|
||||
Reference in New Issue
Block a user