1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00

Merge pull request #234 from goaaats/exd_rework

zone, api: Removed old EXD reader
This commit is contained in:
Mordred 2018-02-01 17:49:35 +01:00 committed by GitHub
commit 7a23d24336
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 288 additions and 211 deletions

View file

@ -735,7 +735,9 @@
name = exdData->getField< std::string >( row, 0 );
abbreviation = exdData->getField< std::string >( row, 1 );
classJobCategory = exdData->getField< uint8_t >( row, 3 );
expArrayIndex = exdData->getField< int8_t >( row, 4 );
modifierHitPoints = exdData->getField< uint16_t >( row, 9 );
modifierManaPoints = exdData->getField< uint16_t >( row, 10 );
modifierStrength = exdData->getField< uint16_t >( row, 11 );
modifierVitality = exdData->getField< uint16_t >( row, 12 );
modifierDexterity = exdData->getField< uint16_t >( row, 13 );
@ -2380,7 +2382,9 @@
placeNameRegion = exdData->getField< uint16_t >( row, 9 );
placeName = exdData->getField< uint16_t >( row, 10 );
placeNameSub = exdData->getField< uint16_t >( row, 11 );
discoveryIndex = exdData->getField< int16_t >( row, 12 );
territoryType = exdData->getField< uint16_t >( row, 14 );
discoveryArrayByte = exdData->getField< bool >( row, 15 );
}
Core::Data::MapMarker::MapMarker( uint32_t row_id, Core::Data::ExdDataGenerated* exdData )
@ -2571,6 +2575,12 @@
icon = exdData->getField< uint32_t >( row, 4 );
}
Core::Data::Opening::Opening( uint32_t row_id, Core::Data::ExdDataGenerated* exdData )
{
auto row = exdData->m_OpeningDat.get_row( row_id );
name = exdData->getField< std::string >( row, 0 );
}
Core::Data::Orchestrion::Orchestrion( uint32_t row_id, Core::Data::ExdDataGenerated* exdData )
{
auto row = exdData->m_OrchestrionDat.get_row( row_id );
@ -3702,6 +3712,10 @@
defaultTalkNPCWin = exdData->getField< uint32_t >( row, 22 );
defaultTalkDraw = exdData->getField< uint32_t >( row, 23 );
defaultTalkPCWin = exdData->getField< uint32_t >( row, 24 );
itemPossibleReward.push_back( exdData->getField< uint32_t >( row, 26 ) );
itemPossibleReward.push_back( exdData->getField< uint32_t >( row, 27 ) );
itemPossibleReward.push_back( exdData->getField< uint32_t >( row, 28 ) );
itemPossibleReward.push_back( exdData->getField< uint32_t >( row, 29 ) );
}
Core::Data::TripleTriadCard::TripleTriadCard( uint32_t row_id, Core::Data::ExdDataGenerated* exdData )
@ -4096,6 +4110,7 @@ bool Core::Data::ExdDataGenerated::init( const std::string& path )
m_NpcEquipDat = setupDatAccess( "NpcEquip", xiv::exd::Language::none );
m_OmenDat = setupDatAccess( "Omen", xiv::exd::Language::none );
m_OnlineStatusDat = setupDatAccess( "OnlineStatus", xiv::exd::Language::en );
m_OpeningDat = setupDatAccess( "Opening", xiv::exd::Language::none );
m_OrchestrionDat = setupDatAccess( "Orchestrion", xiv::exd::Language::en );
m_OrchestrionPathDat = setupDatAccess( "OrchestrionPath", xiv::exd::Language::none );
m_ParamGrowDat = setupDatAccess( "ParamGrow", xiv::exd::Language::none );
@ -7555,6 +7570,21 @@ boost::shared_ptr< Core::Data::OnlineStatus >
}
return nullptr;
}
boost::shared_ptr< Core::Data::Opening >
Core::Data::ExdDataGenerated::getOpening( uint32_t OpeningId )
{
try
{
auto row = m_OpeningDat.get_row( OpeningId );
auto info = boost::make_shared< Opening >( OpeningId, this );
return info;
}
catch( ... )
{
return nullptr;
}
return nullptr;
}
boost::shared_ptr< Core::Data::Orchestrion >
Core::Data::ExdDataGenerated::getOrchestrion( uint32_t OrchestrionId )
{

View file

@ -242,6 +242,7 @@ struct MountAction;
struct NpcEquip;
struct Omen;
struct OnlineStatus;
struct Opening;
struct Orchestrion;
struct OrchestrionPath;
struct ParamGrow;
@ -936,7 +937,9 @@ struct ClassJob
std::string name;
std::string abbreviation;
uint8_t classJobCategory;
int8_t expArrayIndex;
uint16_t modifierHitPoints;
uint16_t modifierManaPoints;
uint16_t modifierStrength;
uint16_t modifierVitality;
uint16_t modifierDexterity;
@ -2425,7 +2428,9 @@ struct Map
uint16_t placeNameRegion;
uint16_t placeName;
uint16_t placeNameSub;
int16_t discoveryIndex;
uint16_t territoryType;
bool discoveryArrayByte;
Map( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );
};
@ -2604,6 +2609,13 @@ struct OnlineStatus
OnlineStatus( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );
};
struct Opening
{
std::string name;
Opening( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );
};
struct Orchestrion
{
std::string name;
@ -3204,6 +3216,7 @@ struct TripleTriad
uint32_t defaultTalkNPCWin;
uint32_t defaultTalkDraw;
uint32_t defaultTalkPCWin;
std::vector< uint32_t > itemPossibleReward;
TripleTriad( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );
};
@ -3607,6 +3620,7 @@ struct WorldDCGroupType
xiv::exd::Exd m_NpcEquipDat;
xiv::exd::Exd m_OmenDat;
xiv::exd::Exd m_OnlineStatusDat;
xiv::exd::Exd m_OpeningDat;
xiv::exd::Exd m_OrchestrionDat;
xiv::exd::Exd m_OrchestrionPathDat;
xiv::exd::Exd m_ParamGrowDat;
@ -3906,6 +3920,7 @@ struct WorldDCGroupType
boost::shared_ptr< NpcEquip > getNpcEquip( uint32_t NpcEquipId );
boost::shared_ptr< Omen > getOmen( uint32_t OmenId );
boost::shared_ptr< OnlineStatus > getOnlineStatus( uint32_t OnlineStatusId );
boost::shared_ptr< Opening > getOpening( uint32_t OpeningId );
boost::shared_ptr< Orchestrion > getOrchestrion( uint32_t OrchestrionId );
boost::shared_ptr< OrchestrionPath > getOrchestrionPath( uint32_t OrchestrionPathId );
boost::shared_ptr< ParamGrow > getParamGrow( uint32_t ParamGrowId );
@ -4205,6 +4220,7 @@ struct WorldDCGroupType
std::set< uint32_t > m_NpcEquipIdList;
std::set< uint32_t > m_OmenIdList;
std::set< uint32_t > m_OnlineStatusIdList;
std::set< uint32_t > m_OpeningIdList;
std::set< uint32_t > m_OrchestrionIdList;
std::set< uint32_t > m_OrchestrionPathIdList;
std::set< uint32_t > m_ParamGrowIdList;
@ -5629,6 +5645,12 @@ const std::set< uint32_t >& getOnlineStatusIdList()
loadIdList( m_OnlineStatusDat, m_OnlineStatusIdList );
return m_OnlineStatusIdList;
}
const std::set< uint32_t >& getOpeningIdList()
{
if( m_OpeningIdList.size() == 0 )
loadIdList( m_OpeningDat, m_OpeningIdList );
return m_OpeningIdList;
}
const std::set< uint32_t >& getOrchestrionIdList()
{
if( m_OrchestrionIdList.size() == 0 )

View file

@ -2,11 +2,11 @@
#include <common/Util/Util.h>
#include <common/Common.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Database/DatabaseDef.h>
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
namespace Core {
@ -220,7 +220,7 @@ namespace Core {
// CharacterId, ClassIdx, Exp, Lvl
auto stmtClass = g_charaDb.getPreparedStatement( Db::CharaDbStatements::CHARA_CLASS_INS );
stmtClass->setInt( 1, m_id );
stmtClass->setInt( 2, g_exdData.m_classJobInfoMap[m_class].exp_idx );
stmtClass->setInt( 2, g_exdDataGen.getClassJob( m_class )->expArrayIndex );
stmtClass->setInt( 3, 0 );
stmtClass->setInt( 4, 1 );
g_charaDb.directExecute( stmtClass );
@ -292,14 +292,14 @@ namespace Core {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SETUP EQUIPMENT / STARTING GEAR
auto classJobInfo = g_exdData.m_classJobInfoMap[m_class];
uint32_t weaponId = classJobInfo.start_weapon_id;
auto classJobInfo = g_exdDataGen.getClassJob( m_class );
uint32_t weaponId = classJobInfo->itemStartingWeapon;
uint64_t uniqueId = getNextUId64();
uint8_t race = customize[CharaLook::Race];
uint8_t gender = customize[CharaLook::Gender];
auto raceInfo = g_exdData.getRaceInfo( race );
auto raceInfo = g_exdDataGen.getRace( race );
uint32_t body;
uint32_t hands;
@ -312,17 +312,17 @@ namespace Core {
if( gender == 0 )
{
body = raceInfo->male_body;
hands = raceInfo->male_hands;
legs = raceInfo->male_legs;
feet = raceInfo->male_feet;
body = raceInfo->rSEMBody;
hands = raceInfo->rSEMHands;
legs = raceInfo->rSEMLegs;
feet = raceInfo->rSEMFeet;
}
else
{
body = raceInfo->female_body;
hands = raceInfo->female_hands;
legs = raceInfo->female_legs;
feet = raceInfo->female_feet;
body = raceInfo->rSEFBody;
hands = raceInfo->rSEFHands;
legs = raceInfo->rSEFLegs;
feet = raceInfo->rSEFFeet;
}
insertDbGlobalItem( weaponId, uniqueId );

View file

@ -13,7 +13,7 @@
#include <common/Network/Hive.h>
#include <common/Network/Acceptor.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Crypt/base64.h>
#include <common/Database/DbLoader.h>
@ -35,7 +35,7 @@
Core::Logger g_log;
Core::Db::DbWorkerPool< Core::Db::CharaDbConnection > g_charaDb;
Core::Data::ExdData g_exdData;
Core::Data::ExdDataGenerated g_exdDataGen;
Core::Network::SapphireAPI g_sapphireAPI;
using namespace std;
@ -139,10 +139,10 @@ bool loadSettings( int32_t argc, char* argv[] )
}
}
g_log.info( "Setting up EXD data" );
if( !g_exdData.init( m_pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
g_log.info( "Setting up generated EXD data" );
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
{
g_log.fatal( "Error setting up EXD data " );
g_log.fatal( "Error setting up generated EXD data " );
return false;
}
@ -241,10 +241,10 @@ std::string buildHttpResponse( uint16_t rCode, const std::string& content = "",
void getZoneName( shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request )
{
string number = request->path_match[1];
auto it = g_exdData.m_zoneInfoMap.find( atoi( number.c_str() ) );
auto info = g_exdDataGen.getTerritoryType( atoi( number.c_str() ) );
std::string responseStr = "Not found!";
if( it != g_exdData.m_zoneInfoMap.end() )
responseStr = it->second.zone_name + ", " + it->second.zone_str;
if( info )
responseStr = info->name + ", " + info->bg;
*response << buildHttpResponse( 200, responseStr );
}
@ -751,9 +751,6 @@ int main( int argc, char* argv[] )
if( !loadSettings( argc, argv ) )
throw std::exception();
g_exdData.loadZoneInfo();
g_exdData.loadClassJobInfo();
server.config.port = stoi( m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) );
g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) + "..." );

View file

@ -3,8 +3,8 @@
#include <common/Common.h>
#include <common/Util/Util.h>
#include <common/Util/UtilMath.h>
#include <common/Exd/ExdData.h>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdDataGenerated.h>
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
@ -17,7 +17,7 @@ using namespace Core::Network;
using namespace Core::Network::Packets;
using namespace Core::Network::Packets::Server;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Logger g_log;
extern Core::Scripting::ScriptManager g_scriptMgr;
@ -31,7 +31,7 @@ Core::Action::ActionCast::ActionCast( Entity::ActorPtr pActor, Entity::ActorPtr
m_startTime = 0;
m_id = actionId;
m_handleActionType = HandleActionType::Spell;
m_castTime = g_exdData.getActionInfo( actionId )->cast_time; // TODO: Add security checks.
m_castTime = g_exdDataGen.getAction( actionId )->cast100ms * 100; // TODO: Add security checks.
m_pSource = pActor;
m_pTarget = pTarget;
m_bInterrupt = false;

View file

@ -53,12 +53,12 @@ bool ActionCollision::isActorApplicable( ActorPtr actorPtr, TargetFilter targetF
std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXIVARR_POSITION3 aoePosition,
std::set< ActorPtr > actorsInRange,
boost::shared_ptr< Core::Data::ActionInfo > actionInfo,
boost::shared_ptr< Core::Data::Action > actionInfo,
TargetFilter targetFilter )
{
std::set< ActorPtr > actorsCollided;
switch( static_cast< ActionCollisionType >( actionInfo->aoe_type ) )
switch( static_cast< ActionCollisionType >( actionInfo->castType ) )
{
case ActionCollisionType::None:
case ActionCollisionType::SingleTarget:
@ -75,7 +75,7 @@ std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXI
continue;
// Test our collision from actor with the area generated by the action from the AoE data
if ( radiusCollision( pActor->getPos(), aoePosition, actionInfo->aoe_width ) )
if ( radiusCollision( pActor->getPos(), aoePosition, actionInfo->effectRange ) )
{
// Add it to the actors collided with the area
actorsCollided.insert( pActor );
@ -92,7 +92,7 @@ std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXI
if ( !isActorApplicable( pActor, targetFilter ) )
continue;
if ( radiusCollision( pActor->getPos(), aoePosition, actionInfo->aoe_range ) )
if ( radiusCollision( pActor->getPos(), aoePosition, actionInfo->effectRange ) )
actorsCollided.insert( pActor );
}
break;
@ -106,7 +106,7 @@ std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXI
if ( !isActorApplicable( pActor, targetFilter ) )
continue;
if ( boxCollision( pActor->getPos(), aoePosition, actionInfo->aoe_width, actionInfo->aoe_range ) )
if ( boxCollision( pActor->getPos(), aoePosition, actionInfo->xAxisModifier, actionInfo->effectRange ) )
{
// todo: does this actually work?

View file

@ -2,6 +2,7 @@
#define _ACTIONCOLLISION_H
#include <common/Common.h>
#include <common/Exd/ExdDataGenerated.h>
#include "Actor/Actor.h"
#include "Action.h"
@ -25,7 +26,7 @@ namespace Entity {
static bool isActorApplicable( ActorPtr actorPtr, TargetFilter targetFilter );
static std::set< ActorPtr > getActorsHitFromAction( Common::FFXIVARR_POSITION3 aoePosition,
std::set< ActorPtr > actorsInRange,
boost::shared_ptr< Data::ActionInfo > actionInfo,
boost::shared_ptr< Data::Action > actionInfo,
TargetFilter targetFilter );
private:

View file

@ -1,7 +1,7 @@
#include "ActionTeleport.h"
#include <common/Util/Util.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Logging/Logger.h>
#include "Network/PacketWrappers/ActorControlPacket142.h"
@ -13,7 +13,7 @@ using namespace Core::Network;
using namespace Core::Network::Packets;
using namespace Core::Network::Packets::Server;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Logger g_log;
Core::Action::ActionTeleport::ActionTeleport()
@ -26,7 +26,7 @@ Core::Action::ActionTeleport::ActionTeleport( Entity::ActorPtr pActor, uint16_t
m_startTime = 0;
m_id = 5;
m_handleActionType = HandleActionType::Teleport;
m_castTime = g_exdData.getActionInfo(5)->cast_time; // TODO: Add security checks.
m_castTime = g_exdDataGen.getAction( 5 )->cast100ms * 100; // TODO: Add security checks.
m_pSource = pActor;
m_bInterrupt = false;
m_targetAetheryte = targetZone;

View file

@ -1,6 +1,6 @@
#include <common/Util/Util.h>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include "EventAction.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
@ -9,7 +9,7 @@
#include "Event/EventHandler.h"
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
using namespace Core::Network;
@ -28,7 +28,7 @@ Core::Action::EventAction::EventAction( Entity::ActorPtr pActor, uint32_t eventI
m_handleActionType = HandleActionType::Event;
m_eventId = eventId;
m_id = action;
m_castTime = g_exdData.m_EventActionInfoMap[action].castTime; // TODO: Add security checks.
m_castTime = g_exdDataGen.getEventAction( action )->castTime; // TODO: Add security checks.
m_onActionFinishClb = finishRef;
m_onActionInterruptClb = interruptRef;
m_pSource = pActor;

View file

@ -2,6 +2,7 @@
#include <common/Util/UtilMath.h>
#include <common/Network/PacketContainer.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/GamePacket.h>
#include "Forwards.h"
@ -24,7 +25,7 @@
#include "Player.h"
extern Core::ServerZone g_serverZone;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
using namespace Core::Network::Packets;
@ -682,7 +683,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
getAsPlayer()->sendDebug( "Handle script skill type: " + std::to_string( type ) );
}
auto actionInfoPtr = g_exdData.getActionInfo( actionId );
auto actionInfoPtr = g_exdDataGen.getAction( actionId );
// Todo: Effect packet generator. 90% of this is basically setting params and it's basically unreadable.
// Prepare packet. This is seemingly common for all packets in the action handler.
@ -708,7 +709,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalDamage;
effectPacket.data().effects[0].unknown_3 = 7;
if( !actionInfoPtr->is_aoe )
if( actionInfoPtr->castType == 1 && actionInfoPtr->effectRange != 0 || actionInfoPtr->castType != 1 )
{
// If action on this specific target is valid...
if ( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Enemies ) )
@ -764,7 +765,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u
effectPacket.data().effects[0].effectType = ActionEffectType::Heal;
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalHeal;
if( !actionInfoPtr->is_aoe )
if( actionInfoPtr->castType == 1 && actionInfoPtr->effectRange != 0 || actionInfoPtr->castType != 1 )
{
if( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Allies ) )
break;

View file

@ -5,7 +5,7 @@
#include <cmath>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Util/Util.h>
#include <common/Util/UtilMath.h>
@ -21,7 +21,7 @@ using namespace Core::Network::Packets;
using namespace Core::Network::Packets::Server;
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
uint32_t Core::Entity::BattleNpc::m_nextID = 1149241694;
@ -422,7 +422,7 @@ void Core::Entity::BattleNpc::onDeath()
auto levelDiff = static_cast< int32_t >( this->m_level ) - level;
auto cappedLevelDiff = Math::Util::clamp( levelDiff, 1, 6 );
auto expNeeded = g_exdData.m_paramGrowthInfoMap[m_level + cappedLevelDiff - 1].needed_exp;
auto expNeeded = g_exdDataGen.getParamGrow( m_level + cappedLevelDiff - 1 )->expToNext;
int32_t exp = 0;
// todo: arbitrary numbers pulled out of my ass

View file

@ -4,7 +4,7 @@
#include <common/Config/XMLConfig.h>
#include <common/Network/GamePacket.h>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/PacketContainer.h>
#include "Session.h"
@ -44,7 +44,7 @@
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
extern Core::TerritoryMgr g_territoryMgr;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Scripting::ScriptManager g_scriptMgr;
using namespace Core::Common;
@ -211,36 +211,27 @@ void Core::Entity::Player::calculateStats()
uint8_t level = getLevel();
uint8_t job = static_cast< uint8_t >( getClass() );
auto classInfoIt = g_exdData.m_classJobInfoMap.find( job );
auto tribeInfoIt = g_exdData.m_tribeInfoMap.find( tribe );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( level );
if( tribeInfoIt == g_exdData.m_tribeInfoMap.end() ||
classInfoIt == g_exdData.m_classJobInfoMap.end() ||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end() )
return;
auto tribeInfo = tribeInfoIt->second;
auto classInfo = classInfoIt->second;
auto paramGrowthInfo = paramGrowthInfoIt->second;
auto classInfo = g_exdDataGen.getClassJob( job );
auto tribeInfo = g_exdDataGen.getTribe( tribe );
auto paramGrowthInfo = g_exdDataGen.getParamGrow( level );
// TODO: put formula somewhere else...
float base = Math::CalcStats::calculateBaseStat( getAsPlayer() );
m_baseStats.str = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_str ) / 100 ) + tribeInfo.mod_str );
m_baseStats.dex = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_dex ) / 100 ) + tribeInfo.mod_dex );
m_baseStats.vit = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_vit ) / 100 ) + tribeInfo.mod_vit );
m_baseStats.inte = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_int ) / 100 ) + tribeInfo.mod_int );
m_baseStats.mnd = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_mnd ) / 100 ) + tribeInfo.mod_mnd );
m_baseStats.pie = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_pie ) / 100 ) + tribeInfo.mod_pie );
m_baseStats.str = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierStrength ) / 100 ) + tribeInfo->sTR );
m_baseStats.dex = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierDexterity ) / 100 ) + tribeInfo->dEX );
m_baseStats.vit = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierVitality ) / 100 ) + tribeInfo->vIT );
m_baseStats.inte = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierIntelligence ) / 100 ) + tribeInfo->iNT );
m_baseStats.mnd = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierMind ) / 100 ) + tribeInfo->mND );
m_baseStats.pie = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierPiety ) / 100 ) + tribeInfo->pIE );
m_baseStats.skillSpeed = paramGrowthInfo.base_secondary;
m_baseStats.spellSpeed = paramGrowthInfo.base_secondary;
m_baseStats.accuracy = paramGrowthInfo.base_secondary;
m_baseStats.critHitRate = paramGrowthInfo.base_secondary;
m_baseStats.attackPotMagic = paramGrowthInfo.base_secondary;
m_baseStats.healingPotMagic = paramGrowthInfo.base_secondary;
m_baseStats.tenacity = paramGrowthInfo.base_secondary;
m_baseStats.skillSpeed = paramGrowthInfo->baseSpeed;
m_baseStats.spellSpeed = paramGrowthInfo->baseSpeed;
m_baseStats.accuracy = paramGrowthInfo->baseSpeed;
m_baseStats.critHitRate = paramGrowthInfo->baseSpeed;
m_baseStats.attackPotMagic = paramGrowthInfo->baseSpeed;
m_baseStats.healingPotMagic = paramGrowthInfo->baseSpeed;
m_baseStats.tenacity = paramGrowthInfo->baseSpeed;
m_baseStats.max_mp = Math::CalcStats::calculateMaxMp( getAsPlayer() );
@ -300,7 +291,7 @@ void Core::Entity::Player::sendStats()
void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
{
auto data = g_exdData.getAetheryteInfo( aetheryteId );
auto data = g_exdDataGen.getAetheryte( aetheryteId );
if( data == nullptr )
{
@ -309,7 +300,7 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
setStateFlag( PlayerStateFlag::BetweenAreas );
auto z_pos = g_territoryMgr.getTerritoryPosition( data->levelId );
auto z_pos = g_territoryMgr.getTerritoryPosition( data->territory );
Common::FFXIVARR_POSITION3 pos;
pos.x = 0;
@ -323,30 +314,30 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
rot = z_pos->getTargetRotation();
}
sendDebug( "Teleport: " + data->placename + " " + data->placename_aethernet +
"(" + std::to_string( data->levelId ) + ")" );
sendDebug( "Teleport: " + g_exdDataGen.getPlaceName( data->placeName )->name + " " + g_exdDataGen.getPlaceName( data->aethernetName )->name +
"(" + std::to_string( data->territory ) + ")" );
// TODO: this should be simplified and a type created in server_common/common.h.
if( type == 1 ) // teleport
{
prepareZoning( data->target_zone, true, 1, 112 );
prepareZoning( data->territory, true, 1, 112 ); // TODO: Really?
sendToInRangeSet( ActorControlPacket142( getId(), ActorDespawnEffect, 0x04 ) );
setZoningType( Common::ZoneingType::Teleport );
}
else if( type == 2 ) // aethernet
{
prepareZoning( data->target_zone, true, 1, 112 );
prepareZoning( data->territory, true, 1, 112 );
sendToInRangeSet( ActorControlPacket142( getId(), ActorDespawnEffect, 0x04 ) );
setZoningType( Common::ZoneingType::Teleport );
}
else if( type == 3 ) // return
{
prepareZoning( data->target_zone, true, 1, 111 );
prepareZoning( data->territory, true, 1, 111 );
sendToInRangeSet( ActorControlPacket142( getId(), ActorDespawnEffect, 0x03 ) );
setZoningType( Common::ZoneingType::Return );
}
m_queuedZoneing = boost::make_shared< QueuedZoning >( data->target_zone, pos, Util::getTimeMs(), rot );
m_queuedZoneing = boost::make_shared< QueuedZoning >( data->territory, pos, Util::getTimeMs(), rot );
}
@ -502,11 +493,11 @@ void Core::Entity::Player::discover( int16_t map_id, int16_t sub_id )
int32_t offset = 4;
auto info = g_exdData.m_zoneInfoMap[getCurrentZone()->getTerritoryId()];
if( info.is_two_byte )
offset = 4 + 2 * info.discovery_index;
auto info = g_exdDataGen.getMap( g_exdDataGen.getTerritoryType( getCurrentZone()->getTerritoryId() )->map );
if( info->discoveryArrayByte )
offset = 4 + 2 * info->discoveryIndex;
else
offset = 324 + 4 * info.discovery_index;
offset = 324 + 4 * info->discoveryIndex;
int32_t index = offset + sub_id / 8;
uint8_t bitIndex = sub_id % 8;
@ -517,7 +508,7 @@ void Core::Entity::Player::discover( int16_t map_id, int16_t sub_id )
uint16_t level = getLevel();
uint32_t exp = ( g_exdData.m_paramGrowthInfoMap[level].needed_exp * 5 / 100 );
uint32_t exp = ( g_exdDataGen.getParamGrow( level )->expToNext * 5 / 100 );
gainExp( exp );
@ -594,9 +585,9 @@ void Core::Entity::Player::gainExp( uint32_t amount )
uint16_t level = getLevel();
uint32_t neededExpToLevel = g_exdData.m_paramGrowthInfoMap[level].needed_exp;
uint32_t neededExpToLevel = g_exdDataGen.getParamGrow( level )->expToNext;
uint32_t neededExpToLevelplus1 = g_exdData.m_paramGrowthInfoMap[level + 1].needed_exp;
uint32_t neededExpToLevelplus1 = g_exdDataGen.getParamGrow( level + 1 )->expToNext;
queuePacket( ActorControlPacket143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
@ -696,25 +687,25 @@ void Core::Entity::Player::sendStatusUpdate( bool toSelf )
uint8_t Core::Entity::Player::getLevel() const
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
return static_cast< uint8_t >( m_classArray[classJobIndex] );
}
uint8_t Core::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( pClass )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast< uint8_t >( pClass ) )->expArrayIndex;
return static_cast< uint8_t >( m_classArray[classJobIndex] );
}
uint32_t Core::Entity::Player::getExp() const
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
return m_expArray[classJobIndex];
}
void Core::Entity::Player::setExp( uint32_t amount )
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
m_expArray[classJobIndex] = amount;
}
@ -754,13 +745,13 @@ void Core::Entity::Player::setClassJob( Common::ClassJob classJob )
void Core::Entity::Player::setLevel( uint8_t level )
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( static_cast< uint8_t >( getClass() ) )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
m_classArray[classJobIndex] = level;
}
void Core::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( classjob )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast< uint8_t >( classjob ) )->expArrayIndex;
if( m_classArray[classJobIndex] == 0 )
insertDbClass( classJobIndex );
@ -910,11 +901,11 @@ const uint8_t* Core::Entity::Player::getStateFlags() const
bool Core::Entity::Player::actionHasCastTime( uint32_t actionId ) //TODO: Add logic for special cases
{
auto actionInfoPtr = g_exdData.getActionInfo( actionId );
if( actionInfoPtr->is_instant )
auto actionInfoPtr = g_exdDataGen.getAction( actionId );
if( actionInfoPtr->preservesCombo )
return false;
return actionInfoPtr->cast_time != 0;
return actionInfoPtr->cast100ms != 0;
}

