fix(Scripts/Commands): battlefield commands console support and localized messages (#24980)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-03-03 10:42:41 -03:00
committed by GitHub
parent 1fc4781306
commit 5b17f4a044
3 changed files with 59 additions and 20 deletions

View File

@@ -0,0 +1,10 @@
--
DELETE FROM `acore_string` WHERE `entry` IN (5111, 5112, 5113, 5114, 5115, 5116, 5117);
INSERT INTO `acore_string` (`entry`, `content_default`, `locale_koKR`, `locale_frFR`, `locale_deDE`, `locale_zhCN`, `locale_zhTW`, `locale_esES`, `locale_esMX`, `locale_ruRU`) VALUES
(5111, 'Battlefield {} not found.', '전장 {}을(를) 찾을 수 없습니다.', 'Champ de bataille {} introuvable.', 'Schlachtfeld {} nicht gefunden.', '战场 {} 未找到。', '戰場 {} 未找到。', 'Campo de batalla {} no encontrado.', 'Campo de batalla {} no encontrado.', 'Поле боя {} не найдено.'),
(5112, 'Battlefield {} battle started.', '전장 {} 전투가 시작되었습니다.', 'La bataille du champ de bataille {} a commencé.', 'Schlachtfeld {} Kampf gestartet.', '战场 {} 战斗已开始。', '戰場 {} 戰鬥已開始。', 'La batalla del campo de batalla {} ha comenzado.', 'La batalla del campo de batalla {} ha comenzado.', 'Сражение на поле боя {} началось.'),
(5113, 'Battlefield {} battle stopped.', '전장 {} 전투가 중지되었습니다.', 'La bataille du champ de bataille {} a été arrêtée.', 'Schlachtfeld {} Kampf beendet.', '战场 {} 战斗已停止。', '戰場 {} 戰鬥已停止。', 'La batalla del campo de batalla {} ha sido detenida.', 'La batalla del campo de batalla {} ha sido detenida.', 'Сражение на поле боя {} остановлено.'),
(5114, 'Battlefield {} factions switched.', '전장 {} 진영이 전환되었습니다.', 'Les factions du champ de bataille {} ont été échangées.', 'Schlachtfeld {} Fraktionen gewechselt.', '战场 {} 阵营已切换。', '戰場 {} 陣營已切換。', 'Las facciones del campo de batalla {} han sido intercambiadas.', 'Las facciones del campo de batalla {} han sido intercambiadas.', 'Фракции на поле боя {} переключены.'),
(5115, 'Battlefield {} timer set to {} seconds.', '전장 {} 타이머가 {}초로 설정되었습니다.', 'Le minuteur du champ de bataille {} a été réglé à {} secondes.', 'Schlachtfeld {} Timer auf {} Sekunden gesetzt.', '战场 {} 计时器已设置为 {} 秒。', '戰場 {} 計時器已設置為 {} 秒。', 'El temporizador del campo de batalla {} se ha establecido en {} segundos.', 'El temporizador del campo de batalla {} se ha establecido en {} segundos.', 'Таймер поля боя {} установлен на {} секунд.'),
(5116, 'Battlefield {} enabled.', '전장 {}이(가) 활성화되었습니다.', 'Champ de bataille {} activé.', 'Schlachtfeld {} aktiviert.', '战场 {} 已启用。', '戰場 {} 已啟用。', 'Campo de batalla {} habilitado.', 'Campo de batalla {} habilitado.', 'Поле боя {} включено.'),
(5117, 'Battlefield {} disabled.', '전장 {}이(가) 비활성화되었습니다.', 'Champ de bataille {} désactivé.', 'Schlachtfeld {} deaktiviert.', '战场 {} 已禁用。', '戰場 {} 已停用。', 'Campo de batalla {} deshabilitado.', 'Campo de batalla {} deshabilitado.', 'Поле боя {} отключено.');

View File

@@ -1183,7 +1183,16 @@ enum AcoreStrings
LANG_CMD_QUEST_STATUS_LOG_FULL = 5109,
LANG_CMD_QUEST_STATUS_COND_DETAIL = 5110,
// Room for more strings 5111-9999
// Battlefield commands
LANG_BF_NOT_FOUND = 5111,
LANG_BF_STARTED = 5112,
LANG_BF_STOPPED = 5113,
LANG_BF_SWITCHED = 5114,
LANG_BF_TIMER_SET = 5115,
LANG_BF_ENABLED = 5116,
LANG_BF_DISABLED = 5117,
// Room for more strings 5118-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,

View File

@@ -18,6 +18,7 @@
#include "BattlefieldMgr.h"
#include "Chat.h"
#include "CommandScript.h"
#include "Language.h"
using namespace Acore::ChatCommands;
@@ -30,11 +31,11 @@ public:
{
static ChatCommandTable battlefieldcommandTable =
{
{ "start", HandleBattlefieldStart, SEC_ADMINISTRATOR, Console::No },
{ "stop", HandleBattlefieldEnd, SEC_ADMINISTRATOR, Console::No },
{ "switch", HandleBattlefieldSwitch, SEC_ADMINISTRATOR, Console::No },
{ "timer", HandleBattlefieldTimer, SEC_ADMINISTRATOR, Console::No },
{ "enable", HandleBattlefieldEnable, SEC_ADMINISTRATOR, Console::No }
{ "start", HandleBattlefieldStart, SEC_ADMINISTRATOR, Console::Yes },
{ "stop", HandleBattlefieldEnd, SEC_ADMINISTRATOR, Console::Yes },
{ "switch", HandleBattlefieldSwitch, SEC_ADMINISTRATOR, Console::Yes },
{ "timer", HandleBattlefieldTimer, SEC_ADMINISTRATOR, Console::Yes },
{ "enable", HandleBattlefieldEnable, SEC_ADMINISTRATOR, Console::Yes }
};
static ChatCommandTable commandTable =
{
@@ -48,12 +49,15 @@ public:
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId);
if (!bf)
{
handler->SendErrorMessage(LANG_BF_NOT_FOUND, battleId);
return false;
}
bf->StartBattle();
if (battleId == 1)
handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)");
handler->SendWorldText(LANG_BF_STARTED, battleId);
if (handler->IsConsole())
handler->PSendSysMessage(LANG_BF_STARTED, battleId);
return true;
}
@@ -63,12 +67,15 @@ public:
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId);
if (!bf)
{
handler->SendErrorMessage(LANG_BF_NOT_FOUND, battleId);
return false;
}
bf->EndBattle(true);
if (battleId == 1)
handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
handler->SendWorldText(LANG_BF_STOPPED, battleId);
if (handler->IsConsole())
handler->PSendSysMessage(LANG_BF_STOPPED, battleId);
return true;
}
@@ -78,19 +85,24 @@ public:
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId);
if (!bf)
{
handler->SendErrorMessage(LANG_BF_NOT_FOUND, battleId);
return false;
}
if (bf->IsEnabled())
{
bf->ToggleBattlefield(false);
if (battleId == 1)
handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
handler->SendWorldText(LANG_BF_DISABLED, battleId);
if (handler->IsConsole())
handler->PSendSysMessage(LANG_BF_DISABLED, battleId);
}
else
{
bf->ToggleBattlefield(true);
if (battleId == 1)
handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
handler->SendWorldText(LANG_BF_ENABLED, battleId);
if (handler->IsConsole())
handler->PSendSysMessage(LANG_BF_ENABLED, battleId);
}
return true;
@@ -101,11 +113,15 @@ public:
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId);
if (!bf)
{
handler->SendErrorMessage(LANG_BF_NOT_FOUND, battleId);
return false;
}
bf->EndBattle(false);
if (battleId == 1)
handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
handler->SendWorldText(LANG_BF_SWITCHED, battleId);
if (handler->IsConsole())
handler->PSendSysMessage(LANG_BF_SWITCHED, battleId);
return true;
}
@@ -138,12 +154,16 @@ public:
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleId);
if (!bf)
{
handler->SendErrorMessage(LANG_BF_NOT_FOUND, battleId);
return false;
}
bf->SetTimer(time * IN_MILLISECONDS);
bf->SendInitWorldStatesToAll();
if (battleId == 1)
handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
handler->SendWorldText(LANG_BF_TIMER_SET, battleId, time);
if (handler->IsConsole())
handler->PSendSysMessage(LANG_BF_TIMER_SET, battleId, time);
return true;
}