fix(Core/Unit): Remove some hardcoded texts (#5816)

This commit is contained in:
Axel Cocat
2022-04-15 13:17:06 +02:00
committed by GitHub
parent 2f5a5dffcb
commit 17e143763a
10 changed files with 132 additions and 107 deletions

View File

@@ -16,6 +16,7 @@
*/
#include "BattlegroundAV.h"
#include "CreatureTextMgr.h"
#include "Formulas.h"
#include "GameEventMgr.h"
#include "GameGraveyard.h"
@@ -391,9 +392,13 @@ void BattlegroundAV::PostUpdateImpl(uint32 diff)
for (uint8 i = 0; i <= 1; i++) //0=alliance, 1=horde
{
if (!m_CaptainAlive[i])
{
continue;
}
if (m_CaptainBuffTimer[i] > diff)
{
m_CaptainBuffTimer[i] -= diff;
}
else
{
if (i == 0)
@@ -401,14 +406,20 @@ void BattlegroundAV::PostUpdateImpl(uint32 diff)
CastSpellOnTeam(AV_BUFF_A_CAPTAIN, TEAM_ALLIANCE);
Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61);
if (creature)
YellToAll(creature, LANG_BG_AV_A_CAPTAIN_BUFF, LANG_COMMON);
{
std::string creatureText = sCreatureTextMgr->GetLocalizedChatString(creature->GetEntry(), creature->getGender(), 0, 0, DEFAULT_LOCALE);
YellToAll(creature, creatureText.c_str(), LANG_COMMON);
}
}
else
{
CastSpellOnTeam(AV_BUFF_H_CAPTAIN, TEAM_HORDE);
Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature
if (creature)
YellToAll(creature, LANG_BG_AV_H_CAPTAIN_BUFF, LANG_ORCISH);
{
std::string creatureText = sCreatureTextMgr->GetLocalizedChatString(creature->GetEntry(), creature->getGender(), 2, 0, DEFAULT_LOCALE);
YellToAll(creature, creatureText.c_str(), LANG_ORCISH);
}
}
m_CaptainBuffTimer[i] = 120000 + urand(0, 4) * 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
}
@@ -729,7 +740,10 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
if (mine == AV_SOUTH_MINE) //i think this gets called all the time
{
if (Creature* creature = GetBGCreature(AV_CPLACE_MINE_S_3))
YellToAll(creature, LANG_BG_AV_S_MINE_BOSS_CLAIMS, LANG_UNIVERSAL);
{
std::string creatureText = sCreatureTextMgr->GetLocalizedChatString(creature->GetEntry(), creature->getGender(), 0, 0, DEFAULT_LOCALE);
YellToAll(creature, creatureText.c_str(), LANG_UNIVERSAL);
}
}
}
}

View File

@@ -21,10 +21,6 @@
#include "Battleground.h"
#include "BattlegroundScore.h"
#define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!"
#define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!"
#define LANG_BG_AV_S_MINE_BOSS_CLAIMS "Snivvle is here! Snivvle claims the Coldtooth Mine!"
#define BG_AV_CAPTIME 240000 //4:00
#define BG_AV_SNOWFALL_FIRSTCAP 300000 //5:00 but i also have seen 4:05