View file

@ -1,7 +1,7 @@
#include <common/Common.h>
#include <common/Network/PacketDef/Zone/ServerZoneDef.h>
#include <common/Network/GamePacket.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/PacketContainer.h>
#include "Network/GameConnection.h"
@ -12,7 +12,7 @@
#include "Inventory/Inventory.h"
#include "Player.h"
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
using namespace Core::Network::Packets;
@ -1015,24 +1015,24 @@ void Core::Entity::Player::removeQuestsCompleted( uint32_t questId )
bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice )
{
uint32_t playerLevel = getLevel();
auto questInfo = g_exdData.getQuestInfo( questId );
auto questInfo = g_exdDataGen.getQuest( questId );
if( !questInfo )
return false;
auto paramGrowth = g_exdData.m_paramGrowthInfoMap[questInfo->quest_level];
auto paramGrowth = g_exdDataGen.getParamGrow( questInfo->classJobLevel0 );
// TODO: use the correct formula, this one is wrong
uint32_t exp = ( questInfo->reward_exp_factor * paramGrowth.quest_exp_mod * ( 45 + 5 * questInfo->quest_level) ) / 100;
exp = exp + ( questInfo->reward_exp_factor / 100 ) * 10000;
uint32_t exp = ( questInfo->expFactor * paramGrowth->questExpModifier * ( 45 + 5 * questInfo->classJobLevel0 ) ) / 100;
exp = exp + ( questInfo->expFactor / 100 ) * 10000;
exp = questInfo->reward_exp_factor;
exp = questInfo->expFactor;
auto rewardItemCount = questInfo->reward_item.size();
uint16_t optionalItemCount = questInfo->reward_item_optional.size() > 0 ? 1 : 0;
auto rewardItemCount = questInfo->itemReward0.size();
uint16_t optionalItemCount = questInfo->itemReward1.size();
uint32_t gilReward = questInfo->reward_gil;
uint32_t gilReward = questInfo->gilReward;
// TODO: check if there is room in inventory, else return false;
if( exp > 0 )
@ -1040,18 +1040,18 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional
if( rewardItemCount > 0 )
{
for( uint32_t i = 0; i < questInfo->reward_item.size(); i++ )
for( uint32_t i = 0; i < questInfo->itemReward0.size(); i++ )
{
// TODO: add the correct amount of items instead of 1
addItem( -1, questInfo->reward_item.at( i ), questInfo->reward_item_count.at( i ) );
addItem( -1, questInfo->itemReward0.at( i ), questInfo->itemReward1.at( i ) );
}
}
if( optionalItemCount > 0 )
{
auto itemId = questInfo->reward_item_optional.at( optionalChoice );
auto itemId = questInfo->itemReward1.at( optionalChoice );
// TODO: add the correct amount of items instead of 1
addItem( -1, itemId, questInfo->reward_item_optional_count.at( optionalChoice ) );
addItem( -1, itemId, questInfo->itemCountReward1.at( optionalChoice ) );
}
if( gilReward > 0 )

View file

@ -4,7 +4,7 @@
#include <common/Util/UtilMath.h>
#include <common/Config/XMLConfig.h>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/PacketContainer.h>
#include <common/Common.h>
#include <common/Database/DatabaseDef.h>
@ -31,7 +31,7 @@
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
extern Core::TerritoryMgr g_territoryMgr;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
@ -433,7 +433,7 @@ void Core::Entity::Player::updateSql()
void Core::Entity::Player::updateDbClass() const
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
uint8_t classJobIndex = g_exdDataGen.getClassJob( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
//Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?
auto stmtS = g_charaDb.getPreparedStatement( Db::CHARA_CLASS_UP );

View file

@ -7,7 +7,7 @@
#include <common/Util/UtilMath.h>
#include <common/Network/PacketContainer.h>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Database/DatabaseDef.h>
#include "DebugCommand.h"
@ -40,7 +40,7 @@
#include "Zone/TerritoryMgr.h"
extern Core::Scripting::ScriptManager g_scriptMgr;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
extern Core::TerritoryMgr g_territoryMgr;
@ -480,7 +480,7 @@ void Core::DebugCommandHandler::get( char * data, Entity::Player& player, boost:
if( ( subCommand == "pos" ) )
{
int16_t map_id = g_exdData.m_zoneInfoMap[player.getCurrentZone()->getTerritoryId()].map_id;
int16_t map_id = g_exdDataGen.getTerritoryType( player.getCurrentZone()->getTerritoryId() )->map;
player.sendNotice( "Pos:\n" +
std::to_string( player.getPos().x ) + "\n" +

View file

@ -1,10 +1,8 @@
#include "EventHelper.h"
#include "EventHandler.h"
#include <common/Common.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
@ -41,7 +39,7 @@ std::string Core::Event::getEventName( uint32_t eventId )
}
case Event::EventHandler::EventHandlerType::Opening:
{
auto openingInfo = g_exdData.getOpeningInfo( eventId );
auto openingInfo = g_exdDataGen.getOpening( eventId );
if( openingInfo )
return openingInfo->name;
return unknown + "Opening";
@ -67,9 +65,9 @@ std::string Core::Event::getEventName( uint32_t eventId )
uint32_t Core::Event::mapEventActorToRealActor( uint32_t eventActorId )
{
auto levelInfo = g_exdData.getLevelInfo( eventActorId );
auto levelInfo = g_exdDataGen.getLevel( eventActorId );
if( levelInfo )
return levelInfo->actor_id;
return levelInfo->objectKey;
return 0;
}

View file

@ -1,6 +1,6 @@
#include <common/Network/PacketDef/Zone/ServerZoneDef.h>
#include <common/Common.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Logging/Logger.h>
#include <common/Database/DatabaseDef.h>
@ -21,7 +21,7 @@
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
using namespace Core::Network;
@ -135,11 +135,11 @@ Core::ItemPtr Core::Inventory::getItemAt( uint16_t containerId, uint8_t slotId )
Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint8_t quantity )
{
auto itemInfo = g_exdData.getItemInfo( catalogId );
auto itemInfo = g_exdDataGen.getItem( catalogId );
uint8_t itemAmount = quantity;
if( itemInfo->stack_size == 1 )
if( itemInfo->stackSize == 1 )
itemAmount = 1;
if( !itemInfo )
@ -153,8 +153,8 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint8_t quantity
pItem->setStackSize( itemAmount );
pItem->setUId( getNextUId() );
pItem->setModelIds( itemInfo->model_primary, itemInfo->model_secondary );
pItem->setCategory( static_cast< ItemUICategory >( itemInfo->ui_category ) );
pItem->setModelIds( itemInfo->modelMain, itemInfo->modelSub );
pItem->setCategory( static_cast< ItemUICategory >( itemInfo->itemUICategory ) );
g_charaDb.execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
std::to_string( m_pOwner->getId() ) + ", " +
@ -473,10 +473,10 @@ bool Core::Inventory::isObtainable( uint32_t catalogId, uint8_t quantity )
int16_t Core::Inventory::addItem( uint16_t inventoryId, int8_t slotId, uint32_t catalogId, uint8_t quantity )
{
auto itemInfo = g_exdData.getItemInfo( catalogId );
auto itemInfo = g_exdDataGen.getItem( catalogId );
// if item data doesn't exist or it's a blank field
if( !itemInfo || itemInfo->item_level == 0 )
if( !itemInfo || itemInfo->levelItem == 0 )
{
return -1;
}
@ -656,13 +656,13 @@ Core::ItemPtr Core::Inventory::loadItem( uint64_t uId )
try
{
auto itemInfo = g_exdData.getItemInfo( itemRes->getUInt( 1 ) );
auto itemInfo = g_exdDataGen.getItem( itemRes->getUInt( 1 ) );
bool isHq = itemRes->getUInt( 3 ) == 1 ? true : false;
ItemPtr pItem( new Item( uId,
itemInfo->id,
itemInfo->model_primary,
itemInfo->model_secondary,
static_cast< ItemUICategory >( itemInfo->ui_category ),
itemRes->getUInt( 1 ),
itemInfo->modelMain,
itemInfo->modelSub,
static_cast< ItemUICategory >( itemInfo->itemUICategory ),
isHq ) );
pItem->setStackSize( itemRes->getUInt( 2 ) );

View file

@ -1,8 +1,8 @@
#include <common/Common.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include "Item.h"
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
Core::Item::Item()
{
@ -24,13 +24,13 @@ Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t mo
m_model2( model2 ),
m_isHq( isHq )
{
auto itemInfo = g_exdData.getItemInfo( catalogId );
m_delayMs = itemInfo->delayMs;
m_physicalDmg = itemInfo->physical_damage;
m_magicalDmg = itemInfo->magical_damage;
auto itemInfo = g_exdDataGen.getItem( catalogId );
m_delayMs = itemInfo->delayms;
m_physicalDmg = itemInfo->damagePhys;
m_magicalDmg = itemInfo->damageMag;
m_weaponDmg = ( m_physicalDmg != 0 ) ? m_physicalDmg : m_magicalDmg;
m_autoAttackDmg = static_cast< float >( m_weaponDmg * m_delayMs ) / 3000;
m_itemLevel = itemInfo->item_level;
m_itemLevel = itemInfo->levelItem;
}
Core::Item::~Item()

View file

@ -1,6 +1,6 @@
#include <cmath>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Common.h>
#include "Actor/Actor.h"
#include "Actor/Player.h"
@ -10,7 +10,7 @@
using namespace Core::Math;
using namespace Core::Entity;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
/*
Class used for battle-related formulas and calculations.
@ -30,14 +30,13 @@ extern Core::Data::ExdData g_exdData;
uint32_t CalcBattle::calculateHealValue( PlayerPtr pPlayer, uint32_t potency )
{
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
auto classInfo = g_exdDataGen.getClassJob( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfo = g_exdDataGen.getParamGrow( pPlayer->getLevel() );
if ( classInfoIt == g_exdData.m_classJobInfoMap.end() ||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end())
if ( !classInfo || !paramGrowthInfo )
return 0;
auto jobModVal = classInfoIt->second;
//auto jobModVal = classInfoIt->second;
// consider 3% variation
return potency / 10;

View file

@ -1,6 +1,6 @@
#include <cmath>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Common.h>
#include "Actor/Actor.h"
#include "Actor/Player.h"
@ -11,7 +11,7 @@
using namespace Core::Math;
using namespace Core::Entity;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
/*
Class used for battle-related formulas and calculations.
@ -61,19 +61,18 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer )
// Is there any way to pull reliable BaseHP without having to manually use a pet for every level, and using the values from a table?
// More info here: https://docs.google.com/spreadsheets/d/1de06KGT0cNRUvyiXNmjNgcNvzBCCQku7jte5QxEQRbs/edit?usp=sharing
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
auto classInfo = g_exdDataGen.getClassJob( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfo = g_exdDataGen.getParamGrow( pPlayer->getLevel() );
if ( classInfoIt == g_exdData.m_classJobInfoMap.end() ||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end() )
if ( !classInfo || !paramGrowthInfo )
return 0;
uint8_t level = pPlayer->getLevel();
float baseStat = calculateBaseStat( pPlayer );
uint16_t vitStat = pPlayer->getStats().vit;
uint16_t hpMod = paramGrowthInfoIt->second.hp_mod;
uint16_t jobModHp = classInfoIt->second.mod_hp;
uint16_t hpMod = paramGrowthInfo->hpModifier;
uint16_t jobModHp = classInfo->modifierHitPoints;
float approxBaseHp = 0.0f; // Read above
// These values are not precise.
@ -83,7 +82,7 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer )
else if ( level >= 50 )
approxBaseHp = 1700 + ( ( level - 50 ) * ( 1700 * 1.04325f ) );
else
approxBaseHp = paramGrowthInfoIt->second.mp_const * 0.7667f;
approxBaseHp = paramGrowthInfo->mpModifier * 0.7667f;
uint16_t result = static_cast< uint16_t >( floor( jobModHp * ( approxBaseHp / 100.0f ) ) + floor( hpMod / 100.0f * ( vitStat - baseStat ) ) );
@ -95,18 +94,17 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer )
uint32_t CalcStats::calculateMaxMp( PlayerPtr pPlayer )
{
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
auto classInfo = g_exdDataGen.getClassJob( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfo = g_exdDataGen.getParamGrow( pPlayer->getLevel() );
if ( classInfoIt == g_exdData.m_classJobInfoMap.end() ||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end() )
if ( !classInfo || !paramGrowthInfo )
return 0;
float baseStat = calculateBaseStat( pPlayer );
uint16_t piety = pPlayer->getStats().pie;
uint16_t pietyScalar = paramGrowthInfoIt->second.mp_mod;
uint16_t jobModMp = classInfoIt->second.mod_mpcpgp;
uint16_t baseMp = paramGrowthInfoIt->second.mp_const;
uint16_t pietyScalar = paramGrowthInfo->mpModifier;
uint16_t jobModMp = classInfo->modifierManaPoints;
uint16_t baseMp = paramGrowthInfo->mpModifier;
uint16_t result = static_cast< uint16_t >( floor( floor( piety - baseStat ) * ( pietyScalar / 100 ) + baseMp ) * jobModMp / 100 );

View file

@ -2,7 +2,7 @@
#include <common/Network/CommonNetwork.h>
#include <common/Network/GamePacketNew.h>
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/PacketContainer.h>
#include <boost/format.hpp>
@ -36,7 +36,7 @@
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::DebugCommandHandler g_gameCommandMgr;
using namespace Core::Common;
@ -200,15 +200,15 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
case 0xCA: // Teleport
{
// TODO: only register this action if enough gil is in possession
auto targetAetheryte = g_exdData.getAetheryteInfo( param11 );
auto targetAetheryte = g_exdDataGen.getAetheryte( param11 );
if( targetAetheryte )
{
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[player.getZoneId()].aetheryte_index );
auto fromAetheryte = g_exdDataGen.getAetheryte( g_exdDataGen.getTerritoryType( player.getZoneId() )->aetheryte );
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
auto cost = static_cast< uint16_t > ( ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) +
pow( fromAetheryte->map_coord_y - targetAetheryte->map_coord_y, 2 ) ) / 2 ) + 100 );
auto cost = static_cast< uint16_t > ( ( sqrt( pow( fromAetheryte->aetherstreamX - targetAetheryte->aetherstreamX, 2 ) +
pow( fromAetheryte->aetherstreamY - targetAetheryte->aetherstreamY, 2 ) ) / 2 ) + 100 );
// cap at 999 gil
cost = cost > uint16_t{999} ? uint16_t{999} : cost;

View file

@ -1,5 +1,5 @@
#include <common/Common.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/CommonNetwork.h>
#include <common/Network/GamePacketNew.h>
#include <common/Network/PacketContainer.h>
@ -21,7 +21,7 @@
#include "Forwards.h"
#include "Event/EventHelper.h"
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Scripting::ScriptManager g_scriptMgr;
using namespace Core::Common;
@ -52,9 +52,9 @@ void Core::Network::GameConnection::eventHandlerTalk( const Packets::GamePacket&
if( !g_scriptMgr.onTalk( player, actorId, eventId ) &&
eventType == Event::EventHandler::EventHandlerType::Quest )
{
auto questInfo = g_exdData.getQuestInfo( eventId );
auto questInfo = g_exdDataGen.getQuest( eventId );
if ( questInfo )
player.sendUrgent( "Quest not implemented: " + questInfo->name + " (" + questInfo->name_intern + ")" );
player.sendUrgent( "Quest not implemented: " + questInfo->name + " (" + questInfo->id + ")" );
}
player.checkEvent( eventId );
@ -87,7 +87,7 @@ void Core::Network::GameConnection::eventHandlerEmote( const Packets::GamePacket
if( !g_scriptMgr.onEmote( player, actorId, eventId, static_cast< uint8_t >( emoteId ) ) &&
eventType == Event::EventHandler::EventHandlerType::Quest )
{
auto questInfo = g_exdData.getQuestInfo( eventId );
auto questInfo = g_exdDataGen.getQuest( eventId );
if( questInfo )
player.sendUrgent( "Quest not implemented: " + questInfo->name );
}

View file

@ -1,6 +1,6 @@
#include <common/Common.h>
#include <common/Network/CommonNetwork.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/GamePacketNew.h>
#include <common/Network/PacketContainer.h>
#include <common/Logging/Logger.h>
@ -32,7 +32,7 @@
extern Core::Scripting::ScriptManager g_scriptMgr;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Logger g_log;
using namespace Core::Common;
@ -60,7 +60,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
std::string actionIdStr = boost::str( boost::format( "%|04X|" ) % action );
player.sendDebug( "---------------------------------------" );
player.sendDebug( "ActionHandler ( " + actionIdStr + " | " +
g_exdData.getActionInfo( action )->name +
g_exdDataGen.getAction( action )->name +
" | " + std::to_string( targetId ) + " )" );
player.queuePacket( ActorControlPacket142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
@ -100,11 +100,11 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
}
else if( action < 3000000 ) // item action
{
auto info = g_exdData.getEventItemInfo( action );
auto info = g_exdDataGen.getEventItem( action );
if( info )
{
g_log.debug( info->name );
g_scriptMgr.onEventItem( player, action, info->eventId, info->castTime, targetId );
g_scriptMgr.onEventItem( player, action, info->quest, info->castTime, targetId );
}
}
else if( action > 3000000 ) // unknown

View file

@ -1,5 +1,5 @@
#include <common/Logging/Logger.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Config/XMLConfig.h>
#include "NativeScriptManager.h"
@ -26,7 +26,7 @@
#include <libraries/external/watchdog/Watchdog.h>
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::ServerZone g_serverZone;
Core::Scripting::ScriptManager::ScriptManager() :
@ -154,7 +154,7 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac
// aethernet/aetherytes need to be handled separately
if( eventType == Event::EventHandler::EventHandlerType::Aetheryte )
{
auto aetherInfo = g_exdData.getAetheryteInfo( eventId & 0xFFFF );
auto aetherInfo = g_exdDataGen.getAetheryte( eventId & 0xFFFF );
scriptId = EVENTSCRIPT_AETHERYTE_ID;
if( !aetherInfo->isAetheryte )
scriptId = EVENTSCRIPT_AETHERNET_ID;

View file

@ -11,7 +11,6 @@
#include <common/Network/Connection.h>
#include <common/Network/Hive.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/PacketContainer.h>
#include <common/Database/DbLoader.h>
@ -39,7 +38,6 @@
Core::Logger g_log;
Core::DebugCommandHandler g_gameCommandMgr;
Core::Scripting::ScriptManager g_scriptMgr;
Core::Data::ExdData g_exdData;
Core::Data::ExdDataGenerated g_exdDataGen;
Core::TerritoryMgr g_territoryMgr;
Core::LinkshellMgr g_linkshellMgr;
@ -164,13 +162,6 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
}
}
g_log.info( "Setting up EXD data" );
if( !g_exdData.init( m_pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
{
g_log.fatal( "Error setting up EXD data " );
return false;
}
g_log.info( "Setting up generated EXD data" );
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
{
@ -213,15 +204,6 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
return;
}
g_exdData.loadZoneInfo();
g_exdData.loadClassJobInfo();
g_exdData.loadParamGrowInfo();
g_exdData.loadEventActionInfo();
g_exdData.loadActionInfo();
g_exdData.loadStatusEffectInfo();
g_exdData.loadAetheryteInfo();
g_exdData.loadTribeInfo();
g_log.info( "LinkshellMgr: Caching linkshells" );
if( !g_linkshellMgr.loadLinkshells() )
{

View file

@ -1,4 +1,4 @@
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Util/Util.h>
#include <common/Network/PacketDef/Zone/ServerZoneDef.h>
#include <common/Logging/Logger.h>
@ -13,7 +13,7 @@
#include "Script/ScriptManager.h"
extern Core::Logger g_log;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
using namespace Core::Common;
using namespace Core::Network::Packets;
@ -31,8 +31,8 @@ Core::StatusEffect::StatusEffect::StatusEffect( uint32_t id, Entity::ActorPtr so
, m_tickRate( tickRate )
, m_lastTick( 0 )
{
auto& entry = g_exdData.m_statusEffectInfoMap[id];
m_name = entry.name;
auto entry = g_exdDataGen.getStatus( id );
m_name = entry->name;
std::replace( m_name.begin(), m_name.end(), ' ', '_' );
std::replace( m_name.begin(), m_name.end(), ':', '_' );

View file

@ -6,7 +6,7 @@
#include <common/Util/UtilMath.h>
#include <common/Network/GamePacket.h>
#include <common/Network/GamePacketNew.h>
#include <common/Exd/ExdData.h>
#include <common/Exd/ExdDataGenerated.h>
#include <common/Network/CommonNetwork.h>
#include <common/Network/PacketDef/Zone/ServerZoneDef.h>
#include <common/Network/PacketContainer.h>
@ -33,7 +33,7 @@
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
extern Core::Data::ExdData g_exdData;
extern Core::Data::ExdDataGenerated g_exdDataGen;
extern Core::Scripting::ScriptManager g_scriptMgr;
namespace Core {
@ -207,7 +207,7 @@ void Zone::loadCellCache()
uint8_t Zone::getNextWeather()
{
auto zoneInfo = g_exdData.m_zoneInfoMap[getTerritoryId()];
auto zoneInfo = g_exdDataGen.getTerritoryType( getTerritoryId() );
uint32_t unixTime = static_cast< uint32_t >( Util::getTimeSeconds() );
// Get Eorzea hour for weather start
@ -225,7 +225,28 @@ uint8_t Zone::getNextWeather()
auto rate = static_cast< uint8_t >( step2 % 0x64 );
for( auto entry : zoneInfo.weather_rate_map )
uint8_t weatherRateNum = zoneInfo->weatherRate > g_exdDataGen.getWeatherRateIdList().size() ? 0 : zoneInfo->weatherRate;
auto weatherRate = g_exdDataGen.getWeatherRate( weatherRateNum );
auto weatherRateFields = g_exdDataGen.m_WeatherRateDat.get_row( weatherRateNum );
std::map< uint8_t, int32_t> weatherRateMap;
uint8_t sumPc = 0;
for( size_t i = 0; i < 16; )
{
int32_t weatherId = boost::get< int32_t >( weatherRateFields[i] );
if( weatherId == 0 )
break;
sumPc += boost::get< uint8_t >( weatherRateFields[i + 1] );
weatherRateMap[sumPc] = weatherId;
i += 2;
}
for( auto entry : weatherRateMap )
{
uint8_t sRate = entry.first;
auto weatherId = static_cast< uint8_t >( entry.second );

View file

@ -1666,10 +1666,18 @@
"target": "ClassJobCategory"
}
},
{
"index": 4,
"name": "ExpArrayIndex"
},
{
"index": 9,
"name": "Modifier{HitPoints}"
},
{
"index": 10,
"name": "Modifier{ManaPoints}"
},
{
"index": 11,
"name": "Modifier{Strength}"
@ -6244,6 +6252,10 @@
"target": "PlaceName"
}
},
{
"index": 12,
"name": "DiscoveryIndex"
},
{
"index": 14,
"name": "TerritoryType",
@ -6251,6 +6263,10 @@
"type": "link",
"target": "TerritoryType"
}
},
{
"index": 15,
"name": "DiscoveryArrayByte"
}
]
},
@ -6845,6 +6861,15 @@
}
]
},
{
"sheet": "Opening",
"defaultColumn": "Name",
"definitions": [
{
"name": "Name"
}
]
},
{
"sheet": "Orchestrion",
"definitions": [
@ -9089,6 +9114,18 @@
"type": "link",
"target": "DefaultTalk"
}
},
{
"index": 26,
"type": "repeat",
"count": 4,
"definition": {
"name": "Item{PossibleReward}",
"converter": {
"type": "link",
"target": "Item"
}
}
}
]
},