mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 02:57:45 +00:00
Merge master
This commit is contained in:
commit
fa3bc04f8e
83 changed files with 1330 additions and 1385 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "Action.h"
|
||||
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
|
||||
|
||||
Core::Action::Action::Action()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _ACTION_H_
|
||||
#define _ACTION_H_
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Common.h>
|
||||
#include "../Forwards.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
|
||||
|
@ -57,4 +57,4 @@ namespace Core { namespace Action {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "ActionCast.h"
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Logging/Logger.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/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
using namespace Core::Common;
|
||||
using namespace Core::Network;
|
||||
|
@ -52,7 +52,8 @@ void Core::Action::ActionCast::onStart()
|
|||
castPacket.data().action_id = m_id;
|
||||
castPacket.data().skillType = Common::SkillType::Normal;
|
||||
castPacket.data().unknown_1 = m_id;
|
||||
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 ); // This is used for the cast bar above the target bar of the caster.
|
||||
// This is used for the cast bar above the target bar of the caster.
|
||||
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 );
|
||||
castPacket.data().target_id = m_pTarget->getId();
|
||||
|
||||
m_pSource->sendToInRangeSet( castPacket, true );
|
||||
|
@ -73,10 +74,10 @@ void Core::Action::ActionCast::onFinish()
|
|||
pPlayer->sendStateFlags();
|
||||
|
||||
/*auto control = ActorControlPacket143( m_pTarget->getId(), ActorControlType::Unk7,
|
||||
0x219, m_id, m_id, m_id, m_id );
|
||||
0x219, m_id, m_id, m_id, m_id );
|
||||
m_pSource->sendToInRangeSet( control, true );*/
|
||||
|
||||
g_scriptMgr.onCastFinish( pPlayer, m_pTarget, m_id );
|
||||
g_scriptMgr.onCastFinish( *pPlayer, m_pTarget, m_id );
|
||||
}
|
||||
|
||||
void Core::Action::ActionCast::onInterrupt()
|
||||
|
@ -89,7 +90,7 @@ void Core::Action::ActionCast::onInterrupt()
|
|||
m_pSource->getAsPlayer()->sendStateFlags();
|
||||
|
||||
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,
|
||||
0x219, 1, m_id, 0 );
|
||||
0x219, 1, m_id, 0 );
|
||||
|
||||
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
|
||||
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef _ACTIONCAST_H_
|
||||
#define _ACTIONCAST_H_
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "../Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
namespace Core {
|
||||
namespace Action {
|
||||
|
||||
class ActionCast : public Action
|
||||
{
|
||||
|
@ -25,4 +26,4 @@ namespace Core { namespace Action {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
|
||||
#include "ActionCollision.h"
|
||||
#include <src/servers/Server_Zone/Actor/Actor.h>
|
||||
#include <src/servers/Server_Zone/Actor/Player.h>
|
||||
#include "Actor/Actor.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
|
@ -16,7 +17,7 @@ using namespace Core::Common;
|
|||
bool ActionCollision::isActorApplicable( ActorPtr actorPtr, TargetFilter targetFilter )
|
||||
{
|
||||
bool actorApplicable = false;
|
||||
switch ( targetFilter )
|
||||
switch( targetFilter )
|
||||
{
|
||||
case TargetFilter::All:
|
||||
{
|
||||
|
@ -57,14 +58,14 @@ std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXI
|
|||
{
|
||||
std::set< ActorPtr > actorsCollided;
|
||||
|
||||
switch ( static_cast< ActionCollisionType >( actionInfo->aoe_type ) )
|
||||
switch( static_cast< ActionCollisionType >( actionInfo->aoe_type ) )
|
||||
{
|
||||
case ActionCollisionType::None:
|
||||
case ActionCollisionType::SingleTarget:
|
||||
{
|
||||
// This is actually needed. There is "splash damage" in actions marked as single target.
|
||||
// Notice how we're using aoe_width. How collision works for SingleTarget is unknown as of now.
|
||||
for ( auto pActor : actorsInRange )
|
||||
for( auto pActor : actorsInRange )
|
||||
{
|
||||
// Make sure actor exists. If it doesn't we done goofed.
|
||||
assert( pActor );
|
||||
|
@ -84,7 +85,7 @@ std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXI
|
|||
}
|
||||
case ActionCollisionType::Circle:
|
||||
{
|
||||
for ( auto pActor : actorsInRange )
|
||||
for( auto pActor : actorsInRange )
|
||||
{
|
||||
assert( pActor );
|
||||
|
||||
|
@ -92,15 +93,13 @@ std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXI
|
|||
continue;
|
||||
|
||||
if ( radiusCollision( pActor->getPos(), aoePosition, actionInfo->aoe_range ) )
|
||||
{
|
||||
actorsCollided.insert( pActor );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ActionCollisionType::Box:
|
||||
{
|
||||
for ( auto pActor : actorsInRange )
|
||||
for( auto pActor : actorsInRange )
|
||||
{
|
||||
assert( pActor );
|
||||
|
||||
|
@ -137,4 +136,4 @@ bool ActionCollision::boxCollision( FFXIVARR_POSITION3 actorPosition, FFXIVARR_P
|
|||
actorPosition.x > aoePosition.x &&
|
||||
actorPosition.y < aoePosition.y + height &&
|
||||
actorPosition.y > aoePosition.y;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
#ifndef _ACTIONCOLLISION_H
|
||||
#define _ACTIONCOLLISION_H
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
#include <src/servers/Server_Zone/Actor/Actor.h>
|
||||
#include "Actor/Actor.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Entity {
|
||||
namespace Entity {
|
||||
|
||||
enum class TargetFilter
|
||||
{
|
||||
All, // All actors in the AoE are applicable for collision
|
||||
Players, // Only players
|
||||
Allies, // Only allies (players, ally NPCs)
|
||||
Party, // Only party members
|
||||
Enemies // Only enemies
|
||||
};
|
||||
enum class TargetFilter
|
||||
{
|
||||
All, // All actors in the AoE are applicable for collision
|
||||
Players, // Only players
|
||||
Allies, // Only allies (players, ally NPCs)
|
||||
Party, // Only party members
|
||||
Enemies // Only enemies
|
||||
};
|
||||
|
||||
class ActionCollision
|
||||
{
|
||||
public:
|
||||
class ActionCollision
|
||||
{
|
||||
public:
|
||||
|
||||
static bool isActorApplicable( ActorPtr actorPtr, TargetFilter targetFilter );
|
||||
static std::set< ActorPtr > getActorsHitFromAction( Common::FFXIVARR_POSITION3 aoePosition,
|
||||
std::set< ActorPtr > actorsInRange,
|
||||
boost::shared_ptr< Data::ActionInfo > actionInfo,
|
||||
TargetFilter targetFilter );
|
||||
|
||||
private:
|
||||
static bool radiusCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition,
|
||||
uint16_t radius );
|
||||
static bool isActorApplicable( ActorPtr actorPtr, TargetFilter targetFilter );
|
||||
static std::set< ActorPtr > getActorsHitFromAction( Common::FFXIVARR_POSITION3 aoePosition,
|
||||
std::set< ActorPtr > actorsInRange,
|
||||
boost::shared_ptr< Data::ActionInfo > actionInfo,
|
||||
TargetFilter targetFilter );
|
||||
|
||||
static bool boxCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition,
|
||||
uint16_t width, uint16_t height );
|
||||
|
||||
};
|
||||
private:
|
||||
static bool radiusCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition,
|
||||
uint16_t radius );
|
||||
|
||||
}
|
||||
static bool boxCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition,
|
||||
uint16_t width, uint16_t height );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "ActionMount.h"
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Logging/Logger.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/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
using namespace Core::Common;
|
||||
using namespace Core::Network;
|
||||
|
@ -23,7 +23,7 @@ extern Core::Scripting::ScriptManager g_scriptMgr;
|
|||
|
||||
Core::Action::ActionMount::ActionMount()
|
||||
{
|
||||
m_handleActionType = Common::HandleActionType::Event;
|
||||
m_handleActionType = HandleActionType::Event;
|
||||
}
|
||||
|
||||
Core::Action::ActionMount::ActionMount( Entity::ActorPtr pActor, uint16_t mountId )
|
||||
|
@ -75,19 +75,20 @@ void Core::Action::ActionMount::onFinish()
|
|||
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
|
||||
pPlayer->sendStateFlags();
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket(pPlayer->getId());
|
||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( pPlayer->getId() );
|
||||
effectPacket.data().targetId = pPlayer->getId();
|
||||
effectPacket.data().actionAnimationId = m_id;
|
||||
effectPacket.data().unknown_62 = 13; // Affects displaying action name next to number in floating text
|
||||
// Affects displaying action name next to number in floating text
|
||||
effectPacket.data().unknown_62 = 13;
|
||||
effectPacket.data().actionTextId = 4;
|
||||
effectPacket.data().numEffects = 1;
|
||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot(pPlayer->getRotation());
|
||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
|
||||
effectPacket.data().effectTarget = INVALID_GAME_OBJECT_ID;
|
||||
effectPacket.data().effects[0].effectType = ActionEffectType::Mount;
|
||||
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::CritDamage;
|
||||
effectPacket.data().effects[0].value = m_id;
|
||||
|
||||
pPlayer->sendToInRangeSet(effectPacket, true);
|
||||
pPlayer->sendToInRangeSet( effectPacket, true );
|
||||
|
||||
pPlayer->mount( m_id );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef _ACTIONMOUNT_H_
|
||||
#define _ACTIONMOUNT_H_
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "../Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
namespace Core {
|
||||
namespace Action {
|
||||
|
||||
class ActionMount : public Action
|
||||
{
|
||||
|
@ -25,4 +26,4 @@ namespace Core { namespace Action {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "ActionTeleport.h"
|
||||
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Logging/Logger.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 "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
using namespace Core::Common;
|
||||
using namespace Core::Network;
|
||||
|
@ -18,7 +18,7 @@ extern Core::Logger g_log;
|
|||
|
||||
Core::Action::ActionTeleport::ActionTeleport()
|
||||
{
|
||||
m_handleActionType = Common::HandleActionType::Event;
|
||||
m_handleActionType = HandleActionType::Event;
|
||||
}
|
||||
|
||||
Core::Action::ActionTeleport::ActionTeleport( Entity::ActorPtr pActor, uint16_t targetZone, uint16_t cost )
|
||||
|
@ -81,7 +81,7 @@ void Core::Action::ActionTeleport::onFinish()
|
|||
//auto control = Network::Packets::Server::ActorControlPacket142( m_pSource->getId(), Common::ActorControlType::TeleportDone );
|
||||
//m_pSource->sendToInRangeSet( control, false );
|
||||
|
||||
pPlayer->setZoningType( Common::ZoneingType::Teleport );
|
||||
pPlayer->setZoningType( ZoneingType::Teleport );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( pPlayer->getId() );
|
||||
effectPacket.data().targetId = pPlayer->getId();
|
||||
|
@ -90,7 +90,7 @@ void Core::Action::ActionTeleport::onFinish()
|
|||
effectPacket.data().actionTextId = 5;
|
||||
effectPacket.data().unknown_5 = 1;
|
||||
effectPacket.data().numEffects = 1;
|
||||
effectPacket.data().rotation = static_cast< uint16_t >( 0x8000 * ( (pPlayer->getRotation() + 3.1415926) ) / 3.1415926 );
|
||||
effectPacket.data().rotation = static_cast< uint16_t >( 0x8000 * ( ( pPlayer->getRotation() + 3.1415926 ) ) / 3.1415926 );
|
||||
effectPacket.data().effectTarget = pPlayer->getId();
|
||||
pPlayer->sendToInRangeSet( effectPacket, true );
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef _ACTIONTELEPORT_H_
|
||||
#define _ACTIONTELEPORT_H_
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "../Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
namespace Core {
|
||||
namespace Action {
|
||||
|
||||
class ActionTeleport : public Action
|
||||
{
|
||||
|
@ -27,4 +28,4 @@ namespace Core { namespace Action {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
|
||||
#include "EventAction.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"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Server_Zone/Actor/Player.h"
|
||||
#include "Server_Zone/Event/Event.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
@ -18,7 +18,7 @@ using namespace Core::Network::Packets::Server;
|
|||
|
||||
Core::Action::EventAction::EventAction()
|
||||
{
|
||||
m_handleActionType = Common::HandleActionType::Event;
|
||||
m_handleActionType = HandleActionType::Event;
|
||||
}
|
||||
|
||||
Core::Action::EventAction::EventAction( Entity::ActorPtr pActor, uint32_t eventId, uint16_t action,
|
||||
|
@ -75,7 +75,6 @@ void Core::Action::EventAction::onFinish()
|
|||
m_onActionFinishClb( *m_pSource->getAsPlayer(), m_eventId, m_additional );
|
||||
|
||||
auto control = ActorControlPacket142( m_pSource->getId(), Common::ActorControlType::CastStart, 0, m_id );
|
||||
|
||||
|
||||
if( !pEvent->hasPlayedScene() )
|
||||
m_pSource->getAsPlayer()->eventFinish( m_eventId, 1 );
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#ifndef _EVENTACTION_H_
|
||||
#define _EVENTACTION_H_
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "src/servers/Server_Zone/Action/Action.h"
|
||||
#include "../Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
namespace Core {
|
||||
namespace Action {
|
||||
|
||||
class EventAction : public Action
|
||||
{
|
||||
|
@ -34,4 +35,4 @@ namespace Core { namespace Action {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include "EventItemAction.h"
|
||||
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
|
||||
#include <string.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"
|
||||
#include "Actor/Player.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
||||
|
@ -19,7 +19,7 @@ using namespace Core::Network::Packets::Server;
|
|||
|
||||
Core::Action::EventItemAction::EventItemAction()
|
||||
{
|
||||
m_handleActionType = Common::HandleActionType::Event;
|
||||
m_handleActionType = HandleActionType::Event;
|
||||
}
|
||||
|
||||
Core::Action::EventItemAction::EventItemAction( Entity::ActorPtr pActor, uint32_t eventId, uint16_t action,
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef _EVENTITEMACTION_H_
|
||||
#define _EVENTITEMACTION_H_
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "src/servers/Server_Zone/Action/Action.h"
|
||||
#include "../Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
namespace Core {
|
||||
namespace Action {
|
||||
|
||||
class EventItemAction : public Action
|
||||
{
|
||||
|
@ -32,4 +33,4 @@ namespace Core { namespace Action {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "src/servers/Server_Zone/Action/Action.h"
|
||||
#include "Forwards.h"
|
||||
#include "Action/Action.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "Zone/Zone.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 "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/UpdateHpMpTpPacket.h"
|
||||
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
|
||||
#include "src/servers/Server_Zone/Action/ActionCollision.h"
|
||||
#include "src/servers/Server_Zone/ServerZone.h"
|
||||
#include "src/servers/Server_Zone/Session.h"
|
||||
#include "src/servers/Server_Zone/Math/CalcBattle.h"
|
||||
#include "StatusEffect/StatusEffect.h"
|
||||
#include "Action/ActionCollision.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Session.h"
|
||||
#include "Math/CalcBattle.h"
|
||||
#include "Actor.h"
|
||||
#include "Player.h"
|
||||
|
||||
|
@ -664,7 +664,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
uint64_t param2, Entity::Actor& pTarget )
|
||||
{
|
||||
|
||||
if ( isPlayer() )
|
||||
if( isPlayer() )
|
||||
{
|
||||
getAsPlayer()->sendDebug( std::to_string( pTarget.getId() ) );
|
||||
getAsPlayer()->sendDebug( "Handle script skill type: " + std::to_string( type ) );
|
||||
|
@ -686,7 +686,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
effectPacket.data().effectTarget = pTarget.getId();
|
||||
|
||||
// Todo: for each actor, calculate how much damage the calculated value should deal to them - 2-step damage calc. we only have 1-step
|
||||
switch ( type )
|
||||
switch( type )
|
||||
{
|
||||
|
||||
case ActionEffectType::Damage:
|
||||
|
@ -696,7 +696,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalDamage;
|
||||
effectPacket.data().effects[0].unknown_3 = 7;
|
||||
|
||||
if ( !actionInfoPtr->is_aoe )
|
||||
if( !actionInfoPtr->is_aoe )
|
||||
{
|
||||
// If action on this specific target is valid...
|
||||
if ( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Enemies ) )
|
||||
|
@ -704,11 +704,11 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
|
||||
sendToInRangeSet( effectPacket, true );
|
||||
|
||||
pTarget.takeDamage( static_cast< uint32_t >( param1 ) );
|
||||
|
||||
if ( pTarget.isAlive() )
|
||||
pTarget.onActionHostile( shared_from_this() );
|
||||
|
||||
|
||||
pTarget.takeDamage( static_cast< uint32_t >( param1 ) );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -716,7 +716,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
auto actorsCollided = ActionCollision::getActorsHitFromAction( pTarget.getPos(), getInRangeActors( true ),
|
||||
actionInfoPtr, TargetFilter::Enemies );
|
||||
|
||||
for ( const auto& pHitActor : actorsCollided )
|
||||
for( const auto& pHitActor : actorsCollided )
|
||||
{
|
||||
effectPacket.data().targetId = pHitActor->getId();
|
||||
effectPacket.data().effectTarget = pHitActor->getId();
|
||||
|
@ -724,17 +724,17 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
// todo: send to range of what? ourselves? when mob script hits this is going to be lacking
|
||||
sendToInRangeSet( effectPacket, true );
|
||||
|
||||
pHitActor->takeDamage( static_cast< uint32_t >( param1 ) );
|
||||
|
||||
if( pHitActor->isAlive() )
|
||||
pHitActor->onActionHostile( shared_from_this() );
|
||||
|
||||
pHitActor->takeDamage( static_cast< uint32_t >( param1 ) );
|
||||
|
||||
// Debug
|
||||
if ( isPlayer() )
|
||||
{
|
||||
if ( pHitActor->isPlayer() ) {
|
||||
if ( pHitActor->isPlayer() )
|
||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) + " (" + pHitActor->getName() + ")" );
|
||||
}
|
||||
else
|
||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) );
|
||||
}
|
||||
|
@ -752,9 +752,9 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
effectPacket.data().effects[0].effectType = ActionEffectType::Heal;
|
||||
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalHeal;
|
||||
|
||||
if ( !actionInfoPtr->is_aoe )
|
||||
if( !actionInfoPtr->is_aoe )
|
||||
{
|
||||
if ( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Allies ) )
|
||||
if( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Allies ) )
|
||||
break;
|
||||
|
||||
sendToInRangeSet( effectPacket, true );
|
||||
|
@ -768,7 +768,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
auto actorsCollided = ActionCollision::getActorsHitFromAction( pTarget.getPos(), getInRangeActors( true ),
|
||||
actionInfoPtr, TargetFilter::Allies );
|
||||
|
||||
for ( auto pHitActor : actorsCollided )
|
||||
for( auto pHitActor : actorsCollided )
|
||||
{
|
||||
effectPacket.data().targetId = pTarget.getId();
|
||||
effectPacket.data().effectTarget = pHitActor->getId();
|
||||
|
@ -777,11 +777,10 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
|||
pHitActor->heal( calculatedHeal );
|
||||
|
||||
// Debug
|
||||
if ( isPlayer() )
|
||||
if( isPlayer() )
|
||||
{
|
||||
if ( pHitActor->isPlayer() ) {
|
||||
if( pHitActor->isPlayer() )
|
||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) + " (" + pHitActor->getName() + ")" );
|
||||
}
|
||||
else
|
||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) );
|
||||
}
|
||||
|
@ -836,13 +835,14 @@ void Core::Entity::Actor::addStatusEffectById( uint32_t id, int32_t duration, En
|
|||
/*! \param StatusEffectPtr to be applied to the actor */
|
||||
void Core::Entity::Actor::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Actor& pSource, uint16_t param )
|
||||
{
|
||||
if( !hasStatusEffect( id ) )
|
||||
{
|
||||
StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, pSource.shared_from_this(),
|
||||
shared_from_this(), duration, 3000 ) );
|
||||
effect->setParam( param );
|
||||
addStatusEffect( effect );
|
||||
}
|
||||
if( hasStatusEffect( id ) )
|
||||
return;
|
||||
|
||||
StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, pSource.shared_from_this(),
|
||||
shared_from_this(), duration, 3000 ) );
|
||||
effect->setParam( param );
|
||||
addStatusEffect( effect );
|
||||
|
||||
}
|
||||
|
||||
float Core::Entity::Actor::getRotation() const
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _ACTOR_H_
|
||||
#define _ACTOR_H_
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
#include <stdint.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
|
||||
#include "Player.h"
|
||||
#include "BattleNpc.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 "Network/PacketWrappers/MoveActorPacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
using namespace Core::Common;
|
||||
using namespace Core::Network::Packets;
|
||||
|
@ -87,7 +87,7 @@ Core::Entity::BattleNpc::BattleNpc( uint16_t modelId, uint16_t nameid, const Com
|
|||
}
|
||||
|
||||
// spawn this player for pTarget
|
||||
void Core::Entity::BattleNpc::spawn( Core::Entity::PlayerPtr pTarget )
|
||||
void Core::Entity::BattleNpc::spawn( PlayerPtr pTarget )
|
||||
{
|
||||
//GamePacketNew< FFXIVIpcActorSpawn > spawnPacket( getId(), pTarget->getId() );
|
||||
|
||||
|
@ -149,7 +149,7 @@ void Core::Entity::BattleNpc::spawn( Core::Entity::PlayerPtr pTarget )
|
|||
}
|
||||
|
||||
// despawn
|
||||
void Core::Entity::BattleNpc::despawn( Core::Entity::ActorPtr pTarget )
|
||||
void Core::Entity::BattleNpc::despawn( ActorPtr pTarget )
|
||||
{
|
||||
|
||||
auto pPlayer = pTarget->getAsPlayer();
|
||||
|
@ -171,7 +171,7 @@ Core::Entity::StateMode Core::Entity::BattleNpc::getMode() const
|
|||
return m_mode;
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::setMode( Core::Entity::StateMode mode )
|
||||
void Core::Entity::BattleNpc::setMode( StateMode mode )
|
||||
{
|
||||
m_mode = mode;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ uint8_t Core::Entity::BattleNpc::getbehavior() const
|
|||
return m_behavior;
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::hateListAdd( Core::Entity::ActorPtr pActor, int32_t hateAmount )
|
||||
void Core::Entity::BattleNpc::hateListAdd( ActorPtr pActor, int32_t hateAmount )
|
||||
{
|
||||
auto hateEntry = new HateListEntry();
|
||||
hateEntry->m_hateAmount = hateAmount;
|
||||
|
@ -211,7 +211,7 @@ Core::Entity::ActorPtr Core::Entity::BattleNpc::hateListGetHighest()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::setOwner( Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::Entity::BattleNpc::setOwner( PlayerPtr pPlayer )
|
||||
{
|
||||
m_pOwner = pPlayer;
|
||||
|
||||
|
@ -234,7 +234,7 @@ void Core::Entity::BattleNpc::setOwner( Core::Entity::PlayerPtr pPlayer )
|
|||
|
||||
void Core::Entity::BattleNpc::sendPositionUpdate()
|
||||
{
|
||||
MoveActorPacket movePacket( shared_from_this(), 0x3A, 0x00, 0, 0x5A );
|
||||
MoveActorPacket movePacket( *this, 0x3A, 0x00, 0, 0x5A );
|
||||
sendToInRangeSet( movePacket );
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ bool Core::Entity::BattleNpc::moveTo( Common::FFXIVARR_POSITION3& pos )
|
|||
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::aggro( Core::Entity::ActorPtr pActor )
|
||||
void Core::Entity::BattleNpc::aggro( ActorPtr pActor )
|
||||
{
|
||||
|
||||
m_lastAttack = Util::getTimeMs();
|
||||
|
@ -296,7 +296,7 @@ void Core::Entity::BattleNpc::aggro( Core::Entity::ActorPtr pActor )
|
|||
}
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::deaggro( Core::Entity::ActorPtr pActor )
|
||||
void Core::Entity::BattleNpc::deaggro( ActorPtr pActor )
|
||||
{
|
||||
if( !hateListHasActor( pActor ) )
|
||||
hateListRemove( pActor );
|
||||
|
@ -322,7 +322,7 @@ void Core::Entity::BattleNpc::hateListClear()
|
|||
}
|
||||
|
||||
|
||||
void Core::Entity::BattleNpc::hateListRemove( Core::Entity::ActorPtr pActor )
|
||||
void Core::Entity::BattleNpc::hateListRemove( ActorPtr pActor )
|
||||
{
|
||||
auto it = m_hateList.begin();
|
||||
for( ; it != m_hateList.end(); ++it )
|
||||
|
@ -342,7 +342,7 @@ void Core::Entity::BattleNpc::hateListRemove( Core::Entity::ActorPtr pActor )
|
|||
}
|
||||
}
|
||||
|
||||
bool Core::Entity::BattleNpc::hateListHasActor( Core::Entity::ActorPtr pActor )
|
||||
bool Core::Entity::BattleNpc::hateListHasActor( ActorPtr pActor )
|
||||
{
|
||||
auto it = m_hateList.begin();
|
||||
for( ; it != m_hateList.end(); ++it )
|
||||
|
@ -363,7 +363,7 @@ uint32_t Core::Entity::BattleNpc::getNameId() const
|
|||
return m_nameId;
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::hateListUpdate( Core::Entity::ActorPtr pActor, int32_t hateAmount )
|
||||
void Core::Entity::BattleNpc::hateListUpdate( ActorPtr pActor, int32_t hateAmount )
|
||||
{
|
||||
|
||||
auto it = m_hateList.begin();
|
||||
|
@ -452,7 +452,7 @@ void Core::Entity::BattleNpc::onDeath()
|
|||
hateListClear();
|
||||
}
|
||||
|
||||
void Core::Entity::BattleNpc::onActionHostile( Core::Entity::ActorPtr pSource )
|
||||
void Core::Entity::BattleNpc::onActionHostile( ActorPtr pSource )
|
||||
{
|
||||
|
||||
if( hateListGetHighest() == nullptr )
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "Actor.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
namespace Entity {
|
||||
|
||||
enum StateMode
|
||||
|
@ -76,7 +75,7 @@ public:
|
|||
|
||||
void onDeath() override;
|
||||
|
||||
void onActionHostile( Core::Entity::ActorPtr pSource ) override;
|
||||
void onActionHostile( ActorPtr pSource ) override;
|
||||
|
||||
ActorPtr getClaimer() const;
|
||||
|
||||
|
@ -113,4 +112,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Config/XMLConfig.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Config/XMLConfig.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Session.h"
|
||||
#include "Session.h"
|
||||
#include "Player.h"
|
||||
#include "BattleNpc.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "Zone/ZoneMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/ServerZone.h"
|
||||
#include "ServerZone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ChatPacket.h"
|
||||
#include "Network/PacketWrappers/ModelEquipPacket.h"
|
||||
#include "Network/PacketWrappers/ActorSpawnPacket.h"
|
||||
#include "Network/PacketWrappers/UpdateHpMpTpPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
#include "Network/PacketWrappers/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 "Script/ScriptManager.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Social/FriendList.h"
|
||||
#include "src/servers/Server_Zone/Actor/Social/Manager/FriendListMgr.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Inventory/Item.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Inventory/Item.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 "src/servers/Server_Zone/Math/CalcStats.h"
|
||||
#include "src/servers/Server_Zone/Math/CalcBattle.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Event/Event.h"
|
||||
#include "Action/Action.h"
|
||||
#include "Action/EventAction.h"
|
||||
#include "Action/EventItemAction.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
#include "Math/CalcStats.h"
|
||||
#include "Math/CalcBattle.h"
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
@ -427,7 +427,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
|
|||
}
|
||||
queuePacket( contentFinderList );
|
||||
|
||||
Server::InitUIPacket initUIPacket( pPlayer );
|
||||
Server::InitUIPacket initUIPacket( *pPlayer );
|
||||
queuePacket( initUIPacket );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcPlayerClassInfo > classInfoPacket( getId() );
|
||||
|
@ -720,7 +720,7 @@ void Core::Entity::Player::gainLevel()
|
|||
|
||||
void Core::Entity::Player::unlock()
|
||||
{
|
||||
queuePacket( PlayerStateFlagsPacket( getAsPlayer(), PlayerStateFlagList{} ) );
|
||||
queuePacket( PlayerStateFlagsPacket( *getAsPlayer(), PlayerStateFlagList{} ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendStatusUpdate( bool toSelf )
|
||||
|
@ -756,7 +756,7 @@ uint8_t Core::Entity::Player::getLevel() const
|
|||
return static_cast< uint8_t >( m_classArray[classJobIndex] );
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getLevelForClass( Core::Common::ClassJob pClass ) const
|
||||
uint8_t Core::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
||||
{
|
||||
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( pClass )].exp_idx;
|
||||
return static_cast< uint8_t >( m_classArray[classJobIndex] );
|
||||
|
@ -785,7 +785,7 @@ void Core::Entity::Player::setInCombat( bool mode )
|
|||
m_bInCombat = mode;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setClassJob( Core::Common::ClassJob classJob )
|
||||
void Core::Entity::Player::setClassJob( Common::ClassJob classJob )
|
||||
{
|
||||
m_class = classJob;
|
||||
uint8_t level = getLevel();
|
||||
|
@ -814,7 +814,7 @@ void Core::Entity::Player::setLevel( uint8_t level )
|
|||
m_classArray[classJobIndex] = level;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJob classjob )
|
||||
void Core::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
|
||||
{
|
||||
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( classjob )].exp_idx;
|
||||
m_classArray[classJobIndex] = level;
|
||||
|
@ -822,7 +822,7 @@ void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJ
|
|||
|
||||
void Core::Entity::Player::sendModel()
|
||||
{
|
||||
ModelEquipPacket modelEquip( getAsPlayer() );
|
||||
ModelEquipPacket modelEquip( *getAsPlayer() );
|
||||
sendToInRangeSet( modelEquip, true );
|
||||
}
|
||||
|
||||
|
@ -853,7 +853,7 @@ uint64_t Core::Entity::Player::getModelSystemWeapon() const
|
|||
|
||||
int8_t Core::Entity::Player::getAetheryteMaskAt( uint8_t index ) const
|
||||
{
|
||||
if( index > 11 )
|
||||
if( index > sizeof( m_aetheryte ) )
|
||||
return 0;
|
||||
return m_aetheryte[index];
|
||||
}
|
||||
|
@ -884,18 +884,18 @@ void Core::Entity::Player::setLookAt( uint8_t index, uint8_t value )
|
|||
}
|
||||
|
||||
// spawn this player for pTarget
|
||||
void Core::Entity::Player::spawn( Core::Entity::PlayerPtr pTarget )
|
||||
void Core::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||
{
|
||||
g_log.debug( "[" + std::to_string( pTarget->getId() ) + "] Spawning " +
|
||||
getName() + " for " +
|
||||
pTarget->getName() );
|
||||
|
||||
PlayerSpawnPacket spawnActor( getAsPlayer(), pTarget );
|
||||
PlayerSpawnPacket spawnActor( *getAsPlayer(), *pTarget );
|
||||
pTarget->queuePacket( spawnActor );
|
||||
}
|
||||
|
||||
// despawn
|
||||
void Core::Entity::Player::despawn( Core::Entity::ActorPtr pTarget )
|
||||
void Core::Entity::Player::despawn( Entity::ActorPtr pTarget )
|
||||
{
|
||||
auto pPlayer = pTarget->getAsPlayer();
|
||||
|
||||
|
@ -906,7 +906,7 @@ void Core::Entity::Player::despawn( Core::Entity::ActorPtr pTarget )
|
|||
|
||||
Core::Entity::ActorPtr Core::Entity::Player::lookupTargetById( uint64_t targetId )
|
||||
{
|
||||
Core::Entity::ActorPtr targetActor;
|
||||
ActorPtr targetActor;
|
||||
auto inRange = getInRangeActors( true );
|
||||
for( auto actor : inRange )
|
||||
{
|
||||
|
@ -966,13 +966,11 @@ bool Core::Entity::Player::actionHasCastTime( uint32_t actionId ) //TODO: Add lo
|
|||
if( actionInfoPtr->is_instant )
|
||||
return false;
|
||||
|
||||
if( actionInfoPtr->cast_time == 0 )
|
||||
return false;
|
||||
return actionInfoPtr->cast_time != 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Entity::Player::hasStateFlag( Core::Common::PlayerStateFlag flag ) const
|
||||
bool Core::Entity::Player::hasStateFlag( Common::PlayerStateFlag flag ) const
|
||||
{
|
||||
int32_t iFlag = static_cast< uint32_t >( flag );
|
||||
|
||||
|
@ -983,7 +981,7 @@ bool Core::Entity::Player::hasStateFlag( Core::Common::PlayerStateFlag flag ) co
|
|||
return ( m_stateFlags[index] & value ) != 0;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setStateFlag( Core::Common::PlayerStateFlag flag )
|
||||
void Core::Entity::Player::setStateFlag( Common::PlayerStateFlag flag )
|
||||
{
|
||||
int32_t iFlag = static_cast< uint32_t >( flag );
|
||||
|
||||
|
@ -1011,10 +1009,10 @@ void Core::Entity::Player::setStateFlags( std::vector< Common::PlayerStateFlag >
|
|||
|
||||
void Core::Entity::Player::sendStateFlags()
|
||||
{
|
||||
queuePacket( PlayerStateFlagsPacket( getAsPlayer() ) );
|
||||
queuePacket( PlayerStateFlagsPacket( *getAsPlayer() ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::unsetStateFlag( Core::Common::PlayerStateFlag flag )
|
||||
void Core::Entity::Player::unsetStateFlag( Common::PlayerStateFlag flag )
|
||||
{
|
||||
if( !hasStateFlag( flag ) )
|
||||
return;
|
||||
|
@ -1088,7 +1086,7 @@ void Core::Entity::Player::update( int64_t currTime )
|
|||
|
||||
|
||||
if( Math::Util::distance(getPos().x, getPos().y, getPos().z,
|
||||
actor->getPos().x, actor->getPos().y, actor->getPos().z) <= range )
|
||||
actor->getPos().x, actor->getPos().y, actor->getPos().z) <= range )
|
||||
{
|
||||
|
||||
if( ( currTime - m_lastAttack ) > mainWeap->getDelay() )
|
||||
|
@ -1114,7 +1112,7 @@ void Core::Entity::Player::update( int64_t currTime )
|
|||
|
||||
void Core::Entity::Player::onMobKill( uint16_t nameId )
|
||||
{
|
||||
g_scriptMgr.onMobKill( getAsPlayer(), nameId );
|
||||
g_scriptMgr.onMobKill( *getAsPlayer(), nameId );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::freePlayerSpawnId( uint32_t actorId )
|
||||
|
@ -1149,57 +1147,57 @@ uint8_t Core::Entity::Player::getHomepoint() const
|
|||
return m_homePoint;
|
||||
}
|
||||
|
||||
uint16_t * Core::Entity::Player::getClassArray()
|
||||
uint16_t* Core::Entity::Player::getClassArray()
|
||||
{
|
||||
return m_classArray;
|
||||
}
|
||||
|
||||
const uint16_t * Core::Entity::Player::getClassArray() const
|
||||
const uint16_t* Core::Entity::Player::getClassArray() const
|
||||
{
|
||||
return m_classArray;
|
||||
}
|
||||
|
||||
const uint8_t * Core::Entity::Player::getLookArray() const
|
||||
const uint8_t* Core::Entity::Player::getLookArray() const
|
||||
{
|
||||
return m_customize;
|
||||
}
|
||||
|
||||
const uint32_t * Core::Entity::Player::getModelArray() const
|
||||
const uint32_t* Core::Entity::Player::getModelArray() const
|
||||
{
|
||||
return m_modelEquip;
|
||||
}
|
||||
|
||||
uint32_t * Core::Entity::Player::getExpArray()
|
||||
uint32_t* Core::Entity::Player::getExpArray()
|
||||
{
|
||||
return m_expArray;
|
||||
}
|
||||
|
||||
const uint32_t * Core::Entity::Player::getExpArray() const
|
||||
const uint32_t* Core::Entity::Player::getExpArray() const
|
||||
{
|
||||
return m_expArray;
|
||||
}
|
||||
|
||||
uint8_t * Core::Entity::Player::getHowToArray()
|
||||
uint8_t* Core::Entity::Player::getHowToArray()
|
||||
{
|
||||
return m_howTo;
|
||||
}
|
||||
|
||||
const uint8_t * Core::Entity::Player::getHowToArray() const
|
||||
const uint8_t* Core::Entity::Player::getHowToArray() const
|
||||
{
|
||||
return m_howTo;
|
||||
}
|
||||
|
||||
const uint8_t * Core::Entity::Player::getUnlockBitmask() const
|
||||
const uint8_t* Core::Entity::Player::getUnlockBitmask() const
|
||||
{
|
||||
return m_unlocks;
|
||||
}
|
||||
|
||||
const uint8_t * Core::Entity::Player::getOrchestrionBitmask() const
|
||||
const uint8_t* Core::Entity::Player::getOrchestrionBitmask() const
|
||||
{
|
||||
return m_orchestrion;
|
||||
}
|
||||
|
||||
const uint8_t * Core::Entity::Player::getMountGuideBitmask() const
|
||||
const uint8_t* Core::Entity::Player::getMountGuideBitmask() const
|
||||
{
|
||||
return m_mountGuide;
|
||||
}
|
||||
|
@ -1219,12 +1217,12 @@ uint8_t Core::Entity::Player::getGc() const
|
|||
return m_gc;
|
||||
}
|
||||
|
||||
const uint8_t * Core::Entity::Player::getGcRankArray() const
|
||||
const uint8_t* Core::Entity::Player::getGcRankArray() const
|
||||
{
|
||||
return m_gcRank;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::queuePacket( Core::Network::Packets::GamePacketPtr pPacket )
|
||||
void Core::Entity::Player::queuePacket( Network::Packets::GamePacketPtr pPacket )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( m_id );
|
||||
|
||||
|
@ -1238,7 +1236,7 @@ void Core::Entity::Player::queuePacket( Core::Network::Packets::GamePacketPtr pP
|
|||
|
||||
}
|
||||
|
||||
void Core::Entity::Player::queueChatPacket( Core::Network::Packets::GamePacketPtr pPacket )
|
||||
void Core::Entity::Player::queueChatPacket( Network::Packets::GamePacketPtr pPacket )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( m_id );
|
||||
|
||||
|
@ -1261,7 +1259,7 @@ void Core::Entity::Player::setLoadingComplete( bool bComplete )
|
|||
m_bLoadingComplete = bComplete;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::performZoning(uint16_t zoneId, const Common::FFXIVARR_POSITION3 &pos, float rotation)
|
||||
void Core::Entity::Player::performZoning( uint16_t zoneId, const Common::FFXIVARR_POSITION3 &pos, float rotation )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_zoneId = zoneId;
|
||||
|
@ -1315,12 +1313,12 @@ void Core::Entity::Player::sendNotice( const std::string& message ) //Purple Tex
|
|||
|
||||
void Core::Entity::Player::sendUrgent( const std::string& message ) //Red Text
|
||||
{
|
||||
queuePacket( ChatPacket( getAsPlayer(), ChatType::ServerUrgent, message ) );
|
||||
queuePacket( ChatPacket( *getAsPlayer(), ChatType::ServerUrgent, message ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendDebug( const std::string& message ) //Grey Text
|
||||
{
|
||||
queuePacket( ChatPacket( getAsPlayer(), ChatType::ServerDebug, message ) );
|
||||
queuePacket( ChatPacket( *getAsPlayer(), ChatType::ServerDebug, message ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
|
||||
|
@ -1334,14 +1332,14 @@ void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
|
|||
}
|
||||
|
||||
|
||||
void Core::Entity::Player::onMobAggro( Core::Entity::BattleNpcPtr pBNpc )
|
||||
void Core::Entity::Player::onMobAggro( BattleNpcPtr pBNpc )
|
||||
{
|
||||
hateListAdd( pBNpc );
|
||||
|
||||
queuePacket( ActorControlPacket142( getId(), ToggleAggro, 1 ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::onMobDeaggro( Core::Entity::BattleNpcPtr pBNpc )
|
||||
void Core::Entity::Player::onMobDeaggro( BattleNpcPtr pBNpc )
|
||||
{
|
||||
hateListRemove( pBNpc );
|
||||
|
||||
|
@ -1349,7 +1347,7 @@ void Core::Entity::Player::onMobDeaggro( Core::Entity::BattleNpcPtr pBNpc )
|
|||
queuePacket( ActorControlPacket142( getId(), ToggleAggro ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::hateListAdd( Core::Entity::BattleNpcPtr pBNpc )
|
||||
void Core::Entity::Player::hateListAdd( BattleNpcPtr pBNpc )
|
||||
|
||||
{
|
||||
if( m_freeHateSlotQueue.empty() )
|
||||
|
@ -1361,7 +1359,7 @@ void Core::Entity::Player::hateListAdd( Core::Entity::BattleNpcPtr pBNpc )
|
|||
|
||||
}
|
||||
|
||||
void Core::Entity::Player::hateListRemove( Core::Entity::BattleNpcPtr pBNpc )
|
||||
void Core::Entity::Player::hateListRemove( BattleNpcPtr pBNpc )
|
||||
{
|
||||
|
||||
auto it = m_actorIdTohateSlotMap.begin();
|
||||
|
@ -1379,7 +1377,7 @@ void Core::Entity::Player::hateListRemove( Core::Entity::BattleNpcPtr pBNpc )
|
|||
}
|
||||
}
|
||||
|
||||
bool Core::Entity::Player::hateListHasMob( Core::Entity::BattleNpcPtr pBNpc )
|
||||
bool Core::Entity::Player::hateListHasMob( BattleNpcPtr pBNpc )
|
||||
{
|
||||
|
||||
auto it = m_actorIdTohateSlotMap.begin();
|
||||
|
@ -1421,7 +1419,7 @@ void Core::Entity::Player::setIsLogin( bool bIsLogin )
|
|||
m_bIsLogin = bIsLogin;
|
||||
}
|
||||
|
||||
uint8_t * Core::Entity::Player::getTitleList()
|
||||
uint8_t* Core::Entity::Player::getTitleList()
|
||||
{
|
||||
return m_titleList;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
#ifndef _PLAYER_H
|
||||
#define _PLAYER_H
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
<<<<<<< HEAD
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Zone/Actor/Social/FriendList.h>
|
||||
#include <src/servers/Server_Zone/Actor/Social/Manager/FriendListMgr.h>
|
||||
=======
|
||||
#include <Server_Common/Common.h>
|
||||
>>>>>>> d84d3be97820f596f748daefbdf8b472df002c61
|
||||
|
||||
#include "Actor.h"
|
||||
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include <map>
|
||||
#include <queue>
|
||||
|
||||
|
@ -245,7 +249,7 @@ public:
|
|||
/*! returns the level of the currently active class / job */
|
||||
uint8_t getLevel() const override;
|
||||
/*! returns the level of the provided class / job */
|
||||
uint8_t getLevelForClass( Core::Common::ClassJob pClass ) const;
|
||||
uint8_t getLevelForClass( Common::ClassJob pClass ) const;
|
||||
/*! returns the exp of the currently active class / job */
|
||||
uint32_t getExp() const;
|
||||
/*! sets the exp of the currently active class / job */
|
||||
|
@ -257,9 +261,9 @@ public:
|
|||
/*! set level on the currently active class / job to given level */
|
||||
void setLevel( uint8_t level );
|
||||
/*! set level on the provided class / job to given level */
|
||||
void setLevelForClass( uint8_t level, Core::Common::ClassJob classjob );
|
||||
void setLevelForClass( uint8_t level, Common::ClassJob classjob );
|
||||
/*! change class or job to given class / job */
|
||||
void setClassJob( Core::Common::ClassJob classJob );
|
||||
void setClassJob( Common::ClassJob classJob );
|
||||
/*! returns a pointer to the class array */
|
||||
uint16_t* getClassArray();
|
||||
/*! returns a const pointer to the class array */
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Config/XMLConfig.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Config/XMLConfig.h>
|
||||
|
||||
#include "Player.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.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 "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/EventStartPacket.h"
|
||||
#include "Network/PacketWrappers/EventPlayPacket.h"
|
||||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Action/EventAction.h"
|
||||
#include "src/servers/Server_Zone/Action/EventItemAction.h"
|
||||
#include "Action/EventAction.h"
|
||||
#include "Action/EventItemAction.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Event/Event.h"
|
||||
#include "src/servers/Server_Zone/Event/Event.h"
|
||||
#include "Server_Zone/ServerZone.h"
|
||||
#include "Event/Event.h"
|
||||
#include "Event/Event.h"
|
||||
#include "ServerZone.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
|
||||
#include "Player.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "Zone/ZoneMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
||||
#include "src/servers/Server_Zone/Inventory/Item.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Inventory/Item.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
||||
|
@ -31,7 +31,7 @@ void Core::Entity::Player::sendItemLevel()
|
|||
}
|
||||
|
||||
// TODO: This has to be redone and simplified
|
||||
void Core::Entity::Player::equipWeapon( Core::ItemPtr pItem )
|
||||
void Core::Entity::Player::equipWeapon( ItemPtr pItem )
|
||||
{
|
||||
ClassJob currentClass = static_cast< ClassJob >( getClass() );
|
||||
|
||||
|
@ -86,7 +86,7 @@ void Core::Entity::Player::equipWeapon( Core::ItemPtr pItem )
|
|||
}
|
||||
|
||||
// equip an item
|
||||
void Core::Entity::Player::equipItem( Inventory::EquipSlot equipSlotId, Core::ItemPtr pItem, bool sendUpdate )
|
||||
void Core::Entity::Player::equipItem( Inventory::EquipSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
|
||||
{
|
||||
|
||||
//g_log.debug( "Equipping into slot " + std::to_string( equipSlotId ) );
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/QuestMessagePacket.h"
|
||||
#include "Network/PacketWrappers/QuestMessagePacket.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Session.h"
|
||||
#include "Server_Zone/Session.h"
|
||||
#include "Player.h"
|
||||
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
||||
#include "Server_Zone/Inventory/Inventory.h"
|
||||
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
||||
|
|
|
@ -1,34 +1,32 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Config/XMLConfig.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Config/XMLConfig.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
#include <set>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#include <servers/Server_Common/Common.h>
|
||||
|
||||
#include "Player.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/ZoneMgr.h"
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "Zone/ZoneMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/ServerZone.h"
|
||||
#include "ServerZone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
|
@ -41,11 +39,11 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
// load player from the db
|
||||
bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||
bool Core::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
||||
{
|
||||
const std::string char_id_str = std::to_string( charId );
|
||||
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEL );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CharaDbStatements::CHARA_SEL );
|
||||
|
||||
stmt->setUInt( 1, charId );
|
||||
auto res = g_charaDb.query( stmt );
|
||||
|
@ -220,7 +218,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
|||
bool Core::Entity::Player::loadActiveQuests()
|
||||
{
|
||||
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_QUEST_SEL );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CharaDbStatements::CHARA_QUEST_SEL );
|
||||
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = g_charaDb.query( stmt );
|
||||
|
@ -257,7 +255,7 @@ bool Core::Entity::Player::loadClassData()
|
|||
{
|
||||
|
||||
// ClassIdx, Exp, Lvl
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_CLASS_SEL );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CharaDbStatements::CHARA_CLASS_SEL );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = g_charaDb.query( stmt );
|
||||
|
||||
|
@ -276,7 +274,7 @@ bool Core::Entity::Player::loadClassData()
|
|||
|
||||
bool Core::Entity::Player::loadSearchInfo()
|
||||
{
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEARCHINFO_SEL );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CharaDbStatements::CHARA_SEARCHINFO_SEL );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = g_charaDb.query( stmt );
|
||||
|
||||
|
@ -304,7 +302,7 @@ void Core::Entity::Player::updateSql()
|
|||
"EquippedMannequin 44, ConfigFlags 45, QuestCompleteFlags 46, OpeningSequence 47, "
|
||||
"QuestTracking 48, GrandCompany 49, GrandCompanyRank 50, Discovery 51, GMRank 52, Unlocks 53, "
|
||||
"CFPenaltyUntil 54"*/
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_UP );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CharaDbStatements::CHARA_UP );
|
||||
|
||||
stmt->setInt( 1, getHp() );
|
||||
stmt->setInt( 2, getMp() );
|
||||
|
@ -431,7 +429,7 @@ void Core::Entity::Player::updateDbClass() const
|
|||
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
|
||||
|
||||
//Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?
|
||||
auto stmtS = g_charaDb.getPreparedStatement( Core::Db::CHARA_CLASS_UP );
|
||||
auto stmtS = g_charaDb.getPreparedStatement( Db::CHARA_CLASS_UP );
|
||||
stmtS->setInt( 1, getExp() );
|
||||
stmtS->setInt( 2, getLevel() );
|
||||
stmtS->setInt( 3, m_id );
|
||||
|
@ -441,17 +439,17 @@ void Core::Entity::Player::updateDbClass() const
|
|||
|
||||
void Core::Entity::Player::updateDbSearchInfo() const
|
||||
{
|
||||
auto stmtS = g_charaDb.getPreparedStatement( Core::Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||
auto stmtS = g_charaDb.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||
stmtS->setInt( 1, m_searchSelectClass );
|
||||
stmtS->setInt( 2, m_id );
|
||||
g_charaDb.execute( stmtS );
|
||||
|
||||
auto stmtS1 = g_charaDb.getPreparedStatement( Core::Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
auto stmtS1 = g_charaDb.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
stmtS1->setInt( 1, m_searchSelectRegion );
|
||||
stmtS1->setInt( 2, m_id );
|
||||
g_charaDb.execute( stmtS1 );
|
||||
|
||||
auto stmtS2 = g_charaDb.getPreparedStatement( Core::Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
auto stmtS2 = g_charaDb.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
stmtS2->setString( 1, string( m_searchMessage != nullptr ? m_searchMessage : "" ) );
|
||||
stmtS2->setInt( 2, m_id );
|
||||
g_charaDb.execute( stmtS2 );
|
||||
|
@ -465,7 +463,7 @@ void Core::Entity::Player::updateDbAllQuests() const
|
|||
if( !m_activeQuests[i] )
|
||||
continue;
|
||||
|
||||
auto stmtS3 = g_charaDb.getPreparedStatement( Core::Db::CHARA_QUEST_UP );
|
||||
auto stmtS3 = g_charaDb.getPreparedStatement( Db::CHARA_QUEST_UP );
|
||||
stmtS3->setInt( 1, m_activeQuests[i]->c.sequence );
|
||||
stmtS3->setInt( 2, m_activeQuests[i]->c.flags );
|
||||
stmtS3->setInt( 3, m_activeQuests[i]->c.UI8A );
|
||||
|
@ -484,7 +482,7 @@ void Core::Entity::Player::updateDbAllQuests() const
|
|||
|
||||
void Core::Entity::Player::deleteQuest( uint16_t questId ) const
|
||||
{
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CHARA_QUEST_DEL );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CHARA_QUEST_DEL );
|
||||
stmt->setInt( 1, m_id );
|
||||
stmt->setInt( 2, questId );
|
||||
g_charaDb.execute( stmt );
|
||||
|
@ -492,7 +490,7 @@ void Core::Entity::Player::deleteQuest( uint16_t questId ) const
|
|||
|
||||
void Core::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const
|
||||
{
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CHARA_QUEST_INS );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Db::CHARA_QUEST_INS );
|
||||
stmt->setInt( 1, m_id );
|
||||
stmt->setInt( 2, index );
|
||||
stmt->setInt( 3, questId );
|
||||
|
|
|
@ -3,6 +3,7 @@ cmake_policy(SET CMP0015 NEW)
|
|||
cmake_policy(SET CMP0014 OLD)
|
||||
|
||||
project(Sapphire_Zone)
|
||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
|
||||
file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
/*.h
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
#ifndef _GAMECOMMAND_H_
|
||||
#define _GAMECOMMAND_H_
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
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 DebugCommand
|
||||
{
|
||||
public:
|
||||
|
||||
using pFunc = void ( DebugCommandHandler::* )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
||||
using pFunc = void ( DebugCommandHandler::* )( char *, Entity::Player&, boost::shared_ptr< DebugCommand > );
|
||||
|
||||
// String for the command
|
||||
std::string m_commandName;
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Version.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Version.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
#include "DebugCommand.h"
|
||||
#include "DebugCommandHandler.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 "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Actor/BattleNpc.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/ServerZone.h"
|
||||
#include "ServerZone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
|
||||
#include "src/servers/Server_Zone/Session.h"
|
||||
#include "StatusEffect/StatusEffect.h"
|
||||
#include "Session.h"
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
|
@ -63,18 +63,18 @@ Core::DebugCommandHandler::~DebugCommandHandler()
|
|||
}
|
||||
|
||||
// add a command set to the register map
|
||||
void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::DebugCommand::pFunc functionPtr,
|
||||
const std::string& hText, uint8_t uLevel )
|
||||
void Core::DebugCommandHandler::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
||||
const std::string& hText, uint8_t uLevel )
|
||||
{
|
||||
m_commandMap[std::string( n )] = boost::make_shared<DebugCommand>( 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::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::DebugCommandHandler::execCommand( char * data, Entity::Player& player )
|
||||
{
|
||||
|
||||
// define callback pointer
|
||||
void ( DebugCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
||||
void ( DebugCommandHandler::*pf )( char *, Entity::Player&, boost::shared_ptr< DebugCommand > );
|
||||
|
||||
std::string commandString;
|
||||
|
||||
|
@ -94,18 +94,18 @@ void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPt
|
|||
|
||||
if( it == m_commandMap.end() )
|
||||
// no command found, do something... or not
|
||||
pPlayer->sendUrgent( "Command not found." );
|
||||
player.sendUrgent( "Command not found." );
|
||||
else
|
||||
{
|
||||
if( pPlayer->getGmRank() < it->second->getRequiredGmLevel() )
|
||||
if( player.getGmRank() < it->second->getRequiredGmLevel() )
|
||||
{
|
||||
pPlayer->sendUrgent( "You are not allowed to use this command." );
|
||||
player.sendUrgent( "You are not allowed to use this command." );
|
||||
return;
|
||||
}
|
||||
|
||||
// command found, call the callback function and pass parameters if present.
|
||||
pf = ( *it ).second->m_pFunc;
|
||||
( this->*pf )( data, pPlayer, ( *it ).second );
|
||||
( this->*pf )( data, player, ( *it ).second );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,26 +117,26 @@ void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPt
|
|||
// Definition of the commands
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerPtr pPlayer,
|
||||
boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::scriptReload( char * data, Entity::Player& player,
|
||||
boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
g_scriptMgr.reload();
|
||||
pPlayer->sendDebug( "Scripts reloaded." );
|
||||
player.sendDebug( "Scripts reloaded." );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
pPlayer->sendDebug( "Registered debug commands:" );
|
||||
player.sendDebug( "Registered debug commands:" );
|
||||
for ( auto cmd : m_commandMap )
|
||||
{
|
||||
if ( pPlayer->getGmRank( ) >= cmd.second->m_gmLevel )
|
||||
if ( player.getGmRank( ) >= cmd.second->m_gmLevel )
|
||||
{
|
||||
pPlayer->sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) );
|
||||
player.sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
std::string subCommand = "";
|
||||
std::string params = "";
|
||||
|
@ -156,7 +156,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
|
||||
g_log.debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
|
@ -170,25 +170,25 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
if( ( posX == 0xcccccccc ) || ( posY == 0xcccccccc ) || ( posZ == 0xcccccccc ) )
|
||||
{
|
||||
pPlayer->sendUrgent( "Syntaxerror." );
|
||||
player.sendUrgent( "Syntaxerror." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( subCommand == "pos" )
|
||||
pPlayer->setPosition( static_cast< float >( posX ),
|
||||
static_cast< float >( posY ),
|
||||
static_cast< float >( posZ ) );
|
||||
player.setPosition( static_cast< float >( posX ),
|
||||
static_cast< float >( posY ),
|
||||
static_cast< float >( posZ ) );
|
||||
else
|
||||
pPlayer->setPosition( pPlayer->getPos().x + static_cast< float >( posX ),
|
||||
pPlayer->getPos().y + static_cast< float >( posY ),
|
||||
pPlayer->getPos().z + static_cast< float >( posZ ) );
|
||||
player.setPosition( player.getPos().x + static_cast< float >( posX ),
|
||||
player.getPos().y + static_cast< float >( posY ),
|
||||
player.getPos().z + static_cast< float >( posZ ) );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
|
||||
setActorPosPacket( pPlayer->getId() );
|
||||
setActorPosPacket.data().x = pPlayer->getPos().x;
|
||||
setActorPosPacket.data().y = pPlayer->getPos().y;
|
||||
setActorPosPacket.data().z = pPlayer->getPos().z;
|
||||
pPlayer->queuePacket( setActorPosPacket );
|
||||
setActorPosPacket( player.getId() );
|
||||
setActorPosPacket.data().x = player.getPos().x;
|
||||
setActorPosPacket.data().y = player.getPos().y;
|
||||
setActorPosPacket.data().z = player.getPos().z;
|
||||
player.queuePacket( setActorPosPacket );
|
||||
|
||||
}
|
||||
else if( ( subCommand == "tele" ) && ( params != "" ) )
|
||||
|
@ -196,7 +196,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
int32_t aetheryteId;
|
||||
sscanf( params.c_str(), "%i", &aetheryteId );
|
||||
|
||||
pPlayer->teleport( aetheryteId );
|
||||
player.teleport( aetheryteId );
|
||||
}
|
||||
else if( ( subCommand == "discovery" ) && ( params != "" ) )
|
||||
{
|
||||
|
@ -204,10 +204,10 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
int32_t discover_id;
|
||||
sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcDiscovery > discoveryPacket( pPlayer->getId() );
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcDiscovery > discoveryPacket( player.getId() );
|
||||
discoveryPacket.data().map_id = map_id;
|
||||
discoveryPacket.data().map_part_id = discover_id;
|
||||
pPlayer->queuePacket( discoveryPacket );
|
||||
player.queuePacket( discoveryPacket );
|
||||
}
|
||||
|
||||
else if( ( subCommand == "discovery_pos" ) && ( params != "" ) )
|
||||
|
@ -231,8 +231,8 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
else if( subCommand == "discovery_reset" )
|
||||
{
|
||||
pPlayer->resetDiscovery();
|
||||
pPlayer->queuePacket( Network::Packets::Server::InitUIPacket( pPlayer ) );
|
||||
player.resetDiscovery();
|
||||
player.queuePacket( Network::Packets::Server::InitUIPacket( player ) );
|
||||
}
|
||||
else if( subCommand == "classjob" )
|
||||
{
|
||||
|
@ -240,28 +240,28 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
|
||||
if( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) == 0 )
|
||||
if( player.getLevelForClass( static_cast< Common::ClassJob > ( id ) ) == 0 )
|
||||
{
|
||||
pPlayer->setLevelForClass( 1, static_cast<Core::Common::ClassJob> ( id ) );
|
||||
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
||||
player.setLevelForClass( 1, static_cast< Common::ClassJob > ( id ) );
|
||||
player.setClassJob( static_cast< Common::ClassJob > ( id ) );
|
||||
}
|
||||
else
|
||||
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
||||
player.setClassJob( static_cast< Common::ClassJob > ( id ) );
|
||||
}
|
||||
else if ( subCommand == "cfpenalty" )
|
||||
{
|
||||
int32_t minutes;
|
||||
sscanf( params.c_str(), "%d", &minutes );
|
||||
|
||||
pPlayer->setCFPenaltyMinutes( minutes );
|
||||
player.setCFPenaltyMinutes( minutes );
|
||||
}
|
||||
else if ( subCommand == "eorzeatime" )
|
||||
{
|
||||
uint64_t timestamp;
|
||||
sscanf( params.c_str(), "%" SCNu64, ×tamp );
|
||||
|
||||
pPlayer->setEorzeaTimeOffset( timestamp );
|
||||
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
|
||||
player.setEorzeaTimeOffset( timestamp );
|
||||
player.sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
|
||||
}
|
||||
else if ( subCommand == "model" )
|
||||
{
|
||||
|
@ -269,26 +269,26 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
uint32_t val;
|
||||
sscanf( params.c_str(), "%d %d", &slot, &val );
|
||||
|
||||
pPlayer->setModelForSlot( static_cast<Inventory::EquipSlot>( slot ), val );
|
||||
pPlayer->sendModel();
|
||||
pPlayer->sendDebug( "Model updated" );
|
||||
player.setModelForSlot( static_cast< Inventory::EquipSlot >( slot ), val );
|
||||
player.sendModel();
|
||||
player.sendDebug( "Model updated" );
|
||||
}
|
||||
else if ( subCommand == "mount" )
|
||||
{
|
||||
int32_t id;
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
|
||||
pPlayer->dismount();
|
||||
pPlayer->mount( id );
|
||||
player.dismount();
|
||||
player.mount( id );
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( subCommand + " is not a valid SET command." );
|
||||
player.sendUrgent( subCommand + " is not a valid SET command." );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
@ -311,7 +311,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
|
||||
g_log.debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
|
@ -323,18 +323,18 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m );
|
||||
|
||||
StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, pPlayer, pPlayer, duration, 3000 ) );
|
||||
StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(), duration, 3000 ) );
|
||||
effect->setParam( param );
|
||||
|
||||
pPlayer->addStatusEffect( effect );
|
||||
player.addStatusEffect( effect );
|
||||
}
|
||||
else if ( subCommand == "title" )
|
||||
else if( subCommand == "title" )
|
||||
{
|
||||
uint32_t titleId;
|
||||
sscanf( params.c_str(), "%u", &titleId );
|
||||
|
||||
pPlayer->addTitle( titleId );
|
||||
pPlayer->sendNotice( "Added title (ID: " + std::to_string( titleId ) + ")" );
|
||||
player.addTitle( titleId );
|
||||
player.sendNotice( "Added title (ID: " + std::to_string( titleId ) + ")" );
|
||||
}
|
||||
else if( subCommand == "spawn" )
|
||||
{
|
||||
|
@ -342,9 +342,9 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%d %d", &model, &name );
|
||||
|
||||
Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( model, name, pPlayer->getPos() ) );
|
||||
Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( model, name, player.getPos() ) );
|
||||
|
||||
auto pZone = pPlayer->getCurrentZone();
|
||||
auto pZone = player.getCurrentZone();
|
||||
pBNpc->setCurrentZone( pZone );
|
||||
pZone->pushActor( pBNpc );
|
||||
|
||||
|
@ -354,8 +354,8 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
// temporary research packet
|
||||
int32_t opcode;
|
||||
sscanf( params.c_str(), "%x", &opcode );
|
||||
Network::Packets::GamePacketPtr pPe( new Network::Packets::GamePacket( opcode, 0x30, pPlayer->getId(), pPlayer->getId() ) );
|
||||
pPlayer->queuePacket( pPe );
|
||||
Network::Packets::GamePacketPtr pPe( new Network::Packets::GamePacket( opcode, 0x30, player.getId(), player.getId() ) );
|
||||
player.queuePacket( pPe );
|
||||
}
|
||||
else if( subCommand == "actrl" )
|
||||
{
|
||||
|
@ -373,9 +373,9 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%x %x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId );
|
||||
|
||||
pPlayer->sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||
player.sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, pPlayer->getId() );
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, player.getId() );
|
||||
actorControl.data().category = opcode;
|
||||
actorControl.data().param1 = param1;
|
||||
actorControl.data().param2 = param2;
|
||||
|
@ -383,29 +383,29 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
actorControl.data().param4 = param4;
|
||||
actorControl.data().param5 = param5;
|
||||
actorControl.data().param6 = param6;
|
||||
pPlayer->queuePacket( actorControl );
|
||||
player.queuePacket( actorControl );
|
||||
|
||||
|
||||
/*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId);
|
||||
|
||||
Network::Packets::Server::ServerNoticePacket noticePacket(pPlayer, "Injecting ACTOR_CONTROL " + std::to_string(opcode));
|
||||
Network::Packets::Server::ServerNoticePacket noticePacket( player, "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||
|
||||
pPlayer->queuePacket(noticePacket);
|
||||
player.queuePacket( noticePacket );
|
||||
|
||||
Network::Packets::Server::ActorControlPacket143 controlPacket(pPlayer, opcode,
|
||||
param1, param2, param3, param4, param5, param6, playerId);
|
||||
pPlayer->queuePacket(controlPacket);*/
|
||||
Network::Packets::Server::ActorControlPacket143 controlPacket( player, opcode,
|
||||
param1, param2, param3, param4, param5, param6, playerId );
|
||||
player.queuePacket( controlPacket );*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( subCommand + " is not a valid ADD command." );
|
||||
player.sendUrgent( subCommand + " is not a valid ADD command." );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::get( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
@ -425,45 +425,45 @@ void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
|
||||
g_log.debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
if( ( subCommand == "pos" ) )
|
||||
{
|
||||
|
||||
int16_t map_id = g_exdData.m_zoneInfoMap[pPlayer->getCurrentZone()->getId()].map_id;
|
||||
int16_t map_id = g_exdData.m_zoneInfoMap[player.getCurrentZone()->getId()].map_id;
|
||||
|
||||
pPlayer->sendNotice( "Pos:\n" +
|
||||
std::to_string( pPlayer->getPos().x ) + "\n" +
|
||||
std::to_string( pPlayer->getPos().y ) + "\n" +
|
||||
std::to_string( pPlayer->getPos().z ) + "\n" +
|
||||
std::to_string( pPlayer->getRotation() ) + "\nMapId: " +
|
||||
std::to_string( map_id ) + "\nZoneID: " +
|
||||
std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" );
|
||||
player.sendNotice( "Pos:\n" +
|
||||
std::to_string( player.getPos().x ) + "\n" +
|
||||
std::to_string( player.getPos().y ) + "\n" +
|
||||
std::to_string( player.getPos().z ) + "\n" +
|
||||
std::to_string( player.getRotation() ) + "\nMapId: " +
|
||||
std::to_string( map_id ) + "\nZoneID: " +
|
||||
std::to_string( player.getCurrentZone()->getId() ) + "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( subCommand + " is not a valid GET command." );
|
||||
player.sendUrgent( subCommand + " is not a valid GET command." );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::injectPacket( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::injectPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( pPlayer->getId() );
|
||||
auto pSession = g_serverZone.getSession( player.getId() );
|
||||
if( pSession )
|
||||
pSession->getZoneConnection()->injectPacket( data + 7, pPlayer );
|
||||
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::injectChatPacket( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::injectChatPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( pPlayer->getId() );
|
||||
auto pSession = g_serverZone.getSession( player.getId() );
|
||||
if( pSession )
|
||||
pSession->getChatConnection()->injectPacket( data + 8, pPlayer );
|
||||
pSession->getChatConnection()->injectPacket( data + 8, player );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command )
|
||||
void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
std::string subCommand;
|
||||
|
||||
|
@ -472,7 +472,7 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, b
|
|||
|
||||
std::size_t spos = tmpCommand.find_first_of( " " );
|
||||
|
||||
auto& pos = pPlayer->getPos();
|
||||
auto& pos = player.getPos();
|
||||
|
||||
int32_t offset = 0;
|
||||
char direction[20];
|
||||
|
@ -480,45 +480,44 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, b
|
|||
|
||||
sscanf( tmpCommand.c_str(), "%d %s", &offset, direction );
|
||||
|
||||
|
||||
if( direction[0] == 'u' || direction[0] == '+' )
|
||||
{
|
||||
pos.y += offset;
|
||||
pPlayer->sendNotice( "nudge: Placing up " + std::to_string( offset ) + " yalms" );
|
||||
player.sendNotice( "nudge: Placing up " + std::to_string( offset ) + " yalms" );
|
||||
}
|
||||
else if( direction[0] == 'd' || direction[0] == '-' )
|
||||
{
|
||||
pos.y -= offset;
|
||||
pPlayer->sendNotice( "nudge: Placing down " + std::to_string( offset ) + " yalms" );
|
||||
player.sendNotice( "nudge: Placing down " + std::to_string( offset ) + " yalms" );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
float angle = pPlayer->getRotation() + ( PI / 2 );
|
||||
float angle = player.getRotation() + ( PI / 2 );
|
||||
pos.x -= offset * cos( angle );
|
||||
pos.z += offset * sin( angle );
|
||||
pPlayer->sendNotice( "nudge: Placing forward " + std::to_string( offset ) + " yalms" );
|
||||
player.sendNotice( "nudge: Placing forward " + std::to_string( offset ) + " yalms" );
|
||||
}
|
||||
if( offset != 0 )
|
||||
{
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
|
||||
setActorPosPacket( pPlayer->getId() );
|
||||
setActorPosPacket.data().x = pPlayer->getPos().x;
|
||||
setActorPosPacket.data().y = pPlayer->getPos().y;
|
||||
setActorPosPacket.data().z = pPlayer->getPos().z;
|
||||
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
|
||||
pPlayer->queuePacket( setActorPosPacket );
|
||||
setActorPosPacket( player.getId() );
|
||||
setActorPosPacket.data().x = player.getPos().x;
|
||||
setActorPosPacket.data().y = player.getPos().y;
|
||||
setActorPosPacket.data().z = player.getPos().z;
|
||||
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( player.getRotation() );
|
||||
player.queuePacket( setActorPosPacket );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::serverInfo( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::serverInfo( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
pPlayer->sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
||||
pPlayer->sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||
pPlayer->sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) );
|
||||
player.sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
||||
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||
player.sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
pPlayer->unlock( );
|
||||
player.unlock( );
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include <map>
|
||||
|
||||
#include "DebugCommand.h"
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Common.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -15,7 +15,7 @@ class DebugCommandHandler
|
|||
{
|
||||
private:
|
||||
// container mapping command string to command object
|
||||
std::map<std::string, boost::shared_ptr<DebugCommand> > m_commandMap;
|
||||
std::map< std::string, boost::shared_ptr< DebugCommand > > m_commandMap;
|
||||
|
||||
public:
|
||||
DebugCommandHandler();
|
||||
|
@ -25,25 +25,25 @@ public:
|
|||
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
||||
|
||||
// execute command if registered
|
||||
void execCommand( char * data, Entity::PlayerPtr pPlayer );
|
||||
void execCommand( char * data, Entity::Player& player );
|
||||
|
||||
// help command
|
||||
void help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
// command handler callbacks
|
||||
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 set( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void get( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void add( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
//void debug( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void scriptReload( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
void injectPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void injectChatPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void serverInfo( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void injectPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void injectChatPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void nudge( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void serverInfo( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
void unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void targetInfo( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void targetInfo( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ Core::Scripting::EventReturnCallback Core::Event::Event::getEventReturnCallback(
|
|||
return m_callback;
|
||||
}
|
||||
|
||||
void Core::Event::Event::setEventReturnCallback( Core::Scripting::EventReturnCallback callback )
|
||||
void Core::Event::Event::setEventReturnCallback( Scripting::EventReturnCallback callback )
|
||||
{
|
||||
m_callback = callback;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include "EventHelper.h"
|
||||
#include "Event.h"
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
|
||||
#include "Inventory.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "ItemContainer.h"
|
||||
#include "Item.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/clamp.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "../Forwards.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef INVENTORY_H_
|
||||
#define INVENTORY_H_
|
||||
#include <map>
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Common.h>
|
||||
#include "../Forwards.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include "Item.h"
|
||||
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _ITEM_H_
|
||||
#define _ITEM_H_
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -81,4 +81,4 @@ protected:
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "../Forwards.h"
|
||||
#include "ItemContainer.h"
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Item.h"
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
||||
|
@ -86,7 +86,7 @@ Core::ItemPtr Core::ItemContainer::getItem( uint8_t slotId )
|
|||
return m_itemMap[slotId];
|
||||
}
|
||||
|
||||
void Core::ItemContainer::setItem( uint8_t slotId, Core::ItemPtr pItem )
|
||||
void Core::ItemContainer::setItem( uint8_t slotId, ItemPtr pItem )
|
||||
{
|
||||
if( ( slotId > m_size ) )
|
||||
return;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#pragma once
|
||||
#ifndef _ITEMCONTAINER_H_
|
||||
#define _ITEMCONTAINER_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
#include "../Forwards.h"
|
||||
|
||||
|
@ -17,7 +16,7 @@ namespace Core
|
|||
{
|
||||
|
||||
public:
|
||||
ItemContainer(uint16_t locationId);
|
||||
ItemContainer( uint16_t locationId );
|
||||
~ItemContainer();
|
||||
|
||||
uint16_t getId() const;
|
||||
|
@ -30,9 +29,9 @@ namespace Core
|
|||
|
||||
const ItemMap& getItemMap() const;
|
||||
|
||||
ItemPtr getItem(uint8_t slotId);
|
||||
ItemPtr getItem( uint8_t slotId );
|
||||
|
||||
void setItem(uint8_t slotId, ItemPtr item);
|
||||
void setItem( uint8_t slotId, ItemPtr item );
|
||||
|
||||
int16_t getFreeSlot();
|
||||
|
||||
|
@ -45,4 +44,4 @@ namespace Core
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Zone/Actor/Actor.h>
|
||||
#include <Server_Zone/Actor/Player.h>
|
||||
|
||||
#include "Actor/Actor.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "CalcBattle.h"
|
||||
|
||||
|
||||
|
@ -42,4 +41,4 @@ uint32_t CalcBattle::calculateHealValue( PlayerPtr pPlayer, uint32_t potency )
|
|||
|
||||
// consider 3% variation
|
||||
return potency / 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _CALCBATTLE_H
|
||||
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Zone/Actor/Actor.h>
|
||||
#include "Actor/Actor.h"
|
||||
|
||||
using namespace Core::Entity;
|
||||
|
||||
|
@ -21,4 +21,4 @@ namespace Math {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Zone/Actor/Actor.h>
|
||||
#include <Server_Zone/Actor/Player.h>
|
||||
#include "Actor/Actor.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "CalcStats.h"
|
||||
|
||||
|
@ -111,4 +111,4 @@ uint32_t CalcStats::calculateMaxMp( PlayerPtr pPlayer )
|
|||
uint16_t result = static_cast< uint16_t >( floor( floor( piety - baseStat ) * ( pietyScalar / 100 ) + baseMp ) * jobModMp / 100 );
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _CALCSTATS_H
|
||||
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Zone/Actor/Actor.h>
|
||||
#include "Actor/Actor.h"
|
||||
|
||||
using namespace Core::Entity;
|
||||
|
||||
|
@ -23,4 +23,4 @@ namespace Math {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketParser.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Network/GamePacketParser.h>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "GameConnection.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 "ServerZone.h"
|
||||
#include "Session.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
extern Core::DebugCommandHandler g_gameCommandMgr;
|
||||
extern Core::Logger g_log;
|
||||
|
@ -134,8 +134,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
|
|||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if( headerResult == Malformed )
|
||||
else if( headerResult == Malformed )
|
||||
{
|
||||
g_log.info( "Dropping connection due to malformed packet header." );
|
||||
Disconnect();
|
||||
|
@ -154,8 +153,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
|
|||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (packetResult == Malformed)
|
||||
else if( packetResult == Malformed )
|
||||
{
|
||||
g_log.info( "Dropping connection due to malformed packets." );
|
||||
Disconnect();
|
||||
|
@ -199,7 +197,7 @@ void Core::Network::GameConnection::handleZonePacket( const Packets::GamePacket&
|
|||
boost::str( boost::format( "%|04X|" ) %
|
||||
static_cast< uint32_t >( pPacket.getSubType() & 0xFFFF ) ) + " )" );
|
||||
|
||||
( this->*( it->second ) )( pPacket, m_pSession->getPlayer() );
|
||||
( this->*( it->second ) )( pPacket, *m_pSession->getPlayer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -227,7 +225,7 @@ void Core::Network::GameConnection::handleChatPacket( const Packets::GamePacket&
|
|||
boost::str( boost::format( "%|04X|" ) %
|
||||
static_cast< uint32_t >( pPacket.getSubType() & 0xFFFF ) ) + " )" );
|
||||
|
||||
( this->*( it->second ) )( pPacket, m_pSession->getPlayer() );
|
||||
( this->*( it->second ) )( pPacket, *m_pSession->getPlayer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -310,7 +308,7 @@ void Core::Network::GameConnection::sendSinglePacket( Packets::GamePacket* pPack
|
|||
sendPackets( &pRP );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::injectPacket( const std::string& packetpath, Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::injectPacket( const std::string& packetpath, Core::Entity::Player& pPlayer )
|
||||
{
|
||||
|
||||
char packet[0x11570];
|
||||
|
@ -339,7 +337,7 @@ void Core::Network::GameConnection::injectPacket( const std::string& packetpath,
|
|||
// cycle through the packet entries and queue each one
|
||||
for( int32_t k = 0x18; k < size; )
|
||||
{
|
||||
uint32_t tmpId = pPlayer->getId();
|
||||
uint32_t tmpId = pPlayer.getId();
|
||||
// replace ids in the entryheader if needed
|
||||
if( !memcmp( packet + k + 0x04, packet + k + 0x08, 4 ) )
|
||||
{
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
|
||||
#ifndef GAMECONNECTION_H
|
||||
#define GAMECONNECTION_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/Connection.h>
|
||||
#include <src/servers/Server_Common/Network/Acceptor.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/Connection.h>
|
||||
#include <Server_Common/Network/Acceptor.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Util/LockedQueue.h>
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
#include <src/servers/Server_Common/Util/LockedQueue.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
|
||||
#define DECLARE_HANDLER( x ) void x( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
#define DECLARE_HANDLER( x ) void x( const Packets::GamePacket& inPacket, Entity::Player& player )
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -29,18 +26,18 @@ class GameConnection : public Connection
|
|||
{
|
||||
|
||||
private:
|
||||
typedef void ( GameConnection::* Handler )( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer );
|
||||
typedef void ( GameConnection::* Handler )( const Packets::GamePacket& inPacket, Entity::Player& player );
|
||||
|
||||
using HandlerMap = std::map< uint16_t, Handler >;
|
||||
using HandlerStrMap = std::map< uint16_t, std::string >;
|
||||
|
||||
AcceptorPtr m_pAcceptor;
|
||||
|
||||
// handler for game packets (main type 0x03, connection type 1)
|
||||
// handler for game packets ( main type 0x03, connection type 1 )
|
||||
HandlerMap m_zoneHandlerMap;
|
||||
HandlerStrMap m_zoneHandlerStrMap;
|
||||
|
||||
// handler for game packets (main type 0x03, connection type 2)
|
||||
// handler for game packets ( main type 0x03, connection type 2 )
|
||||
HandlerMap m_chatHandlerMap;
|
||||
HandlerStrMap m_chatHandlerStrMap;
|
||||
|
||||
|
@ -80,11 +77,11 @@ public:
|
|||
|
||||
void handleChatPacket( const Packets::GamePacket& pPacket );
|
||||
|
||||
void sendPackets( Packets::PacketContainer * pPacket );
|
||||
void sendPackets( Packets::PacketContainer* pPacket );
|
||||
|
||||
void sendSinglePacket( Packets::GamePacket * pPacket );
|
||||
void sendSinglePacket( Packets::GamePacket* pPacket );
|
||||
|
||||
void injectPacket( const std::string& packetpath, Entity::PlayerPtr pPlayer );
|
||||
void injectPacket( const std::string& packetpath, Entity::Player& player );
|
||||
|
||||
DECLARE_HANDLER( initHandler );
|
||||
DECLARE_HANDLER( finishLoadingHandler );
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Network/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/Zone.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Zone/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 "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/PacketWrappers/PingPacket.h"
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
#include "Network/PacketWrappers/ChatPacket.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/EventStartPacket.h"
|
||||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.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"
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Forwards.h"
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionTeleport.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
|
@ -46,7 +46,7 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint16_t commandId = inPacket.getValAt< uint16_t >( 0x20 );
|
||||
uint64_t param1 = inPacket.getValAt< uint64_t >( 0x24 );
|
||||
|
@ -70,14 +70,14 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
case 0x01: // Toggle sheathe
|
||||
{
|
||||
if ( param11 == 1 )
|
||||
pPlayer->setStance( Entity::Actor::Stance::Active );
|
||||
player.setStance( Entity::Actor::Stance::Active );
|
||||
else
|
||||
{
|
||||
pPlayer->setStance( Entity::Actor::Stance::Passive );
|
||||
pPlayer->setAutoattack( false );
|
||||
player.setStance( Entity::Actor::Stance::Passive );
|
||||
player.setAutoattack( false );
|
||||
}
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 0, param11, 1 ) );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), 0, param11, 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
{
|
||||
if ( param11 == 1 )
|
||||
{
|
||||
pPlayer->setAutoattack( true );
|
||||
pPlayer->setStance( Entity::Actor::Stance::Active );
|
||||
player.setAutoattack( true );
|
||||
player.setStance( Entity::Actor::Stance::Active );
|
||||
}
|
||||
else
|
||||
pPlayer->setAutoattack( false );
|
||||
player.setAutoattack( false );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 1, param11, 1 ) );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), 1, param11, 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -99,51 +99,51 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
{
|
||||
|
||||
uint64_t targetId = inPacket.getValAt< uint64_t >( 0x24 );
|
||||
pPlayer->changeTarget( targetId );
|
||||
player.changeTarget( targetId );
|
||||
break;
|
||||
}
|
||||
case 0x65:
|
||||
{
|
||||
pPlayer->dismount();
|
||||
player.dismount();
|
||||
break;
|
||||
}
|
||||
case 0x68: // Remove status (clicking it off)
|
||||
{
|
||||
// todo: check if status can be removed by client from exd
|
||||
pPlayer->removeSingleStatusEffectById( static_cast< uint32_t >( param1 ) );
|
||||
player.removeSingleStatusEffectById( static_cast< uint32_t >( param1 ) );
|
||||
break;
|
||||
}
|
||||
case 0x69: // Cancel cast
|
||||
{
|
||||
if( pPlayer->getCurrentAction() )
|
||||
pPlayer->getCurrentAction()->setInterrupted();
|
||||
if( player.getCurrentAction() )
|
||||
player.getCurrentAction()->setInterrupted();
|
||||
break;
|
||||
}
|
||||
case 0x12E: // Set player title
|
||||
{
|
||||
pPlayer->setTitle( static_cast< uint16_t >( param1 ) );
|
||||
player.setTitle( static_cast< uint16_t >( param1 ) );
|
||||
break;
|
||||
}
|
||||
case 0x12F: // Get title list
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcPlayerTitleList > titleListPacket( pPlayer->getId() );
|
||||
memcpy( titleListPacket.data().titleList, pPlayer->getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
||||
ZoneChannelPacket< FFXIVIpcPlayerTitleList > titleListPacket( player.getId() );
|
||||
memcpy( titleListPacket.data().titleList, player.getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
||||
|
||||
pPlayer->queuePacket( titleListPacket );
|
||||
player.queuePacket( titleListPacket );
|
||||
break;
|
||||
}
|
||||
case 0x133: // Update howtos seen
|
||||
{
|
||||
uint32_t howToId = static_cast< uint32_t >( param1 );
|
||||
pPlayer->updateHowtosSeen( howToId );
|
||||
player.updateHowtosSeen( howToId );
|
||||
break;
|
||||
}
|
||||
case 0x1F4: // emote
|
||||
{
|
||||
uint64_t targetId = pPlayer->getTargetId();
|
||||
uint64_t targetId = player.getTargetId();
|
||||
uint32_t emoteId = inPacket.getValAt< uint32_t >( 0x24 );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket144( pPlayer->getId(), Emote, emoteId, 0, 0, 0, targetId ) );
|
||||
player.sendToInRangeSet( ActorControlPacket144( player.getId(), Emote, emoteId, 0, 0, 0, targetId ) );
|
||||
break;
|
||||
}
|
||||
case 0xC8: // return dead
|
||||
|
@ -152,10 +152,10 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
{
|
||||
case ResurrectType::RaiseSpell:
|
||||
// todo: handle raise case (set position to raiser, apply weakness status, set hp/mp/tp as well as packet)
|
||||
pPlayer->returnToHomepoint();
|
||||
player.returnToHomepoint();
|
||||
break;
|
||||
case ResurrectType::Return:
|
||||
pPlayer->returnToHomepoint();
|
||||
player.returnToHomepoint();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -164,39 +164,39 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
}
|
||||
case 0xC9: // Finish zoning
|
||||
{
|
||||
switch( pPlayer->getZoningType() )
|
||||
switch( player.getZoningType() )
|
||||
{
|
||||
case ZoneingType::None:
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01 ), true );
|
||||
break;
|
||||
case ZoneingType::Teleport:
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||
break;
|
||||
case ZoneingType::Return:
|
||||
case ZoneingType::ReturnDead:
|
||||
{
|
||||
if( pPlayer->getStatus() == Entity::Actor::ActorStatus::Dead )
|
||||
if( player.getStatus() == Entity::Actor::ActorStatus::Dead )
|
||||
{
|
||||
pPlayer->resetHp();
|
||||
pPlayer->resetMp();
|
||||
pPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||
player.resetHp();
|
||||
player.resetMp();
|
||||
player.setStatus( Entity::Actor::ActorStatus::Idle );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||
}
|
||||
else
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
||||
}
|
||||
break;
|
||||
case ZoneingType::FadeIn:
|
||||
break;
|
||||
}
|
||||
|
||||
pPlayer->setZoningType( Common::ZoneingType::None );
|
||||
player.setZoningType( Common::ZoneingType::None );
|
||||
|
||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
|
||||
pPlayer->sendStateFlags();
|
||||
player.unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
player.unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
|
||||
player.sendStateFlags();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
|
||||
if( targetAetheryte )
|
||||
{
|
||||
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index );
|
||||
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[player.getZoneId()].aetheryte_index );
|
||||
|
||||
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
||||
auto cost = static_cast< uint16_t > ( ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) +
|
||||
|
@ -216,14 +216,14 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
// cap at 999 gil
|
||||
cost = cost > uint16_t{999} ? uint16_t{999} : cost;
|
||||
|
||||
bool insufficientGil = pPlayer->getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
||||
bool insufficientGil = player.getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
||||
// todo: figure out what param1 really does
|
||||
pPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), TeleportStart, insufficientGil ? 2 : 0, param11 ) );
|
||||
player.queuePacket( ActorControlPacket143( player.getId(), TeleportStart, insufficientGil ? 2 : 0, param11 ) );
|
||||
|
||||
if( !insufficientGil )
|
||||
{
|
||||
Action::ActionTeleportPtr pActionTeleport( new Action::ActionTeleport( pPlayer, param11, cost ) );
|
||||
pPlayer->setCurrentAction( pActionTeleport );
|
||||
Action::ActionTeleportPtr pActionTeleport( new Action::ActionTeleport( player.getAsPlayer(), param11, cost ) );
|
||||
player.setCurrentAction( pActionTeleport );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.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 "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Session.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
||||
|
@ -25,11 +23,11 @@ using namespace Core::Network::Packets::Server;
|
|||
|
||||
|
||||
void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( player.getId() );
|
||||
|
||||
auto penaltyMinutes = pPlayer->getCFPenaltyMinutes();
|
||||
auto penaltyMinutes = player.getCFPenaltyMinutes();
|
||||
if (penaltyMinutes > 255)
|
||||
{
|
||||
// cap it since it's uint8_t in packets
|
||||
|
@ -39,13 +37,13 @@ void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket
|
|||
|
||||
queueOutPacket( dutyInfoPacket );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( player.getId() );
|
||||
queueOutPacket( inNeedsPacket );
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer)
|
||||
Entity::Player& player)
|
||||
{
|
||||
// TODO use for loop for this
|
||||
auto contentId1 = inPacket.getValAt< uint16_t >( 46 );
|
||||
|
@ -54,28 +52,28 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
|
|||
auto contentId4 = inPacket.getValAt< uint16_t >( 52 );
|
||||
auto contentId5 = inPacket.getValAt< uint16_t >( 54 );
|
||||
|
||||
pPlayer->sendDebug("Duty register request");
|
||||
pPlayer->sendDebug("ContentId1" + std::to_string(contentId1));
|
||||
pPlayer->sendDebug("ContentId2" + std::to_string(contentId2));
|
||||
pPlayer->sendDebug("ContentId3" + std::to_string(contentId3));
|
||||
pPlayer->sendDebug("ContentId4" + std::to_string(contentId4));
|
||||
pPlayer->sendDebug("ContentId5" + std::to_string(contentId5));
|
||||
player.sendDebug("Duty register request");
|
||||
player.sendDebug("ContentId1" + std::to_string(contentId1));
|
||||
player.sendDebug("ContentId2" + std::to_string(contentId2));
|
||||
player.sendDebug("ContentId3" + std::to_string(contentId3));
|
||||
player.sendDebug("ContentId4" + std::to_string(contentId4));
|
||||
player.sendDebug("ContentId5" + std::to_string(contentId5));
|
||||
|
||||
// let's cancel it because otherwise you can't register it again
|
||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
|
||||
cfCancelPacket.data().state1 = 3;
|
||||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
||||
queueOutPacket( cfCancelPacket );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::cfRegisterRoulette( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer)
|
||||
Entity::Player& player)
|
||||
{
|
||||
pPlayer->sendDebug("Roulette register");
|
||||
player.sendDebug("Roulette register");
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::cfDutyAccepted( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer)
|
||||
Entity::Player& player)
|
||||
{
|
||||
pPlayer->sendDebug("TODO: Duty accept");
|
||||
player.sendDebug("TODO: Duty accept");
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#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"
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Session.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/EventStartPacket.h"
|
||||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
#include "Event/EventHelper.h"
|
||||
|
||||
extern Core::Scripting::ScriptManager g_scriptMgr;
|
||||
|
||||
|
@ -27,22 +27,22 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint16_t eventHandlerId = inPacket.getValAt< uint16_t >( 0x12 );
|
||||
|
||||
// we need to abort the event in case it has not been scripted so the player wont be locked up
|
||||
auto abortEventFunc = []( Core::Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId )
|
||||
auto abortEventFunc = []( Core::Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
pPlayer->queuePacket( EventStartPacket( pPlayer->getId(), actorId, eventId, 1, 0, 0 ) );
|
||||
pPlayer->queuePacket( EventFinishPacket( pPlayer->getId(), eventId, 1, 0 ) );
|
||||
player.queuePacket( EventStartPacket( player.getId(), actorId, eventId, 1, 0, 0 ) );
|
||||
player.queuePacket( EventFinishPacket( player.getId(), eventId, 1, 0 ) );
|
||||
// this isn't ideal as it will also reset any other status that might be active
|
||||
pPlayer->queuePacket( PlayerStateFlagsPacket( pPlayer, PlayerStateFlagList{} ) );
|
||||
player.queuePacket( PlayerStateFlagsPacket( player, PlayerStateFlagList{} ) );
|
||||
};
|
||||
|
||||
std::string eventIdStr = boost::str( boost::format( "%|04X|" ) % static_cast< uint32_t >( eventHandlerId & 0xFFFF ) );
|
||||
pPlayer->sendDebug( "---------------------------------------" );
|
||||
pPlayer->sendDebug( "EventHandler ( " + eventIdStr + " )" );
|
||||
player.sendDebug( "---------------------------------------" );
|
||||
player.sendDebug( "EventHandler ( " + eventIdStr + " )" );
|
||||
|
||||
switch( eventHandlerId )
|
||||
{
|
||||
|
@ -52,8 +52,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
uint64_t actorId = inPacket.getValAt< uint64_t >( 0x20 );
|
||||
uint32_t eventId = inPacket.getValAt< uint32_t >( 0x28 );
|
||||
|
||||
if( !g_scriptMgr.onTalk( pPlayer, actorId, eventId ) )
|
||||
abortEventFunc( pPlayer, actorId, eventId );
|
||||
if( !g_scriptMgr.onTalk( player, actorId, eventId ) )
|
||||
abortEventFunc( player, actorId, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onEmote( pPlayer, actorId, eventId, static_cast< uint8_t >( emoteId ) ) )
|
||||
abortEventFunc( pPlayer, actorId, eventId );
|
||||
if( !g_scriptMgr.onEmote( player, actorId, eventId, static_cast< uint8_t >( emoteId ) ) )
|
||||
abortEventFunc( player, actorId, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onWithinRange( pPlayer, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onWithinRange( player, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onOutsideRange( pPlayer, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onOutsideRange( player, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onEnterTerritory( pPlayer, eventId, eventParam1, eventParam2 ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onEnterTerritory( player, eventId, eventParam1, eventParam2 ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -125,8 +125,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onEventHandlerReturn( pPlayer, eventId, subEvent, param1, param2, param3 ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onEventHandlerReturn( player, eventId, subEvent, param1, param2, param3 ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,12 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
uint16_t subEvent = inPacket.getValAt< uint16_t >( 0x24 );
|
||||
std::string lsName = inPacket.getStringAt( 0x27 );
|
||||
|
||||
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcEventLinkshell > linkshellEvent( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcEventLinkshell > linkshellEvent( player.getId() );
|
||||
linkshellEvent.data().eventId = eventId;
|
||||
linkshellEvent.data().scene = static_cast< uint8_t >(subEvent);
|
||||
linkshellEvent.data().scene = static_cast< uint8_t >( subEvent );
|
||||
linkshellEvent.data().param3 = 1;
|
||||
linkshellEvent.data().unknown1 = 0x15a;
|
||||
pPlayer->queuePacket( linkshellEvent );
|
||||
player.queuePacket( linkshellEvent );
|
||||
|
||||
// abortEventFunc( pPlayer, 0, eventId );
|
||||
break;
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Network/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/Zone.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Zone/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 "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/PacketWrappers/PingPacket.h"
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
#include "Network/PacketWrappers/ChatPacket.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/EventStartPacket.h"
|
||||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.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"
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Forwards.h"
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionTeleport.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
|
@ -92,9 +92,9 @@ enum GmCommand
|
|||
JumpNpc = 0x025F,
|
||||
};
|
||||
|
||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::Player& player )
|
||||
{
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
if( player.getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
|
@ -102,19 +102,20 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x28 );
|
||||
uint32_t param3 = inPacket.getValAt< uint32_t >( 0x38 );
|
||||
|
||||
g_log.debug( pPlayer->getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
||||
g_log.debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
||||
", params: " + std::to_string( param1 ) + ", " +
|
||||
std::to_string( param2 ) + ", " + std::to_string( param3 ) );
|
||||
|
||||
Core::Entity::ActorPtr targetActor;
|
||||
|
||||
|
||||
if( pPlayer->getId() == param3 )
|
||||
if( player.getId() == param3 )
|
||||
{
|
||||
targetActor = pPlayer;
|
||||
targetActor = player.getAsPlayer();
|
||||
}
|
||||
else {
|
||||
auto inRange = pPlayer->getInRangeActors();
|
||||
else
|
||||
{
|
||||
auto inRange = player.getInRangeActors();
|
||||
for( auto actor : inRange )
|
||||
{
|
||||
if( actor->getId() == param3 )
|
||||
|
@ -131,13 +132,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::Lv:
|
||||
{
|
||||
targetPlayer->setLevel( param1 );
|
||||
pPlayer->sendNotice( "Level for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Level for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Race:
|
||||
{
|
||||
targetPlayer->setLookAt( CharaLook::Race, param1 );
|
||||
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->spawn( targetPlayer );
|
||||
auto inRange = targetPlayer->getInRangeActors();
|
||||
for ( auto actor : inRange )
|
||||
|
@ -150,7 +151,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::Tribe:
|
||||
{
|
||||
targetPlayer->setLookAt( CharaLook::Tribe, param1 );
|
||||
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->spawn( targetPlayer );
|
||||
auto inRange = targetPlayer->getInRangeActors();
|
||||
for ( auto actor : inRange )
|
||||
|
@ -163,7 +164,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::Sex:
|
||||
{
|
||||
targetPlayer->setLookAt( CharaLook::Gender, param1 );
|
||||
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->spawn( targetPlayer );
|
||||
auto inRange = targetActor->getInRangeActors();
|
||||
for ( auto actor : inRange )
|
||||
|
@ -175,30 +176,30 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
}
|
||||
case GmCommand::Time:
|
||||
{
|
||||
pPlayer->setEorzeaTimeOffset( param2 );
|
||||
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( param2 ) );
|
||||
player.setEorzeaTimeOffset( param2 );
|
||||
player.sendNotice( "Eorzea time offset: " + std::to_string( param2 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Weather:
|
||||
{
|
||||
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
|
||||
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
||||
player.sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
||||
targetPlayer->getName() + " set in range." );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Call:
|
||||
{
|
||||
if ( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
||||
targetPlayer->setZone( pPlayer->getZoneId() );
|
||||
if ( targetPlayer->getZoneId() != player.getZoneId() )
|
||||
targetPlayer->setZone( player.getZoneId() );
|
||||
|
||||
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
|
||||
pPlayer->getRotation() );
|
||||
pPlayer->sendNotice( "Calling " + targetPlayer->getName() );
|
||||
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z,
|
||||
player.getRotation() );
|
||||
player.sendNotice( "Calling " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Inspect:
|
||||
{
|
||||
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
|
||||
player.sendNotice( "Name: " + targetPlayer->getName() +
|
||||
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
|
||||
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
|
||||
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
|
||||
|
@ -211,14 +212,14 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
}
|
||||
case GmCommand::Speed:
|
||||
{
|
||||
targetPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), Flee, param1 ) );
|
||||
pPlayer->sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->queuePacket( ActorControlPacket143( player.getId(), Flee, param1 ) );
|
||||
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Kill:
|
||||
{
|
||||
targetActor->takeDamage( 9999999 );
|
||||
pPlayer->sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
|
||||
player.sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Icon:
|
||||
|
@ -235,34 +236,34 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
strcpy( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
|
||||
targetPlayer->queuePacket( searchInfoPacket );
|
||||
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( player.getOnlineStatus() ) ),
|
||||
true );
|
||||
pPlayer->sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Hp:
|
||||
{
|
||||
targetPlayer->setHp( param1 );
|
||||
pPlayer->sendNotice( "Hp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Hp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Mp:
|
||||
{
|
||||
targetPlayer->setMp( param1 );
|
||||
pPlayer->sendNotice( "Mp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Mp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Gp:
|
||||
{
|
||||
targetPlayer->setHp( param1 );
|
||||
pPlayer->sendNotice( "Gp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Gp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Exp:
|
||||
{
|
||||
targetPlayer->gainExp( param1 );
|
||||
pPlayer->sendNotice( std::to_string( param1 ) + " Exp was added to " + targetPlayer->getName() );
|
||||
player.sendNotice( std::to_string( param1 ) + " Exp was added to " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Inv:
|
||||
|
@ -272,7 +273,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
else
|
||||
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill );
|
||||
|
||||
pPlayer->sendNotice( "Invincibility for " + targetPlayer->getName() +
|
||||
player.sendNotice( "Invincibility for " + targetPlayer->getName() +
|
||||
" was switched." );
|
||||
break;
|
||||
}
|
||||
|
@ -285,13 +286,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
for ( uint8_t i = 0; i < 255; i++ )
|
||||
targetActor->getAsPlayer()->learnSong( i, 0 );
|
||||
|
||||
pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() +
|
||||
player.sendNotice( "All Songs for " + targetPlayer->getName() +
|
||||
" were turned on." );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetActor->getAsPlayer()->learnSong( param2, 0 );
|
||||
pPlayer->sendNotice( "Song " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
player.sendNotice( "Song " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
" was turned on." );
|
||||
}
|
||||
}
|
||||
|
@ -307,18 +308,18 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
|
||||
if( ( param1 == 0xcccccccc ) )
|
||||
{
|
||||
pPlayer->sendUrgent( "Syntaxerror." );
|
||||
player.sendUrgent( "Syntaxerror." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !targetPlayer->addItem( -1, param1, param2 ) )
|
||||
pPlayer->sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
||||
player.sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Gil:
|
||||
{
|
||||
targetPlayer->addCurrency( 1, param1 );
|
||||
pPlayer->sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
|
||||
player.sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Collect:
|
||||
|
@ -327,12 +328,12 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
|
||||
if ( gil < param1 )
|
||||
{
|
||||
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
||||
player.sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPlayer->removeCurrency( 1, param1 );
|
||||
pPlayer->sendNotice( "Removed " + std::to_string( param1 ) +
|
||||
player.sendNotice( "Removed " + std::to_string( param1 ) +
|
||||
" Gil from " + targetPlayer->getName() +
|
||||
"(" + std::to_string( gil ) + " before)" );
|
||||
}
|
||||
|
@ -366,14 +367,14 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::GC:
|
||||
{
|
||||
targetPlayer->setGc( param1 );
|
||||
pPlayer->sendNotice( "GC for " + targetPlayer->getName() +
|
||||
player.sendNotice( "GC for " + targetPlayer->getName() +
|
||||
" was set to " + std::to_string( targetPlayer->getGc() ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::GCRank:
|
||||
{
|
||||
targetPlayer->setGcRankAt( targetPlayer->getGc() - 1, param1 );
|
||||
pPlayer->sendNotice( "GC Rank for " + targetPlayer->getName() +
|
||||
player.sendNotice( "GC Rank for " + targetPlayer->getName() +
|
||||
" for GC " + std::to_string( targetPlayer->getGc() ) +
|
||||
" was set to " + std::to_string( targetPlayer->getGcRankArray()[targetPlayer->getGc() - 1] ) );
|
||||
break;
|
||||
|
@ -387,13 +388,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
for ( uint8_t i = 0; i < 255; i++ )
|
||||
targetActor->getAsPlayer()->registerAetheryte( i );
|
||||
|
||||
pPlayer->sendNotice( "All Aetherytes for " + targetPlayer->getName() +
|
||||
player.sendNotice( "All Aetherytes for " + targetPlayer->getName() +
|
||||
" were turned on." );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetActor->getAsPlayer()->registerAetheryte( param2 );
|
||||
pPlayer->sendNotice( "Aetheryte " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
player.sendNotice( "Aetheryte " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
" was turned on." );
|
||||
}
|
||||
}
|
||||
|
@ -405,55 +406,55 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
auto zoneInfo = g_zoneMgr.getZone( param1 );
|
||||
if ( !zoneInfo )
|
||||
{
|
||||
pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) );
|
||||
player.sendUrgent( "Invalid zone " + std::to_string( param1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPlayer->setPosition( targetPlayer->getPos() );
|
||||
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 );
|
||||
pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
|
||||
player.sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GmCommand::TeriInfo:
|
||||
{
|
||||
pPlayer->sendNotice( "ZoneId: " + std::to_string( pPlayer->getZoneId() ) + "\nName: " +
|
||||
pPlayer->getCurrentZone()->getName() + "\nInternalName: " +
|
||||
pPlayer->getCurrentZone()->getInternalName() + "\nPopCount: " +
|
||||
std::to_string( pPlayer->getCurrentZone()->getPopCount() ) +
|
||||
"\nCurrentWeather:" + std::to_string( pPlayer->getCurrentZone()->getCurrentWeather() ) +
|
||||
"\nNextWeather:" + std::to_string( pPlayer->getCurrentZone()->getNextWeather() ) );
|
||||
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) + "\nName: " +
|
||||
player.getCurrentZone()->getName() + "\nInternalName: " +
|
||||
player.getCurrentZone()->getInternalName() + "\nPopCount: " +
|
||||
std::to_string( player.getCurrentZone()->getPopCount() ) +
|
||||
"\nCurrentWeather:" + std::to_string( player.getCurrentZone()->getCurrentWeather() ) +
|
||||
"\nNextWeather:" + std::to_string( player.getCurrentZone()->getNextWeather() ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Jump:
|
||||
{
|
||||
|
||||
auto inRange = pPlayer->getInRangeActors();
|
||||
auto inRange = player.getInRangeActors();
|
||||
for( auto actor : inRange )
|
||||
{
|
||||
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
targetActor->getRotation() );
|
||||
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
targetActor->getRotation() );
|
||||
}
|
||||
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
|
||||
player.sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
pPlayer->sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
|
||||
player.sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::Player& player )
|
||||
{
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
if( player.getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
std::string param1 = inPacket.getStringAt( 0x34 );
|
||||
|
||||
g_log.debug( pPlayer->getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
||||
g_log.debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
||||
|
||||
auto targetSession = g_serverZone.getSession( param1 );
|
||||
Core::Entity::ActorPtr targetActor;
|
||||
|
@ -466,11 +467,11 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
|||
{
|
||||
if( param1 == "self" )
|
||||
{
|
||||
targetActor = pPlayer;
|
||||
targetActor = player.getAsPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( "Player " + param1 + " not found on this server." );
|
||||
player.sendUrgent( "Player " + param1 + " not found on this server." );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -488,25 +489,25 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
|||
targetPlayer->resetMp();
|
||||
targetPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus,
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatus,
|
||||
static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||
pPlayer->sendNotice( "Raised " + targetPlayer->getName() );
|
||||
player.sendNotice( "Raised " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Jump:
|
||||
{
|
||||
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
||||
if( targetPlayer->getZoneId() != player.getZoneId() )
|
||||
{
|
||||
pPlayer->setZone( targetPlayer->getZoneId() );
|
||||
player.setZone( targetPlayer->getZoneId() );
|
||||
}
|
||||
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
targetActor->getRotation() );
|
||||
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() );
|
||||
player.sendNotice( "Jumping to " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
||||
player.sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Network/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/Zone.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Zone/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 "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.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 "DebugCommand/DebugCommandHandler.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
|
@ -37,7 +37,7 @@ using namespace Core::Network::Packets::Server;
|
|||
|
||||
|
||||
void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t seq = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
uint8_t action = inPacket.getValAt< uint8_t >( 0x24 );
|
||||
|
@ -46,10 +46,10 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
|
|||
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
|
||||
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( player.getId() );
|
||||
ackPacket.data().sequence = seq;
|
||||
ackPacket.data().type = 7;
|
||||
pPlayer->queuePacket( ackPacket );
|
||||
player.queuePacket( ackPacket );
|
||||
|
||||
|
||||
g_log.debug( inPacket.toString() );
|
||||
|
@ -61,19 +61,19 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
|
|||
|
||||
case 0x07: // discard item action
|
||||
{
|
||||
pPlayer->getInventory()->discardItem( fromContainer, fromSlot );
|
||||
player.getInventory()->discardItem( fromContainer, fromSlot );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x08: // move item action
|
||||
{
|
||||
pPlayer->getInventory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
player.getInventory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x09: // swap item action
|
||||
{
|
||||
pPlayer->getInventory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
player.getInventory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,43 +1,42 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Chat/ServerChatDef.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Network/PacketDef/Chat/ServerChatDef.h>
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Session.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Zone/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 "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/PacketWrappers/PingPacket.h"
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
#include "Network/PacketWrappers/ChatPacket.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/EventStartPacket.h"
|
||||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/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 "DebugCommand/DebugCommandHandler.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Forwards.h"
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Action/Action.h"
|
||||
#include "Action/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"
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
|
@ -50,15 +49,15 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::fcInfoReqHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, pPlayer->getId(), pPlayer->getId() ) );
|
||||
GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, player.getId(), player.getId() ) );
|
||||
pPe->setValAt< uint8_t >( 0x48, 0x01 );
|
||||
queueOutPacket( pPe );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t inval = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
uint32_t inval1 = inPacket.getValAt< uint32_t >( 0x24 );
|
||||
|
@ -66,54 +65,53 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePac
|
|||
|
||||
uint8_t selectRegion = inPacket.getValAt< uint8_t >( 0x31 );
|
||||
|
||||
pPlayer->setSearchInfo( selectRegion, 0, inPacket.getStringAt( 0x32 ) );
|
||||
player.setSearchInfo( selectRegion, 0, inPacket.getStringAt( 0x32 ) );
|
||||
|
||||
pPlayer->setOnlineStatusMask( status );
|
||||
player.setOnlineStatusMask( status );
|
||||
|
||||
if( pPlayer->isNewAdventurer() && !( inval & 0x01000000 ) )
|
||||
if( player.isNewAdventurer() && !( inval & 0x01000000 ) )
|
||||
// mark player as not new adventurer anymore
|
||||
pPlayer->setNewAdventurer( false );
|
||||
player.setNewAdventurer( false );
|
||||
else if( inval & 0x01000000 )
|
||||
// mark player as new adventurer
|
||||
pPlayer->setNewAdventurer( true );
|
||||
player.setNewAdventurer( true );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( player.getId() );
|
||||
statusPacket.data().onlineStatusFlags = status;
|
||||
queueOutPacket( statusPacket );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( player.getId() );
|
||||
searchInfoPacket.data().onlineStatusFlags = status;
|
||||
searchInfoPacket.data().selectRegion = pPlayer->getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, pPlayer->getSearchMessage() );
|
||||
searchInfoPacket.data().selectRegion = player.getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, player.getSearchMessage() );
|
||||
queueOutPacket( searchInfoPacket );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
|
||||
true );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( player.getOnlineStatus() ) ), true );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::reqSearchInfoHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcInitSearchInfo > searchInfoPacket( pPlayer->getId() );
|
||||
searchInfoPacket.data().onlineStatusFlags = pPlayer->getOnlineStatusMask();
|
||||
searchInfoPacket.data().selectRegion = pPlayer->getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, pPlayer->getSearchMessage() );
|
||||
ZoneChannelPacket< FFXIVIpcInitSearchInfo > searchInfoPacket( player.getId() );
|
||||
searchInfoPacket.data().onlineStatusFlags = player.getOnlineStatusMask();
|
||||
searchInfoPacket.data().selectRegion = player.getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, player.getSearchMessage() );
|
||||
queueOutPacket( searchInfoPacket );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::linkshellListHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcLinkshellList > linkshellListPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcLinkshellList > linkshellListPacket( player.getId() );
|
||||
queueOutPacket( linkshellListPacket );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
// if the player is marked for zoning we no longer want to update his pos
|
||||
if( pPlayer->isMarkedForZoning() )
|
||||
if( player.isMarkedForZoning() )
|
||||
return;
|
||||
|
||||
struct testMov
|
||||
|
@ -178,23 +176,23 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
|
|||
//pInPacket->debugPrint();
|
||||
|
||||
bool bPosChanged = false;
|
||||
if( ( pPlayer->getPos().x != inPacket.getValAt< float >( 0x2c ) ) ||
|
||||
( pPlayer->getPos().y != inPacket.getValAt< float >( 0x30 ) ) ||
|
||||
( pPlayer->getPos().z != inPacket.getValAt< float >( 0x34 ) ) )
|
||||
if( ( player.getPos().x != inPacket.getValAt< float >( 0x2c ) ) ||
|
||||
( player.getPos().y != inPacket.getValAt< float >( 0x30 ) ) ||
|
||||
( player.getPos().z != inPacket.getValAt< float >( 0x34 ) ) )
|
||||
bPosChanged = true;
|
||||
if( !bPosChanged && pPlayer->getRotation() == inPacket.getValAt< float >( 0x20 ) )
|
||||
if( !bPosChanged && player.getRotation() == inPacket.getValAt< float >( 0x20 ) )
|
||||
return;
|
||||
|
||||
pPlayer->setRotation( inPacket.getValAt< float >( 0x20 ) );
|
||||
pPlayer->setPosition( inPacket.getValAt< float >( 0x2c ),
|
||||
inPacket.getValAt< float >( 0x30 ),
|
||||
inPacket.getValAt< float >( 0x34 ) );
|
||||
player.setRotation( inPacket.getValAt< float >( 0x20 ) );
|
||||
player.setPosition( inPacket.getValAt< float >( 0x2c ),
|
||||
inPacket.getValAt< float >( 0x30 ),
|
||||
inPacket.getValAt< float >( 0x34 ) );
|
||||
|
||||
if( ( pPlayer->getCurrentAction() != nullptr ) && bPosChanged )
|
||||
pPlayer->getCurrentAction()->setInterrupted();
|
||||
if( ( player.getCurrentAction() != nullptr ) && bPosChanged )
|
||||
player.getCurrentAction()->setInterrupted();
|
||||
|
||||
// if no one is in range, don't bother trying to send a position update
|
||||
if( !pPlayer->hasInRangeActor() )
|
||||
if( !player.hasInRangeActor() )
|
||||
return;
|
||||
|
||||
uint8_t unk = inPacket.getValAt< uint8_t >( 0x29 );
|
||||
|
@ -278,26 +276,26 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
|
|||
}
|
||||
}
|
||||
|
||||
MoveActorPacket movePacket( pPlayer, unk1, unk2, unk3, unk4 );
|
||||
pPlayer->sendToInRangeSet( movePacket );
|
||||
MoveActorPacket movePacket( player, unk1, unk2, unk3, unk4 );
|
||||
player.sendToInRangeSet( movePacket );
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::reqEquipDisplayFlagsHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
g_log.info( "[" + std::to_string( pPlayer->getId() ) + "] Setting EquipDisplayFlags to " + std::to_string( inPacket.getValAt< uint8_t >( 0x20 ) ) );
|
||||
pPlayer->setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
g_log.info( "[" + std::to_string( player.getId() ) + "] Setting EquipDisplayFlags to " + std::to_string( inPacket.getValAt< uint8_t >( 0x20 ) ) );
|
||||
player.setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t zoneLineId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
|
||||
pPlayer->sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
||||
player.sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
||||
|
||||
auto pZone = pPlayer->getCurrentZone();
|
||||
auto pZone = player.getCurrentZone();
|
||||
|
||||
auto pLine = g_zoneMgr.getZonePosition( zoneLineId );
|
||||
|
||||
|
@ -307,34 +305,34 @@ void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket&
|
|||
|
||||
if( pLine != nullptr )
|
||||
{
|
||||
pPlayer->sendDebug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
|
||||
player.sendDebug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
|
||||
targetPos = pLine->getTargetPosition();
|
||||
targetZone = pLine->getTargetZoneId();
|
||||
rotation = pLine->getTargetRotation();
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( player.getId() );
|
||||
preparePacket.data().targetZone = targetZone;
|
||||
|
||||
//ActorControlPacket143 controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
|
||||
// 0x03, pPlayer->getId(), 0x01, targetZone );
|
||||
pPlayer->queuePacket( preparePacket );
|
||||
// 0x03, player.getId(), 0x01, targetZone );
|
||||
player.queuePacket( preparePacket );
|
||||
}
|
||||
else
|
||||
{
|
||||
// No zoneline found, revert to last zone
|
||||
pPlayer->sendUrgent( "ZoneLine " + std::to_string( zoneLineId ) + " not found." );
|
||||
player.sendUrgent( "ZoneLine " + std::to_string( zoneLineId ) + " not found." );
|
||||
targetPos.x = 0;
|
||||
targetPos.y = 0;
|
||||
targetPos.z = 0;
|
||||
targetZone = pZone->getId();
|
||||
}
|
||||
|
||||
pPlayer->performZoning( targetZone, targetPos, rotation);
|
||||
player.performZoning( targetZone, targetPos, rotation);
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::discoveryHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t ref_position_id = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
|
||||
|
@ -344,47 +342,47 @@ void Core::Network::GameConnection::discoveryHandler( const Packets::GamePacket&
|
|||
|
||||
if( !pQR->next() )
|
||||
{
|
||||
pPlayer->sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) + " not found. " );
|
||||
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) + " not found. " );
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcDiscovery > discoveryPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcDiscovery > discoveryPacket( player.getId() );
|
||||
discoveryPacket.data().map_id = pQR->getUInt( 2 );
|
||||
discoveryPacket.data().map_part_id = pQR->getUInt( 3 );
|
||||
|
||||
pPlayer->queuePacket( discoveryPacket );
|
||||
pPlayer->sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) );
|
||||
player.queuePacket( discoveryPacket );
|
||||
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) );
|
||||
|
||||
pPlayer->discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
||||
player.discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::playTimeHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcPlayTime > playTimePacket( pPlayer->getId() );
|
||||
playTimePacket.data().playTimeInMinutes = pPlayer->getPlayTime() / 60;
|
||||
pPlayer->queuePacket( playTimePacket );
|
||||
ZoneChannelPacket< FFXIVIpcPlayTime > playTimePacket( player.getId() );
|
||||
playTimePacket.data().playTimeInMinutes = player.getPlayTime() / 60;
|
||||
player.queuePacket( playTimePacket );
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::initHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
// init handler means this is a login procedure
|
||||
pPlayer->setIsLogin( true );
|
||||
player.setIsLogin( true );
|
||||
|
||||
pPlayer->setZone( pPlayer->getZoneId() );
|
||||
player.setZone( player.getZoneId() );
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::blackListHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint8_t count = inPacket.getValAt< uint8_t >( 0x21 );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcBlackList > blackListPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcBlackList > blackListPacket( player.getId() );
|
||||
blackListPacket.data().sequence = count;
|
||||
// TODO: Fill with actual blacklist data
|
||||
//blackListPacket.data().entry[0].contentId = 1;
|
||||
|
@ -395,39 +393,39 @@ void Core::Network::GameConnection::blackListHandler( const Packets::GamePacket&
|
|||
|
||||
|
||||
void Core::Network::GameConnection::pingHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
int32_t inVal = inPacket.getValAt< int32_t >( 0x20 );
|
||||
PingPacket pingPacket( pPlayer, inVal );
|
||||
PingPacket pingPacket( player, inVal );
|
||||
queueOutPacket( pingPacket );
|
||||
|
||||
pPlayer->setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
||||
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::finishLoadingHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
// player is done zoning
|
||||
pPlayer->setLoadingComplete( true );
|
||||
player.setLoadingComplete( true );
|
||||
|
||||
// if this is a login event
|
||||
if( pPlayer->isLogin() )
|
||||
if( player.isLogin() )
|
||||
{
|
||||
// fire the onLogin Event
|
||||
pPlayer->onLogin();
|
||||
pPlayer->setIsLogin( false );
|
||||
player.onLogin();
|
||||
player.setIsLogin( false );
|
||||
}
|
||||
|
||||
// spawn the player for himself
|
||||
pPlayer->spawn( pPlayer );
|
||||
player.spawn( player.getAsPlayer() );
|
||||
|
||||
// notify the zone of a change in position to force an "inRangeActor" update
|
||||
pPlayer->getCurrentZone()->changeActorPosition( pPlayer );
|
||||
player.getCurrentZone()->changeActorPosition( player.getAsPlayer() );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
|
||||
uint8_t type = inPacket.getValAt< uint8_t >( 0x2A );
|
||||
|
@ -436,7 +434,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
if( type == SocialListType::PartyList )
|
||||
{ // party list
|
||||
|
||||
/*ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );;
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( player.getId() );
|
||||
|
||||
listPacket.data().type = 2;
|
||||
listPacket.data().sequence = count;
|
||||
|
@ -444,15 +442,34 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
int32_t entrysizes = sizeof( listPacket.data().entries );
|
||||
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
|
||||
|
||||
listPacket.data().entries[0] = pPlayer->generatePlayerEntry();
|
||||
listPacket.data().entries[0].bytes[2] = player.getCurrentZone()->getId();
|
||||
listPacket.data().entries[0].bytes[3] = 0x80;
|
||||
listPacket.data().entries[0].bytes[4] = 0x02;
|
||||
listPacket.data().entries[0].bytes[6] = 0x3B;
|
||||
listPacket.data().entries[0].bytes[11] = 0x10;
|
||||
listPacket.data().entries[0].classJob = static_cast< uint8_t >( player.getClass() );
|
||||
listPacket.data().entries[0].contentId = player.getContentId();
|
||||
listPacket.data().entries[0].level = player.getLevel();
|
||||
listPacket.data().entries[0].zoneId = player.getCurrentZone()->getId();
|
||||
listPacket.data().entries[0].zoneId1 = 0x0100;
|
||||
// TODO: no idea what this does
|
||||
//listPacket.data().entries[0].one = 1;
|
||||
|
||||
queueOutPacket( listPacket );*/
|
||||
memcpy( listPacket.data().entries[0].name, player.getName().c_str(), strlen( player.getName().c_str() ) );
|
||||
|
||||
// TODO: actually store and read language from somewhere
|
||||
listPacket.data().entries[0].bytes1[0] = 0x01;//flags (lang)
|
||||
// TODO: these flags need to be figured out
|
||||
//listPacket.data().entries[0].bytes1[1] = 0x00;//flags
|
||||
listPacket.data().entries[0].onlineStatusMask = player.getOnlineStatusMask();
|
||||
|
||||
queueOutPacket( listPacket );
|
||||
|
||||
}
|
||||
else if( type == SocialListType::FriendList )
|
||||
{ // friend list
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( player.getId() );
|
||||
listPacket.data().type = 0x0B;
|
||||
listPacket.data().sequence = count;
|
||||
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
|
||||
|
@ -681,7 +698,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
|||
}
|
||||
|
||||
void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
|
||||
std::string chatString( inPacket.getStringAt( 0x3a ) );
|
||||
|
@ -691,35 +708,35 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
if( chatString.at( 0 ) == '!' )
|
||||
{
|
||||
// execute game console command
|
||||
g_gameCommandMgr.execCommand( const_cast< char * >( chatString.c_str() ) + 1, pPlayer );
|
||||
g_gameCommandMgr.execCommand( const_cast< char * >( chatString.c_str() ) + 1, player );
|
||||
return;
|
||||
}
|
||||
|
||||
ChatType chatType = static_cast<ChatType>( inPacket.getValAt< uint8_t >( 0x38 ) );
|
||||
ChatType chatType = static_cast< ChatType >( inPacket.getValAt< uint8_t >( 0x38 ) );
|
||||
|
||||
//ToDo, need to implement sending GM chat types.
|
||||
ChatPacket chatPacket( pPlayer, chatType, chatString );
|
||||
ChatPacket chatPacket( player, chatType, chatString );
|
||||
|
||||
switch( chatType )
|
||||
{
|
||||
case ChatType::Say:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange( pPlayer, 50, chatPacket );
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Yell:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange(pPlayer, 6000, chatPacket);
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Shout:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange( pPlayer, 6000, chatPacket );
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange( pPlayer, 50, chatPacket );
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -731,19 +748,19 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
// log right back in.
|
||||
// Also the packet needs to be converted to an ipc structure
|
||||
void Core::Network::GameConnection::logoutHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcLogout > logoutPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcLogout > logoutPacket( player.getId() );
|
||||
logoutPacket.data().flags1 = 0x02;
|
||||
logoutPacket.data().flags2 = 0x2000;
|
||||
queueOutPacket( logoutPacket );
|
||||
|
||||
pPlayer->setMarkedForRemoval();
|
||||
player.setMarkedForRemoval();
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
std::string targetPcName = inPacket.getStringAt( 0x21 );
|
||||
std::string msg = inPacket.getStringAt( 0x41 );
|
||||
|
@ -752,7 +769,7 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
|
|||
|
||||
if( !pSession )
|
||||
{
|
||||
ChatChannelPacket< FFXIVIpcTellErrNotFound > tellErrPacket( pPlayer->getId() );
|
||||
ChatChannelPacket< FFXIVIpcTellErrNotFound > tellErrPacket( player.getId() );
|
||||
strcpy( tellErrPacket.data().receipientName, targetPcName.c_str() );
|
||||
sendSinglePacket( tellErrPacket );
|
||||
|
||||
|
@ -785,9 +802,9 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
|
|||
return;
|
||||
}
|
||||
|
||||
ChatChannelPacket< FFXIVIpcTell > tellPacket( pPlayer->getId() );
|
||||
ChatChannelPacket< FFXIVIpcTell > tellPacket( player.getId() );
|
||||
strcpy( tellPacket.data().msg, msg.c_str() );
|
||||
strcpy( tellPacket.data().receipientName, pPlayer->getName().c_str() );
|
||||
strcpy( tellPacket.data().receipientName, player.getName().c_str() );
|
||||
// TODO: do these have a meaning?
|
||||
//tellPacket.data().u1 = 0x92CD7337;
|
||||
//tellPacket.data().u2a = 0x2E;
|
||||
|
@ -797,12 +814,12 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
|
|||
}
|
||||
|
||||
void Core::Network::GameConnection::performNoteHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
GamePacketNew< FFXIVIpcPerformNote, ServerZoneIpcType > performPacket( pPlayer->getId() ); // todo: change to zonepacket
|
||||
GamePacketNew< FFXIVIpcPerformNote, ServerZoneIpcType > performPacket( player.getId() );
|
||||
|
||||
uint8_t inVal = inPacket.getValAt< uint8_t >( 0x20 );
|
||||
memcpy( &performPacket.data().data[0], &inVal, 32 );
|
||||
|
||||
pPlayer->sendToInRangeSet( performPacket );
|
||||
player.sendToInRangeSet( performPacket );
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Common.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Session.h"
|
||||
#include "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 "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
|
||||
#include "src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h"
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Action/Action.h"
|
||||
#include "src/servers/Server_Zone/Action/ActionCast.h"
|
||||
#include "src/servers/Server_Zone/Action/ActionMount.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Server_Zone/Network/PacketWrappers/MoveActorPacket.h"
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionCast.h"
|
||||
#include "Action/ActionMount.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
|
||||
extern Core::Scripting::ScriptManager g_scriptMgr;
|
||||
|
@ -40,7 +40,7 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint8_t type = inPacket.getValAt< uint32_t >( 0x21 );
|
||||
|
||||
|
@ -49,7 +49,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
|
||||
uint64_t targetId = inPacket.getValAt< uint64_t >( 0x30 );
|
||||
|
||||
pPlayer->sendDebug( "Skill type:" + std::to_string( type ) );
|
||||
player.sendDebug( "Skill type:" + std::to_string( type ) );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
|
@ -58,16 +58,16 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
if( action < 1000000 ) // normal action
|
||||
{
|
||||
std::string actionIdStr = boost::str( boost::format( "%|04X|" ) % action );
|
||||
pPlayer->sendDebug( "---------------------------------------" );
|
||||
pPlayer->sendDebug( "ActionHandler ( " + actionIdStr + " | " +
|
||||
g_exdData.getActionInfo( action )->name +
|
||||
" | " + std::to_string( targetId ) + " )" );
|
||||
player.sendDebug( "---------------------------------------" );
|
||||
player.sendDebug( "ActionHandler ( " + actionIdStr + " | " +
|
||||
g_exdData.getActionInfo( action )->name +
|
||||
" | " + std::to_string( targetId ) + " )" );
|
||||
|
||||
pPlayer->queuePacket( ActorControlPacket142( pPlayer->getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||
player.queuePacket( ActorControlPacket142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||
|
||||
if( action == 5 )
|
||||
{
|
||||
auto currentAction = pPlayer->getCurrentAction();
|
||||
auto currentAction = player.getCurrentAction();
|
||||
|
||||
// we should always have an action here, if not there is a bug
|
||||
assert( currentAction );
|
||||
|
@ -75,22 +75,22 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
}
|
||||
else
|
||||
{
|
||||
Core::Entity::ActorPtr targetActor = pPlayer;
|
||||
if( targetId != pPlayer->getId() )
|
||||
Core::Entity::ActorPtr targetActor = player.getAsPlayer();
|
||||
if( targetId != player.getId() )
|
||||
{
|
||||
targetActor = pPlayer->lookupTargetById( targetId );
|
||||
targetActor = player.lookupTargetById( targetId );
|
||||
}
|
||||
|
||||
if( !pPlayer->actionHasCastTime( action ) )
|
||||
if( !player.actionHasCastTime( action ) )
|
||||
{
|
||||
g_scriptMgr.onCastFinish( pPlayer, targetActor, action );
|
||||
g_scriptMgr.onCastFinish( player, targetActor, action );
|
||||
}
|
||||
else
|
||||
{
|
||||
Action::ActionCastPtr pActionCast( new Action::ActionCast( pPlayer, targetActor, action ) );
|
||||
pPlayer->setCurrentAction( pActionCast );
|
||||
pPlayer->sendDebug( "setCurrentAction()" );
|
||||
pPlayer->getCurrentAction()->onStart();
|
||||
Action::ActionCastPtr pActionCast( new Action::ActionCast( player.getAsPlayer(), targetActor, action ) );
|
||||
player.setCurrentAction( pActionCast );
|
||||
player.sendDebug( "setCurrentAction()" );
|
||||
player.getCurrentAction()->onStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
if( info )
|
||||
{
|
||||
g_log.debug( info->name );
|
||||
g_scriptMgr.onEventItem( pPlayer, action, info->eventId, info->castTime, targetId );
|
||||
g_scriptMgr.onEventItem( player, action, info->eventId, info->castTime, targetId );
|
||||
}
|
||||
}
|
||||
else if( action > 3000000 ) // unknown
|
||||
|
@ -116,15 +116,15 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
|
||||
case Common::SkillType::MountSkill:
|
||||
|
||||
pPlayer->sendDebug( "Request mount " + std::to_string( action ) );
|
||||
player.sendDebug( "Request mount " + std::to_string( action ) );
|
||||
|
||||
Action::ActionMountPtr pActionMount( new Action::ActionMount(pPlayer, action) );
|
||||
pPlayer->setCurrentAction( pActionMount );
|
||||
pPlayer->sendDebug("setCurrentAction()");
|
||||
pPlayer->getCurrentAction()->onStart();
|
||||
Action::ActionMountPtr pActionMount( new Action::ActionMount( player.getAsPlayer(), action ) );
|
||||
player.setCurrentAction( pActionMount );
|
||||
player.sendDebug( "setCurrentAction()" );
|
||||
player.getCurrentAction()->onStart();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _ACTORCONTROL142_H
|
||||
#define _ACTORCONTROL142_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _ACTORCONTROL143_H
|
||||
#define _ACTORCONTROL143_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _ACTORCONTROL144_H
|
||||
#define _ACTORCONTROL144_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _ACTORSPAWN_H
|
||||
#define _ACTORSPAWN_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _CHATPACKET_H
|
||||
#define _CHATPACKET_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
namespace Core {
|
||||
|
@ -18,17 +18,17 @@ class ChatPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcChat >
|
||||
{
|
||||
public:
|
||||
ChatPacket( Entity::PlayerPtr player, Common::ChatType chatType, const std::string& msg ) :
|
||||
ZoneChannelPacket< FFXIVIpcChat >( player->getId(), player->getId() )
|
||||
ChatPacket( Entity::Player& player, Common::ChatType chatType, const std::string& msg ) :
|
||||
ZoneChannelPacket< FFXIVIpcChat >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player, chatType, msg );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player, Common::ChatType chatType, const std::string& msg )
|
||||
void initialize( Entity::Player& player, Common::ChatType chatType, const std::string& msg )
|
||||
{
|
||||
m_data.chatType = chatType;
|
||||
strcpy( m_data.name, player->getName().c_str() );
|
||||
strcpy( m_data.name, player.getName().c_str() );
|
||||
strcpy( m_data.msg, msg.c_str() );
|
||||
};
|
||||
};
|
||||
|
@ -38,4 +38,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#endif /*_CHATPACKET_H*/
|
||||
#endif /*_CHATPACKET_H*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _EVENTFINISH_H
|
||||
#define _EVENTFINISH_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _EVENTPLAY_H
|
||||
#define _EVENTPLAY_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _EVENTSTART_H
|
||||
#define _EVENTSTART_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _CORE_NETWORK_PACKETS_INITUIPACKET_H
|
||||
#define _CORE_NETWORK_PACKETS_INITUIPACKET_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "Server_Zone/Actor/Player.h"
|
||||
#include "Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -18,59 +18,59 @@ namespace Server {
|
|||
class InitUIPacket : public ZoneChannelPacket< FFXIVIpcInitUI >
|
||||
{
|
||||
public:
|
||||
InitUIPacket( Entity::PlayerPtr player ) :
|
||||
ZoneChannelPacket< FFXIVIpcInitUI >( player->getId(), player->getId() )
|
||||
InitUIPacket( Entity::Player& player ) :
|
||||
ZoneChannelPacket< FFXIVIpcInitUI >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player )
|
||||
void initialize( Entity::Player& player )
|
||||
{
|
||||
m_data.contentId = player->getContentId();
|
||||
m_data.contentId = player.getContentId();
|
||||
|
||||
// TODO: Support rested experience.
|
||||
m_data.restedExp = 0;
|
||||
//m_data.padding = 0x100;
|
||||
m_data.charId = player->getId();
|
||||
m_data.race = player->getLookAt( Common::CharaLook::Race );
|
||||
m_data.tribe = player->getLookAt( Common::CharaLook::Tribe );
|
||||
m_data.gender = player->getLookAt( Common::CharaLook::Gender );
|
||||
m_data.currentClass = static_cast< uint8_t >( player->getClass() );
|
||||
m_data.currentJob = static_cast< uint8_t >( player->getClass() );
|
||||
m_data.deity = static_cast< uint8_t >( player->getGuardianDeity() );
|
||||
m_data.namedayMonth = player->getBirthMonth();
|
||||
m_data.namedayDay = player->getBirthDay();
|
||||
m_data.charId = player.getId();
|
||||
m_data.race = player.getLookAt( Common::CharaLook::Race );
|
||||
m_data.tribe = player.getLookAt( Common::CharaLook::Tribe );
|
||||
m_data.gender = player.getLookAt( Common::CharaLook::Gender );
|
||||
m_data.currentClass = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.currentJob = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.deity = static_cast< uint8_t >( player.getGuardianDeity() );
|
||||
m_data.namedayMonth = player.getBirthMonth();
|
||||
m_data.namedayDay = player.getBirthDay();
|
||||
// TODO: Support grand company status.
|
||||
m_data.grandCompany = static_cast< Common::GrandCompany >( player->getGc() );
|
||||
m_data.grandCompany = static_cast< Common::GrandCompany >( player.getGc() );
|
||||
//m_data.gcRank = GCRank::None;
|
||||
|
||||
// TODO: Support starting city.
|
||||
//m_data.startCity = Town::Gridania;
|
||||
m_data.homepoint = player->getHomepoint();
|
||||
m_data.homepoint = player.getHomepoint();
|
||||
|
||||
memset( &m_data.name[0], 0, sizeof( m_data.name ) );
|
||||
|
||||
strcpy( &m_data.name[0], player->getName().c_str() );
|
||||
strcpy( &m_data.name[0], player.getName().c_str() );
|
||||
|
||||
memcpy( m_data.aetheryte, player->getAetheryteArray(), sizeof ( m_data.aetheryte ) );
|
||||
memcpy( m_data.aetheryte, player.getAetheryteArray(), sizeof ( m_data.aetheryte ) );
|
||||
|
||||
// Set the class levels and exp.
|
||||
for( uint8_t i = 0; i < 25; i++ )
|
||||
{
|
||||
m_data.levels[i] = player->getClassArray()[i];
|
||||
m_data.exp[i] = player->getExpArray()[i];
|
||||
m_data.levels[i] = player.getClassArray()[i];
|
||||
m_data.exp[i] = player.getExpArray()[i];
|
||||
}
|
||||
|
||||
memcpy( m_data.orchestrionMask, player->getOrchestrionBitmask(), sizeof( m_data.orchestrionMask ) );
|
||||
memcpy( m_data.orchestrionMask, player.getOrchestrionBitmask(), sizeof( m_data.orchestrionMask ) );
|
||||
|
||||
memcpy( m_data.mountGuideMask, player->getMountGuideBitmask(), sizeof( m_data.mountGuideMask) );
|
||||
memcpy( m_data.mountGuideMask, player.getMountGuideBitmask(), sizeof( m_data.mountGuideMask) );
|
||||
|
||||
memcpy( m_data.unlockBitmask, player->getUnlockBitmask(), sizeof( m_data.unlockBitmask ) );
|
||||
memcpy( m_data.unlockBitmask, player.getUnlockBitmask(), sizeof( m_data.unlockBitmask ) );
|
||||
|
||||
memcpy( m_data.discovery, player->getDiscoveryBitmask(), sizeof( m_data.discovery ) );
|
||||
memcpy( m_data.discovery, player.getDiscoveryBitmask(), sizeof( m_data.discovery ) );
|
||||
|
||||
memcpy( m_data.howto, player->getHowToArray(), sizeof( m_data.howto ) );
|
||||
memcpy( m_data.howto, player.getHowToArray(), sizeof( m_data.howto ) );
|
||||
|
||||
m_data.unknown_13 = 0x46;
|
||||
m_data.expansion = 2;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _MODELEQUIPPACKET_H
|
||||
#define _MODELEQUIPPACKET_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -17,22 +17,22 @@ class ModelEquipPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcModelEquip >
|
||||
{
|
||||
public:
|
||||
ModelEquipPacket( Entity::PlayerPtr player ) :
|
||||
ZoneChannelPacket< FFXIVIpcModelEquip >( player->getId(), player->getId() )
|
||||
ModelEquipPacket( Entity::Player& player ) :
|
||||
ZoneChannelPacket< FFXIVIpcModelEquip >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player )
|
||||
void initialize( Entity::Player& player )
|
||||
{
|
||||
m_data.mainWeapon = player->getModelMainWeapon();
|
||||
m_data.offWeapon = player->getModelSubWeapon();
|
||||
m_data.models[0] = player->getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = player->getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = player->getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = player->getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = player->getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
m_data.mainWeapon = player.getModelMainWeapon();
|
||||
m_data.offWeapon = player.getModelSubWeapon();
|
||||
m_data.models[0] = player.getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = player.getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = player.getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = player.getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = player.getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -41,4 +41,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#endif /*_MODELEQUIPPACKET_H*/
|
||||
#endif /*_MODELEQUIPPACKET_H*/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef _MOVEACTORPACKET_H
|
||||
#define _MOVEACTORPACKET_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
namespace Core {
|
||||
|
@ -21,24 +21,24 @@ class MoveActorPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcActorMove >
|
||||
{
|
||||
public:
|
||||
MoveActorPacket( Entity::ActorPtr actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) :
|
||||
ZoneChannelPacket< FFXIVIpcActorMove >( actor->getId(), actor->getId() )
|
||||
MoveActorPacket( Entity::Actor& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) :
|
||||
ZoneChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() )
|
||||
{
|
||||
initialize( actor, unk1, unk2, unk3, unk4 );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::ActorPtr actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
||||
void initialize( Entity::Actor& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
||||
{
|
||||
|
||||
m_data.rotation = Math::Util::floatToUInt8Rot( actor->getRotation() );
|
||||
m_data.rotation = Math::Util::floatToUInt8Rot( actor.getRotation() );
|
||||
m_data.unknown_1 = unk1;
|
||||
m_data.unknown_2 = unk2;
|
||||
m_data.unknown_3 = unk3;
|
||||
m_data.unknown_4 = unk4;
|
||||
m_data.posX = Math::Util::floatToUInt16( actor->getPos().x );
|
||||
m_data.posY = Math::Util::floatToUInt16( actor->getPos().y );
|
||||
m_data.posZ = Math::Util::floatToUInt16( actor->getPos().z );
|
||||
m_data.posX = Math::Util::floatToUInt16( actor.getPos().x );
|
||||
m_data.posY = Math::Util::floatToUInt16( actor.getPos().y );
|
||||
m_data.posZ = Math::Util::floatToUInt16( actor.getPos().z );
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -48,4 +48,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#endif /*_MOVEACTORPACKET_H*/
|
||||
#endif /*_MOVEACTORPACKET_H*/
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _CORE_NETWORK_PACKETS_PINGPACKET_H
|
||||
#define _CORE_NETWORK_PACKETS_PINGPACKET_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -17,14 +17,14 @@ class PingPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcPing >
|
||||
{
|
||||
public:
|
||||
PingPacket( Entity::PlayerPtr player, int32_t inVal ) :
|
||||
ZoneChannelPacket< FFXIVIpcPing >( player->getId(), player->getId() )
|
||||
PingPacket( Entity::Player& player, int32_t inVal ) :
|
||||
ZoneChannelPacket< FFXIVIpcPing >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player, inVal );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player, int32_t inVal )
|
||||
void initialize( Entity::Player& player, int32_t inVal )
|
||||
{
|
||||
m_data.timeInMilliseconds = 0x000014D00000000 + inVal;
|
||||
};
|
||||
|
@ -35,4 +35,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#endif /*_CORE_NETWORK_PACKETS_CPINGPACKET_H*/
|
||||
#endif /*_CORE_NETWORK_PACKETS_CPINGPACKET_H*/
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef _PLAYERSPAWN_H
|
||||
#define _PLAYERSPAWN_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Util/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"
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Inventory/Item.h"
|
||||
#include "StatusEffect/StatusEffect.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -22,97 +22,97 @@ namespace Server {
|
|||
public GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >
|
||||
{
|
||||
public:
|
||||
PlayerSpawnPacket( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget ) :
|
||||
GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >( pPlayer->getId(), pTarget->getId() )
|
||||
PlayerSpawnPacket( Entity::Player& player, Entity::Player& target ) :
|
||||
GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >( player.getId(), target.getId() )
|
||||
{
|
||||
initialize( pPlayer, pTarget );
|
||||
initialize( player, target );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget )
|
||||
void initialize( Entity::Player& player, Entity::Player& target )
|
||||
{
|
||||
// todo: figure out unkown offsets
|
||||
// TODO: temporary gm rank
|
||||
//m_data.gmRank = 0xff;
|
||||
|
||||
m_data.classJob = static_cast< uint8_t >( pPlayer->getClass() );
|
||||
m_data.classJob = static_cast< uint8_t >( player.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.hPCurr = player.getHp();
|
||||
m_data.mPCurr = player.getMp();
|
||||
m_data.tPCurr = player.getTp();
|
||||
m_data.hPMax = player.getMaxHp();
|
||||
m_data.mPMax = player.getMaxMp();
|
||||
|
||||
//m_data.tPMax = 3000;
|
||||
m_data.level = pPlayer->getLevel();
|
||||
m_data.gmRank = pPlayer->getGmRank();
|
||||
m_data.level = player.getLevel();
|
||||
m_data.gmRank = player.getGmRank();
|
||||
m_data.pose = 0;
|
||||
|
||||
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
|
||||
memcpy( m_data.look, player.getLookArray(), 26 );
|
||||
|
||||
auto item = pPlayer->getInventory()->getItemAt( Inventory::GearSet0, Inventory::EquipSlot::MainHand );
|
||||
auto item = player.getInventory()->getItemAt( Inventory::GearSet0, Inventory::EquipSlot::MainHand );
|
||||
if( item )
|
||||
m_data.mainWeaponModel = item->getModelId1();
|
||||
m_data.secWeaponModel = pPlayer->getModelSubWeapon();
|
||||
m_data.secWeaponModel = player.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.models[0] = player.getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = player.getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = player.getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = player.getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = player.getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
strcpy( m_data.name, player.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.rotation = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
|
||||
m_data.pos.x = player.getPos().x;
|
||||
m_data.pos.y = player.getPos().y;
|
||||
m_data.pos.z = player.getPos().z;
|
||||
m_data.rotation = Math::Util::floatToUInt16Rot( player.getRotation() );
|
||||
|
||||
|
||||
m_data.title = pPlayer->getTitle();
|
||||
m_data.voice = pPlayer->getVoiceId();
|
||||
m_data.currentMount = pPlayer->getCurrentMount();
|
||||
m_data.title = player.getTitle();
|
||||
m_data.voice = player.getVoiceId();
|
||||
m_data.currentMount = player.getCurrentMount();
|
||||
|
||||
m_data.onlineStatus = static_cast< uint8_t >( pPlayer->getOnlineStatus() );
|
||||
m_data.onlineStatus = static_cast< uint8_t >( player.getOnlineStatus() );
|
||||
|
||||
//m_data.u23 = 0x04;
|
||||
//m_data.u24 = 256;
|
||||
m_data.state = static_cast< uint8_t >( pPlayer->getStatus() );
|
||||
m_data.state = static_cast< uint8_t >( player.getStatus() );
|
||||
m_data.type = 1;
|
||||
if( pTarget == pPlayer )
|
||||
if( target.getId() == player.getId() )
|
||||
{
|
||||
m_data.spawnIndex = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data.spawnIndex = pTarget->getSpawnIdForActorId( pPlayer->getId() );
|
||||
m_data.spawnIndex = target.getSpawnIdForActorId( player.getId() );
|
||||
}
|
||||
// 0x20 == spawn hidden to be displayed by the spawneffect control
|
||||
m_data.displayFlags = pPlayer->getStance();
|
||||
m_data.displayFlags = player.getStance();
|
||||
|
||||
if( pPlayer->getZoningType() != Common::ZoneingType::None )
|
||||
if( player.getZoningType() != Common::ZoneingType::None )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::Invisible;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead )
|
||||
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::HideHead;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon )
|
||||
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::HideWeapon;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor )
|
||||
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::Visor;
|
||||
}
|
||||
|
||||
m_data.currentMount = pPlayer->getCurrentMount();
|
||||
m_data.currentMount = player.getCurrentMount();
|
||||
|
||||
m_data.targetId = pPlayer->getTargetId();
|
||||
m_data.targetId = player.getTargetId();
|
||||
//m_data.type = 1;
|
||||
//m_data.unknown_33 = 4;
|
||||
//m_data.unknown_38 = 0x70;
|
||||
|
@ -121,11 +121,11 @@ namespace Server {
|
|||
|
||||
uint64_t currentTimeMs = Util::getTimeMs();
|
||||
|
||||
for( auto const& effect : pPlayer->getStatusEffectMap() )
|
||||
for( auto const& effect : player.getStatusEffectMap() )
|
||||
{
|
||||
m_data.effect[effect.first].effect_id = effect.second->getId();
|
||||
m_data.effect[effect.first].duration = static_cast< float >( effect.second->getDuration() -
|
||||
( currentTimeMs - effect.second->getStartTimeMs() ) ) / 1000;
|
||||
( currentTimeMs - effect.second->getStartTimeMs() ) ) / 1000;
|
||||
m_data.effect[effect.first].sourceActorId = effect.second->getSrcActorId();
|
||||
m_data.effect[effect.first].unknown1 = effect.second->getParam();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _PLAYERSTATE_H
|
||||
#define _PLAYERSTATE_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -17,14 +17,14 @@ class PlayerStateFlagsPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcPlayerStateFlags >
|
||||
{
|
||||
public:
|
||||
PlayerStateFlagsPacket( Entity::PlayerPtr pActor ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( pActor->getId(), pActor->getId() )
|
||||
PlayerStateFlagsPacket( Entity::Player& player ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( pActor->getStateFlags() );
|
||||
initialize( player.getStateFlags() );
|
||||
}
|
||||
|
||||
PlayerStateFlagsPacket( Entity::PlayerPtr pActor, std::vector< Common::PlayerStateFlag > flags ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( pActor->getId(), pActor->getId() )
|
||||
PlayerStateFlagsPacket( Entity::Player& player, std::vector< Common::PlayerStateFlag > flags ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() )
|
||||
{
|
||||
uint8_t newFlags[7];
|
||||
memset( newFlags, 0, 7 );
|
||||
|
@ -55,4 +55,4 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
#endif /*_PLAYERSTATE_H*/
|
||||
#endif /*_PLAYERSTATE_H*/
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _QUESTMESSAGE_H
|
||||
#define _QUESTMESSAGE_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include "Actor/Player.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _SERVERNOTICEPACKET_H
|
||||
#define _SERVERNOTICEPACKET_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _UPDATEHPMPTP_H
|
||||
#define _UPDATEHPMPTP_H
|
||||
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Zone/Actor/Actor.h>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Actor/Actor.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <chaiscript/chaiscript.hpp>
|
||||
|
||||
#include <src/servers/Server_Common/Script/ChaiscriptStdLib.h>
|
||||
#include <Server_Common/Script/ChaiscriptStdLib.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Actor/BattleNpc.h"
|
||||
#include "src/servers/Server_Zone/ServerZone.h"
|
||||
#include "src/servers/Server_Zone/Event/Event.h"
|
||||
#include "src/servers/Server_Zone/Event/EventHelper.h"
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Event/Event.h"
|
||||
#include "Event/EventHelper.h"
|
||||
#include "StatusEffect/StatusEffect.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
@ -55,11 +55,11 @@ void Core::Scripting::ScriptManager::loadDir( std::string dirname, std::set<std:
|
|||
|
||||
}
|
||||
|
||||
void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Entity::Player& player )
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string test = m_onFirstEnterWorld( *pPlayer );
|
||||
std::string test = m_onFirstEnterWorld( player );
|
||||
}
|
||||
catch( const std::exception &e )
|
||||
{
|
||||
|
@ -87,18 +87,18 @@ const boost::shared_ptr< chaiscript::ChaiScript >& Core::Scripting::ScriptManage
|
|||
}
|
||||
|
||||
|
||||
bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId )
|
||||
bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
std::string eventName = "onTalk";
|
||||
std::string objName = Event::getEventName( eventId );
|
||||
|
||||
pPlayer->sendDebug( "Actor: " +
|
||||
std::to_string( actorId ) + " -> " +
|
||||
std::to_string( Core::Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
|
||||
" \neventId: " +
|
||||
std::to_string( eventId ) +
|
||||
" (0x" + boost::str( boost::format( "%|08X|" )
|
||||
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
|
||||
player.sendDebug( "Actor: " +
|
||||
std::to_string( actorId ) + " -> " +
|
||||
std::to_string( Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
|
||||
" \neventId: " +
|
||||
std::to_string( eventId ) +
|
||||
" (0x" + boost::str( boost::format( "%|08X|" )
|
||||
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
|
||||
|
||||
uint16_t eventType = eventId >> 16;
|
||||
|
||||
|
@ -106,26 +106,26 @@ bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, ui
|
|||
{
|
||||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( objName );
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( actorId, eventId, Event::Event::Talk, 0, 0 );
|
||||
player.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 );
|
||||
fn( obj, eventId, player, actorId );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what( ) );
|
||||
player.sendDebug( e.what( ) );
|
||||
|
||||
if( eventType == Common::EventType::Quest )
|
||||
{
|
||||
auto questInfo = g_exdData.getQuestInfo( eventId );
|
||||
if( questInfo )
|
||||
{
|
||||
pPlayer->sendUrgent( "Quest not implemented: " + questInfo->name );
|
||||
player.sendUrgent( "Quest not implemented: " + questInfo->name );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, ui
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEnterTerritory( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
|
||||
bool Core::Scripting::ScriptManager::onEnterTerritory( Entity::Player& player, uint32_t eventId,
|
||||
uint16_t param1, uint16_t param2 )
|
||||
{
|
||||
std::string eventName = "onEnterTerritory";
|
||||
|
@ -146,25 +146,25 @@ bool Core::Scripting::ScriptManager::onEnterTerritory( Core::Entity::PlayerPtr p
|
|||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( objName );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::EnterTerritory, 0, pPlayer->getZoneId() );
|
||||
player.eventStart( player.getId(), eventId, Event::Event::EnterTerritory, 0, player.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 );
|
||||
fn( obj, eventId, player, param1, param2 );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what() );
|
||||
player.sendDebug( e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onWithinRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1,
|
||||
bool Core::Scripting::ScriptManager::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||
float x, float y, float z )
|
||||
{
|
||||
std::string eventName = "onWithinRange";
|
||||
|
@ -175,25 +175,25 @@ bool Core::Scripting::ScriptManager::onWithinRange( Entity::PlayerPtr pPlayer, u
|
|||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::WithinRange, 1, param1 );
|
||||
player.eventStart( player.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 );
|
||||
fn( obj, eventId, player, param1, x, y, z );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what() );
|
||||
player.sendDebug( e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1,
|
||||
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||
float x, float y, float z )
|
||||
{
|
||||
std::string eventName = "onOutsideRange";
|
||||
|
@ -204,25 +204,25 @@ bool Core::Scripting::ScriptManager::onOutsideRange( Entity::PlayerPtr pPlayer,
|
|||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::OutsideRange, 1, param1 );
|
||||
player.eventStart( player.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 );
|
||||
fn( obj, eventId, player, param1, x, y, z );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what() );
|
||||
player.sendDebug( e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, uint64_t actorId,
|
||||
bool Core::Scripting::ScriptManager::onEmote( Entity::Player& player, uint64_t actorId,
|
||||
uint32_t eventId, uint8_t emoteId )
|
||||
{
|
||||
std::string eventName = "onEmote";
|
||||
|
@ -232,15 +232,15 @@ bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, u
|
|||
{
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( actorId, eventId, Event::Event::Emote, 0, emoteId );
|
||||
player.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 );
|
||||
fn( obj, eventId, player, actorId, emoteId );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, u
|
|||
auto questInfo = g_exdData.getQuestInfo( eventId );
|
||||
if( questInfo )
|
||||
{
|
||||
pPlayer->sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
|
||||
player.sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -260,22 +260,22 @@ bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, u
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerReturn( Entity::Player& player, 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 ) );
|
||||
player.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 );
|
||||
auto pEvent = player.getEvent( eventId );
|
||||
if( pEvent )
|
||||
{
|
||||
pEvent->setPlayedScene( false );
|
||||
|
@ -284,27 +284,27 @@ bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::PlayerP
|
|||
// if there is one, proceed to call it
|
||||
if( eventCallback )
|
||||
{
|
||||
eventCallback( *pPlayer, eventId, param1, param2, param3 );
|
||||
eventCallback( player, eventId, param1, param2, param3 );
|
||||
if( !pEvent->hasPlayedScene() )
|
||||
pPlayer->eventFinish( eventId, 1 );
|
||||
player.eventFinish( eventId, 1 );
|
||||
else
|
||||
pEvent->setPlayedScene( false );
|
||||
}
|
||||
// else, finish the event.
|
||||
else
|
||||
pPlayer->eventFinish( eventId, 1 );
|
||||
player.eventFinish( eventId, 1 );
|
||||
}
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendNotice( e.what() );
|
||||
player.sendNotice( e.what() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId,
|
||||
uint16_t subEvent, uint16_t param, uint32_t catalogId )
|
||||
{
|
||||
std::string eventName = Event::getEventName( eventId ) + "_TRADE";
|
||||
|
@ -313,7 +313,7 @@ bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::Pl
|
|||
{
|
||||
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 );
|
||||
fn( player, eventId, subEvent, param, catalogId );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::Pl
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uint32_t eventItemId,
|
||||
bool Core::Scripting::ScriptManager::onEventItem( Entity::Player& player, uint32_t eventItemId,
|
||||
uint32_t eventId, uint32_t castTime, uint64_t targetId )
|
||||
{
|
||||
std::string eventName = "onEventItem";
|
||||
|
@ -333,17 +333,17 @@ bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uin
|
|||
{
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( targetId, eventId, Event::Event::Item, 0, 0 );
|
||||
player.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 );
|
||||
fn( obj, eventId, player, eventItemId, castTime, targetId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendNotice( e.what() );
|
||||
player.sendNotice( e.what() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uin
|
|||
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint16_t nameId )
|
||||
bool Core::Scripting::ScriptManager::onMobKill( Entity::Player& player, uint16_t nameId )
|
||||
{
|
||||
std::string eventName = "onBnpcKill_" + std::to_string( nameId );
|
||||
|
||||
|
@ -359,7 +359,7 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint1
|
|||
// loop through all active quests and try to call available onMobKill callbacks
|
||||
for( size_t i = 0; i < 30; i++ )
|
||||
{
|
||||
auto activeQuests = pPlayer->getQuestActive( static_cast< uint16_t >( i ) );
|
||||
auto activeQuests = player.getQuestActive( static_cast< uint16_t >( i ) );
|
||||
if( !activeQuests )
|
||||
continue;
|
||||
|
||||
|
@ -369,12 +369,12 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint1
|
|||
auto obj = m_pChaiHandler->eval( Event::getEventName( 0x00010000 | questId ) );
|
||||
std::string objName = Event::getEventName( 0x00010000 | questId );
|
||||
|
||||
pPlayer->sendDebug("Calling: " + objName + "." + eventName);
|
||||
player.sendDebug("Calling: " + objName + "." + eventName);
|
||||
|
||||
try
|
||||
{
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Player& ) > >(eventName);
|
||||
fn( obj, *pPlayer );
|
||||
fn( obj, player );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint1
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onCastFinish( Entity::PlayerPtr pPlayer, Entity::ActorPtr pTarget, uint32_t actionId )
|
||||
bool Core::Scripting::ScriptManager::onCastFinish( Entity::Player& player, Entity::ActorPtr pTarget, uint32_t actionId )
|
||||
{
|
||||
std::string eventName = "onFinish";
|
||||
|
||||
|
@ -396,14 +396,14 @@ bool Core::Scripting::ScriptManager::onCastFinish( Entity::PlayerPtr pPlayer, En
|
|||
auto obj = m_pChaiHandler->eval( "skillDef_" + std::to_string( actionId ) );
|
||||
std::string objName = "skillDef_" + std::to_string( actionId );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Player&,
|
||||
Entity::Actor& ) > >( eventName );
|
||||
fn( obj, *pPlayer, *pTarget );
|
||||
fn( obj, player, *pTarget );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendUrgent( e.what() );
|
||||
player.sendUrgent( e.what() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -446,7 +446,7 @@ bool Core::Scripting::ScriptManager::onStatusTick( Entity::ActorPtr pActor, Core
|
|||
pActor->getAsPlayer()->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Actor&,
|
||||
Core::StatusEffect::StatusEffect& ) > >( eventName );
|
||||
StatusEffect::StatusEffect& ) > >( eventName );
|
||||
fn( obj, *pActor, effect );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include <mutex>
|
||||
#include <set>
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include "../Forwards.h"
|
||||
#include <Server_Common/Common.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
namespace chaiscript
|
||||
|
@ -37,20 +37,20 @@ namespace Core
|
|||
|
||||
const boost::shared_ptr< chaiscript::ChaiScript >& getHandler() const;
|
||||
|
||||
void onPlayerFirstEnterWorld( Entity::PlayerPtr pPlayer );
|
||||
void onPlayerFirstEnterWorld( Entity::Player& player );
|
||||
|
||||
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 onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId );
|
||||
bool onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
||||
bool onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
bool onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
bool onEmote( Entity::Player& player, uint64_t actorId, uint32_t eventId, uint8_t emoteId );
|
||||
bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId );
|
||||
|
||||
bool onMobKill( Entity::PlayerPtr pPlayer, uint16_t nameId );
|
||||
bool onMobKill( Entity::Player& player, uint16_t nameId );
|
||||
|
||||
bool onCastFinish( Entity::PlayerPtr pPlayer, Entity::ActorPtr pTarget, uint32_t actionId );
|
||||
bool onCastFinish( Entity::Player& pPlayer, Entity::ActorPtr pTarget, uint32_t actionId );
|
||||
|
||||
bool onStatusReceive( Entity::ActorPtr pActor, uint32_t effectId );
|
||||
bool onStatusTick( Entity::ActorPtr pActor, Core::StatusEffect::StatusEffect& effect );
|
||||
|
@ -58,8 +58,8 @@ namespace Core
|
|||
|
||||
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 );
|
||||
bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1, uint16_t param2, uint16_t param3 );
|
||||
bool onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );
|
||||
|
||||
|
||||
void loadDir( std::string dirname, std::set<std::string>& chaiFiles );
|
||||
|
|
|
@ -4,18 +4,17 @@
|
|||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Script/ChaiscriptStdLib.h>
|
||||
|
||||
#include "src/servers/Server_Zone/ServerZone.h"
|
||||
#include "ServerZone.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Zone/Zone.h"
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Actor/BattleNpc.h"
|
||||
#include "src/servers/Server_Zone/Event/Event.h"
|
||||
#include "src/servers/Server_Zone/Event/EventHelper.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
#include "Event/Event.h"
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "StatusEffect/StatusEffect.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "ServerZone.h"
|
||||
|
||||
#include <src/servers/Server_Common/Version.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Config/XMLConfig.h>
|
||||
#include <src/servers/Server_Common/Version.h>
|
||||
#include <Server_Common/Version.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Config/XMLConfig.h>
|
||||
#include <Server_Common/Version.h>
|
||||
|
||||
#include <MySqlBase.h>
|
||||
#include <Connection.h>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef __GAMESERVER_H
|
||||
#define __GAMESERVER_H
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "src/servers/Server_Zone/Actor/BattleNpcTemplate.h"
|
||||
#include "Actor/BattleNpcTemplate.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <time.h>
|
||||
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include "src/servers/Server_Zone/Network/GameConnection.h"
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Session.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "Actor/Player.h"
|
||||
|
||||
Core::Session::Session( uint32_t sessionId )
|
||||
: m_sessionId( sessionId )
|
||||
|
@ -23,13 +23,13 @@ Core::Session::~Session()
|
|||
{
|
||||
}
|
||||
|
||||
void Core::Session::setZoneConnection( Core::Network::GameConnectionPtr pZoneCon )
|
||||
void Core::Session::setZoneConnection( Network::GameConnectionPtr pZoneCon )
|
||||
{
|
||||
pZoneCon->m_conType = Network::ConnectionType::Zone;
|
||||
m_pZoneConnection = pZoneCon;
|
||||
}
|
||||
|
||||
void Core::Session::setChatConnection( Core::Network::GameConnectionPtr pChatCon )
|
||||
void Core::Session::setChatConnection( Network::GameConnectionPtr pChatCon )
|
||||
{
|
||||
pChatCon->m_conType = Network::ConnectionType::Chat;
|
||||
m_pChatConnection = pChatCon;
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
||||
class Session : public boost::enable_shared_from_this< Session >
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
#include "src/servers/Server_Zone/Actor/Actor.h"
|
||||
#include "Actor/Actor.h"
|
||||
|
||||
#include "StatusEffect.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
#include "Cell.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 "Actor/Actor.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
#include "Forwards.h"
|
||||
#include "Zone.h"
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
#include <set>
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -1,36 +1,35 @@
|
|||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacket.h>
|
||||
#include <src/servers/Server_Common/Network/GamePacketNew.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Network/CommonNetwork.h>
|
||||
#include <src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <src/servers/Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Logging/Logger.h>
|
||||
#include <Server_Common/Util/Util.h>
|
||||
#include <Server_Common/Util/UtilMath.h>
|
||||
#include <Server_Common/Network/GamePacket.h>
|
||||
#include <Server_Common/Network/GamePacketNew.h>
|
||||
#include <Server_Common/Exd/ExdData.h>
|
||||
#include <Server_Common/Network/CommonNetwork.h>
|
||||
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Server_Common/Network/PacketContainer.h>
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
#include "Zone.h"
|
||||
#include "ZoneMgr.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 "Session.h"
|
||||
#include "Actor/Actor.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "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 "Network/GameConnection.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Script/ScriptManager.h"
|
||||
|
||||
#include "CellHandler.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
||||
extern Core::Logger g_log;
|
||||
extern Core::ServerZone g_serverZone;
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
@ -180,16 +179,10 @@ void Zone::loadCellCache()
|
|||
pos.x = posX;
|
||||
pos.y = posY;
|
||||
pos.z = posZ;
|
||||
Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( modelId, nameId,
|
||||
pos,
|
||||
Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( modelId, nameId, pos,
|
||||
sizeId, type, level, behaviour, mobType ) );
|
||||
pBNpc->setRotation( static_cast< float >( rotation ) );
|
||||
cache.push_back( pBNpc );
|
||||
|
||||
//pushActor( pBNpc );
|
||||
|
||||
//m_zonePositionMap[id] = ZonePositionPtr( new ZonePosition( id, targetZoneId, Position( posX, posY, posZ, posO ), radius ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,9 +283,6 @@ void Zone::pushActor( Entity::ActorPtr pActor )
|
|||
g_log.debug( "[Zone:" + m_zoneCode + "] Adding player [" + std::to_string( pActor->getId() ) + "]" );
|
||||
auto pPlayer = pActor->getAsPlayer();
|
||||
|
||||
// fire the onEnter Lua event
|
||||
//LuaManager->onRegionEnter(this, pPlayer);
|
||||
|
||||
auto pSession = g_serverZone.getSession( pPlayer->getId() );
|
||||
if( pSession )
|
||||
m_sessionSet.insert( pSession );
|
||||
|
@ -343,7 +333,7 @@ void Zone::removeActor( Entity::ActorPtr pActor )
|
|||
{
|
||||
Entity::ActorPtr pCurAct;
|
||||
|
||||
for( auto iter = pActor->m_inRangeActors.begin(); iter != pActor->m_inRangeActors.end();)
|
||||
for( auto iter = pActor->m_inRangeActors.begin(); iter != pActor->m_inRangeActors.end(); )
|
||||
{
|
||||
pCurAct = *iter;
|
||||
auto iter2 = iter++;
|
||||
|
@ -354,21 +344,21 @@ void Zone::removeActor( Entity::ActorPtr pActor )
|
|||
|
||||
}
|
||||
|
||||
void Zone::queueOutPacketForRange( Entity::PlayerPtr pSourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry )
|
||||
void Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry )
|
||||
{
|
||||
for( auto it = m_playerMap.begin(); it != m_playerMap.end(); ++it )
|
||||
{
|
||||
float distance = Math::Util::distance( pSourcePlayer->getPos().x,
|
||||
pSourcePlayer->getPos().y,
|
||||
pSourcePlayer->getPos().z,
|
||||
float distance = Math::Util::distance( sourcePlayer.getPos().x,
|
||||
sourcePlayer.getPos().y,
|
||||
sourcePlayer.getPos().z,
|
||||
( *it ).second->getPos().x,
|
||||
( *it ).second->getPos().y,
|
||||
( *it ).second->getPos().z );
|
||||
|
||||
if( ( distance < range ) && pSourcePlayer->getId() != ( *it ).second->getId() )
|
||||
if( ( distance < range ) && sourcePlayer.getId() != ( *it ).second->getId() )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( ( *it ).second->getId() );
|
||||
pPacketEntry->setValAt<uint32_t>( 0x08, ( *it ).second->getId() );
|
||||
pPacketEntry->setValAt< uint32_t >( 0x08, ( *it ).second->getId() );
|
||||
if( pSession )
|
||||
pSession->getZoneConnection()->queueOutPacket( pPacketEntry );
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
#define _ZONE_H
|
||||
|
||||
#include <unordered_map>
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
#include "Cell.h"
|
||||
#include "CellHandler.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
#include <set>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
|
@ -15,11 +15,10 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
namespace Core {
|
||||
|
||||
namespace Entity
|
||||
{
|
||||
class Actor;
|
||||
class Player;
|
||||
class Actor;
|
||||
class Player;
|
||||
}
|
||||
|
||||
class Session;
|
||||
|
@ -39,8 +38,8 @@ protected:
|
|||
|
||||
bool m_bPrivate;
|
||||
|
||||
std::unordered_map<int32_t, Entity::PlayerPtr > m_playerMap;
|
||||
std::unordered_map<int32_t, Entity::BattleNpcPtr > m_BattleNpcMap;
|
||||
std::unordered_map< int32_t, Entity::PlayerPtr > m_playerMap;
|
||||
std::unordered_map< int32_t, Entity::BattleNpcPtr > m_BattleNpcMap;
|
||||
|
||||
std::set< Entity::BattleNpcPtr > m_BattleNpcDeadMap;
|
||||
|
||||
|
@ -90,7 +89,7 @@ public:
|
|||
|
||||
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
||||
|
||||
void queueOutPacketForRange( Entity::PlayerPtr pSourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry );
|
||||
void queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry );
|
||||
|
||||
virtual uint32_t getId();
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "ZoneMgr.h"
|
||||
#include "Zone.h"
|
||||
|
||||
#include "ZonePosition.h"
|
||||
|
||||
#include <Server_Common/Database/DatabaseDef.h>
|
||||
|
@ -65,51 +64,6 @@ namespace Core {
|
|||
m_zoneMap[info.id] = pZone;
|
||||
}
|
||||
|
||||
//do
|
||||
//{
|
||||
// Db::Field *field = pQR->fetch();
|
||||
// uint16_t id = field[0].getUInt16();
|
||||
// std::string inName = field[1].getString();
|
||||
// std::string name = field[2].getString();
|
||||
// uint32_t layoutId = field[3].getUInt32();
|
||||
// bool isPrivate = field[4].getBool();
|
||||
|
||||
// if(!isPrivate)
|
||||
// {
|
||||
// g_log.Log(LoggingSeverity::info, std::to_string(id) + "\t" + inName + " - " + name);
|
||||
|
||||
// ZonePtr pZone( new Zone( id, layoutId, name, inName, isPrivate ) );
|
||||
|
||||
// m_zoneMap[id] = pZone;
|
||||
|
||||
// // start the region worker
|
||||
// // ThreadPool->executeTask(pRegion);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //Console->outTime(" --> %s", inName.c_str());
|
||||
// //Console->outTime("\tCached private instance...", name.c_str());
|
||||
|
||||
// //// write the instance data into the instance cache for later use
|
||||
// //InstanceCacheEntry * pICE = new InstanceCacheEntry();
|
||||
// //pICE->id = id;
|
||||
// //pICE->inName = inName;
|
||||
// //pICE->minX = minX;
|
||||
// //pICE->maxX = maxX;
|
||||
// //pICE->minY = minY;
|
||||
// //pICE->maxY = maxY;
|
||||
// //pICE->name = name;
|
||||
// //pICE->layoutId = layoutId;
|
||||
// //pICE->isPrivate = isPrivate;
|
||||
|
||||
// //m_instanceCache[pICE->id] = pICE;
|
||||
// //m_instanceCacheName[inName] = pICE;
|
||||
|
||||
// //createInstance(pICE);
|
||||
// }
|
||||
|
||||
//} while(pQR->nextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Core::ZonePosition::ZonePosition()
|
|||
{
|
||||
}
|
||||
|
||||
Core::ZonePosition::ZonePosition( uint32_t id, uint32_t targetZoneId, const Core::Common::FFXIVARR_POSITION3& targetPosition, uint32_t radius, float rotation )
|
||||
Core::ZonePosition::ZonePosition( uint32_t id, uint32_t targetZoneId, const Common::FFXIVARR_POSITION3& targetPosition, uint32_t radius, float rotation )
|
||||
{
|
||||
m_id = id;
|
||||
m_targetZoneId = targetZoneId;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _ZONELINE_H
|
||||
#define _ZONELINE_H
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <Server_Common/Common.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue