1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Massivly modified project structure in server_zone

This commit is contained in:
Mordred 2017-08-18 17:16:15 +02:00
parent e4d2c3464c
commit d3f6fc9a67
82 changed files with 473 additions and 1271 deletions

View file

@ -2,7 +2,7 @@
#define _ACTION_H_
#include <Server_Common/Common.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core { namespace Action {

View file

@ -6,10 +6,10 @@
#include <Server_Common/ExdData.h>
#include <Server_Common/Logger.h>
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "Player.h"
#include "ScriptManager.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
using namespace Core::Common;
using namespace Core::Network;

View file

@ -1,7 +1,7 @@
#ifndef _ACTIONCAST_H_
#define _ACTIONCAST_H_
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "Action.h"
namespace Core { namespace Action {

View file

@ -4,9 +4,9 @@
#include <Server_Common/ExdData.h>
#include <Server_Common/Logger.h>
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "Player.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Actor/Player.h"
using namespace Core::Common;
using namespace Core::Network;

View file

@ -1,7 +1,7 @@
#ifndef _ACTIONTELEPORT_H_
#define _ACTIONTELEPORT_H_
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "Action.h"
namespace Core { namespace Action {

View file

@ -3,10 +3,10 @@
#include <Server_Common/ExdData.h>
#include "EventAction.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "Player.h"
#include "Event.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Event/Event.h"
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;

View file

@ -3,8 +3,8 @@
#include <Server_Common/Common.h>
#include "Forwards.h"
#include "Action.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Action/Action.h"
namespace Core { namespace Action {

View file

@ -1,11 +1,14 @@
#include "EventItemAction.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include <Server_Common/Util.h>
#include <Server_Common/UtilMath.h>
#include <Server_Common/Logger.h>
#include <string.h>
#include "Player.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
extern Core::Logger g_log;

View file

@ -1,8 +1,8 @@
#ifndef _EVENTITEMACTION_H_
#define _EVENTITEMACTION_H_
#include "Forwards.h"
#include "Action.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Action/Action.h"
namespace Core { namespace Action {

View file

@ -2,21 +2,21 @@
#include <Server_Common/UtilMath.h>
#include <Server_Common/PacketContainer.h>
#include "Forwards.h"
#include "Action.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "Actor.h"
#include "Zone.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include <Server_Common/GamePacket.h>
#include "GameConnection.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "UpdateHpMpTpPacket.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/UpdateHpMpTpPacket.h"
#include "StatusEffectContainer.h"
#include "StatusEffect.h"
#include "ServerZone.h"
#include "Session.h"
#include "src/servers/Server_Zone/StatusEffect/StatusEffectContainer.h"
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Session.h"
#include "Player.h"
extern Core::ServerZone g_serverZone;

View file

@ -4,7 +4,7 @@
#include <Server_Common/Common.h>
#include <boost/enable_shared_from_this.hpp>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include <set>
#include <map>

View file

@ -12,10 +12,10 @@
#include "Player.h"
#include "BattleNpc.h"
#include "MoveActorPacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "StatusEffectContainer.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/MoveActorPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/StatusEffect/StatusEffectContainer.h"
using namespace Core::Common;
using namespace Core::Network::Packets;

View file

@ -8,42 +8,42 @@
#include <Server_Common/ExdData.h>
#include <Server_Common/PacketContainer.h>
#include "Session.h"
#include "src/servers/Server_Zone/Session.h"
#include "Player.h"
#include "BattleNpc.h"
#include "ZoneMgr.h"
#include "Zone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "ServerZone.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "InitUIPacket.h"
#include "ServerNoticePacket.h"
#include "ChatPacket.h"
#include "ModelEquipPacket.h"
#include "ActorSpawnPacket.h"
#include "UpdateHpMpTpPacket.h"
#include "PlayerStateFlagsPacket.h"
#include "PlayerSpawnPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ChatPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ModelEquipPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorSpawnPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/UpdateHpMpTpPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerSpawnPacket.h"
#include "ScriptManager.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
#include "StatusEffectContainer.h"
#include "src/servers/Server_Zone/StatusEffect/StatusEffectContainer.h"
#include "Item.h"
#include "src/servers/Server_Zone/Inventory/Item.h"
#include "Inventory.h"
#include "Event.h"
#include "Action.h"
#include "EventAction.h"
#include "EventItemAction.h"
#include "ZonePosition.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Event/Event.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "src/servers/Server_Zone/Action/EventAction.h"
#include "src/servers/Server_Zone/Action/EventItemAction.h"
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
#include <boost/make_shared.hpp>
extern Core::Logger g_log;

View file

@ -1,12 +1,12 @@
#ifndef _PLAYER_H
#define _PLAYER_H
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include <Server_Common/Common.h>
#include "Actor.h"
#include "Inventory.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include <map>
#include <queue>

View file

@ -5,19 +5,19 @@
#include "Player.h"
#include "Zone.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "GameConnection.h"
#include "ActorControlPacket142.h"
#include "InitUIPacket.h"
#include "ServerNoticePacket.h"
#include "EventStartPacket.h"
#include "EventPlayPacket.h"
#include "EventFinishPacket.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventStartPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventPlayPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h"
#include "Event.h"
#include "src/servers/Server_Zone/Event/Event.h"
extern Core::Logger g_log;

View file

@ -2,15 +2,15 @@
#include "Player.h"
#include "ZoneMgr.h"
#include "Zone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include <Server_Common/GamePacket.h>
#include "ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "Inventory.h"
#include "Item.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Inventory/Item.h"
using namespace Core::Common;
using namespace Core::Network::Packets;

View file

@ -5,13 +5,13 @@
#include <Server_Common/ExdData.h>
#include <Server_Common/PacketContainer.h>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "QuestMessagePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/QuestMessagePacket.h"
#include "Session.h"
#include "src/servers/Server_Zone/Session.h"
#include "Player.h"
#include "Inventory.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"

View file

@ -15,17 +15,17 @@
#include "Player.h"
#include "ZoneMgr.h"
#include "Zone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "ServerZone.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "GameConnection.h"
#include "InitUIPacket.h"
#include "StatusEffectContainer.h"
#include "Inventory.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/StatusEffect/StatusEffectContainer.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
extern Core::Logger g_log;
extern Core::Db::Database g_database;

View file

@ -1,13 +1,27 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0014 OLD)
project(Sapphire_Zone)
include_directories("../../libraries/external/ChaiScript-6.0.0/include/")
include_directories("../../libraries/sapphire/datReader/")
include_directories("../")
file(GLOB SERVER_PUBLIC_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*")
file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
file(GLOB SERVER_PUBLIC_INCLUDE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/Script/*)
file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.c*
Actor/*.c*
Action/*.c*
DebugCommand/*.c*
Event/*.c*
Inventory/*.c*
Network/*.c*
Network/Handlers/*.c*
Network/PacketWrappers/*.c*
Script/*.c*
StatusEffect/*.c*
Zone/*.c*)
set(SERVER_COMMON_DIR ../Server_Common)
set(Boost_USE_STATIC_LIBS ON)
@ -54,6 +68,7 @@ else()
endif()
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Script)
include_directories(${Boost_INCLUDE_DIR})

View file

@ -3,21 +3,21 @@
#include <Server_Common/Common.h>
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
class GameCommandHandler;
class DebugCommandHandler;
// CGameCommand is used to define in game text command callbacks
// TODO it should probably be renamed to something more intuitive
// TODO the command identifier, currently '@' should probably be defined in here aswell so it is easily replaced
class GameCommand
class DebugCommand
{
public:
typedef void (GameCommandHandler::*pFunc)(char *, Entity::PlayerPtr, boost::shared_ptr<GameCommand>);
typedef void ( DebugCommandHandler::*pFunc )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
// String for the command
std::string m_commandName;
@ -31,7 +31,7 @@ namespace Core {
// userlevel needed to execute the command
Common::UserLevel m_userLevel;
GameCommand(const std::string& n, pFunc functionPtr, const std::string& hText, Common::UserLevel uLevel)
DebugCommand( const std::string& n, pFunc functionPtr, const std::string& hText, Common::UserLevel uLevel )
{
m_commandName = n;
m_pFunc = functionPtr;
@ -39,7 +39,7 @@ namespace Core {
m_userLevel = uLevel;
}
~GameCommand()
~DebugCommand()
{
}

View file

@ -9,25 +9,25 @@
#include <Server_Common/Logger.h>
#include <Server_Common/ExdData.h>
#include "GameCommand.h"
#include "GameCommandHandler.h"
#include "DebugCommand.h"
#include "DebugCommandHandler.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "InitUIPacket.h"
#include "GameConnection.h"
#include "ScriptManager.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
#include "Player.h"
#include "BattleNpc.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Actor/BattleNpc.h"
#include "Zone.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "ServerZone.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "StatusEffect.h"
#include "Session.h"
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
#include "src/servers/Server_Zone/Session.h"
#include <boost/make_shared.hpp>
extern Core::Db::Database g_database;
@ -37,40 +37,40 @@ extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
// instanciate and initialize commands
Core::GameCommandHandler::GameCommandHandler()
Core::DebugCommandHandler::DebugCommandHandler()
{
// Push all commands onto the register map
registerCommand( "set", &GameCommandHandler::set, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "get", &GameCommandHandler::get, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "add", &GameCommandHandler::add, "Loads and injects a premade Packet.", Common::UserLevel::all );
//registerCommand( "debug", &GameCommandHandler::debug, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "inject", &GameCommandHandler::injectPacket, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "script_reload", &GameCommandHandler::scriptReload, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "nudge", &GameCommandHandler::nudge, "Nudges you forward/up/down", Common::UserLevel::all );
registerCommand( "set", &DebugCommandHandler::set, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "get", &DebugCommandHandler::get, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "add", &DebugCommandHandler::add, "Loads and injects a premade Packet.", Common::UserLevel::all );
//registerCommand( "debug", &DebugCommandHandler::debug, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "inject", &DebugCommandHandler::injectPacket, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "script_reload", &DebugCommandHandler::scriptReload, "Loads and injects a premade Packet.", Common::UserLevel::all );
registerCommand( "nudge", &DebugCommandHandler::nudge, "Nudges you forward/up/down", Common::UserLevel::all );
}
// clear all loaded commands
Core::GameCommandHandler::~GameCommandHandler()
Core::DebugCommandHandler::~DebugCommandHandler()
{
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it )
( *it ).second.reset();
}
// add a command set to the register map
void Core::GameCommandHandler::registerCommand( const std::string& n, Core::GameCommand::pFunc functionPtr,
void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::DebugCommand::pFunc functionPtr,
const std::string& hText, Core::Common::UserLevel uLevel )
{
m_commandMap[std::string( n )] = boost::make_shared<GameCommand>( n, functionPtr, hText, uLevel );
m_commandMap[std::string( n )] = boost::make_shared<DebugCommand>( n, functionPtr, hText, uLevel );
}
// try to retrieve the command in question, execute if found
void Core::GameCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
{
// define callback pointer
void ( GameCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< GameCommand > );
void ( DebugCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
std::string commandString;
@ -109,13 +109,13 @@ void Core::GameCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr
// Definition of the commands
///////////////////////////////////////////////////////////////////////////////////////
void Core::GameCommandHandler::scriptReload( char * data, Core::Entity::PlayerPtr pPlayer,
boost::shared_ptr<Core::GameCommand> command )
void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerPtr pPlayer,
boost::shared_ptr<Core::DebugCommand> command )
{
g_scriptMgr.reload();
}
void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::GameCommand> command )
void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
{
std::string subCommand = "";
std::string params = "";
@ -285,7 +285,7 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
}
void Core::GameCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::GameCommand> command )
void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
{
std::string subCommand;
std::string params = "";
@ -421,7 +421,7 @@ void Core::GameCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer
}
void Core::GameCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::GameCommand> command )
void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
{
std::string subCommand;
std::string params = "";
@ -461,14 +461,14 @@ void Core::GameCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlayer
}
void Core::GameCommandHandler::injectPacket( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::GameCommand > command )
void Core::DebugCommandHandler::injectPacket( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
{
auto pSession = g_serverZone.getSession( pPlayer->getId() );
if( pSession )
pSession->getZoneConnection()->injectPacket( data + 7, pPlayer );
}
void Core::GameCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command )
void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command )
{
std::string subCommand;

View file

@ -3,39 +3,39 @@
#include <map>
#include "GameCommand.h"
#include "DebugCommand.h"
#include <Server_Common/Common.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
// handler for in game commands
class GameCommandHandler
class DebugCommandHandler
{
private:
// container mapping command string to command object
std::map<std::string, boost::shared_ptr<GameCommand> > m_commandMap;
std::map<std::string, boost::shared_ptr<DebugCommand> > m_commandMap;
public:
GameCommandHandler();
~GameCommandHandler();
DebugCommandHandler();
~DebugCommandHandler();
// register command to command map
void registerCommand( const std::string& n, GameCommand::pFunc, const std::string& hText, Common::UserLevel uLevel );
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, Common::UserLevel uLevel );
// execute command if registered
void execCommand( char * data, Entity::PlayerPtr pPlayer );
// command handler callbacks
void set( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
void get( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
void add( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
//void debug( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
void scriptReload( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
void set( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void get( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void add( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
//void debug( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void scriptReload( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void injectPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
void injectPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
};

View file

@ -1,7 +1,7 @@
#ifndef _EVENT_H
#define _EVENT_H
#include "Forwards.h"
#include "../Forwards.h"
namespace Core {
namespace Event {

View file

@ -6,17 +6,17 @@
#include "Inventory.h"
#include "Player.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "ItemContainer.h"
#include "Item.h"
#include "ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include <boost/lexical_cast.hpp>
#include "Forwards.h"
#include "ActorControlPacket143.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
extern Core::Logger g_log;
extern Core::Db::Database g_database;

View file

@ -2,7 +2,7 @@
#define INVENTORY_H_
#include <map>
#include <Server_Common/Common.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core
{

View file

@ -1,11 +1,11 @@
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "ItemContainer.h"
#include <Server_Common/Common.h>
#include <Server_Common/Logger.h>
#include <Server_Common/Database.h>
#include "Player.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "Item.h"

View file

@ -6,7 +6,7 @@
#include <Server_Common/Common.h>
#include "Forwards.h"
#include "../Forwards.h"
namespace Core
{

View file

@ -9,20 +9,15 @@
#include "GameConnection.h"
#include "ServerZone.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "Session.h"
#include "Zone.h"
#include "InitUIPacket.h"
#include "GameCommandHandler.h"
#include "Player.h"
#include "Forwards.h"
extern Core::GameCommandHandler g_gameCommandMgr;
extern Core::DebugCommandHandler g_gameCommandMgr;
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;

View file

@ -10,7 +10,7 @@
#include <Server_Common/LockedQueue.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#define DECLARE_HANDLER( x ) void x( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )

View file

@ -9,45 +9,40 @@
#include <boost/format.hpp>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "Session.h"
#include "Zone.h"
#include "ZonePosition.h"
#include "ServerZone.h"
#include "ZoneMgr.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "InitUIPacket.h"
#include "PingPacket.h"
#include "MoveActorPacket.h"
#include "ChatPacket.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "EventStartPacket.h"
#include "EventFinishPacket.h"
#include "PlayerStateFlagsPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PingPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/MoveActorPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ChatPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventStartPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "GameCommandHandler.h"
#include "Player.h"
#include "Inventory.h"
#include "Forwards.h"
#include "EventHelper.h"
#include "Action.h"
#include "ActionTeleport.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Event/EventHelper.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "src/servers/Server_Zone/Action/ActionTeleport.h"
extern Core::Logger g_log;
extern Core::Db::Database g_database;
extern Core::ServerZone g_serverZone;
extern Core::ZoneMgr g_zoneMgr;
extern Core::Data::ExdData g_exdData;
extern Core::GameCommandHandler g_gameCommandMgr;
extern Core::DebugCommandHandler g_gameCommandMgr;
using namespace Core::Common;
using namespace Core::Network::Packets;

View file

@ -1,26 +1,19 @@
#include <Server_Common/Common.h>
#include <Server_Common/CommonNetwork.h>
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/Logger.h>
#include <Server_Common/PacketContainer.h>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "Session.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "PlayerStateFlagsPacket.h"
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"

View file

@ -5,23 +5,19 @@
#include <boost/format.hpp>
#include "GameConnection.h"
#include "Session.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "EventStartPacket.h"
#include "EventFinishPacket.h"
#include "PlayerStateFlagsPacket.h"
#include "ScriptManager.h"
#include "Player.h"
#include "Forwards.h"
#include "EventHelper.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventStartPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Event/EventHelper.h"
extern Core::Scripting::ScriptManager g_scriptMgr;

View file

@ -8,46 +8,40 @@
#include <boost/format.hpp>
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "GameConnection.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "Session.h"
#include "Zone.h"
#include "ZonePosition.h"
#include "ServerZone.h"
#include "ZoneMgr.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PingPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/MoveActorPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ChatPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventStartPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "InitUIPacket.h"
#include "PingPacket.h"
#include "MoveActorPacket.h"
#include "ChatPacket.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "EventStartPacket.h"
#include "EventFinishPacket.h"
#include "PlayerStateFlagsPacket.h"
#include "GameCommandHandler.h"
#include "Player.h"
#include "Inventory.h"
#include "Forwards.h"
#include "EventHelper.h"
#include "Action.h"
#include "ActionTeleport.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Event/EventHelper.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "src/servers/Server_Zone/Action/ActionTeleport.h"
extern Core::Logger g_log;
extern Core::Db::Database g_database;
extern Core::ServerZone g_serverZone;
extern Core::ZoneMgr g_zoneMgr;
extern Core::Data::ExdData g_exdData;
extern Core::GameCommandHandler g_gameCommandMgr;
extern Core::DebugCommandHandler g_gameCommandMgr;
using namespace Core::Common;
using namespace Core::Network::Packets;

View file

@ -8,46 +8,30 @@
#include <boost/format.hpp>
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "GameConnection.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "Session.h"
#include "Zone.h"
#include "ZonePosition.h"
#include "ServerZone.h"
#include "ZoneMgr.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "InitUIPacket.h"
#include "PingPacket.h"
#include "MoveActorPacket.h"
#include "ChatPacket.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "EventStartPacket.h"
#include "EventFinishPacket.h"
#include "PlayerStateFlagsPacket.h"
#include "GameCommandHandler.h"
#include "Player.h"
#include "Inventory.h"
#include "Forwards.h"
#include "EventHelper.h"
#include "Action.h"
#include "ActionTeleport.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Forwards.h"
extern Core::Logger g_log;
extern Core::Db::Database g_database;
extern Core::ServerZone g_serverZone;
extern Core::ZoneMgr g_zoneMgr;
extern Core::Data::ExdData g_exdData;
extern Core::GameCommandHandler g_gameCommandMgr;
extern Core::DebugCommandHandler g_gameCommandMgr;
using namespace Core::Common;
using namespace Core::Network::Packets;

View file

@ -9,45 +9,40 @@
#include <boost/format.hpp>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "Session.h"
#include "Zone.h"
#include "ZonePosition.h"
#include "ServerZone.h"
#include "ZoneMgr.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "InitUIPacket.h"
#include "PingPacket.h"
#include "MoveActorPacket.h"
#include "ChatPacket.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "EventStartPacket.h"
#include "EventFinishPacket.h"
#include "PlayerStateFlagsPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PingPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/MoveActorPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ChatPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventStartPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "GameCommandHandler.h"
#include "Player.h"
#include "Inventory.h"
#include "Forwards.h"
#include "EventHelper.h"
#include "Action.h"
#include "ActionTeleport.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Event/EventHelper.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "src/servers/Server_Zone/Action/ActionTeleport.h"
extern Core::Logger g_log;
extern Core::Db::Database g_database;
extern Core::ServerZone g_serverZone;
extern Core::ZoneMgr g_zoneMgr;
extern Core::Data::ExdData g_exdData;
extern Core::GameCommandHandler g_gameCommandMgr;
extern Core::DebugCommandHandler g_gameCommandMgr;
using namespace Core::Common;
using namespace Core::Network::Packets;

View file

@ -7,27 +7,27 @@
#include <boost/format.hpp>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "Session.h"
#include "src/servers/Server_Zone/Session.h"
#include "ServerNoticePacket.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "ActorControlPacket144.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
#include "PlayerStateFlagsPacket.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "GameCommandHandler.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "Player.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "Action.h"
#include "ActionTeleport.h"
#include "ActionCast.h"
#include "ScriptManager.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "src/servers/Server_Zone/Action/ActionTeleport.h"
#include "src/servers/Server_Zone/Action/ActionCast.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
extern Core::Scripting::ScriptManager g_scriptMgr;

View file

@ -3,7 +3,7 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/ServerPacketDef.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -3,7 +3,7 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/ServerPacketDef.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {

View file

@ -3,8 +3,8 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/UtilMath.h>
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {
@ -12,7 +12,7 @@ namespace Packets {
namespace Server {
/**
* @brief The packet sent to finish an event.
* @brief The packet sent to spawn an actor.
*/
class ActorSpawnPacket :
public GamePacketNew<FFXIVIpcActorSpawn>

View file

@ -3,7 +3,7 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/ServerPacketDef.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {

View file

@ -2,7 +2,7 @@
#define _EVENTPLAY_H
#include <Server_Common/GamePacketNew.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -2,7 +2,7 @@
#define _EVENTSTART_H
#include <Server_Common/GamePacketNew.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -3,8 +3,8 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/ServerPacketDef.h>
#include "Player.h"
#include "Forwards.h"
#include "Server_Zone/Actor/Player.h"
#include "Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -2,8 +2,8 @@
#define _MODELEQUIPPACKET_H
#include <Server_Common/GamePacketNew.h>
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -4,8 +4,8 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/ServerPacketDef.h>
#include <Server_Common/UtilMath.h>
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {

View file

@ -3,7 +3,7 @@
#include <Server_Common/GamePacketNew.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -0,0 +1,105 @@
#ifndef _PLAYERSPAWN_H
#define _PLAYERSPAWN_H
#include <Server_Common/ServerPacketDef.h>
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/UtilMath.h>
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Inventory/Inventory.h"
#include "src/servers/Server_Zone/Inventory/Item.h"
namespace Core {
namespace Network {
namespace Packets {
namespace Server {
/**
* @brief The packet sent to spawn a player.
*/
class PlayerSpawnPacket :
public GamePacketNew<FFXIVIpcPlayerSpawn>
{
public:
PlayerSpawnPacket( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget ) :
GamePacketNew<FFXIVIpcPlayerSpawn>( pPlayer->getId(), pTarget->getId() )
{
initialize( pPlayer, pTarget );
};
private:
void initialize( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget )
{
// todo: figure out unkown offsets
// TODO: temporary gm rank
//m_data.gmRank = 0xff;
m_data.currentMount = 0;
m_data.classJob = pPlayer->getClass();
//m_data.status = static_cast< uint8_t >( pPlayer->getStatus() );
m_data.hPCurr = pPlayer->getHp();
m_data.mPCurr = pPlayer->getMp();
m_data.tPCurr = pPlayer->getTp();
m_data.hPMax = pPlayer->getMaxHp();
m_data.mPMax = pPlayer->getMaxMp();
m_data.gmRank = 0xff;
//m_data.tPMax = 3000;
m_data.level = pPlayer->getLevel();
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
auto item = pPlayer->getInvetory()->getItemAt( Inventory::GearSet0, 0 );
if( item )
m_data.mainWeaponModel = item->getModelId1();
m_data.secWeaponModel = pPlayer->getModelSubWeapon();
m_data.models[0] = pPlayer->getModelForSlot( Inventory::EquipSlot::Head );
m_data.models[1] = pPlayer->getModelForSlot( Inventory::EquipSlot::Body );
m_data.models[2] = pPlayer->getModelForSlot( Inventory::EquipSlot::Hands );
m_data.models[3] = pPlayer->getModelForSlot( Inventory::EquipSlot::Legs );
m_data.models[4] = pPlayer->getModelForSlot( Inventory::EquipSlot::Feet );
strcpy( m_data.name, pPlayer->getName().c_str() );
m_data.pos.x = pPlayer->getPos().x;
m_data.pos.y = pPlayer->getPos().y;
m_data.pos.z = pPlayer->getPos().z;
m_data.voice = pPlayer->getVoiceId();
m_data.rotation = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
m_data.onlineStatus = static_cast< uint8_t >( pPlayer->getOnlineStatus() );
//m_data.u23 = 0x04;
//m_data.u24 = 256;
m_data.state = 1;
m_data.type = 1;
if( pTarget == pPlayer )
{
m_data.spawnIndex = 0x00;
}
else
{
m_data.spawnIndex = pTarget->getSpawnIdForActorId( pPlayer->getId() );
}
// 0x20 == spawn hidden to be displayed by the spawneffect control
m_data.displayFlags = pPlayer->getStance();
if( pPlayer->getZoningType() != Common::ZoneingType::None )
{
m_data.displayFlags |= 0x20;
}
m_data.targetId = pPlayer->getTargetId();
//m_data.type = 1;
//m_data.unknown_33 = 4;
//m_data.unknown_38 = 0x70;
//m_data.unknown_60 = 3;
//m_data.unknown_61 = 7;
};
};
}
}
}
}
#endif /*_PlayerSpawn_H*/

View file

@ -2,8 +2,8 @@
#define _PLAYERSTATE_H
#include <Server_Common/GamePacketNew.h>
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {
@ -11,7 +11,7 @@ namespace Packets {
namespace Server {
/**
* @brief The Ping response packet.
* @brief Packet sent to set a players state, this impacts which actions he can perform.
*/
class PlayerStateFlagsPacket :
public GamePacketNew< FFXIVIpcPlayerStateFlags >

View file

@ -2,8 +2,8 @@
#define _QUESTMESSAGE_H
#include <Server_Common/GamePacketNew.h>
#include "Player.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {
@ -11,13 +11,14 @@ namespace Packets {
namespace Server {
/**
* @brief The Ping response packet.
* @brief Packet to display a quest specific info message.
*/
class QuestMessagePacket :
public GamePacketNew< FFXIVIpcQuestMessage >
{
public:
QuestMessagePacket( Entity::ActorPtr pActor, uint32_t questId, int8_t msgId, uint8_t type = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) :
QuestMessagePacket( Entity::ActorPtr pActor, uint32_t questId, int8_t msgId,
uint8_t type = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) :
GamePacketNew< FFXIVIpcQuestMessage >( pActor->getId(), pActor->getId() )
{
initialize( questId, msgId, type, var1, var2 );

View file

@ -3,7 +3,7 @@
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/ServerPacketDef.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -2,7 +2,7 @@
#define _UPDATEHPMPTP_H
#include <Server_Common/GamePacketNew.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
namespace Network {

View file

@ -1,105 +0,0 @@
#ifndef _PLAYERSPAWN_H
#define _PLAYERSPAWN_H
#include <Server_Common/ServerPacketDef.h>
#include <Server_Common/GamePacketNew.h>
#include <Server_Common/UtilMath.h>
#include "Player.h"
#include "Forwards.h"
#include "Inventory.h"
#include "Item.h"
namespace Core {
namespace Network {
namespace Packets {
namespace Server {
/**
* @brief The packet sent to finish an event.
*/
class PlayerSpawnPacket :
public GamePacketNew<FFXIVIpcPlayerSpawn>
{
public:
PlayerSpawnPacket( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget ) :
GamePacketNew<FFXIVIpcPlayerSpawn>( pPlayer->getId(), pTarget->getId() )
{
initialize( pPlayer, pTarget );
};
private:
void initialize( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget )
{
// todo: figure out unkown offsets
// TODO: temporary gm rank
//m_data.gmRank = 0xff;
m_data.currentMount = 0;
m_data.classJob = pPlayer->getClass();
//m_data.status = static_cast< uint8_t >( pPlayer->getStatus() );
m_data.hPCurr = pPlayer->getHp();
m_data.mPCurr = pPlayer->getMp();
m_data.tPCurr = pPlayer->getTp();
m_data.hPMax = pPlayer->getMaxHp();
m_data.mPMax = pPlayer->getMaxMp();
m_data.gmRank = 0xff;
//m_data.tPMax = 3000;
m_data.level = pPlayer->getLevel();
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
auto item = pPlayer->getInvetory()->getItemAt( Inventory::GearSet0, 0 );
if( item )
m_data.mainWeaponModel = item->getModelId1();
m_data.secWeaponModel = pPlayer->getModelSubWeapon();
m_data.models[0] = pPlayer->getModelForSlot( Inventory::EquipSlot::Head );
m_data.models[1] = pPlayer->getModelForSlot( Inventory::EquipSlot::Body );
m_data.models[2] = pPlayer->getModelForSlot( Inventory::EquipSlot::Hands );
m_data.models[3] = pPlayer->getModelForSlot( Inventory::EquipSlot::Legs );
m_data.models[4] = pPlayer->getModelForSlot( Inventory::EquipSlot::Feet );
strcpy( m_data.name, pPlayer->getName().c_str() );
m_data.pos.x = pPlayer->getPos().x;
m_data.pos.y = pPlayer->getPos().y;
m_data.pos.z = pPlayer->getPos().z;
m_data.voice = pPlayer->getVoiceId();
m_data.rotation = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
m_data.onlineStatus = static_cast< uint8_t >( pPlayer->getOnlineStatus() );
//m_data.u23 = 0x04;
//m_data.u24 = 256;
m_data.state = 1;
m_data.type = 1;
if( pTarget == pPlayer )
{
m_data.spawnIndex = 0x00;
}
else
{
m_data.spawnIndex = pTarget->getSpawnIdForActorId( pPlayer->getId() );
}
// 0x20 == spawn hidden to be displayed by the spawneffect control
m_data.displayFlags = pPlayer->getStance();
if( pPlayer->getZoningType() != Common::ZoneingType::None )
{
m_data.displayFlags |= 0x20;
}
m_data.targetId = pPlayer->getTargetId();
//m_data.type = 1;
//m_data.unknown_33 = 4;
//m_data.unknown_38 = 0x70;
//m_data.unknown_60 = 3;
//m_data.unknown_61 = 7;
};
};
}
}
}
}
#endif /*_PlayerSpawn_H*/

View file

@ -1,490 +0,0 @@
#include <Server_Common/Logger.h>
#include <Server_Common/ExdData.h>
#include <chaiscript/chaiscript.hpp>
#include <Server_Common/ChaiscriptStdLib.h>
#include "ScriptManager.h"
#include "Zone.h"
#include "Player.h"
#include "BattleNpc.h"
#include "ServerZone.h"
#include "Event.h"
#include "EventHelper.h"
#include "ScriptManager.h"
#include "StatusEffect.h"
#include "ServerNoticePacket.h"
#include <boost/lexical_cast.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;
extern Core::ServerZone g_serverZone;
extern Core::Scripting::ScriptManager g_scriptManager;
Core::Scripting::ScriptManager::ScriptManager()
{
m_pChaiHandler = create_chaiscript();
}
Core::Scripting::ScriptManager::~ScriptManager()
{
}
void Core::Scripting::ScriptManager::loadDir( std::string dirname, std::set<std::string>& chaiFiles )
{
boost::filesystem::path targetDir( dirname );
boost::filesystem::recursive_directory_iterator iter( targetDir ), eod;
BOOST_FOREACH( boost::filesystem::path const& i, make_pair( iter, eod ) )
{
if( is_regular_file( i ) && boost::filesystem::extension( i.string() ) == ".chai" ||
boost::filesystem::extension( i.string() ) == ".inc" )
{
chaiFiles.insert( i.string() );
}
}
}
void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Core::Entity::PlayerPtr pPlayer )
{
try
{
std::string test = m_onFirstEnterWorld( *pPlayer );
}
catch( const std::exception &e )
{
std::string what = e.what();
g_log.Log( LoggingSeverity::error, what );
}
}
bool Core::Scripting::ScriptManager::registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId, uint32_t bnpcNameId, uint32_t modelId, std::string aiName )
{
return g_serverZone.registerBnpcTemplate( templateName, bnpcBaseId, bnpcNameId, modelId, aiName );
}
void Core::Scripting::ScriptManager::reload()
{
auto handler = create_chaiscript();
m_pChaiHandler.swap( handler );
init();
}
const boost::shared_ptr<chaiscript::ChaiScript>& Core::Scripting::ScriptManager::getHandler() const
{
return m_pChaiHandler;
}
bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId )
{
std::string eventName = "onTalk";
std::string objName = Event::getEventName( eventId );
pPlayer->sendDebug("Actor: " +
std::to_string( actorId ) +
" \neventId: " +
std::to_string( eventId ) +
" (0x" + boost::str( boost::format( "%|08X|" )
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
uint16_t eventType = eventId >> 16;
try
{
// Get object from engine
auto obj = m_pChaiHandler->eval( objName );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
pPlayer->eventStart( actorId, eventId, Event::Event::Talk, 0, 0 );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint64_t ) > >( eventName );
fn( obj, eventId, *pPlayer, actorId );
pPlayer->checkEvent( eventId );
}
catch( std::exception& e )
{
if( eventType == Common::EventType::Quest )
{
auto questInfo = g_exdData.getQuestInfo( eventId );
if( questInfo )
{
pPlayer->sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
return false;
}
}
pPlayer->sendDebug( e.what() );
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onEnterTerritory( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
uint16_t param1, uint16_t param2 )
{
std::string eventName = "onEnterTerritory";
std::string objName = Event::getEventName( eventId );
try
{
// Get object from engine
auto obj = m_pChaiHandler->eval( objName );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::EnterTerritory, 0, pPlayer->getZoneId() );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint16_t, uint16_t ) > >( eventName );
fn( obj, eventId, *pPlayer, param1, param2 );
pPlayer->checkEvent( eventId );
}
catch( std::exception& e )
{
pPlayer->sendDebug( e.what() );
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onWithinRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1, float x, float y, float z )
{
std::string eventName = "onWithinRange";
std::string objName = Event::getEventName( eventId );
try
{
// Get object from engine
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::WithinRange, 1, param1 );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t, float, float, float ) > >( eventName );
fn( obj, eventId, *pPlayer, param1, x, y, z );
pPlayer->checkEvent( eventId );
}
catch( std::exception& e )
{
pPlayer->sendDebug( e.what() );
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1, float x, float y, float z )
{
std::string eventName = "onOutsideRange";
std::string objName = Event::getEventName( eventId );
try
{
// Get object from engine
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::OutsideRange, 1, param1 );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t, float, float, float ) > >( eventName );
fn( obj, eventId, *pPlayer, param1, x, y, z );
pPlayer->checkEvent( eventId );
}
catch( std::exception& e )
{
pPlayer->sendDebug( e.what() );
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, uint64_t actorId,
uint32_t eventId, uint8_t emoteId )
{
std::string eventName = "onEmote";
std::string objName = Event::getEventName( eventId );
try
{
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
pPlayer->eventStart( actorId, eventId, Event::Event::Emote, 0, emoteId );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint64_t, uint8_t ) > >( eventName );
fn( obj, eventId, *pPlayer, actorId, emoteId );
pPlayer->checkEvent( eventId );
}
catch( std::exception& e )
{
uint16_t eventType = eventId >> 16;
if( eventType == Common::EventType::Quest )
{
auto questInfo = g_exdData.getQuestInfo( eventId );
if( questInfo )
{
pPlayer->sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
return false;
}
}
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t subEvent,
uint16_t param1, uint16_t param2, uint16_t param3 )
{
pPlayer->sendDebug("eventId: " +
std::to_string( eventId ) +
" ( 0x" + boost::str( boost::format( "%|08X|" ) % ( uint64_t ) ( eventId & 0xFFFFFFF ) ) + " ) " +
" scene: " + std::to_string( subEvent ) +
" p1: " + std::to_string( param1 ) +
" p2: " + std::to_string( param2 ) +
" p3: " + std::to_string( param3 ) );
try
{
auto pEvent = pPlayer->getEvent( eventId );
if( pEvent )
{
pEvent->setPlayedScene( false );
// try to retrieve a stored callback
auto eventCallback = pEvent->getEventReturnCallback();
// if there is one, proceed to call it
if( eventCallback )
{
eventCallback( *pPlayer, eventId, param1, param2, param3 );
if( !pEvent->hasPlayedScene() )
pPlayer->eventFinish( eventId, 1 );
else
pEvent->setPlayedScene( false );
}
// else, finish the event.
else
pPlayer->eventFinish( eventId, 1 );
}
}
catch( std::exception& e )
{
pPlayer->sendNotice( e.what() );
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
uint16_t subEvent, uint16_t param, uint32_t catalogId )
{
std::string eventName = Event::getEventName( eventId ) + "_TRADE";
try
{
auto fn = m_pChaiHandler->eval< std::function< void( Entity::Player&, uint32_t, uint16_t, uint16_t, uint32_t ) > >( eventName );
fn( *pPlayer, eventId, subEvent, param, catalogId );
}
catch( ... )
{
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uint32_t eventItemId,
uint32_t eventId, uint32_t castTime, uint64_t targetId )
{
std::string eventName = "onEventItem";
std::string objName = Event::getEventName( eventId );
try
{
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
pPlayer->eventStart( targetId, eventId, Event::Event::Item, 0, 0 );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t, uint32_t, uint64_t ) > >( eventName );
fn( obj, eventId, *pPlayer, eventItemId, castTime, targetId );
}
catch( std::exception& e )
{
pPlayer->sendNotice( e.what() );
return false;
}
return true;
}
bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint16_t nameId )
{
std::string eventName = "onBnpcKill_" + std::to_string( nameId );
// loop through all active quests and try to call available onMobKill callbacks
for( size_t i = 0; i < 30; i++ )
{
auto activeQuests = pPlayer->getQuestActive( i );
if( !activeQuests )
continue;
uint16_t questId = activeQuests->c.questId;
if( questId != 0 )
{
auto obj = m_pChaiHandler->eval( Event::getEventName( 0x00010000 | questId ) );
std::string objName = Event::getEventName( 0x00010000 | questId );
pPlayer->sendDebug("Calling: " + objName + "." + eventName);
try
{
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Player& ) > >(eventName);
fn( obj, *pPlayer );
}
catch( std::exception& e )
{
g_log.info( e.what() );
}
}
}
return true;
}
bool Core::Scripting::ScriptManager::onCastFinish( Entity::PlayerPtr pPlayer, Entity::ActorPtr pTarget, uint32_t actionId )
{
std::string eventName = "onFinish";
try
{
auto obj = m_pChaiHandler->eval( "skillDef_" + std::to_string( actionId ) );
std::string objName = "skillDef_" + std::to_string( actionId );
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Player&, Entity::Actor& ) > >( eventName );
fn( obj, *pPlayer, *pTarget );
}
catch( std::exception& e )
{
pPlayer->sendUrgent( e.what() );
}
return true;
}
bool Core::Scripting::ScriptManager::onStatusReceive( Entity::ActorPtr pActor, uint32_t effectId )
{
std::string eventName = "onReceive";
try
{
auto obj = m_pChaiHandler->eval( "statusDef_" + std::to_string( effectId ) );
std::string objName = "statusDef_" + std::to_string( effectId );
if( pActor->isPlayer() )
pActor->getAsPlayer()->sendDebug( "Calling: " + objName + "." + eventName );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Actor&) > >( eventName );
fn( obj, *pActor );
}
catch( std::exception& e )
{
if( pActor->isPlayer() )
pActor->getAsPlayer()->sendUrgent( e.what() );
}
return true;
}
bool Core::Scripting::ScriptManager::onStatusTick( Entity::ActorPtr pActor, Core::StatusEffect::StatusEffect& effect )
{
std::string eventName = "onTick";
try
{
auto obj = m_pChaiHandler->eval( "statusDef_" + std::to_string( effect.getId() ) );
std::string objName = "statusDef_" + std::to_string( effect.getId() );
if( pActor->isPlayer() )
pActor->getAsPlayer()->sendDebug( "Calling: " + objName + "." + eventName );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Actor&, Core::StatusEffect::StatusEffect& ) > >( eventName );
fn( obj, *pActor, effect );
}
catch( std::exception& e )
{
if( pActor->isPlayer() )
pActor->getAsPlayer()->sendUrgent( e.what() );
}
return true;
}
bool Core::Scripting::ScriptManager::onStatusTimeOut( Entity::ActorPtr pActor, uint32_t effectId )
{
std::string eventName = "onTimeOut";
try
{
auto obj = m_pChaiHandler->eval( "statusDef_" + std::to_string( effectId ) );
std::string objName = "statusDef_" + std::to_string( effectId );
if( pActor->isPlayer() )
pActor->getAsPlayer()->sendDebug( "Calling: " + objName + "." + eventName );
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Actor& ) > >( eventName );
fn( obj, *pActor );
}
catch( std::exception& e )
{
if( pActor->isPlayer() )
pActor->getAsPlayer()->sendUrgent( e.what() );
}
return true;
}
bool Core::Scripting::ScriptManager::onZoneInit( ZonePtr pZone )
{
std::string eventName = "onZoneInit_" + pZone->getInternalName();
try
{
auto fn = m_pChaiHandler->eval< std::function< void( Zone& ) > >( eventName );
fn( *pZone );
}
catch( std::exception& e )
{
g_log.info( e.what() );
return false;
}
return true;
}

View file

@ -1,71 +0,0 @@
#ifndef _SCRIPTMANAGER_H_
#define _SCRIPTMANAGER_H_
#include <boost/shared_ptr.hpp>
#include <mutex>
#include <set>
#include <Server_Common/Common.h>
#include "Forwards.h"
namespace chaiscript
{
class ChaiScript;
}
namespace Core
{
namespace Scripting
{
class ScriptManager
{
private:
boost::shared_ptr< chaiscript::ChaiScript > m_pChaiHandler;
std::function< std::string( Entity::Player& ) > m_onFirstEnterWorld;
// auto fn = m_pChaiHandler->eval< std::function<const std::string( Entity::Player ) > >( "onFirstEnterWorld" );
public:
ScriptManager();
~ScriptManager();
int32_t init();
void reload();
const boost::shared_ptr< chaiscript::ChaiScript >& getHandler() const;
void onPlayerFirstEnterWorld( Entity::PlayerPtr pPlayer );
static bool registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId, uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
bool onTalk( Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId );
bool onEnterTerritory( Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t param1, uint16_t param2 );
bool onWithinRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1, float x, float y, float z );
bool onOutsideRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1, float x, float y, float z );
bool onEmote( Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId, uint8_t emoteId );
bool onEventItem( Entity::PlayerPtr pPlayer, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId );
bool onMobKill( Entity::PlayerPtr pPlayer, uint16_t nameId );
bool onCastFinish( Entity::PlayerPtr pPlayer, Entity::ActorPtr pTarget, uint32_t actionId );
bool onStatusReceive( Entity::ActorPtr pActor, uint32_t effectId );
bool onStatusTick( Entity::ActorPtr pActor, Core::StatusEffect::StatusEffect& effect );
bool onStatusTimeOut( Entity::ActorPtr pActor, uint32_t effectId );
bool onZoneInit( ZonePtr pZone );
bool onEventHandlerReturn( Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t subEvent, uint16_t param1, uint16_t param2, uint16_t param3 );
bool onEventHandlerTradeReturn( Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );
void loadDir( std::string dirname, std::set<std::string>& chaiFiles );
};
}
}
#endif

View file

@ -1,209 +0,0 @@
#include <Server_Common/Logger.h>
#include <chaiscript/chaiscript.hpp>
#include <Server_Common/ChaiscriptStdLib.h>
#include "ScriptManager.h"
#include "Zone.h"
#include "Player.h"
#include "BattleNpc.h"
#include "Event.h"
#include "EventHelper.h"
#include "ServerNoticePacket.h"
#include "StatusEffect.h"
#include <boost/lexical_cast.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
extern Core::Logger g_log;
int Core::Scripting::ScriptManager::init()
{
// ACTOR / PLAYER BINDINGS
/////////////////////////////////////////////////////////////////////////////////////////////
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getName ), "getName" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getId ), "getId" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getHp ), "getHp" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getMp ), "getMp" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getTp ), "getTp" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getLevel ), "getLevel" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::getTargetId ), "getTargetId" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::addStatusEffect ), "addStatusEffect" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::addStatusEffectById ), "addStatusEffectById" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::addStatusEffectByIdIfNotExist ), "addStatusEffectByIdIfNotExist" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Actor::takeDamage ), "takeDamage" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::forceZoneing ), "setZone" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getClassAsInt ), "getClass" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getRace ), "getRace" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getGender ), "getGender" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::isFirstLogin ), "isFirstLogin" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setFirstLogin ), "setFirstLogin" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::gainExp ), "gainExp" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::unlock ), "unlock" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::registerAetheryte ), "aetheryteRegister" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::learnAction ), "learnAction" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getHomepoint ), "getHomepoint" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setHomepoint ), "setHomepoint" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::returnToHomepoint ), "returnToHomepoint" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::teleport ), "teleport" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::prepareZoning ), "prepareZoning" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getCurrency ), "getCurrency" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::addCurrency ), "addCurrency" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::removeCurrency ), "removeCurrency" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getCrystal ), "getCrystals" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::addCrystal ), "addCrystals" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::removeCrystal ), "removeCrystals" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::updateQuest ), "questUpdate" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::finishQuest ), "questFinish" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::sendQuestMessage ), "questMessage" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestSeq ), "questGetSeq" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::hasQuest ), "hasQuest" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getZoneId ), "getZoneId" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::handleScriptSkill ), "handleScriptSkill" );
m_pChaiHandler->add( chaiscript::fun( &Core::Event::mapEventActorToRealActor ), "mapActor" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8A ), "getQuestUI8A" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8B ), "getQuestUI8B" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8C ), "getQuestUI8C" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8D ), "getQuestUI8D" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8E ), "getQuestUI8E" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8F ), "getQuestUI8F" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8AH ), "getQuestUI8AH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8BH ), "getQuestUI8BH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8CH ), "getQuestUI8CH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8DH ), "getQuestUI8DH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8EH ), "getQuestUI8EH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8FH ), "getQuestUI8FH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8AL ), "getQuestUI8AL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8BL ), "getQuestUI8BL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8CL ), "getQuestUI8CL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8DL ), "getQuestUI8DL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8EL ), "getQuestUI8EL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI8FL ), "getQuestUI8FL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI16A ), "getQuestUI16A" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI16B ), "getQuestUI16B" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI16C ), "getQuestUI16C" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestUI32A ), "getQuestUI32A" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestBitFlag8 ), "getQuestBitFlag8" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestBitFlag16 ), "getQuestBitFlag16" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestBitFlag24 ), "getQuestBitFlag24" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestBitFlag32 ), "getQuestBitFlag32" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestBitFlag40 ), "getQuestBitFlag40" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getQuestBitFlag48 ), "getQuestBitFlag48" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8A ), "setQuestUI8A" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8B ), "setQuestUI8B" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8C ), "setQuestUI8C" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8D ), "setQuestUI8D" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8E ), "setQuestUI8E" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8F ), "setQuestUI8F" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8AH ), "setQuestUI8AH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8BH ), "setQuestUI8BH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8CH ), "setQuestUI8CH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8DH ), "setQuestUI8DH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8EH ), "setQuestUI8EH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8FH ), "setQuestUI8FH" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8AL ), "setQuestUI8AL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8BL ), "setQuestUI8BL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8CL ), "setQuestUI8CL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8DL ), "setQuestUI8DL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8EL ), "setQuestUI8EL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI8FL ), "setQuestUI8FL" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI16A ), "setQuestUI16A" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI16B ), "setQuestUI16B" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI16C ), "setQuestUI16C" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestUI32A ), "setQuestUI32A" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestBitFlag8 ), "setQuestBitFlag8" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestBitFlag16 ), "setQuestBitFlag16" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestBitFlag24 ), "setQuestBitFlag24" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestBitFlag32 ), "setQuestBitFlag32" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestBitFlag40 ), "setQuestBitFlag40" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setQuestBitFlag48 ), "setQuestBitFlag48" );
m_pChaiHandler->add(chaiscript::fun(&Entity::Player::giveQuestRewards), "giveQuestRewards");
m_pChaiHandler->add( chaiscript::fun< void, Entity::Player, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t >( &Entity::Player::eventPlay ), "eventPlay" );
m_pChaiHandler->add( chaiscript::fun< void, Entity::Player, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, EventReturnCallback >( &Entity::Player::eventPlay ), "eventPlay" );
m_pChaiHandler->add( chaiscript::fun< void, Entity::Player, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, EventReturnCallback >( &Entity::Player::eventPlay ), "eventPlay" );
m_pChaiHandler->add( chaiscript::fun< void, Entity::Player, uint32_t, uint32_t, uint32_t, EventReturnCallback >( &Entity::Player::eventPlay ), "eventPlay" );
m_pChaiHandler->add( chaiscript::fun< void, Entity::Player, uint32_t, uint32_t, uint32_t >( &Entity::Player::eventPlay ), "eventPlay" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::eventActionStart ), "eventActionStart" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::eventItemActionStart ), "eventItemActionStart" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::changePosition ), "changePos" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::tryAddItem ), "tryAddItem" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::isAetheryteRegistered ), "isAetheryteRegistered" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::isActionLearned ), "isActionLearned" );
m_pChaiHandler->add( chaiscript::base_class< Entity::Actor, Entity::Player >() );
m_pChaiHandler->add( chaiscript::base_class< Entity::Actor, Entity::BattleNpc >() );
m_pChaiHandler->add( chaiscript::user_type< Entity::Actor >(), "Actor" );
m_pChaiHandler->add( chaiscript::user_type< Entity::Player >(), "Player" );
m_pChaiHandler->add( chaiscript::user_type< Entity::BattleNpc >(), "BattleNpc" );
m_pChaiHandler->add( chaiscript::user_type< StatusEffect::StatusEffect >(), "StatusEffect" );
m_pChaiHandler->add( chaiscript::fun( &StatusEffect::StatusEffect::registerTickEffect ), "registerTickEffect" );
m_pChaiHandler->add( chaiscript::user_type< Zone >(), "Zone" );
m_pChaiHandler->add( chaiscript::fun( &Zone::getName ), "getName" );
m_pChaiHandler->add( chaiscript::fun( &registerBnpcTemplate ), "registerBnpcTemplate" );
// EVENT BINDINGS
/////////////////////////////////////////////////////////////////////////////////////////////
std::set< std::string > chaiFiles;
g_log.info( "ScriptEngine: Loading Scripts..." );
loadDir( "scripts/chai", chaiFiles );
uint16_t scriptCount = 0;
uint16_t errorCount = 0;
for( auto itr = chaiFiles.begin(); itr != chaiFiles.end(); ++itr )
{
auto& fileName = *itr;
try
{
m_pChaiHandler->eval_file( fileName );
scriptCount++;
}
catch( std::exception& e )
{
g_log.Log( LoggingSeverity::error, e.what() );
errorCount++;
}
}
g_log.info( "\tloaded " + std::to_string( scriptCount ) +
" scripts, " + std::to_string( errorCount ) + " errors." );
std::function<std::string( Entity::Player& ) > f =
m_pChaiHandler->eval< std::function<std::string( Entity::Player& ) > >( "onFirstEnterWorld" );
m_onFirstEnterWorld = f;
return true;
}

