mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 08:07:46 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d694cbfcf5
14 changed files with 977 additions and 1642 deletions
|
@ -699,6 +699,8 @@ namespace Core {
|
||||||
DeathAnimation = 0x0E,
|
DeathAnimation = 0x0E,
|
||||||
CastInterrupt = 0x0F,
|
CastInterrupt = 0x0F,
|
||||||
|
|
||||||
|
ActionStart = 0x11,
|
||||||
|
|
||||||
StatusEffectGain = 0x14,
|
StatusEffectGain = 0x14,
|
||||||
StatusEffectLose = 0x15,
|
StatusEffectLose = 0x15,
|
||||||
|
|
||||||
|
|
204
src/servers/Server_Zone/ActionHandler.cpp
Normal file
204
src/servers/Server_Zone/ActionHandler.cpp
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
#include <Server_Common/Common.h>
|
||||||
|
#include <Server_Common/CommonNetwork.h>
|
||||||
|
#include <Server_Common/Database.h>
|
||||||
|
#include <Server_Common/GamePacketNew.h>
|
||||||
|
#include <Server_Common/Logger.h>
|
||||||
|
#include <Server_Common/ExdData.h>
|
||||||
|
#include <Server_Common/PacketContainer.h>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameConnection.h"
|
||||||
|
|
||||||
|
#include "Session.h"
|
||||||
|
#include "Zone.h"
|
||||||
|
#include "ZonePosition.h"
|
||||||
|
#include "ServerZone.h"
|
||||||
|
#include "ZoneMgr.h"
|
||||||
|
|
||||||
|
#include "InitUIPacket.h"
|
||||||
|
#include "PingPacket.h"
|
||||||
|
#include "MoveActorPacket.h"
|
||||||
|
#include "ChatPacket.h"
|
||||||
|
#include "ServerNoticePacket.h"
|
||||||
|
#include "ActorControlPacket142.h"
|
||||||
|
#include "ActorControlPacket143.h"
|
||||||
|
#include "ActorControlPacket144.h"
|
||||||
|
#include "EventStartPacket.h"
|
||||||
|
#include "EventFinishPacket.h"
|
||||||
|
#include "PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameCommandHandler.h"
|
||||||
|
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Inventory.h"
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
#include "EventHelper.h"
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "ActionTeleport.h"
|
||||||
|
|
||||||
|
extern Core::Logger g_log;
|
||||||
|
extern Core::Db::Database g_database;
|
||||||
|
extern Core::ServerZone g_serverZone;
|
||||||
|
extern Core::ZoneMgr g_zoneMgr;
|
||||||
|
extern Core::Data::ExdData g_exdData;
|
||||||
|
extern Core::GameCommandHandler g_gameCommandMgr;
|
||||||
|
|
||||||
|
using namespace Core::Common;
|
||||||
|
using namespace Core::Network::Packets;
|
||||||
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
|
{
|
||||||
|
uint16_t commandId = pInPacket->getValAt< uint16_t >( 0x20 );
|
||||||
|
uint64_t param1 = pInPacket->getValAt< uint64_t >( 0x24 );
|
||||||
|
uint32_t param11 = pInPacket->getValAt< uint32_t >( 0x24 );
|
||||||
|
uint32_t param12 = pInPacket->getValAt< uint32_t >( 0x28 );
|
||||||
|
uint32_t param2 = pInPacket->getValAt< uint32_t >( 0x2c );
|
||||||
|
uint64_t param3 = pInPacket->getValAt< uint64_t >( 0x38 );
|
||||||
|
|
||||||
|
g_log.debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
|
||||||
|
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) +
|
||||||
|
"\nparam1: " + boost::str( boost::format( "%|016X|" ) % ( uint64_t ) ( param1 & 0xFFFFFFFFFFFFFFF ) ) +
|
||||||
|
"\nparam2: " + boost::str( boost::format( "%|08X|" ) % ( uint32_t ) ( param2 & 0xFFFFFFFF ) ) +
|
||||||
|
"\nparam3: " + boost::str( boost::format( "%|016X|" ) % ( uint64_t ) ( param3 & 0xFFFFFFFFFFFFFFF ) )
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//g_log.Log(LoggingSeverity::debug, "[" + std::to_string(m_pSession->getId()) + "] " + pInPacket->toString());
|
||||||
|
|
||||||
|
switch( commandId )
|
||||||
|
{
|
||||||
|
case 0x01: // Toggle sheathe
|
||||||
|
{
|
||||||
|
if ( param11 == 1 )
|
||||||
|
pPlayer->setStance( Entity::Actor::Stance::Active );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pPlayer->setStance( Entity::Actor::Stance::Passive );
|
||||||
|
pPlayer->setAutoattack( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 0, param11, 1 ) );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x02: // Toggle auto-attack
|
||||||
|
{
|
||||||
|
if ( param11 == 1 )
|
||||||
|
{
|
||||||
|
pPlayer->setAutoattack( true );
|
||||||
|
pPlayer->setStance( Entity::Actor::Stance::Active );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pPlayer->setAutoattack( false );
|
||||||
|
|
||||||
|
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 1, param11, 1 ) );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x03: // Change target
|
||||||
|
{
|
||||||
|
|
||||||
|
uint64_t targetId = pInPacket->getValAt< uint64_t >( 0x24 );
|
||||||
|
pPlayer->changeTarget( targetId );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x133: // Update howtos seen
|
||||||
|
{
|
||||||
|
uint32_t howToId = static_cast< uint32_t >( param1 );
|
||||||
|
pPlayer->updateHowtosSeen( howToId );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x1F4: // emote
|
||||||
|
{
|
||||||
|
uint64_t targetId = pPlayer->getTargetId();
|
||||||
|
uint32_t emoteId = pInPacket->getValAt< uint32_t >( 0x24 );
|
||||||
|
|
||||||
|
pPlayer->sendToInRangeSet( ActorControlPacket144( pPlayer->getId(), Emote, emoteId, 0, 0, 0, targetId ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xC8: // return dead
|
||||||
|
{
|
||||||
|
pPlayer->returnToHomepoint();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xC9: // Finish zoning
|
||||||
|
{
|
||||||
|
switch( pPlayer->getZoningType() )
|
||||||
|
{
|
||||||
|
case ZoneingType::None:
|
||||||
|
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01 ), true );
|
||||||
|
break;
|
||||||
|
case ZoneingType::Teleport:
|
||||||
|
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||||
|
break;
|
||||||
|
case ZoneingType::Return:
|
||||||
|
case ZoneingType::ReturnDead:
|
||||||
|
{
|
||||||
|
if( pPlayer->getStatus() == Entity::Actor::ActorStatus::Dead )
|
||||||
|
{
|
||||||
|
pPlayer->resetHp();
|
||||||
|
pPlayer->resetMp();
|
||||||
|
pPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||||
|
pPlayer->setSyncFlag( Status );
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ZoneingType::FadeIn:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPlayer->setZoningType( Common::ZoneingType::None );
|
||||||
|
|
||||||
|
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||||
|
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
|
||||||
|
pPlayer->sendStateFlags();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0xCA: // Teleport
|
||||||
|
{
|
||||||
|
// TODO: only register this action if enough gil is in possession
|
||||||
|
auto targetAetheryte = g_exdData.getAetheryteInfo( param11 );
|
||||||
|
|
||||||
|
if( targetAetheryte )
|
||||||
|
{
|
||||||
|
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index );
|
||||||
|
|
||||||
|
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
||||||
|
auto cost = ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) +
|
||||||
|
pow( fromAetheryte->map_coord_y - targetAetheryte->map_coord_y, 2 ) ) / 2 ) + 100;
|
||||||
|
|
||||||
|
// cap at 999 gil
|
||||||
|
cost = cost > 999 ? 999 : cost;
|
||||||
|
|
||||||
|
bool insufficientGil = pPlayer->getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
||||||
|
// todo: figure out what param1 really does
|
||||||
|
pPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), TeleportStart, insufficientGil ? 2 : 0, param11 ) );
|
||||||
|
|
||||||
|
if( !insufficientGil )
|
||||||
|
{
|
||||||
|
Action::ActionTeleportPtr pActionTeleport( new Action::ActionTeleport( pPlayer, param11, cost ) );
|
||||||
|
pPlayer->setCurrentAction( pActionTeleport );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
102
src/servers/Server_Zone/CFHandlers.cpp
Normal file
102
src/servers/Server_Zone/CFHandlers.cpp
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
#include <Server_Common/Common.h>
|
||||||
|
#include <Server_Common/CommonNetwork.h>
|
||||||
|
#include <Server_Common/Database.h>
|
||||||
|
#include <Server_Common/GamePacketNew.h>
|
||||||
|
#include <Server_Common/Logger.h>
|
||||||
|
#include <Server_Common/ExdData.h>
|
||||||
|
#include <Server_Common/PacketContainer.h>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameConnection.h"
|
||||||
|
|
||||||
|
#include "Session.h"
|
||||||
|
#include "Zone.h"
|
||||||
|
#include "ZonePosition.h"
|
||||||
|
#include "ServerZone.h"
|
||||||
|
#include "ZoneMgr.h"
|
||||||
|
|
||||||
|
#include "InitUIPacket.h"
|
||||||
|
#include "PingPacket.h"
|
||||||
|
#include "MoveActorPacket.h"
|
||||||
|
#include "ChatPacket.h"
|
||||||
|
#include "ServerNoticePacket.h"
|
||||||
|
#include "ActorControlPacket142.h"
|
||||||
|
#include "ActorControlPacket143.h"
|
||||||
|
#include "ActorControlPacket144.h"
|
||||||
|
#include "EventStartPacket.h"
|
||||||
|
#include "EventFinishPacket.h"
|
||||||
|
#include "PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameCommandHandler.h"
|
||||||
|
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Inventory.h"
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
#include "EventHelper.h"
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "ActionTeleport.h"
|
||||||
|
|
||||||
|
extern Core::Logger g_log;
|
||||||
|
extern Core::Db::Database g_database;
|
||||||
|
extern Core::ServerZone g_serverZone;
|
||||||
|
extern Core::ZoneMgr g_zoneMgr;
|
||||||
|
extern Core::Data::ExdData g_exdData;
|
||||||
|
extern Core::GameCommandHandler g_gameCommandMgr;
|
||||||
|
|
||||||
|
using namespace Core::Common;
|
||||||
|
using namespace Core::Network::Packets;
|
||||||
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::cfDutyInfoRequest(Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer)
|
||||||
|
{
|
||||||
|
GamePacketNew< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
|
||||||
|
queueOutPacket( dutyInfoPacket );
|
||||||
|
|
||||||
|
GamePacketNew< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
|
||||||
|
queueOutPacket( inNeedsPacket );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::cfRegisterDuty(Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer)
|
||||||
|
{
|
||||||
|
// TODO use for loop for this
|
||||||
|
auto contentId1 = pInPacket->getValAt< uint16_t >( 46 );
|
||||||
|
auto contentId2 = pInPacket->getValAt< uint16_t >( 48 );
|
||||||
|
auto contentId3 = pInPacket->getValAt< uint16_t >( 50 );
|
||||||
|
auto contentId4 = pInPacket->getValAt< uint16_t >( 52 );
|
||||||
|
auto contentId5 = pInPacket->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));
|
||||||
|
|
||||||
|
// let's cancel it because otherwise you can't register it again
|
||||||
|
GamePacketNew< FFXIVIpcCFNotify > cfCancelPacket( pPlayer->getId() );
|
||||||
|
cfCancelPacket.data().state1 = 3;
|
||||||
|
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
||||||
|
queueOutPacket( cfCancelPacket );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::cfRegisterRoulette(Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer)
|
||||||
|
{
|
||||||
|
pPlayer->sendDebug("Roulette register");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::cfDutyAccepted(Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer)
|
||||||
|
{
|
||||||
|
pPlayer->sendDebug("TODO: Duty accept");
|
||||||
|
}
|
|
@ -1,561 +0,0 @@
|
||||||
#include "CharaPc.h"
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getClass() const
|
|
||||||
{
|
|
||||||
return m_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setClass( uint8_t class_ )
|
|
||||||
{
|
|
||||||
m_class = class_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Core::Entity::CharaDetail::getBIsNewGame() const
|
|
||||||
{
|
|
||||||
return m_bIsNewGame;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBIsNewGame( bool isNewGame )
|
|
||||||
{
|
|
||||||
m_bIsNewGame = isNewGame;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getMakeValid() const
|
|
||||||
{
|
|
||||||
return m_makeValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setMakeValid( uint8_t makeValid )
|
|
||||||
{
|
|
||||||
m_makeValid = makeValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getLegacyEmployEnable() const
|
|
||||||
{
|
|
||||||
return m_legacyEmployEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLegacyEmployEnable( uint8_t legacyEmployEnable )
|
|
||||||
{
|
|
||||||
m_legacyEmployEnable = legacyEmployEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getLegacyCompleteFlag() const
|
|
||||||
{
|
|
||||||
return m_legacyCompleteFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLegacyCompleteFlag( uint8_t legacyCompleteFlag )
|
|
||||||
{
|
|
||||||
m_legacyCompleteFlag = legacyCompleteFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getRemakeFlag() const
|
|
||||||
{
|
|
||||||
return m_remakeFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setRemakeFlag( uint32_t remakeFlag )
|
|
||||||
{
|
|
||||||
m_remakeFlag = remakeFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getTotalPlayTime() const
|
|
||||||
{
|
|
||||||
return m_totalPlayTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setTotalPlayTime( uint32_t totalPlayTime )
|
|
||||||
{
|
|
||||||
m_totalPlayTime = totalPlayTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Core::Entity::CharaDetail::getTotalPlayTimeSecond() const
|
|
||||||
{
|
|
||||||
return m_totalPlayTimeSecond;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setTotalPlayTimeSecond( float totalPlayTimeSecond )
|
|
||||||
{
|
|
||||||
m_totalPlayTimeSecond = totalPlayTimeSecond;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getInvisible() const
|
|
||||||
{
|
|
||||||
return m_invisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setInvisible( uint8_t invisible )
|
|
||||||
{
|
|
||||||
m_invisible = invisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getFirstClass() const
|
|
||||||
{
|
|
||||||
return m_firstClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setFirstClass( uint8_t firstClass )
|
|
||||||
{
|
|
||||||
m_firstClass = firstClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getHomePoint() const
|
|
||||||
{
|
|
||||||
return m_homePoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setHomePoint( uint8_t homePoint )
|
|
||||||
{
|
|
||||||
m_homePoint = homePoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getRestPoint() const
|
|
||||||
{
|
|
||||||
return m_restPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setRestPoint( uint32_t restPoint )
|
|
||||||
{
|
|
||||||
m_restPoint = restPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Core::Entity::CharaDetail::getRentalTimer() const
|
|
||||||
{
|
|
||||||
return m_rentalTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setRentalTimer( float rentalTimer )
|
|
||||||
{
|
|
||||||
m_rentalTimer = rentalTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Core::Entity::CharaDetail::getBuddyUpdateTimer() const
|
|
||||||
{
|
|
||||||
return m_buddyUpdateTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyUpdateTimer( float buddyUpdateTimer )
|
|
||||||
{
|
|
||||||
m_buddyUpdateTimer = buddyUpdateTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Core::Entity::CharaDetail::getBuddyTimer() const
|
|
||||||
{
|
|
||||||
return m_buddyTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyTimer( float buddyTimer )
|
|
||||||
{
|
|
||||||
m_buddyTimer = buddyTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getBuddyRank() const
|
|
||||||
{
|
|
||||||
return m_buddyRank;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyRank( uint8_t buddyRank )
|
|
||||||
{
|
|
||||||
m_buddyRank = buddyRank;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getBuddyAdditionSkillPoint() const
|
|
||||||
{
|
|
||||||
return m_buddyAdditionSkillPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyAdditionSkillPoint( uint8_t buddyAdditionSkillPoint )
|
|
||||||
{
|
|
||||||
m_buddyAdditionSkillPoint = buddyAdditionSkillPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getBuddyExp() const
|
|
||||||
{
|
|
||||||
return m_buddyExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyExp( uint32_t buddyExp )
|
|
||||||
{
|
|
||||||
m_buddyExp = buddyExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getBuddyCommand() const
|
|
||||||
{
|
|
||||||
return m_buddyCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyCommand( uint32_t buddyCommand )
|
|
||||||
{
|
|
||||||
m_buddyCommand = buddyCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getBuddyHp() const
|
|
||||||
{
|
|
||||||
return m_buddyHp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBuddyHp( uint32_t buddyHp )
|
|
||||||
{
|
|
||||||
m_buddyHp = buddyHp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getGuardianDeity() const
|
|
||||||
{
|
|
||||||
return m_guardianDeity;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGuardianDeity( uint8_t guardianDeity )
|
|
||||||
{
|
|
||||||
m_guardianDeity = guardianDeity;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getBirthMonth() const
|
|
||||||
{
|
|
||||||
return m_birthMonth;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBirthMonth( uint8_t birthMonth )
|
|
||||||
{
|
|
||||||
m_birthMonth = birthMonth;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getBirthday() const
|
|
||||||
{
|
|
||||||
return m_birthday;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setBirthday( uint8_t birthday )
|
|
||||||
{
|
|
||||||
m_birthday = birthday;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getStartTown() const
|
|
||||||
{
|
|
||||||
return m_startTown;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setStartTown( uint8_t startTown )
|
|
||||||
{
|
|
||||||
m_startTown = startTown;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getActiveTitle() const
|
|
||||||
{
|
|
||||||
return m_activeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setActiveTitle( uint16_t activeTitle )
|
|
||||||
{
|
|
||||||
m_activeTitle = activeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getEquippedMannequin() const
|
|
||||||
{
|
|
||||||
return m_equippedMannequin;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setEquippedMannequin( uint16_t equippedMannequin )
|
|
||||||
{
|
|
||||||
m_equippedMannequin = equippedMannequin;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getTomeStoneCounter() const
|
|
||||||
{
|
|
||||||
return m_tomeStoneCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setTomeStoneCounter( uint32_t tomeStoneCounter )
|
|
||||||
{
|
|
||||||
m_tomeStoneCounter = tomeStoneCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Core::Entity::CharaDetail::getTomeStomeTimer() const
|
|
||||||
{
|
|
||||||
return m_tomeStomeTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setTomeStomeTimer( float tomeStomeTimer )
|
|
||||||
{
|
|
||||||
m_tomeStomeTimer = tomeStomeTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getConfigFlags() const
|
|
||||||
{
|
|
||||||
return m_configFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setConfigFlags( uint16_t configFlags )
|
|
||||||
{
|
|
||||||
m_configFlags = configFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getGmIcon() const
|
|
||||||
{
|
|
||||||
return m_gmIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGmIcon( uint8_t gmIcon )
|
|
||||||
{
|
|
||||||
m_gmIcon = gmIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getGmBind() const
|
|
||||||
{
|
|
||||||
return m_gmBind;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGmBind( uint8_t gmBind )
|
|
||||||
{
|
|
||||||
m_gmBind = gmBind;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getCatchCount() const
|
|
||||||
{
|
|
||||||
return m_catchCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setCatchCount( uint32_t catchCount )
|
|
||||||
{
|
|
||||||
m_catchCount = catchCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getUseBaitCatalogId() const
|
|
||||||
{
|
|
||||||
return m_useBaitCatalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setUseBaitCatalogId( uint32_t useBaitCatalogId )
|
|
||||||
{
|
|
||||||
m_useBaitCatalogId = useBaitCatalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getOpeningSequence() const
|
|
||||||
{
|
|
||||||
return m_openingSequence;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setOpeningSequence( uint8_t openingSequence )
|
|
||||||
{
|
|
||||||
m_openingSequence = openingSequence;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getLeveTicketNum() const
|
|
||||||
{
|
|
||||||
return m_leveTicketNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLeveTicketNum( uint8_t leveTicketNum )
|
|
||||||
{
|
|
||||||
m_leveTicketNum = leveTicketNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getLeveTicketLastGetTime() const
|
|
||||||
{
|
|
||||||
return m_leveTicketLastGetTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLeveTicketLastGetTime( uint32_t leveTicketLastGetTime )
|
|
||||||
{
|
|
||||||
m_leveTicketLastGetTime = leveTicketLastGetTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getLeveAssignmentSeed() const
|
|
||||||
{
|
|
||||||
return m_leveAssignmentSeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLeveAssignmentSeed( uint16_t leveAssignmentSeed )
|
|
||||||
{
|
|
||||||
m_leveAssignmentSeed = leveAssignmentSeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getLeveAssignmentCount() const
|
|
||||||
{
|
|
||||||
return m_leveAssignmentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLeveAssignmentCount( uint8_t leveAssignmentCount )
|
|
||||||
{
|
|
||||||
m_leveAssignmentCount = leveAssignmentCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getGuildleveFactionCreditBr() const
|
|
||||||
{
|
|
||||||
return m_guildleveFactionCreditBr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGuildleveFactionCreditBr( uint16_t guildleveFactionCreditBr )
|
|
||||||
{
|
|
||||||
m_guildleveFactionCreditBr = guildleveFactionCreditBr;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getGuildleveFactionCreditAz() const
|
|
||||||
{
|
|
||||||
return m_guildleveFactionCreditAz;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGuildleveFactionCreditAz( uint16_t guildleveFactionCreditAz )
|
|
||||||
{
|
|
||||||
m_guildleveFactionCreditAz = guildleveFactionCreditAz;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getGuildleveFactionCreditHo() const
|
|
||||||
{
|
|
||||||
return m_guildleveFactionCreditHo;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGuildleveFactionCreditHo( uint16_t guildleveFactionCreditHo )
|
|
||||||
{
|
|
||||||
m_guildleveFactionCreditHo = guildleveFactionCreditHo;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getGrandCompany() const
|
|
||||||
{
|
|
||||||
return m_grandCompany;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGrandCompany( uint8_t grandCompany )
|
|
||||||
{
|
|
||||||
m_grandCompany = grandCompany;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getGearsetMaxNum() const
|
|
||||||
{
|
|
||||||
return m_gearsetMaxNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGearsetMaxNum( uint8_t gearsetMaxNum )
|
|
||||||
{
|
|
||||||
m_gearsetMaxNum = gearsetMaxNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getContentJoinTime() const
|
|
||||||
{
|
|
||||||
return m_contentJoinTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setContentJoinTime( uint32_t contentJoinTime )
|
|
||||||
{
|
|
||||||
m_contentJoinTime = contentJoinTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getPathId() const
|
|
||||||
{
|
|
||||||
return m_pathId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setPathId( uint32_t pathId )
|
|
||||||
{
|
|
||||||
m_pathId = pathId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getStepIndex() const
|
|
||||||
{
|
|
||||||
return m_stepIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setStepIndex( uint16_t stepIndex )
|
|
||||||
{
|
|
||||||
m_stepIndex = stepIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getPathIdBackUp() const
|
|
||||||
{
|
|
||||||
return m_pathIdBackUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setPathIdBackUp( uint32_t pathIdBackUp )
|
|
||||||
{
|
|
||||||
m_pathIdBackUp = pathIdBackUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getStepIndexBackUp() const
|
|
||||||
{
|
|
||||||
return m_stepIndexBackUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setStepIndexBackUp( uint16_t stepIndexBackUp )
|
|
||||||
{
|
|
||||||
m_stepIndexBackUp = stepIndexBackUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getGcSupplySeed() const
|
|
||||||
{
|
|
||||||
return m_gcSupplySeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGcSupplySeed( uint8_t gcSupplySeed )
|
|
||||||
{
|
|
||||||
m_gcSupplySeed = gcSupplySeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getGcSupplyTime() const
|
|
||||||
{
|
|
||||||
return m_gcSupplyTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGcSupplyTime( uint32_t gcSupplyTime )
|
|
||||||
{
|
|
||||||
m_gcSupplyTime = gcSupplyTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Core::Entity::CharaDetail::getLayerSet() const
|
|
||||||
{
|
|
||||||
return m_layerSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setLayerSet( uint32_t layerSet )
|
|
||||||
{
|
|
||||||
m_layerSet = layerSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getGcChangeTime() const
|
|
||||||
{
|
|
||||||
return m_gcChangeTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setGcChangeTime( uint16_t gcChangeTime )
|
|
||||||
{
|
|
||||||
m_gcChangeTime = gcChangeTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getFateFlag() const
|
|
||||||
{
|
|
||||||
return m_fateFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setFateFlag( uint8_t fateFlag )
|
|
||||||
{
|
|
||||||
m_fateFlag = fateFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Core::Entity::CharaDetail::getContentRaidCounter() const
|
|
||||||
{
|
|
||||||
return m_contentRaidCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setContentRaidCounter( uint8_t contentRaidCounter )
|
|
||||||
{
|
|
||||||
m_contentRaidCounter = contentRaidCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Core::Entity::CharaDetail::getContentRaidTimer() const
|
|
||||||
{
|
|
||||||
return m_contentRaidTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setContentRaidTimer( uint16_t contentRaidTimer )
|
|
||||||
{
|
|
||||||
m_contentRaidTimer = contentRaidTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t Core::Entity::CharaDetail::getId() const
|
|
||||||
{
|
|
||||||
return m_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Entity::CharaDetail::setId( uint64_t id )
|
|
||||||
{
|
|
||||||
m_id = id;
|
|
||||||
}
|
|
|
@ -1,299 +0,0 @@
|
||||||
#ifndef _CHARA_H_
|
|
||||||
#define _CHARA_H_
|
|
||||||
|
|
||||||
#include <Server_Common/Common.h>
|
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
|
||||||
|
|
||||||
#include "Forwards.h"
|
|
||||||
#include <set>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace Core
|
|
||||||
{
|
|
||||||
namespace Entity
|
|
||||||
{
|
|
||||||
|
|
||||||
class CharaDetail
|
|
||||||
{
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// CHARAPC data ------------------------------------------------------------------------------------
|
|
||||||
uint8_t m_class;
|
|
||||||
bool m_bIsNewGame;
|
|
||||||
uint8_t m_makeValid;
|
|
||||||
|
|
||||||
struct RetainerInfo
|
|
||||||
{
|
|
||||||
uint32_t retainerId;
|
|
||||||
char retainerName[32];
|
|
||||||
uint32_t createUnixTime;
|
|
||||||
bool isActive;
|
|
||||||
bool isRename;
|
|
||||||
uint8_t status;
|
|
||||||
} m_retainerInfo[8];
|
|
||||||
|
|
||||||
uint8_t m_legacyEmployEnable;
|
|
||||||
char m_platform[32];
|
|
||||||
uint8_t m_legacyCompleteFlag;
|
|
||||||
uint32_t m_remakeFlag;
|
|
||||||
uint32_t m_totalPlayTime;
|
|
||||||
float m_totalPlayTimeSecond;
|
|
||||||
|
|
||||||
uint8_t m_invisible;
|
|
||||||
uint8_t m_firstClass;
|
|
||||||
uint8_t m_homePoint;
|
|
||||||
uint8_t m_favoritePoint[3];
|
|
||||||
|
|
||||||
uint32_t m_restPoint;
|
|
||||||
float m_rentalTimer;
|
|
||||||
float m_buddyUpdateTimer;
|
|
||||||
float m_buddyTimer;
|
|
||||||
char m_buddyName[21];
|
|
||||||
uint8_t m_possession[8];
|
|
||||||
uint8_t m_buddyEquip[3];
|
|
||||||
uint8_t m_buddyRank;
|
|
||||||
uint8_t m_buddyAdditionSkillPoint;
|
|
||||||
uint8_t m_buddySkillLine[3];
|
|
||||||
uint32_t m_buddyExp;
|
|
||||||
uint32_t m_buddyCommand;
|
|
||||||
uint32_t m_buddyHp;
|
|
||||||
|
|
||||||
uint8_t m_guardianDeity;
|
|
||||||
uint8_t m_birthMonth;
|
|
||||||
uint8_t m_birthday;
|
|
||||||
uint8_t m_startTown;
|
|
||||||
uint8_t m_mountList[11];
|
|
||||||
uint16_t m_activeTitle;
|
|
||||||
uint8_t m_titleList[32];
|
|
||||||
uint8_t m_reward[16];
|
|
||||||
|
|
||||||
struct HuntingLogInfo
|
|
||||||
{
|
|
||||||
uint8_t killCount[40];
|
|
||||||
uint64_t completeFlags;
|
|
||||||
uint8_t currentRank;
|
|
||||||
uint32_t isNewFlags;
|
|
||||||
} m_huntingLogInfo[10];
|
|
||||||
|
|
||||||
uint8_t m_aetheryteList[12];
|
|
||||||
|
|
||||||
uint8_t m_howTo[32];
|
|
||||||
uint8_t m_minions[32];
|
|
||||||
uint8_t m_cutScene[64];
|
|
||||||
uint16_t m_equippedMannequin;
|
|
||||||
uint32_t m_tomeStoneCounter;
|
|
||||||
float m_tomeStomeTimer;
|
|
||||||
|
|
||||||
uint16_t m_configFlags;
|
|
||||||
uint8_t m_gmIcon;
|
|
||||||
uint8_t m_gmBind;
|
|
||||||
|
|
||||||
uint32_t m_catchCount;
|
|
||||||
uint8_t m_isFishCaught[50];
|
|
||||||
uint8_t m_isSpotVisited[25];
|
|
||||||
uint8_t m_lastFishSize[36];
|
|
||||||
uint8_t m_lastFishId[36];
|
|
||||||
uint32_t m_useBaitCatalogId;
|
|
||||||
|
|
||||||
uint8_t m_gatheringHistoryPointId[8];
|
|
||||||
uint8_t m_gatheringDivisionOpenFlags[40];
|
|
||||||
uint8_t m_gatheringItemGetFlags[60];
|
|
||||||
|
|
||||||
uint8_t m_recipeDevisionOpenFlags[80];
|
|
||||||
uint8_t m_recipeCreateFlags[250];
|
|
||||||
|
|
||||||
uint8_t m_questCompleteFlags[200];
|
|
||||||
uint8_t m_legacyQuestCompleteFlags[40];
|
|
||||||
uint8_t m_legacyCompleteFlags[200];
|
|
||||||
|
|
||||||
struct LeveInfo
|
|
||||||
{
|
|
||||||
uint8_t leves[28];
|
|
||||||
} m_leveInfo[16];
|
|
||||||
|
|
||||||
uint8_t m_openingSequence;
|
|
||||||
|
|
||||||
// I really do not know what this is for
|
|
||||||
//`Type` TINYINT( 3 ) UNSIGNED,
|
|
||||||
//`Index` TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Type_0 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Index_0 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Type_1 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Index_1 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Type_2 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Index_2 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Type_3 TINYINT( 3 ) UNSIGNED,
|
|
||||||
//Index_3 TINYINT( 3 ) UNSIGNED,
|
|
||||||
|
|
||||||
uint8_t m_leveTicketNum;
|
|
||||||
uint32_t m_leveTicketLastGetTime;
|
|
||||||
uint16_t m_leveAssignmentSeed;
|
|
||||||
uint8_t m_leveAssignmentCount;
|
|
||||||
|
|
||||||
uint16_t m_guildleveFactionCreditBr;
|
|
||||||
uint16_t m_guildleveFactionCreditAz;
|
|
||||||
uint16_t m_guildleveFactionCreditHo;
|
|
||||||
|
|
||||||
uint8_t m_grandCompany;
|
|
||||||
uint8_t m_grandCompanyRank[3];
|
|
||||||
uint8_t m_gearsetMaxNum;
|
|
||||||
|
|
||||||
uint8_t m_discoveryWork[414];
|
|
||||||
|
|
||||||
uint32_t m_contentJoinTime;
|
|
||||||
uint8_t m_contentRaidClearFlags[28];
|
|
||||||
uint8_t m_contentDungeonClearFlags[18];
|
|
||||||
uint8_t m_contentGuildOrderClearFlags[10];
|
|
||||||
uint8_t m_contentBossBattleClearFlags[6];
|
|
||||||
uint8_t m_contentColosseumClearFlags[2];
|
|
||||||
uint8_t m_contentRaidAttainFlags[28];
|
|
||||||
uint8_t m_contentDungeonAttainFlag[18];
|
|
||||||
uint8_t m_contentGuildOrderAttainFlags[10];
|
|
||||||
uint8_t m_contentBossBattleAttainFlags[6];
|
|
||||||
uint8_t m_contentColosseumAttainFlags[2];
|
|
||||||
|
|
||||||
// related to currently active choco taxi??
|
|
||||||
uint32_t m_pathId;
|
|
||||||
uint16_t m_stepIndex;
|
|
||||||
uint32_t m_pathIdBackUp;
|
|
||||||
|
|
||||||
uint16_t m_stepIndexBackUp;
|
|
||||||
|
|
||||||
uint8_t m_chocoboTaxiStandFlags[8];
|
|
||||||
uint8_t m_companion[16];
|
|
||||||
|
|
||||||
uint8_t m_cabinet[32];
|
|
||||||
uint8_t m_contentFinderPenalties[2];
|
|
||||||
uint8_t m_gcSupplyItemFlags[4];
|
|
||||||
uint8_t m_gcSupplySeed;
|
|
||||||
uint32_t m_gcSupplyTime;
|
|
||||||
uint8_t m_gcSupplyClassLevel[11];
|
|
||||||
|
|
||||||
uint32_t m_layerSet;
|
|
||||||
uint8_t m_trophyAcquisitionFlags[8];
|
|
||||||
uint16_t m_gcChangeTime;
|
|
||||||
uint8_t m_fateFlag;
|
|
||||||
uint8_t m_contentRaidCounter;
|
|
||||||
uint16_t m_contentRaidTimer;
|
|
||||||
|
|
||||||
uint64_t m_id;
|
|
||||||
public:
|
|
||||||
uint8_t getClass() const;
|
|
||||||
void setClass( uint8_t class_ );
|
|
||||||
bool getBIsNewGame() const;
|
|
||||||
void setBIsNewGame( bool isNewGame );
|
|
||||||
uint8_t getMakeValid() const;
|
|
||||||
void setMakeValid( uint8_t makeValid );
|
|
||||||
uint8_t getLegacyEmployEnable() const;
|
|
||||||
void setLegacyEmployEnable( uint8_t legacyEmployEnable );
|
|
||||||
uint8_t getLegacyCompleteFlag() const;
|
|
||||||
void setLegacyCompleteFlag( uint8_t legacyCompleteFlag );
|
|
||||||
uint32_t getRemakeFlag() const;
|
|
||||||
void setRemakeFlag( uint32_t remakeFlag );
|
|
||||||
uint32_t getTotalPlayTime() const;
|
|
||||||
void setTotalPlayTime( uint32_t totalPlayTime );
|
|
||||||
float getTotalPlayTimeSecond() const;
|
|
||||||
void setTotalPlayTimeSecond( float totalPlayTimeSecond );
|
|
||||||
uint8_t getInvisible() const;
|
|
||||||
void setInvisible( uint8_t invisible );
|
|
||||||
uint8_t getFirstClass() const;
|
|
||||||
void setFirstClass( uint8_t firstClass );
|
|
||||||
uint8_t getHomePoint() const;
|
|
||||||
void setHomePoint( uint8_t homePoint );
|
|
||||||
uint32_t getRestPoint() const;
|
|
||||||
void setRestPoint( uint32_t restPoint );
|
|
||||||
float getRentalTimer() const;
|
|
||||||
void setRentalTimer( float rentalTimer );
|
|
||||||
float getBuddyUpdateTimer() const;
|
|
||||||
void setBuddyUpdateTimer( float buddyUpdateTimer );
|
|
||||||
float getBuddyTimer() const;
|
|
||||||
void setBuddyTimer( float buddyTimer );
|
|
||||||
uint8_t getBuddyRank() const;
|
|
||||||
void setBuddyRank( uint8_t buddyRank );
|
|
||||||
uint8_t getBuddyAdditionSkillPoint() const;
|
|
||||||
void setBuddyAdditionSkillPoint( uint8_t buddyAdditionSkillPoint );
|
|
||||||
uint32_t getBuddyExp() const;
|
|
||||||
void setBuddyExp( uint32_t buddyExp );
|
|
||||||
uint32_t getBuddyCommand() const;
|
|
||||||
void setBuddyCommand( uint32_t buddyCommand );
|
|
||||||
uint32_t getBuddyHp() const;
|
|
||||||
void setBuddyHp( uint32_t buddyHp );
|
|
||||||
uint8_t getGuardianDeity() const;
|
|
||||||
void setGuardianDeity( uint8_t guardianDeity );
|
|
||||||
uint8_t getBirthMonth() const;
|
|
||||||
void setBirthMonth( uint8_t birthMonth );
|
|
||||||
uint8_t getBirthday() const;
|
|
||||||
void setBirthday( uint8_t birthday );
|
|
||||||
uint8_t getStartTown() const;
|
|
||||||
void setStartTown( uint8_t startTown );
|
|
||||||
uint16_t getActiveTitle() const;
|
|
||||||
void setActiveTitle( uint16_t activeTitle );
|
|
||||||
uint16_t getEquippedMannequin() const;
|
|
||||||
void setEquippedMannequin( uint16_t equippedMannequin );
|
|
||||||
uint32_t getTomeStoneCounter() const;
|
|
||||||
void setTomeStoneCounter( uint32_t tomeStoneCounter );
|
|
||||||
float getTomeStomeTimer() const;
|
|
||||||
void setTomeStomeTimer( float tomeStomeTimer );
|
|
||||||
uint16_t getConfigFlags() const;
|
|
||||||
void setConfigFlags( uint16_t configFlags );
|
|
||||||
uint8_t getGmIcon() const;
|
|
||||||
void setGmIcon( uint8_t gmIcon );
|
|
||||||
uint8_t getGmBind() const;
|
|
||||||
void setGmBind( uint8_t gmBind );
|
|
||||||
uint32_t getCatchCount() const;
|
|
||||||
void setCatchCount( uint32_t catchCount );
|
|
||||||
uint32_t getUseBaitCatalogId() const;
|
|
||||||
void setUseBaitCatalogId( uint32_t useBaitCatalogId );
|
|
||||||
uint8_t getOpeningSequence() const;
|
|
||||||
void setOpeningSequence( uint8_t openingSequence );
|
|
||||||
uint8_t getLeveTicketNum() const;
|
|
||||||
void setLeveTicketNum( uint8_t leveTicketNum );
|
|
||||||
uint32_t getLeveTicketLastGetTime() const;
|
|
||||||
void setLeveTicketLastGetTime( uint32_t leveTicketLastGetTime );
|
|
||||||
uint16_t getLeveAssignmentSeed() const;
|
|
||||||
void setLeveAssignmentSeed( uint16_t leveAssignmentSeed );
|
|
||||||
uint8_t getLeveAssignmentCount() const;
|
|
||||||
void setLeveAssignmentCount( uint8_t leveAssignmentCount );
|
|
||||||
uint16_t getGuildleveFactionCreditBr() const;
|
|
||||||
void setGuildleveFactionCreditBr( uint16_t guildleveFactionCreditBr );
|
|
||||||
uint16_t getGuildleveFactionCreditAz() const;
|
|
||||||
void setGuildleveFactionCreditAz( uint16_t guildleveFactionCreditAz );
|
|
||||||
uint16_t getGuildleveFactionCreditHo() const;
|
|
||||||
void setGuildleveFactionCreditHo( uint16_t guildleveFactionCreditHo );
|
|
||||||
uint8_t getGrandCompany() const;
|
|
||||||
void setGrandCompany( uint8_t grandCompany );
|
|
||||||
uint8_t getGearsetMaxNum() const;
|
|
||||||
void setGearsetMaxNum( uint8_t gearsetMaxNum );
|
|
||||||
uint32_t getContentJoinTime() const;
|
|
||||||
void setContentJoinTime( uint32_t contentJoinTime );
|
|
||||||
uint32_t getPathId() const;
|
|
||||||
void setPathId( uint32_t pathId );
|
|
||||||
uint16_t getStepIndex() const;
|
|
||||||
void setStepIndex( uint16_t stepIndex );
|
|
||||||
uint32_t getPathIdBackUp() const;
|
|
||||||
void setPathIdBackUp( uint32_t pathIdBackUp );
|
|
||||||
uint16_t getStepIndexBackUp() const;
|
|
||||||
void setStepIndexBackUp( uint16_t stepIndexBackUp );
|
|
||||||
uint8_t getGcSupplySeed() const;
|
|
||||||
void setGcSupplySeed( uint8_t gcSupplySeed );
|
|
||||||
uint32_t getGcSupplyTime() const;
|
|
||||||
void setGcSupplyTime( uint32_t gcSupplyTime );
|
|
||||||
uint32_t getLayerSet() const;
|
|
||||||
void setLayerSet( uint32_t layerSet );
|
|
||||||
uint16_t getGcChangeTime() const;
|
|
||||||
void setGcChangeTime( uint16_t gcChangeTime );
|
|
||||||
uint8_t getFateFlag() const;
|
|
||||||
void setFateFlag( uint8_t fateFlag );
|
|
||||||
uint8_t getContentRaidCounter() const;
|
|
||||||
void setContentRaidCounter( uint8_t contentRaidCounter );
|
|
||||||
uint16_t getContentRaidTimer() const;
|
|
||||||
void setContentRaidTimer( uint16_t contentRaidTimer );
|
|
||||||
uint64_t getId() const;
|
|
||||||
void setId( uint64_t id );
|
|
||||||
|
|
||||||
// CHARAPC data END ------------------------------------------------------------------------------------
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -48,71 +48,6 @@ using namespace Core::Common;
|
||||||
using namespace Core::Network::Packets;
|
using namespace Core::Network::Packets;
|
||||||
using namespace Core::Network::Packets::Server;
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
void Core::Network::GameConnection::skillHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t action = pInPacket->getValAt< uint32_t >( 0x24 );
|
|
||||||
uint32_t useCount = pInPacket->getValAt< uint32_t >( 0x28 );
|
|
||||||
|
|
||||||
uint64_t targetId = pInPacket->getValAt< uint64_t >( 0x30 );
|
|
||||||
|
|
||||||
|
|
||||||
if( action < 1000000 ) // normal action
|
|
||||||
{
|
|
||||||
std::string actionIdStr = boost::str( boost::format( "%|04X|" ) % action );
|
|
||||||
pPlayer->sendDebug( "---------------------------------------" );
|
|
||||||
pPlayer->sendDebug( "ActionHandler ( " + actionIdStr + " | " + g_exdData.m_actionInfoMap[action].name + " | " + std::to_string( targetId ) + " )" );
|
|
||||||
|
|
||||||
if( action == 5 )
|
|
||||||
{
|
|
||||||
auto currentAction = pPlayer->getCurrentAction();
|
|
||||||
|
|
||||||
// we should always have an action here, if not there is a bug
|
|
||||||
assert( currentAction );
|
|
||||||
currentAction->onStart();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Core::Entity::ActorPtr targetActor = pPlayer;
|
|
||||||
if( targetId != pPlayer->getId() )
|
|
||||||
{
|
|
||||||
targetActor = pPlayer->lookupTargetById( targetId );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !pPlayer->actionHasCastTime( action ) )
|
|
||||||
{
|
|
||||||
g_scriptMgr.onCastFinish( pPlayer, targetActor, action );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Action::ActionCastPtr pActionCast( new Action::ActionCast( pPlayer, targetActor, action ) );
|
|
||||||
pPlayer->setCurrentAction( pActionCast );
|
|
||||||
pPlayer->sendDebug( "setCurrentAction()" );
|
|
||||||
pPlayer->getCurrentAction()->onStart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( action < 2000000 ) // craft action
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if( action < 3000000 ) // item action
|
|
||||||
{
|
|
||||||
auto info = g_exdData.getEventItemInfo( action );
|
|
||||||
if( info )
|
|
||||||
{
|
|
||||||
g_log.debug( info->name );
|
|
||||||
g_scriptMgr.onEventItem( pPlayer, action, info->eventId, info->castTime, targetId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( action > 3000000 ) // unknown
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::eventHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
void Core::Network::GameConnection::eventHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
{
|
{
|
425
src/servers/Server_Zone/GMCommandHandlers.cpp
Normal file
425
src/servers/Server_Zone/GMCommandHandlers.cpp
Normal file
|
@ -0,0 +1,425 @@
|
||||||
|
#include <Server_Common/Common.h>
|
||||||
|
#include <Server_Common/CommonNetwork.h>
|
||||||
|
#include <Server_Common/Database.h>
|
||||||
|
#include <Server_Common/GamePacketNew.h>
|
||||||
|
#include <Server_Common/Logger.h>
|
||||||
|
#include <Server_Common/ExdData.h>
|
||||||
|
#include <Server_Common/PacketContainer.h>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameConnection.h"
|
||||||
|
|
||||||
|
#include "Session.h"
|
||||||
|
#include "Zone.h"
|
||||||
|
#include "ZonePosition.h"
|
||||||
|
#include "ServerZone.h"
|
||||||
|
#include "ZoneMgr.h"
|
||||||
|
|
||||||
|
#include "InitUIPacket.h"
|
||||||
|
#include "PingPacket.h"
|
||||||
|
#include "MoveActorPacket.h"
|
||||||
|
#include "ChatPacket.h"
|
||||||
|
#include "ServerNoticePacket.h"
|
||||||
|
#include "ActorControlPacket142.h"
|
||||||
|
#include "ActorControlPacket143.h"
|
||||||
|
#include "ActorControlPacket144.h"
|
||||||
|
#include "EventStartPacket.h"
|
||||||
|
#include "EventFinishPacket.h"
|
||||||
|
#include "PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameCommandHandler.h"
|
||||||
|
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Inventory.h"
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
#include "EventHelper.h"
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "ActionTeleport.h"
|
||||||
|
|
||||||
|
extern Core::Logger g_log;
|
||||||
|
extern Core::Db::Database g_database;
|
||||||
|
extern Core::ServerZone g_serverZone;
|
||||||
|
extern Core::ZoneMgr g_zoneMgr;
|
||||||
|
extern Core::Data::ExdData g_exdData;
|
||||||
|
extern Core::GameCommandHandler g_gameCommandMgr;
|
||||||
|
|
||||||
|
using namespace Core::Common;
|
||||||
|
using namespace Core::Network::Packets;
|
||||||
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
|
enum GmCommand
|
||||||
|
{
|
||||||
|
Pos = 0x0000,
|
||||||
|
Lv = 0x0001,
|
||||||
|
Race = 0x0002,
|
||||||
|
Tribe = 0x0003,
|
||||||
|
Sex = 0x0004,
|
||||||
|
Time = 0x0005,
|
||||||
|
Weather = 0x0006,
|
||||||
|
Call = 0x0007,
|
||||||
|
Inspect = 0x0008,
|
||||||
|
Speed = 0x0009,
|
||||||
|
Invis = 0x000D,
|
||||||
|
|
||||||
|
Raise = 0x0010,
|
||||||
|
Kill = 0x000E,
|
||||||
|
Icon = 0x0012,
|
||||||
|
|
||||||
|
Hp = 0x0064,
|
||||||
|
Mp = 0x0065,
|
||||||
|
Tp = 0x0066,
|
||||||
|
Gp = 0x0067,
|
||||||
|
|
||||||
|
Item = 0x00C8,
|
||||||
|
Gil = 0x00C9,
|
||||||
|
Collect = 0x00CA,
|
||||||
|
|
||||||
|
QuestAccept = 0x012C,
|
||||||
|
QuestCancel = 0x012D,
|
||||||
|
QuestComplete = 0x012E,
|
||||||
|
QuestIncomplete = 0x012F,
|
||||||
|
QuestSequence = 0x0130,
|
||||||
|
QuestInspect = 0x0131,
|
||||||
|
GC = 0x0154,
|
||||||
|
GCRank = 0x0155,
|
||||||
|
TeriInfo = 0x025D,
|
||||||
|
Jump = 0x025E,
|
||||||
|
JumpNpc = 0x025F,
|
||||||
|
};
|
||||||
|
void Core::Network::GameConnection::gm1Handler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
|
{
|
||||||
|
uint32_t commandId = pInPacket->getValAt< uint32_t >( 0x20 );
|
||||||
|
uint32_t param1 = pInPacket->getValAt< uint32_t >( 0x24 );
|
||||||
|
uint32_t param2 = pInPacket->getValAt< uint32_t >( 0x28 );
|
||||||
|
uint32_t param3 = pInPacket->getValAt< uint32_t >( 0x38 );
|
||||||
|
|
||||||
|
g_log.debug( pPlayer->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 )
|
||||||
|
{
|
||||||
|
targetActor = pPlayer;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
auto inRange = pPlayer->getInRangeActors();
|
||||||
|
for( auto actor : inRange )
|
||||||
|
{
|
||||||
|
if( actor->getId() == param3 )
|
||||||
|
targetActor = actor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !targetActor )
|
||||||
|
return;
|
||||||
|
auto targetPlayer = targetActor->getAsPlayer();
|
||||||
|
|
||||||
|
switch( commandId )
|
||||||
|
{
|
||||||
|
case GmCommand::Kill:
|
||||||
|
{
|
||||||
|
targetActor->takeDamage( 9999999 );
|
||||||
|
pPlayer->sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::QuestSequence:
|
||||||
|
{
|
||||||
|
targetPlayer->updateQuest( param1, param2 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::QuestComplete:
|
||||||
|
{
|
||||||
|
targetPlayer->finishQuest( param1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::QuestAccept:
|
||||||
|
{
|
||||||
|
targetPlayer->updateQuest( param1, 1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::QuestCancel:
|
||||||
|
{
|
||||||
|
targetPlayer->removeQuest( param1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::QuestIncomplete:
|
||||||
|
{
|
||||||
|
targetPlayer->unfinishQuest( param1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Speed:
|
||||||
|
{
|
||||||
|
targetPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), Flee, param1 ) );
|
||||||
|
pPlayer->sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Gil:
|
||||||
|
{
|
||||||
|
targetPlayer->addCurrency( 1, param1 );
|
||||||
|
pPlayer->sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Lv:
|
||||||
|
{
|
||||||
|
targetPlayer->setLevel( param1 );
|
||||||
|
pPlayer->sendNotice( "Level 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 ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Mp:
|
||||||
|
{
|
||||||
|
targetPlayer->setMp( param1 );
|
||||||
|
pPlayer->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 ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Sex:
|
||||||
|
{
|
||||||
|
targetPlayer->setLookAt( CharaLook::Gender, param1 );
|
||||||
|
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
|
targetPlayer->spawn( targetPlayer );
|
||||||
|
auto inRange = targetActor->getInRangeActors();
|
||||||
|
for( auto actor : inRange )
|
||||||
|
{
|
||||||
|
targetPlayer->despawn( actor->getAsPlayer() );
|
||||||
|
targetPlayer->spawn( actor->getAsPlayer() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Race:
|
||||||
|
{
|
||||||
|
targetPlayer->setLookAt( CharaLook::Race, param1 );
|
||||||
|
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
|
targetPlayer->spawn( targetPlayer );
|
||||||
|
auto inRange = targetPlayer->getInRangeActors();
|
||||||
|
for( auto actor : inRange )
|
||||||
|
{
|
||||||
|
targetPlayer->despawn( actor->getAsPlayer() );
|
||||||
|
targetPlayer->spawn( actor->getAsPlayer() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Tribe:
|
||||||
|
{
|
||||||
|
targetPlayer->setLookAt( CharaLook::Tribe, param1 );
|
||||||
|
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
|
targetPlayer->spawn( targetPlayer );
|
||||||
|
auto inRange = targetPlayer->getInRangeActors();
|
||||||
|
for( auto actor : inRange )
|
||||||
|
{
|
||||||
|
targetPlayer->despawn( actor->getAsPlayer() );
|
||||||
|
targetPlayer->spawn( actor->getAsPlayer() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Item:
|
||||||
|
{
|
||||||
|
if( param2 < 1 || param2 > 99 )
|
||||||
|
{
|
||||||
|
param2 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( param1 == 0xcccccccc ) )
|
||||||
|
{
|
||||||
|
pPlayer->sendUrgent( "Syntaxerror." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !targetPlayer->addItem( -1, param1, param2 ) )
|
||||||
|
pPlayer->sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Weather:
|
||||||
|
{
|
||||||
|
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
|
||||||
|
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
||||||
|
targetPlayer->getName() + " set in range." );
|
||||||
|
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() ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Jump:
|
||||||
|
{
|
||||||
|
|
||||||
|
auto inRange = pPlayer->getInRangeActors();
|
||||||
|
for( auto actor : inRange )
|
||||||
|
{
|
||||||
|
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||||
|
targetActor->getRotation() );
|
||||||
|
}
|
||||||
|
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Collect:
|
||||||
|
{
|
||||||
|
uint32_t gil = targetPlayer->getCurrency( 1 );
|
||||||
|
|
||||||
|
if( gil < param1 )
|
||||||
|
{
|
||||||
|
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetPlayer->removeCurrency( 1, param1 );
|
||||||
|
pPlayer->sendNotice( "Removed " + std::to_string( param1 ) +
|
||||||
|
" Gil from " + targetPlayer->getName() +
|
||||||
|
"(" + std::to_string( gil ) + " before)" );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Icon:
|
||||||
|
{
|
||||||
|
targetPlayer->setOnlineStatusMask( param1 );
|
||||||
|
|
||||||
|
GamePacketNew< FFXIVIpcSetOnlineStatus > statusPacket( targetPlayer->getId() );
|
||||||
|
statusPacket.data().onlineStatusFlags = param1;
|
||||||
|
queueOutPacket( statusPacket );
|
||||||
|
|
||||||
|
GamePacketNew< FFXIVIpcSetSearchInfo > searchInfoPacket( targetPlayer->getId() );
|
||||||
|
searchInfoPacket.data().onlineStatusFlags = param1;
|
||||||
|
searchInfoPacket.data().selectRegion = targetPlayer->getSearchSelectRegion();
|
||||||
|
sprintf( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
|
||||||
|
targetPlayer->queuePacket( searchInfoPacket );
|
||||||
|
|
||||||
|
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
|
||||||
|
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
|
||||||
|
true );
|
||||||
|
pPlayer->sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::GC:
|
||||||
|
{
|
||||||
|
targetPlayer->setGc( param1 );
|
||||||
|
pPlayer->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() +
|
||||||
|
" for GC " + std::to_string( targetPlayer->getGc()) +
|
||||||
|
" was set to " + std::to_string( targetPlayer->getGcRankArray()[targetPlayer->getGc() - 1] ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
pPlayer->sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::gm2Handler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
|
{
|
||||||
|
uint32_t commandId = pInPacket->getValAt< uint32_t >( 0x20 );
|
||||||
|
std::string param1 = pInPacket->getStringAt( 0x34 );
|
||||||
|
|
||||||
|
g_log.debug( pPlayer->getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
||||||
|
|
||||||
|
auto targetSession = g_serverZone.getSession( param1 );
|
||||||
|
Core::Entity::ActorPtr targetActor;
|
||||||
|
|
||||||
|
if( targetSession != nullptr )
|
||||||
|
{
|
||||||
|
targetActor = targetSession->getPlayer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( param1 == "self" )
|
||||||
|
{
|
||||||
|
targetActor = pPlayer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pPlayer->sendUrgent("Player " + param1 + " not found on this server.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !targetActor )
|
||||||
|
return;
|
||||||
|
auto targetPlayer = targetActor->getAsPlayer();
|
||||||
|
|
||||||
|
switch( commandId )
|
||||||
|
{
|
||||||
|
case GmCommand::Raise:
|
||||||
|
{
|
||||||
|
targetPlayer->resetHp();
|
||||||
|
targetPlayer->resetMp();
|
||||||
|
targetPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||||
|
targetPlayer->setSyncFlag( Status );
|
||||||
|
|
||||||
|
targetPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||||
|
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus,
|
||||||
|
static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||||
|
pPlayer->sendNotice( "Raised " + targetPlayer->getName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Jump:
|
||||||
|
{
|
||||||
|
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
||||||
|
{
|
||||||
|
pPlayer->setZone( targetPlayer->getZoneId() );
|
||||||
|
}
|
||||||
|
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||||
|
targetActor->getRotation() );
|
||||||
|
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Call:
|
||||||
|
{
|
||||||
|
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
||||||
|
targetPlayer->setZone( pPlayer->getZoneId() );
|
||||||
|
|
||||||
|
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
|
||||||
|
pPlayer->getRotation() );
|
||||||
|
pPlayer->sendNotice( "Calling " + targetPlayer->getName() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GmCommand::Inspect:
|
||||||
|
{
|
||||||
|
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
|
||||||
|
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
|
||||||
|
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
|
||||||
|
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
|
||||||
|
"\nClass: " + std::to_string( targetPlayer->getClass() ) +
|
||||||
|
"\nLevel: " + std::to_string( targetPlayer->getLevel() ) +
|
||||||
|
"\nExp: " + std::to_string( targetPlayer->getExp() ) +
|
||||||
|
"\nSearchMessage: " + targetPlayer->getSearchMessage() +
|
||||||
|
"\nPlayTime: " + std::to_string( targetPlayer->getPlayTime() ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
|
@ -190,8 +190,6 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
|
||||||
pPlayer->sendToInRangeSet( control, true );
|
pPlayer->sendToInRangeSet( control, true );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( ( subCommand == "quest" ) && ( params != "" ) )
|
|
||||||
setQuestHandler( const_cast< char* >( params.c_str() ), pPlayer, command );
|
|
||||||
|
|
||||||
else if( ( subCommand == "tele" ) && ( params != "" ) )
|
else if( ( subCommand == "tele" ) && ( params != "" ) )
|
||||||
{
|
{
|
||||||
|
@ -281,47 +279,6 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::GameCommandHandler::setQuestHandler( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::GameCommand> command )
|
|
||||||
{
|
|
||||||
std::string tmpCommand( data );
|
|
||||||
std::string subCommand;
|
|
||||||
|
|
||||||
std::size_t pos = tmpCommand.find_first_of( " " );
|
|
||||||
|
|
||||||
if( pos != std::string::npos )
|
|
||||||
// command has parameters, grab the first part
|
|
||||||
subCommand = tmpCommand.substr( 0, pos );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// no subcommand given
|
|
||||||
subCommand = tmpCommand;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string params( data + pos );
|
|
||||||
|
|
||||||
if( subCommand == "seq" )
|
|
||||||
{
|
|
||||||
int32_t questId;
|
|
||||||
int32_t sequence;
|
|
||||||
sscanf( params.c_str(), "%i %i", &questId, &sequence );
|
|
||||||
|
|
||||||
if( sequence == -1 )
|
|
||||||
pPlayer->removeQuest( questId );
|
|
||||||
else
|
|
||||||
pPlayer->updateQuest( questId, sequence );
|
|
||||||
}
|
|
||||||
else if( subCommand == "var" )
|
|
||||||
{
|
|
||||||
int32_t questId;
|
|
||||||
int32_t varIdx;
|
|
||||||
int32_t varVal;
|
|
||||||
sscanf( params.c_str(), "%i %i %i", &questId, &varIdx, &varVal );
|
|
||||||
|
|
||||||
//pPlayer->updateQuestVar( questId, varIdx, varVal );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::GameCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::GameCommand> command )
|
void Core::GameCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::GameCommand> command )
|
||||||
{
|
{
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
|
|
|
@ -34,8 +34,6 @@ public:
|
||||||
//void debug( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
//void debug( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
||||||
void scriptReload( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
void scriptReload( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
||||||
|
|
||||||
void setQuestHandler( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
|
||||||
|
|
||||||
void injectPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
void injectPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
||||||
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<GameCommand> command );
|
||||||
|
|
||||||
|
|
|
@ -84,10 +84,10 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
|
||||||
setHandler( ClientIpcType::ReturnEventHandler, "EventHandlerReturn", &GameConnection::eventHandler );
|
setHandler( ClientIpcType::ReturnEventHandler, "EventHandlerReturn", &GameConnection::eventHandler );
|
||||||
setHandler( ClientIpcType::TradeReturnEventHandler, "EventHandlerReturn", &GameConnection::eventHandler );
|
setHandler( ClientIpcType::TradeReturnEventHandler, "EventHandlerReturn", &GameConnection::eventHandler );
|
||||||
|
|
||||||
setHandler(ClientIpcType::CFDutyInfoHandler, "CFDutyInfoRequest", &GameConnection::cfDutyInfoRequest );
|
setHandler( ClientIpcType::CFDutyInfoHandler, "CFDutyInfoRequest", &GameConnection::cfDutyInfoRequest );
|
||||||
setHandler(ClientIpcType::CFRegisterDuty, "CFRegisterDuty", &GameConnection::cfRegisterDuty );
|
setHandler( ClientIpcType::CFRegisterDuty, "CFRegisterDuty", &GameConnection::cfRegisterDuty );
|
||||||
setHandler(ClientIpcType::CFRegisterRoulette, "CFRegisterRoulette", &GameConnection::cfRegisterRoulette );
|
setHandler( ClientIpcType::CFRegisterRoulette, "CFRegisterRoulette", &GameConnection::cfRegisterRoulette );
|
||||||
setHandler(ClientIpcType::CFCommenceHandler, "CFDutyAccepted", &GameConnection::cfDutyAccepted);
|
setHandler( ClientIpcType::CFCommenceHandler, "CFDutyAccepted", &GameConnection::cfDutyAccepted);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
118
src/servers/Server_Zone/InventoryHandler.cpp
Normal file
118
src/servers/Server_Zone/InventoryHandler.cpp
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
#include <Server_Common/Common.h>
|
||||||
|
#include <Server_Common/CommonNetwork.h>
|
||||||
|
#include <Server_Common/Database.h>
|
||||||
|
#include <Server_Common/GamePacketNew.h>
|
||||||
|
#include <Server_Common/Logger.h>
|
||||||
|
#include <Server_Common/ExdData.h>
|
||||||
|
#include <Server_Common/PacketContainer.h>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameConnection.h"
|
||||||
|
|
||||||
|
#include "Session.h"
|
||||||
|
#include "Zone.h"
|
||||||
|
#include "ZonePosition.h"
|
||||||
|
#include "ServerZone.h"
|
||||||
|
#include "ZoneMgr.h"
|
||||||
|
|
||||||
|
#include "InitUIPacket.h"
|
||||||
|
#include "PingPacket.h"
|
||||||
|
#include "MoveActorPacket.h"
|
||||||
|
#include "ChatPacket.h"
|
||||||
|
#include "ServerNoticePacket.h"
|
||||||
|
#include "ActorControlPacket142.h"
|
||||||
|
#include "ActorControlPacket143.h"
|
||||||
|
#include "ActorControlPacket144.h"
|
||||||
|
#include "EventStartPacket.h"
|
||||||
|
#include "EventFinishPacket.h"
|
||||||
|
#include "PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameCommandHandler.h"
|
||||||
|
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Inventory.h"
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
#include "EventHelper.h"
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "ActionTeleport.h"
|
||||||
|
|
||||||
|
extern Core::Logger g_log;
|
||||||
|
extern Core::Db::Database g_database;
|
||||||
|
extern Core::ServerZone g_serverZone;
|
||||||
|
extern Core::ZoneMgr g_zoneMgr;
|
||||||
|
extern Core::Data::ExdData g_exdData;
|
||||||
|
extern Core::GameCommandHandler g_gameCommandMgr;
|
||||||
|
|
||||||
|
using namespace Core::Common;
|
||||||
|
using namespace Core::Network::Packets;
|
||||||
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::inventoryModifyHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
|
{
|
||||||
|
uint32_t seq = pInPacket->getValAt< uint32_t >( 0x20 );
|
||||||
|
uint8_t action = pInPacket->getValAt< uint8_t >( 0x24 );
|
||||||
|
uint8_t fromSlot = pInPacket->getValAt< uint8_t >( 0x30 );
|
||||||
|
uint8_t toSlot = pInPacket->getValAt< uint8_t >( 0x44 );
|
||||||
|
uint16_t fromContainer = pInPacket->getValAt< uint16_t >( 0x2C );
|
||||||
|
uint16_t toContainer = pInPacket->getValAt< uint16_t >( 0x40 );
|
||||||
|
|
||||||
|
GamePacketNew< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
|
||||||
|
ackPacket.data().sequence = seq;
|
||||||
|
ackPacket.data().type = 7;
|
||||||
|
pPlayer->queuePacket( ackPacket );
|
||||||
|
|
||||||
|
|
||||||
|
g_log.debug( pInPacket->toString() );
|
||||||
|
g_log.debug( "InventoryAction: " + std::to_string( action ) );
|
||||||
|
|
||||||
|
// TODO: other inventory operations need to be implemented
|
||||||
|
switch( action )
|
||||||
|
{
|
||||||
|
|
||||||
|
case 0x07: // discard item action
|
||||||
|
{
|
||||||
|
pPlayer->getInvetory()->discardItem( fromContainer, fromSlot );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x08: // move item action
|
||||||
|
{
|
||||||
|
pPlayer->getInvetory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x09: // swap item action
|
||||||
|
{
|
||||||
|
pPlayer->getInvetory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x0C: // merge stack action
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x0A: // split stack action
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPlayer->setSyncFlag( PlayerSyncFlags::Status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -113,378 +113,6 @@ void Core::Network::GameConnection::linkshellListHandler( Core::Network::Packets
|
||||||
queueOutPacket( linkshellListPacket );
|
queueOutPacket( linkshellListPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move this and the handlers to a gm command handler
|
|
||||||
enum GmCommand
|
|
||||||
{
|
|
||||||
Pos = 0x0000,
|
|
||||||
Lv = 0x0001,
|
|
||||||
Race = 0x0002,
|
|
||||||
Tribe = 0x0003,
|
|
||||||
Sex = 0x0004,
|
|
||||||
Time = 0x0005,
|
|
||||||
Weather = 0x0006,
|
|
||||||
Call = 0x0007,
|
|
||||||
Inspect = 0x0008,
|
|
||||||
Speed = 0x0009,
|
|
||||||
Invis = 0x000D,
|
|
||||||
|
|
||||||
Raise = 0x0010,
|
|
||||||
Kill = 0x000E,
|
|
||||||
Icon = 0x0012,
|
|
||||||
|
|
||||||
Hp = 0x0064,
|
|
||||||
Mp = 0x0065,
|
|
||||||
Tp = 0x0066,
|
|
||||||
Gp = 0x0067,
|
|
||||||
|
|
||||||
Item = 0x00C8,
|
|
||||||
Gil = 0x00C9,
|
|
||||||
Collect = 0x00CA,
|
|
||||||
|
|
||||||
QuestAccept = 0x012C,
|
|
||||||
QuestCancel = 0x012D,
|
|
||||||
QuestComplete = 0x012E,
|
|
||||||
QuestIncomplete = 0x012F,
|
|
||||||
QuestSequence = 0x0130,
|
|
||||||
QuestInspect = 0x0131,
|
|
||||||
GC = 0x0154,
|
|
||||||
GCRank = 0x0155,
|
|
||||||
TeriInfo = 0x025D,
|
|
||||||
Jump = 0x025E,
|
|
||||||
JumpNpc = 0x025F,
|
|
||||||
};
|
|
||||||
void Core::Network::GameConnection::gm1Handler( Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
|
||||||
uint32_t commandId = pInPacket->getValAt< uint32_t >( 0x20 );
|
|
||||||
uint32_t param1 = pInPacket->getValAt< uint32_t >( 0x24 );
|
|
||||||
uint32_t param2 = pInPacket->getValAt< uint32_t >( 0x28 );
|
|
||||||
uint32_t param3 = pInPacket->getValAt< uint32_t >( 0x38 );
|
|
||||||
|
|
||||||
g_log.debug( pPlayer->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 )
|
|
||||||
{
|
|
||||||
targetActor = pPlayer;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
auto inRange = pPlayer->getInRangeActors();
|
|
||||||
for( auto actor : inRange )
|
|
||||||
{
|
|
||||||
if( actor->getId() == param3 )
|
|
||||||
targetActor = actor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !targetActor )
|
|
||||||
return;
|
|
||||||
auto targetPlayer = targetActor->getAsPlayer();
|
|
||||||
|
|
||||||
switch( commandId )
|
|
||||||
{
|
|
||||||
case GmCommand::Kill:
|
|
||||||
{
|
|
||||||
targetActor->takeDamage( 9999999 );
|
|
||||||
pPlayer->sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::QuestSequence:
|
|
||||||
{
|
|
||||||
targetPlayer->updateQuest( param1, param2 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::QuestComplete:
|
|
||||||
{
|
|
||||||
targetPlayer->finishQuest( param1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::QuestAccept:
|
|
||||||
{
|
|
||||||
targetPlayer->updateQuest( param1, 1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::QuestCancel:
|
|
||||||
{
|
|
||||||
targetPlayer->removeQuest( param1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::QuestIncomplete:
|
|
||||||
{
|
|
||||||
targetPlayer->unfinishQuest( param1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Speed:
|
|
||||||
{
|
|
||||||
targetPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), Flee, param1 ) );
|
|
||||||
pPlayer->sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Gil:
|
|
||||||
{
|
|
||||||
targetPlayer->addCurrency( 1, param1 );
|
|
||||||
pPlayer->sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Lv:
|
|
||||||
{
|
|
||||||
targetPlayer->setLevel( param1 );
|
|
||||||
pPlayer->sendNotice( "Level 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 ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Mp:
|
|
||||||
{
|
|
||||||
targetPlayer->setMp( param1 );
|
|
||||||
pPlayer->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 ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Sex:
|
|
||||||
{
|
|
||||||
targetPlayer->setLookAt( CharaLook::Gender, param1 );
|
|
||||||
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
|
||||||
targetPlayer->spawn( targetPlayer );
|
|
||||||
auto inRange = targetActor->getInRangeActors();
|
|
||||||
for( auto actor : inRange )
|
|
||||||
{
|
|
||||||
targetPlayer->despawn( actor->getAsPlayer() );
|
|
||||||
targetPlayer->spawn( actor->getAsPlayer() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Race:
|
|
||||||
{
|
|
||||||
targetPlayer->setLookAt( CharaLook::Race, param1 );
|
|
||||||
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
|
||||||
targetPlayer->spawn( targetPlayer );
|
|
||||||
auto inRange = targetPlayer->getInRangeActors();
|
|
||||||
for( auto actor : inRange )
|
|
||||||
{
|
|
||||||
targetPlayer->despawn( actor->getAsPlayer() );
|
|
||||||
targetPlayer->spawn( actor->getAsPlayer() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Tribe:
|
|
||||||
{
|
|
||||||
targetPlayer->setLookAt( CharaLook::Tribe, param1 );
|
|
||||||
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
|
||||||
targetPlayer->spawn( targetPlayer );
|
|
||||||
auto inRange = targetPlayer->getInRangeActors();
|
|
||||||
for( auto actor : inRange )
|
|
||||||
{
|
|
||||||
targetPlayer->despawn( actor->getAsPlayer() );
|
|
||||||
targetPlayer->spawn( actor->getAsPlayer() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Item:
|
|
||||||
{
|
|
||||||
if( param2 < 1 || param2 > 99 )
|
|
||||||
{
|
|
||||||
param2 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( param1 == 0xcccccccc ) )
|
|
||||||
{
|
|
||||||
pPlayer->sendUrgent( "Syntaxerror." );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !targetPlayer->addItem( -1, param1, param2 ) )
|
|
||||||
pPlayer->sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Weather:
|
|
||||||
{
|
|
||||||
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
|
|
||||||
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
|
||||||
targetPlayer->getName() + " set in range." );
|
|
||||||
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() ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Jump:
|
|
||||||
{
|
|
||||||
|
|
||||||
auto inRange = pPlayer->getInRangeActors();
|
|
||||||
for( auto actor : inRange )
|
|
||||||
{
|
|
||||||
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
|
||||||
targetActor->getRotation() );
|
|
||||||
}
|
|
||||||
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Collect:
|
|
||||||
{
|
|
||||||
uint32_t gil = targetPlayer->getCurrency( 1 );
|
|
||||||
|
|
||||||
if( gil < param1 )
|
|
||||||
{
|
|
||||||
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
targetPlayer->removeCurrency( 1, param1 );
|
|
||||||
pPlayer->sendNotice( "Removed " + std::to_string( param1 ) +
|
|
||||||
" Gil from " + targetPlayer->getName() +
|
|
||||||
"(" + std::to_string( gil ) + " before)" );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Icon:
|
|
||||||
{
|
|
||||||
targetPlayer->setOnlineStatusMask( param1 );
|
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcSetOnlineStatus > statusPacket( targetPlayer->getId() );
|
|
||||||
statusPacket.data().onlineStatusFlags = param1;
|
|
||||||
queueOutPacket( statusPacket );
|
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcSetSearchInfo > searchInfoPacket( targetPlayer->getId() );
|
|
||||||
searchInfoPacket.data().onlineStatusFlags = param1;
|
|
||||||
searchInfoPacket.data().selectRegion = targetPlayer->getSearchSelectRegion();
|
|
||||||
sprintf( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
|
|
||||||
targetPlayer->queuePacket( searchInfoPacket );
|
|
||||||
|
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
|
|
||||||
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
|
|
||||||
true );
|
|
||||||
pPlayer->sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::GC:
|
|
||||||
{
|
|
||||||
targetPlayer->setGc( param1 );
|
|
||||||
pPlayer->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() +
|
|
||||||
" for GC " + std::to_string( targetPlayer->getGc()) +
|
|
||||||
" was set to " + std::to_string( targetPlayer->getGcRankArray()[targetPlayer->getGc() - 1] ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
pPlayer->sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::gm2Handler( Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
|
||||||
uint32_t commandId = pInPacket->getValAt< uint32_t >( 0x20 );
|
|
||||||
std::string param1 = pInPacket->getStringAt( 0x34 );
|
|
||||||
|
|
||||||
g_log.debug( pPlayer->getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
|
||||||
|
|
||||||
auto targetSession = g_serverZone.getSession( param1 );
|
|
||||||
Core::Entity::ActorPtr targetActor;
|
|
||||||
|
|
||||||
if( targetSession != nullptr )
|
|
||||||
{
|
|
||||||
targetActor = targetSession->getPlayer();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( param1 == "self" )
|
|
||||||
{
|
|
||||||
targetActor = pPlayer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPlayer->sendUrgent("Player " + param1 + " not found on this server.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !targetActor )
|
|
||||||
return;
|
|
||||||
auto targetPlayer = targetActor->getAsPlayer();
|
|
||||||
|
|
||||||
switch( commandId )
|
|
||||||
{
|
|
||||||
case GmCommand::Raise:
|
|
||||||
{
|
|
||||||
targetPlayer->resetHp();
|
|
||||||
targetPlayer->resetMp();
|
|
||||||
targetPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
|
||||||
targetPlayer->setSyncFlag( Status );
|
|
||||||
|
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus,
|
|
||||||
static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
|
||||||
pPlayer->sendNotice( "Raised " + targetPlayer->getName());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Jump:
|
|
||||||
{
|
|
||||||
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
|
||||||
{
|
|
||||||
pPlayer->setZone( targetPlayer->getZoneId() );
|
|
||||||
}
|
|
||||||
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
|
||||||
targetActor->getRotation() );
|
|
||||||
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Call:
|
|
||||||
{
|
|
||||||
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
|
||||||
targetPlayer->setZone( pPlayer->getZoneId() );
|
|
||||||
|
|
||||||
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
|
|
||||||
pPlayer->getRotation() );
|
|
||||||
pPlayer->sendNotice( "Calling " + targetPlayer->getName() );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GmCommand::Inspect:
|
|
||||||
{
|
|
||||||
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
|
|
||||||
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
|
|
||||||
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
|
|
||||||
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
|
|
||||||
"\nClass: " + std::to_string( targetPlayer->getClass() ) +
|
|
||||||
"\nLevel: " + std::to_string( targetPlayer->getLevel() ) +
|
|
||||||
"\nExp: " + std::to_string( targetPlayer->getExp() ) +
|
|
||||||
"\nSearchMessage: " + targetPlayer->getSearchMessage() +
|
|
||||||
"\nPlayTime: " + std::to_string( targetPlayer->getPlayTime() ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::updatePositionHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
void Core::Network::GameConnection::updatePositionHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
{
|
{
|
||||||
|
@ -708,7 +336,6 @@ void Core::Network::GameConnection::zoneLineHandler( Core::Network::Packets::Gam
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::discoveryHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
void Core::Network::GameConnection::discoveryHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
{
|
{
|
||||||
|
@ -737,218 +364,6 @@ void Core::Network::GameConnection::discoveryHandler( Core::Network::Packets::Ga
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::inventoryModifyHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
|
||||||
uint32_t seq = pInPacket->getValAt< uint32_t >( 0x20 );
|
|
||||||
uint8_t action = pInPacket->getValAt< uint8_t >( 0x24 );
|
|
||||||
uint8_t fromSlot = pInPacket->getValAt< uint8_t >( 0x30 );
|
|
||||||
uint8_t toSlot = pInPacket->getValAt< uint8_t >( 0x44 );
|
|
||||||
uint16_t fromContainer = pInPacket->getValAt< uint16_t >( 0x2C );
|
|
||||||
uint16_t toContainer = pInPacket->getValAt< uint16_t >( 0x40 );
|
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
|
|
||||||
ackPacket.data().sequence = seq;
|
|
||||||
ackPacket.data().type = 7;
|
|
||||||
pPlayer->queuePacket( ackPacket );
|
|
||||||
|
|
||||||
|
|
||||||
g_log.debug( pInPacket->toString() );
|
|
||||||
g_log.debug( "InventoryAction: " + std::to_string( action ) );
|
|
||||||
|
|
||||||
// TODO: other inventory operations need to be implemented
|
|
||||||
switch( action )
|
|
||||||
{
|
|
||||||
|
|
||||||
case 0x07: // discard item action
|
|
||||||
{
|
|
||||||
pPlayer->getInvetory()->discardItem( fromContainer, fromSlot );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x08: // move item action
|
|
||||||
{
|
|
||||||
pPlayer->getInvetory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x09: // swap item action
|
|
||||||
{
|
|
||||||
pPlayer->getInvetory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x0C: // merge stack action
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x0A: // split stack action
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->setSyncFlag( PlayerSyncFlags::Status );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
|
||||||
{
|
|
||||||
uint16_t commandId = pInPacket->getValAt< uint16_t >( 0x20 );
|
|
||||||
uint64_t param1 = pInPacket->getValAt< uint64_t >( 0x24 );
|
|
||||||
uint32_t param11 = pInPacket->getValAt< uint32_t >( 0x24 );
|
|
||||||
uint32_t param12 = pInPacket->getValAt< uint32_t >( 0x28 );
|
|
||||||
uint32_t param2 = pInPacket->getValAt< uint32_t >( 0x2c );
|
|
||||||
uint64_t param3 = pInPacket->getValAt< uint64_t >( 0x38 );
|
|
||||||
|
|
||||||
g_log.debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
|
|
||||||
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) +
|
|
||||||
"\nparam1: " + boost::str( boost::format( "%|016X|" ) % ( uint64_t ) ( param1 & 0xFFFFFFFFFFFFFFF ) ) +
|
|
||||||
"\nparam2: " + boost::str( boost::format( "%|08X|" ) % ( uint32_t ) ( param2 & 0xFFFFFFFF ) ) +
|
|
||||||
"\nparam3: " + boost::str( boost::format( "%|016X|" ) % ( uint64_t ) ( param3 & 0xFFFFFFFFFFFFFFF ) )
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//g_log.Log(LoggingSeverity::debug, "[" + std::to_string(m_pSession->getId()) + "] " + pInPacket->toString());
|
|
||||||
|
|
||||||
switch( commandId )
|
|
||||||
{
|
|
||||||
case 0x01: // Toggle sheathe
|
|
||||||
{
|
|
||||||
if ( param11 == 1 )
|
|
||||||
pPlayer->setStance( Entity::Actor::Stance::Active );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPlayer->setStance( Entity::Actor::Stance::Passive );
|
|
||||||
pPlayer->setAutoattack( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 0, param11, 1 ) );
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0x02: // Toggle auto-attack
|
|
||||||
{
|
|
||||||
if ( param11 == 1 )
|
|
||||||
{
|
|
||||||
pPlayer->setAutoattack( true );
|
|
||||||
pPlayer->setStance( Entity::Actor::Stance::Active );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pPlayer->setAutoattack( false );
|
|
||||||
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 1, param11, 1 ) );
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0x03: // Change target
|
|
||||||
{
|
|
||||||
|
|
||||||
uint64_t targetId = pInPacket->getValAt< uint64_t >( 0x24 );
|
|
||||||
pPlayer->changeTarget( targetId );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x133: // Update howtos seen
|
|
||||||
{
|
|
||||||
uint32_t howToId = static_cast< uint32_t >( param1 );
|
|
||||||
pPlayer->updateHowtosSeen( howToId );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0x1F4: // emote
|
|
||||||
{
|
|
||||||
uint64_t targetId = pPlayer->getTargetId();
|
|
||||||
uint32_t emoteId = pInPacket->getValAt< uint32_t >( 0x24 );
|
|
||||||
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket144( pPlayer->getId(), Emote, emoteId, 0, 0, 0, targetId ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0xC8: // return dead
|
|
||||||
{
|
|
||||||
pPlayer->returnToHomepoint();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0xC9: // Finish zoning
|
|
||||||
{
|
|
||||||
switch( pPlayer->getZoningType() )
|
|
||||||
{
|
|
||||||
case ZoneingType::None:
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01 ), true );
|
|
||||||
break;
|
|
||||||
case ZoneingType::Teleport:
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
|
||||||
break;
|
|
||||||
case ZoneingType::Return:
|
|
||||||
case ZoneingType::ReturnDead:
|
|
||||||
{
|
|
||||||
if( pPlayer->getStatus() == Entity::Actor::ActorStatus::Dead )
|
|
||||||
{
|
|
||||||
pPlayer->resetHp();
|
|
||||||
pPlayer->resetMp();
|
|
||||||
pPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
|
||||||
pPlayer->setSyncFlag( Status );
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ZoneingType::FadeIn:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->setZoningType( Common::ZoneingType::None );
|
|
||||||
|
|
||||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
|
||||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
|
|
||||||
pPlayer->sendStateFlags();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0xCA: // Teleport
|
|
||||||
{
|
|
||||||
// TODO: only register this action if enough gil is in possession
|
|
||||||
auto targetAetheryte = g_exdData.getAetheryteInfo( param11 );
|
|
||||||
|
|
||||||
if( targetAetheryte )
|
|
||||||
{
|
|
||||||
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index );
|
|
||||||
|
|
||||||
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
|
||||||
auto cost = ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) +
|
|
||||||
pow( fromAetheryte->map_coord_y - targetAetheryte->map_coord_y, 2 ) ) / 2 ) + 100;
|
|
||||||
|
|
||||||
// cap at 999 gil
|
|
||||||
cost = cost > 999 ? 999 : cost;
|
|
||||||
|
|
||||||
bool insufficientGil = pPlayer->getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
|
||||||
// todo: figure out what param1 really does
|
|
||||||
pPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), TeleportStart, insufficientGil ? 2 : 0, param11 ) );
|
|
||||||
|
|
||||||
if( !insufficientGil )
|
|
||||||
{
|
|
||||||
Action::ActionTeleportPtr pActionTeleport( new Action::ActionTeleport( pPlayer, param11, cost ) );
|
|
||||||
pPlayer->setCurrentAction( pActionTeleport );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::playTimeHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
void Core::Network::GameConnection::playTimeHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
Core::Entity::PlayerPtr pPlayer )
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
|
@ -1070,38 +485,6 @@ void Core::Network::GameConnection::socialListHandler( Core::Network::Packets::G
|
||||||
else if( type == 0x0e )
|
else if( type == 0x0e )
|
||||||
{ // player search result
|
{ // player search result
|
||||||
// TODO: implement player search
|
// TODO: implement player search
|
||||||
/*CGamePacket * pPE = new CGamePacket(0xCC, 0x3A0, pPlayer->getId(), pPlayer->getId());
|
|
||||||
pPE->setInt8At(0x2C, 0x0E);
|
|
||||||
pPE->setInt8At(0x2D, count);
|
|
||||||
|
|
||||||
std::set<CPlayer*> tmpSet = m_playerSearchResult;
|
|
||||||
|
|
||||||
std::set<CPlayer*>::iterator it;
|
|
||||||
|
|
||||||
int32_t i = 0x30;
|
|
||||||
for(it = tmpSet.begin(); it != tmpSet.end(); it++)
|
|
||||||
{
|
|
||||||
if((*it)->getId() == pPlayer->getId())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pPE->setInt64At(i, (*it)->getContentId());
|
|
||||||
pPE->setInt8At(i+0x16, 0x2);
|
|
||||||
pPE->setInt16At(i+0x0A, (*it)->getZone()->getLayoutId());
|
|
||||||
pPE->setInt16At(i+0x0C, (*it)->getZone()->getLayoutId());
|
|
||||||
pPE->setInt16At(i+0x0E, 0x46);
|
|
||||||
pPE->setInt16At(i+0x14, 0x100);
|
|
||||||
|
|
||||||
pPE->setInt16At(i+0x1A, 0x8000);
|
|
||||||
pPE->setInt16At(i + 0x20, static_cast<uint8_t>((*it)->getClass()));
|
|
||||||
pPE->setInt16At(i+0x22,(*it)->getLevel());
|
|
||||||
pPE->setStringAt(i+0x26, (*it)->getName());
|
|
||||||
i += 0x48;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pPlayer->queuePacket(pPE);*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1112,8 +495,7 @@ void Core::Network::GameConnection::chatHandler( Core::Network::Packets::GamePac
|
||||||
|
|
||||||
std::string chatString( pInPacket->getStringAt( 0x3a ) );
|
std::string chatString( pInPacket->getStringAt( 0x3a ) );
|
||||||
|
|
||||||
uint32_t sourceId;
|
uint32_t sourceId = pInPacket->getValAt< uint32_t >( 0x24 );
|
||||||
sourceId = pInPacket->getValAt< uint32_t >( 0x24 );
|
|
||||||
|
|
||||||
if( chatString.at( 0 ) == '@' )
|
if( chatString.at( 0 ) == '@' )
|
||||||
{
|
{
|
||||||
|
@ -1165,50 +547,3 @@ void Core::Network::GameConnection::logoutHandler( Core::Network::Packets::GameP
|
||||||
logoutPacket.data().flags2 = 0x2000;
|
logoutPacket.data().flags2 = 0x2000;
|
||||||
queueOutPacket( logoutPacket );
|
queueOutPacket( logoutPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::cfDutyInfoRequest(Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer)
|
|
||||||
{
|
|
||||||
GamePacketNew< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
|
|
||||||
queueOutPacket( dutyInfoPacket );
|
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
|
|
||||||
queueOutPacket( inNeedsPacket );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::cfRegisterDuty(Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer)
|
|
||||||
{
|
|
||||||
// TODO use for loop for this
|
|
||||||
auto contentId1 = pInPacket->getValAt< uint16_t >( 46 );
|
|
||||||
auto contentId2 = pInPacket->getValAt< uint16_t >( 48 );
|
|
||||||
auto contentId3 = pInPacket->getValAt< uint16_t >( 50 );
|
|
||||||
auto contentId4 = pInPacket->getValAt< uint16_t >( 52 );
|
|
||||||
auto contentId5 = pInPacket->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));
|
|
||||||
|
|
||||||
// let's cancel it because otherwise you can't register it again
|
|
||||||
GamePacketNew< FFXIVIpcCFNotify > cfCancelPacket( pPlayer->getId() );
|
|
||||||
cfCancelPacket.data().state1 = 3;
|
|
||||||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
|
||||||
queueOutPacket( cfCancelPacket );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::cfRegisterRoulette(Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer)
|
|
||||||
{
|
|
||||||
pPlayer->sendDebug("Roulette register");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::cfDutyAccepted(Core::Network::Packets::GamePacketPtr pInPacket,
|
|
||||||
Core::Entity::PlayerPtr pPlayer)
|
|
||||||
{
|
|
||||||
pPlayer->sendDebug("TODO: Duty accept");
|
|
||||||
}
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
||||||
uint64_t dcMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Disconnected );
|
uint64_t dcMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Disconnected );
|
||||||
uint64_t meldMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LfMeld );
|
uint64_t meldMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LfMeld );
|
||||||
uint64_t ptMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LfParty );
|
uint64_t ptMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LfParty );
|
||||||
|
uint64_t rpMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::RolePlaying );
|
||||||
|
|
||||||
OnlineStatus status = OnlineStatus::Online;
|
OnlineStatus status = OnlineStatus::Online;
|
||||||
|
|
||||||
|
@ -154,6 +155,9 @@ Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
||||||
if( m_onlineStatus & ptMask )
|
if( m_onlineStatus & ptMask )
|
||||||
status = OnlineStatus::LfParty;
|
status = OnlineStatus::LfParty;
|
||||||
|
|
||||||
|
if( m_onlineStatus & rpMask )
|
||||||
|
status = OnlineStatus::RolePlaying;
|
||||||
|
|
||||||
if( hasStateFlag( PlayerStateFlag::WatchingCutscene ) || hasStateFlag( PlayerStateFlag::WatchingCutscene1 ) )
|
if( hasStateFlag( PlayerStateFlag::WatchingCutscene ) || hasStateFlag( PlayerStateFlag::WatchingCutscene1 ) )
|
||||||
status = OnlineStatus::Cutscene;
|
status = OnlineStatus::Cutscene;
|
||||||
|
|
||||||
|
|
115
src/servers/Server_Zone/SkillHandler.cpp
Normal file
115
src/servers/Server_Zone/SkillHandler.cpp
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
#include <Server_Common/Common.h>
|
||||||
|
#include <Server_Common/CommonNetwork.h>
|
||||||
|
#include <Server_Common/Database.h>
|
||||||
|
#include <Server_Common/GamePacketNew.h>
|
||||||
|
#include <Server_Common/PacketContainer.h>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameConnection.h"
|
||||||
|
|
||||||
|
#include "Session.h"
|
||||||
|
#include "Zone.h"
|
||||||
|
#include "ZonePosition.h"
|
||||||
|
|
||||||
|
#include "InitUIPacket.h"
|
||||||
|
#include "PingPacket.h"
|
||||||
|
#include "MoveActorPacket.h"
|
||||||
|
#include "ChatPacket.h"
|
||||||
|
#include "ServerNoticePacket.h"
|
||||||
|
#include "ActorControlPacket142.h"
|
||||||
|
#include "ActorControlPacket143.h"
|
||||||
|
#include "ActorControlPacket144.h"
|
||||||
|
#include "EventStartPacket.h"
|
||||||
|
#include "EventFinishPacket.h"
|
||||||
|
#include "PlayerStateFlagsPacket.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameCommandHandler.h"
|
||||||
|
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Inventory.h"
|
||||||
|
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
#include "EventHelper.h"
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include "ActionTeleport.h"
|
||||||
|
#include "ActionCast.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern Core::GameCommandHandler g_gameCommandMgr;
|
||||||
|
|
||||||
|
using namespace Core::Common;
|
||||||
|
using namespace Core::Network::Packets;
|
||||||
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
|
void Core::Network::GameConnection::skillHandler( Core::Network::Packets::GamePacketPtr pInPacket,
|
||||||
|
Core::Entity::PlayerPtr pPlayer )
|
||||||
|
{
|
||||||
|
|
||||||
|
uint32_t action = pInPacket->getValAt< uint32_t >( 0x24 );
|
||||||
|
uint32_t useCount = pInPacket->getValAt< uint32_t >( 0x28 );
|
||||||
|
|
||||||
|
uint64_t targetId = pInPacket->getValAt< uint64_t >( 0x30 );
|
||||||
|
|
||||||
|
if( action < 1000000 ) // normal action
|
||||||
|
{
|
||||||
|
std::string actionIdStr = boost::str( boost::format( "%|04X|" ) % action );
|
||||||
|
pPlayer->sendDebug( "---------------------------------------" );
|
||||||
|
pPlayer->sendDebug( "ActionHandler ( " + actionIdStr + " | " + g_exdData.m_actionInfoMap[action].name + " | " + std::to_string( targetId ) + " )" );
|
||||||
|
|
||||||
|
pPlayer->queuePacket( ActorControlPacket142( pPlayer->getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||||
|
|
||||||
|
if( action == 5 )
|
||||||
|
{
|
||||||
|
auto currentAction = pPlayer->getCurrentAction();
|
||||||
|
|
||||||
|
// we should always have an action here, if not there is a bug
|
||||||
|
assert( currentAction );
|
||||||
|
currentAction->onStart();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Core::Entity::ActorPtr targetActor = pPlayer;
|
||||||
|
if( targetId != pPlayer->getId() )
|
||||||
|
{
|
||||||
|
targetActor = pPlayer->lookupTargetById( targetId );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !pPlayer->actionHasCastTime( action ) )
|
||||||
|
{
|
||||||
|
g_scriptMgr.onCastFinish( pPlayer, targetActor, action );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Action::ActionCastPtr pActionCast( new Action::ActionCast( pPlayer, targetActor, action ) );
|
||||||
|
pPlayer->setCurrentAction( pActionCast );
|
||||||
|
pPlayer->sendDebug( "setCurrentAction()" );
|
||||||
|
pPlayer->getCurrentAction()->onStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( action < 2000000 ) // craft action
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if( action < 3000000 ) // item action
|
||||||
|
{
|
||||||
|
auto info = g_exdData.getEventItemInfo( action );
|
||||||
|
if( info )
|
||||||
|
{
|
||||||
|
g_log.debug( info->name );
|
||||||
|
g_scriptMgr.onEventItem( pPlayer, action, info->eventId, info->castTime, targetId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( action > 3000000 ) // unknown
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue