fix(Core/DB) Quest 925 Cairne's Hoofprint (#8721)

Fixed to use proper gossip from db.
This commit is contained in:
Malcrom
2021-10-26 05:35:45 -03:00
committed by GitHub
parent 04aac67970
commit 6c4b8215fa
2 changed files with 103 additions and 94 deletions

View File

@@ -15,132 +15,126 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Thunder_Bluff
SD%Complete: 100
SDComment: Quest support: 925
SDCategory: Thunder Bluff
EndScriptData */
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
/*#####
# npc_cairne_bloodhoof
# Support for Quest 925: Cairne's Hoofprint
######*/
// NPC 3057: Cairne Bloodhoof <High Chieftain>
enum CairneBloodhoof
{
SPELL_BERSERKER_CHARGE = 16636,
SPELL_CLEAVE = 16044,
SPELL_MORTAL_STRIKE = 16856,
SPELL_THUNDERCLAP = 23931,
SPELL_UPPERCUT = 22916
SPELL_UPPERCUT = 22916,
SPELL_CAIRNES_HOOFPRINT = 23123
};
#define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint."
/// @todo verify abilities/timers
// @todo verify abilities/timers
class npc_cairne_bloodhoof : public CreatureScript
{
public:
npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
struct npc_cairne_bloodhoofAI : public ScriptedAI
{
ClearGossipMenuFor(player);
if (action == GOSSIP_SENDER_INFO)
npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
player->CastSpell(player, 23123, false);
SendGossipMenuFor(player, 7014, creature->GetGUID());
_berserkerChargeTimer = 30000;
_cleaveTimer = 5000;
_mortalStrikeTimer = 10000;
_thunderclapTimer = 15000;
_uppercutTimer = 10000;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) override
{
if (action == 0)
{
player->CastSpell(player, SPELL_CAIRNES_HOOFPRINT, false);
}
}
if (player->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE)
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO);
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
{
return;
}
SendGossipMenuFor(player, 7013, creature->GetGUID());
if (_berserkerChargeTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
DoCast(target, SPELL_BERSERKER_CHARGE);
}
_berserkerChargeTimer = 25000;
}
else
{
_berserkerChargeTimer -= diff;
}
return true;
}
if (_uppercutTimer <= diff)
{
DoCastVictim(SPELL_UPPERCUT);
_uppercutTimer = 20000;
}
else
{
_uppercutTimer -= diff;
}
if (_thunderclapTimer <= diff)
{
DoCastVictim(SPELL_THUNDERCLAP);
_thunderclapTimer = 15000;
}
else
{
_thunderclapTimer -= diff;
}
if (_mortalStrikeTimer <= diff)
{
DoCastVictim(SPELL_MORTAL_STRIKE);
_mortalStrikeTimer = 15000;
}
else
{
_mortalStrikeTimer -= diff;
}
if (_cleaveTimer <= diff)
{
DoCastVictim(SPELL_CLEAVE);
_cleaveTimer = 7000;
}
else
{
_cleaveTimer -= diff;
}
DoMeleeAttackIfReady();
}
private:
uint32 _berserkerChargeTimer;
uint32 _cleaveTimer;
uint32 _mortalStrikeTimer;
uint32 _thunderclapTimer;
uint32 _uppercutTimer;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_cairne_bloodhoofAI(creature);
}
struct npc_cairne_bloodhoofAI : public ScriptedAI
{
npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) { }
uint32 BerserkerChargeTimer;
uint32 CleaveTimer;
uint32 MortalStrikeTimer;
uint32 ThunderclapTimer;
uint32 UppercutTimer;
void Reset() override
{
BerserkerChargeTimer = 30000;
CleaveTimer = 5000;
MortalStrikeTimer = 10000;
ThunderclapTimer = 15000;
UppercutTimer = 10000;
}
void EnterCombat(Unit* /*who*/) override { }
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (BerserkerChargeTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_BERSERKER_CHARGE);
BerserkerChargeTimer = 25000;
}
else BerserkerChargeTimer -= diff;
if (UppercutTimer <= diff)
{
DoCastVictim(SPELL_UPPERCUT);
UppercutTimer = 20000;
}
else UppercutTimer -= diff;
if (ThunderclapTimer <= diff)
{
DoCastVictim(SPELL_THUNDERCLAP);
ThunderclapTimer = 15000;
}
else ThunderclapTimer -= diff;
if (MortalStrikeTimer <= diff)
{
DoCastVictim(SPELL_MORTAL_STRIKE);
MortalStrikeTimer = 15000;
}
else MortalStrikeTimer -= diff;
if (CleaveTimer <= diff)
{
DoCastVictim(SPELL_CLEAVE);
CleaveTimer = 7000;
}
else CleaveTimer -= diff;
DoMeleeAttackIfReady();
}
};
};
void AddSC_thunder_bluff()