View file

@ -15,14 +15,14 @@
#include <Server_Common/ExdData.h>
#include <Server_Common/PacketContainer.h>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "Session.h"
#include "ZoneMgr.h"
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
#include "GameCommandHandler.h"
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
#include "ScriptManager.h"
#include "Script/ScriptManager.h"
#include "Forwards.h"
#include <boost/foreach.hpp>
@ -32,7 +32,7 @@
Core::Logger g_log;
Core::Db::Database g_database;
Core::GameCommandHandler g_gameCommandMgr;
Core::DebugCommandHandler g_gameCommandMgr;
Core::Scripting::ScriptManager g_scriptMgr;
Core::Data::ExdData g_exdData;
Core::ZoneMgr g_zoneMgr;

View file

@ -8,7 +8,7 @@
#include <map>
#include "Forwards.h"
#include "BattleNpcTemplate.h"
#include "src/servers/Server_Zone/Actor/BattleNpcTemplate.h"
namespace Core {

View file

@ -2,10 +2,10 @@
#include <Server_Common/Util.h>
#include <Server_Common/PacketContainer.h>
#include "GameConnection.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "Session.h"
#include "Player.h"
#include "src/servers/Server_Zone/Actor/Player.h"
Core::Session::Session( uint32_t sessionId )
: m_sessionId( sessionId )

View file

@ -7,10 +7,10 @@
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include "Actor.h"
#include "src/servers/Server_Zone/Actor/Actor.h"
#include "StatusEffect.h"
#include "ScriptManager.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;

View file

@ -3,7 +3,7 @@
#include <boost/shared_ptr.hpp>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core
{

View file

@ -1,11 +1,11 @@
#include <Server_Common/Util.h>
#include <Server_Common/ServerPacketDef.h>
#include "Actor.h"
#include "src/servers/Server_Zone/Actor/Actor.h"
#include "StatusEffect.h"
#include "StatusEffectContainer.h"
#include "ActorControlPacket142.h"
#include "ActorControlPacket143.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
using namespace Core::Common;

View file

@ -6,7 +6,7 @@
#include <queue>
#include <map>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core
{

View file

@ -1,10 +1,11 @@
#include "Cell.h"
#include "Actor.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Actor/Actor.h"
#include "src/servers/Server_Zone/Actor/BattleNpc.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "Zone.h"
#include "BattleNpc.h"
// TODO: the entire zone / areahandling is a bit outdated ( in parts i used this for the 1.0 iteration )
// likely this could be greatly improved or redone

View file

@ -4,7 +4,7 @@
#include <stdint.h>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include <set>
namespace Core {

View file

@ -13,19 +13,19 @@
#include <Server_Common/ServerPacketDef.h>
#include <Server_Common/PacketContainer.h>
#include "Session.h"
#include "Actor.h"
#include "Player.h"
#include "BattleNpc.h"
#include "Forwards.h"
#include "GameConnection.h"
#include "Zone.h"
#include "ZoneMgr.h"
#include "ServerZone.h"
#include "ScriptManager.h"
#include "src/servers/Server_Zone/Session.h"
#include "src/servers/Server_Zone/Actor/Actor.h"
#include "src/servers/Server_Zone/Actor/Player.h"
#include "src/servers/Server_Zone/Actor/BattleNpc.h"
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
#include "CellHandler.h"

View file

@ -7,7 +7,7 @@
#include "Cell.h"
#include "CellHandler.h"
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
#include <set>
#include <boost/enable_shared_from_this.hpp>

View file

@ -4,7 +4,7 @@
#include <unordered_map>
#include <map>
#include "Forwards.h"
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {