Skip to content

Commit

Permalink
Implement Suns Reach Reclamation event and phasing
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jan 5, 2021
1 parent b18d50e commit 73aa549
Show file tree
Hide file tree
Showing 10 changed files with 684 additions and 62 deletions.
1 change: 1 addition & 0 deletions sql/scriptdev2/scriptdev2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ UPDATE creature_template SET ScriptName='npc_grand_admiral_westwind' WHERE entry

/* ISLE OF QUEL'DANAS */
UPDATE creature_template SET ScriptName='npc_converted_sentry' WHERE entry=24981;
UPDATE creature_template SET ScriptName='npc_suns_reach_reclamation' WHERE entry IN(24965,24967,25061,25057,24932,25108,25069,25046,24975,25112,25163);

/* KARAZHAN */
UPDATE instance_template SET ScriptName='instance_karazhan' WHERE map=532;
Expand Down
5 changes: 5 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(34630,'spell_scrap_reaver_spell'),
(44935,'spell_razorthorn_root'),
(44881,'spell_charm_ravager'),
(44948,'spell_living_flare_detonator'),
(44877,'spell_living_flare_master'),
(44943,'spell_living_flare_unstable'),

This comment has been minimized.

Copy link
@NeatElves

NeatElves Jan 11, 2021

Spell 44877 has script spell_living_flare_master in spell_scripts but script does not exist. Skipping.
Spell 44943 has script spell_living_flare_unstable in spell_scripts but script does not exist. Skipping.
Spell 44948 has script spell_living_flare_detonator in spell_scripts but script does not exist. Skipping.

Are these spells needed for WOTLK?)

(45188,'spell_dawnblade_attack'),
(38858,'spell_queldanas_shoot'),
(34800,'spell_getting_sleepy_aura'),
(43364,'spell_getting_sleepy_aura');

Expand Down
66 changes: 66 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/world/suns_reach_reclamation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include "AI/ScriptDevAI/include/sc_common.h"
#include "World/WorldState.h"
#include "Spells/Scripts/SpellScript.h"

bool QuestRewarded_suns_reach_reclamation(Player* player, Creature* creature, Quest const* quest)
{
sWorldState.AddSunsReachProgress(quest->GetQuestId());
return true;
}

enum
{
SPELL_SHOOT = 38858,
SPELL_DAWNBLADE_ATTACK_RESPONSE = 45189,
};

struct DawnbladeAttack : public SpellScript
{
void OnInit(Spell* spell) const override
{
spell->SetMaxAffectedTargets(1);
}

void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
if (urand(0, 1) == 0)
if (Unit* target = spell->GetUnitTarget())
target->AI()->DoCastSpellIfCan(spell->GetCaster(), SPELL_SHOOT);
}
};

struct QuelDanasShoot : public SpellScript
{
void OnHit(Spell* spell, SpellMissInfo /*missInfo*/) const override
{
if (Unit* target = spell->GetUnitTarget())
target->AI()->DoCastSpellIfCan(spell->GetCaster(), SPELL_DAWNBLADE_ATTACK_RESPONSE);
}
};

void AddSC_suns_reach_reclamation()
{
Script* pNewScript = new Script;
pNewScript->Name = "npc_suns_reach_reclamation";
pNewScript->pQuestRewardedNPC = &QuestRewarded_suns_reach_reclamation;
pNewScript->RegisterSelf();

RegisterSpellScript<DawnbladeAttack>("spell_dawnblade_attack");
RegisterSpellScript<QuelDanasShoot>("spell_queldanas_shoot");
}
2 changes: 2 additions & 0 deletions src/game/AI/ScriptDevAI/system/ScriptLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern void AddSC_spell_scripts();
extern void AddSC_world_map_scripts();
extern void AddSC_boss_highlord_kruul();
extern void AddSC_war_effort();
extern void AddSC_suns_reach_reclamation();
extern void AddSC_world_map_ebon_hold();
extern void AddSC_shade_of_the_horseman();

