fix(Core/Spell): Roll 'dem Bones (#14522)
* fix(Core/Spell): Roll 'dem Bones * closes https://github.com/azerothcore/azerothcore-wotlk/issues/14357 * Partial cp of https://github.com/TrinityCore/TrinityCore/commit/029527365f1763c45e8668c16ecd25ba7553bb22 Co-Authored-By: joschiwald <736792+joschiwald@users.noreply.github.com> * newline pleb Co-authored-by: joschiwald <736792+joschiwald@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `spell_script_names` WHERE `spell_id` = 47776 AND `ScriptName` = 'spell_item_worn_troll_dice';
|
||||||
|
INSERT INTO `spell_script_names` VALUES
|
||||||
|
(47776, 'spell_item_worn_troll_dice');
|
||||||
@@ -3904,17 +3904,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
|||||||
m_caster->TextEmote(buf);
|
m_caster->TextEmote(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Roll 'dem Bones - Worn Troll Dice
|
|
||||||
case 47776:
|
|
||||||
{
|
|
||||||
char buf[128];
|
|
||||||
const char* gender = "his";
|
|
||||||
if (m_caster->getGender() > 0)
|
|
||||||
gender = "her";
|
|
||||||
sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName().c_str(), gender, urand(1, 6), urand(1, 6));
|
|
||||||
m_caster->TextEmote(buf);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 52173: // Coyote Spirit Despawn
|
case 52173: // Coyote Spirit Despawn
|
||||||
case 60243: // Blood Parrot Despawn
|
case 60243: // Blood Parrot Despawn
|
||||||
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->IsSummon())
|
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->IsSummon())
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
@@ -3757,6 +3758,46 @@ class spell_item_green_whelp_armor : public AuraScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TrollDice
|
||||||
|
{
|
||||||
|
TEXT_WORN_TROLL_DICE = 26152
|
||||||
|
};
|
||||||
|
|
||||||
|
// 47776 - Roll 'dem Bones
|
||||||
|
class spell_item_worn_troll_dice : public SpellScript
|
||||||
|
{
|
||||||
|
PrepareSpellScript(spell_item_worn_troll_dice);
|
||||||
|
|
||||||
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
|
{
|
||||||
|
if (!sObjectMgr->GetBroadcastText(TEXT_WORN_TROLL_DICE))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Load() override
|
||||||
|
{
|
||||||
|
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
GetCaster()->TextEmote(TEXT_WORN_TROLL_DICE, GetHitUnit());
|
||||||
|
|
||||||
|
static uint32 const minimum = 1;
|
||||||
|
static uint32 const maximum = 6;
|
||||||
|
|
||||||
|
// roll twice
|
||||||
|
GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum);
|
||||||
|
GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_item_worn_troll_dice::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_item_spell_scripts()
|
void AddSC_item_spell_scripts()
|
||||||
{
|
{
|
||||||
RegisterSpellScript(spell_item_massive_seaforium_charge);
|
RegisterSpellScript(spell_item_massive_seaforium_charge);
|
||||||
@@ -3873,4 +3914,5 @@ void AddSC_item_spell_scripts()
|
|||||||
RegisterSpellScript(spell_item_snowman);
|
RegisterSpellScript(spell_item_snowman);
|
||||||
RegisterSpellScript(spell_item_freeze_rookery_egg);
|
RegisterSpellScript(spell_item_freeze_rookery_egg);
|
||||||
RegisterSpellScript(spell_item_green_whelp_armor);
|
RegisterSpellScript(spell_item_green_whelp_armor);
|
||||||
|
RegisterSpellScript(spell_item_worn_troll_dice);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user