Script/BoreanTundra: move Pile of Fake Furs' script (related to quest Unfit for Death) from ItemScript to SpellScript.

Closes #21890.
This commit is contained in:
Wyrserth
2019-07-17 19:32:07 +02:00
parent c52c0f0b7d
commit e7cf24d263
3 changed files with 62 additions and 72 deletions

View File

@@ -0,0 +1,23 @@
--
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=46085;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(17, 0, 46085, 0, 0, 30, 0, 187982, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 1, 30, 0, 187995, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 2, 30, 0, 187996, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 3, 30, 0, 187997, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 4, 30, 0, 187998, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 5, 30, 0, 187999, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 6, 30, 0, 188000, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 7, 30, 0, 188001, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 8, 30, 0, 188002, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 9, 30, 0, 188003, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 10, 30, 0, 188004, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 11, 30, 0, 188005, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 12, 30, 0, 188006, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 13, 30, 0, 188007, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap"),
(17, 0, 46085, 0, 14, 30, 0, 188008, 2, 0, 0, 0, 0, "", "Place Fake Fur can only be cast within 2 yards of Caribou Trap");
UPDATE `item_template` SET `ScriptName`="" WHERE `entry`=35127;
DELETE FROM `spell_script_names` WHERE `ScriptName`="spell_q11865_place_fake_fur";
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(46085, "spell_q11865_place_fake_fur");

View File

@@ -394,12 +394,10 @@ public:
}
};
/*######
## npc_nesingwary_trapper
######*/
enum NesingwaryTrapper
{
NPC_NESINGWARY_TRAPPER = 25835,
GO_HIGH_QUALITY_FUR = 187983,
GO_CARIBOU_TRAP_1 = 187982,
@@ -432,6 +430,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(), 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:
@@ -2557,6 +2591,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();

View File

@@ -189,73 +189,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*/) 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(), 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
#####*/
@@ -421,7 +354,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();