mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Chat tweak, guild bots management tooggle
This commit is contained in:
@@ -128,6 +128,15 @@ AiPlayerbot.AllowPlayerBots = 0
|
|||||||
# Allow/deny bots from your guild
|
# Allow/deny bots from your guild
|
||||||
AiPlayerbot.AllowGuildBots = 1
|
AiPlayerbot.AllowGuildBots = 1
|
||||||
|
|
||||||
|
# Randombots will invite nearby bots to guilds
|
||||||
|
AiPlayerbot.RandomBotGuildNearby = 0
|
||||||
|
|
||||||
|
# Randombots will invite players to groups/raids/guilds.
|
||||||
|
AiPlayerbot.RandomBotInvitePlayer = 0
|
||||||
|
|
||||||
|
# Bots will chat in say/guild when they invite other bots to groups/raids/guilds
|
||||||
|
AiPlayerbot.InviteChat = 0
|
||||||
|
|
||||||
# Bots will be summoned to player when accept group invitation
|
# Bots will be summoned to player when accept group invitation
|
||||||
AiPlayerbot.SummonWhenGroup = 1
|
AiPlayerbot.SummonWhenGroup = 1
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
|
|||||||
|
|
||||||
if (!player->InBattleground())
|
if (!player->InBattleground())
|
||||||
{
|
{
|
||||||
engine->addStrategies("racials", "chat", "default", "cast time", "duel", "boost", "emote", nullptr);
|
engine->addStrategies("racials", "chat", "default", "cast time", "duel", "boost", nullptr);
|
||||||
}
|
}
|
||||||
if (sPlayerbotAIConfig->autoSaveMana)
|
if (sPlayerbotAIConfig->autoSaveMana)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
iterationsPerTick = sConfigMgr->GetOption<int32>("AiPlayerbot.IterationsPerTick", 100);
|
iterationsPerTick = sConfigMgr->GetOption<int32>("AiPlayerbot.IterationsPerTick", 100);
|
||||||
|
|
||||||
allowGuildBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowGuildBots", true);
|
allowGuildBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowGuildBots", true);
|
||||||
|
randomBotGuildNearby = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotGuildNearby", false);
|
||||||
|
randomBotInvitePlayer = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotInvitePlayer", false);
|
||||||
|
inviteChat = sConfigMgr->GetOption<bool>("AiPlayerbot.InviteChat", false);
|
||||||
allowPlayerBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowPlayerBots", false);
|
allowPlayerBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowPlayerBots", false);
|
||||||
|
|
||||||
randomBotMapsAsString = sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotMaps", "0,1,530,571");
|
randomBotMapsAsString = sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotMaps", "0,1,530,571");
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class PlayerbotAIConfig
|
|||||||
|
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool allowGuildBots, allowPlayerBots;
|
bool allowGuildBots, allowPlayerBots;
|
||||||
|
bool randomBotGuildNearby, randomBotInvitePlayer, inviteChat;
|
||||||
uint32 globalCoolDown, reactDelay, maxWaitForMove, disableMoveSplinePath, maxMovementSearchTime,
|
uint32 globalCoolDown, reactDelay, maxWaitForMove, disableMoveSplinePath, maxMovementSearchTime,
|
||||||
expireActionTime, dispelAuraDuration, passiveDelay, repeatDelay,
|
expireActionTime, dispelAuraDuration, passiveDelay, repeatDelay,
|
||||||
errorDelay, rpgDelay, sitDelay, returnDelay, lootDelay;
|
errorDelay, rpgDelay, sitDelay, returnDelay, lootDelay;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ bool CleanQuestLogAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
||||||
std::string link = event.getParam();
|
std::string link = event.getParam();
|
||||||
if (botAI->HasActivePlayerMaster())
|
if (botAI->HasActivePlayerMaster() || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint8 totalQuests = 0;
|
uint8 totalQuests = 0;
|
||||||
|
|||||||
@@ -159,65 +159,142 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
if (!player || bot == player)
|
if (!player || bot == player)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player->GetGuildId()) //Promote or demote nearby members based on chance.
|
if (player->isDND())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId()) //Promote or demote nearby members based on chance.
|
||||||
{
|
{
|
||||||
Guild::Member* member = guild->GetMember(player->GetGUID());
|
Guild::Member* member = guild->GetMember(player->GetGUID());
|
||||||
uint32 dCount = AI_VALUE(uint32, "death count");
|
uint32 dCount = AI_VALUE(uint32, "death count");
|
||||||
|
|
||||||
if ((dCount < 2 || !urand(0, 10)) && guild->GetRankRights(botMember->GetRankId() & GR_RIGHT_PROMOTE))
|
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
||||||
{
|
|
||||||
if (!urand(0, 10))
|
|
||||||
{
|
{
|
||||||
BroadcastHelper::BroadcastGuildMemberPromotion(botAI, bot, player);
|
BroadcastHelper::BroadcastGuildMemberPromotion(botAI, bot, player);
|
||||||
|
|
||||||
botAI->DoSpecificAction("guild promote", Event("guild management", guid), true);
|
botAI->DoSpecificAction("guild promote", Event("guild management", guid), true);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((dCount > 3 || !urand(0, 10)) && guild->GetRankRights(botMember->GetRankId() & GR_RIGHT_DEMOTE))
|
if (!urand(0, 30) && dCount > 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_DEMOTE)
|
||||||
{
|
|
||||||
if (!urand(0, 10))
|
|
||||||
{
|
{
|
||||||
|
BroadcastHelper::BroadcastGuildMemberDemotion(botAI, bot, player);
|
||||||
|
|
||||||
botAI->DoSpecificAction("guild demote", Event("guild management", guid), true);
|
botAI->DoSpecificAction("guild demote", Event("guild management", guid), true);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE))
|
if (!sPlayerbotAIConfig->randomBotGuildNearby)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (guild->GetMemberSize() > 1000)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( (guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player->GetGuildIdInvited())
|
if (player->GetGuildIdInvited())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(player);
|
PlayerbotAI* botAi = GET_PLAYERBOT_AI(player);
|
||||||
|
|
||||||
if (botAI)
|
if (!sPlayerbotAIConfig->randomBotInvitePlayer && botAi && botAi->IsRealPlayer())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (botAi)
|
||||||
{
|
{
|
||||||
|
if (botAi->GetGuilderType() == GuilderType::SOLO && !botAi->HasRealPlayerMaster()) //Do not invite solo players.
|
||||||
if (botAI->GetGuilderType() == GuilderType::SOLO && !botAI->HasRealPlayerMaster()) //Do not invite solo players.
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (botAi->HasActivePlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(player)) //Do not invite alts of active players.
|
||||||
if (botAI->HasActivePlayerMaster()) //Do not invite alts of active players.
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool sameGroup = bot->GetGroup() && bot->GetGroup()->IsMember(player->GetGUID());
|
||||||
|
|
||||||
|
if (!sameGroup && sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->spellDistance)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (sPlayerbotAIConfig->inviteChat && (sRandomPlayerbotMgr->IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
||||||
|
{
|
||||||
|
std::map<std::string, std::string> placeholders;
|
||||||
|
placeholders["%name"] = player->GetName();
|
||||||
|
placeholders["%members"] = std::to_string(guild->GetMemberSize());
|
||||||
|
placeholders["%guildname"] = guild->GetName();
|
||||||
|
AreaTableEntry const* current_area = botAI->GetCurrentArea();
|
||||||
|
AreaTableEntry const* current_zone = botAI->GetCurrentZone();
|
||||||
|
placeholders["%area_name"] = current_area ? current_area->area_name[BroadcastHelper::GetLocale()] : BOT_TEXT1("string_unknown_area");
|
||||||
|
placeholders["%zone_name"] = current_zone ? current_zone->area_name[BroadcastHelper::GetLocale()] : BOT_TEXT1("string_unknown_area");
|
||||||
|
|
||||||
|
std::vector<std::string> lines;
|
||||||
|
|
||||||
|
//TODO - Move these hardcoded texts to sql!
|
||||||
|
switch ((urand(0, 10) * urand(0, 10)) / 10)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
lines.push_back(BOT_TEXT2("Hey %name do you want to join my guild?", placeholders));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
lines.push_back(BOT_TEXT2("Hey man you wanna join my guild %name?", placeholders));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
lines.push_back(BOT_TEXT2("I think you would be a good contribution to %guildname. Would you like to join %name?", placeholders));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
lines.push_back(BOT_TEXT2("My guild %guildname has %members quality members. Would you like to make it 1 more %name?", placeholders));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
lines.push_back(BOT_TEXT2("Hey %name do you want to join %guildname? We have %members members and looking to become number 1 of the server.", placeholders));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
lines.push_back(BOT_TEXT2("I'm not really good at smalltalk. Do you wanna join my guild %name/r?", placeholders));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
lines.push_back(BOT_TEXT2("Welcome to %zone_name.... do you want to join my guild %name?", placeholders));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
lines.push_back(BOT_TEXT2("%name, you should join my guild!", placeholders));
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
lines.push_back(BOT_TEXT2("%name, I got this guild....", placeholders));
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
lines.push_back(BOT_TEXT2("You are actually going to join my guild %name?", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("Haha.. you are the man! We are going to raid Molten...", placeholders));
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
lines.push_back(BOT_TEXT2("Hey Hey! do you guys wanna join my gild????", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("We've got a bunch of high levels and we are really super friendly..", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("..and watch your dog and do your homework...", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("..and we raid once a week and are working on MC raids...", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("..and we have more members than just me...", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("..and please stop I'm lonenly and we can get a ride the whole time...", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("..and it's really beautifull and I feel like crying...", placeholders));
|
||||||
|
lines.push_back(BOT_TEXT2("So what do you guys say are you going to join are you going to join?", placeholders));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto line : lines)
|
||||||
|
if (sameGroup)
|
||||||
|
{
|
||||||
|
WorldPacket data;
|
||||||
|
ChatHandler::BuildChatPacket(data, bot->GetGroup()->isRaidGroup() ? CHAT_MSG_RAID : CHAT_MSG_PARTY, line.c_str(), LANG_UNIVERSAL, CHAT_TAG_NONE, bot->GetGUID(), bot->GetName());
|
||||||
|
bot->GetGroup()->BroadcastPacket(&data, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
bot->Say(line, (bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
||||||
if (!sPlayerbotAIConfig->randomBotGroupNearby)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
|
if (botAI->DoSpecificAction("guild invite", Event("guild management", guid), true))
|
||||||
continue;
|
{
|
||||||
|
if (sPlayerbotAIConfig->inviteChat)
|
||||||
if (botAI && botAI->DoSpecificAction("ginvite", Event("guild management", guid)))
|
return true;
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return found > 0;
|
return found > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ SuggestWhatToDoAction::SuggestWhatToDoAction(PlayerbotAI* botAI, std::string con
|
|||||||
|
|
||||||
bool SuggestWhatToDoAction::isUseful()
|
bool SuggestWhatToDoAction::isUseful()
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot) || bot->GetGroup() || bot->GetInstanceId())
|
if (!sRandomPlayerbotMgr->IsRandomBot(bot) || bot->GetGroup() || bot->GetInstanceId() || bot->GetBattleground())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string qualifier = "suggest what to do";
|
std::string qualifier = "suggest what to do";
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class SuggestTradeAction : public SuggestWhatToDoAction
|
|||||||
SuggestTradeAction(PlayerbotAI* botAI);
|
SuggestTradeAction(PlayerbotAI* botAI);
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override { return true; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SuggestDungeonAction : public SuggestWhatToDoAction
|
class SuggestDungeonAction : public SuggestWhatToDoAction
|
||||||
@@ -50,7 +49,6 @@ class SuggestDungeonAction : public SuggestWhatToDoAction
|
|||||||
SuggestDungeonAction(PlayerbotAI* botAI);
|
SuggestDungeonAction(PlayerbotAI* botAI);
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override { return true; }
|
|
||||||
private:
|
private:
|
||||||
static std::map<std::string, uint8> instances;
|
static std::map<std::string, uint8> instances;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user