Erik Strandberg authored and Aokromes committed 2017-12-10 00:37:21 +00:00
1 parent dcc4d29276
commit a3b16c040b
122 files changed
+6029 -5246

No files matched your search

-181
View File
@@ -1560,78 +1560,6 @@ bool ScriptMgr::OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo co
return tmpscript->OnCastItemCombatSpell(player, victim, spellInfo, item);
}
bool ScriptMgr::OnGossipHello(Player* player, Creature* creature)
{
ASSERT(player);
ASSERT(creature);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnGossipHello(player, creature);
}
bool ScriptMgr::OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
{
ASSERT(player);
ASSERT(creature);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, false);
return tmpscript->OnGossipSelect(player, creature, sender, action);
}
bool ScriptMgr::OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code)
{
ASSERT(player);
ASSERT(creature);
ASSERT(code);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, false);
return tmpscript->OnGossipSelectCode(player, creature, sender, action, code);
}
bool ScriptMgr::OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
{
ASSERT(player);
ASSERT(creature);
ASSERT(quest);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnQuestAccept(player, creature, quest);
}
bool ScriptMgr::OnQuestSelect(Player* player, Creature* creature, Quest const* quest)
{
ASSERT(player);
ASSERT(creature);
ASSERT(quest);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnQuestSelect(player, creature, quest);
}
bool ScriptMgr::OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt)
{
ASSERT(player);
ASSERT(creature);
ASSERT(quest);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnQuestReward(player, creature, quest, opt);
}
uint32 ScriptMgr::GetDialogStatus(Player* player, Creature* creature)
{
ASSERT(player);
ASSERT(creature);
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, DIALOG_STATUS_SCRIPTED_NO_STATUS);
player->PlayerTalkClass->ClearMenus();
return tmpscript->GetDialogStatus(player, creature);
}
bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureTemplate const* actTemplate, CreatureData const* cData, Map const* map)
{
ASSERT(actTemplate);
@@ -1662,115 +1590,6 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject)
return tmpscript->GetAI(gameobject);
}
void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
{
ASSERT(creature);
GET_SCRIPT(CreatureScript, creature->GetScriptId(), tmpscript);
tmpscript->OnUpdate(creature, diff);
}
bool ScriptMgr::OnGossipHello(Player* player, GameObject* go)
{
ASSERT(player);
ASSERT(go);
GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnGossipHello(player, go);
}
bool ScriptMgr::OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action)
{
ASSERT(player);
ASSERT(go);
GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, false);
return tmpscript->OnGossipSelect(player, go, sender, action);
}
bool ScriptMgr::OnGossipSelectCode(Player* player, GameObject* go, uint32 sender, uint32 action, const char* code)
{
ASSERT(player);
ASSERT(go);
ASSERT(code);
GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, false);
return tmpscript->OnGossipSelectCode(player, go, sender, action, code);
}
bool ScriptMgr::OnQuestAccept(Player* player, GameObject* go, Quest const* quest)
{
ASSERT(player);
ASSERT(go);
ASSERT(quest);
GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnQuestAccept(player, go, quest);
}
bool ScriptMgr::OnQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt)
{
ASSERT(player);
ASSERT(go);
ASSERT(quest);
GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, false);
player->PlayerTalkClass->ClearMenus();
return tmpscript->OnQuestReward(player, go, quest, opt);
}
uint32 ScriptMgr::GetDialogStatus(Player* player, GameObject* go)
{
ASSERT(player);
ASSERT(go);
GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, DIALOG_STATUS_SCRIPTED_NO_STATUS);
player->PlayerTalkClass->ClearMenus();
return tmpscript->GetDialogStatus(player, go);
}
void ScriptMgr::OnGameObjectDestroyed(GameObject* go, Player* player)
{
ASSERT(go);
GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
tmpscript->OnDestroyed(go, player);
}
void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player)
{
ASSERT(go);
GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
tmpscript->OnDamaged(go, player);
}
void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit)
{
ASSERT(go);
GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
tmpscript->OnLootStateChanged(go, state, unit);
}
void ScriptMgr::OnGameObjectStateChanged(GameObject* go, uint32 state)
{
ASSERT(go);
GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
tmpscript->OnGameObjectStateChanged(go, state);
}
void ScriptMgr::OnGameObjectUpdate(GameObject* go, uint32 diff)
{
ASSERT(go);
GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
tmpscript->OnUpdate(go, diff);
}
bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
{
ASSERT(player);
+3 -73
View File
@@ -403,7 +403,7 @@ class TC_GAME_API UnitScript : public ScriptObject
virtual void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/) { }
};
class TC_GAME_API CreatureScript : public UnitScript, public UpdatableScript<Creature>
class TC_GAME_API CreatureScript : public UnitScript
{
protected:
@@ -411,32 +411,11 @@ class TC_GAME_API CreatureScript : public UnitScript, public UpdatableScript<Cre
public:
// Called when a player opens a gossip dialog with the creature.
virtual bool OnGossipHello(Player* /*player*/, Creature* /*creature*/) { return false; }
// Called when a player selects a gossip item in the creature's gossip menu.
virtual bool OnGossipSelect(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
// Called when a player selects a gossip with a code in the creature's gossip menu.
virtual bool OnGossipSelectCode(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
// Called when a player accepts a quest from the creature.
virtual bool OnQuestAccept(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
// Called when a player selects a quest in the creature's quest menu.
virtual bool OnQuestSelect(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
virtual bool OnQuestReward(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
// Called when the dialog status between a player and the creature is requested.
virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
// Called when the creature tries to spawn. Return false to block spawn and re-evaluate on next tick.
virtual bool CanSpawn(ObjectGuid::LowType /*spawnId*/, uint32 /*entry*/, CreatureTemplate const* /*baseTemplate*/, CreatureTemplate const* /*actTemplate*/, CreatureData const* /*cData*/, Map const* /*map*/) const { return true; }
// Called when a CreatureAI object is needed for the creature.
virtual CreatureAI* GetAI(Creature* /*creature*/) const { return NULL; }
virtual CreatureAI* GetAI(Creature* /*creature*/) const = 0;
};
class TC_GAME_API GameObjectScript : public ScriptObject, public UpdatableScript<GameObject>
@@ -447,38 +426,8 @@ class TC_GAME_API GameObjectScript : public ScriptObject, public UpdatableScript
public:
// Called when a player opens a gossip dialog with the gameobject.
virtual bool OnGossipHello(Player* /*player*/, GameObject* /*go*/) { return false; }
// Called when a player selects a gossip item in the gameobject's gossip menu.
virtual bool OnGossipSelect(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
// Called when a player selects a gossip with a code in the gameobject's gossip menu.
virtual bool OnGossipSelectCode(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
// Called when a player accepts a quest from the gameobject.
virtual bool OnQuestAccept(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/) { return false; }
// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
virtual bool OnQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
// Called when the dialog status between a player and the gameobject is requested.
virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
// Called when the game object is destroyed (destructible buildings only).
virtual void OnDestroyed(GameObject* /*go*/, Player* /*player*/) { }
// Called when the game object is damaged (destructible buildings only).
virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { }
// Called when the game object loot state is changed.
virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
// Called when the game object state is changed.
virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { }
// Called when a GameObjectAI object is needed for the gameobject.
virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; }
virtual GameObjectAI* GetAI(GameObject* /*go*/) const = 0;
};
class TC_GAME_API AreaTriggerScript : public ScriptObject
@@ -952,30 +901,11 @@ class TC_GAME_API ScriptMgr
public: /* CreatureScript */
bool OnGossipHello(Player* player, Creature* creature);
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action);
bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code);
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest);
bool OnQuestSelect(Player* player, Creature* creature, Quest const* quest);
bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt);
uint32 GetDialogStatus(Player* player, Creature* creature);
bool CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureTemplate const* actTemplate, CreatureData const* cData, Map const* map);
CreatureAI* GetCreatureAI(Creature* creature);
void OnCreatureUpdate(Creature* creature, uint32 diff);
public: /* GameObjectScript */
bool OnGossipHello(Player* player, GameObject* go);
bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action);
bool OnGossipSelectCode(Player* player, GameObject* go, uint32 sender, uint32 action, const char* code);
bool OnQuestAccept(Player* player, GameObject* go, Quest const* quest);
bool OnQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt);
uint32 GetDialogStatus(Player* player, GameObject* go);
void OnGameObjectDestroyed(GameObject* go, Player* player);
void OnGameObjectDamaged(GameObject* go, Player* player);
void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit);
void OnGameObjectStateChanged(GameObject* go, uint32 state);
void OnGameObjectUpdate(GameObject* go, uint32 diff);
GameObjectAI* GetGameObjectAI(GameObject* go);
public: /* AreaTriggerScript */