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

Public Member Functions

 item_tainted_core ()
 
bool OnUse (Player *player, Item *, SpellCastTargets const &targets) 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_tainted_core::item_tainted_core ( )
inline
886 : ItemScript("item_tainted_core") { }
ItemScript(const char *name)
Definition: ScriptMgr.cpp:1580

Member Function Documentation

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

Reimplemented from ItemScript.

889  {
890  InstanceScript* instance = player->GetInstanceScript();
891  if (!instance)
892  {
893  player->GetSession()->SendNotification(TEXT_NOT_INITIALIZED);
894  return true;
895  }
896 
897  Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetGuidData(DATA_LADYVASHJ));
898  if (vashj && (ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2))
899  {
900  if (GameObject* gObj = targets.GetGOTarget())
901  {
902  uint32 identifier;
903  uint8 channelIdentifier;
904  switch (gObj->GetEntry())
905  {
906  case 185052:
907  identifier = DATA_SHIELDGENERATOR1;
908  channelIdentifier = 0;
909  break;
910  case 185053:
911  identifier = DATA_SHIELDGENERATOR2;
912  channelIdentifier = 1;
913  break;
914  case 185051:
915  identifier = DATA_SHIELDGENERATOR3;
916  channelIdentifier = 2;
917  break;
918  case 185054:
919  identifier = DATA_SHIELDGENERATOR4;
920  channelIdentifier = 3;
921  break;
922  default:
923  return true;
924  }
925 
926  if (instance->GetData(identifier))
927  {
928  player->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED);
929  return true;
930  }
931 
932  // get and remove channel
933  if (Unit* channel = ObjectAccessor::GetCreature(*vashj, ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier]))
934  channel->setDeathState(JUST_DIED); // call Unsummon()
935 
936  instance->SetData(identifier, 1);
937 
938  // remove this item
939  player->DestroyItemCount(31088, 1, true);
940  return true;
941  }
942  else if (targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT)
943  return false;
944  else if (targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER)
945  {
946  player->DestroyItemCount(31088, 1, true);
947  player->CastSpell(targets.GetUnitTarget(), 38134, true);
948  return true;
949  }
950  }
951  return true;
952  }
Definition: Unit.h:542
Definition: serpent_shrine.h:47
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
Definition: ObjectGuid.h:32
Definition: Creature.h:467
Definition: boss_lady_vashj.cpp:146
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
CreatureAI * AI() const
Definition: Creature.h:525
Definition: serpent_shrine.h:44
uint32_t uint32
Definition: Define.h:150
Definition: serpent_shrine.h:39
Definition: GameObject.h:880
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
Definition: serpent_shrine.h:45
Definition: ObjectGuid.h:33
Definition: InstanceScript.h:141
uint8_t uint8
Definition: Define.h:152
Definition: serpent_shrine.h:46
Definition: Unit.h:1305
Phase
Definition: boss_kiljaeden.cpp:153
#define TEXT_ALREADY_DEACTIVATED
Definition: boss_lady_vashj.cpp:76
#define TEXT_NOT_INITIALIZED
Definition: boss_lady_vashj.cpp:75

+ Here is the call graph for this function:


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