Skip to content

Commit

Permalink
Cleaned up the gossip NPC and instance script logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchyDev committed Oct 15, 2023
1 parent b1383f0 commit c21479a
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 49 deletions.
12 changes: 11 additions & 1 deletion data/sql/db-world/base/tos_world_base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ DELETE FROM `instance_template` WHERE `map`=44;
INSERT INTO `instance_template` (`map`, `parent`, `script`, `allowMount`) VALUES (44, 0, 'instance_trial_of_strength', 0);



-- Combatant / Melee
DELETE FROM `creature_template` WHERE `entry`=441251;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (441251, 0, 0, 0, 0, 0, 3960, 4443, 4021, 4024, 'Enemy Combatant', 'Melee', NULL, 0, 80, 80, 0, 17, 0, 1, 1.14286, 1, 1, 20, 1, 0, 0, 5, 2000, 2000, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'CombatAI', 0, 1, 2, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'ToSEnemyCombatantScript', 1);
Expand All @@ -23,6 +22,17 @@ INSERT INTO `creature_equip_template` (`CreatureID`, `ID`, `ItemID1`, `ItemID2`,
DELETE FROM `creature_template` WHERE `entry`=441250;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (441250, 0, 0, 0, 0, 0, 18039, 0, 0, 0, 'Fortichad Ironfist', 'Arena Master', NULL, 0, 80, 80, 0, 35, 3, 1, 1.14286, 1, 1, 20, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'ToSArenaMasterScript', 1);

DELETE FROM `npc_text` WHERE `ID`=441250;
INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `Probability0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `Probability1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `Probability2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `Probability3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `Probability4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `Probability5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `Probability6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `Probability7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES (441250, 'Greetings, $n.|n|nI am the Arena Master for the Trial of Strength.|n|nIf you seek to test your abilities, then I can transport you to the arena.|n|nAre you ready to face the challenges that lie ahead?', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
DELETE FROM `npc_text` WHERE `ID`=441251;
INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `Probability0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `Probability1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `Probability2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `Probability3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `Probability4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `Probability5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `Probability6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `Probability7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES (441251, 'Welcome $n, are you ready to start the Trial of Strength?', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
DELETE FROM `npc_text` WHERE `ID`=441252;
INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `Probability0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `Probability1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `Probability2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `Probability3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `Probability4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `Probability5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `Probability6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `Probability7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES (441252, 'You must finish the current trial before speaking to me again.', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
DELETE FROM `npc_text` WHERE `ID`=441253;
INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `Probability0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `Probability1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `Probability2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `Probability3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `Probability4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `Probability5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `Probability6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `Probability7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES (441253, 'Are you ready for the next trial?', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
DELETE FROM `npc_text` WHERE `ID`=441254;
INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `Probability0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `Probability1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `Probability2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `Probability3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `Probability4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `Probability5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `Probability6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `Probability7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES (441254, 'Congratulations, $n!|n|nYou have triumphed in the Trial of Strength, proving your mettle and determination. Your strength and skill have shone brightly, and your name will be celebrated in the annals of our arena\'s history.|n|nWhat would you like to do now?', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);


CREATE TABLE IF NOT EXISTS `tos_reward_template` (
`id` int DEFAULT NULL,
Expand Down
5 changes: 5 additions & 0 deletions src/TrialOfStrength.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ ToSWaveTemplate* GetWaveTemplateForWave(uint32 wave)
return &it->second;
}

uint32 GetTotalWaves()
{
return waveTemplates.size();
}

std::vector<ToSEnemyGroup*> GetEnemiesFromGroup(uint32 groupId, uint32 subGroup)
{
std::vector<ToSEnemyGroup*> groups;
Expand Down
10 changes: 4 additions & 6 deletions src/TrialOfStrength.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ enum ToSConstants {
TOS_MAP_ID = 44,
TOS_NPC_HANDLER = 441250,

TOS_GOSSIP_TELEPORT_TO = 1,
TOS_GOSSIP_TELEPORT_FROM = 2,
TOS_GOSSIP_ENCOUNTER_START = 3,
TOS_GOSSIP_ENCOUNTER_NEXT_WAVE = 4,
TOS_GOSSIP_ENCOUNTER_RESET = 5,

TOS_DATA_ENCOUNTER_START = 1,
TOS_DATA_ENCOUNTER_CURRENT_WAVE = 2,
TOS_DATA_ENCOUNTER_CURRENT_WAVE_CLEARED = 3,
Expand All @@ -30,6 +24,9 @@ enum ToSConstants {
TOS_DATA_ENCOUNTER_CHECK_WAVE_COMPLETE = 8,
TOS_DATA_ENCOUNTER_START_NEXT_WAVE = 9,
TOS_DATA_ENCOUNTER_CHECK_FAILURE = 10,
TOS_DATA_ENCOUNTER_CURRENT_SUBWAVE = 11,
TOS_DATA_ENCOUNTER_TOTAL_SUBWAVE = 12,
TOS_DATA_ENCOUNTER_TRIAL_COMPLETED = 13,
};

struct ToSWaveTemplate {
Expand Down Expand Up @@ -58,6 +55,7 @@ std::unordered_map<uint32, ToSEnemyGroup> enemyGroups;
std::unordered_map<uint32, ToSRewardTemplate> rewardTemplates;

ToSWaveTemplate* GetWaveTemplateForWave(uint32 wave);
uint32 GetTotalWaves();
std::vector<ToSEnemyGroup*> GetEnemiesFromGroup(uint32 groupId, uint32 subGroup);
ToSRewardTemplate* GetRewardTemplate(uint32 rewardId);
std::vector<uint32> GetSubGroups(uint32 groupId);
Expand Down
91 changes: 65 additions & 26 deletions src/scripts/ToSArenaMasterScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ class ToSArenaMasterScript : public CreatureScript
public:
ToSArenaMasterScript() : CreatureScript("ToSArenaMasterScript") { }

enum ArenaMasterConstants {
TOS_ARENA_MASTER_TEXT_GREETING = 441250,
TOS_ARENA_MASTER_TEXT_PRE_TRIAL = 441251,
TOS_ARENA_MASTER_TEXT_WAVE_NOT_FINISHED = 441252,
TOS_ARENA_MASTER_TEXT_WAVE_NEXT = 441253,
TOS_ARENA_MASTER_TEXT_CONGRATULATE = 441254,

TOS_GOSSIP_TELEPORT_TO = 1,
TOS_GOSSIP_TELEPORT_FROM = 2,
TOS_GOSSIP_ENCOUNTER_START = 3,
TOS_GOSSIP_ENCOUNTER_NEXT_WAVE = 4,
TOS_GOSSIP_ENCOUNTER_RESET = 5,
};

virtual bool OnGossipHello(Player* player, Creature* creature) override
{
if (!sConfigMgr->GetOption<bool>("TrialOfStrength.Enable", false))
Expand All @@ -19,43 +33,69 @@ class ToSArenaMasterScript : public CreatureScript
if (map && map->GetId() != TOS_MAP_ID)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Yes, I would like to attempt the trials.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_TELEPORT_TO);
SendGossipMenuFor(player, TOS_ARENA_MASTER_TEXT_GREETING, creature);

return true;
}

SendGossipMenuFor(player, 1, creature);
auto iScript = creature->GetInstanceScript();
if (!iScript)
{
CloseGossipMenuFor(player);

return false;
}

auto currentWave = iScript->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE);
auto currentSubWave = iScript->GetData(TOS_DATA_ENCOUNTER_CURRENT_SUBWAVE);
auto totalSubWave = iScript->GetData(TOS_DATA_ENCOUNTER_TOTAL_SUBWAVE);
auto waveCleared = iScript->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE_CLEARED) > 0;
auto hasMoreWaves = iScript->GetData(TOS_DATA_ENCOUNTER_HAS_MORE_WAVES) > 0;
auto remainingAlive = iScript->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE_REMAINING);
auto trialCompleted = iScript->GetData(TOS_DATA_ENCOUNTER_TRIAL_COMPLETED) > 0;

if (!iScript->IsEncounterInProgress() && !waveCleared)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Yes, I am ready to start the Trial of Strength.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_START);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I changed my mind, I would like to leave.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_TELEPORT_FROM);

SendGossipMenuFor(player, TOS_ARENA_MASTER_TEXT_PRE_TRIAL, creature);

return true;
}

if (InstanceScript* pInstance = creature->GetInstanceScript())
if (iScript->IsEncounterInProgress() && !waveCleared)
{
auto encounterInProgress = pInstance->IsEncounterInProgress() ? "|cff00FF00true|r" : "|cffFF0000false|r";
auto currentWave = pInstance->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE);
auto waveCleared = pInstance->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE_CLEARED) > 0 ? "|cff00FF00true|r" : "|cffFF0000false|r";
auto moreWaves = pInstance->GetData(TOS_DATA_ENCOUNTER_HAS_MORE_WAVES) > 0 ? "|cff00FF00yes|r" : "|cffFF0000no|r";
auto remainingAlive = pInstance->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE_REMAINING);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, Acore::StringFormatFmt("Encounter In Progress: {}|nCurrent Wave: |cff0000FF{}|r|nCurrent Sub-Wave: {}/{}|nWave Cleared: {}|nAlive: |cffFF0000{}|r|nMore Waves?: {}", iScript->IsEncounterInProgress() ? "true" : "false", currentWave, currentSubWave, totalSubWave, waveCleared ? "true" : "false", remainingAlive, hasMoreWaves ? "true" : "false"), GOSSIP_SENDER_MAIN, 0);

