*add 11 new event hooks to the OnEvents system, by Hawthorne
--HG-- branch : trunk
This commit is contained in:
@@ -244,6 +244,94 @@ void OnPVPKill(Player *killer, Player *killed)
|
||||
tmpscript->pOnPVPKill(killer, killed);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool OnSpellCast (Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnSpellCast) return true;
|
||||
return tmpscript->pOnSpellCast(pUnitTarget,pItemTarget,pGoTarget,i,spell);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
uint32 OnGetXP(Player *pPlayer, uint32 amount)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnGetXP) return amount;
|
||||
return tmpscript->pOnGetXP(pPlayer,amount);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
uint32 OnGetMoney(Player *pPlayer, int32 amount)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnGetMoney) return amount;
|
||||
return tmpscript->pOnGetMoney(pPlayer,amount);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool OnPlayerChat(Player *pPlayer, const char *text)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnPlayerChat) return true;
|
||||
return tmpscript->pOnPlayerChat(pPlayer,text);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
void OnServerStartup()
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnServerStartup) return;
|
||||
tmpscript->pOnServerStartup();
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
void OnServerShutdown()
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnServerShutdown) return;
|
||||
tmpscript->pOnServerShutdown();
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnAreaChange) return;
|
||||
tmpscript->pOnAreaChange(pPlayer, pArea);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool OnItemClick (Player *pPlayer, Item *pItem)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnItemClick) return true;
|
||||
return tmpscript->pOnItemClick(pPlayer,pItem);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool OnItemOpen (Player *pPlayer, Item *pItem)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnItemOpen) return true;
|
||||
return tmpscript->pOnItemOpen(pPlayer,pItem);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool OnGoClick (Player *pPlayer, GameObject *pGameObject)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnGoClick) return true;
|
||||
return tmpscript->pOnGoClick(pPlayer,pGameObject);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
void OnCreatureKill (Player *pPlayer, Creature *pCreature)
|
||||
{
|
||||
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
|
||||
if (!tmpscript || !tmpscript->pOnCreatureKill) return;
|
||||
tmpscript->pOnCreatureKill(pPlayer,pCreature);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
char const* ScriptsVersion()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,17 @@ struct Script
|
||||
void (*pOnLogin )(Player*);
|
||||
void (*pOnLogout )(Player*);
|
||||
void (*pOnPVPKill )(Player*, Player*);
|
||||
bool (*pOnSpellCast )(Unit*, Item*, GameObject*, uint32, SpellEntry const*);
|
||||
uint32 (*pOnGetXP )(Player*, uint32);
|
||||
int32 (*pOnGetMoney )(Player*, int32);
|
||||
bool (*pOnPlayerChat )(Player*, const char*);
|
||||
void (*pOnServerStartup )();
|
||||
void (*pOnServerShutdown )();
|
||||
void (*pOnAreaChange )(Player*, AreaTableEntry const*);
|
||||
bool (*pOnItemClick )(Player*, Item*);
|
||||
bool (*pOnItemOpen )(Player*, Item*);
|
||||
bool (*pOnGoClick )(Player*, GameObject*);
|
||||
void (*pOnCreatureKill )(Player*, Creature*);
|
||||
bool (*pGossipHello )(Player*, Creature*);
|
||||
bool (*pQuestAccept )(Player*, Creature*, Quest const* );
|
||||
bool (*pGossipSelect )(Player*, Creature*, uint32 , uint32 );
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "CombatAI.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Chat.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
|
||||
@@ -17,6 +17,71 @@ void OnLogout(Player *pPlayer)
|
||||
void OnPVPKill(Player *killer, Player *killed)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//This function is called when a players AreaID changes
|
||||
void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//This is called when a player kills a creature (non pvp)
|
||||
void OnCreatureKill(Player *pPlayer, Creature *pCreature)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//This function is called when a player has a money exchange
|
||||
int32 OnGetMoney(Player *pPlayer, int32 amount)
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
|
||||
//This function is called whenever a player gets XP
|
||||
uint32 OnGetXP(Player *pPlayer, uint32 amount)
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
|
||||
//This function is called when a player clicks a GO Object
|
||||
bool OnGoClick(Player *pPlayer, GameObject *pGameObject)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//This function is called when a player clicks and item
|
||||
bool OnItemClick(Player *pPlayer, Item *pItem)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//This function is called when a player opens an item (like a clam)
|
||||
bool OnItemOpen(Player *pPlayer, Item *pItem)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//This function is called when a player sends a chat message
|
||||
bool OnPlayerChat(Player *pPlayer, const char *text)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//this function is called when the server starts
|
||||
void OnServerStartup()
|
||||
{
|
||||
|
||||
}
|
||||
//this function is called when the server shuts down
|
||||
void OnServerShutdown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//this function is called when a player casts a spell
|
||||
bool OnSpellCast(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddSC_onevents()
|
||||
@@ -27,5 +92,17 @@ void OnPVPKill(Player *killer, Player *killed)
|
||||
newscript->pOnLogin = &OnLogin;
|
||||
newscript->pOnLogout = &OnLogout;
|
||||
newscript->pOnPVPKill = &OnPVPKill;
|
||||
newscript->pOnAreaChange = &OnAreaChange;
|
||||
newscript->pOnCreatureKill = &OnCreatureKill;
|
||||
newscript->pOnGetMoney = &OnGetMoney;
|
||||
newscript->pOnGetXP = &OnGetXP;
|
||||
newscript->pOnGoClick = &OnGoClick;
|
||||
newscript->pOnItemClick = &OnItemClick;
|
||||
newscript->pOnItemOpen = &OnItemOpen;
|
||||
newscript->pOnPlayerChat = &OnPlayerChat;
|
||||
newscript->pOnServerShutdown = &OnServerShutdown;
|
||||
newscript->pOnServerStartup = &OnServerStartup;
|
||||
newscript->pOnSpellCast = &OnSpellCast;
|
||||
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
|
||||
@@ -1368,3 +1368,48 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
data << uint8(0); // 4 - equipment swap failed - inventory is full
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleOnPVPKill(Player *killed)
|
||||
{
|
||||
Script->OnPVPKill(GetPlayer(), killed);
|
||||
}
|
||||
|
||||
bool WorldSession::HandleOnPlayerChat(const char *text)
|
||||
{
|
||||
return Script->OnPlayerChat(GetPlayer(), text);
|
||||
}
|
||||
|
||||
uint32 WorldSession::HandleOnGetXP(uint32 amount)
|
||||
{
|
||||
return Script->OnGetXP(GetPlayer(), amount);
|
||||
}
|
||||
|
||||
int32 WorldSession::HandleOnGetMoney(int32 amount)
|
||||
{
|
||||
return Script->OnGetMoney(GetPlayer(), amount);
|
||||
}
|
||||
|
||||
void WorldSession::HandleOnAreaChange(AreaTableEntry const *pArea)
|
||||
{
|
||||
Script->OnAreaChange(GetPlayer(), pArea);
|
||||
}
|
||||
|
||||
bool WorldSession::HandleOnItemClick(Item *pItem)
|
||||
{
|
||||
return Script->OnItemClick(GetPlayer(), pItem);
|
||||
}
|
||||
|
||||
bool WorldSession::HandleOnItemOpen(Item *pItem)
|
||||
{
|
||||
return Script->OnItemOpen(GetPlayer(), pItem);
|
||||
}
|
||||
|
||||
bool WorldSession::HandleOnGoClick(GameObject *pGameObject)
|
||||
{
|
||||
return Script->OnGoClick(GetPlayer(), pGameObject);
|
||||
}
|
||||
|
||||
void WorldSession::HandleOnCreatureKill(Creature *pCreature)
|
||||
{
|
||||
Script->OnCreatureKill(GetPlayer(), pCreature);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "ScriptCalls.h"
|
||||
|
||||
// Supported shift-links (client generated and server side)
|
||||
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
|
||||
@@ -1049,6 +1050,9 @@ int ChatHandler::ParseCommands(const char* text)
|
||||
|
||||
std::string fullcmd = text;
|
||||
|
||||
if(!m_session->HandleOnPlayerChat(text))
|
||||
return 0;
|
||||
|
||||
/// chat case (.command or !command format)
|
||||
if (m_session)
|
||||
{
|
||||
|
||||
+2
-1
@@ -76,6 +76,7 @@ class TRINITY_DLL_SPEC ChatHandler
|
||||
static ChatCommand* getCommandTable();
|
||||
|
||||
bool isValidChatMessage(const char* msg);
|
||||
void SendGlobalSysMessage(const char *str);
|
||||
protected:
|
||||
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
|
||||
|
||||
@@ -91,7 +92,7 @@ class TRINITY_DLL_SPEC ChatHandler
|
||||
bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
|
||||
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
|
||||
|
||||
void SendGlobalSysMessage(const char *str);
|
||||
|
||||
void SendGlobalGMSysMessage(const char *str);
|
||||
|
||||
static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand );
|
||||
|
||||
+21
-1
@@ -2498,7 +2498,7 @@ void Player::GiveXP(uint32 xp, Unit* victim)
|
||||
level = getLevel();
|
||||
nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
|
||||
}
|
||||
|
||||
newXP = GetSession()->HandleOnGetXP(newXP);
|
||||
SetUInt32Value(PLAYER_XP, newXP);
|
||||
}
|
||||
|
||||
@@ -6003,6 +6003,14 @@ void Player::CheckExploreSystem()
|
||||
if (isInFlight())
|
||||
return;
|
||||
|
||||
if(!m_AreaID)
|
||||
m_AreaID = GetAreaId();
|
||||
if(m_AreaID != GetAreaId())
|
||||
{
|
||||
m_AreaID = GetAreaId();
|
||||
GetSession()->HandleOnAreaChange(GetAreaEntryByAreaID(m_AreaID));
|
||||
}
|
||||
|
||||
uint16 areaFlag = GetBaseMap()->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ());
|
||||
if(areaFlag==0xffff)
|
||||
return;
|
||||
@@ -22089,3 +22097,15 @@ void Player::ActivateSpec(uint8 spec)
|
||||
SetPower(pw, 0);
|
||||
}
|
||||
|
||||
void Player::SetReputation(uint32 factionentry, uint32 value)
|
||||
{
|
||||
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry),value);
|
||||
}
|
||||
uint32 Player::GetReputation(uint32 factionentry)
|
||||
{
|
||||
return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
|
||||
}
|
||||
std::string Player::GetGuildName()
|
||||
{
|
||||
return objmgr.GetGuildById(GetGuildId())->GetName();
|
||||
}
|
||||
|
||||
+5
-2
@@ -1365,6 +1365,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||
uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); }
|
||||
void ModifyMoney( int32 d )
|
||||
{
|
||||
d = GetSession()->HandleOnGetMoney(d);
|
||||
if(d < 0)
|
||||
SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
|
||||
else
|
||||
@@ -1464,7 +1465,9 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||
void learnSpellHighRank(uint32 spellid);
|
||||
void AddTemporarySpell(uint32 spellId);
|
||||
void RemoveTemporarySpell(uint32 spellId);
|
||||
|
||||
void SetReputation(uint32 factionentry, uint32 value);
|
||||
uint32 GetReputation(uint32 factionentry);
|
||||
std::string GetGuildName();
|
||||
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
|
||||
void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); }
|
||||
bool resetTalents(bool no_cost = false);
|
||||
@@ -2220,7 +2223,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||
void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
|
||||
Spell * m_spellModTakingSpell;
|
||||
protected:
|
||||
|
||||
uint32 m_AreaID;
|
||||
uint32 m_regenTimerCount;
|
||||
float m_powerFraction[MAX_POWERS];
|
||||
uint32 m_contestedPvPTimer;
|
||||
|
||||
@@ -62,6 +62,20 @@ bool LoadScriptingModule(char const* libName)
|
||||
||!(testScript->OnLogin =(scriptCallOnLogin )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogin" ))
|
||||
||!(testScript->OnLogout =(scriptCallOnLogout )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogout" ))
|
||||
||!(testScript->OnPVPKill =(scriptCallOnPVPKill )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnPVPKill" ))
|
||||
||!(testScript->OnLogin =(scriptCallOnLogin )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogin" ))
|
||||
||!(testScript->OnLogout =(scriptCallOnLogout )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnLogout" ))
|
||||
||!(testScript->OnPVPKill =(scriptCallOnPVPKill )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnPVPKill" ))
|
||||
||!(testScript->OnSpellCast =(scriptCallOnSpellCast )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnSpellCast" ))
|
||||
||!(testScript->OnGetXP =(scriptCallOnGetXP )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnGetXP" ))
|
||||
||!(testScript->OnGetMoney =(scriptCallOnGetMoney )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnGetMoney" ))
|
||||
||!(testScript->OnPlayerChat =(scriptCallOnPlayerChat )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnPlayerChat" ))
|
||||
||!(testScript->OnServerStartup =(scriptCallOnServerStartup )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnServerStartup" ))
|
||||
||!(testScript->OnServerShutdown =(scriptCallOnServerShutdown )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnServerShutdown" ))
|
||||
||!(testScript->OnAreaChange =(scriptCallOnAreaChange )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnAreaChange" ))
|
||||
||!(testScript->OnItemClick =(scriptCallOnItemClick )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnItemClick" ))
|
||||
||!(testScript->OnItemOpen =(scriptCallOnItemOpen )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnItemOpen" ))
|
||||
||!(testScript->OnGoClick =(scriptCallOnGoClick )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnGoClick" ))
|
||||
||!(testScript->OnCreatureKill =(scriptCallOnCreatureKill )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"OnCreatureKill" ))
|
||||
||!(testScript->ScriptsFree =(scriptCallScriptsFree )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" ))
|
||||
||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" ))
|
||||
||!(testScript->GossipHello =(scriptCallGossipHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" ))
|
||||
|
||||
+22
-1
@@ -41,6 +41,17 @@ void UnloadScriptingModule();
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnLogin) (Player *pPlayer);
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnLogout) (Player *pPlayer);
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnPVPKill) (Player *killer, Player *killed);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallOnSpellCast)(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell);
|
||||
typedef uint32(TRINITY_IMPORT * scriptCallOnGetXP) (Player *pPlayer, uint32 amount);
|
||||
typedef int32(TRINITY_IMPORT * scriptCallOnGetMoney) (Player *pPlayer, int32 amount);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallOnPlayerChat) (Player *pPlayer, const char *text);
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnServerStartup) ();
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnServerShutdown) ();
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnAreaChange) (Player *pPlayer, AreaTableEntry const *pArea);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallOnItemClick) (Player *pPlayer, Item *pItem);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallOnItemOpen) (Player *pPlayer, Item *pItem);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallOnGoClick) (Player *pPlayer, GameObject *pGameObject);
|
||||
typedef void(TRINITY_IMPORT * scriptCallOnCreatureKill) (Player *pPlayer, Creature *pCreature);
|
||||
|
||||
typedef void(TRINITY_IMPORT * scriptCallScriptsInit) (char const*);
|
||||
typedef void(TRINITY_IMPORT * scriptCallScriptsFree) ();
|
||||
@@ -80,7 +91,17 @@ typedef struct
|
||||
scriptCallOnLogin OnLogin;
|
||||
scriptCallOnLogout OnLogout;
|
||||
scriptCallOnPVPKill OnPVPKill;
|
||||
|
||||
scriptCallOnSpellCast OnSpellCast;
|
||||
scriptCallOnGetXP OnGetXP;
|
||||
scriptCallOnGetMoney OnGetMoney;
|
||||
scriptCallOnPlayerChat OnPlayerChat;
|
||||
scriptCallOnServerStartup OnServerStartup;
|
||||
scriptCallOnServerShutdown OnServerShutdown;
|
||||
scriptCallOnAreaChange OnAreaChange;
|
||||
scriptCallOnItemClick OnItemClick;
|
||||
scriptCallOnItemOpen OnItemOpen;
|
||||
scriptCallOnGoClick OnGoClick;
|
||||
scriptCallOnCreatureKill OnCreatureKill;
|
||||
scriptCallGossipHello GossipHello;
|
||||
scriptCallGOChooseReward GOChooseReward;
|
||||
scriptCallQuestAccept QuestAccept;
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "Util.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ScriptCalls.h"
|
||||
|
||||
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
|
||||
|
||||
@@ -4306,6 +4307,10 @@ void Spell::HandleThreatSpells(uint32 spellId)
|
||||
|
||||
void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i)
|
||||
{
|
||||
|
||||
if(!Script->OnSpellCast(pUnitTarget,pItemTarget,pGOTarget,i,m_spellInfo))
|
||||
return;
|
||||
|
||||
//effect has been handled, skip it
|
||||
if(m_effectMask & (1<<i))
|
||||
return;
|
||||
|
||||
@@ -189,6 +189,9 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!pUser->GetSession()->HandleOnItemOpen(pItem))
|
||||
return;
|
||||
|
||||
// locked item
|
||||
uint32 lockId = proto->LockID;
|
||||
if(lockId)
|
||||
|
||||
+7
-1
@@ -785,7 +785,13 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
{
|
||||
Player *killer = ((Player*)this);
|
||||
Player *killed = ((Player*)pVictim);
|
||||
Script->OnPVPKill(killer, killed);
|
||||
killer->GetSession()->HandleOnPVPKill(killed);
|
||||
}
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && this->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player *killer = ((Player*)this);
|
||||
Creature *pCreature = ((Creature*)pVictim);
|
||||
killer->GetSession()->HandleOnCreatureKill(pCreature);
|
||||
}
|
||||
}
|
||||
else // if (health <= damage)
|
||||
|
||||
@@ -1678,6 +1678,8 @@ void World::SetInitialWorldSettings()
|
||||
sLog.SetLogDBLater(false);
|
||||
}
|
||||
|
||||
Script->OnServerStartup();
|
||||
|
||||
sLog.outString("WORLD: World initialized");
|
||||
}
|
||||
|
||||
@@ -2294,6 +2296,8 @@ void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
|
||||
m_ShutdownTimer = time;
|
||||
ShutdownMsg(true);
|
||||
}
|
||||
|
||||
Script->OnServerShutdown();
|
||||
}
|
||||
|
||||
/// Display a shutdown message to the user(s)
|
||||
|
||||
@@ -736,6 +736,15 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
void HandleEquipmentSetSave(WorldPacket& recv_data);
|
||||
void HandleEquipmentSetDelete(WorldPacket& recv_data);
|
||||
void HandleEquipmentSetUse(WorldPacket& recv_data);
|
||||
void HandleOnPVPKill(Player *killed);
|
||||
bool HandleOnPlayerChat(const char *text);
|
||||
uint32 HandleOnGetXP(uint32 amount);
|
||||
int32 HandleOnGetMoney(int32 amount);
|
||||
void HandleOnAreaChange(AreaTableEntry const *pArea);
|
||||
bool HandleOnItemClick(Item *pItem);
|
||||
bool HandleOnItemOpen(Item *pItem);
|
||||
bool HandleOnGoClick(GameObject *pGameObject);
|
||||
void HandleOnCreatureKill(Creature *pCreature);
|
||||
private:
|
||||
// private trade methods
|
||||
void moveItems(Item* myItems[], Item* hisItems[]);
|
||||
|
||||
Reference in New Issue
Block a user