Merge pull request #377 from atidot3/master

Fix LFG random classic dungeon limitation level issue
This commit is contained in:
Yunfan Li
2024-07-25 22:10:50 +08:00
committed by GitHub
2 changed files with 101 additions and 197 deletions

View File

@@ -24,7 +24,7 @@ INSERT INTO `ai_playerbot_texts` (`id`, `name`, `text`, `say_type`, `reply_type`
(4, 'suggest_instance', 'LFD: %instance.', 0, 0, '', 'Cherche à faire : %instance', '', '', '', '', '', ''),
(5, 'suggest_instance', 'Anyone needs %role for %instance?',0, 0, '', 'Quelqu\'un a besoin de %role pour %instance ?', '', '', '', '', '', ''),
(6, 'suggest_instance', 'Missing %role for %instance?', 0, 0, '', '%role manquant pour %instance ?', '', '', '', '', '', ''),
(7, 'suggest_instance', 'Can be a %role for %instance.', 0, 0, '', 'Peut être un %role pour %instance', '', '', '', '', '', ''),
(7, 'suggest_instance', 'Can be a %role for %instance.', 0, 0, '', '%role disponible pour %instance', '', '', '', '', '', ''),
(8, 'suggest_instance', 'Need help with %instance?', 0, 0, '', 'Besoin d\'aide avec %instance ?', '', '', '', '', '', ''),
(9, 'suggest_instance', 'Need %role help with %instance?', 0, 0, '', 'Besoin d\'aide %role avec %instance ?', '', '', '', '', '', ''),
(10, 'suggest_instance', 'Anyone needs gear from %instance?',0, 0, '', 'Quelqu\'un a besoin d\'équipement de %instance ?', '', '', '', '', '', ''),
@@ -47,7 +47,7 @@ INSERT INTO `ai_playerbot_texts` (`id`, `name`, `text`, `say_type`, `reply_type`
(27, 'suggest_instance', 'Is there any point being %role in %instance?', 0, 0, '', 'Y a-t-il un intérêt à être %role dans %instance ?', '', '', '', '', '', ''),
(28, 'suggest_instance', 'It is really worth to go to %instance?', 0, 0, '', 'Cela vaut-il vraiment la peine d\'aller dans %instance ?', '', '', '', '', '', ''),
(29, 'suggest_instance', 'Anybody needs more people for %instance?', 0, 0, '', 'Quelqu\'un a besoin de plus de personnes pour %instance ?', '', '', '', '', '', ''),
(30, 'suggest_instance', '%instance bosses drop good gear. Wanna run?', 0, 0, '', 'Les boss %instance drop du bon équipement. Tu veux courir ?', '', '', '', '', '', ''),
(30, 'suggest_instance', '%instance bosses drop good gear. Wanna run?', 0, 0, '', 'Les boss %instance drop du bon équipement. Tu veux nous rejoindre ?', '', '', '', '', '', ''),
(31, 'suggest_instance', 'What about %instance?', 0, 0, '', 'Et %instance ?', '', '', '', '', '', ''),
(32, 'suggest_instance', 'Anybody needs %role?', 0, 0, '', 'Quelqu\'un a besoin de %role ?', '', '', '', '', '', ''),
(33, 'suggest_instance', 'Anyone needs %role?', 0, 0, '', 'Quelqu\'un a besoin de %role ?', '', '', '', '', '', ''),
@@ -518,41 +518,41 @@ INSERT INTO `ai_playerbot_texts` (`id`, `name`, `text`, `say_type`, `reply_type`
(498, 'no ammo', 'That\'s it! No <ammo>!', 0, 0, '', 'C\'est ça! Pas de <ammo>!', '', '', '', '', '', ''),
(499, 'no ammo', 'And you have my bow... Oops, no <ammo>!', 0, 0, '', 'Et vous avez mon arc... Oups, pas de <ammo>!', '', '', '', '', '', ''),
(500, 'no ammo', 'Need ammo!', 0, 0, '', 'Besoin de munitions!', '', '', '', '', '', ''),
(501, 'hello', 'Hello', 0, 0, '', '', '', '', '', '', '', 'Привет'),
(502, 'hello', 'Hello!', 0, 0, '', '', '', '', '', '', '', 'Привет!'),
(503, 'hello', 'Hi', 0, 0, '', '', '', '', '', '', '', 'Прив'),
(504, 'hello', 'Hi!', 0, 0, '', '', '', '', '', '', '', 'Прив!'),
(505, 'hello', 'Hello there!', 0, 0, '', '', '', '', '', '', '', 'Здарова!'),
(506, 'hello_follow', 'Hello, I follow you!', 0, 0, '', '', '', '', '', '', '', 'Привет, иду за тобой!'),
(507, 'hello_follow', 'Hello, lead the way!', 0, 0, '', '', '', '', '', '', '', 'Привет, веди!'),
(508, 'hello_follow', 'Hi, lead the way!', 0, 0, '', '', '', '', '', '', '', 'Прив, веди!'),
(509, 'logout_cancel', 'Logout cancelled!', 0, 0, '', '', '', '', '', '', '', 'Логаут отменен!'),
(510, 'logout_start', 'I\'m logging out!', 0, 0, '', '', '', '', '', '', '', 'Я выхожу из игры!'),
(511, 'goodbye', 'Goodbye!', 0, 0, '', '', '', '', '', '', '', 'Пока!'),
(512, 'goodbye', 'Bye bye!', 0, 0, '', '', '', '', '', '', '', 'Пока пока!'),
(513, 'goodbye', 'See you later!', 0, 0, '', '', '', '', '', '', '', 'Увидимся позже!'),
(514, 'quest_accept', 'Quest accepted', 0, 0, '', '', '', '', '', '', '', 'Квест взят'),
(515, 'quest_remove', 'Quest removed', 0, 0, '', '', '', '', '', '', '', 'Квест отменен'),
(516, 'quest_cant_take', 'I can\'t take this quest', 0, 0, '', '', '', '', '', '', '', 'Я не могу взять этот квест'),
(517, 'following', 'Following', 0, 0, '', '', '', '', '', '', '', 'Следую'),
(518, 'staying', 'Staying', 0, 0, '', '', '', '', '', '', '', 'Стою'),
(519, 'fleeing', 'Fleeing', 0, 0, '', '', '', '', '', '', '', 'Убегаю'),
(520, 'fleeing_far', 'I won\'t flee with you, you are too far away', 0, 0, '', '', '', '', '', '', '', 'Я с тобой не побегу, ты слишком далеко'),
(521, 'grinding', 'Grinding', 0, 0, '', '', '', '', '', '', '', 'Гриндю'),
(522, 'attacking', 'Attacking', 0, 0, '', '', '', '', '', '', '', 'Атакую'),
(523, 'wait_travel_close', 'I am close, wait for me!', 0, 0, '', '', '', '', '', '', '', 'Я тут рядом, подожди!'),
(524, 'wait_travel_close', 'I\'m not far, please wait!', 0, 0, '', '', '', '', '', '', '', 'Я недалеко, погодите!'),
(525, 'wait_travel_medium', 'I\'m heading to your location', 0, 0, '', '', '', '', '', '', '', 'Двигаюсь к тебе'),
(526, 'wait_travel_medium', 'I\'m coming to you', 0, 0, '', '', '', '', '', '', '', 'Иду к тебе'),
(527, 'wait_travel_far', 'I\'m traveling to your location', 0, 0, '', '', '', '', '', '', '', 'Направляюсь к тебе'),
(528, 'wait_travel_far', 'I\'m trying to get to you', 0, 0, '', '', '', '', '', '', '', 'Пытаюсь до тебя добраться'),
(529, 'error_far', 'It is too far away', 0, 0, '', '', '', '', '', '', '', 'Слишком далеко'),
(530, 'error_water', 'It is under water', 0, 0, '', '', '', '', '', '', '', 'Это под водой'),
(531, 'error_cant_go', 'I can\'t go there', 0, 0, '', '', '', '', '', '', '', 'Я не могу туда пройти'),
(532, 'error_guild', 'I\'m not in your guild!', 0, 0, '', '', '', '', '', '', '', 'Я не в твоей гильдии'),
(533, 'error_gbank_found', 'Can not find a guild bank nearby', 0, 0, '', '', '', '', '', '', '', 'Не могу найти гильд банк рядом'),
(501, 'hello', 'Hello', 0, 0, '', 'Salut', '', '', '', '', '', 'Привет'),
(502, 'hello', 'Hello!', 0, 0, '', 'Salut !', '', '', '', '', '', 'Привет!'),
(503, 'hello', 'Hi', 0, 0, '', 'Bonjour', '', '', '', '', '', 'Прив'),
(504, 'hello', 'Hi!', 0, 0, '', 'Bonjour !', '', '', '', '', '', 'Прив!'),
(505, 'hello', 'Hello there!', 0, 0, '', 'Salut par ici !', '', '', '', '', '', 'Здарова!'),
(506, 'hello_follow', 'Hello, I follow you!', 0, 0, '', 'Salut, je te suis !', '', '', '', '', '', 'Привет, иду за тобой!'),
(507, 'hello_follow', 'Hello, lead the way!', 0, 0, '', 'Salut, après toi !', '', '', '', '', '', 'Привет, веди!'),
(508, 'hello_follow', 'Hi, lead the way!', 0, 0, '', 'Bonjour, après vous !', '', '', '', '', '', 'Прив, веди!'),
(509, 'logout_cancel', 'Logout cancelled!', 0, 0, '', 'Logout annulé', '', '', '', '', '', 'Логаут отменен!'),
(510, 'logout_start', 'I\'m logging out!', 0, 0, '', 'Je déconnecte', '', '', '', '', '', 'Я выхожу из игры!'),
(511, 'goodbye', 'Goodbye!', 0, 0, '', 'Au revoir', '', '', '', '', '', 'Пока!'),
(512, 'goodbye', 'Bye bye!', 0, 0, '', 'Salut salut++', '', '', '', '', '', 'Пока пока!'),
(513, 'goodbye', 'See you later!', 0, 0, '', 'A plus tard', '', '', '', '', '', 'Увидимся позже!'),
(514, 'quest_accept', 'Quest accepted', 0, 0, '', 'Quête accepté', '', '', '', '', '', 'Квест взят'),
(515, 'quest_remove', 'Quest removed', 0, 0, '', 'Quête supprimé', '', '', '', '', '', 'Квест отменен'),
(516, 'quest_cant_take', 'I can\'t take this quest', 0, 0, '', 'Je ne peut pas prendre la quête', '', '', '', '', '', 'Я не могу взять этот квест'),
(517, 'following', 'Following', 0, 0, '', 'Je vous suis', '', '', '', '', '', 'Следую'),
(518, 'staying', 'Staying', 0, 0, '', 'Je reste en position', '', '', '', '', '', 'Стою'),
(519, 'fleeing', 'Fleeing', 0, 0, '', 'Au secours !!', '', '', '', '', '', 'Убегаю'),
(520, 'fleeing_far', 'I won\'t flee with you, you are too far away', 0, 0, '', 'Tu es trop loin je ne peut pas fuir avec toi', '', '', '', '', '', 'Я с тобой не побегу, ты слишком далеко'),
(521, 'grinding', 'Grinding', 0, 0, '', 'Je grind', '', '', '', '', '', 'Гриндю'),
(522, 'attacking', 'Attacking', 0, 0, '', 'J'attack', '', '', '', '', '', 'Атакую'),
(523, 'wait_travel_close', 'I am close, wait for me!', 0, 0, '', 'Attends moi je suis proche', '', '', '', '', '', 'Я тут рядом, подожди!'),
(524, 'wait_travel_close', 'I\'m not far, please wait!', 0, 0, '', 'Je suis à côté s\'il te plait attends moi !', '', '', '', '', '', 'Я недалеко, погодите!'),
(525, 'wait_travel_medium', 'I\'m heading to your location', 0, 0, '', 'J\'arrive sur ta position', '', '', '', '', '', 'Двигаюсь к тебе'),
(526, 'wait_travel_medium', 'I\'m coming to you', 0, 0, '', 'Je viens à toi', '', '', '', '', '', 'Иду к тебе'),
(527, 'wait_travel_far', 'I\'m traveling to your location', 0, 0, '', 'Je voyage jusqu\'à toi'', '', '', '', '', '', 'Направляюсь к тебе'),
(528, 'wait_travel_far', 'I\'m trying to get to you', 0, 0, '', 'J\'essai de vous rejoindre', '', '', '', '', '', 'Пытаюсь до тебя добраться'),
(529, 'error_far', 'It is too far away', 0, 0, '', 'C\'est trop loin'', '', '', '', '', '', 'Слишком далеко'),
(530, 'error_water', 'It is under water', 0, 0, '', 'C\'est sous l\'eau', '', '', '', '', '', 'Это под водой'),
(531, 'error_cant_go', 'I can\'t go there', 0, 0, '', 'Je ne peut pas atteindre cette destination', '', '', '', '', '', 'Я не могу туда пройти'),
(532, 'error_guild', 'I\'m not in your guild!', 0, 0, '', 'Je ne fais pas parti de ta guilde', '', '', '', '', '', 'Я не в твоей гильдии'),
(533, 'error_gbank_found', 'Can not find a guild bank nearby', 0, 0, '', 'Il n\'y a pas de coffre de guilde à proximité'', '', '', '', '', '', 'Не могу найти гильд банк рядом'),
(534, 'error_cant_put', 'I can\'t put ', 0, 0, '', '', '', '', '', '', '', 'Я не могу положить'),
(535, 'error_gbank_rights', 'I have no rights to put items in the first guild bank tab', 0, 0, '', '', '', '', '', '', '', 'Нет прав чтобы класть вещи в первую вкладку гильд банка'),
(535, 'error_gbank_rights', 'I have no rights to put items in the first guild bank tab', 0, 0, '', 'Je n'ai pas les droits de dépôt à la banque', '', '', '', '', '', 'Нет прав чтобы класть вещи в первую вкладку гильд банка'),
(536, 'gbank_put', ' put to guild bank', 0, 0, '', '', '', '', '', '', '', ' теперь в гильд банке');
/*!40000 ALTER TABLE `ai_playerbot_texts` ENABLE KEYS */;

View File

@@ -103,14 +103,13 @@ bool LfgJoinAction::JoinLFG()
if (!dungeon || (dungeon->TypeID != LFG_TYPE_RANDOM && dungeon->TypeID != LFG_TYPE_DUNGEON && dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
continue;
uint32 botLevel = bot->GetLevel();
if (dungeon->MinLevel && botLevel < dungeon->MinLevel)
continue;
const auto& botLevel = bot->GetLevel();
if (dungeon->MinLevel && botLevel > dungeon->MinLevel + 10)
continue;
if (dungeon->MaxLevel && botLevel > dungeon->MaxLevel)
/*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/
if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel)
||
(botLevel > dungeon->MinLevel + 10 && dungeon->TypeID == LFG_TYPE_DUNGEON)
)
continue;
selected.push_back(dungeon->ID);
@@ -126,41 +125,8 @@ bool LfgJoinAction::JoinLFG()
bool many = list.size() > 1;
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*list.begin());
/*for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM_DUNGEON && dungeon->type != LFG_TYPE_DUNGEON && dungeon->type != LFG_TYPE_HEROIC_DUNGEON &&
dungeon->type != LFG_TYPE_RAID))
continue;
uint32 botLevel = bot->GetLevel();
if (dungeon->MinLevel && botLevel < dungeon->MinLevel)
continue;
if (dungeon->MinLevel && botLevel > dungeon->MinLevel + 10)
continue;
if (dungeon->MaxLevel && botLevel > dungeon->MaxLevel)
continue;
if (heroic && !dungeon->difficulty)
continue;
if (rbotAId && dungeon->type != LFG_TYPE_RAID)
continue;
if (!random && !rbotAId && !heroic && dungeon->type != LFG_TYPE_DUNGEON)
continue;
list.insert(dungeon);
}
if (list.empty() && !random)
return false;*/
// check role for console msg
std::string _roles = "multiple roles";
uint32 roleMask = GetRoles();
if (roleMask & PLAYER_ROLE_TANK)
_roles = "TANK";
@@ -175,70 +141,8 @@ bool LfgJoinAction::JoinLFG()
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
bot->GetLevel(), bot->GetName().c_str(), _roles, many ? "several dungeons" : dungeon->Name[0]);
/*if (lfgState->IsSingleRole())
{
if (lfgState->HasRole(ROLE_TANK))
_roles = "TANK";
if (lfgState->HasRole(ROLE_HEALER))
_roles = "HEAL";
if (lfgState->HasRole(ROLE_DAMAGE))
_roles = "DPS";
}*/
/*LFGDungeonEntry const* dungeon;
if(!random)
dungeon = *list.begin();
bool many = list.size() > 1;
if (random)
{
LFGDungeonSet randList = sLFGMgr->GetRandomDungeonsForPlayer(bot);
for (LFGDungeonSet::const_iterator itr = randList.begin(); itr != randList.end(); ++itr)
{
LFGDungeonEntry const* dungeon = *itr;
if (!dungeon)
continue;
idx.push_back(dungeon->ID);
}
if (idx.empty())
return false;
// choose random dungeon
dungeon = sLFGDungeonStore.LookupEntry(idx[urand(0, idx.size() - 1)]);
list.insert(dungeon);
pState->SetType(LFG_TYPE_RANDOM_DUNGEON);
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: queues LFG, Random Dungeon as {} ({})",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _roles, dungeon->Name[0]);
return true;
}
else if (heroic)
{
pState->SetType(LFG_TYPE_HEROIC_DUNGEON);
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: queues LFG, Heroic Dungeon as {} ({})",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
bot->GetLevel(), bot->GetName().c_str(), _roles, many ? "several dungeons" : dungeon->Name[0]);
}
else if (rbotAId)
{
pState->SetType(LFG_TYPE_RAID);
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: queues LFG, RbotAId as {} ({})",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _roles, many ? "several dungeons" : dungeon->Name[0]);
}
else
{
pState->SetType(LFG_TYPE_DUNGEON);
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: queues LFG, Dungeon as {} ({})",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _roles, many ? "several dungeons" : dungeon->Name[0]);
}*/
// Set RbotAId Browser comment
std::string const _gs = std::to_string(botAI->GetEquipGearScore(bot, false, false));
sLFGMgr->JoinLfg(bot, roleMask, list, _gs);
return true;