AddGossipItemFor(player, GOSSIP_ICON_CHAT, Acore::StringFormatFmt("Encounter In Progress:{}|nCurrent Wave: |cff0000FF{}|r|nWave Cleared: {}|nAlive: |cffFF0000{}|r|nMore Waves?: {}", encounterInProgress, currentWave, waveCleared, remainingAlive, moreWaves), GOSSIP_SENDER_MAIN, 0);
SendGossipMenuFor(player, TOS_ARENA_MASTER_TEXT_WAVE_NOT_FINISHED, creature);

if (!pInstance->GetData(TOS_DATA_ENCOUNTER_START))
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I would like to start the trial.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_START);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I changed my mind, I would like to leave.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_TELEPORT_FROM);
}
else
{
if (pInstance->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE_CLEARED) &&
pInstance->GetData(TOS_DATA_ENCOUNTER_HAS_MORE_WAVES))
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, Acore::StringFormatFmt("I would like to move to the next wave ({}).", (pInstance->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE) + 1)), GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_NEXT_WAVE);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I would like to stop.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_TELEPORT_FROM);
}
}
return true;
}

AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Reset encounter", GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_RESET);
if (!iScript->IsEncounterInProgress() && waveCleared && hasMoreWaves)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, Acore::StringFormatFmt("Yes, I would like to proceed to the next wave. ({})", currentWave + 1), GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_NEXT_WAVE);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I would like to stop here.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_RESET);

SendGossipMenuFor(player, TOS_ARENA_MASTER_TEXT_WAVE_NEXT, creature);

return true;
}

SendGossipMenuFor(player, 1, creature);
if (trialCompleted)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I would like to attempt the trial again.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_ENCOUNTER_RESET);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I want to leave this place.", GOSSIP_SENDER_MAIN, TOS_GOSSIP_TELEPORT_FROM);

return true;
SendGossipMenuFor(player, TOS_ARENA_MASTER_TEXT_CONGRATULATE, creature);

return true;
}

CloseGossipMenuFor(player);

return false;
}

virtual bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
Expand Down Expand Up @@ -108,7 +148,6 @@ class ToSArenaMasterScript : public CreatureScript

if (InstanceScript* pInstance = creature->GetInstanceScript())
{
pInstance->SetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE_CLEARED, 0);
pInstance->SetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE, pInstance->GetData(TOS_DATA_ENCOUNTER_CURRENT_WAVE) + 1);
pInstance->SetData(TOS_DATA_ENCOUNTER_START, 1);
}
Expand Down
Loading

0 comments on commit c21479a

Please sign in to comment.