aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWyrserth <wyrserth@protonmail.com>2019-07-17 19:32:07 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-16 21:20:39 +0100
commit96bca1fe2b690a16e741d8675f6d1f6d4467739b (patch)
treecea495a34e47a04dd74383c3fdab18995886b2b4 /src
parent1f8a6bac87e726f580247a601391e6286017468c (diff)
Script/BoreanTundra: move Pile of Fake Furs' script (related to quest Unfit for Death) from ItemScript to SpellScript.
Closes #21890. (cherry picked from commit e7cf24d2630058128e556b7d5bbb36f4a810695f)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp43
-rw-r--r--src/server/scripts/World/item_scripts.cpp68
2 files changed, 39 insertions, 72 deletions
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index 4a85c8c421d..6d488fd5112 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -395,12 +395,10 @@ public:
}
};
-/*######
-## npc_nesingwary_trapper
-######*/
-
enum NesingwaryTrapper
{
+ NPC_NESINGWARY_TRAPPER = 25835,
+
GO_HIGH_QUALITY_FUR = 187983,
GO_CARIBOU_TRAP_1 = 187982,
@@ -430,6 +428,42 @@ const uint32 CaribouTraps[CaribouTrapsNum] =
GO_CARIBOU_TRAP_11, GO_CARIBOU_TRAP_12, GO_CARIBOU_TRAP_13, GO_CARIBOU_TRAP_14, GO_CARIBOU_TRAP_15,
};
+class spell_q11865_place_fake_fur : public SpellScript
+{
+ PrepareSpellScript(spell_q11865_place_fake_fur);
+
+ bool Load() override
+ {
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void ActivateGameObject(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GameObject* go = GetHitGObj();
+ Player* player = GetCaster()->ToPlayer();
+
+ if (go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || go->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f))
+ return;
+
+ float x, y, z;
+ go->GetClosePoint(x, y, z, go->GetCombatReach() / 3, 7.0f);
+
+ go->SummonGameObject(GO_HIGH_QUALITY_FUR, go->GetPosition(), QuaternionData::fromEulerAnglesZYX(go->GetOrientation(), 0.0f, 0.0f), 20);
+ if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
+ {
+ summon->SetVisible(false);
+ summon->SetReactState(REACT_PASSIVE);
+ summon->SetImmuneToPC(true);
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q11865_place_fake_fur::ActivateGameObject, EFFECT_0, SPELL_EFFECT_ACTIVATE_OBJECT);
+ }
+};
+
class npc_nesingwary_trapper : public CreatureScript
{
public:
@@ -2555,6 +2589,7 @@ void AddSC_borean_tundra()
new npc_corastrasza();
new npc_iruk();
new npc_nerubar_victim();
+ RegisterSpellScript(spell_q11865_place_fake_fur);
new npc_nesingwary_trapper();
new npc_lurgglbr();
new spell_red_dragonblood();
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index f0e3c207b16..78e8c2b3498 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -190,73 +190,6 @@ public:
};
/*#####
-# item_pile_fake_furs
-#####*/
-
-enum PileFakeFur
-{
- GO_CARIBOU_TRAP_1 = 187982,
- GO_CARIBOU_TRAP_2 = 187995,
- GO_CARIBOU_TRAP_3 = 187996,
- GO_CARIBOU_TRAP_4 = 187997,
- GO_CARIBOU_TRAP_5 = 187998,
- GO_CARIBOU_TRAP_6 = 187999,
- GO_CARIBOU_TRAP_7 = 188000,
- GO_CARIBOU_TRAP_8 = 188001,
- GO_CARIBOU_TRAP_9 = 188002,
- GO_CARIBOU_TRAP_10 = 188003,
- GO_CARIBOU_TRAP_11 = 188004,
- GO_CARIBOU_TRAP_12 = 188005,
- GO_CARIBOU_TRAP_13 = 188006,
- GO_CARIBOU_TRAP_14 = 188007,
- GO_CARIBOU_TRAP_15 = 188008,
- GO_HIGH_QUALITY_FUR = 187983,
- NPC_NESINGWARY_TRAPPER = 25835
-};
-
-#define CaribouTrapsNum 15
-const uint32 CaribouTraps[CaribouTrapsNum] =
-{
- GO_CARIBOU_TRAP_1, GO_CARIBOU_TRAP_2, GO_CARIBOU_TRAP_3, GO_CARIBOU_TRAP_4, GO_CARIBOU_TRAP_5,
- GO_CARIBOU_TRAP_6, GO_CARIBOU_TRAP_7, GO_CARIBOU_TRAP_8, GO_CARIBOU_TRAP_9, GO_CARIBOU_TRAP_10,
- GO_CARIBOU_TRAP_11, GO_CARIBOU_TRAP_12, GO_CARIBOU_TRAP_13, GO_CARIBOU_TRAP_14, GO_CARIBOU_TRAP_15,
-};
-
-class item_pile_fake_furs : public ItemScript
-{
-public:
- item_pile_fake_furs() : ItemScript("item_pile_fake_furs") { }
-
- bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override
- {
- GameObject* go = nullptr;
- for (uint8 i = 0; i < CaribouTrapsNum; ++i)
- {
- go = player->FindNearestGameObject(CaribouTraps[i], 5.0f);
- if (go)
- break;
- }
-
- if (!go)
- return false;
-
- if (go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || go->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f))
- return true;
-
- float x, y, z;
- go->GetClosePoint(x, y, z, go->GetCombatReach() / 3, 7.0f);
- go->SummonGameObject(GO_HIGH_QUALITY_FUR, *go, QuaternionData::fromEulerAnglesZYX(go->GetOrientation(), 0.0f, 0.0f), 1);
- if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
- {
- summon->SetVisible(false);
- summon->SetReactState(REACT_PASSIVE);
- summon->SetImmuneToPC(true);
- }
- return false;
- }
-};
-
-/*#####
# item_petrov_cluster_bombs
#####*/
@@ -419,7 +352,6 @@ void AddSC_item_scripts()
new item_incendiary_explosives();
new item_mysterious_egg();
new item_disgusting_jar();
- new item_pile_fake_furs();
new item_petrov_cluster_bombs();
new item_dehta_trap_smasher();
new item_captured_frog();