Tweak automation

This commit is contained in:
郑佩茹
2022-09-22 17:22:19 -06:00
parent 1e490e80e4
commit 88d81c7a31
4 changed files with 31 additions and 3 deletions

View File

@@ -309,6 +309,10 @@ bool DisEnchantRandomItemAction::Execute(Event event)
for (auto& item: items)
{
// don't touch rare+ items if with real player/guild
if ((botAI->HasRealPlayerMaster() || botAI->IsInRealGuild()) && item->GetTemplate()->Quality > ITEM_QUALITY_UNCOMMON)
return false;
if(CastCustomSpellAction::Execute(Event("disenchant random item", "13262 "+ chat->FormatQItem(item->GetEntry()))))
return true;
}

View File

@@ -47,6 +47,27 @@ bool SmartDestroyItemAction::Execute(Event event)
if (bagSpace < 90)
return false;
// only destoy grey items if with real player/guild
if (botAI->HasRealPlayerMaster() && botAI->IsInRealGuild())
{
std::set<Item*> items;
FindItemsToTradeByQualityVisitor visitor(ITEM_QUALITY_POOR, 5);
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
items.insert(visitor.GetResult().begin(), visitor.GetResult().end());
for (auto& item : items)
{
FindItemByIdVisitor visitor(item->GetTemplate()->ItemId);
DestroyItem(&visitor);
bagSpace = AI_VALUE(uint8, "bag space");
if (bagSpace < 90)
return true;
}
return true;
}
std::vector<uint32> bestToDestroy = { ITEM_USAGE_NONE }; //First destroy anything useless.
if (!AI_VALUE(bool, "can sell") && AI_VALUE(bool, "should get money")) // We need money so quest items are less important since they can't directly be sold.

View File

@@ -163,7 +163,7 @@ bool GuildManageNearbyAction::Execute(Event event)
Guild::Member* member = guild->GetMember(player->GetGUID());
uint32 dCount = AI_VALUE(uint32, "death count");
if (dCount < 2 || !urand(0, 10))
if ((dCount < 2 || !urand(0, 10)) && guild->GetRankRights(botMember->GetRankId() & GR_RIGHT_PROMOTE))
{
if (!urand(0, 10))
{
@@ -173,7 +173,7 @@ bool GuildManageNearbyAction::Execute(Event event)
}
}
if (dCount > 3 || !urand(0, 10))
if ((dCount > 3 || !urand(0, 10)) && guild->GetRankRights(botMember->GetRankId() & GR_RIGHT_DEMOTE))
{
if (!urand(0, 10))
{

View File

@@ -27,6 +27,9 @@ bool LeaveLargeGuildTrigger::IsActive()
if (botAI->IsAlt())
return false;
if (botAI->IsInRealGuild())
return false;
GuilderType type = botAI->GetGuilderType();
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
@@ -34,7 +37,7 @@ bool LeaveLargeGuildTrigger::IsActive()
Player* leader = ObjectAccessor::FindPlayer(guild->GetLeaderGUID());
//Only leave the guild if we know the leader is not a real player.
if (!leader)
if (!leader || !GET_PLAYERBOT_AI(leader) || !GET_PLAYERBOT_AI(leader)->IsRealPlayer())
return false;
PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(leader);