@@ -30,6 +30,7 @@ EndContentData */
30
30
#include " ScriptMgr.h"
31
31
#include " CellImpl.h"
32
32
#include " CreatureAIImpl.h"
33
+ #include " DBCStores.h"
33
34
#include " GameObjectAI.h"
34
35
#include " GridNotifiersImpl.h"
35
36
#include " MotionMaster.h"
@@ -1069,6 +1070,131 @@ class spell_bem_wicked_strong_fetish : public SpellScript
1069
1070
}
1070
1071
};
1071
1072
1073
+ enum TheSmallestCreature
1074
+ {
1075
+ SPELL_CHARM_REXXARS_RODENT = 38586 ,
1076
+ SPELL_COAX_MARMOT = 38544 ,
1077
+ SPELL_STEALTH_MARMOT = 42347 ,
1078
+ SPELL_GREEN_EYE_GROG_CREDIT = 38996 ,
1079
+ SPELL_RIPE_MOONSHINE_CREDIT = 38997 ,
1080
+ SPELL_FERMENTED_SEED_BEER_CREDIT = 38998 ,
1081
+
1082
+ NPC_MARMOT = 22189 ,
1083
+ NPC_GREEN_SPOT_GROG_KEG_CREDIT = 22356 ,
1084
+ NPC_RIPE_MOONSHINE_KEG_CREDIT = 22367 ,
1085
+ NPC_FERMENTED_SEED_BEER_KEG_CREDIT = 22368
1086
+ };
1087
+
1088
+ struct npc_q10720_keg_credit : public ScriptedAI
1089
+ {
1090
+ npc_q10720_keg_credit (Creature * creature) : ScriptedAI(creature)
1091
+ {
1092
+ // Neccessary hack to allow spell 38629 to hit the keg credit (visibility is checked against the summoner, not the caster)
1093
+ creature->m_invisibilityDetect .AddFlag (INVISIBILITY_UNK4);
1094
+ }
1095
+ };
1096
+
1097
+ struct npc_q10720_marmot : public ScriptedAI
1098
+ {
1099
+ using ScriptedAI::ScriptedAI;
1100
+
1101
+ void IsSummonedBy (WorldObject* summoner) override
1102
+ {
1103
+ summoner->CastSpell (me, SPELL_CHARM_REXXARS_RODENT, true );
1104
+ }
1105
+ };
1106
+
1107
+ // 38544 - Coax Marmot
1108
+ class spell_bem_coax_marmot : public AuraScript
1109
+ {
1110
+ PrepareAuraScript (spell_bem_coax_marmot);
1111
+
1112
+ void HandleEffectApply (AuraEffect const * /* aurEff*/ , AuraEffectHandleModes /* mode*/ )
1113
+ {
1114
+ // prevent loading the aura from db
1115
+ if (GetTarget ()->GetCharmedGUID ().IsEmpty ())
1116
+ Remove ();
1117
+ }
1118
+
1119
+ void HandleEffectRemove (AuraEffect const * /* aurEff*/ , AuraEffectHandleModes /* mode*/ )
1120
+ {
1121
+ if (Creature* marmot = Object::ToCreature (GetTarget ()->GetCharmed ()))
1122
+ if (marmot->GetUInt32Value (UNIT_CREATED_BY_SPELL) == SPELL_COAX_MARMOT)
1123
+ marmot->DespawnOrUnsummon ();
1124
+ }
1125
+
1126
+ void Register () override
1127
+ {
1128
+ AfterEffectApply += AuraEffectApplyFn (spell_bem_coax_marmot::HandleEffectApply, EFFECT_1, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL);
1129
+ AfterEffectRemove += AuraEffectApplyFn (spell_bem_coax_marmot::HandleEffectRemove, EFFECT_1, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL);
1130
+ }
1131
+ };
1132
+
1133
+ // 38586 - [DND]Charm Rexxar's Rodent
1134
+ class spell_bem_charm_rexxars_rodent : public AuraScript
1135
+ {
1136
+ PrepareAuraScript (spell_bem_charm_rexxars_rodent);
1137
+
1138
+ void OnRemove (AuraEffect const * /* aurEff*/ , AuraEffectHandleModes /* mode*/ )
1139
+ {
1140
+ if (Unit* caster = GetCaster ())
1141
+ caster->RemoveAurasDueToSpell (SPELL_COAX_MARMOT);
1142
+
1143
+ if (Creature* creature = GetTarget ()->ToCreature ())
1144
+ creature->DespawnOrUnsummon (1ms);
1145
+ }
1146
+
1147
+ void Register () override
1148
+ {
1149
+ AfterEffectRemove += AuraEffectRemoveFn (spell_bem_charm_rexxars_rodent::OnRemove, EFFECT_0, SPELL_AURA_MOD_POSSESS, AURA_EFFECT_HANDLE_REAL);
1150
+ }
1151
+ };
1152
+
1153
+ // 38629 - Poison Keg
1154
+ class spell_bem_q10720_poison_keg : public SpellScript
1155
+ {
1156
+ PrepareSpellScript (spell_bem_q10720_poison_keg);
1157
+
1158
+ bool Validate (SpellInfo const * /* spellEntry*/ ) override
1159
+ {
1160
+ return ValidateSpellInfo (
1161
+ {
1162
+ SPELL_GREEN_EYE_GROG_CREDIT,
1163
+ SPELL_RIPE_MOONSHINE_CREDIT,
1164
+ SPELL_FERMENTED_SEED_BEER_CREDIT
1165
+ });
1166
+ }
1167
+
1168
+ void HandleScriptEffect (SpellEffIndex /* effIndex*/ )
1169
+ {
1170
+ if (Player* player = GetCaster ()->GetCharmerOrOwnerPlayerOrPlayerItself ())
1171
+ {
1172
+ uint32 spellId = 0 ;
1173
+ switch (GetHitUnit ()->GetEntry ())
1174
+ {
1175
+ case NPC_GREEN_SPOT_GROG_KEG_CREDIT:
1176
+ spellId = SPELL_GREEN_EYE_GROG_CREDIT;
1177
+ break ;
1178
+ case NPC_RIPE_MOONSHINE_KEG_CREDIT:
1179
+ spellId = SPELL_RIPE_MOONSHINE_CREDIT;
1180
+ break ;
1181
+ case NPC_FERMENTED_SEED_BEER_KEG_CREDIT:
1182
+ spellId = SPELL_FERMENTED_SEED_BEER_CREDIT;
1183
+ break ;
1184
+ default :
1185
+ return ;
1186
+ }
1187
+
1188
+ player->CastSpell (nullptr , spellId, true );
1189
+ }
1190
+ }
1191
+
1192
+ void Register () override
1193
+ {
1194
+ OnEffectHitTarget += SpellEffectFn (spell_bem_q10720_poison_keg::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
1195
+ }
1196
+ };
1197
+
1072
1198
void AddSC_blades_edge_mountains ()
1073
1199
{
1074
1200
new npc_nether_drake ();
@@ -1080,4 +1206,9 @@ void AddSC_blades_edge_mountains()
1080
1206
new spell_oscillating_field ();
1081
1207
RegisterSpellScript (spell_bem_dispelling_analysis);
1082
1208
RegisterSpellScript (spell_bem_wicked_strong_fetish);
1209
+ RegisterCreatureAI (npc_q10720_keg_credit);
1210
+ RegisterCreatureAI (npc_q10720_marmot);
1211
+ RegisterSpellScript (spell_bem_coax_marmot);
1212
+ RegisterSpellScript (spell_bem_charm_rexxars_rodent);
1213
+ RegisterSpellScript (spell_bem_q10720_poison_keg);
1083
1214
}
0 commit comments