Expand Down Expand Up @@ -525,6 +526,7 @@ void AddScripts()
AddSC_world_map_scripts();
AddSC_boss_highlord_kruul();
AddSC_war_effort();
AddSC_suns_reach_reclamation();
AddSC_world_map_ebon_hold();
AddSC_shade_of_the_horseman();

Expand Down
9 changes: 9 additions & 0 deletions src/game/Chat/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,18 @@ ChatCommand* ChatHandler::getCommandTable()
{ nullptr, 0, false, nullptr, "", nullptr }
};

static ChatCommand sunsReachReclamationTable[] =
{
{ "phase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSunsReachReclamationPhaseCommand, "", nullptr },
{ "subphase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSunsReachReclamationSubPhaseCommand, "", nullptr },
{ "counter", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSunsReachReclamationCounterCommand, "", nullptr },
{ nullptr, 0, false, nullptr, "", nullptr }
};

static ChatCommand worldStateTable[] =
{
{ "wareffort", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWarEffortCommand, "", nullptr },
{ "sunsreach", SEC_ADMINISTRATOR, false, nullptr, "", sunsReachReclamationTable },
{ "expansion", SEC_ADMINISTRATOR, false, &ChatHandler::HandleExpansionRelease, "", nullptr },
{ nullptr, 0, false, nullptr, "", nullptr }
};
Expand Down
3 changes: 3 additions & 0 deletions src/game/Chat/Chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,9 @@ class ChatHandler

// worldstate
bool HandleWarEffortCommand(char* args);
bool HandleSunsReachReclamationPhaseCommand(char* args);
bool HandleSunsReachReclamationSubPhaseCommand(char* args);
bool HandleSunsReachReclamationCounterCommand(char* args);
bool HandleExpansionRelease(char* args);

// Battleground
Expand Down
44 changes: 44 additions & 0 deletions src/game/Chat/Level3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7277,6 +7277,50 @@ bool ChatHandler::HandleWarEffortCommand(char* args)
return true;
}

bool ChatHandler::HandleSunsReachReclamationPhaseCommand(char* args)
{
uint32 param;
if (!ExtractUInt32(&args, param))
{
PSendSysMessage("%s", sWorldState.GetSunsReachPrintout().data());
return true;
}
sWorldState.HandleSunsReachPhaseTransition(param);
return true;
}

bool ChatHandler::HandleSunsReachReclamationSubPhaseCommand(char* args)
{
uint32 param;
if (!ExtractUInt32(&args, param))
{
PSendSysMessage("%s", sWorldState.GetSunsReachPrintout().data());
return true;
}
sWorldState.HandleSunsReachSubPhaseTransition(param);
return true;
}

bool ChatHandler::HandleSunsReachReclamationCounterCommand(char* args)
{
uint32 index;
if (!ExtractUInt32(&args, index) || index >= COUNTERS_MAX)
{
PSendSysMessage("Enter valid index for counter.");
return true;
}

uint32 value;
if (!ExtractUInt32(&args, value))
{
PSendSysMessage("Enter valid value for counter.");
return true;
}

sWorldState.SetSunsReachCounter(SunsReachCounters(index), value);
return true;
}

bool ChatHandler::HandleExpansionRelease(char* args)
{
uint32 curExpansion = sWorldState.GetExpansion();
Expand Down
1 change: 1 addition & 0 deletions src/game/Spells/SpellMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ inline bool IsSpellRemovedOnEvade(SpellEntry const* spellInfo)
case 44604: // Enchantment of Spell Haste
case 44855: // Out of Phase
case 45033: // Abyssal Transformation
case 45187: // Dawnblade Attack
case 45822: // Iceblood Warmaster
case 45823: // Tower Point Warmaster
case 45824: // West Frostwolf Warmaster
Expand Down
Loading

0 comments on commit 73aa549

Please sign in to comment.