mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-23 18:17:46 +00:00
Implement CFPenaltyTime
This commit is contained in:
parent
a730ef37aa
commit
f3efd6d086
11 changed files with 136 additions and 50 deletions
|
@ -77,6 +77,7 @@ CREATE TABLE charadetail (
|
||||||
`ContentRetryTime` blob,
|
`ContentRetryTime` blob,
|
||||||
`ContentJoinTime` int(10) DEFAULT NULL,
|
`ContentJoinTime` int(10) DEFAULT NULL,
|
||||||
`ContentClearFlag` blob,
|
`ContentClearFlag` blob,
|
||||||
|
`CFPenaltyUntil` int unsigned NOT NULL DEFAULT '0',
|
||||||
`TownWarpFstFlags` binary(2) DEFAULT NULL,
|
`TownWarpFstFlags` binary(2) DEFAULT NULL,
|
||||||
`PathId` int(10) DEFAULT NULL,
|
`PathId` int(10) DEFAULT NULL,
|
||||||
`StepIndex` int(5) DEFAULT NULL,
|
`StepIndex` int(5) DEFAULT NULL,
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 23b9c0a154a327b25d700cd6857a4e53bed2e8a1
|
|
|
@ -265,7 +265,7 @@ namespace Core {
|
||||||
JOB_ASTROLOGIAN = 33, // astro
|
JOB_ASTROLOGIAN = 33, // astro
|
||||||
JOB_SAMURAI = 34, // sam
|
JOB_SAMURAI = 34, // sam
|
||||||
JOB_REDMAGE = 35, // red mage
|
JOB_REDMAGE = 35, // red mage
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PlayerSyncFlags : uint32_t
|
enum PlayerSyncFlags : uint32_t
|
||||||
|
@ -285,13 +285,15 @@ namespace Core {
|
||||||
HpMp = 0x00000800,
|
HpMp = 0x00000800,
|
||||||
QuestTracker = 0x00001000,
|
QuestTracker = 0x00001000,
|
||||||
NewGame = 0x00002000,
|
NewGame = 0x00002000,
|
||||||
|
// 0x0000400 is missing here
|
||||||
Unlocks = 0x00008000,
|
Unlocks = 0x00008000,
|
||||||
PlayTime = 0x00010000,
|
PlayTime = 0x00010000,
|
||||||
NewAdventurer = 0x00020000,
|
NewAdventurer = 0x00020000,
|
||||||
SearchInfo = 0x00040000,
|
SearchInfo = 0x00040000,
|
||||||
GC = 0x00080000,
|
GC = 0x00080000,
|
||||||
|
|
||||||
|
CFPenaltyTime = 0x00100000,
|
||||||
|
|
||||||
All = 0xFFFFFFFF,
|
All = 0xFFFFFFFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,8 @@ uint64_t Core::Util::getTimeMs()
|
||||||
|
|
||||||
uint64_t Core::Util::getTimeSeconds()
|
uint64_t Core::Util::getTimeSeconds()
|
||||||
{
|
{
|
||||||
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
|
std::chrono::seconds epoch = std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::now().time_since_epoch());
|
||||||
auto now = std::chrono::time_point_cast< std::chrono::seconds >( t1 ).time_since_epoch().count();
|
return epoch.count();
|
||||||
return now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Core::Util::getEorzeanTimeStamp()
|
uint64_t Core::Util::getEorzeanTimeStamp()
|
||||||
|
|
0
src/servers/Server_Zone/ContentFinder.cpp
Normal file
0
src/servers/Server_Zone/ContentFinder.cpp
Normal file
12
src/servers/Server_Zone/ContentFinder.h
Normal file
12
src/servers/Server_Zone/ContentFinder.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _CONTENTFINDER_H
|
||||||
|
#define _CONTENTFINDER_H
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class ContentFinder {
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -79,7 +79,7 @@ void Core::GameCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr
|
||||||
// no parameters, just get the command
|
// no parameters, just get the command
|
||||||
commandString = tmpCommand;
|
commandString = tmpCommand;
|
||||||
|
|
||||||
// try to retrieve the command
|
// try to retrieve the command
|
||||||
auto it = m_commandMap.find( commandString );
|
auto it = m_commandMap.find( commandString );
|
||||||
|
|
||||||
if( it == m_commandMap.end() )
|
if( it == m_commandMap.end() )
|
||||||
|
@ -237,7 +237,6 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
|
||||||
g_database.execute( query2.c_str() );
|
g_database.execute( query2.c_str() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( subCommand == "discovery_reset" )
|
else if( subCommand == "discovery_reset" )
|
||||||
{
|
{
|
||||||
pPlayer->resetDiscovery();
|
pPlayer->resetDiscovery();
|
||||||
|
@ -257,6 +256,13 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
|
||||||
else
|
else
|
||||||
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
||||||
}
|
}
|
||||||
|
else if( subCommand == "cfpenalty")
|
||||||
|
{
|
||||||
|
uint32_t minutes;
|
||||||
|
sscanf( params.c_str(), "%d", &minutes );
|
||||||
|
|
||||||
|
pPlayer->setPenaltyMinutes( minutes );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -411,7 +417,7 @@ void Core::GameCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer
|
||||||
sscanf( params.c_str(), "%x %x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId );
|
sscanf( params.c_str(), "%x %x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId );
|
||||||
|
|
||||||
pPlayer->sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
pPlayer->sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||||
|
|
||||||
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, pPlayer->getId() );
|
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, pPlayer->getId() );
|
||||||
actorControl.data().category = opcode;
|
actorControl.data().category = opcode;
|
||||||
actorControl.data().param1 = param1;
|
actorControl.data().param1 = param1;
|
||||||
|
|
|
@ -164,7 +164,7 @@ void Core::Network::GameConnection::gm1Handler( Core::Network::Packets::GamePack
|
||||||
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 ) );
|
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;
|
Core::Entity::ActorPtr targetActor;
|
||||||
|
|
||||||
|
|
||||||
if( pPlayer->getId() == param3 )
|
if( pPlayer->getId() == param3 )
|
||||||
{
|
{
|
||||||
|
@ -311,23 +311,23 @@ void Core::Network::GameConnection::gm1Handler( Core::Network::Packets::GamePack
|
||||||
case GmCommand::Weather:
|
case GmCommand::Weather:
|
||||||
{
|
{
|
||||||
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
|
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
|
||||||
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
||||||
targetPlayer->getName() + " set in range." );
|
targetPlayer->getName() + " set in range." );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GmCommand::TeriInfo:
|
case GmCommand::TeriInfo:
|
||||||
{
|
{
|
||||||
pPlayer->sendNotice( "ZoneId: " + std::to_string( pPlayer->getZoneId() ) + "\nName: " +
|
pPlayer->sendNotice( "ZoneId: " + std::to_string( pPlayer->getZoneId() ) + "\nName: " +
|
||||||
pPlayer->getCurrentZone()->getName() + "\nInternalName: " +
|
pPlayer->getCurrentZone()->getName() + "\nInternalName: " +
|
||||||
pPlayer->getCurrentZone()->getInternalName() + "\nPopCount: " +
|
pPlayer->getCurrentZone()->getInternalName() + "\nPopCount: " +
|
||||||
std::to_string( pPlayer->getCurrentZone()->getPopCount() ) +
|
std::to_string( pPlayer->getCurrentZone()->getPopCount() ) +
|
||||||
"\nCurrentWeather:" + std::to_string( pPlayer->getCurrentZone()->getCurrentWeather() ) +
|
"\nCurrentWeather:" + std::to_string( pPlayer->getCurrentZone()->getCurrentWeather() ) +
|
||||||
"\nNextWeather:" + std::to_string( pPlayer->getCurrentZone()->getNextWeather() ) );
|
"\nNextWeather:" + std::to_string( pPlayer->getCurrentZone()->getNextWeather() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GmCommand::Jump:
|
case GmCommand::Jump:
|
||||||
{
|
{
|
||||||
|
|
||||||
auto inRange = pPlayer->getInRangeActors();
|
auto inRange = pPlayer->getInRangeActors();
|
||||||
for( auto actor : inRange )
|
for( auto actor : inRange )
|
||||||
{
|
{
|
||||||
|
@ -340,7 +340,7 @@ void Core::Network::GameConnection::gm1Handler( Core::Network::Packets::GamePack
|
||||||
case GmCommand::Collect:
|
case GmCommand::Collect:
|
||||||
{
|
{
|
||||||
uint32_t gil = targetPlayer->getCurrency( 1 );
|
uint32_t gil = targetPlayer->getCurrency( 1 );
|
||||||
|
|
||||||
if( gil < param1 )
|
if( gil < param1 )
|
||||||
{
|
{
|
||||||
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
||||||
|
@ -418,7 +418,7 @@ void Core::Network::GameConnection::gm2Handler( Core::Network::Packets::GamePack
|
||||||
{
|
{
|
||||||
targetActor = pPlayer;
|
targetActor = pPlayer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pPlayer->sendUrgent("Player " + param1 + " not found on this server.");
|
pPlayer->sendUrgent("Player " + param1 + " not found on this server.");
|
||||||
return;
|
return;
|
||||||
|
@ -468,12 +468,12 @@ void Core::Network::GameConnection::gm2Handler( Core::Network::Packets::GamePack
|
||||||
case GmCommand::Inspect:
|
case GmCommand::Inspect:
|
||||||
{
|
{
|
||||||
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
|
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
|
||||||
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
|
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
|
||||||
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
|
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
|
||||||
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
|
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
|
||||||
"\nClass: " + std::to_string( targetPlayer->getClass() ) +
|
"\nClass: " + std::to_string( targetPlayer->getClass() ) +
|
||||||
"\nLevel: " + std::to_string( targetPlayer->getLevel() ) +
|
"\nLevel: " + std::to_string( targetPlayer->getLevel() ) +
|
||||||
"\nExp: " + std::to_string( targetPlayer->getExp() ) +
|
"\nExp: " + std::to_string( targetPlayer->getExp() ) +
|
||||||
"\nSearchMessage: " + targetPlayer->getSearchMessage() +
|
"\nSearchMessage: " + targetPlayer->getSearchMessage() +
|
||||||
"\nPlayTime: " + std::to_string( targetPlayer->getPlayTime() ) );
|
"\nPlayTime: " + std::to_string( targetPlayer->getPlayTime() ) );
|
||||||
break;
|
break;
|
||||||
|
@ -751,7 +751,7 @@ void Core::Network::GameConnection::inventoryModifyHandler( Core::Network::Packe
|
||||||
ackPacket.data().sequence = seq;
|
ackPacket.data().sequence = seq;
|
||||||
ackPacket.data().type = 7;
|
ackPacket.data().type = 7;
|
||||||
pPlayer->queuePacket( ackPacket );
|
pPlayer->queuePacket( ackPacket );
|
||||||
|
|
||||||
|
|
||||||
g_log.debug( pInPacket->toString() );
|
g_log.debug( pInPacket->toString() );
|
||||||
g_log.debug( "InventoryAction: " + std::to_string( action ) );
|
g_log.debug( "InventoryAction: " + std::to_string( action ) );
|
||||||
|
@ -881,10 +881,10 @@ void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GameP
|
||||||
{
|
{
|
||||||
switch( pPlayer->getZoningType() )
|
switch( pPlayer->getZoningType() )
|
||||||
{
|
{
|
||||||
case ZoneingType::None:
|
case ZoneingType::None:
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01 ), true );
|
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01 ), true );
|
||||||
break;
|
break;
|
||||||
case ZoneingType::Teleport:
|
case ZoneingType::Teleport:
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||||
break;
|
break;
|
||||||
case ZoneingType::Return:
|
case ZoneingType::Return:
|
||||||
|
@ -905,10 +905,10 @@ void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GameP
|
||||||
break;
|
break;
|
||||||
case ZoneingType::FadeIn:
|
case ZoneingType::FadeIn:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayer->setZoningType( Common::ZoneingType::None );
|
pPlayer->setZoningType( Common::ZoneingType::None );
|
||||||
|
|
||||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||||
|
@ -921,7 +921,7 @@ void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GameP
|
||||||
{
|
{
|
||||||
// TODO: only register this action if enough gil is in possession
|
// TODO: only register this action if enough gil is in possession
|
||||||
auto targetAetheryte = g_exdData.getAetheryteInfo( param11 );
|
auto targetAetheryte = g_exdData.getAetheryteInfo( param11 );
|
||||||
|
|
||||||
if( targetAetheryte )
|
if( targetAetheryte )
|
||||||
{
|
{
|
||||||
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index );
|
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index );
|
||||||
|
@ -1170,6 +1170,15 @@ void Core::Network::GameConnection::cfDutyInfoRequest(Core::Network::Packets::Ga
|
||||||
Core::Entity::PlayerPtr pPlayer)
|
Core::Entity::PlayerPtr pPlayer)
|
||||||
{
|
{
|
||||||
GamePacketNew< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
|
GamePacketNew< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
|
||||||
|
|
||||||
|
auto penaltyMinutes = pPlayer->getPenaltyMinutes();
|
||||||
|
if (penaltyMinutes > 255)
|
||||||
|
{
|
||||||
|
// cap it since it's uint8_t in packets
|
||||||
|
penaltyMinutes = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
dutyInfoPacket.data().penaltyTime = penaltyMinutes;
|
||||||
queueOutPacket( dutyInfoPacket );
|
queueOutPacket( dutyInfoPacket );
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
|
GamePacketNew< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
|
||||||
|
|
|
@ -86,6 +86,9 @@ Core::Entity::Player::Player() :
|
||||||
memset( m_name, 0, sizeof( m_name ) );
|
memset( m_name, 0, sizeof( m_name ) );
|
||||||
memset( m_stateFlags, 0, sizeof( m_stateFlags ) );
|
memset( m_stateFlags, 0, sizeof( m_stateFlags ) );
|
||||||
memset( m_searchMessage, 0, sizeof( m_searchMessage ) );
|
memset( m_searchMessage, 0, sizeof( m_searchMessage ) );
|
||||||
|
|
||||||
|
// content finder
|
||||||
|
m_cfPenaltyUntil = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Entity::Player::~Player()
|
Core::Entity::Player::~Player()
|
||||||
|
@ -190,7 +193,7 @@ void Core::Entity::Player::calculateStats()
|
||||||
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( level );
|
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( level );
|
||||||
|
|
||||||
if( tribeInfoIt == g_exdData.m_tribeInfoMap.end() ||
|
if( tribeInfoIt == g_exdData.m_tribeInfoMap.end() ||
|
||||||
classInfoIt == g_exdData.m_classJobInfoMap.end() ||
|
classInfoIt == g_exdData.m_classJobInfoMap.end() ||
|
||||||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end() )
|
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -200,7 +203,7 @@ void Core::Entity::Player::calculateStats()
|
||||||
|
|
||||||
// TODO: put formula somewhere else...
|
// TODO: put formula somewhere else...
|
||||||
float base = 0.0f;
|
float base = 0.0f;
|
||||||
|
|
||||||
if( level < 51 )
|
if( level < 51 )
|
||||||
base = 0.053f * ( level * level ) + ( 1.022f * level ) - 0.907f + 20;
|
base = 0.053f * ( level * level ) + ( 1.022f * level ) - 0.907f + 20;
|
||||||
else
|
else
|
||||||
|
@ -220,11 +223,11 @@ void Core::Entity::Player::calculateStats()
|
||||||
m_baseStats.attackPotMagic = paramGrowthInfo.base_secondary;
|
m_baseStats.attackPotMagic = paramGrowthInfo.base_secondary;
|
||||||
m_baseStats.healingPotMagic = paramGrowthInfo.base_secondary;
|
m_baseStats.healingPotMagic = paramGrowthInfo.base_secondary;
|
||||||
|
|
||||||
m_baseStats.max_mp = floor(
|
m_baseStats.max_mp = floor(
|
||||||
floor(
|
floor(
|
||||||
( ( m_baseStats.pie - base ) * ( static_cast< float >( paramGrowthInfo.piety_scalar ) / 100 ) ) + paramGrowthInfo.mp_const ) * ( static_cast< float >( classInfo.mod_mpcpgp ) / 100 )
|
( ( m_baseStats.pie - base ) * ( static_cast< float >( paramGrowthInfo.piety_scalar ) / 100 ) ) + paramGrowthInfo.mp_const ) * ( static_cast< float >( classInfo.mod_mpcpgp ) / 100 )
|
||||||
);
|
);
|
||||||
|
|
||||||
m_baseStats.max_hp = floor(
|
m_baseStats.max_hp = floor(
|
||||||
floor(
|
floor(
|
||||||
( ( m_baseStats.vit - base ) * ( ( static_cast< float >( paramGrowthInfo.piety_scalar ) ) / 100 ) ) + paramGrowthInfo.hp_mod ) * ( static_cast< float >( classInfo.mod_hp * 0.9f ) / 100 ) * 15
|
( ( m_baseStats.vit - base ) * ( ( static_cast< float >( paramGrowthInfo.piety_scalar ) ) / 100 ) ) + paramGrowthInfo.hp_mod ) * ( static_cast< float >( classInfo.mod_hp * 0.9f ) / 100 ) * 15
|
||||||
|
@ -305,7 +308,7 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
pos = z_pos->getTargetPosition();
|
pos = z_pos->getTargetPosition();
|
||||||
rot = z_pos->getTargetRotation();
|
rot = z_pos->getTargetRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sendDebug( "Teleport: " + data->placename + " " + data->placename_aethernet +
|
sendDebug( "Teleport: " + data->placename + " " + data->placename_aethernet +
|
||||||
"(" + std::to_string( data->levelId ) + ")" );
|
"(" + std::to_string( data->levelId ) + ")" );
|
||||||
|
@ -380,7 +383,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
|
||||||
|
|
||||||
sendInventory();
|
sendInventory();
|
||||||
|
|
||||||
// set flags, will be reset automatically by zoning ( only on client side though )
|
// set flags, will be reset automatically by zoning ( only on client side though )
|
||||||
pPlayer->setStateFlag( PlayerStateFlag::BetweenAreas );
|
pPlayer->setStateFlag( PlayerStateFlag::BetweenAreas );
|
||||||
pPlayer->setStateFlag( PlayerStateFlag::BetweenAreas1 );
|
pPlayer->setStateFlag( PlayerStateFlag::BetweenAreas1 );
|
||||||
pPlayer->sendStateFlags();
|
pPlayer->sendStateFlags();
|
||||||
|
@ -518,7 +521,7 @@ void Core::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
||||||
// map.exd field 12 -> index in one of the two discovery sections, if field 15 is false, need to use 2nd section
|
// map.exd field 12 -> index in one of the two discovery sections, if field 15 is false, need to use 2nd section
|
||||||
// section 1 starts at 4 - 2 bytes each
|
// section 1 starts at 4 - 2 bytes each
|
||||||
|
|
||||||
// section to starts at 320 - 4 bytes long
|
// section to starts at 320 - 4 bytes long
|
||||||
|
|
||||||
int32_t offset = 4;
|
int32_t offset = 4;
|
||||||
|
|
||||||
|
@ -810,7 +813,7 @@ void Core::Entity::Player::eventActionStart( uint32_t eventId,
|
||||||
|
|
||||||
setCurrentAction( pEventAction );
|
setCurrentAction( pEventAction );
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
|
|
||||||
if( !pEvent && getEventCount() )
|
if( !pEvent && getEventCount() )
|
||||||
{
|
{
|
||||||
// We're trying to play a nested event, need to start it first.
|
// We're trying to play a nested event, need to start it first.
|
||||||
|
@ -1096,7 +1099,7 @@ void Core::Entity::Player::update( int64_t currTime )
|
||||||
|
|
||||||
for( auto actor : m_inRangeActors )
|
for( auto actor : m_inRangeActors )
|
||||||
{
|
{
|
||||||
if( isAutoattackOn() &&
|
if( isAutoattackOn() &&
|
||||||
actor->getId() == m_targetId &&
|
actor->getId() == m_targetId &&
|
||||||
actor->isAlive() &&
|
actor->isAlive() &&
|
||||||
mainWeap &&
|
mainWeap &&
|
||||||
|
@ -1452,7 +1455,7 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
|
||||||
//uint64_t tick = Util::getTimeMs();
|
//uint64_t tick = Util::getTimeMs();
|
||||||
//srand(static_cast< uint32_t >(tick));
|
//srand(static_cast< uint32_t >(tick));
|
||||||
|
|
||||||
uint32_t damage = mainWeap->getAutoAttackDmg() + rand() % 12;
|
uint32_t damage = mainWeap->getAutoAttackDmg() + rand() % 12;
|
||||||
uint32_t variation = 0 + rand() % 3;
|
uint32_t variation = 0 + rand() % 3;
|
||||||
|
|
||||||
if( getClass() == 5 || getClass() == 23 || getClass() == 31 )
|
if( getClass() == 5 || getClass() == 23 || getClass() == 31 )
|
||||||
|
@ -1497,5 +1500,41 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
|
||||||
}
|
}
|
||||||
|
|
||||||
pTarget->takeDamage(damage);
|
pTarget->takeDamage(damage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Content Finder
|
||||||
|
/////////////////////////////
|
||||||
|
uint32_t Core::Entity::Player::getPenaltyTimestamp() const
|
||||||
|
{
|
||||||
|
return m_cfPenaltyUntil;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::setPenaltyTimestamp( uint32_t timestamp )
|
||||||
|
{
|
||||||
|
m_cfPenaltyUntil = timestamp;
|
||||||
|
setSyncFlag( PlayerSyncFlags::CFPenaltyTime );
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Core::Entity::Player::getPenaltyMinutes() const
|
||||||
|
{
|
||||||
|
auto currentTimestamp = Core::Util::getTimeSeconds();
|
||||||
|
auto endTimestamp = getPenaltyTimestamp();
|
||||||
|
|
||||||
|
// check if penalty timestamp already passed current time
|
||||||
|
if (currentTimestamp > endTimestamp)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto deltaTime = endTimestamp - currentTimestamp;
|
||||||
|
return ceil(static_cast< float > (deltaTime) / 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::setPenaltyMinutes( uint32_t minutes )
|
||||||
|
{
|
||||||
|
auto currentTimestamp = Core::Util::getTimeSeconds();
|
||||||
|
setPenaltyTimestamp(currentTimestamp + minutes * 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
|
|
||||||
void checkEvent( uint32_t eventId );
|
void checkEvent( uint32_t eventId );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -482,6 +482,14 @@ public:
|
||||||
void setAutoattack( bool mode );
|
void setAutoattack( bool mode );
|
||||||
bool isAutoattackOn() const;
|
bool isAutoattackOn() const;
|
||||||
|
|
||||||
|
// Player Content Finder Handling
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
uint32_t getPenaltyTimestamp() const;
|
||||||
|
void setPenaltyTimestamp( uint32_t timestamp );
|
||||||
|
|
||||||
|
uint32_t getPenaltyMinutes() const;
|
||||||
|
void setPenaltyMinutes( uint32_t minutes );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_lastWrite;
|
uint32_t m_lastWrite;
|
||||||
uint32_t m_lastPing;
|
uint32_t m_lastPing;
|
||||||
|
@ -581,7 +589,7 @@ private:
|
||||||
bool m_bAutoattack;
|
bool m_bAutoattack;
|
||||||
|
|
||||||
Common::ZoneingType m_zoningType;
|
Common::ZoneingType m_zoningType;
|
||||||
|
|
||||||
bool m_bMarkedForZoning;
|
bool m_bMarkedForZoning;
|
||||||
uint32_t m_updateFlags;
|
uint32_t m_updateFlags;
|
||||||
bool m_bNewAdventurer;
|
bool m_bNewAdventurer;
|
||||||
|
@ -597,6 +605,8 @@ private:
|
||||||
uint8_t m_gc;
|
uint8_t m_gc;
|
||||||
uint8_t m_gcRank[3];
|
uint8_t m_gcRank[3];
|
||||||
|
|
||||||
|
// content finder info
|
||||||
|
uint32_t m_cfPenaltyUntil;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
// TODO: can't help but think that the whole player loading could be handled better...
|
// TODO: can't help but think that the whole player loading could be handled better...
|
||||||
const std::string char_id_str = std::to_string( charId );
|
const std::string char_id_str = std::to_string( charId );
|
||||||
|
|
||||||
auto pQR = g_database.query( "SELECT c.Name, "
|
auto pQR = g_database.query( "SELECT "
|
||||||
|
"c.Name, "
|
||||||
"c.PrimaryTerritoryId, "
|
"c.PrimaryTerritoryId, "
|
||||||
"c.Hp, "
|
"c.Hp, "
|
||||||
"c.Mp, "
|
"c.Mp, "
|
||||||
|
@ -53,7 +54,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
"c.Pos_0_1, "
|
"c.Pos_0_1, "
|
||||||
"c.Pos_0_2, "
|
"c.Pos_0_2, "
|
||||||
"c.Pos_0_3, "
|
"c.Pos_0_3, "
|
||||||
"c.FirstLogin, "
|
"c.FirstLogin, " // 10
|
||||||
"c.Customize, "
|
"c.Customize, "
|
||||||
"c.ModelMainWeapon, "
|
"c.ModelMainWeapon, "
|
||||||
"c.ModelSubWeapon, "
|
"c.ModelSubWeapon, "
|
||||||
|
@ -63,7 +64,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
"cd.BirthMonth, "
|
"cd.BirthMonth, "
|
||||||
"cd.Status, "
|
"cd.Status, "
|
||||||
"cd.Class, "
|
"cd.Class, "
|
||||||
"cd.Homepoint, "
|
"cd.Homepoint, " // 20
|
||||||
"cd.HowTo, "
|
"cd.HowTo, "
|
||||||
"c.ContentId, "
|
"c.ContentId, "
|
||||||
"c.Voice, "
|
"c.Voice, "
|
||||||
|
@ -73,11 +74,12 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
"cd.Aetheryte, "
|
"cd.Aetheryte, "
|
||||||
"cd.unlocks, "
|
"cd.unlocks, "
|
||||||
"cd.Discovery, "
|
"cd.Discovery, "
|
||||||
"cd.StartTown, "
|
"cd.StartTown, " // 30
|
||||||
"cd.TotalPlayTime, "
|
"cd.TotalPlayTime, "
|
||||||
"c.IsNewAdventurer, "
|
"c.IsNewAdventurer, "
|
||||||
"cd.GrandCompany, "
|
"cd.GrandCompany, "
|
||||||
"cd.GrandCompanyRank "
|
"cd.GrandCompanyRank, "
|
||||||
|
"cd.CFPenaltyUntil "
|
||||||
"FROM charabase AS c "
|
"FROM charabase AS c "
|
||||||
" INNER JOIN charadetail AS cd "
|
" INNER JOIN charadetail AS cd "
|
||||||
" ON c.CharacterId = cd.CharacterId "
|
" ON c.CharacterId = cd.CharacterId "
|
||||||
|
@ -166,6 +168,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
m_gc = field[33].getUInt8();
|
m_gc = field[33].getUInt8();
|
||||||
field[34].getBinary( reinterpret_cast< char* >( m_gcRank ), 3 );
|
field[34].getBinary( reinterpret_cast< char* >( m_gcRank ), 3 );
|
||||||
|
|
||||||
|
m_cfPenaltyUntil = field[35].getUInt32();
|
||||||
|
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
|
||||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
||||||
|
@ -388,6 +392,11 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
charaInfoSearchSet.insert( " SearchComment = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_searchMessage ), sizeof( m_searchMessage ) ) + "')" ) );
|
charaInfoSearchSet.insert( " SearchComment = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_searchMessage ), sizeof( m_searchMessage ) ) + "')" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_updateFlags & PlayerSyncFlags::CFPenaltyTime )
|
||||||
|
{
|
||||||
|
charaDetailSet.insert( " CFPenaltyUntil = " + std::to_string( m_cfPenaltyUntil ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( !charaInfoSearchSet.empty() )
|
if( !charaInfoSearchSet.empty() )
|
||||||
{
|
{
|
||||||
for( auto entry : charaInfoSearchSet )
|
for( auto entry : charaInfoSearchSet )
|
||||||
|
|
Loading…
Add table
Reference in a new issue