TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
item_pile_fake_furs Class Reference

Public Member Functions

 item_pile_fake_furs ()
 
bool OnUse (Player *player, Item *, SpellCastTargets const &) override
 
- Public Member Functions inherited from ItemScript
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Item *)
 
virtual bool OnQuestAccept (Player *, Item *, Quest const *)
 
virtual bool OnExpire (Player *, ItemTemplate const *)
 
virtual bool OnRemove (Player *, Item *)
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Additional Inherited Members

- Protected Member Functions inherited from ItemScript
 ItemScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

item_pile_fake_furs::item_pile_fake_furs ( )
inline
224 : ItemScript("item_pile_fake_furs") { }
ItemScript(const char *name)
Definition: ScriptMgr.cpp:1580

Member Function Documentation

bool item_pile_fake_furs::OnUse ( Player player,
Item ,
SpellCastTargets const  
)
inlineoverridevirtual

Reimplemented from ItemScript.

227  {
228  GameObject* go = NULL;
229  for (uint8 i = 0; i < CaribouTrapsNum; ++i)
230  {
231  go = player->FindNearestGameObject(CaribouTraps[i], 5.0f);
232  if (go)
233  break;
234  }
235 
236  if (!go)
237  return false;
238 
240  return true;
241 
242  float x, y, z;
243  go->GetClosePoint(x, y, z, go->GetObjectSize() / 3, 7.0f);
244  go->SummonGameObject(GO_HIGH_QUALITY_FUR, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 0, 0, 0, 0, 1);
245  if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
246  {
247  summon->SetVisible(false);
248  summon->SetReactState(REACT_PASSIVE);
250  }
251  return false;
252  }
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition: Object.cpp:2372
#define CaribouTrapsNum
Definition: item_scripts.cpp:213
Definition: TemporarySummon.h:40
Definition: Unit.h:1129
GameObject * FindNearestGameObject(uint32 entry, float range) const
Definition: Object.cpp:2452
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Object.h:60
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2443
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
Definition: Unit.h:681
const uint32 CaribouTraps[CaribouTrapsNum]
Definition: item_scripts.cpp:214
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
Definition: item_scripts.cpp:209
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
Definition: GameObject.h:880
Definition: item_scripts.cpp:210
Definition: UpdateFields.h:109
uint8_t uint8
Definition: Define.h:152
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104
float GetObjectSize() const
Definition: Object.cpp:2656
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition: Object.cpp:2623

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: