mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 15:17:46 +00:00
Merge pull request #570 from NotAdam/develop
api charlist json cleanup & some base action code
This commit is contained in:
commit
a56e875c8f
65 changed files with 2043 additions and 1257 deletions
|
@ -14,17 +14,11 @@ namespace Sapphire::Api {
|
|||
using namespace Common;
|
||||
|
||||
// player constructor
|
||||
PlayerMinimal::PlayerMinimal( void ) :
|
||||
PlayerMinimal::PlayerMinimal() :
|
||||
m_id( 0 )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// deconstructor
|
||||
PlayerMinimal::~PlayerMinimal( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// load player from the db
|
||||
|
@ -85,76 +79,101 @@ void PlayerMinimal::load( uint32_t charId )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
std::string PlayerMinimal::getLookString()
|
||||
std::string PlayerMinimal::getInfoJson()
|
||||
{
|
||||
auto payload = nlohmann::json();
|
||||
auto& c = payload["content"];
|
||||
|
||||
auto it = m_lookMap.begin();
|
||||
// DisplayName
|
||||
c.push_back( getName() );
|
||||
|
||||
std::string lookString;
|
||||
|
||||
for( ; it != m_lookMap.end(); ++it )
|
||||
{
|
||||
|
||||
std::string s = std::to_string( it->second );
|
||||
|
||||
lookString += "\"" + s + "\"";
|
||||
if( it != m_lookMap.end() )
|
||||
{
|
||||
lookString += ",";
|
||||
}
|
||||
}
|
||||
|
||||
return lookString.substr( 0, lookString.size() - 1 );
|
||||
}
|
||||
|
||||
std::string PlayerMinimal::getModelString()
|
||||
{
|
||||
std::string modelString = "\""
|
||||
+ std::to_string( m_modelEquip[ 0 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 1 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 2 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 3 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 4 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 5 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 6 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 7 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 8 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 9 ] ) + "\"";
|
||||
return modelString;
|
||||
}
|
||||
|
||||
std::string PlayerMinimal::getLevelsString()
|
||||
{
|
||||
// class levels
|
||||
auto levelsArray = nlohmann::json();
|
||||
|
||||
for( int i = 0; i < Common::CLASSJOB_SLOTS; ++i )
|
||||
{
|
||||
// these must be strings
|
||||
levelsArray.push_back( std::to_string( m_classMap[ i ] ) );
|
||||
}
|
||||
|
||||
return levelsArray.dump();
|
||||
}
|
||||
// ClassLv
|
||||
c.push_back( levelsArray );
|
||||
|
||||
std::string PlayerMinimal::getInfoJson()
|
||||
{
|
||||
std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," +
|
||||
getLevelsString() + ","
|
||||
"\"0\",\"0\",\"0\",\"" +
|
||||
std::to_string( getBirthMonth() ) +
|
||||
"\",\"" + std::to_string( getBirthDay() ) +
|
||||
"\",\"" + std::to_string( getGuardianDeity() ) +
|
||||
"\",\"" + std::to_string( m_class ) +
|
||||
"\",\"0\",\"" + std::to_string( getZoneId() ) +
|
||||
"\",\"0\"," +
|
||||
"[" + getLookString() + "]," +
|
||||
"\"" + std::to_string( m_modelMainWeapon ) + "\",\"" + std::to_string( m_modelSubWeapon ) + "\"," +
|
||||
"[" + getModelString() + "]," +
|
||||
"\"1\",\"0\",\"0\",\"0\",\"" + std::to_string( m_equipDisplayFlags ) +
|
||||
"\",\"0\",\"\",\"0\",\"0\"]," +
|
||||
"\"classname\":\"ClientSelectData\",\"classid\":116}";
|
||||
return charDetails;
|
||||
// Race
|
||||
c.push_back( "0" );
|
||||
// Tribe
|
||||
c.push_back( "0" );
|
||||
// Sex
|
||||
c.push_back( "0" );
|
||||
|
||||
// BirthMonth
|
||||
c.push_back( std::to_string( getBirthMonth() ) );
|
||||
// Birthday
|
||||
c.push_back( std::to_string( getBirthDay() ) );
|
||||
// GuardianDeity
|
||||
c.push_back( std::to_string( getGuardianDeity() ) );
|
||||
|
||||
// Class
|
||||
c.push_back( std::to_string( m_class ) );
|
||||
|
||||
// ZoneId
|
||||
c.push_back( "0" );
|
||||
|
||||
// TerritoryType
|
||||
c.push_back( std::to_string( getZoneId() ) );
|
||||
|
||||
// ContentFinderCondition
|
||||
c.push_back( "0" );
|
||||
|
||||
// look map
|
||||
auto lookArray = nlohmann::json();
|
||||
for( auto& it : m_lookMap )
|
||||
{
|
||||
lookArray.push_back( std::to_string( it.second ) );
|
||||
}
|
||||
// Customize
|
||||
c.push_back( lookArray );
|
||||
|
||||
// ModelMainWeapon
|
||||
c.push_back( std::to_string( m_modelMainWeapon ) );
|
||||
// ModelSubWeapon
|
||||
c.push_back( std::to_string( m_modelSubWeapon ) );
|
||||
|
||||
// model
|
||||
auto modelArray = nlohmann::json();
|
||||
for( auto i : m_modelEquip )
|
||||
{
|
||||
modelArray.push_back( std::to_string( i ) );
|
||||
}
|
||||
// ModelEquip
|
||||
c.push_back( modelArray );
|
||||
|
||||
// MainWeapon
|
||||
c.push_back( "1" );
|
||||
// SubWeapon
|
||||
c.push_back( "0" );
|
||||
// JobStone
|
||||
c.push_back( "0" );
|
||||
|
||||
// RemakeFlag
|
||||
c.push_back( "0" );
|
||||
|
||||
// ConfigFlags
|
||||
c.push_back( std::to_string( m_equipDisplayFlags ) );
|
||||
|
||||
// Voice
|
||||
c.push_back( "0" );
|
||||
// WorldName
|
||||
c.push_back( "" );
|
||||
// LoginStatus
|
||||
c.push_back( "0" );
|
||||
// IsOutTerritory
|
||||
c.push_back( "0" );
|
||||
|
||||
|
||||
payload["classname"] = "ClientSelectData";
|
||||
payload["classid"] = 116;
|
||||
|
||||
return payload.dump();
|
||||
}
|
||||
|
||||
uint8_t PlayerMinimal::getClassLevel()
|
||||
|
@ -163,30 +182,6 @@ uint8_t PlayerMinimal::getClassLevel()
|
|||
return static_cast< uint8_t >( m_classMap[ classJobIndex ] );
|
||||
}
|
||||
|
||||
std::string PlayerMinimal::getClassString()
|
||||
{
|
||||
|
||||
std::map< uint8_t, uint16_t >::iterator it;
|
||||
|
||||
it = m_classMap.begin();
|
||||
|
||||
std::string classString;
|
||||
|
||||
for( ; it != m_classMap.end(); ++it )
|
||||
{
|
||||
|
||||
std::string s = std::to_string( it->second );
|
||||
|
||||
classString += "\"" + s + "\"";
|
||||
if( it != m_classMap.end() )
|
||||
{
|
||||
classString += ",";
|
||||
}
|
||||
}
|
||||
|
||||
return classString.substr( 0, classString.size() - 1 );
|
||||
}
|
||||
|
||||
void PlayerMinimal::saveAsNew()
|
||||
{
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace Sapphire::Api
|
|||
class PlayerMinimal
|
||||
{
|
||||
public:
|
||||
PlayerMinimal( void );
|
||||
PlayerMinimal();
|
||||
|
||||
~PlayerMinimal( void );
|
||||
~PlayerMinimal() = default;
|
||||
|
||||
// write player to the database
|
||||
void write();
|
||||
|
@ -23,16 +23,8 @@ namespace Sapphire::Api
|
|||
|
||||
void saveAsNew();
|
||||
|
||||
std::string getLookString();
|
||||
|
||||
std::string getInfoJson();
|
||||
|
||||
std::string getModelString();
|
||||
|
||||
std::string getClassString();
|
||||
|
||||
std::string getLevelsString();
|
||||
|
||||
uint8_t getClassLevel();
|
||||
|
||||
// return the id of the actor
|
||||
|
|
|
@ -699,7 +699,7 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe
|
|||
catch( const exception& )
|
||||
{
|
||||
string content = "Path not found: " + request->path;
|
||||
*response << buildHttpResponse( 400, content );
|
||||
*response << buildHttpResponse( 404, content );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -990,6 +990,18 @@ namespace Sapphire::Common
|
|||
CircularAoEPlaced = 7
|
||||
};
|
||||
|
||||
enum class Role : uint8_t
|
||||
{
|
||||
None,
|
||||
Tank,
|
||||
Healer,
|
||||
RangedPhysical,
|
||||
RangedMagical,
|
||||
Melee,
|
||||
Crafter,
|
||||
Gatherer
|
||||
};
|
||||
|
||||
using PlayerStateFlagList = std::vector< PlayerStateFlag >;
|
||||
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace Sapphire::Network::ActorControl
|
|||
UpdatedSeenHowTos = 0x133,
|
||||
AllotAttribute = 0x135,
|
||||
|
||||
ClearWaymarks = 0x13A,
|
||||
ClearFieldMarkers = 0x13A,
|
||||
CameraMode = 0x13B, // param12, 1 = camera mode enable, 0 = disable
|
||||
CharaNameReq = 0x13D, // requests character name by content id
|
||||
HuntingLogDetails = 0x194,
|
||||
|
|
|
@ -136,7 +136,9 @@ namespace Sapphire::Network::Packets
|
|||
|
||||
ActorSetPos = 0x0184, // updated 5.0
|
||||
|
||||
ActorCast = 0x0187, // updated 5.0
|
||||
ActorCast = 0x0186, // updated 5.0
|
||||
|
||||
SomeCustomiseChangePacketProbably = 0x0187, // added 5.0
|
||||
|
||||
PartyList = 0x0188, // updated 5.0
|
||||
HateRank = 0x0189, // updated 5.0
|
||||
|
@ -313,15 +315,14 @@ namespace Sapphire::Network::Packets
|
|||
|
||||
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
|
||||
|
||||
ReqCountdownInitiate = 0x0133, // updated 4.5
|
||||
ReqCountdownCancel = 0x0134, // updated 4.5
|
||||
ClearWaymarks = 0x0135, // updated 4.5
|
||||
ReqCountdownInitiate = 0x0135, // updated 5.0
|
||||
ReqCountdownCancel = 0x0136, // updated 5.0
|
||||
|
||||
ZoneLineHandler = 0x0139, // updated 5.0
|
||||
ClientTrigger = 0x013A, // updated 5.0
|
||||
DiscoveryHandler = 0x013B, // updated 5.0
|
||||
|
||||
AddWaymark = 0x013A, // updated 4.5
|
||||
PlaceFieldMarker = 0x013C, // updated 5.0
|
||||
|
||||
SkillHandler = 0x013D, // updated 5.0
|
||||
GMCommand1 = 0x013E, // updated 5.0
|
||||
|
@ -331,6 +332,7 @@ namespace Sapphire::Network::Packets
|
|||
UpdatePositionHandler = 0x0141, // updated 5.0
|
||||
|
||||
InventoryModifyHandler = 0x0148, // updated 5.0
|
||||
InventoryEquipRecommendedItems = 0x0149, // updated 5.0
|
||||
|
||||
ReqPlaceHousingItem = 0x014B, // updated 5.0
|
||||
BuildPresetHandler = 0x014F, // updated 5.0
|
||||
|
|
|
@ -448,14 +448,19 @@ namespace Sapphire::Network::Packets::Server
|
|||
uint32_t max_hp;
|
||||
uint16_t max_mp;
|
||||
uint16_t max_something;
|
||||
uint8_t effect_index; // which position do i display this
|
||||
|
||||
struct StatusEntry
|
||||
{
|
||||
uint8_t index; // which position do i display this
|
||||
uint8_t unknown3;
|
||||
uint16_t effect_id;
|
||||
uint16_t id;
|
||||
uint16_t param;
|
||||
uint16_t unknown5; // Sort this out (old right half of power/param property)
|
||||
float duration;
|
||||
uint32_t actor_id1;
|
||||
uint8_t unknown4[52];
|
||||
uint32_t sourceActorId;
|
||||
} statusEntries[4];
|
||||
|
||||
uint32_t unknown4;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -551,12 +556,21 @@ namespace Sapphire::Network::Packets::Server
|
|||
uint64_t animationTargetId; // who the animation targets
|
||||
|
||||
uint32_t actionId; // what the casting player casts, shown in battle log/ui
|
||||
uint32_t sequence; // seems to only increment on retail?
|
||||
/*!
|
||||
* @brief Zone sequence for the effect. Used to link effects that are split across multiple packets as one
|
||||
*/
|
||||
uint32_t sequence;
|
||||
|
||||
float animationLockTime; // maybe? doesn't seem to do anything
|
||||
uint32_t someTargetId; // always 00 00 00 E0, 0x0E000000 is the internal def for INVALID TARGET ID
|
||||
uint32_t someTargetId; // always 0x0E000000?
|
||||
|
||||
uint16_t hiddenAnimation; // if 0, always shows animation, otherwise hides it. counts up by 1 for each animation skipped on a caster
|
||||
/*!
|
||||
* @brief The cast sequence from the originating player. Should only be sent to the source, 0 for every other player.
|
||||
*
|
||||
* This needs to match the sequence sent from the player in the action start packet otherwise you'll cancel the
|
||||
* initial animation and start a new one once the packet arrives.
|
||||
*/
|
||||
uint16_t sourceSequence;
|
||||
uint16_t rotation;
|
||||
uint16_t actionAnimationId; // the animation that is played by the casting character
|
||||
uint8_t variation; // variation in the animation
|
||||
|
@ -1076,6 +1090,7 @@ namespace Sapphire::Network::Packets::Server
|
|||
*/
|
||||
struct FFXIVIpcPlayerStats : FFXIVIpcBasePacket< PlayerStats >
|
||||
{
|
||||
// order comes from baseparam order column
|
||||
uint32_t strength;
|
||||
uint32_t dexterity;
|
||||
uint32_t vitality;
|
||||
|
@ -1085,45 +1100,30 @@ namespace Sapphire::Network::Packets::Server
|
|||
uint32_t hp;
|
||||
uint32_t mp;
|
||||
uint32_t tp;
|
||||
uint32_t gp; // Set to 10000 as non-gatherer for some reason
|
||||
uint32_t gp;
|
||||
uint32_t cp;
|
||||
uint32_t unknown_2;
|
||||
uint32_t delay;
|
||||
uint32_t tenacity;
|
||||
uint32_t attack;
|
||||
uint32_t attackPower;
|
||||
uint32_t defense;
|
||||
uint32_t accuracy;
|
||||
uint32_t spellSpeed;
|
||||
uint32_t directHitRate;
|
||||
uint32_t evasion;
|
||||
uint32_t magicDefense;
|
||||
uint32_t criticalHitRate;
|
||||
uint32_t resistanceSlashing;
|
||||
uint32_t resistancePiercing;
|
||||
uint32_t resistanceBlunt;
|
||||
uint32_t criticalHit;
|
||||
uint32_t attackMagicPotency;
|
||||
uint32_t healingMagicPotency;
|
||||
uint32_t fire;
|
||||
uint32_t ice;
|
||||
uint32_t wind;
|
||||
uint32_t earth;
|
||||
uint32_t lightning;
|
||||
uint32_t water;
|
||||
uint32_t elementalBonus;
|
||||
uint32_t determination;
|
||||
uint32_t skillSpeed;
|
||||
uint32_t spellSpeed1;
|
||||
uint32_t spellSpeedMod;
|
||||
uint32_t unknown_6;
|
||||
uint32_t spellSpeed;
|
||||
uint32_t haste;
|
||||
uint32_t craftsmanship;
|
||||
uint32_t control;
|
||||
uint32_t gathering;
|
||||
uint32_t perception;
|
||||
uint32_t resistanceSlow;
|
||||
uint32_t resistanceSilence;
|
||||
uint32_t resistanceBlind;
|
||||
uint32_t resistancePoison;
|
||||
uint32_t resistanceStun;
|
||||
uint32_t resistanceSleep;
|
||||
uint32_t resistanceBind;
|
||||
uint32_t resistanceHeavy;
|
||||
uint32_t unknown_7[9]; // possibly level sync stats.
|
||||
|
||||
// todo: what is here?
|
||||
uint32_t unknown[26];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
if( !pExdData )
|
||||
return;
|
||||
|
||||
auto housingZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto housingZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !housingZone )
|
||||
return;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
return;
|
||||
|
||||
// check we're teleporting to the same territorytype
|
||||
if( player.getCurrentZone()->getTerritoryTypeId() != pHousingAethernet->territoryType )
|
||||
if( player.getCurrentTerritory()->getTerritoryTypeId() != pHousingAethernet->territoryType )
|
||||
return;
|
||||
|
||||
// todo: this needs to be done properly and used queued zoning + aethernet animation
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
if( !terriMgr )
|
||||
return;
|
||||
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !zone )
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Territory/Zone.h>
|
||||
#include <Territory/HousingZone.h>
|
||||
#include <Manager/HousingMgr.h>
|
||||
#include <Network/PacketWrappers/ActorControlPacket143.h>
|
||||
|
@ -35,7 +34,7 @@ public:
|
|||
auto activeLand = player.getActiveLand();
|
||||
auto territoryId = player.getTerritoryId();
|
||||
|
||||
auto pTerritory = player.getCurrentZone();
|
||||
auto pTerritory = player.getCurrentTerritory();
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||
auto pHouMgr = pFw->get< HousingMgr >();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ int main()
|
|||
|
||||
Logger::init( "action_parse" );
|
||||
|
||||
if( !fs::exists( "ActionLut.cpp.tmpl" ) )
|
||||
if( !fs::exists( "ActionLutData.cpp.tmpl" ) )
|
||||
throw std::runtime_error( "ActionLut.cpp.tmpl is missing in working directory" );
|
||||
|
||||
Logger::info( "Setting up EXD data" );
|
||||
|
@ -249,9 +249,11 @@ int main()
|
|||
// action.first, data.name, data.potency, data.flankPotency, data.frontPotency, data.rearPotency,
|
||||
// data.curePotency, data.restorePercentage );
|
||||
|
||||
auto out = fmt::format( " // {}\n {{ {}, {{ {}, {}, {}, {}, {} }} }},\n",
|
||||
auto out = fmt::format( " // {}\n {{ {}, {{ {}, {}, {}, {}, {}, {} }} }},\n",
|
||||
data.name, action.first,
|
||||
data.potency, data.flankPotency, data.frontPotency, data.rearPotency, data.curePotency );
|
||||
data.potency, data.comboPotency,
|
||||
data.flankPotency, data.frontPotency, data.rearPotency,
|
||||
data.curePotency );
|
||||
|
||||
output += out;
|
||||
// Logger::info( out );
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "Action.h"
|
||||
#include "ActionLut.h"
|
||||
#include "EffectBuilder.h"
|
||||
|
||||
#include <Inventory/Item.h>
|
||||
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Util/Util.h>
|
||||
|
@ -11,15 +14,17 @@
|
|||
#include "Actor/Player.h"
|
||||
#include "Actor/BNpc.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include <Network/PacketWrappers/EffectPacket.h>
|
||||
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
#include <Util/ActorFilter.h>
|
||||
#include <Util/UtilMath.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::Common;
|
||||
|
@ -33,19 +38,21 @@ using namespace Sapphire::World;
|
|||
Action::Action::Action() = default;
|
||||
Action::Action::~Action() = default;
|
||||
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, FrameworkPtr fw ) :
|
||||
Action( std::move( caster ), actionId, nullptr, std::move( fw ) )
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw ) :
|
||||
Action( std::move( caster ), actionId, sequence, nullptr, std::move( fw ) )
|
||||
{
|
||||
}
|
||||
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, Data::ActionPtr actionData, FrameworkPtr fw ) :
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence,
|
||||
Data::ActionPtr actionData, FrameworkPtr fw ) :
|
||||
m_pSource( std::move( caster ) ),
|
||||
m_pFw( std::move( fw ) ),
|
||||
m_actionData( std::move( actionData ) ),
|
||||
m_id( actionId ),
|
||||
m_targetId( 0 ),
|
||||
m_startTime( 0 ),
|
||||
m_interruptType( Common::ActionInterruptType::None )
|
||||
m_interruptType( Common::ActionInterruptType::None ),
|
||||
m_sequence( sequence )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -68,6 +75,8 @@ bool Action::Action::init()
|
|||
m_actionData = actionData;
|
||||
}
|
||||
|
||||
m_effectBuilder = make_EffectBuilder( m_pSource, getId(), m_sequence );
|
||||
|
||||
m_castTimeMs = static_cast< uint32_t >( m_actionData->cast100ms * 100 );
|
||||
m_recastTimeMs = static_cast< uint32_t >( m_actionData->recast100ms * 100 );
|
||||
m_cooldownGroup = m_actionData->cooldownGroup;
|
||||
|
@ -217,13 +226,20 @@ void Action::Action::start()
|
|||
if( hasCastTime() )
|
||||
{
|
||||
auto castPacket = makeZonePacket< Server::FFXIVIpcActorCast >( getId() );
|
||||
auto& data = castPacket->data();
|
||||
|
||||
castPacket->data().action_id = static_cast< uint16_t >( m_id );
|
||||
castPacket->data().skillType = Common::SkillType::Normal;
|
||||
castPacket->data().unknown_1 = m_id;
|
||||
data.action_id = static_cast< uint16_t >( m_id );
|
||||
data.skillType = Common::SkillType::Normal;
|
||||
data.unknown_1 = m_id;
|
||||
// This is used for the cast bar above the target bar of the caster.
|
||||
castPacket->data().cast_time = m_castTimeMs / 1000.f;
|
||||
castPacket->data().target_id = static_cast< uint32_t >( m_targetId );
|
||||
data.cast_time = m_castTimeMs / 1000.f;
|
||||
data.target_id = static_cast< uint32_t >( m_targetId );
|
||||
|
||||
auto pos = m_pSource->getPos();
|
||||
data.posX = Common::Util::floatToUInt16( pos.x );
|
||||
data.posY = Common::Util::floatToUInt16( pos.y );
|
||||
data.posZ = Common::Util::floatToUInt16( pos.z );
|
||||
data.rotation = m_pSource->getRot();
|
||||
|
||||
m_pSource->sendToInRangeSet( castPacket, true );
|
||||
|
||||
|
@ -328,28 +344,11 @@ void Action::Action::execute()
|
|||
|
||||
if( !hasClientsideTarget() )
|
||||
{
|
||||
snapshotAffectedActors( m_hitActors );
|
||||
|
||||
if( !m_hitActors.empty() )
|
||||
{
|
||||
// only call script if actors are hit
|
||||
if( !pScriptMgr->onExecute( *this ) && ActionLut::validEntryExists( getId() ) )
|
||||
{
|
||||
auto lutEntry = ActionLut::getEntry( getId() );
|
||||
|
||||
// no script exists but we have a valid lut entry
|
||||
if( auto player = getSourceChara()->getAsPlayer() )
|
||||
{
|
||||
player->sendDebug( "Hit target: pot: {} (f: {}, r: {}), heal pot: {}",
|
||||
lutEntry.potency, lutEntry.flankPotency, lutEntry.rearPotency, lutEntry.curePotency );
|
||||
}
|
||||
}
|
||||
}
|
||||
buildEffects();
|
||||
}
|
||||
else if( auto player = m_pSource->getAsPlayer() )
|
||||
{
|
||||
pScriptMgr->onEObjHit( *player, m_targetId, getId() );
|
||||
return;
|
||||
}
|
||||
|
||||
// set currently casted action as the combo action if it interrupts a combo
|
||||
|
@ -360,6 +359,83 @@ void Action::Action::execute()
|
|||
}
|
||||
}
|
||||
|
||||
std::pair< uint32_t, Common::ActionHitSeverityType > Action::Action::calcDamage( uint32_t potency )
|
||||
{
|
||||
// todo: what do for npcs?
|
||||
auto wepDmg = 1.f;
|
||||
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
{
|
||||
auto item = player->getEquippedWeapon();
|
||||
assert( item );
|
||||
|
||||
auto role = player->getRole();
|
||||
if( role == Common::Role::RangedMagical || role == Common::Role::Healer )
|
||||
{
|
||||
wepDmg = item->getMagicalDmg();
|
||||
}
|
||||
else
|
||||
{
|
||||
wepDmg = item->getPhysicalDmg();
|
||||
}
|
||||
}
|
||||
|
||||
auto dmg = Math::CalcStats::calcActionDamage( *m_pSource, potency, wepDmg );
|
||||
|
||||
return std::make_pair( dmg, Common::ActionHitSeverityType::NormalDamage );
|
||||
}
|
||||
|
||||
void Action::Action::buildEffects()
|
||||
{
|
||||
snapshotAffectedActors( m_hitActors );
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
|
||||
if( !pScriptMgr->onExecute( *this ) && !ActionLut::validEntryExists( getId() ) )
|
||||
{
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
{
|
||||
player->sendUrgent( "missing lut entry for action#{}", getId() );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_hitActors.empty() )
|
||||
return;
|
||||
|
||||
auto lutEntry = ActionLut::getEntry( getId() );
|
||||
|
||||
// no script exists but we have a valid lut entry
|
||||
if( auto player = getSourceChara()->getAsPlayer() )
|
||||
{
|
||||
player->sendDebug( "Hit target: pot: {} (c: {}, f: {}, r: {}), heal pot: {}",
|
||||
lutEntry.potency, lutEntry.comboPotency, lutEntry.flankPotency, lutEntry.rearPotency,
|
||||
lutEntry.curePotency );
|
||||
}
|
||||
|
||||
for( auto& actor : m_hitActors )
|
||||
{
|
||||
// todo: this is shit
|
||||
if( lutEntry.curePotency > 0 )
|
||||
{
|
||||
|
||||
m_effectBuilder->healTarget( actor, lutEntry.curePotency );
|
||||
}
|
||||
|
||||
else if( lutEntry.potency > 0 )
|
||||
{
|
||||
auto dmg = calcDamage( lutEntry.potency );
|
||||
m_effectBuilder->damageTarget( actor, dmg.first, dmg.second );
|
||||
}
|
||||
}
|
||||
|
||||
m_effectBuilder->buildAndSendPackets();
|
||||
|
||||
// at this point we're done with it and no longer need it
|
||||
m_effectBuilder.reset();
|
||||
}
|
||||
|
||||
bool Action::Action::preCheck()
|
||||
{
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace Sapphire::World::Action
|
|||
public:
|
||||
|
||||
Action();
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, Data::ActionPtr actionData, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, Data::ActionPtr actionData, FrameworkPtr fw );
|
||||
|
||||
virtual ~Action();
|
||||
|
||||
|
@ -85,6 +85,8 @@ namespace Sapphire::World::Action
|
|||
*/
|
||||
bool snapshotAffectedActors( std::vector< Entity::CharaPtr >& actors );
|
||||
|
||||
void buildEffects();
|
||||
|
||||
/*!
|
||||
* @brief Adds an actor filter to this action.
|
||||
* @param filter The ptr to the ActorFilter to add
|
||||
|
@ -96,6 +98,10 @@ namespace Sapphire::World::Action
|
|||
*/
|
||||
void addDefaultActorFilters();
|
||||
|
||||
std::pair< uint32_t, Common::ActionHitSeverityType > calcDamage( uint32_t potency );
|
||||
|
||||
std::pair< uint32_t, Common::ActionHitSeverityType > calcHealing( uint32_t potency );
|
||||
|
||||
|
||||
std::vector< Entity::CharaPtr >& getHitCharas();
|
||||
|
||||
|
@ -139,6 +145,8 @@ namespace Sapphire::World::Action
|
|||
|
||||
uint32_t m_id;
|
||||
|
||||
uint16_t m_sequence;
|
||||
|
||||
Common::ActionPrimaryCostType m_primaryCostType;
|
||||
uint16_t m_primaryCost;
|
||||
|
||||
|
@ -171,6 +179,8 @@ namespace Sapphire::World::Action
|
|||
|
||||
Common::FFXIVARR_POSITION3 m_pos;
|
||||
|
||||
EffectBuilderPtr m_effectBuilder;
|
||||
|
||||
std::vector< World::Util::ActorFilterPtr > m_actorFilters;
|
||||
std::vector< Entity::CharaPtr > m_hitActors;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
92
src/world/Action/EffectBuilder.cpp
Normal file
92
src/world/Action/EffectBuilder.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "EffectBuilder.h"
|
||||
#include "EffectResult.h"
|
||||
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Network/PacketWrappers/EffectPacket.h>
|
||||
|
||||
#include <Territory/Territory.h>
|
||||
|
||||
#include <Util/Util.h>
|
||||
#include <Util/UtilMath.h>
|
||||
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
||||
EffectBuilder::EffectBuilder( Entity::CharaPtr source, uint32_t actionId, uint16_t sequence ) :
|
||||
m_sourceChara( std::move( source ) ),
|
||||
m_actionId( actionId ),
|
||||
m_sequence( sequence )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint64_t EffectBuilder::getResultDelayMs()
|
||||
{
|
||||
// todo: actually figure this retarded shit out
|
||||
|
||||
return Common::Util::getTimeMs() + 850;
|
||||
}
|
||||
|
||||
EffectResultPtr EffectBuilder::getResult( Entity::CharaPtr& chara )
|
||||
{
|
||||
auto it = m_resolvedEffects.find( chara->getId() );
|
||||
if( it == m_resolvedEffects.end() )
|
||||
{
|
||||
// create a new one and return it
|
||||
// todo: this feels kinda dirty but makes for easy work
|
||||
auto result = make_EffectResult( chara, getResultDelayMs() );
|
||||
|
||||
m_resolvedEffects[ chara->getId() ] = result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void EffectBuilder::healTarget( Entity::CharaPtr& target, uint32_t amount, Common::ActionHitSeverityType severity )
|
||||
{
|
||||
auto result = getResult( target );
|
||||
assert( result );
|
||||
|
||||
result->heal( amount, severity );
|
||||
}
|
||||
|
||||
void EffectBuilder::damageTarget( Entity::CharaPtr& target, uint32_t amount, Common::ActionHitSeverityType severity )
|
||||
{
|
||||
auto result = getResult( target );
|
||||
assert( result );
|
||||
|
||||
result->damage( amount, severity );
|
||||
}
|
||||
|
||||
void EffectBuilder::buildAndSendPackets()
|
||||
{
|
||||
Logger::debug( "EffectBuilder result: " );
|
||||
Logger::debug( "Targets afflicted: {}", m_resolvedEffects.size() );
|
||||
|
||||
for( auto it = m_resolvedEffects.begin(); it != m_resolvedEffects.end(); )
|
||||
{
|
||||
auto result = it->second;
|
||||
Logger::debug( " - id: {}", result->getTarget()->getId() );
|
||||
|
||||
auto seq = m_sourceChara->getCurrentTerritory()->getNextEffectSequence();
|
||||
|
||||
auto effectPacket = std::make_shared< Server::EffectPacket >( m_sourceChara->getId(), result->getTarget()->getId(), m_actionId );
|
||||
effectPacket->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) );
|
||||
effectPacket->setSequence( seq, m_sequence );
|
||||
|
||||
effectPacket->addEffect( result->buildEffectEntry() );
|
||||
|
||||
m_sourceChara->sendToInRangeSet( effectPacket, true );
|
||||
|
||||
// add effect to territory
|
||||
m_sourceChara->getCurrentTerritory()->addEffectResult( std::move( result ) );
|
||||
|
||||
it = m_resolvedEffects.erase( it );
|
||||
}
|
||||
}
|
39
src/world/Action/EffectBuilder.h
Normal file
39
src/world/Action/EffectBuilder.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
#ifndef SAPPHIRE_EFFECTBUILDER_H
|
||||
#define SAPPHIRE_EFFECTBUILDER_H
|
||||
|
||||
#include <ForwardsZone.h>
|
||||
#include <Common.h>
|
||||
|
||||
namespace Sapphire::World::Action
|
||||
{
|
||||
class EffectBuilder
|
||||
{
|
||||
public:
|
||||
EffectBuilder( Entity::CharaPtr source, uint32_t actionId, uint16_t sequence );
|
||||
|
||||
|
||||
void healTarget( Entity::CharaPtr& target, uint32_t amount,
|
||||
Common::ActionHitSeverityType severity = Common::ActionHitSeverityType::NormalHeal );
|
||||
|
||||
void damageTarget( Entity::CharaPtr& target, uint32_t amount,
|
||||
Common::ActionHitSeverityType severity = Common::ActionHitSeverityType::NormalDamage );
|
||||
|
||||
void buildAndSendPackets();
|
||||
|
||||
|
||||
private:
|
||||
EffectResultPtr getResult( Entity::CharaPtr& chara );
|
||||
|
||||
uint64_t getResultDelayMs();
|
||||
|
||||
private:
|
||||
uint32_t m_actionId;
|
||||
uint16_t m_sequence;
|
||||
|
||||
Entity::CharaPtr m_sourceChara;
|
||||
std::unordered_map< uint32_t, EffectResultPtr > m_resolvedEffects;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SAPPHIRE_EFFECTBUILDER_H
|
90
src/world/Action/EffectResult.cpp
Normal file
90
src/world/Action/EffectResult.cpp
Normal file
|
@ -0,0 +1,90 @@
|
|||
#include "EffectResult.h"
|
||||
|
||||
#include <Util/Util.h>
|
||||
|
||||
#include "Actor/Chara.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
|
||||
EffectResult::EffectResult( Entity::CharaPtr target, uint64_t runAfter ) :
|
||||
m_target( std::move( target ) ),
|
||||
m_delayMs( runAfter ),
|
||||
m_value( 0 ),
|
||||
m_severity( Common::ActionHitSeverityType::NormalDamage ),
|
||||
m_type( Common::ActionEffectType::Nothing ),
|
||||
m_param( 0 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Entity::CharaPtr EffectResult::getTarget() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
uint32_t EffectResult::getValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
uint64_t EffectResult::getDelay()
|
||||
{
|
||||
return m_delayMs;
|
||||
}
|
||||
|
||||
void EffectResult::setParam( uint8_t param )
|
||||
{
|
||||
m_param = param;
|
||||
}
|
||||
|
||||
void EffectResult::damage( uint32_t amount, Common::ActionHitSeverityType severity )
|
||||
{
|
||||
m_severity = severity;
|
||||
m_value = amount;
|
||||
|
||||
m_type = Common::ActionEffectType::Damage;
|
||||
}
|
||||
|
||||
void EffectResult::heal( uint32_t amount, Sapphire::Common::ActionHitSeverityType severity )
|
||||
{
|
||||
m_severity = severity;
|
||||
m_value = amount;
|
||||
|
||||
m_type = Common::ActionEffectType::Heal;
|
||||
}
|
||||
|
||||
Common::EffectEntry EffectResult::buildEffectEntry() const
|
||||
{
|
||||
Common::EffectEntry entry{};
|
||||
|
||||
// todo: that retarded shit so > u16 max numbers work
|
||||
entry.value = getValue();
|
||||
entry.hitSeverity = m_severity;
|
||||
entry.effectType = m_type;
|
||||
entry.param = m_param;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
void EffectResult::execute()
|
||||
{
|
||||
switch( m_type )
|
||||
{
|
||||
case Common::ActionEffectType::Damage:
|
||||
{
|
||||
m_target->takeDamage( m_value );
|
||||
break;
|
||||
}
|
||||
|
||||
case Common::ActionEffectType::Heal:
|
||||
{
|
||||
m_target->heal( m_value );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
46
src/world/Action/EffectResult.h
Normal file
46
src/world/Action/EffectResult.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef SAPPHIRE_EFFECTRESULT_H
|
||||
#define SAPPHIRE_EFFECTRESULT_H
|
||||
|
||||
#include <ForwardsZone.h>
|
||||
#include <Common.h>
|
||||
|
||||
namespace Sapphire::World::Action
|
||||
{
|
||||
/*!
|
||||
* @brief A container for the computed result of an effect on a single actor. Used to apply damage/healing dealt
|
||||
* at a later point in time.
|
||||
*/
|
||||
class EffectResult
|
||||
{
|
||||
public:
|
||||
explicit EffectResult( Entity::CharaPtr target, uint64_t delayMs );
|
||||
|
||||
void damage( uint32_t amount, Common::ActionHitSeverityType severity );
|
||||
void heal( uint32_t amount, Common::ActionHitSeverityType severity );
|
||||
|
||||
Entity::CharaPtr getTarget() const;
|
||||
|
||||
uint32_t getValue() const;
|
||||
|
||||
uint64_t getDelay();
|
||||
|
||||
void setParam( uint8_t param );
|
||||
|
||||
Common::EffectEntry buildEffectEntry() const;
|
||||
|
||||
void execute();
|
||||
|
||||
private:
|
||||
uint64_t m_delayMs;
|
||||
|
||||
Entity::CharaPtr m_target;
|
||||
|
||||
Common::ActionHitSeverityType m_severity;
|
||||
Common::ActionEffectType m_type;
|
||||
|
||||
uint32_t m_value;
|
||||
uint8_t m_param;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SAPPHIRE_EFFECTRESULT_H
|
|
@ -6,7 +6,7 @@
|
|||
#include <Util/UtilMath.h>
|
||||
#include <utility>
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
|
@ -66,7 +66,7 @@ void Sapphire::Entity::Actor::setPos( float x, float y, float z, bool broadcastU
|
|||
m_pos.z = z;
|
||||
|
||||
if( broadcastUpdate )
|
||||
m_pCurrentZone->updateActorPosition( *this );
|
||||
m_pCurrentTerritory->updateActorPosition( *this );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Actor::setPos( const Sapphire::Common::FFXIVARR_POSITION3& pos, bool broadcastUpdate )
|
||||
|
@ -74,7 +74,7 @@ void Sapphire::Entity::Actor::setPos( const Sapphire::Common::FFXIVARR_POSITION3
|
|||
m_pos = pos;
|
||||
|
||||
if( broadcastUpdate )
|
||||
m_pCurrentZone->updateActorPosition( *this );
|
||||
m_pCurrentTerritory->updateActorPosition( *this );
|
||||
}
|
||||
|
||||
float Sapphire::Entity::Actor::getRot() const
|
||||
|
@ -330,23 +330,23 @@ std::set< Sapphire::Entity::ActorPtr > Sapphire::Entity::Actor::getInRangeActors
|
|||
return tempInRange;
|
||||
}
|
||||
|
||||
/*! \return ZonePtr to the current zone, nullptr if not set */
|
||||
Sapphire::ZonePtr Sapphire::Entity::Actor::getCurrentZone() const
|
||||
/*! \return TerritoryPtr to the current zone, nullptr if not set */
|
||||
Sapphire::TerritoryPtr Sapphire::Entity::Actor::getCurrentTerritory() const
|
||||
{
|
||||
return m_pCurrentZone;
|
||||
return m_pCurrentTerritory;
|
||||
}
|
||||
|
||||
/*! \param ZonePtr to the zone to be set as current */
|
||||
void Sapphire::Entity::Actor::setCurrentZone( ZonePtr currZone )
|
||||
/*! \param TerritoryPtr to the zone to be set as current */
|
||||
void Sapphire::Entity::Actor::setCurrentZone( TerritoryPtr currZone )
|
||||
{
|
||||
m_pCurrentZone = currZone;
|
||||
m_pCurrentTerritory = currZone;
|
||||
}
|
||||
|
||||
/*! \return InstanceContentPtr to the current instance, nullptr if not an instance or not set */
|
||||
Sapphire::InstanceContentPtr Sapphire::Entity::Actor::getCurrentInstance() const
|
||||
{
|
||||
if( m_pCurrentZone )
|
||||
return m_pCurrentZone->getAsInstanceContent();
|
||||
if( m_pCurrentTerritory )
|
||||
return m_pCurrentTerritory->getAsInstanceContent();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -354,8 +354,8 @@ Sapphire::InstanceContentPtr Sapphire::Entity::Actor::getCurrentInstance() const
|
|||
/*! \return QuestBattlePtr to the current instance, nullptr if not an instance or not set */
|
||||
Sapphire::QuestBattlePtr Sapphire::Entity::Actor::getCurrentQuestBattle() const
|
||||
{
|
||||
if( m_pCurrentZone )
|
||||
return m_pCurrentZone->getAsQuestBattle();
|
||||
if( m_pCurrentTerritory )
|
||||
return m_pCurrentTerritory->getAsQuestBattle();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Sapphire::Entity
|
|||
/*! Id of the zone the actor currently is in */
|
||||
uint32_t m_territoryTypeId;
|
||||
/*! Ptr to the ZoneObj the actor belongs to */
|
||||
ZonePtr m_pCurrentZone;
|
||||
TerritoryPtr m_pCurrentTerritory;
|
||||
|
||||
/*! list of various actors in range */
|
||||
std::set< ActorPtr > m_inRangeActor;
|
||||
|
@ -122,9 +122,9 @@ namespace Sapphire::Entity
|
|||
|
||||
BNpcPtr getAsBNpc();
|
||||
|
||||
ZonePtr getCurrentZone() const;
|
||||
TerritoryPtr getCurrentTerritory() const;
|
||||
|
||||
void setCurrentZone( ZonePtr currZone );
|
||||
void setCurrentZone( TerritoryPtr currZone );
|
||||
|
||||
InstanceContentPtr getCurrentInstance() const;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "Forwards.h"
|
||||
#include "Action/Action.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
|
@ -53,7 +53,7 @@ Sapphire::Entity::BNpc::BNpc( FrameworkPtr pFw ) :
|
|||
}
|
||||
|
||||
Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
||||
uint8_t level, uint32_t maxHp, ZonePtr pZone, FrameworkPtr pFw ) :
|
||||
uint8_t level, uint32_t maxHp, TerritoryPtr pZone, FrameworkPtr pFw ) :
|
||||
Npc( ObjKind::BattleNpc, pFw )
|
||||
{
|
||||
m_id = id;
|
||||
|
@ -78,7 +78,7 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX
|
|||
|
||||
m_class = ClassJob::Adventurer;
|
||||
|
||||
m_pCurrentZone = std::move( pZone );
|
||||
m_pCurrentTerritory = std::move( pZone );
|
||||
|
||||
m_spawnPos = m_pos;
|
||||
|
||||
|
@ -194,13 +194,13 @@ void Sapphire::Entity::BNpc::setState( BNpcState state )
|
|||
bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||
{
|
||||
|
||||
auto pNaviProvider = m_pCurrentZone->getNaviProvider();
|
||||
auto pNaviProvider = m_pCurrentTerritory->getNaviProvider();
|
||||
|
||||
if( !pNaviProvider )
|
||||
{
|
||||
Logger::error( "No NaviProvider for zone#{0} - {1}",
|
||||
m_pCurrentZone->getGuId(),
|
||||
m_pCurrentZone->getInternalName() );
|
||||
m_pCurrentTerritory->getGuId(),
|
||||
m_pCurrentTerritory->getInternalName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
|||
return true;
|
||||
}
|
||||
|
||||
m_pCurrentZone->updateActorPosition( *this );
|
||||
m_pCurrentTerritory->updateActorPosition( *this );
|
||||
face( pos );
|
||||
setPos( pos1 );
|
||||
sendPositionUpdate();
|
||||
|
@ -226,13 +226,13 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
|||
bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara )
|
||||
{
|
||||
|
||||
auto pNaviProvider = m_pCurrentZone->getNaviProvider();
|
||||
auto pNaviProvider = m_pCurrentTerritory->getNaviProvider();
|
||||
|
||||
if( !pNaviProvider )
|
||||
{
|
||||
Logger::error( "No NaviProvider for zone#{0} - {1}",
|
||||
m_pCurrentZone->getGuId(),
|
||||
m_pCurrentZone->getInternalName() );
|
||||
m_pCurrentTerritory->getGuId(),
|
||||
m_pCurrentTerritory->getInternalName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara )
|
|||
return true;
|
||||
}
|
||||
|
||||
m_pCurrentZone->updateActorPosition( *this );
|
||||
m_pCurrentTerritory->updateActorPosition( *this );
|
||||
face( targetChara.getPos() );
|
||||
setPos( pos1 );
|
||||
sendPositionUpdate();
|
||||
|
@ -407,7 +407,7 @@ void Sapphire::Entity::BNpc::update( uint64_t tickCount )
|
|||
const uint8_t maxDistanceToOrigin = 40;
|
||||
const uint32_t roamTick = 20;
|
||||
|
||||
auto pNaviProvider = m_pCurrentZone->getNaviProvider();
|
||||
auto pNaviProvider = m_pCurrentTerritory->getNaviProvider();
|
||||
|
||||
if( !pNaviProvider )
|
||||
return;
|
||||
|
@ -692,7 +692,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
|||
srand( static_cast< uint32_t >( tick ) );
|
||||
|
||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
||||
auto damage = Math::CalcStats::calculateAutoAttackDamage( *this );
|
||||
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
||||
|
||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
|
||||
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Sapphire::Entity
|
|||
public:
|
||||
BNpc( FrameworkPtr pFw );
|
||||
BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
||||
uint8_t level, uint32_t maxHp, ZonePtr pZone,FrameworkPtr pFw );
|
||||
uint8_t level, uint32_t maxHp, TerritoryPtr pZone,FrameworkPtr pFw );
|
||||
|
||||
virtual ~BNpc() override;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "Forwards.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
|
@ -123,6 +123,67 @@ void Sapphire::Entity::Chara::setClass( Common::ClassJob classJob )
|
|||
m_class = classJob;
|
||||
}
|
||||
|
||||
Sapphire::Common::Role Sapphire::Entity::Chara::getRole() const
|
||||
{
|
||||
switch( getClass() )
|
||||
{
|
||||
case ClassJob::Gladiator:
|
||||
case ClassJob::Marauder:
|
||||
case ClassJob::Paladin:
|
||||
case ClassJob::Warrior:
|
||||
case ClassJob::Darkknight:
|
||||
case ClassJob::Gunbreaker:
|
||||
return Role::Tank;
|
||||
|
||||
case ClassJob::Pugilist:
|
||||
case ClassJob::Lancer:
|
||||
case ClassJob::Monk:
|
||||
case ClassJob::Dragoon:
|
||||
case ClassJob::Rogue:
|
||||
case ClassJob::Ninja:
|
||||
case ClassJob::Samurai:
|
||||
return Role::Melee;
|
||||
|
||||
case ClassJob::Archer:
|
||||
case ClassJob::Bard:
|
||||
case ClassJob::Machinist:
|
||||
case ClassJob::Dancer:
|
||||
return Role::RangedPhysical;
|
||||
|
||||
case ClassJob::Conjurer:
|
||||
case ClassJob::Whitemage:
|
||||
case ClassJob::Scholar:
|
||||
case ClassJob::Astrologian:
|
||||
return Role::Healer;
|
||||
|
||||
case ClassJob::Thaumaturge:
|
||||
case ClassJob::Blackmage:
|
||||
case ClassJob::Arcanist:
|
||||
case ClassJob::Summoner:
|
||||
case ClassJob::Redmage:
|
||||
case ClassJob::Bluemage:
|
||||
return Role::RangedMagical;
|
||||
|
||||
case ClassJob::Carpenter:
|
||||
case ClassJob::Blacksmith:
|
||||
case ClassJob::Armorer:
|
||||
case ClassJob::Goldsmith:
|
||||
case ClassJob::Leatherworker:
|
||||
case ClassJob::Weaver:
|
||||
case ClassJob::Alchemist:
|
||||
case ClassJob::Culinarian:
|
||||
return Role::Crafter;
|
||||
|
||||
case ClassJob::Miner:
|
||||
case ClassJob::Botanist:
|
||||
case ClassJob::Fisher:
|
||||
return Role::Gatherer;
|
||||
|
||||
default:
|
||||
return Role::None;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \param Id of the target to set */
|
||||
void Sapphire::Entity::Chara::setTargetId( uint64_t targetId )
|
||||
{
|
||||
|
@ -460,18 +521,21 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
|||
auto statusEffectAdd = makeZonePacket< FFXIVIpcEffectResult >( getId() );
|
||||
|
||||
statusEffectAdd->data().actor_id = pEffect->getTargetActorId();
|
||||
statusEffectAdd->data().actor_id1 = pEffect->getSrcActorId();
|
||||
statusEffectAdd->data().current_hp = getHp();
|
||||
statusEffectAdd->data().current_mp = getMp();
|
||||
statusEffectAdd->data().current_tp = getTp();
|
||||
statusEffectAdd->data().duration = static_cast< float >( pEffect->getDuration() ) / 1000;
|
||||
statusEffectAdd->data().effect_id = pEffect->getId();
|
||||
statusEffectAdd->data().effect_index = nextSlot;
|
||||
statusEffectAdd->data().max_hp = getMaxHp();
|
||||
statusEffectAdd->data().max_mp = getMaxMp();
|
||||
statusEffectAdd->data().max_something = 1;
|
||||
//statusEffectAdd->data().unknown2 = 28;
|
||||
statusEffectAdd->data().param = pEffect->getParam();
|
||||
|
||||
auto& status = statusEffectAdd->data().statusEntries[0];
|
||||
|
||||
status.sourceActorId = pEffect->getSrcActorId();
|
||||
status.duration = static_cast< float >( pEffect->getDuration() ) / 1000;
|
||||
status.id = pEffect->getId();
|
||||
status.index = nextSlot;
|
||||
status.param = pEffect->getParam();
|
||||
|
||||
sendToInRangeSet( statusEffectAdd, isPlayer() );
|
||||
}
|
||||
|
|
|
@ -209,6 +209,8 @@ namespace Sapphire::Entity
|
|||
|
||||
void setClass( Common::ClassJob classJob );
|
||||
|
||||
Common::Role getRole() const;
|
||||
|
||||
void setTargetId( uint64_t targetId );
|
||||
|
||||
uint64_t getTargetId() const;
|
||||
|
|
|
@ -102,12 +102,12 @@ uint32_t Sapphire::Entity::EventObject::getHousingLink() const
|
|||
return m_housingLink;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::EventObject::setParentInstance( Sapphire::ZonePtr instance )
|
||||
void Sapphire::Entity::EventObject::setParentInstance( Sapphire::TerritoryPtr instance )
|
||||
{
|
||||
m_parentInstance = instance;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::Entity::EventObject::getParentInstance() const
|
||||
Sapphire::TerritoryPtr Sapphire::Entity::EventObject::getParentInstance() const
|
||||
{
|
||||
return m_parentInstance;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Sapphire::Entity
|
|||
Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" );
|
||||
|
||||
using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr,
|
||||
ZonePtr, uint64_t ) >;
|
||||
TerritoryPtr, uint64_t ) >;
|
||||
|
||||
uint32_t getGimmickId() const;
|
||||
|
||||
|
@ -35,9 +35,9 @@ namespace Sapphire::Entity
|
|||
|
||||
const std::string& getName() const;
|
||||
|
||||
ZonePtr getParentInstance() const;
|
||||
TerritoryPtr getParentInstance() const;
|
||||
|
||||
void setParentInstance( ZonePtr instance );
|
||||
void setParentInstance( TerritoryPtr instance );
|
||||
|
||||
void spawn( PlayerPtr pTarget ) override;
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace Sapphire::Entity
|
|||
uint8_t m_state;
|
||||
float m_scale;
|
||||
std::string m_name;
|
||||
ZonePtr m_parentInstance;
|
||||
TerritoryPtr m_parentInstance;
|
||||
OnTalkEventHandler m_onTalkEventHandler;
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Forwards.h"
|
||||
#include "Action/Action.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Manager/RNGMgr.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/ZonePosition.h"
|
||||
#include "Territory/InstanceContent.h"
|
||||
#include "Territory/Land.h"
|
||||
|
@ -311,8 +311,8 @@ bool Sapphire::Entity::Player::isAutoattackOn() const
|
|||
|
||||
void Sapphire::Entity::Player::sendStats()
|
||||
{
|
||||
|
||||
auto statPacket = makeZonePacket< FFXIVIpcPlayerStats >( getId() );
|
||||
|
||||
statPacket->data().strength = getStatValue( Common::BaseParam::Strength );
|
||||
statPacket->data().dexterity = getStatValue( Common::BaseParam::Dexterity );
|
||||
statPacket->data().vitality = getStatValue( Common::BaseParam::Vitality );
|
||||
|
@ -322,16 +322,14 @@ void Sapphire::Entity::Player::sendStats()
|
|||
statPacket->data().determination = getStatValue( Common::BaseParam::Determination );
|
||||
statPacket->data().hp = getStatValue( Common::BaseParam::HP );
|
||||
statPacket->data().mp = getStatValue( Common::BaseParam::MP );
|
||||
statPacket->data().accuracy = m_baseStats.accuracy;
|
||||
statPacket->data().attack = getStatValue( Common::BaseParam::AttackPower );
|
||||
statPacket->data().directHitRate = getStatValue( Common::BaseParam::DirectHitRate );
|
||||
statPacket->data().attackPower = getStatValue( Common::BaseParam::AttackPower );
|
||||
statPacket->data().attackMagicPotency = getStatValue( Common::BaseParam::AttackMagicPotency );
|
||||
statPacket->data().healingMagicPotency = getStatValue( Common::BaseParam::HealingMagicPotency );
|
||||
statPacket->data().skillSpeed = getStatValue( Common::BaseParam::SkillSpeed );
|
||||
statPacket->data().spellSpeed = getStatValue( Common::BaseParam::SpellSpeed );
|
||||
statPacket->data().spellSpeed1 = getStatValue( Common::BaseParam::SpellSpeed );
|
||||
statPacket->data().spellSpeedMod = 100;
|
||||
|
||||
statPacket->data().criticalHitRate = getStatValue( Common::BaseParam::CriticalHit );
|
||||
statPacket->data().haste = 100;
|
||||
statPacket->data().criticalHit = getStatValue( Common::BaseParam::CriticalHit );
|
||||
statPacket->data().defense = getStatValue( Common::BaseParam::Defense );
|
||||
statPacket->data().magicDefense = getStatValue( Common::BaseParam::MagicDefense );
|
||||
statPacket->data().tenacity = getStatValue( Common::BaseParam::Tenacity );
|
||||
|
@ -437,14 +435,14 @@ bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
|||
return setInstance( instance );
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
|
||||
bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance )
|
||||
{
|
||||
m_onEnterEventDone = false;
|
||||
if( !instance )
|
||||
return false;
|
||||
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto currentZone = getCurrentZone();
|
||||
auto currentZone = getCurrentTerritory();
|
||||
|
||||
// zoning within the same zone won't cause the prev data to be overwritten
|
||||
if( instance->getTerritoryTypeId() != m_territoryTypeId )
|
||||
|
@ -458,14 +456,14 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
|
|||
return pTeriMgr->movePlayer( instance, getAsPlayer() );
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::setInstance( ZonePtr instance, Common::FFXIVARR_POSITION3 pos )
|
||||
bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIVARR_POSITION3 pos )
|
||||
{
|
||||
m_onEnterEventDone = false;
|
||||
if( !instance )
|
||||
return false;
|
||||
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto currentZone = getCurrentZone();
|
||||
auto currentZone = getCurrentTerritory();
|
||||
|
||||
// zoning within the same zone won't cause the prev data to be overwritten
|
||||
if( instance->getTerritoryTypeId() != m_territoryTypeId )
|
||||
|
@ -489,7 +487,7 @@ bool Sapphire::Entity::Player::exitInstance()
|
|||
{
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
||||
auto pZone = getCurrentZone();
|
||||
auto pZone = getCurrentTerritory();
|
||||
auto pInstance = pZone->getAsInstanceContent();
|
||||
|
||||
resetHp();
|
||||
|
@ -596,7 +594,7 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
|||
int32_t offset = 4;
|
||||
|
||||
auto info = pExdData->get< Sapphire::Data::Map >(
|
||||
pExdData->get< Sapphire::Data::TerritoryType >( getCurrentZone()->getTerritoryTypeId() )->map );
|
||||
pExdData->get< Sapphire::Data::TerritoryType >( getCurrentTerritory()->getTerritoryTypeId() )->map );
|
||||
if( info->discoveryArrayByte )
|
||||
offset = 5 + 2 * info->discoveryIndex;
|
||||
else
|
||||
|
@ -1065,7 +1063,7 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
|||
if( m_queuedZoneing && ( tickCount - m_queuedZoneing->m_queueTime ) > 800 )
|
||||
{
|
||||
Common::FFXIVARR_POSITION3 targetPos = m_queuedZoneing->m_targetPosition;
|
||||
if( getCurrentZone()->getTerritoryTypeId() != m_queuedZoneing->m_targetZone )
|
||||
if( getCurrentTerritory()->getTerritoryTypeId() != m_queuedZoneing->m_targetZone )
|
||||
{
|
||||
performZoning( m_queuedZoneing->m_targetZone, targetPos, m_queuedZoneing->m_targetRotation );
|
||||
}
|
||||
|
@ -1567,7 +1565,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
|||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
||||
auto variation = static_cast< uint32_t >( pRNGMgr->getRandGenerator< float >( 0, 3 ).next() );
|
||||
|
||||
auto damage = Math::CalcStats::calculateAutoAttackDamage( *this );
|
||||
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
||||
|
||||
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
||||
{
|
||||
|
@ -1683,7 +1681,7 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
pServerMgr->updatePlayerName( getId(), getName() );
|
||||
}
|
||||
|
||||
getCurrentZone()->onBeforePlayerZoneIn( *this );
|
||||
getCurrentTerritory()->onBeforePlayerZoneIn( *this );
|
||||
|
||||
auto initPacket = makeZonePacket< FFXIVIpcInit >( getId() );
|
||||
initPacket->data().charId = getId();
|
||||
|
@ -1749,17 +1747,17 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
sendLandFlags();
|
||||
|
||||
auto initZonePacket = makeZonePacket< FFXIVIpcInitZone >( getId() );
|
||||
initZonePacket->data().zoneId = getCurrentZone()->getTerritoryTypeId();
|
||||
initZonePacket->data().weatherId = static_cast< uint8_t >( getCurrentZone()->getCurrentWeather() );
|
||||
initZonePacket->data().zoneId = getCurrentTerritory()->getTerritoryTypeId();
|
||||
initZonePacket->data().weatherId = static_cast< uint8_t >( getCurrentTerritory()->getCurrentWeather() );
|
||||
initZonePacket->data().bitmask = 0x1;
|
||||
initZonePacket->data().festivalId = getCurrentZone()->getCurrentFestival().first;
|
||||
initZonePacket->data().additionalFestivalId = getCurrentZone()->getCurrentFestival().second;
|
||||
initZonePacket->data().festivalId = getCurrentTerritory()->getCurrentFestival().first;
|
||||
initZonePacket->data().additionalFestivalId = getCurrentTerritory()->getCurrentFestival().second;
|
||||
initZonePacket->data().pos.x = getPos().x;
|
||||
initZonePacket->data().pos.y = getPos().y;
|
||||
initZonePacket->data().pos.z = getPos().z;
|
||||
queuePacket( initZonePacket );
|
||||
|
||||
getCurrentZone()->onPlayerZoneIn( *this );
|
||||
getCurrentTerritory()->onPlayerZoneIn( *this );
|
||||
|
||||
if( isLogin() )
|
||||
{
|
||||
|
|
|
@ -480,10 +480,10 @@ namespace Sapphire::Entity
|
|||
bool setInstance( uint32_t instanceContentId );
|
||||
|
||||
/*! sets the players instance & initiates zoning process */
|
||||
bool setInstance( ZonePtr instance );
|
||||
bool setInstance( TerritoryPtr instance );
|
||||
|
||||
/*! sets the players instance & initiates zoning process */
|
||||
bool setInstance( Sapphire::ZonePtr instance, Sapphire::Common::FFXIVARR_POSITION3 pos );
|
||||
bool setInstance( Sapphire::TerritoryPtr instance, Sapphire::Common::FFXIVARR_POSITION3 pos );
|
||||
|
||||
/*! returns the player to their position before zoning into an instance */
|
||||
bool exitInstance();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/DirectorPlayScenePacket.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <Network/CommonActorControl.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Inventory/Item.h"
|
||||
#include "Inventory/ItemContainer.h"
|
||||
#include "Manager/ItemMgr.h"
|
||||
|
@ -64,7 +64,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
m_prevPos.z = res->getFloat( "OPosZ" );
|
||||
m_prevRot = res->getFloat( "OPosR" );
|
||||
|
||||
ZonePtr pCurrZone = nullptr;
|
||||
TerritoryPtr pCurrZone = nullptr;
|
||||
|
||||
// if the zone is an instanceContent zone, we need to actually find the instance
|
||||
if( pTeriMgr->isInstanceContentTerritory( zoneId ) )
|
||||
|
@ -108,7 +108,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
// see if a valid zone could be found for the character
|
||||
if( !pCurrZone )
|
||||
{
|
||||
Logger::error( "[{0}] Zone #{1} not found!", char_id_str, zoneId );
|
||||
Logger::error( "[{0}] Territory #{1} not found!", char_id_str, zoneId );
|
||||
Logger::error( "[{0}] Setting default zone instead", char_id_str );
|
||||
|
||||
// default to new gridania
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef std::vector< x > x ## PtrList;
|
|||
namespace Sapphire
|
||||
{
|
||||
TYPE_FORWARD( Cell );
|
||||
TYPE_FORWARD( Zone );
|
||||
TYPE_FORWARD( Territory );
|
||||
TYPE_FORWARD( HousingZone );
|
||||
TYPE_FORWARD( House );
|
||||
TYPE_FORWARD( InstanceContent );
|
||||
|
@ -87,6 +87,8 @@ namespace World::Action
|
|||
TYPE_FORWARD( Action );
|
||||
TYPE_FORWARD( EventAction );
|
||||
TYPE_FORWARD( ItemAction );
|
||||
TYPE_FORWARD( EffectBuilder );
|
||||
TYPE_FORWARD( EffectResult );
|
||||
|
||||
using ActionCallback = std::function< void( Entity::Player&, uint32_t, uint64_t ) >;
|
||||
}
|
||||
|
|
|
@ -19,12 +19,13 @@ World::Manager::ActionMgr::ActionMgr( Sapphire::FrameworkPtr pFw ) :
|
|||
}
|
||||
|
||||
void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos )
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos,
|
||||
uint16_t sequence )
|
||||
{
|
||||
player.sendDebug( "got aoe act: {0}", actionData->name );
|
||||
|
||||
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, actionData, framework() );
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData, framework() );
|
||||
|
||||
if( !action->init() )
|
||||
return;
|
||||
|
@ -42,9 +43,10 @@ void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player
|
|||
}
|
||||
|
||||
void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, uint64_t targetId )
|
||||
Data::ActionPtr actionData, uint64_t targetId,
|
||||
uint16_t sequence )
|
||||
{
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, actionData, framework() );
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData, framework() );
|
||||
|
||||
action->setTargetId( targetId );
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace Sapphire::World::Manager
|
|||
~ActionMgr() = default;
|
||||
|
||||
void handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, uint64_t targetId );
|
||||
Data::ActionPtr actionData, uint64_t targetId, uint16_t sequence );
|
||||
void handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos );
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos, uint16_t sequence );
|
||||
|
||||
void handleItemAction( Entity::Player& player, uint32_t itemId, Data::ItemActionPtr itemActionData,
|
||||
uint16_t itemSourceSlot, uint16_t itemSourceContainer );
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "Actor/EventObject.h"
|
||||
#include "Actor/BNpc.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/HousingZone.h"
|
||||
#include "Territory/InstanceContent.h"
|
||||
#include "Territory/QuestBattle.h"
|
||||
|
@ -304,7 +304,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
|||
|
||||
sscanf( params.c_str(), "%d", &weatherId );
|
||||
|
||||
player.getCurrentZone()->setWeatherOverride( static_cast< Common::Weather >( weatherId ) );
|
||||
player.getCurrentTerritory()->setWeatherOverride( static_cast< Common::Weather >( weatherId ) );
|
||||
}
|
||||
else if( subCommand == "festival" )
|
||||
{
|
||||
|
@ -448,7 +448,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
|||
player.sendNotice( "Template {0} not found in cache!", params );
|
||||
return;
|
||||
}
|
||||
auto playerZone = player.getCurrentZone();
|
||||
auto playerZone = player.getCurrentTerritory();
|
||||
auto pBNpc = std::make_shared< Entity::BNpc >( playerZone->getNextActorId(),
|
||||
bNpcTemplate,
|
||||
player.getPos().x,
|
||||
|
@ -538,7 +538,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
|||
|
||||
effectPacket->addEffect( entry );
|
||||
|
||||
auto sequence = player.getCurrentZone()->getNextEffectSequence();
|
||||
auto sequence = player.getCurrentTerritory()->getNextEffectSequence();
|
||||
effectPacket->setSequence( sequence );
|
||||
|
||||
// effectPacket->setAnimationId( param1 );
|
||||
|
@ -581,11 +581,11 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player&
|
|||
if( ( subCommand == "pos" ) )
|
||||
{
|
||||
|
||||
int16_t map_id = pExdData->get< Sapphire::Data::TerritoryType >( player.getCurrentZone()->getTerritoryTypeId() )->map;
|
||||
int16_t map_id = pExdData->get< Sapphire::Data::TerritoryType >( player.getCurrentTerritory()->getTerritoryTypeId() )->map;
|
||||
|
||||
player.sendNotice( "Pos:\n {0}\n {1}\n {2}\n {3}\n MapId: {4}\n ZoneId:{5}",
|
||||
player.getPos().x, player.getPos().y, player.getPos().z,
|
||||
player.getRot(), map_id, player.getCurrentZone()->getTerritoryTypeId() );
|
||||
player.getRot(), map_id, player.getCurrentTerritory()->getTerritoryTypeId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -919,7 +919,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
sscanf( params.c_str(), "%d %d", &index, &value );
|
||||
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -932,7 +932,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
|
||||
sscanf( params.c_str(), "%s %hhu", objName, &state );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -950,7 +950,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
|
||||
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -969,7 +969,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
|
||||
sscanf( params.c_str(), "%hhu", &seq );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -981,7 +981,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
|
||||
sscanf( params.c_str(), "%hhu", &branch );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -989,7 +989,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
}
|
||||
else if( subCommand == "qte_start" )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -998,7 +998,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
}
|
||||
else if( subCommand == "event_start" )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
}
|
||||
else if( subCommand == "event_end" )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
else if( subCommand == "complete" )
|
||||
{
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
else if( subCommand == "fail" )
|
||||
{
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
sscanf( params.c_str(), "%d %d", &index, &value );
|
||||
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
|
||||
sscanf( params.c_str(), "%s %hhu", objName, &state );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
|
||||
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1164,7 +1164,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
|
||||
sscanf( params.c_str(), "%hhu", &seq );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
|
||||
sscanf( params.c_str(), "%hhu", &branch );
|
||||
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
}
|
||||
else if( subCommand == "qte_start" )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
}
|
||||
else if( subCommand == "event_start" )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
|||
}
|
||||
else if( subCommand == "event_end" )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentZone() );
|
||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
||||
if( !instance )
|
||||
return;
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Pla
|
|||
//
|
||||
// if ( permissionSet < 5 )
|
||||
// {
|
||||
// auto pZone = player.getCurrentZone();
|
||||
// auto pZone = player.getCurrentTerritory();
|
||||
// if( pTeriMgr->isHousingTerritory( pZone->getTerritoryTypeId() ) )
|
||||
// {
|
||||
// auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||
|
@ -1267,7 +1267,7 @@ void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Pla
|
|||
// player.sendLandFlags();
|
||||
// }
|
||||
// else
|
||||
// player.sendDebug( "You aren't in a housing Zone." );
|
||||
// player.sendDebug( "You aren't in a housing Territory." );
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "Event/EventDefs.h"
|
||||
|
||||
#include "TerritoryMgr.h"
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/HousingZone.h"
|
||||
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||
#include "HousingMgr.h"
|
||||
|
@ -362,7 +362,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& pla
|
|||
|
||||
Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand( Entity::Player& player, uint8_t plot, uint8_t state )
|
||||
{
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
|
||||
auto plotPrice = pHousing->getLand( plot )->getCurrentPrice();
|
||||
auto gilAvailable = player.getCurrency( CurrencyType::Gil );
|
||||
|
@ -418,7 +418,7 @@ bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& playe
|
|||
{
|
||||
// TODO: Fix "permissions" being sent incorrectly
|
||||
// TODO: Add checks for land state before relinquishing
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
|
||||
auto pLand = pHousing->getLand( plot );
|
||||
auto plotMaxPrice = pLand->getCurrentPrice();
|
||||
|
@ -660,7 +660,7 @@ void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house
|
|||
|
||||
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId )
|
||||
{
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -830,7 +830,8 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
|||
// and we have to switch up our way of getting the LandPtr
|
||||
if( plotNum == 255 )
|
||||
{
|
||||
auto internalZone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
auto internalZone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
||||
player.getCurrentTerritory() );
|
||||
if( !internalZone )
|
||||
return;
|
||||
|
||||
|
@ -846,7 +847,7 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
|||
}
|
||||
else
|
||||
{
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !zone )
|
||||
return;
|
||||
|
||||
|
@ -971,14 +972,15 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
|
|||
bool isOutside = false;
|
||||
|
||||
// inside housing territory
|
||||
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() ) )
|
||||
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
||||
{
|
||||
land = zone->getLand( landId );
|
||||
|
||||
isOutside = true;
|
||||
}
|
||||
// otherwise, inside a house. landId is 0 when inside a plot
|
||||
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() ) )
|
||||
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
||||
player.getCurrentTerritory() ) )
|
||||
{
|
||||
// todo: this whole process is retarded and needs to be fixed
|
||||
// perhaps maintain a list of estates by ident inside housingmgr?
|
||||
|
@ -1043,12 +1045,13 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
|
|||
LandPtr land;
|
||||
bool isOutside = false;
|
||||
|
||||
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() ) )
|
||||
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
||||
{
|
||||
land = zone->getLand( landId );
|
||||
isOutside = true;
|
||||
}
|
||||
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() ) )
|
||||
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
||||
player.getCurrentTerritory() ) )
|
||||
{
|
||||
// todo: this whole process is retarded and needs to be fixed
|
||||
// perhaps maintain a list of estates by ident inside housingmgr?
|
||||
|
@ -1133,7 +1136,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
|||
invMgr->updateHousingItemPosition( item );
|
||||
|
||||
// add to zone and spawn
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
assert( zone );
|
||||
|
||||
zone->spawnYardObject( ident.landId, freeSlot, *item );
|
||||
|
@ -1146,7 +1149,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
|||
{
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||
assert( zone );
|
||||
|
||||
auto ident = zone->getLandIdent();
|
||||
|
@ -1177,7 +1180,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
|||
invMgr->saveHousingContainer( ident, container );
|
||||
invMgr->updateHousingItemPosition( item );
|
||||
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||
assert( zone );
|
||||
|
||||
zone->spawnHousingObject( containerIdx, freeSlot, containerId, item );
|
||||
|
@ -1202,7 +1205,7 @@ Sapphire::Common::HousingObject Sapphire::World::Manager::HousingMgr::getYardObj
|
|||
void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sapphire::Entity::Player& player,
|
||||
bool storeroom )
|
||||
{
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||
if( !zone )
|
||||
return;
|
||||
|
||||
|
@ -1243,11 +1246,12 @@ void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& p
|
|||
|
||||
// todo: what happens when either of these fail? how does the server let the client know that the moment failed
|
||||
// as is, if it does fail, the client will be locked and unable to move any item until reentering the territory
|
||||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() ) )
|
||||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
||||
player.getCurrentTerritory() ) )
|
||||
{
|
||||
moveInternalItem( player, ident, *terri, slot, pos, rot );
|
||||
}
|
||||
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() ) )
|
||||
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
||||
{
|
||||
moveExternalItem( player, ident, slot, *terri, pos, rot );
|
||||
}
|
||||
|
@ -1339,7 +1343,8 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
|
|||
uint16_t containerId, uint8_t slot,
|
||||
bool sendToStoreroom )
|
||||
{
|
||||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() ) )
|
||||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
||||
player.getCurrentTerritory() ) )
|
||||
{
|
||||
auto ident = terri->getLandIdent();
|
||||
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum );
|
||||
|
@ -1353,7 +1358,7 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
|
|||
|
||||
removeInternalItem( player, *terri, containerId, slot, sendToStoreroom );
|
||||
}
|
||||
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() ) )
|
||||
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
||||
{
|
||||
auto land = terri->getLand( plot );
|
||||
if( !land )
|
||||
|
@ -1542,7 +1547,7 @@ Sapphire::ItemContainerPtr Sapphire::World::Manager::HousingMgr::getFreeEstateIn
|
|||
|
||||
void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::Entity::Player& player, uint16_t plot )
|
||||
{
|
||||
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !terri )
|
||||
return;
|
||||
|
||||
|
@ -1569,7 +1574,7 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
|
|||
|
||||
void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::Entity::Player& player )
|
||||
{
|
||||
auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||
if( !terri )
|
||||
return;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <Manager/TerritoryMgr.h>
|
||||
#include <Territory/ZonePosition.h>
|
||||
#include <Territory/Zone.h>
|
||||
#include <Territory/Territory.h>
|
||||
|
||||
#include <Manager/HousingMgr.h>
|
||||
|
||||
|
@ -26,7 +26,7 @@ void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire:
|
|||
if( !terriMgr )
|
||||
return;
|
||||
|
||||
Sapphire::ZonePtr destinationZone;
|
||||
Sapphire::TerritoryPtr destinationZone;
|
||||
|
||||
auto terriPos = terriMgr->getTerritoryPosition( landId );
|
||||
if( terriPos )
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/ZonePosition.h"
|
||||
#include "Territory/InstanceContent.h"
|
||||
#include "Territory/QuestBattle.h"
|
||||
|
@ -181,7 +181,7 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
|
|||
|
||||
uint32_t guid = getNextInstanceId();
|
||||
|
||||
auto pZone = make_Zone( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() );
|
||||
auto pZone = make_Territory( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() );
|
||||
pZone->init();
|
||||
|
||||
std::string bgPath = territoryInfo->bg;
|
||||
|
@ -197,11 +197,11 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
|
|||
hasNaviMesh ? "NAVI" : "",
|
||||
pPlaceName->name );
|
||||
|
||||
InstanceIdToZonePtrMap instanceMap;
|
||||
InstanceIdToTerritoryPtrMap instanceMap;
|
||||
instanceMap[ guid ] = pZone;
|
||||
m_guIdToZonePtrMap[ guid ] = pZone;
|
||||
m_guIdToTerritoryPtrMap[ guid ] = pZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ] = instanceMap;
|
||||
m_zoneSet.insert( { pZone } );
|
||||
m_territorySet.insert( { pZone } );
|
||||
|
||||
}
|
||||
|
||||
|
@ -243,12 +243,12 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
|
|||
pPlaceName->name, framework() );
|
||||
pHousingZone->init();
|
||||
|
||||
InstanceIdToZonePtrMap instanceMap;
|
||||
InstanceIdToTerritoryPtrMap instanceMap;
|
||||
instanceMap[ guid ] = pHousingZone;
|
||||
m_guIdToZonePtrMap[ guid ] = pHousingZone;
|
||||
m_guIdToTerritoryPtrMap[ guid ] = pHousingZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ guid ] = pHousingZone;
|
||||
m_landSetIdToZonePtrMap[ pHousingZone->getLandSetId() ] = pHousingZone;
|
||||
m_zoneSet.insert( { pHousingZone } );
|
||||
m_landSetIdToTerritoryPtrMap[ pHousingZone->getLandSetId() ] = pHousingZone;
|
||||
m_territorySet.insert( { pHousingZone } );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
|
|||
return true;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstance( uint32_t territoryTypeId )
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstance( uint32_t territoryTypeId )
|
||||
{
|
||||
if( !isValidTerritory( territoryTypeId ) )
|
||||
return nullptr;
|
||||
|
@ -274,17 +274,17 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc
|
|||
|
||||
Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, pPlaceName->name );
|
||||
|
||||
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() );
|
||||
auto pZone = make_Territory( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() );
|
||||
pZone->init();
|
||||
|
||||
m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ pZone->getTerritoryTypeId() ][ pZone->getGuId() ] = pZone;
|
||||
m_zoneSet.insert( { pZone } );
|
||||
m_territorySet.insert( { pZone } );
|
||||
|
||||
return pZone;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uint32_t questBattleId )
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uint32_t questBattleId )
|
||||
{
|
||||
|
||||
auto it = m_questBattleToContentFinderMap.find( questBattleId );
|
||||
|
@ -321,13 +321,13 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uin
|
|||
pZone->init();
|
||||
|
||||
m_questBattleIdToInstanceMap[ questBattleId ][ pZone->getGuId() ] = pZone;
|
||||
m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_instanceZoneSet.insert( pZone );
|
||||
|
||||
return pZone;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( uint32_t contentFinderConditionId )
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( uint32_t contentFinderConditionId )
|
||||
{
|
||||
|
||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||
|
@ -355,19 +355,19 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent(
|
|||
pZone->init();
|
||||
|
||||
m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone;
|
||||
m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_instanceZoneSet.insert( pZone );
|
||||
|
||||
return pZone;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInterior( const Common::LandIdent landIdent )
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInterior( const Common::LandIdent landIdent )
|
||||
{
|
||||
// check if zone already spawned first
|
||||
auto ident = *reinterpret_cast< const uint64_t* >( &landIdent );
|
||||
|
||||
auto it = m_landIdentToZonePtrMap.find( ident );
|
||||
if( it != m_landIdentToZonePtrMap.end() )
|
||||
auto it = m_landIdentToTerritoryPtrMap.find( ident );
|
||||
if( it != m_landIdentToTerritoryPtrMap.end() )
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
@ -427,23 +427,23 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt
|
|||
|
||||
zone->init();
|
||||
|
||||
m_landIdentToZonePtrMap[ ident ] = zone;
|
||||
m_guIdToZonePtrMap[ zone->getGuId() ] = zone;
|
||||
m_zoneSet.insert( { zone } );
|
||||
m_landIdentToTerritoryPtrMap[ ident ] = zone;
|
||||
m_guIdToTerritoryPtrMap[ zone->getGuId() ] = zone;
|
||||
m_territorySet.insert( { zone } );
|
||||
|
||||
return zone;
|
||||
}
|
||||
|
||||
bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t guId )
|
||||
{
|
||||
ZonePtr pZone;
|
||||
TerritoryPtr pZone;
|
||||
if( ( pZone = getTerritoryByGuId( guId ) ) == nullptr )
|
||||
return false;
|
||||
|
||||
m_guIdToZonePtrMap.erase( pZone->getGuId() );
|
||||
m_guIdToTerritoryPtrMap.erase( pZone->getGuId() );
|
||||
|
||||
m_instanceZoneSet.erase( pZone );
|
||||
m_zoneSet.erase( pZone );
|
||||
m_territorySet.erase( pZone );
|
||||
|
||||
if( isInstanceContentTerritory( pZone->getTerritoryTypeId() ) )
|
||||
{
|
||||
|
@ -456,10 +456,10 @@ bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t g
|
|||
return true;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getTerritoryByGuId( uint32_t guId ) const
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getTerritoryByGuId( uint32_t guId ) const
|
||||
{
|
||||
auto it = m_guIdToZonePtrMap.find( guId );
|
||||
if( it == m_guIdToZonePtrMap.end() )
|
||||
auto it = m_guIdToTerritoryPtrMap.find( guId );
|
||||
if( it == m_guIdToTerritoryPtrMap.end() )
|
||||
return nullptr;
|
||||
|
||||
return it->second;
|
||||
|
@ -495,7 +495,7 @@ Sapphire::ZonePositionPtr Sapphire::World::Manager::TerritoryMgr::getTerritoryPo
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const
|
||||
{
|
||||
auto zoneMap = m_territoryTypeIdToInstanceGuidMap.find( territoryTypeId );
|
||||
if( zoneMap == m_territoryTypeIdToInstanceGuidMap.end() )
|
||||
|
@ -505,10 +505,10 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryType
|
|||
return zoneMap->second.begin()->second;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByLandSetId( uint32_t landSetId ) const
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getZoneByLandSetId( uint32_t landSetId ) const
|
||||
{
|
||||
auto zoneMap = m_landSetIdToZonePtrMap.find( landSetId );
|
||||
if( zoneMap == m_landSetIdToZonePtrMap.end() )
|
||||
auto zoneMap = m_landSetIdToTerritoryPtrMap.find( landSetId );
|
||||
if( zoneMap == m_landSetIdToTerritoryPtrMap.end() )
|
||||
return nullptr;
|
||||
|
||||
return zoneMap->second;
|
||||
|
@ -516,7 +516,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByLandSetId( ui
|
|||
|
||||
void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t tickCount )
|
||||
{
|
||||
for( auto& zone : m_zoneSet )
|
||||
for( auto& zone : m_territorySet )
|
||||
{
|
||||
zone->update( tickCount );
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t
|
|||
}
|
||||
|
||||
// remove internal house zones with nobody in them
|
||||
for( auto it = m_landIdentToZonePtrMap.begin(); it != m_landIdentToZonePtrMap.end(); )
|
||||
for( auto it = m_landIdentToTerritoryPtrMap.begin(); it != m_landIdentToTerritoryPtrMap.end(); )
|
||||
{
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( it->second );
|
||||
assert( zone ); // wtf??
|
||||
|
@ -540,8 +540,8 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t
|
|||
Logger::info( "Removing HousingInteriorTerritory#{0} - has been inactive for 60 seconds", zone->getGuId() );
|
||||
|
||||
// remove zone from maps
|
||||
m_zoneSet.erase( zone );
|
||||
it = m_landIdentToZonePtrMap.erase( it );
|
||||
m_territorySet.erase( zone );
|
||||
it = m_landIdentToTerritoryPtrMap.erase( it );
|
||||
}
|
||||
else
|
||||
it++;
|
||||
|
@ -565,7 +565,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t
|
|||
|
||||
// remove zone from maps
|
||||
m_instanceZoneSet.erase( zone );
|
||||
m_guIdToZonePtrMap.erase( zone->getGuId() );
|
||||
m_guIdToTerritoryPtrMap.erase( zone->getGuId() );
|
||||
inIt = m_questBattleIdToInstanceMap[ zone->getQuestBattleId() ].erase( inIt );
|
||||
}
|
||||
else
|
||||
|
@ -598,11 +598,11 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( uint32_t territoryTypeI
|
|||
return movePlayer( pZone, pPlayer );
|
||||
}
|
||||
|
||||
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire::Entity::PlayerPtr pPlayer )
|
||||
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( TerritoryPtr pZone, Sapphire::Entity::PlayerPtr pPlayer )
|
||||
{
|
||||
if( !pZone )
|
||||
{
|
||||
Logger::error( "Zone not found on this server." );
|
||||
Logger::error( "Territory not found on this server." );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -628,8 +628,8 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire
|
|||
// mark character as zoning in progress
|
||||
pPlayer->setLoadingComplete( false );
|
||||
|
||||
if( pPlayer->getLastPing() != 0 && pPlayer->getCurrentZone() )
|
||||
pPlayer->getCurrentZone()->removeActor( pPlayer );
|
||||
if( pPlayer->getLastPing() != 0 && pPlayer->getCurrentTerritory() )
|
||||
pPlayer->getCurrentTerritory()->removeActor( pPlayer );
|
||||
|
||||
pPlayer->setCurrentZone( pZone );
|
||||
pZone->pushActor( pPlayer );
|
||||
|
@ -642,7 +642,7 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire
|
|||
return true;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getLinkedInstance( uint32_t playerId ) const
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getLinkedInstance( uint32_t playerId ) const
|
||||
{
|
||||
auto it = m_playerIdToInstanceMap.find( playerId );
|
||||
if( it != m_playerIdToInstanceMap.end() )
|
||||
|
@ -661,7 +661,7 @@ void Sapphire::World::Manager::TerritoryMgr::setCurrentFestival( uint16_t festiv
|
|||
{
|
||||
m_currentFestival = { festivalId, additionalFestival };
|
||||
|
||||
for( const auto& zone : m_zoneSet )
|
||||
for( const auto& zone : m_territorySet )
|
||||
{
|
||||
zone->setCurrentFestival( festivalId, additionalFestival );
|
||||
}
|
||||
|
|
|
@ -102,21 +102,21 @@ namespace Sapphire::World::Manager
|
|||
bool isHousingTerritory( uint32_t territoryTypeId ) const;
|
||||
|
||||
/*! creates a new instance for a given territoryTypeId */
|
||||
ZonePtr createTerritoryInstance( uint32_t territoryTypeId );
|
||||
TerritoryPtr createTerritoryInstance( uint32_t territoryTypeId );
|
||||
|
||||
ZonePtr createInstanceContent( uint32_t contentFinderConditionId );
|
||||
TerritoryPtr createInstanceContent( uint32_t contentFinderConditionId );
|
||||
|
||||
ZonePtr createQuestBattle( uint32_t contentFinderConditionId );
|
||||
TerritoryPtr createQuestBattle( uint32_t contentFinderConditionId );
|
||||
|
||||
void createAndJoinQuestBattle( Entity::Player& player, uint16_t contentFinderConditionId );
|
||||
|
||||
ZonePtr findOrCreateHousingInterior( const Common::LandIdent landIdent );
|
||||
TerritoryPtr findOrCreateHousingInterior( const Common::LandIdent landIdent );
|
||||
|
||||
/*! removes instance by instanceId, return true if successful */
|
||||
bool removeTerritoryInstance( uint32_t guId );
|
||||
|
||||
/*! returns a ZonePtr to the instance or nullptr if not found */
|
||||
ZonePtr getTerritoryByGuId( uint32_t guId ) const;
|
||||
/*! returns a TerritoryPtr to the instance or nullptr if not found */
|
||||
TerritoryPtr getTerritoryByGuId( uint32_t guId ) const;
|
||||
|
||||
/*! returns the cached detail of a territory, nullptr if not found */
|
||||
Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const;
|
||||
|
@ -129,17 +129,17 @@ namespace Sapphire::World::Manager
|
|||
|
||||
/*! returns a default Zone by territoryTypeId
|
||||
TODO: Mind multiple instances?! */
|
||||
ZonePtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
|
||||
TerritoryPtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
|
||||
|
||||
/*! returns a Zone by landSetId */
|
||||
ZonePtr getZoneByLandSetId( uint32_t landSetId ) const;
|
||||
TerritoryPtr getZoneByLandSetId( uint32_t landSetId ) const;
|
||||
|
||||
bool movePlayer( uint32_t territoryTypeId, Entity::PlayerPtr pPlayer );
|
||||
|
||||
bool movePlayer( ZonePtr, Entity::PlayerPtr pPlayer );
|
||||
bool movePlayer( TerritoryPtr, Entity::PlayerPtr pPlayer );
|
||||
|
||||
/*! returns an instancePtr if the player is still bound to an isntance */
|
||||
ZonePtr getLinkedInstance( uint32_t playerId ) const;
|
||||
TerritoryPtr getLinkedInstance( uint32_t playerId ) const;
|
||||
|
||||
/*!
|
||||
* @brief Sets the current festival for every zone
|
||||
|
@ -163,16 +163,16 @@ namespace Sapphire::World::Manager
|
|||
|
||||
private:
|
||||
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
||||
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||
using LandSetIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||
using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
||||
using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
||||
using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
||||
using InstanceIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >;
|
||||
using LandSetIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >;
|
||||
using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >;
|
||||
using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >;
|
||||
using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >;
|
||||
using QuestBattleIdToContentFinderCondMap = std::unordered_map< uint16_t, uint16_t >;
|
||||
using PlayerIdToInstanceIdMap = std::unordered_map< uint32_t, uint32_t >;
|
||||
using PositionMap = std::unordered_map< int32_t, ZonePositionPtr >;
|
||||
using InstanceIdList = std::vector< uint32_t >;
|
||||
using LandIdentToZonePtrMap = std::unordered_map< uint64_t, ZonePtr >;
|
||||
using LandIdentToTerritoryPtrMap = std::unordered_map< uint64_t, TerritoryPtr >;
|
||||
|
||||
/*! map holding details for territory templates */
|
||||
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
||||
|
@ -181,7 +181,7 @@ namespace Sapphire::World::Manager
|
|||
TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap;
|
||||
|
||||
/*! map holding actual instances of default territories */
|
||||
LandSetIdToZonePtrMap m_landSetIdToZonePtrMap;
|
||||
LandSetIdToTerritoryPtrMap m_landSetIdToTerritoryPtrMap;
|
||||
|
||||
/*! map holding actual instances of InstanceContent */
|
||||
InstanceContentIdToInstanceMap m_instanceContentIdToInstanceMap;
|
||||
|
@ -190,7 +190,7 @@ namespace Sapphire::World::Manager
|
|||
QuestBattleIdToInstanceMap m_questBattleIdToInstanceMap;
|
||||
|
||||
/*! flat map for easier lookup of instances by guid */
|
||||
InstanceIdToZonePtrMap m_guIdToZonePtrMap;
|
||||
InstanceIdToTerritoryPtrMap m_guIdToTerritoryPtrMap;
|
||||
|
||||
/*! map holding positions for zonelines */
|
||||
PositionMap m_territoryPositionMap;
|
||||
|
@ -199,16 +199,16 @@ namespace Sapphire::World::Manager
|
|||
PlayerIdToInstanceIdMap m_playerIdToInstanceMap;
|
||||
|
||||
/*! map for storing landident to zones, used for internal housing zones */
|
||||
LandIdentToZonePtrMap m_landIdentToZonePtrMap;
|
||||
LandIdentToTerritoryPtrMap m_landIdentToTerritoryPtrMap;
|
||||
|
||||
/*! internal counter for instanceIds */
|
||||
uint32_t m_lastInstanceId;
|
||||
|
||||
/*! set of ZonePtrs for quick iteration*/
|
||||
std::set< ZonePtr > m_zoneSet;
|
||||
/*! set of TerritoryPtrs for quick iteration*/
|
||||
std::set< TerritoryPtr > m_territorySet;
|
||||
|
||||
/*! set of ZonePtrs for quick iteration*/
|
||||
std::set< ZonePtr > m_instanceZoneSet;
|
||||
/*! set of TerritoryPtrs for quick iteration*/
|
||||
std::set< TerritoryPtr > m_instanceZoneSet;
|
||||
|
||||
/*! current festival(s) to set for public zones from festival.exd */
|
||||
std::pair< uint16_t, uint16_t > m_currentFestival;
|
||||
|
|
|
@ -15,93 +15,93 @@
|
|||
using namespace Sapphire::Math;
|
||||
using namespace Sapphire::Entity;
|
||||
|
||||
const int levelTable[81][5] =
|
||||
const int levelTable[81][6] =
|
||||
{
|
||||
// MAIN,SUB,DIV,HP,ELMT,THREAT
|
||||
{ 1, 1, 1, 1, 1 },
|
||||
{ 20, 56, 56, 0, 52 },
|
||||
{ 21, 57, 57, 0, 54 },
|
||||
{ 22, 60, 60, 0, 56 },
|
||||
{ 24, 62, 62, 0, 58 },
|
||||
{ 26, 65, 65, 0, 60 },
|
||||
{ 27, 68, 68, 0, 62 },
|
||||
{ 29, 70, 70, 0, 64 },
|
||||
{ 31, 73, 73, 0, 66 },
|
||||
{ 33, 76, 76, 0, 68 },
|
||||
{ 35, 78, 78, 0, 70 },
|
||||
{ 36, 82, 82, 0, 73 },
|
||||
{ 38, 85, 85, 0, 75 },
|
||||
{ 41, 89, 89, 0, 78 },
|
||||
{ 44, 93, 93, 0, 81 },
|
||||
{ 46, 96, 96, 0, 84 },
|
||||
{ 49, 100, 100, 0, 86 },
|
||||
{ 52, 104, 104, 0, 89 },
|
||||
{ 54, 109, 109, 0, 93 },
|
||||
{ 57, 113, 113, 0, 95 },
|
||||
{ 60, 116, 116, 0, 98 },
|
||||
{ 63, 122, 122, 0, 102 },
|
||||
{ 67, 127, 127, 0, 105 },
|
||||
{ 71, 133, 133, 0, 109 },
|
||||
{ 74, 138, 138, 0, 113 },
|
||||
{ 78, 144, 144, 0, 117 },
|
||||
{ 81, 150, 150, 0, 121 },
|
||||
{ 85, 155, 155, 0, 125 },
|
||||
{ 89, 162, 162, 0, 129 },
|
||||
{ 92, 168, 168, 0, 133 },
|
||||
{ 97, 173, 173, 0, 137 },
|
||||
{ 101, 181, 181, 0, 143 },
|
||||
{ 106, 188, 188, 0, 148 },
|
||||
{ 110, 194, 194, 0, 153 },
|
||||
{ 115, 202, 202, 0, 159 },
|
||||
{ 119, 209, 209, 0, 165 },
|
||||
{ 124, 215, 215, 0, 170 },
|
||||
{ 128, 223, 223, 0, 176 },
|
||||
{ 134, 229, 229, 0, 181 },
|
||||
{ 139, 236, 236, 0, 186 },
|
||||
{ 144, 244, 244, 0, 192 },
|
||||
{ 150, 253, 253, 0, 200 },
|
||||
{ 155, 263, 263, 0, 207 },
|
||||
{ 161, 272, 272, 0, 215 },
|
||||
{ 166, 283, 283, 0, 223 },
|
||||
{ 171, 292, 292, 0, 231 },
|
||||
{ 177, 302, 302, 0, 238 },
|
||||
{ 183, 311, 311, 0, 246 },
|
||||
{ 189, 322, 322, 0, 254 },
|
||||
{ 196, 331, 331, 0, 261 },
|
||||
{ 202, 341, 341, 1700, 269 },
|
||||
{ 204, 342, 393, 1774, 270 },
|
||||
{ 205, 344, 444, 1851, 271 },
|
||||
{ 207, 345, 496, 1931, 273 },
|
||||
{ 209, 346, 548, 2015, 274 },
|
||||
{ 210, 347, 600, 2102, 275 },
|
||||
{ 212, 349, 651, 2194, 276 },
|
||||
{ 214, 350, 703, 2289, 278 },
|
||||
{ 215, 351, 755, 2388, 279 },
|
||||
{ 217, 352, 806, 2492, 280 },
|
||||
{ 218, 354, 858, 2600, 282 },
|
||||
{ 224, 355, 941, 2700, 283 },
|
||||
{ 228, 356, 1032, 2800, 284 },
|
||||
{ 236, 357, 1133, 2900, 286 },
|
||||
{ 244, 358, 1243, 3000, 287 },
|
||||
{ 252, 359, 1364, 3100, 288 },
|
||||
{ 260, 360, 1497, 3200, 290 },
|
||||
{ 268, 361, 1643, 3300, 292 },
|
||||
{ 276, 362, 1802, 3400, 293 },
|
||||
{ 284, 363, 1978, 3500, 294 },
|
||||
{ 292, 364, 2170, 3600, 295 },
|
||||
{ 1, 1, 1, 1, 1, 1 },
|
||||
{ 20, 56, 56, 0, 52, 2 },
|
||||
{ 21, 57, 57, 0, 54, 2 },
|
||||
{ 22, 60, 60, 0, 56, 3 },
|
||||
{ 24, 62, 62, 0, 58, 3 },
|
||||
{ 26, 65, 65, 0, 60, 3 },
|
||||
{ 27, 68, 68, 0, 62, 3 },
|
||||
{ 29, 70, 70, 0, 64, 4 },
|
||||
{ 31, 73, 73, 0, 66, 4 },
|
||||
{ 33, 76, 76, 0, 68, 4 },
|
||||
{ 35, 78, 78, 0, 70, 5 },
|
||||
{ 36, 82, 82, 0, 73, 5 },
|
||||
{ 38, 85, 85, 0, 75, 5 },
|
||||
{ 41, 89, 89, 0, 78, 6 },
|
||||
{ 44, 93, 93, 0, 81, 6 },
|
||||
{ 46, 96, 96, 0, 84, 7 },
|
||||
{ 49, 100, 100, 0, 86, 7 },
|
||||
{ 52, 104, 104, 0, 89, 8 },
|
||||
{ 54, 109, 109, 0, 93, 9 },
|
||||
{ 57, 113, 113, 0, 95, 9 },
|
||||
{ 60, 116, 116, 0, 98, 10 },
|
||||
{ 63, 122, 122, 0, 102, 10 },
|
||||
{ 67, 127, 127, 0, 105, 11 },
|
||||
{ 71, 133, 133, 0, 109, 12 },
|
||||
{ 74, 138, 138, 0, 113, 13 },
|
||||
{ 78, 144, 144, 0, 117, 14 },
|
||||
{ 81, 150, 150, 0, 121, 15 },
|
||||
{ 85, 155, 155, 0, 125, 16 },
|
||||
{ 89, 162, 162, 0, 129, 17 },
|
||||
{ 92, 168, 168, 0, 133, 18 },
|
||||
{ 97, 173, 173, 0, 137, 19 },
|
||||
{ 101, 181, 181, 0, 143, 20 },
|
||||
{ 106, 188, 188, 0, 148, 22 },
|
||||
{ 110, 194, 194, 0, 153, 23 },
|
||||
{ 115, 202, 202, 0, 159, 25 },
|
||||
{ 119, 209, 209, 0, 165, 27 },
|
||||
{ 124, 215, 215, 0, 170, 29 },
|
||||
{ 128, 223, 223, 0, 176, 31 },
|
||||
{ 134, 229, 229, 0, 181, 33 },
|
||||
{ 139, 236, 236, 0, 186, 35 },
|
||||
{ 144, 244, 244, 0, 192, 38 },
|
||||
{ 150, 253, 253, 0, 200, 40 },
|
||||
{ 155, 263, 263, 0, 207, 43 },
|
||||
{ 161, 272, 272, 0, 215, 46 },
|
||||
{ 166, 283, 283, 0, 223, 49 },
|
||||
{ 171, 292, 292, 0, 231, 52 },
|
||||
{ 177, 302, 302, 0, 238, 55 },
|
||||
{ 183, 311, 311, 0, 246, 58 },
|
||||
{ 189, 322, 322, 0, 254, 62 },
|
||||
{ 196, 331, 331, 0, 261, 66 },
|
||||
{ 202, 341, 341, 1700, 269, 70 },
|
||||
{ 204, 342, 393, 1774, 270, 84 },
|
||||
{ 205, 344, 444, 1851, 271, 99 },
|
||||
{ 207, 345, 496, 1931, 273, 113 },
|
||||
{ 209, 346, 548, 2015, 274, 128 },
|
||||
{ 210, 347, 600, 2102, 275, 142 },
|
||||
{ 212, 349, 651, 2194, 276, 157 },
|
||||
{ 214, 350, 703, 2289, 278, 171 },
|
||||
{ 215, 351, 755, 2388, 279, 186 },
|
||||
{ 217, 352, 806, 2492, 280, 200 },
|
||||
{ 218, 354, 858, 2600, 282, 215 },
|
||||
{ 224, 355, 941, 2700, 283, 232 },
|
||||
{ 228, 356, 1032, 2800, 284, 250 },
|
||||
{ 236, 357, 1133, 2900, 286, 269 },
|
||||
{ 244, 358, 1243, 3000, 287, 290 },
|
||||
{ 252, 359, 1364, 3100, 288, 313 },
|
||||
{ 260, 360, 1497, 3200, 290, 337 },
|
||||
{ 268, 361, 1643, 3300, 292, 363 },
|
||||
{ 276, 362, 1802, 3400, 293, 392 },
|
||||
{ 284, 363, 1978, 3500, 294, 422 },
|
||||
{ 292, 364, 2170, 3600, 295, 455 },
|
||||
|
||||
// todo: add proper shbr values
|
||||
// todo: add proper shbr values - hp/elmt/threat
|
||||
// sub/div added from http://theoryjerks.akhmorning.com/resources/levelmods/
|
||||
{ 292, 365, 2263, 3600, 295 },
|
||||
{ 292, 366, 2360, 3600, 295 },
|
||||
{ 292, 367, 2461, 3600, 295 },
|
||||
{ 292, 368, 2566, 3600, 295 },
|
||||
{ 292, 370, 2676, 3600, 295 },
|
||||
{ 292, 372, 2790, 3600, 295 },
|
||||
{ 292, 374, 2910, 3600, 295 },
|
||||
{ 292, 376, 3034, 3600, 295 },
|
||||
{ 292, 378, 3164, 3600, 295 },
|
||||
{ 292, 380, 3300, 3600, 295 },
|
||||
{ 296, 365, 2263, 3600, 466, 466 },
|
||||
{ 300, 366, 2360, 3600, 295, 466 },
|
||||
{ 305, 367, 2461, 3600, 295, 466 },
|
||||
{ 310, 368, 2566, 3600, 295, 466 },
|
||||
{ 315, 370, 2676, 3600, 295, 466 },
|
||||
{ 320, 372, 2790, 3600, 295, 466 },
|
||||
{ 325, 374, 2910, 3600, 295, 466 },
|
||||
{ 330, 376, 3034, 3600, 295, 466 },
|
||||
{ 335, 378, 3164, 3600, 295, 466 },
|
||||
{ 340, 380, 3300, 3600, 569, 569 },
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -219,16 +219,9 @@ float CalcStats::autoAttackPotency( const Sapphire::Entity::Chara& chara )
|
|||
{
|
||||
uint32_t aaPotency = AUTO_ATTACK_POTENCY;
|
||||
|
||||
// check if ranged class
|
||||
switch( chara.getClass() )
|
||||
if( chara.getRole() == Common::Role::RangedPhysical )
|
||||
{
|
||||
case Common::ClassJob::Machinist:
|
||||
case Common::ClassJob::Bard:
|
||||
case Common::ClassJob::Archer:
|
||||
aaPotency = RANGED_AUTO_ATTACK_POTENCY;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float autoAttackDelay = 2.5f;
|
||||
|
@ -442,7 +435,7 @@ float CalcStats::healingMagicPotency( const Sapphire::Entity::Chara& chara )
|
|||
return std::floor( 100.f * ( chara.getStatValue( Common::BaseParam::HealingMagicPotency ) - 292.f ) / 264.f + 100.f ) / 100.f;
|
||||
}
|
||||
|
||||
float CalcStats::calculateAutoAttackDamage( const Sapphire::Entity::Chara& chara )
|
||||
float CalcStats::calcAutoAttackDamage( const Sapphire::Entity::Chara& chara )
|
||||
{
|
||||
// D = ⌊ f(ptc) × f(aa) × f(ap) × f(det) × f(tnc) × traits ⌋ × f(ss) ⌋ ×
|
||||
// f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ × buff_1 ⌋ × buff... ⌋
|
||||
|
@ -451,12 +444,25 @@ float CalcStats::calculateAutoAttackDamage( const Sapphire::Entity::Chara& chara
|
|||
auto aa = autoAttack( chara );
|
||||
auto ap = getPrimaryAttackPower( chara );
|
||||
auto det = determination( chara );
|
||||
auto ten = tenacity( chara );
|
||||
|
||||
Logger::debug( "auto attack: pot: {} aa: {} ap: {} det: {} ten: {}", pot, aa, ap, det, ten );
|
||||
auto ten = 1.f;
|
||||
if( chara.getRole() == Common::Role::Tank )
|
||||
ten = tenacity( chara );
|
||||
|
||||
// todo: everything after tenacity
|
||||
auto factor = std::floor( pot * aa * ap * det * ten );
|
||||
|
||||
constexpr auto format = "auto attack: pot: {} aa: {} ap: {} det: {} ten: {} = {}";
|
||||
|
||||
if( auto player = const_cast< Entity::Chara& >( chara ).getAsPlayer() )
|
||||
{
|
||||
player->sendDebug( format, pot, aa, ap, det, ten, factor );
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::debug( format, pot, aa, ap, det, ten, factor );
|
||||
}
|
||||
|
||||
// todo: traits
|
||||
|
||||
factor = std::floor( factor * speed( chara ) );
|
||||
|
@ -472,6 +478,38 @@ float CalcStats::calculateAutoAttackDamage( const Sapphire::Entity::Chara& chara
|
|||
return factor;
|
||||
}
|
||||
|
||||
float CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg )
|
||||
{
|
||||
// D = ⌊ f(pot) × f(wd) × f(ap) × f(det) × f(tnc) × traits ⌋
|
||||
// × f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ buff_1 ⌋ × buff_1 ⌋ × buff... ⌋
|
||||
|
||||
auto pot = potency( ptc );
|
||||
auto wd = weaponDamage( chara, wepDmg );
|
||||
auto ap = getPrimaryAttackPower( chara );
|
||||
auto det = determination( chara );
|
||||
|
||||
auto ten = 1.f;
|
||||
if( chara.getRole() == Common::Role::Tank )
|
||||
ten = tenacity( chara );
|
||||
|
||||
auto factor = std::floor( pot * wd * ap * det * ten );
|
||||
|
||||
constexpr auto format = "dmg: pot: {} ({}) wd: {} ({}) ap: {} det: {} ten: {} = {}";
|
||||
|
||||
if( auto player = const_cast< Entity::Chara& >( chara ).getAsPlayer() )
|
||||
{
|
||||
player->sendDebug( format, pot, ptc, wd, wepDmg, ap, det, ten, factor );
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::debug( format, pot, ptc, wd, wepDmg, ap, det, ten, factor );
|
||||
}
|
||||
|
||||
// todo: the rest
|
||||
|
||||
return factor;
|
||||
}
|
||||
|
||||
uint32_t CalcStats::primaryStatValue( const Sapphire::Entity::Chara& chara )
|
||||
{
|
||||
return chara.getStatValue( chara.getPrimaryStat() );
|
||||
|
|
|
@ -128,7 +128,9 @@ namespace Sapphire::Math
|
|||
|
||||
////////////////////////////////////////////
|
||||
|
||||
static float calculateAutoAttackDamage( const Sapphire::Entity::Chara& chara );
|
||||
static float calcAutoAttackDamage( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
static float calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg );
|
||||
|
||||
static uint32_t primaryStatValue( const Sapphire::Entity::Chara& chara );
|
||||
private:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <Common.h>
|
||||
#include <Framework.h>
|
||||
#include <Territory/Zone.h>
|
||||
#include <Territory/Territory.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <ServerMgr.h>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <Network/PacketContainer.h>
|
||||
#include <Network/GamePacketParser.h>
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||
|
||||
|
@ -215,13 +215,13 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac
|
|||
std::string name = itStr != m_zoneHandlerStrMap.end() ? itStr->second : "unknown";
|
||||
// dont display packet notification if it is a ping or pos update, don't want the spam
|
||||
if( opcode != PingHandler && opcode != UpdatePositionHandler )
|
||||
Logger::debug( "[{0}] Handling Zone IPC : {1} ( {2:04X} )", m_pSession->getId(), name, opcode );
|
||||
Logger::debug( "[{0}] Handling World IPC : {1} ( {2:04X} )", m_pSession->getId(), name, opcode );
|
||||
|
||||
( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::debug( "[{0}] Undefined Zone IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode );
|
||||
Logger::debug( "[{0}] Undefined World IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode );
|
||||
|
||||
Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ),
|
||||
pPacket.segHdr.size ) );
|
||||
|
@ -433,7 +433,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
|||
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
|
||||
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId;
|
||||
sendSinglePacket( pe1 );
|
||||
Logger::info( "[{0}] Setting session for zone connection", id );
|
||||
Logger::info( "[{0}] Setting session for world connection", id );
|
||||
session->setZoneConnection( pCon );
|
||||
}
|
||||
// chat connection, assinging it to the session
|
||||
|
|
|
@ -48,7 +48,7 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
|||
if( !action )
|
||||
return;
|
||||
|
||||
actionMgr->handleTargetedPlayerAction( player, actionId, action, targetId );
|
||||
actionMgr->handleTargetedPlayerAction( player, actionId, action, targetId, sequence );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -112,5 +112,5 @@ void Sapphire::Network::GameConnection::placedActionHandler( FrameworkPtr pFw,
|
|||
return;
|
||||
|
||||
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
||||
actionMgr->handlePlacedPlayerAction( player, actionId, action, pos );
|
||||
actionMgr->handlePlacedPlayerAction( player, actionId, action, pos, sequence );
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||
#include <Util/Util.h>
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/ZonePosition.h"
|
||||
#include "Manager/HousingMgr.h"
|
||||
|
||||
|
@ -287,12 +287,12 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
|||
}
|
||||
case ClientTriggerType::DirectorInitFinish: // Director init finish
|
||||
{
|
||||
player.getCurrentZone()->onInitDirector( player );
|
||||
player.getCurrentTerritory()->onInitDirector( player );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::DirectorSync: // Director init finish
|
||||
{
|
||||
player.getCurrentZone()->onDirectorSync( player );
|
||||
player.getCurrentTerritory()->onDirectorSync( player );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::EnterTerritoryEventFinished:// this may still be something else. I think i have seen it elsewhere
|
||||
|
@ -313,7 +313,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
|||
}
|
||||
case ClientTriggerType::RequestHousingBuildPreset:
|
||||
{
|
||||
auto zone = player.getCurrentZone();
|
||||
auto zone = player.getCurrentTerritory();
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
if (!hZone)
|
||||
return;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "Session.h"
|
||||
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/InstanceContent.h"
|
||||
|
||||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||
|
@ -190,9 +190,9 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
|||
}
|
||||
case GmCommand::Weather:
|
||||
{
|
||||
targetPlayer->getCurrentZone()->setWeatherOverride( static_cast< Common::Weather >( param1 ) );
|
||||
player.sendNotice( "Weather in Zone \"{0}\" of {1} set in range.",
|
||||
targetPlayer->getCurrentZone()->getName(), targetPlayer->getName() );
|
||||
targetPlayer->getCurrentTerritory()->setWeatherOverride( static_cast< Common::Weather >( param1 ) );
|
||||
player.sendNotice( "Weather in Territory \"{0}\" of {1} set in range.",
|
||||
targetPlayer->getCurrentTerritory()->getName(), targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Call:
|
||||
|
@ -208,7 +208,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
|||
{
|
||||
player.sendNotice( "Name: {0}"
|
||||
"\nGil: {1}"
|
||||
"\nZone: {2}"
|
||||
"\nTerritory: {2}"
|
||||
"({3})"
|
||||
"\nClass: {4}"
|
||||
"\nLevel: {5}"
|
||||
|
@ -217,7 +217,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
|||
"\nPlayTime: {8}",
|
||||
targetPlayer->getName(),
|
||||
targetPlayer->getCurrency( CurrencyType::Gil ),
|
||||
targetPlayer->getCurrentZone()->getName(),
|
||||
targetPlayer->getCurrentTerritory()->getName(),
|
||||
targetPlayer->getZoneId(),
|
||||
static_cast< uint8_t >( targetPlayer->getClass() ),
|
||||
targetPlayer->getLevel(),
|
||||
|
@ -551,7 +551,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
|||
}
|
||||
case GmCommand::TeriInfo:
|
||||
{
|
||||
auto pCurrentZone = player.getCurrentZone();
|
||||
auto pCurrentZone = player.getCurrentTerritory();
|
||||
player.sendNotice( "ZoneId: {0}"
|
||||
"\nName: {1}"
|
||||
"\nInternalName: {2}"
|
||||
|
@ -657,16 +657,16 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw,
|
|||
{
|
||||
player.exitInstance();
|
||||
}
|
||||
if( targetPlayer->getCurrentZone()->getGuId() != player.getCurrentZone()->getGuId() )
|
||||
if( targetPlayer->getCurrentTerritory()->getGuId() != player.getCurrentTerritory()->getGuId() )
|
||||
{
|
||||
// Checks if the target player is in an InstanceContent to avoid binding to a Zone or PublicContent
|
||||
// Checks if the target player is in an InstanceContent to avoid binding to a Territory or PublicContent
|
||||
if( targetPlayer->getCurrentInstance() )
|
||||
{
|
||||
auto pInstanceContent = targetPlayer->getCurrentInstance()->getAsInstanceContent();
|
||||
// Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now
|
||||
pInstanceContent->bindPlayer( player.getId() );
|
||||
}
|
||||
player.setInstance( targetPlayer->getCurrentZone()->getGuId() );
|
||||
player.setInstance( targetPlayer->getCurrentTerritory()->getGuId() );
|
||||
}
|
||||
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
targetActor->getRot() );
|
||||
|
@ -687,9 +687,9 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw,
|
|||
{
|
||||
targetPlayer->exitInstance();
|
||||
}
|
||||
if( targetPlayer->getCurrentZone()->getGuId() != player.getCurrentZone()->getGuId() )
|
||||
if( targetPlayer->getCurrentTerritory()->getGuId() != player.getCurrentTerritory()->getGuId() )
|
||||
{
|
||||
targetPlayer->setInstance( player.getCurrentZone()->getGuId() );
|
||||
targetPlayer->setInstance( player.getCurrentTerritory()->getGuId() );
|
||||
}
|
||||
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() );
|
||||
targetPlayer->sendZoneInPackets( 0x00, 0x00, 0, 0, false );
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/ZonePosition.h"
|
||||
|
||||
#include "Manager/DebugCommandMgr.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/HousingZone.h"
|
||||
#include "Territory/Land.h"
|
||||
#include "Territory/ZonePosition.h"
|
||||
|
@ -281,7 +281,7 @@ void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
|||
|
||||
player.sendDebug( "Walking ZoneLine#{0}", zoneLineId );
|
||||
|
||||
auto pZone = player.getCurrentZone();
|
||||
auto pZone = player.getCurrentTerritory();
|
||||
|
||||
auto pLine = pTeriMgr->getTerritoryPosition( zoneLineId );
|
||||
|
||||
|
@ -411,7 +411,7 @@ void Sapphire::Network::GameConnection::finishLoadingHandler( FrameworkPtr pFw,
|
|||
gcPacket->data().gcRank[ 2 ] = player.getGcRankArray()[ 2 ];
|
||||
player.queuePacket( gcPacket );
|
||||
|
||||
player.getCurrentZone()->onFinishLoading( player );
|
||||
player.getCurrentTerritory()->onFinishLoading( player );
|
||||
|
||||
// player is done zoning
|
||||
player.setLoadingComplete( true );
|
||||
|
@ -428,7 +428,7 @@ void Sapphire::Network::GameConnection::finishLoadingHandler( FrameworkPtr pFw,
|
|||
player.spawn( player.getAsPlayer() );
|
||||
|
||||
// notify the zone of a change in position to force an "inRangeActor" update
|
||||
player.getCurrentZone()->updateActorPosition( player );
|
||||
player.getCurrentTerritory()->updateActorPosition( player );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::socialListHandler( FrameworkPtr pFw,
|
||||
|
@ -450,7 +450,7 @@ void Sapphire::Network::GameConnection::socialListHandler( FrameworkPtr pFw,
|
|||
int32_t entrysizes = sizeof( listPacket->data().entries );
|
||||
memset( listPacket->data().entries, 0, sizeof( listPacket->data().entries ) );
|
||||
|
||||
listPacket->data().entries[ 0 ].bytes[ 2 ] = player.getCurrentZone()->getTerritoryTypeId();
|
||||
listPacket->data().entries[ 0 ].bytes[ 2 ] = player.getCurrentTerritory()->getTerritoryTypeId();
|
||||
listPacket->data().entries[ 0 ].bytes[ 3 ] = 0x80;
|
||||
listPacket->data().entries[ 0 ].bytes[ 4 ] = 0x02;
|
||||
listPacket->data().entries[ 0 ].bytes[ 6 ] = 0x3B;
|
||||
|
@ -458,7 +458,7 @@ void Sapphire::Network::GameConnection::socialListHandler( FrameworkPtr pFw,
|
|||
listPacket->data().entries[ 0 ].classJob = static_cast< uint8_t >( player.getClass() );
|
||||
listPacket->data().entries[ 0 ].contentId = player.getContentId();
|
||||
listPacket->data().entries[ 0 ].level = player.getLevel();
|
||||
listPacket->data().entries[ 0 ].zoneId = player.getCurrentZone()->getTerritoryTypeId();
|
||||
listPacket->data().entries[ 0 ].zoneId = player.getCurrentTerritory()->getTerritoryTypeId();
|
||||
listPacket->data().entries[ 0 ].zoneId1 = 0x0100;
|
||||
// TODO: no idea what this does
|
||||
//listPacket.data().entries[0].one = 1;
|
||||
|
@ -516,7 +516,7 @@ void Sapphire::Network::GameConnection::chatHandler( FrameworkPtr pFw,
|
|||
if( player.isActingAsGm() )
|
||||
chatPacket->data().chatType = ChatType::GMSay;
|
||||
|
||||
player.getCurrentZone()->queuePacketForRange( player, 50, chatPacket );
|
||||
player.getCurrentTerritory()->queuePacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Yell:
|
||||
|
@ -524,7 +524,7 @@ void Sapphire::Network::GameConnection::chatHandler( FrameworkPtr pFw,
|
|||
if( player.isActingAsGm() )
|
||||
chatPacket->data().chatType = ChatType::GMYell;
|
||||
|
||||
player.getCurrentZone()->queuePacketForRange( player, 6000, chatPacket );
|
||||
player.getCurrentTerritory()->queuePacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Shout:
|
||||
|
@ -532,12 +532,12 @@ void Sapphire::Network::GameConnection::chatHandler( FrameworkPtr pFw,
|
|||
if( player.isActingAsGm() )
|
||||
chatPacket->data().chatType = ChatType::GMShout;
|
||||
|
||||
player.getCurrentZone()->queuePacketForRange( player, 6000, chatPacket );
|
||||
player.getCurrentTerritory()->queuePacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
player.getCurrentZone()->queuePacketForRange( player, 50, chatPacket );
|
||||
player.getCurrentTerritory()->queuePacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,9 +64,10 @@ namespace Sapphire::Network::Packets::Server
|
|||
FFXIVPacketBase::setTargetActor( targetId );
|
||||
}
|
||||
|
||||
void setSequence( uint32_t sequence )
|
||||
void setSequence( uint32_t sequence, uint16_t sourceSequence = 0 )
|
||||
{
|
||||
m_data.sequence = sequence;
|
||||
m_data.sourceSequence = sourceSequence;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <watchdog/Watchdog.h>
|
||||
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/InstanceContent.h"
|
||||
#include "Territory/QuestBattle.h"
|
||||
#include "Actor/Player.h"
|
||||
|
@ -163,7 +163,7 @@ void Sapphire::Scripting::ScriptMgr::onPlayerFirstEnterWorld( Entity::Player& pl
|
|||
bool Sapphire::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
// check if the actor is an eobj and call its script if we have one
|
||||
auto zone = player.getCurrentZone();
|
||||
auto zone = player.getCurrentTerritory();
|
||||
if( auto eobj = zone->getEObj( actorId ) )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventObjectScript >( eobj->getObjectId() );
|
||||
|
@ -412,7 +412,7 @@ bool Sapphire::Scripting::ScriptMgr::onStatusTimeOut( Entity::CharaPtr pChara, u
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Sapphire::Scripting::ScriptMgr::onZoneInit( ZonePtr pZone )
|
||||
bool Sapphire::Scripting::ScriptMgr::onZoneInit( TerritoryPtr pZone )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::ZoneScript >( pZone->getTerritoryTypeId() );
|
||||
if( script )
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Sapphire::Scripting
|
|||
|
||||
bool onStatusTimeOut( Entity::CharaPtr pActor, uint32_t effectId );
|
||||
|
||||
bool onZoneInit( ZonePtr pZone );
|
||||
bool onZoneInit( TerritoryPtr pZone );
|
||||
|
||||
bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1,
|
||||
uint16_t param2, uint16_t param3 );
|
||||
|
|
|
@ -286,7 +286,7 @@ void Sapphire::World::ServerMgr::mainLoop()
|
|||
|
||||
// if the player is in a zone, let the zone handler take care of his updates
|
||||
// else do it here.
|
||||
if( !session->getPlayer()->getCurrentZone() )
|
||||
if( !session->getPlayer()->getCurrentTerritory() )
|
||||
session->update();
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "Actor/Chara.h"
|
||||
#include "Forwards.h"
|
||||
#include "Zone.h"
|
||||
#include "Territory.h"
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
// TODO: the entire zone / areahandling is a bit outdated ( in parts i used this for the 1.0 iteration )
|
||||
|
@ -22,7 +22,7 @@ Sapphire::Cell::~Cell()
|
|||
removeActors();
|
||||
}
|
||||
|
||||
void Sapphire::Cell::init( uint32_t x, uint32_t y, ZonePtr pZone )
|
||||
void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone )
|
||||
{
|
||||
m_pZone = pZone;
|
||||
m_posX = x;
|
||||
|
|
|
@ -13,7 +13,7 @@ typedef std::set< Entity::ActorPtr > ActorSet;
|
|||
|
||||
class Cell
|
||||
{
|
||||
friend class Zone;
|
||||
friend class Territory;
|
||||
|
||||
private:
|
||||
bool m_bForcedActive;
|
||||
|
@ -25,14 +25,14 @@ private:
|
|||
bool m_bUnloadPending;
|
||||
|
||||
uint16_t m_playerCount;
|
||||
ZonePtr m_pZone;
|
||||
TerritoryPtr m_pZone;
|
||||
|
||||
public:
|
||||
Cell();
|
||||
|
||||
~Cell();
|
||||
|
||||
void init( uint32_t x, uint32_t y, ZonePtr pZone );
|
||||
void init( uint32_t x, uint32_t y, TerritoryPtr pZone );
|
||||
|
||||
void addActor( Entity::ActorPtr pAct );
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Sapphire::World::Territory::Housing::HousingInteriorTerritory::HousingInteriorTe
|
|||
const std::string& internalName,
|
||||
const std::string& contentName,
|
||||
FrameworkPtr pFw ) :
|
||||
Zone( territoryTypeId, guId, internalName, contentName, pFw ),
|
||||
Territory( territoryTypeId, guId, internalName, contentName, pFw ),
|
||||
m_landIdent( ident )
|
||||
{
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
|
|||
{
|
||||
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
||||
|
||||
Logger::debug( "HousingInteriorTerritory::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||
Logger::debug( "HousingInteriorTerritory::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
|
||||
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
|
||||
auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() );
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "ForwardsZone.h"
|
||||
#include "Territory/Zone.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Common.h"
|
||||
#include <array>
|
||||
|
||||
namespace Sapphire::World::Territory::Housing
|
||||
{
|
||||
class HousingInteriorTerritory : public Zone
|
||||
class HousingInteriorTerritory : public Territory
|
||||
{
|
||||
public:
|
||||
HousingInteriorTerritory( Common::LandIdent ident, uint16_t territoryTypeId,
|
||||
|
|
|
@ -33,7 +33,7 @@ Sapphire::HousingZone::HousingZone( uint8_t wardNum,
|
|||
const std::string& internalName,
|
||||
const std::string& contentName,
|
||||
FrameworkPtr pFw ) :
|
||||
Zone( territoryTypeId, guId, internalName, contentName, pFw ),
|
||||
Territory( territoryTypeId, guId, internalName, contentName, pFw ),
|
||||
m_wardNum( wardNum ),
|
||||
m_territoryTypeId( territoryTypeId ),
|
||||
m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ),
|
||||
|
@ -155,7 +155,7 @@ bool Sapphire::HousingZone::init()
|
|||
|
||||
void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "HousingZone::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||
Logger::debug( "HousingZone::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
|
||||
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
|
||||
auto isInSubdivision = isPlayerSubInstance( player ) ? true : false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SAPPHIRE_HOUSINGZONE_H
|
||||
#define SAPPHIRE_HOUSINGZONE_H
|
||||
|
||||
#include "Zone.h"
|
||||
#include "Territory.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
#include <array>
|
||||
|
@ -24,7 +24,7 @@ namespace Sapphire
|
|||
RELOCATE = 4,
|
||||
};
|
||||
|
||||
class HousingZone : public Zone
|
||||
class HousingZone : public Territory
|
||||
{
|
||||
public:
|
||||
HousingZone( uint8_t landSetId,
|
||||
|
|
|
@ -34,7 +34,7 @@ Sapphire::InstanceContent::InstanceContent( std::shared_ptr< Sapphire::Data::Ins
|
|||
const std::string& contentName,
|
||||
uint32_t instanceContentId,
|
||||
FrameworkPtr pFw ) :
|
||||
Zone( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ),
|
||||
Territory( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ),
|
||||
Director( Event::Director::InstanceContent, instanceContentId ),
|
||||
m_instanceConfiguration( pInstanceConfiguration ),
|
||||
m_instanceContentId( instanceContentId ),
|
||||
|
@ -48,7 +48,7 @@ Sapphire::InstanceContent::InstanceContent( std::shared_ptr< Sapphire::Data::Ins
|
|||
|
||||
bool Sapphire::InstanceContent::init()
|
||||
{
|
||||
if( !Zone::init() )
|
||||
if( !Territory::init() )
|
||||
return false;
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
|
@ -75,7 +75,7 @@ Sapphire::Data::ExdDataGenerated::InstanceContentPtr Sapphire::InstanceContent::
|
|||
|
||||
void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "InstanceContent::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||
Logger::debug( "InstanceContent::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
|
||||
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
|
||||
// mark player as "bound by duty"
|
||||
|
@ -90,7 +90,7 @@ void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
|
|||
|
||||
void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "InstanceContent::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}",
|
||||
Logger::debug( "InstanceContent::onLeaveTerritory: Territory#{0}|{1}, Entity#{2}",
|
||||
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
|
||||
clearDirector( player );
|
||||
|
@ -318,7 +318,7 @@ void Sapphire::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object )
|
|||
// todo: data should be renamed to eventId
|
||||
m_eventIdToObjectMap[ objData->data ] = object;
|
||||
else
|
||||
Logger::error( "InstanceContent::onRegisterEObj Zone " +
|
||||
Logger::error( "InstanceContent::onRegisterEObj Territory " +
|
||||
m_internalName + ": No EObj data found for EObj with ID: " +
|
||||
std::to_string( object->getObjectId() ) );
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SAPPHIRE_INSTANCECONTENT_H
|
||||
#define SAPPHIRE_INSTANCECONTENT_H
|
||||
|
||||
#include "Zone.h"
|
||||
#include "Territory.h"
|
||||
#include "Event/Director.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace Sapphire::Data
|
|||
|
||||
namespace Sapphire
|
||||
{
|
||||
class InstanceContent : public Event::Director, public Zone
|
||||
class InstanceContent : public Event::Director, public Territory
|
||||
{
|
||||
public:
|
||||
enum InstanceContentState
|
||||
|
|
|
@ -36,7 +36,7 @@ Sapphire::QuestBattle::QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle
|
|||
const std::string& contentName,
|
||||
uint32_t questBattleId,
|
||||
FrameworkPtr pFw ) :
|
||||
Zone( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ),
|
||||
Territory( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ),
|
||||
Director( Event::Director::QuestBattle, questBattleId ),
|
||||
m_pBattleDetails( pBattleDetails ),
|
||||
m_questBattleId( questBattleId ),
|
||||
|
@ -48,7 +48,7 @@ Sapphire::QuestBattle::QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle
|
|||
|
||||
bool Sapphire::QuestBattle::init()
|
||||
{
|
||||
if( !Zone::init() )
|
||||
if( !Territory::init() )
|
||||
return false;
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
|
@ -69,7 +69,7 @@ Sapphire::Data::ExdDataGenerated::QuestBattlePtr Sapphire::QuestBattle::getQuest
|
|||
|
||||
void Sapphire::QuestBattle::onPlayerZoneIn( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "QuestBattle::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||
Logger::debug( "QuestBattle::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
|
||||
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
|
||||
m_pPlayer = player.getAsPlayer();
|
||||
|
@ -83,7 +83,7 @@ void Sapphire::QuestBattle::onPlayerZoneIn( Entity::Player& player )
|
|||
|
||||
void Sapphire::QuestBattle::onLeaveTerritory( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "QuestBattle::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}",
|
||||
Logger::debug( "QuestBattle::onLeaveTerritory: Territory#{0}|{1}, Entity#{2}",
|
||||
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
|
||||
clearDirector( player );
|
||||
|
@ -291,7 +291,7 @@ void Sapphire::QuestBattle::onRegisterEObj( Entity::EventObjectPtr object )
|
|||
// todo: data should be renamed to eventId
|
||||
m_eventIdToObjectMap[ objData->data ] = object;
|
||||
else
|
||||
Logger::error( "InstanceContent::onRegisterEObj Zone " +
|
||||
Logger::error( "InstanceContent::onRegisterEObj Territory " +
|
||||
m_internalName + ": No EObj data found for EObj with ID: " +
|
||||
std::to_string( object->getObjectId() ) );
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SAPPHIRE_QUESTBATTLE_H
|
||||
#define SAPPHIRE_QUESTBATTLE_H
|
||||
|
||||
#include "Zone.h"
|
||||
#include "Territory.h"
|
||||
#include "Event/Director.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace Sapphire::Data
|
|||
|
||||
namespace Sapphire
|
||||
{
|
||||
class QuestBattle : public Event::Director, public Zone
|
||||
class QuestBattle : public Event::Director, public Territory
|
||||
{
|
||||
public:
|
||||
QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle > pBattleDetails,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <Database/DatabaseDef.h>
|
||||
#include <Network/PacketWrappers/ActorControlPacket143.h>
|
||||
|
||||
#include "Zone.h"
|
||||
#include "Territory.h"
|
||||
#include "InstanceContent.h"
|
||||
#include "QuestBattle.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
|
@ -31,15 +31,15 @@
|
|||
#include "Actor/SpawnPoint.h"
|
||||
#include "Actor/BNpcTemplate.h"
|
||||
|
||||
#include "Action/EffectResult.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "ForwardsZone.h"
|
||||
#include "ServerMgr.h"
|
||||
#include "CellHandler.h"
|
||||
#include "Zone.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include "Manager/RNGMgr.h"
|
||||
|
@ -54,7 +54,7 @@ using namespace Sapphire::World::Manager;
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
Sapphire::Zone::Zone() :
|
||||
Sapphire::Territory::Territory() :
|
||||
m_territoryTypeId( 0 ),
|
||||
m_guId( 0 ),
|
||||
m_currentWeather( Weather::FairSkies ),
|
||||
|
@ -65,7 +65,7 @@ Sapphire::Zone::Zone() :
|
|||
{
|
||||
}
|
||||
|
||||
Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId,
|
||||
Sapphire::Territory::Territory( uint16_t territoryTypeId, uint32_t guId,
|
||||
const std::string& internalName, const std::string& placeName,
|
||||
FrameworkPtr pFw ) :
|
||||
m_currentWeather( Weather::FairSkies ),
|
||||
|
@ -93,7 +93,7 @@ Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId,
|
|||
m_currentWeather = getNextWeather();
|
||||
}
|
||||
|
||||
void Sapphire::Zone::loadWeatherRates()
|
||||
void Sapphire::Territory::loadWeatherRates()
|
||||
{
|
||||
if( !m_territoryTypeInfo )
|
||||
return;
|
||||
|
@ -118,11 +118,9 @@ void Sapphire::Zone::loadWeatherRates()
|
|||
}
|
||||
}
|
||||
|
||||
Sapphire::Zone::~Zone()
|
||||
{
|
||||
}
|
||||
Sapphire::Territory::~Territory() = default;
|
||||
|
||||
bool Sapphire::Zone::init()
|
||||
bool Sapphire::Territory::init()
|
||||
{
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
|
||||
|
@ -144,22 +142,22 @@ bool Sapphire::Zone::init()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::setWeatherOverride( Weather weather )
|
||||
void Sapphire::Territory::setWeatherOverride( Weather weather )
|
||||
{
|
||||
m_weatherOverride = weather;
|
||||
}
|
||||
|
||||
Weather Sapphire::Zone::getCurrentWeather() const
|
||||
Weather Sapphire::Territory::getCurrentWeather() const
|
||||
{
|
||||
return m_currentWeather;
|
||||
}
|
||||
|
||||
const Sapphire::FestivalPair& Sapphire::Zone::getCurrentFestival() const
|
||||
const Sapphire::FestivalPair& Sapphire::Territory::getCurrentFestival() const
|
||||
{
|
||||
return m_currentFestival;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::setCurrentFestival( uint16_t festivalId, uint16_t additionalFestivalId )
|
||||
void Sapphire::Territory::setCurrentFestival( uint16_t festivalId, uint16_t additionalFestivalId )
|
||||
{
|
||||
m_currentFestival = { festivalId, additionalFestivalId };
|
||||
|
||||
|
@ -172,11 +170,11 @@ void Sapphire::Zone::setCurrentFestival( uint16_t festivalId, uint16_t additiona
|
|||
}
|
||||
}
|
||||
|
||||
void Sapphire::Zone::loadCellCache()
|
||||
void Sapphire::Territory::loadCellCache()
|
||||
{
|
||||
}
|
||||
|
||||
Weather Sapphire::Zone::getNextWeather()
|
||||
Weather Sapphire::Territory::getNextWeather()
|
||||
{
|
||||
uint32_t unixTime = Util::getTimeSeconds();
|
||||
// Get Eorzea hour for weather start
|
||||
|
@ -206,7 +204,7 @@ Weather Sapphire::Zone::getNextWeather()
|
|||
return Weather::FairSkies;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::pushActor( Entity::ActorPtr pActor )
|
||||
void Sapphire::Territory::pushActor( Entity::ActorPtr pActor )
|
||||
{
|
||||
float mx = pActor->getPos().x;
|
||||
float my = pActor->getPos().z;
|
||||
|
@ -271,7 +269,7 @@ void Sapphire::Zone::pushActor( Entity::ActorPtr pActor )
|
|||
}
|
||||
}
|
||||
|
||||
void Sapphire::Zone::removeActor( Entity::ActorPtr pActor )
|
||||
void Sapphire::Territory::removeActor( Entity::ActorPtr pActor )
|
||||
{
|
||||
float mx = pActor->getPos().x;
|
||||
float my = pActor->getPos().z;
|
||||
|
@ -314,7 +312,7 @@ void Sapphire::Zone::removeActor( Entity::ActorPtr pActor )
|
|||
|
||||
}
|
||||
|
||||
void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||
void Sapphire::Territory::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
||||
{
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
@ -339,7 +337,7 @@ void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
|
||||
void Sapphire::Territory::queuePacketForZone( Entity::Player& sourcePlayer,
|
||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
||||
bool forSelf )
|
||||
{
|
||||
|
@ -361,37 +359,37 @@ void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Zone::getTerritoryTypeId() const
|
||||
uint32_t Sapphire::Territory::getTerritoryTypeId() const
|
||||
{
|
||||
return m_territoryTypeId;
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Zone::getGuId() const
|
||||
uint32_t Sapphire::Territory::getGuId() const
|
||||
{
|
||||
return m_guId;
|
||||
}
|
||||
|
||||
const std::string& Sapphire::Zone::getName() const
|
||||
const std::string& Sapphire::Territory::getName() const
|
||||
{
|
||||
return m_placeName;
|
||||
}
|
||||
|
||||
const std::string& Sapphire::Zone::getInternalName() const
|
||||
const std::string& Sapphire::Territory::getInternalName() const
|
||||
{
|
||||
return m_internalName;
|
||||
}
|
||||
|
||||
const std::string& Sapphire::Zone::getBgPath() const
|
||||
const std::string& Sapphire::Territory::getBgPath() const
|
||||
{
|
||||
return m_bgPath;
|
||||
}
|
||||
|
||||
std::size_t Sapphire::Zone::getPopCount() const
|
||||
std::size_t Sapphire::Territory::getPopCount() const
|
||||
{
|
||||
return m_playerMap.size();
|
||||
}
|
||||
|
||||
bool Sapphire::Zone::checkWeather()
|
||||
bool Sapphire::Territory::checkWeather()
|
||||
{
|
||||
if( m_weatherOverride != Weather::None )
|
||||
{
|
||||
|
@ -413,7 +411,7 @@ bool Sapphire::Zone::checkWeather()
|
|||
return false;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::updateBNpcs( uint64_t tickCount )
|
||||
void Sapphire::Territory::updateBNpcs( uint64_t tickCount )
|
||||
{
|
||||
if( ( tickCount - m_lastMobUpdate ) <= 250 )
|
||||
return;
|
||||
|
@ -468,12 +466,12 @@ void Sapphire::Zone::updateBNpcs( uint64_t tickCount )
|
|||
|
||||
}
|
||||
|
||||
uint64_t Sapphire::Zone::getLastActivityTime() const
|
||||
uint64_t Sapphire::Territory::getLastActivityTime() const
|
||||
{
|
||||
return m_lastActivityTime;
|
||||
}
|
||||
|
||||
bool Sapphire::Zone::update( uint64_t tickCount )
|
||||
bool Sapphire::Territory::update( uint64_t tickCount )
|
||||
{
|
||||
//TODO: this should be moved to a updateWeather call and pulled out of updateSessions
|
||||
bool changedWeather = checkWeather();
|
||||
|
@ -488,6 +486,8 @@ bool Sapphire::Zone::update( uint64_t tickCount )
|
|||
|
||||
updateSpawnPoints();
|
||||
|
||||
processEffectResults( tickCount );
|
||||
|
||||
if( !m_playerMap.empty() )
|
||||
m_lastActivityTime = tickCount;
|
||||
|
||||
|
@ -496,7 +496,7 @@ bool Sapphire::Zone::update( uint64_t tickCount )
|
|||
return true;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::updateSessions( uint64_t tickCount, bool changedWeather )
|
||||
void Sapphire::Territory::updateSessions( uint64_t tickCount, bool changedWeather )
|
||||
{
|
||||
// update sessions in this zone
|
||||
for( auto it = m_playerMap.begin(); it != m_playerMap.end(); ++it )
|
||||
|
@ -511,7 +511,7 @@ void Sapphire::Zone::updateSessions( uint64_t tickCount, bool changedWeather )
|
|||
}
|
||||
|
||||
// this session is not linked to this area anymore, remove it from zone session list
|
||||
if( ( !pPlayer->getCurrentZone() ) || ( pPlayer->getCurrentZone() != shared_from_this() ) )
|
||||
if( ( !pPlayer->getCurrentTerritory() ) || ( pPlayer->getCurrentTerritory() != shared_from_this() ) )
|
||||
{
|
||||
removeActor( pPlayer );
|
||||
return;
|
||||
|
@ -529,12 +529,12 @@ void Sapphire::Zone::updateSessions( uint64_t tickCount, bool changedWeather )
|
|||
pPlayer->getSession()->update();
|
||||
|
||||
// this session is not linked to this area anymore, remove it from zone session list
|
||||
if( ( !pPlayer->getCurrentZone() ) || ( pPlayer->getCurrentZone() != shared_from_this() ) )
|
||||
if( ( !pPlayer->getCurrentTerritory() ) || ( pPlayer->getCurrentTerritory() != shared_from_this() ) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool Sapphire::Zone::isCellActive( uint32_t x, uint32_t y )
|
||||
bool Sapphire::Territory::isCellActive( uint32_t x, uint32_t y )
|
||||
{
|
||||
uint32_t endX = ( ( x + 1 ) <= _sizeX ) ? x + 1 : ( _sizeX - 1 );
|
||||
uint32_t endY = ( ( y + 1 ) <= _sizeY ) ? y + 1 : ( _sizeY - 1 );
|
||||
|
@ -559,7 +559,7 @@ bool Sapphire::Zone::isCellActive( uint32_t x, uint32_t y )
|
|||
return false;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::updateCellActivity( uint32_t x, uint32_t y, int32_t radius )
|
||||
void Sapphire::Territory::updateCellActivity( uint32_t x, uint32_t y, int32_t radius )
|
||||
{
|
||||
|
||||
uint32_t endX = ( x + radius ) <= _sizeX ? x + radius : ( _sizeX - 1 );
|
||||
|
@ -608,10 +608,10 @@ void Sapphire::Zone::updateCellActivity( uint32_t x, uint32_t y, int32_t radius
|
|||
}
|
||||
}
|
||||
|
||||
void Sapphire::Zone::updateActorPosition( Entity::Actor& actor )
|
||||
void Sapphire::Territory::updateActorPosition( Entity::Actor& actor )
|
||||
{
|
||||
|
||||
if( actor.getCurrentZone() != shared_from_this() )
|
||||
if( actor.getCurrentTerritory() != shared_from_this() )
|
||||
return;
|
||||
|
||||
//actor.checkInRangeActors();
|
||||
|
@ -679,7 +679,7 @@ void Sapphire::Zone::updateActorPosition( Entity::Actor& actor )
|
|||
}
|
||||
|
||||
|
||||
void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
||||
void Sapphire::Territory::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
||||
{
|
||||
if( pCell == nullptr )
|
||||
return;
|
||||
|
@ -728,37 +728,37 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
|||
}
|
||||
}
|
||||
|
||||
void Sapphire::Zone::onPlayerZoneIn( Entity::Player& player )
|
||||
void Sapphire::Territory::onPlayerZoneIn( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "Zone::onEnterTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
Logger::debug( "Territory::onEnterTerritory: Territory#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
}
|
||||
|
||||
void Sapphire::Zone::onLeaveTerritory( Entity::Player& player )
|
||||
void Sapphire::Territory::onLeaveTerritory( Entity::Player& player )
|
||||
{
|
||||
Logger::debug( "Zone::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
Logger::debug( "Territory::onLeaveTerritory: Territory#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
|
||||
}
|
||||
|
||||
void Sapphire::Zone::onUpdate( uint64_t tickCount )
|
||||
void Sapphire::Territory::onUpdate( uint64_t tickCount )
|
||||
{
|
||||
updateBNpcs( tickCount );
|
||||
}
|
||||
|
||||
void Sapphire::Zone::onFinishLoading( Entity::Player& player )
|
||||
void Sapphire::Territory::onFinishLoading( Entity::Player& player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sapphire::Zone::onInitDirector( Entity::Player& player )
|
||||
void Sapphire::Territory::onInitDirector( Entity::Player& player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sapphire::Zone::onEnterTerritory( Sapphire::Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 )
|
||||
void Sapphire::Territory::onEnterTerritory( Sapphire::Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sapphire::Zone::registerEObj( Entity::EventObjectPtr object )
|
||||
void Sapphire::Territory::registerEObj( Entity::EventObjectPtr object )
|
||||
{
|
||||
if( !object )
|
||||
return;
|
||||
|
@ -772,7 +772,7 @@ void Sapphire::Zone::registerEObj( Entity::EventObjectPtr object )
|
|||
//Logger::debug( "Registered instance eobj: " + std::to_string( object->getId() ) );
|
||||
}
|
||||
|
||||
Sapphire::Entity::EventObjectPtr Sapphire::Zone::getEObj( uint32_t objId )
|
||||
Sapphire::Entity::EventObjectPtr Sapphire::Territory::getEObj( uint32_t objId )
|
||||
{
|
||||
auto obj = m_eventObjects.find( objId );
|
||||
if( obj == m_eventObjects.end() )
|
||||
|
@ -781,28 +781,28 @@ Sapphire::Entity::EventObjectPtr Sapphire::Zone::getEObj( uint32_t objId )
|
|||
return obj->second;
|
||||
}
|
||||
|
||||
Sapphire::InstanceContentPtr Sapphire::Zone::getAsInstanceContent()
|
||||
Sapphire::InstanceContentPtr Sapphire::Territory::getAsInstanceContent()
|
||||
{
|
||||
return std::dynamic_pointer_cast< InstanceContent, Zone >( shared_from_this() );
|
||||
return std::dynamic_pointer_cast< InstanceContent, Territory >( shared_from_this() );
|
||||
}
|
||||
|
||||
Sapphire::QuestBattlePtr Sapphire::Zone::getAsQuestBattle()
|
||||
Sapphire::QuestBattlePtr Sapphire::Territory::getAsQuestBattle()
|
||||
{
|
||||
return std::dynamic_pointer_cast< QuestBattle, Zone >( shared_from_this() );
|
||||
return std::dynamic_pointer_cast< QuestBattle, Territory >( shared_from_this() );
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Zone::getNextEObjId()
|
||||
uint32_t Sapphire::Territory::getNextEObjId()
|
||||
{
|
||||
return ++m_nextEObjId;
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Zone::getNextActorId()
|
||||
uint32_t Sapphire::Territory::getNextActorId()
|
||||
{
|
||||
return ++m_nextActorId;
|
||||
}
|
||||
|
||||
|
||||
Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
||||
Sapphire::Entity::EventObjectPtr Sapphire::Territory::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
||||
uint8_t state, FFXIVARR_POSITION3 pos, float scale,
|
||||
float rotation )
|
||||
{
|
||||
|
@ -813,12 +813,12 @@ Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string
|
|||
return eObj;
|
||||
}
|
||||
|
||||
Sapphire::Data::TerritoryTypePtr Sapphire::Zone::getTerritoryTypeInfo() const
|
||||
Sapphire::Data::TerritoryTypePtr Sapphire::Territory::getTerritoryTypeInfo() const
|
||||
{
|
||||
return m_territoryTypeInfo;
|
||||
}
|
||||
|
||||
bool Sapphire::Zone::loadSpawnGroups()
|
||||
bool Sapphire::Territory::loadSpawnGroups()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS );
|
||||
|
@ -863,7 +863,7 @@ bool Sapphire::Zone::loadSpawnGroups()
|
|||
return false;
|
||||
}
|
||||
|
||||
void Sapphire::Zone::updateSpawnPoints()
|
||||
void Sapphire::Territory::updateSpawnPoints()
|
||||
{
|
||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
||||
auto rng = pRNGMgr->getRandGenerator< float >( 0.f, PI * 2 );
|
||||
|
@ -906,13 +906,13 @@ void Sapphire::Zone::updateSpawnPoints()
|
|||
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Zone::getNextEffectSequence()
|
||||
uint32_t Sapphire::Territory::getNextEffectSequence()
|
||||
{
|
||||
return m_effectCounter++;
|
||||
}
|
||||
|
||||
Sapphire::Entity::BNpcPtr
|
||||
Sapphire::Zone::createBNpcFromLevelEntry( uint32_t levelId, uint8_t level, uint8_t type,
|
||||
Sapphire::Territory::createBNpcFromLevelEntry( uint32_t levelId, uint8_t level, uint8_t type,
|
||||
uint32_t hp, uint16_t nameId, uint32_t directorId,
|
||||
uint8_t bnpcType )
|
||||
{
|
||||
|
@ -1006,9 +1006,9 @@ Sapphire::Entity::BNpcPtr
|
|||
return bnpc;
|
||||
}
|
||||
|
||||
Sapphire::Entity::BNpcPtr Sapphire::Zone::getActiveBNpcByLevelId( uint32_t levelId )
|
||||
Sapphire::Entity::BNpcPtr Sapphire::Territory::getActiveBNpcByLevelId( uint32_t levelId )
|
||||
{
|
||||
for( auto bnpcIt : m_bNpcMap )
|
||||
for( const auto& bnpcIt : m_bNpcMap )
|
||||
{
|
||||
if( bnpcIt.second->getLevelId() == levelId )
|
||||
return bnpcIt.second;
|
||||
|
@ -1016,7 +1016,32 @@ Sapphire::Entity::BNpcPtr Sapphire::Zone::getActiveBNpcByLevelId( uint32_t level
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr< Sapphire::World::Navi::NaviProvider > Sapphire::Zone::getNaviProvider()
|
||||
std::shared_ptr< Sapphire::World::Navi::NaviProvider > Sapphire::Territory::getNaviProvider()
|
||||
{
|
||||
return m_pNaviProvider;
|
||||
}
|
||||
|
||||
void Sapphire::Territory::addEffectResult( Sapphire::World::Action::EffectResultPtr result )
|
||||
{
|
||||
m_effectResults.emplace_back( std::move( result ) );
|
||||
}
|
||||
|
||||
void Sapphire::Territory::processEffectResults( uint64_t tickCount )
|
||||
|
||||
{
|
||||
// todo: move this to generic territory/instance delay wrapper cause it might be useful scheduling other things
|
||||
for( auto it = m_effectResults.begin(); it != m_effectResults.end(); )
|
||||
{
|
||||
auto effect = *it;
|
||||
|
||||
if( tickCount < effect->getDelay() )
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
effect->execute();
|
||||
|
||||
it = m_effectResults.erase( it );
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ namespace Sapphire
|
|||
struct TerritoryType;
|
||||
}
|
||||
|
||||
class Zone : public CellHandler< Cell >, public std::enable_shared_from_this< Zone >
|
||||
class Territory : public CellHandler< Cell >, public std::enable_shared_from_this< Territory >
|
||||
{
|
||||
protected:
|
||||
uint32_t m_territoryTypeId;
|
||||
|
@ -65,13 +65,15 @@ namespace Sapphire
|
|||
uint32_t m_effectCounter;
|
||||
std::shared_ptr< World::Navi::NaviProvider > m_pNaviProvider;
|
||||
|
||||
public:
|
||||
Zone();
|
||||
std::vector< World::Action::EffectResultPtr > m_effectResults;
|
||||
|
||||
Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName,
|
||||
public:
|
||||
Territory();
|
||||
|
||||
Territory( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName,
|
||||
const std::string& placeName, FrameworkPtr pFw );
|
||||
|
||||
virtual ~Zone();
|
||||
virtual ~Territory();
|
||||
|
||||
/*! overrides the zone's weather, set to 0 to unlock */
|
||||
void setWeatherOverride( Common::Weather weather );
|
||||
|
@ -174,6 +176,10 @@ namespace Sapphire
|
|||
uint32_t getNextEffectSequence();
|
||||
|
||||
std::shared_ptr< World::Navi::NaviProvider > getNaviProvider();
|
||||
|
||||
void addEffectResult( World::Action::EffectResultPtr result );
|
||||
|
||||
void processEffectResults( uint64_t tickCount );
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue