bool ItemUse_item_pile_fake_furs(Player *pPlayer, Item * /*pItem*/, SpellCastTargets const & /*targets*/) { GameObject *pGo = NULL; for (uint8 i = 0; i < CaribouTrapsNum; ++i) { pGo = pPlayer->FindNearestGameObject(CaribouTraps[i], 5.0f); if (pGo) break; } if (!pGo) return false; if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f)) return true; float x, y, z; pGo->GetClosePoint(x, y, z, pGo->GetObjectSize() / 3, 7.0f); pGo->SummonGameObject(GO_HIGH_QUALITY_FUR, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, 0, 0, 0, 0, 1000); if (TempSummon* summon = pPlayer->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, pGo->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000)) { summon->SetVisibility(VISIBILITY_OFF); summon->SetReactState(REACT_PASSIVE); summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } return false; }
bool ItemUse_item_pile_fake_furs(Player *pPlayer, Item *pItem, SpellCastTargets const &targets) { GameObject *pGo; if ((pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_1, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_2, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_3, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_4, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_5, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_6, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_7, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_8, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_9, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_10, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_11, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_12, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_13, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_14, 5.0f)) || (pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_15, 5.0f))) { if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f)) return true; float x, y, z; pGo->GetClosePoint(x, y, z, pGo->GetObjectSize() / 3, 7.0f); pGo->SummonGameObject(GO_HIGH_QUALITY_FUR, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, 0, 0, 0, 0, 1000); if (TempSummon* summon = pPlayer->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, pGo->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000)) { summon->SetVisibility(VISIBILITY_OFF); summon->SetReactState(REACT_PASSIVE); summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } } return false; }
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/) { GameObject* go = NULL; 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->GetObjectSize() / 3, 7.0f); go->SummonGameObject(GO_HIGH_QUALITY_FUR, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 0, 0, 0, 0, 1000); 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->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } return false; }
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; }