mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #462 from liyunfan1223/fix-trade
Handle command and trade check for summoned bot
This commit is contained in:
@@ -655,11 +655,7 @@ void PlayerbotAI::HandleCommand(uint32 type, std::string const text, Player* fro
|
||||
}
|
||||
|
||||
if (!IsAllowedCommand(filtered) &&
|
||||
(master != fromPlayer ||
|
||||
!GetSecurity()->CheckLevelFor(PLAYERBOT_SECURITY_ALLOW_ALL, type != CHAT_MSG_WHISPER, fromPlayer)))
|
||||
return;
|
||||
|
||||
if (!IsAllowedCommand(filtered) && master != fromPlayer)
|
||||
(!GetSecurity()->CheckLevelFor(PLAYERBOT_SECURITY_ALLOW_ALL, type != CHAT_MSG_WHISPER, fromPlayer)))
|
||||
return;
|
||||
|
||||
if (type == CHAT_MSG_RAID_WARNING && filtered.find(bot->GetName()) != std::string::npos &&
|
||||
|
||||
@@ -55,14 +55,16 @@ PlayerbotSecurityLevel PlayerbotSecurity::LevelFor(Player* from, DenyReason* rea
|
||||
// }
|
||||
|
||||
Group* group = from->GetGroup();
|
||||
if (group)
|
||||
if (group && group == bot->GetGroup() && !ignoreGroup && botAI->GetMaster() == from)
|
||||
{
|
||||
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
||||
{
|
||||
Player* player = gref->GetSource();
|
||||
if (player == bot && !ignoreGroup)
|
||||
return PLAYERBOT_SECURITY_ALLOW_ALL;
|
||||
}
|
||||
return PLAYERBOT_SECURITY_ALLOW_ALL;
|
||||
}
|
||||
|
||||
if (group && group == bot->GetGroup() && !ignoreGroup && botAI->GetMaster() != from)
|
||||
{
|
||||
if (reason)
|
||||
*reason = PLAYERBOT_DENY_NOT_YOURS;
|
||||
return PLAYERBOT_SECURITY_TALK;
|
||||
}
|
||||
|
||||
if (sPlayerbotAIConfig->groupInvitationPermission <= 0)
|
||||
@@ -137,13 +139,6 @@ PlayerbotSecurityLevel PlayerbotSecurity::LevelFor(Player* from, DenyReason* rea
|
||||
return PLAYERBOT_SECURITY_INVITE;
|
||||
}
|
||||
|
||||
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
||||
{
|
||||
Player* player = gref->GetSource();
|
||||
if (player == from)
|
||||
return PLAYERBOT_SECURITY_ALLOW_ALL;
|
||||
}
|
||||
|
||||
if (group->IsFull())
|
||||
{
|
||||
if (reason)
|
||||
@@ -169,11 +164,17 @@ PlayerbotSecurityLevel PlayerbotSecurity::LevelFor(Player* from, DenyReason* rea
|
||||
|
||||
if (reason)
|
||||
*reason = PLAYERBOT_DENY_INVITE;
|
||||
|
||||
|
||||
return PLAYERBOT_SECURITY_INVITE;
|
||||
}
|
||||
|
||||
return PLAYERBOT_SECURITY_ALLOW_ALL;
|
||||
if (botAI->GetMaster() == from)
|
||||
return PLAYERBOT_SECURITY_ALLOW_ALL;
|
||||
|
||||
if (reason)
|
||||
*reason = PLAYERBOT_DENY_NOT_YOURS;
|
||||
|
||||
return PLAYERBOT_SECURITY_INVITE;
|
||||
}
|
||||
|
||||
bool PlayerbotSecurity::CheckLevelFor(PlayerbotSecurityLevel level, bool silent, Player* from, bool ignoreGroup)
|
||||
|
||||
@@ -1215,9 +1215,6 @@ void RandomPlayerbotMgr::Revive(Player* player)
|
||||
|
||||
void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>& locs, bool hearth)
|
||||
{
|
||||
if (bot->IsBeingTeleported())
|
||||
return;
|
||||
|
||||
if (bot->InBattleground())
|
||||
return;
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
#include "GuildTaskMgr.h"
|
||||
#include "ItemUsageValue.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "PlayerbotMgr.h"
|
||||
#include "PlayerbotSecurity.h"
|
||||
#include "Playerbots.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
#include "SetCraftAction.h"
|
||||
|
||||
bool TradeStatusAction::Execute(Event event)
|
||||
@@ -180,8 +182,12 @@ bool TradeStatusAction::CheckTrade()
|
||||
}
|
||||
return isGettingItem;
|
||||
}
|
||||
|
||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!bot->GetSession())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint32 accountId = bot->GetSession()->GetAccountId();
|
||||
if (!sPlayerbotAIConfig->IsInRandomAccountList(accountId))
|
||||
{
|
||||
int32 botItemsMoney = CalculateCost(bot, true);
|
||||
int32 botMoney = bot->GetTradeData()->GetMoney() + botItemsMoney;
|
||||
|
||||
Reference in New Issue
Block a user