Scripts/Spells: fixed Decahedral Dwarven Dice and Worn Troll Dice
This commit is contained in:
1 parent
f28d3d00de
commit
d647b5d6a1
6 files changed
+167
-43
No files matched your search
@@ -20619,6 +20619,11 @@ void Player::Say(std::string const& text, Language language, WorldObject const*
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
|
||||
}
|
||||
|
||||
void Player::Say(uint32 textId, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
Talk(textId, CHAT_MSG_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
|
||||
}
|
||||
|
||||
void Player::Yell(std::string const& text, Language language, WorldObject const* /*= nullptr*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
@@ -20629,6 +20634,11 @@ void Player::Yell(std::string const& text, Language language, WorldObject const*
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), true);
|
||||
}
|
||||
|
||||
void Player::Yell(uint32 textId, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
Talk(textId, CHAT_MSG_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
|
||||
}
|
||||
|
||||
void Player::TextEmote(std::string const& text, WorldObject const* /*= nullptr*/, bool /*= false*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
@@ -20639,6 +20649,11 @@ void Player::TextEmote(std::string const& text, WorldObject const* /*= nullptr*/
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT));
|
||||
}
|
||||
|
||||
void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
|
||||
{
|
||||
Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
|
||||
}
|
||||
|
||||
void Player::WhisperAddon(std::string const& text, const std::string& prefix, Player* receiver)
|
||||
{
|
||||
std::string _text(text);
|
||||
@@ -20688,6 +20703,24 @@ void Player::Whisper(std::string const& text, Language language, Player* target,
|
||||
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, target->GetName().c_str(), target->autoReplyMsg.c_str());
|
||||
}
|
||||
|
||||
void Player::Whisper(uint32 textId, Player* target, bool /*isBossWhisper = false*/)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
|
||||
if (!bct)
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "WorldObject::MonsterWhisper: `broadcast_text` was not %u found", textId);
|
||||
return;
|
||||
}
|
||||
|
||||
LocaleConstant locale = target->GetSession()->GetSessionDbLocaleIndex();
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
|
||||
target->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
Item* Player::GetMItem(uint32 id)
|
||||
{
|
||||
ItemMap::const_iterator itr = mMitems.find(id);
|
||||
@@ -27464,3 +27497,22 @@ void Player::RemoveRestFlag(RestFlag restFlag)
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Player::DoRandomRoll(uint32 minimum, uint32 maximum)
|
||||
{
|
||||
ASSERT(maximum <= 10000);
|
||||
|
||||
uint32 roll = urand(minimum, maximum);
|
||||
|
||||
WorldPacket data(MSG_RANDOM_ROLL, 4 + 4 + 4 + 8);
|
||||
data << uint32(minimum);
|
||||
data << uint32(maximum);
|
||||
data << uint32(roll);
|
||||
data << GetGUID();
|
||||
if (Group* group = GetGroup())
|
||||
group->BroadcastPacket(&data, false);
|
||||
else
|
||||
SendDirectMessage(&data);
|
||||
|
||||
return roll;
|
||||
}
|
||||
@@ -1284,12 +1284,16 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
/// Handles said message in regular chat based on declared language and in config pre-defined Range.
|
||||
void Say(std::string const& text, Language language, WorldObject const* = nullptr) override;
|
||||
void Say(uint32 textId, WorldObject const* target = nullptr) override;
|
||||
/// Handles yelled message in regular chat based on declared language and in config pre-defined Range.
|
||||
void Yell(std::string const& text, Language language, WorldObject const* = nullptr) override;
|
||||
void Yell(uint32 textId, WorldObject const* target = nullptr) override;
|
||||
/// Outputs an universal text which is supposed to be an action.
|
||||
void TextEmote(std::string const& text, WorldObject const* = nullptr, bool = false) override;
|
||||
void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false) override;
|
||||
/// Handles whispers from Addons and players based on sender, receiver's guid and language.
|
||||
void Whisper(std::string const& text, Language language, Player* receiver, bool = false) override;
|
||||
void Whisper(uint32 textId, Player* target, bool isBossWhisper = false) override;
|
||||
void WhisperAddon(std::string const& text, std::string const& prefix, Player* receiver);
|
||||
|
||||
/*********************************************************/
|
||||
@@ -2319,6 +2323,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
void SendCinematicStart(uint32 CinematicSequenceId) const;
|
||||
void SendMovieStart(uint32 MovieId) const;
|
||||
|
||||
uint32 DoRandomRoll(uint32 minimum, uint32 maximum);
|
||||
|
||||
/*********************************************************/
|
||||
/*** INSTANCE SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
@@ -2156,11 +2156,11 @@ class Unit : public WorldObject
|
||||
virtual void Yell(std::string const& text, Language language, WorldObject const* target = nullptr);
|
||||
virtual void TextEmote(std::string const& text, WorldObject const* target = nullptr, bool isBossEmote = false);
|
||||
virtual void Whisper(std::string const& text, Language language, Player* target, bool isBossWhisper = false);
|
||||
void Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject const* target);
|
||||
void Say(uint32 textId, WorldObject const* target = nullptr);
|
||||
void Yell(uint32 textId, WorldObject const* target = nullptr);
|
||||
void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false);
|
||||
void Whisper(uint32 textId, Player* target, bool isBossWhisper = false);
|
||||
virtual void Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject const* target);
|
||||
virtual void Say(uint32 textId, WorldObject const* target = nullptr);
|
||||
virtual void Yell(uint32 textId, WorldObject const* target = nullptr);
|
||||
virtual void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false);
|
||||
virtual void Whisper(uint32 textId, Player* target, bool isBossWhisper = false);
|
||||
|
||||
protected:
|
||||
explicit Unit (bool isWorldObject);
|
||||
|
||||
@@ -694,9 +694,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received MSG_RANDOM_ROLL");
|
||||
|
||||
uint32 minimum, maximum, roll;
|
||||
uint32 minimum, maximum;
|
||||
recvData >> minimum;
|
||||
recvData >> maximum;
|
||||
|
||||
@@ -706,19 +704,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData)
|
||||
/********************/
|
||||
|
||||
// everything's fine, do it
|
||||
roll = urand(minimum, maximum);
|
||||
|
||||
//TC_LOG_DEBUG("misc", "ROLL: MIN: %u, MAX: %u, ROLL: %u", minimum, maximum, roll);
|
||||
|
||||
WorldPacket data(MSG_RANDOM_ROLL, 4+4+4+8);
|
||||
data << uint32(minimum);
|
||||
data << uint32(maximum);
|
||||
data << uint32(roll);
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
if (GetPlayer()->GetGroup())
|
||||
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
|
||||
else
|
||||
SendPacket(&data);
|
||||
GetPlayer()->DoRandomRoll(minimum, maximum);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
|
||||
|
||||
@@ -3469,28 +3469,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
|
||||
break;
|
||||
}
|
||||
// Roll Dice - Decahedral Dwarven Dice
|
||||
case 47770:
|
||||
{
|
||||
char buf[128];
|
||||
const char *gender = "his";
|
||||
if (m_caster->getGender() > 0)
|
||||
gender = "her";
|
||||
sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName().c_str(), gender, gender, urand(1, 10), urand(1, 10));
|
||||
m_caster->TextEmote(buf);
|
||||
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;
|
||||
}
|
||||
// Death Knight Initiate Visual
|
||||
case 51519:
|
||||
{
|
||||
|
||||
@@ -201,6 +201,55 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 47770 - Roll Dice
|
||||
class spell_item_decahedral_dwarven_dice : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_item_decahedral_dwarven_dice() : SpellScriptLoader("spell_item_decahedral_dwarven_dice") { }
|
||||
|
||||
class spell_item_decahedral_dwarven_dice_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_decahedral_dwarven_dice_SpellScript);
|
||||
|
||||
enum
|
||||
{
|
||||
TEXT_DECAHEDRAL_DWARVEN_DICE = 26147
|
||||
};
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
if (!sObjectMgr->GetBroadcastText(TEXT_DECAHEDRAL_DWARVEN_DICE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->TextEmote(TEXT_DECAHEDRAL_DWARVEN_DICE, GetHitUnit());
|
||||
|
||||
static uint32 const minimum = 1;
|
||||
static uint32 const maximum = 100;
|
||||
|
||||
GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_decahedral_dwarven_dice_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_item_decahedral_dwarven_dice_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 8342 - Defibrillate (Goblin Jumper Cables) have 33% chance on success
|
||||
// 22999 - Defibrillate (Goblin Jumper Cables XL) have 50% chance on success
|
||||
// 54732 - Defibrillate (Gnomish Army Knife) have 67% chance on success
|
||||
@@ -1319,6 +1368,57 @@ class spell_item_underbelly_elixir : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 47776 - Roll 'dem Bones
|
||||
class spell_item_worn_troll_dice : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_item_worn_troll_dice() : SpellScriptLoader("spell_item_worn_troll_dice") { }
|
||||
|
||||
class spell_item_worn_troll_dice_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_worn_troll_dice_SpellScript);
|
||||
|
||||
enum
|
||||
{
|
||||
TEXT_WORN_TROLL_DICE = 26152
|
||||
};
|
||||
|
||||
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_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_item_worn_troll_dice_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum AirRifleSpells
|
||||
{
|
||||
SPELL_AIR_RIFLE_HOLD_VISUAL = 65582,
|
||||
@@ -2637,6 +2737,7 @@ void AddSC_item_spell_scripts()
|
||||
new spell_item_aegis_of_preservation();
|
||||
new spell_item_arcane_shroud();
|
||||
new spell_item_blessing_of_ancient_kings();
|
||||
new spell_item_decahedral_dwarven_dice();
|
||||
new spell_item_defibrillate("spell_item_goblin_jumper_cables", 67, SPELL_GOBLIN_JUMPER_CABLES_FAIL);
|
||||
new spell_item_defibrillate("spell_item_goblin_jumper_cables_xl", 50, SPELL_GOBLIN_JUMPER_CABLES_XL_FAIL);
|
||||
new spell_item_defibrillate("spell_item_gnomish_army_knife", 33);
|
||||
@@ -2661,6 +2762,7 @@ void AddSC_item_spell_scripts()
|
||||
new spell_item_six_demon_bag();
|
||||
new spell_item_the_eye_of_diminution();
|
||||
new spell_item_underbelly_elixir();
|
||||
new spell_item_worn_troll_dice();
|
||||
new spell_item_red_rider_air_rifle();
|
||||
|
||||
new spell_item_create_heart_candy();
|
||||
|
||||
Reference in new issue
Block a user