aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/CharacterHandler.cpp5
-rw-r--r--src/game/Map.cpp2
-rw-r--r--src/game/ObjectMgr.cpp7
-rw-r--r--src/game/ScriptCalls.cpp3
-rw-r--r--src/game/ScriptCalls.h9
-rw-r--r--src/game/Unit.cpp9
-rw-r--r--src/game/World.h2
-rw-r--r--src/game/WorldSession.cpp4
8 files changed, 37 insertions, 4 deletions
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index becf81d9c04..c65c923a31e 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -42,6 +42,7 @@
#include "SocialMgr.h"
#include "UpdateMask.h"
#include "Util.h"
+#include "ScriptCalls.h"
class LoginQueryHolder : public SqlQueryHolder
{
@@ -812,6 +813,10 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
m_playerLoading = false;
+
+ //Hook for OnLogin Event
+ Script->OnLogin(pCurrChar);
+
delete holder;
}
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index ee6ca6f8291..2953236bcbd 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -2866,7 +2866,7 @@ void Map::ScriptsProcess()
sLog.outError("SCRIPT_COMMAND_TALK call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
}
- if(step.script->datalong > 3)
+ if(step.script->datalong > 4)
{
sLog.outError("SCRIPT_COMMAND_TALK invalid chat type (%u), skipping.",step.script->datalong);
break;
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index a1e19eb178a..2f4bad688ef 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -4297,7 +4297,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
{
case SCRIPT_COMMAND_TALK:
{
- if(tmp.datalong > 3)
+ if(tmp.datalong > 4)
{
sLog.outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id);
continue;
@@ -8377,7 +8377,10 @@ void ObjectMgr::LoadScriptNames()
}
barGoLink bar( result->GetRowCount() );
- uint32 count = 0;
+
+ //OnEvent Changes
+ m_scriptNames.push_back("scripted_on_events");
+ uint32 count = 1;
do
{
diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp
index b8870c2a1dd..8a075448daf 100644
--- a/src/game/ScriptCalls.cpp
+++ b/src/game/ScriptCalls.cpp
@@ -59,6 +59,9 @@ bool LoadScriptingModule(char const* libName)
}
if( !(testScript->ScriptsInit =(scriptCallScriptsInit )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" ))
+ ||!(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->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" ))
diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h
index 0eae69cb505..bb6ecee3b89 100644
--- a/src/game/ScriptCalls.h
+++ b/src/game/ScriptCalls.h
@@ -37,6 +37,11 @@ class InstanceData;
bool LoadScriptingModule(char const* libName = "");
void UnloadScriptingModule();
+//On Event Handlers
+typedef void(TRINITY_IMPORT * scriptCallOnLogin) (Player *pPlayer);
+typedef void(TRINITY_IMPORT * scriptCallOnLogout) (Player *pPlayer);
+typedef void(TRINITY_IMPORT * scriptCallOnPVPKill) (Player *killer, Player *killed);
+
typedef void(TRINITY_IMPORT * scriptCallScriptsInit) (char const*);
typedef void(TRINITY_IMPORT * scriptCallScriptsFree) ();
typedef char const* (TRINITY_IMPORT * scriptCallScriptsVersion) ();
@@ -72,6 +77,10 @@ typedef struct
scriptCallScriptsFree ScriptsFree;
scriptCallScriptsVersion ScriptsVersion;
+ scriptCallOnLogin OnLogin;
+ scriptCallOnLogout OnLogout;
+ scriptCallOnPVPKill OnPVPKill;
+
scriptCallGossipHello GossipHello;
scriptCallGOChooseReward GOChooseReward;
scriptCallQuestAccept QuestAccept;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index e73f8ec80de..607018cd8cb 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -53,6 +53,7 @@
#include "TemporarySummon.h"
#include "Vehicle.h"
#include "Transports.h"
+#include "ScriptCalls.h"
#include <math.h>
@@ -778,6 +779,14 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
Kill(pVictim, durabilityLoss);
+
+ //Hook for OnPVPKill Event
+ if (pVictim->GetTypeId() == TYPEID_PLAYER && this->GetTypeId() == TYPEID_PLAYER)
+ {
+ Player *killer = ((Player*)this);
+ Player *killed = ((Player*)pVictim);
+ Script->OnPVPKill(killer, killed);
+ }
}
else // if (health <= damage)
{
diff --git a/src/game/World.h b/src/game/World.h
index 9d5085c3b7f..6cd1fb6a82e 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -386,7 +386,7 @@ enum RealmZone
};
// DB scripting commands
-#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong ( 0=say, 1=whisper, 2=yell, 3=emote text)
+#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong (0=say, 1=whisper, 2=yell, 3=emote text, 4=boss emote text)
#define SCRIPT_COMMAND_EMOTE 1 // source = unit, datalong = anim_id
#define SCRIPT_COMMAND_FIELD_SET 2 // source = any, datalong = field_id, datalog2 = value
#define SCRIPT_COMMAND_MOVE_TO 3 // source = Creature, datalog2 = time, x/y/z
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index d80ede80bc7..4cb251d6524 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -40,6 +40,7 @@
#include "MapManager.h"
#include "SocialMgr.h"
#include "zlib/zlib.h"
+#include "ScriptCalls.h"
/// WorldSession constructor
WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) :
@@ -451,6 +452,9 @@ void WorldSession::LogoutPlayer(bool Save)
sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" );
}
+ //Hook for OnLogout Event
+ Script->OnLogout(_player);
+
m_playerLogout = false;
m_playerRecentlyLogout = true;
LogoutRequest(0);