*Event Hooks (OnLogin, OnLogout, OnPVPKill) by Hawthorne
*Boss Emote Command for DB Scripts by XTElite1 --HG-- branch : trunk
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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" ))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user