1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-22 10:07:44 +00:00

Merge branch 'develop' into exit_poprange

This commit is contained in:
NotAdam 2020-01-05 20:06:31 +11:00
commit 2824c30342
36 changed files with 1772 additions and 574 deletions

View file

@ -4,6 +4,7 @@
#include "PreparedStatement.h" #include "PreparedStatement.h"
#include <mysql.h> #include <mysql.h>
#include <stdexcept>
#include <vector> #include <vector>
Mysql::Connection::Connection( std::shared_ptr< MySqlBase > pBase, Mysql::Connection::Connection( std::shared_ptr< MySqlBase > pBase,

View file

@ -3,6 +3,7 @@
#include <memory> #include <memory>
#include <map> #include <map>
#include <string>
#include "MysqlCommon.h" #include "MysqlCommon.h"
typedef struct st_mysql MYSQL; typedef struct st_mysql MYSQL;

View file

@ -3,7 +3,8 @@
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h> // ?
#include <string>
namespace Sapphire::Api namespace Sapphire::Api
{ {

View file

@ -27,6 +27,8 @@ namespace Sapphire::Common
const uint8_t CLASSJOB_TOTAL = 38; const uint8_t CLASSJOB_TOTAL = 38;
const uint8_t CLASSJOB_SLOTS = 28; const uint8_t CLASSJOB_SLOTS = 28;
const uint8_t TOWN_COUNT = 6;
/*! /*!
* @brief The maximum length (in ms) of a combo before it is canceled/voided. * @brief The maximum length (in ms) of a combo before it is canceled/voided.
* *
@ -214,6 +216,8 @@ namespace Sapphire::Common
HandIn = 2005, HandIn = 2005,
DamagedGear = 2007, DamagedGear = 2007,
//UNKNOWN_1 = 2008, //UNKNOWN_1 = 2008,
// Temporary inventory that is used for the "trade" window
TradeInventory = 2009,
ArmoryOff = 3200, ArmoryOff = 3200,
ArmoryHead = 3201, ArmoryHead = 3201,
@ -232,6 +236,9 @@ namespace Sapphire::Common
SaddleBag0 = 4000, SaddleBag0 = 4000,
SaddleBag1 = 4001, SaddleBag1 = 4001,
// These are the ones you get when paying for premium companion app
PremiumSaddleBag0 = 4100,
PremiumSaddleBag1 = 4101,
RetainerBag0 = 10000, RetainerBag0 = 10000,
RetainerBag1 = 10001, RetainerBag1 = 10001,

View file

@ -1,6 +1,8 @@
#ifndef SAPPHIRE_DBCOMMON_H #ifndef SAPPHIRE_DBCOMMON_H
#define SAPPHIRE_DBCOMMON_H #define SAPPHIRE_DBCOMMON_H
#include <string>
namespace Sapphire::Db namespace Sapphire::Db
{ {
struct ConnectionInfo struct ConnectionInfo

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,9 @@ namespace Sapphire::Network::ActorControl
SetStatus = 0x02, SetStatus = 0x02,
CastStart = 0x03, CastStart = 0x03,
ToggleAggro = 0x04, ToggleAggro = 0x04,
/*!
* param1 = ClassJob ID
*/
ClassJobChange = 0x05, ClassJobChange = 0x05,
DefeatMsg = 0x06, DefeatMsg = 0x06,
GainExpMsg = 0x07, GainExpMsg = 0x07,
@ -142,6 +145,15 @@ namespace Sapphire::Network::ActorControl
SetPose = 0x127, SetPose = 0x127,
/*!
* This is used for general crafting events, I found some of them but some are missing:
*
* param1 = event type, the rest of the struct depends on this param.
* - 18 & 19: Quicksynth result, 19 means HQ result item, item ID is param2 and is + 1 000 000 when HQ.
* Quantity is param3 (possible quicksynth that gives more than one item in the future?)
*
* All the other values have unkown behavior for now.
*/
CraftingUnk = 0x12C, CraftingUnk = 0x12C,
GatheringSenseMsg = 0x130, GatheringSenseMsg = 0x130,
@ -175,6 +187,14 @@ namespace Sapphire::Network::ActorControl
RelicInfuseMsg = 0x179, RelicInfuseMsg = 0x179,
/*!
* Sent as result of an aetherial reduction.
* param1 = Reduced item ID + 500 000 (idk what this 500 000 is but it's always here no matter what)
* param2 = First result item id (+ 1 000 000 if HQ)
* param3 = First result item quantity
* param4 = (Optional) Second result item id (+ 1 000 000 if HQ)
* param5 = (Optional) Second result item quantity
*/
AetherReductionDlg = 0x17D, AetherReductionDlg = 0x17D,
/*! /*!
@ -208,11 +228,19 @@ namespace Sapphire::Network::ActorControl
/*! /*!
* Sent when a player desynths an item, one packet per result type (one for consumed item, one for each obtained items, and one for exp if the player received exp) * Sent when a player desynths an item, one packet per result type (one for consumed item, one for each obtained items, and one for exp if the player received exp)
* param1 = result type (4921 => Item consumed, 4922 => Item obtained, 4925 => Exp obtained) * param1 = result type
* param3 = item id (used for result types 4921 & 4922) * 4921 => Desynth item consumed
* 4922 => Desynth item obtained
* 4925 => Desynth exp obtained)
* 3553 => Reduction item used
* 3555 => Reduction item obtained
* param3 = u32 item id (+100 000 if item is HQ)
* param4 = item amount (used only for reduction it seems)
* param5 = exp amount (x 100) * param5 = exp amount (x 100)
*
* Idk exactly how reduce's param3 is formatted, it seems like it's item id + 500 000 but it seems too... shady.
*/ */
DesynthResult = 0x20F, DesynthOrReductionResult = 0x20F,
GilTrailMsg = 0x211, GilTrailMsg = 0x211,
@ -230,10 +258,14 @@ namespace Sapphire::Network::ActorControl
GearSetEquipMsg = 0x321, GearSetEquipMsg = 0x321,
SetBait = 0x325, // param1: bait ID
SetFestival = 0x386, // param1: festival.exd index SetFestival = 0x386, // param1: festival.exd index
ToggleOrchestrionUnlock = 0x396, ToggleOrchestrionUnlock = 0x396,
EventBattleDialog = 0x39C,
/*! /*!
* param1 = mountSpeed * param1 = mountSpeed
* Retail sends 12 for mount speed star 1 unlocked and 15 for mount speed star 2 unlocked * Retail sends 12 for mount speed star 1 unlocked and 15 for mount speed star 2 unlocked
@ -347,6 +379,12 @@ namespace Sapphire::Network::ActorControl
EmoteReq = 0x1F4, EmoteReq = 0x1F4,
EmoteCancel = 0x1F6, EmoteCancel = 0x1F6,
PersistentEmoteCancel = 0x1F7, PersistentEmoteCancel = 0x1F7,
/*!
* param2 = pose ID
* 0 = idle pose 0 (just standing)
* 1 = idle pose 1
* 2-4 = idle poses 2-4
*/
PoseChange = 0x1F9, PoseChange = 0x1F9,
PoseReapply = 0x1FA, PoseReapply = 0x1FA,
PoseCancel = 0x1FB, PoseCancel = 0x1FB,
@ -355,6 +393,8 @@ namespace Sapphire::Network::ActorControl
AchievementComp = 0x203, AchievementComp = 0x203,
AchievementCatChat = 0x206, AchievementCatChat = 0x206,
RequestEventBattle = 0x232C,
QuestJournalUpdateQuestVisibility = 0x2BE, QuestJournalUpdateQuestVisibility = 0x2BE,
QuestJournalClosed = 0x2BF, QuestJournalClosed = 0x2BF,

View file

@ -45,27 +45,32 @@ namespace Sapphire::Network::Packets
{ {
// static opcode ( the ones that rarely, if ever, change ) // static opcode ( the ones that rarely, if ever, change )
Ping = 0x0065, Ping = 0x0200, // updated 5.18
Init = 0x0066, Init = 0x018E,
ActorFreeSpawn = 0x0191, ActorFreeSpawn = 0x009B, // updated 5.18
InitZone = 0x019A, InitZone = 0x007C, // updated 5.18
EffectResult = 0x0141, EffectResult = 0x0267, // updated 5.18
ActorControl = 0x0142, ActorControl = 0x03BE, // updated 5.18
ActorControlSelf = 0x0143, ActorControlSelf = 0x00E3, // updated 5.18
ActorControlTarget = 0x0144, ActorControlTarget = 0x24d, // updated 5.18
UpdateHpMpTp = 0x0145, // used when resting
/*!
* @brief Used when resting
*/
UpdateHpMpTp = 0x0125, // updated 5.18
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
ChatBanned = 0x006B, ChatBanned = 0x006B,
Playtime = 0x0100, // updated 5.0 Playtime = 0x00E7, // updated 5.18
Logout = 0x0077, // updated 5.0 Logout = 0x142, // updated 5.18
CFNotify = 0x0078, CFNotify = 0x01F8, // updated 5.18
CFMemberStatus = 0x0079, CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A, CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F, CFPlayerInNeed = 0x007F,
CFPreferredRole = 0x032A, // added 5.18
SocialRequestError = 0x00AD, SocialRequestError = 0x00AD,
@ -75,29 +80,29 @@ namespace Sapphire::Network::Packets
LogMessage = 0x00D0, LogMessage = 0x00D0,
Chat = 0x0104, // updated 5.0 Chat = 0x02A3, // updated 5.18
WorldVisitList = 0x00FE, // added 4.5 WorldVisitList = 0x00FE, // added 4.5
SocialList = 0x010D, // updated 5.0 SocialList = 0x01F1, // updated 5.18
ExamineSearchInfo = 0x010F, // added 5.0 ExamineSearchInfo = 0x012B, // updated 5.18
UpdateSearchInfo = 0x0110, // updated 5.0 UpdateSearchInfo = 0x01E5, // updated 5.18
InitSearchInfo = 0x0111, // updated 5.0 InitSearchInfo = 0x01D0, // updated 5.18
ExamineSearchComment = 0x0102, // updated 4.1 ExamineSearchComment = 0x0102, // updated 4.1
ServerNoticeShort = 0x0115, // updated 5.0 ServerNoticeShort = 0x0115, // updated 5.0
ServerNotice = 0x0116, // updated 5.0 ServerNotice = 0x0088, // updated 5.18
SetOnlineStatus = 0x0117, // updated 5.0 SetOnlineStatus = 0x015E, // updated 5.1
CountdownInitiate = 0x011E, // updated 5.0 CountdownInitiate = 0x0309, // updated 5.11
CountdownCancel = 0x011F, // updated 5.0 CountdownCancel = 0x00D9, // updated 5.18
PlayerAddedToBlacklist = 0x0120, // updated 5.0 PlayerAddedToBlacklist = 0x033F, // updated 5.1
PlayerRemovedFromBlacklist = 0x0121, // updated 5.0 PlayerRemovedFromBlacklist = 0x0385, // updated 5.1
BlackList = 0x0123, // updated 5.0 BlackList = 0x0253, // updated 5.18
LinkshellList = 0x012A, // updated 5.0 LinkshellList = 0x00AC, // updated 5.18
MailDeleteRequest = 0x012B, // updated 5.0 MailDeleteRequest = 0x012B, // updated 5.0
@ -106,10 +111,12 @@ namespace Sapphire::Network::Packets
ReqMoogleMailLetter = 0x0139, // updated 5.0 ReqMoogleMailLetter = 0x0139, // updated 5.0
MailLetterNotification = 0x013A, // updated 5.0 MailLetterNotification = 0x013A, // updated 5.0
MarketBoardItemListingCount = 0x013B, // updated 5.0 MarketTaxRates = 0x025E, // updated 5.18
MarketBoardItemListing = 0x013C, // updated 5.0
MarketBoardItemListingHistory = 0x012A, // updated 4.5 MarketBoardItemListingCount = 0x0328, // updated 5.18
MarketBoardSearchResult = 0x0139, // updated 4.5 MarketBoardItemListing = 0x015F, // updated 5.18
MarketBoardItemListingHistory = 0x0113, // updated 5.18
MarketBoardSearchResult = 0x01EA, // updated 5.18
CharaFreeCompanyTag = 0x013B, // updated 4.5 CharaFreeCompanyTag = 0x013B, // updated 4.5
FreeCompanyBoardMsg = 0x013C, // updated 4.5 FreeCompanyBoardMsg = 0x013C, // updated 4.5
@ -118,94 +125,109 @@ namespace Sapphire::Network::Packets
FreeCompanyUpdateShortMessage = 0x0157, // added 5.0 FreeCompanyUpdateShortMessage = 0x0157, // added 5.0
StatusEffectList = 0x015B, // updated 5.0 StatusEffectList = 0x0183, // updated 5.18
EurekaStatusEffectList = 0x015C, // updated 5.0 EurekaStatusEffectList = 0x0167, // updated 5.18
Effect = 0x015E, // updated 5.0 BossStatusEffectList = 0x0312, // added 5.1
AoeEffect8 = 0x0161, // updated 5.0 Effect = 0x026B, // updated 5.18
AoeEffect16 = 0x0162, // updated 5.0 AoeEffect8 = 0x033E, // updated 5.18
AoeEffect24 = 0x0163, // updated 5.0 AoeEffect16 = 0x0305, // updated 5.18
AoeEffect32 = 0x0164, // updated 5.0 AoeEffect24 = 0x023F, // updated 5.18
PersistantEffect = 0x0165, // updated 5.0 AoeEffect32 = 0x0352, // updated 5.18
PersistantEffect = 0x019C, // updated 5.18
GCAffiliation = 0x016F, // updated 5.0 GCAffiliation = 0x016F, // updated 5.0
PlayerSpawn = 0x017F, // updated 5.0 PlayerSpawn = 0x0262, // updated 5.18
NpcSpawn = 0x0180, // updated 5.0 NpcSpawn = 0x0186, // updated 5.18
NpcSpawn2 = 0x0181, // ( Bigger statuseffectlist? ) updated 5.0 NpcSpawn2 = 0x010C, // ( Bigger statuseffectlist? ) updated 5.18
ActorMove = 0x0182, // updated 5.0 ActorMove = 0x021B, // updated 5.18
ActorSetPos = 0x0184, // updated 5.0 ActorSetPos = 0x0068, // updated 5.18
ActorCast = 0x0186, // updated 5.0 ActorCast = 0x03B1, // updated 5.18
SomeCustomiseChangePacketProbably = 0x0187, // added 5.0 SomeCustomiseChangePacketProbably = 0x00CD, // added 5.18
PartyList = 0x0188, // updated 5.0
HateRank = 0x0189, // updated 5.0 PartyList = 0x0287, // updated 5.18
HateList = 0x018A, // updated 5.0 HateRank = 0x0226, // updated 5.18
ObjectSpawn = 0x018B, // updated 5.0 HateList = 0x0361, // updated 5.18
ObjectDespawn = 0x018C, // updated 5.0 ObjectSpawn = 0x027F, // updated 5.18
UpdateClassInfo = 0x018D, // updated 5.0 ObjectDespawn = 0x034B, // updated 5.18
UpdateClassInfo = 0x0362, // updated 5.18
SilentSetClassJob = 0x018E, // updated 5.0 - seems to be the case, not sure if it's actually used for anything SilentSetClassJob = 0x018E, // updated 5.0 - seems to be the case, not sure if it's actually used for anything
PlayerSetup = 0x018F, // updated 5.0 PlayerSetup = 0x0295, // updated 5.18
PlayerStats = 0x0190, // updated 5.0 PlayerStats = 0x017A, // updated 5.18
ActorOwner = 0x0192, // updated 5.0 ActorOwner = 0x0322, // updated 5.11
PlayerStateFlags = 0x0193, // updated 5.0 PlayerStateFlags = 0x02C6, // updated 5.18
PlayerClassInfo = 0x0194, // updated 5.0 PlayerClassInfo = 0x01B0, // updated 5.18
ModelEquip = 0x0196, // updated 5.0 ModelEquip = 0x0170, // updated 5.11
Examine = 0x0197, // updated 5.0 Examine = 0x0366, // updated 5.18
CharaNameReq = 0x0198, // updated 5.0 CharaNameReq = 0x0116, // updated 5.18
// nb: see #565 on github // nb: see #565 on github
UpdateRetainerItemSalePrice = 0x019F, // updated 5.0 UpdateRetainerItemSalePrice = 0x019F, // updated 5.0
SetLevelSync = 0x1186, // not updated for 4.4, not sure what it is anymore SetLevelSync = 0x1186, // not updated for 4.4, not sure what it is anymore
ItemInfo = 0x01A1, // updated 5.0 ItemInfo = 0x00F2, // updated 5.18
ContainerInfo = 0x01A2, // updated 5.0 ContainerInfo = 0x01F2, // updated 5.18
InventoryTransactionFinish = 0x01A3, // updated 5.0 InventoryTransactionFinish = 0x00D2, // updated 5.18
InventoryTransaction = 0x01A4, // updated 5.0 InventoryTransaction = 0x0233, // updated 5.18
CurrencyCrystalInfo = 0x01A5, // updated 5.0 CurrencyCrystalInfo = 0x02BF, // updated 5.18
InventoryActionAck = 0x01A7, // updated 5.0 InventoryActionAck = 0x02FA, // updated 5.18
UpdateInventorySlot = 0x01A8, // updated 5.0 UpdateInventorySlot = 0x0370, // updated 5.18
HuntingLogEntry = 0x01B3, // updated 5.0 HuntingLogEntry = 0x01B3, // updated 5.0
EventPlay = 0x01B5, // updated 5.0 EventPlay = 0x0279, // updated 5.18
DirectorPlayScene = 0x01B9, // updated 5.0 EventPlay4 = 0x02F7, // updated 5.18
EventOpenGilShop = 0x01BC, // updated 5.0 EventPlay8 = 0x0119, // updated 5.18
EventPlay16 = 0x01FB, // updated 5.18
EventPlay32 = 0x0364, // updated 5.18
EventPlay64 = 0x00E5, // updated 5.18
EventPlay128 = 0x02BE, // updated 5.18
EventPlay255 = 0x01B1, // updated 5.18
EventStart = 0x01BE, // updated 5.0 EventStart = 0x0230, // updated 5.18
EventFinish = 0x01BF, // updated 5.0 EventFinish = 0x01E4, // updated 5.18
UseMooch = 0x0233, // updated 5.18
EventLinkshell = 0x1169, EventLinkshell = 0x1169,
QuestActiveList = 0x01D2, // updated 5.0 QuestActiveList = 0x031E, // updated 5.18
QuestUpdate = 0x01D3, // updated 5.0 QuestUpdate = 0x0066, // updated 5.18
QuestCompleteList = 0x01D4, // updated 5.0 QuestCompleteList = 0x025D, // updated 5.18
QuestFinish = 0x01D5, // updated 5.0 QuestFinish = 0x013A, // updated 5.18
MSQTrackerComplete = 0x01D6, // updated 5.0 MSQTrackerComplete = 0x01D6, // updated 5.0
MSQTrackerProgress = 0xF1CD, // updated 4.5 ? this actually looks like the two opcodes have been combined, see #474 MSQTrackerProgress = 0xF1CD, // updated 4.5 ? this actually looks like the two opcodes have been combined, see #474
QuestMessage = 0x01DE, // updated 5.0 QuestMessage = 0x00BF, // updated 5.18
QuestTracker = 0x01E3, // updated 5.0 QuestTracker = 0x0289, // updated 5.18
Mount = 0x01F3, // updated 5.0 Mount = 0x02F0, // updated 5.18
DirectorVars = 0x01F5, // updated 5.0 DirectorVars = 0x00E6, // updated 5.18
DirectorPopUp = 0x0200, // updated 5.0 - display dialogue pop-ups in duties and FATEs, for example, Teraflare's countdown SomeDirectorUnk1 = 0x0084, // updated 5.18
SomeDirectorUnk2 = 0x00C1, // updated 5.18
SomeDirectorUnk4 = 0x0100, // updated 5.18
SomeDirectorUnk8 = 0x028A, // updated 5.18
SomeDirectorUnk16 = 0x028C, // updated 5.18
DirectorPopUp = 0x0162, // updated 5.18 - display dialogue pop-ups in duties and FATEs, for example, Teraflare's countdown
DirectorPopUp4 = 0x0214, // updated 5.18
DirectorPopUp8 = 0x00F8, // updated 5.18
CFAvailableContents = 0xF1FD, // updated 4.2 CFAvailableContents = 0xF1FD, // updated 4.2
WeatherChange = 0x0210, // updated 5.0 WeatherChange = 0x02FB, // updated 5.11
PlayerTitleList = 0x0211, // updated 5.0 PlayerTitleList = 0x037D, // updated 5.1
Discovery = 0x0212, // updated 5.0 Discovery = 0x02E7, // updated 5.18
EorzeaTimeOffset = 0x0214, // updated 5.0 EorzeaTimeOffset = 0x03B8, // updated 5.1
EquipDisplayFlags = 0x0220, // updated 5.0 EquipDisplayFlags = 0x00FF, // updated 5.18
/// Housing ////////////////////////////////////// /// Housing //////////////////////////////////////
@ -218,7 +240,7 @@ namespace Sapphire::Network::Packets
LandRename = 0x023A, // updated 5.0 LandRename = 0x023A, // updated 5.0
HousingEstateGreeting = 0x023B, // updated 5.0 HousingEstateGreeting = 0x023B, // updated 5.0
HousingUpdateLandFlagsSlot = 0x023C, // updated 5.0 HousingUpdateLandFlagsSlot = 0x023C, // updated 5.0
HousingLandFlags = 0x023D, // updated 5.0 HousingLandFlags = 0x01F3, // updated 5.18
HousingShowEstateGuestAccess = 0x023E, // updated 5.0 HousingShowEstateGuestAccess = 0x023E, // updated 5.0
HousingObjectInitialize = 0x0240, // updated 5.0 HousingObjectInitialize = 0x0240, // updated 5.0
@ -238,12 +260,12 @@ namespace Sapphire::Network::Packets
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3 PerformNote = 0x0286, // updated 4.3
PrepareZoning = 0x02A4, // updated 5.0 PrepareZoning = 0x035C, // updated 5.18
ActorGauge = 0x0292, // updated 4.3 ActorGauge = 0x016D, // updated 5.18
// daily quest info -> without them sent, login will take longer... // daily quest info -> without them sent, login will take longer...
DailyQuests = 0x025E, // updated 5.0 DailyQuests = 0x02D8, // updated 5.18
DailyQuestRepeatFlags = 0x0260, // updated 5.0 DailyQuestRepeatFlags = 0x03A3, // updated 5.18
/// Doman Mahjong ////////////////////////////////////// /// Doman Mahjong //////////////////////////////////////
MahjongOpenGui = 0x02A4, // only available in mahjong instance MahjongOpenGui = 0x02A4, // only available in mahjong instance
@ -264,37 +286,37 @@ namespace Sapphire::Network::Packets
enum ClientZoneIpcType : uint16_t enum ClientZoneIpcType : uint16_t
{ {
PingHandler = 0x0065, // unchanged 5.0 PingHandler = 0x0200, // updated 5.18
InitHandler = 0x0066, // unchanged 5.0 InitHandler = 0x018E, // updated 5.18
FinishLoadingHandler = 0x0069, // unchanged 5.0 FinishLoadingHandler = 0x01F5, // updated 5.18
CFCommenceHandler = 0x006F, CFCommenceHandler = 0x006F,
CFRegisterDuty = 0x0071, CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072, CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 5.0 PlayTimeHandler = 0x0276, // updated 5.1
LogoutHandler = 0x0074, // unchanged 5.0 LogoutHandler = 0x015D, // updated 5.18
CancelLogout = 0x0075, // updated 5.0 CancelLogout = 0x008F, // updated 5.1
CFDutyInfoHandler = 0x0078, // updated 4.2 CFDutyInfoHandler = 0x0078, // updated 4.2
SocialReqSendHandler = 0x00AE, // updated 4.1 SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3 CreateCrossWorldLS = 0x00AF, // updated 4.3
ChatHandler = 0x00D9, // updated 5.0 ChatHandler = 0x0130, // updated 5.18
SocialListHandler = 0x00E1, // updated 5.0 SocialListHandler = 0x0090, // updated 5.18
SetSearchInfoHandler = 0x00E4, // updated 5.0 SetSearchInfoHandler = 0x0320, // updated 5.18
ReqSearchInfoHandler = 0x00E6, // updated 5.0 ReqSearchInfoHandler = 0x0374, // updated 5.18
ReqExamineSearchCommentHandler = 0x00E7, // updated 5.0 ReqExamineSearchCommentHandler = 0x00E7, // updated 5.0
ReqRemovePlayerFromBlacklist = 0x00F1, // updated 5.0 ReqRemovePlayerFromBlacklist = 0x00F1, // updated 5.0
BlackListHandler = 0x00F2, // updated 5.0 BlackListHandler = 0x01EB, // updated 5.18
PlayerSearchHandler = 0x00F4, // updated 5.0 PlayerSearchHandler = 0x00F4, // updated 5.0
LinkshellListHandler = 0x00FA, // updated 5.0 LinkshellListHandler = 0x014A, // updated 5.18
MarketBoardRequestItemListingInfo = 0x0102, // updated 4.5 MarketBoardRequestItemListingInfo = 0x0102, // updated 4.5
MarketBoardRequestItemListings = 0x0103, // updated 4.5 MarketBoardRequestItemListings = 0x0103, // updated 4.5
@ -313,41 +335,41 @@ namespace Sapphire::Network::Packets
ReqCountdownInitiate = 0x0135, // updated 5.0 ReqCountdownInitiate = 0x0135, // updated 5.0
ReqCountdownCancel = 0x0136, // updated 5.0 ReqCountdownCancel = 0x0136, // updated 5.0
ZoneLineHandler = 0x0139, // updated 5.0 ZoneLineHandler = 0x0174, // updated 5.18
ClientTrigger = 0x013A, // updated 5.0 ClientTrigger = 0x03C0, // updated 5.18
DiscoveryHandler = 0x013B, // updated 5.0 DiscoveryHandler = 0x017B, // updated 5.18
PlaceFieldMarker = 0x013C, // updated 5.0 PlaceFieldMarker = 0x013C, // updated 5.0
SkillHandler = 0x01BE, // updated 5.18
SkillHandler = 0x013D, // updated 5.0 GMCommand1 = 0x00A4, // updated 5.1
GMCommand1 = 0x013E, // updated 5.0
GMCommand2 = 0x013F, // updated 5.0 GMCommand2 = 0x013F, // updated 5.0
AoESkillHandler = 0x140, // updated 5.0 AoESkillHandler = 0x140, // updated 5.0
UpdatePositionHandler = 0x0141, // updated 5.0 UpdatePositionHandler = 0x0318, // updated 5.18
InventoryModifyHandler = 0x0148, // updated 5.0 InventoryModifyHandler = 0x03C5, // updated 5.18
InventoryEquipRecommendedItems = 0x0149, // updated 5.0 InventoryEquipRecommendedItems = 0x0149, // updated 5.0
ReqPlaceHousingItem = 0x014B, // updated 5.0 ReqPlaceHousingItem = 0x014B, // updated 5.0
BuildPresetHandler = 0x0150, // updated 5.0 BuildPresetHandler = 0x0150, // updated 5.0
TalkEventHandler = 0x0151, // updated 5.0 TalkEventHandler = 0x02FD, // updated 5.18
EmoteEventHandler = 0x0152, // updated 5.0 EmoteEventHandler = 0x0183, // updated 5.18
WithinRangeEventHandler = 0x0153, // updated 5.0 WithinRangeEventHandler = 0x0167, // updated 5.18
OutOfRangeEventHandler = 0x0154, // updated 5.0 OutOfRangeEventHandler = 0x02B5, // updated 5.18
EnterTeriEventHandler = 0x0155, // updated 5.0 EnterTeriEventHandler = 0x0267, // updated 5.18
ShopEventHandler = 0x0157, // updated 5.0 ShopEventHandler = 0x0156, // updated 5.0
ReturnEventHandler = 0x015A, // updated 5.0? ReturnEventHandler = 0x026B, // updated 5.18
TradeReturnEventHandler = 0x015B, // updated 5.0? TradeReturnEventHandler = 0x02DD, // updated 5.18
LinkshellEventHandler = 0x016B, // updated 4.5 LinkshellEventHandler = 0x016B, // updated 4.5
LinkshellEventHandler1 = 0x016C, // updated 4.5 LinkshellEventHandler1 = 0x016C, // updated 4.5
ReqEquipDisplayFlagsChange = 0x0175, // updated 5.0 ReqEquipDisplayFlagsChange = 0x01FE, // updated 5.18
LandRenameHandler = 0x0177, // updated 5.0 LandRenameHandler = 0xF177, // updated 5.0
HousingUpdateHouseGreeting = 0x0178, // updated 5.0 HousingUpdateHouseGreeting = 0x0178, // updated 5.0
HousingUpdateObjectPosition = 0x0179, // updated 5.0 HousingUpdateObjectPosition = 0x0179, // updated 5.0
@ -357,8 +379,6 @@ namespace Sapphire::Network::Packets
PerformNoteHandler = 0x029B, // updated 4.3 PerformNoteHandler = 0x029B, // updated 4.3
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -244,6 +244,7 @@ namespace Sapphire::Network::Packets::Server
uint8_t rank; uint8_t rank;
uint16_t padding; uint16_t padding;
uint8_t lsName[20]; uint8_t lsName[20];
uint8_t unk[16];
} entry[8]; } entry[8];
}; };
@ -283,6 +284,15 @@ namespace Sapphire::Network::Packets::Server
char unk2[0x4]; // This has probs something to do with the support desk (inquiry id?) char unk2[0x4]; // This has probs something to do with the support desk (inquiry id?)
}; };
struct FFFXIVIpcMarketTaxRates : FFXIVIpcBasePacket< MarketTaxRates >
{
uint32_t unknown1;
uint16_t padding1;
uint16_t unknown2;
uint32_t taxRate[Common::TOWN_COUNT]; // In the order of Common::Town
uint64_t unknown3;
};
struct FFFXIVIpcMarketBoardItemListingCount : FFXIVIpcBasePacket< MarketBoardItemListingCount > struct FFFXIVIpcMarketBoardItemListingCount : FFXIVIpcBasePacket< MarketBoardItemListingCount >
{ {
uint32_t itemCatalogId; uint32_t itemCatalogId;
@ -322,15 +332,7 @@ namespace Sapphire::Network::Packets::Server
bool hq; bool hq;
uint8_t materiaCount; uint8_t materiaCount;
uint8_t onMannequin; uint8_t onMannequin;
/** Common::Town marketCity;
* 0x01 Limsa Lominsa
* 0x02 Gridania
* 0x03 Ul'dah
* 0x04 Ishgard
* 0x07 Kugane
* 0x0A Crystarium
*/
uint8_t retainerCity;
uint16_t dyeId; uint16_t dyeId;
uint16_t padding3; uint16_t padding3;
uint32_t padding4; uint32_t padding4;
@ -439,15 +441,25 @@ namespace Sapphire::Network::Packets::Server
{ {
uint32_t unknown; uint32_t unknown;
uint32_t actor_id; uint32_t actor_id;
uint8_t unknown1; //uint8_t unknown1;
uint8_t unknown2; //uint8_t unknown2;
uint16_t padding1; //uint16_t padding1;
//uint32_t current_hp;
//uint16_t current_mp;
//uint16_t current_tp;
//uint32_t max_hp;
//uint16_t max_mp;
//uint16_t max_something;
uint32_t current_hp; uint32_t current_hp;
uint16_t current_mp;
uint16_t current_tp;
uint32_t max_hp; uint32_t max_hp;
uint16_t current_mp;
uint16_t unknown1;
uint16_t max_mp; uint16_t max_mp;
uint16_t max_something; uint8_t unknown2;
uint8_t classId;
uint8_t unknown4;
uint8_t unkFlag;
uint16_t unknown6;
struct StatusEntry struct StatusEntry
{ {
@ -460,7 +472,7 @@ namespace Sapphire::Network::Packets::Server
uint32_t sourceActorId; uint32_t sourceActorId;
} statusEntries[4]; } statusEntries[4];
uint32_t unknown4; uint32_t unknown7;
}; };
/** /**
@ -693,8 +705,8 @@ namespace Sapphire::Network::Packets::Server
uint8_t mountFeet; uint8_t mountFeet;
uint8_t mountColor; uint8_t mountColor;
uint8_t scale; uint8_t scale;
uint32_t u29b; uint32_t elementalLevel;
uint32_t u30b; uint32_t element;
Common::StatusEffect effect[30]; Common::StatusEffect effect[30];
Common::FFXIVARR_POSITION3 pos; Common::FFXIVARR_POSITION3 pos;
uint32_t models[10]; uint32_t models[10];
@ -929,8 +941,10 @@ namespace Sapphire::Network::Packets::Server
uint32_t unknown10; uint32_t unknown10;
uint32_t unknown11; uint32_t unknown11;
uint32_t unknown12[4]; uint32_t unknown12[4];
uint32_t unknown13[3];
Common::FFXIVARR_POSITION3 pos; Common::FFXIVARR_POSITION3 pos;
uint32_t unknown13; uint32_t unknown14[3];
uint32_t unknown15;
}; };
@ -1027,6 +1041,7 @@ namespace Sapphire::Network::Packets::Server
unsigned char companionHealRank; unsigned char companionHealRank;
unsigned char u19[2]; unsigned char u19[2];
unsigned char mountGuideMask[19]; unsigned char mountGuideMask[19];
uint8_t unk1[9];
char name[32]; char name[32];
unsigned char unknownOword[16]; unsigned char unknownOword[16];
unsigned char unknownOw; unsigned char unknownOw;
@ -1406,11 +1421,24 @@ namespace Sapphire::Network::Packets::Server
uint8_t unknown[8]; uint8_t unknown[8];
}; };
template< int ArgCount >
struct FFXIVIpcEventPlayN
{
uint64_t actorId;
uint32_t eventId;
uint16_t scene;
uint16_t padding;
uint32_t sceneFlags;
uint8_t paramCount;
uint8_t padding2[3];
uint32_t params[ArgCount];
};
/** /**
* Structural representation of the packet sent by the server * Structural representation of the packet sent by the server
* to play an event * to play an event
*/ */
struct FFXIVIpcDirectorPlayScene : FFXIVIpcBasePacket< DirectorPlayScene > struct FFXIVIpcDirectorPlayScene : FFXIVIpcBasePacket< EventPlay32 >
{ {
uint64_t actorId; uint64_t actorId;
uint32_t eventId; uint32_t eventId;
@ -1439,15 +1467,10 @@ namespace Sapphire::Network::Packets::Server
/* 000C */ uint32_t padding1; /* 000C */ uint32_t padding1;
}; };
struct FFXIVIpcEventOpenGilShop : FFXIVIpcBasePacket< EventOpenGilShop > struct FFXIVIpcEventPlay255 :
FFXIVIpcBasePacket< EventPlay255 >,
FFXIVIpcEventPlayN< 255 >
{ {
uint64_t actorId;
uint32_t eventId;
uint16_t scene;
uint16_t padding;
uint32_t sceneFlags;
uint32_t unknown_wtf[0x101];
}; };
@ -1495,7 +1518,7 @@ namespace Sapphire::Network::Packets::Server
struct FFXIVIpcQuestCompleteList : FFXIVIpcBasePacket< QuestCompleteList > struct FFXIVIpcQuestCompleteList : FFXIVIpcBasePacket< QuestCompleteList >
{ {
uint8_t questCompleteMask[480]; uint8_t questCompleteMask[480];
uint8_t unknownCompleteMask[32]; uint8_t unknownCompleteMask[80];
}; };
/** /**

View file

@ -59,7 +59,8 @@ public:
{ {
if( player.isAetheryteRegistered( eventId & 0xFFFF ) ) if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
{ {
player.playScene( eventId, 0, 1, [this]( Entity::Player& player, const Event::SceneResult& result ) // eventParam4 (or params[1] if using EventPlay8, which is actually used on retail) anything bigger than 1 will show select instance menu item
player.playScene( eventId, 0, 1, 0, 1, 2, [this]( Entity::Player& player, const Event::SceneResult& result )
{ {
if( result.param1 == 256 ) // set homepoint if( result.param1 == 256 ) // set homepoint
{ {

View file

@ -14,7 +14,7 @@ public:
EOBJ_INIT EOBJ_INIT
} }
void onUpdate( InstanceContent& instance, uint32_t currTime ) override void onUpdate( InstanceContent& instance, uint64_t tickCount ) override
{ {
} }

View file

@ -137,7 +137,7 @@ void loadAllInstanceContentEntries()
if( !ic ) if( !ic )
continue; continue;
type = ic->instanceContentType; type = ic->instanceContentType;
name = ic->name; name = cfc->name;
} }
else if( cfc->contentLinkType == 5 ) else if( cfc->contentLinkType == 5 )
{ {

View file

@ -16,7 +16,7 @@ public:
EOBJ_INIT EOBJ_INIT
} }
void onUpdate( QuestBattle& instance, uint32_t currTime ) override void onUpdate( QuestBattle& instance, uint64_t tickCount ) override
{ {
} }

View file

@ -127,8 +127,17 @@ std::string generateStruct( const std::string& exd )
} }
auto sheet = nlohmann::json(); auto sheet = nlohmann::json();
std::ifstream defJson( path );
defJson >> sheet; try
{
std::ifstream defJson( path );
defJson >> sheet;
}
catch( const std::exception& ex )
{
Logger::error( "Failed parsing json definition, err: {} file: {}", ex.what(), path );
return "";
}
for( auto& definition : sheet[ "definitions" ] ) for( auto& definition : sheet[ "definitions" ] )
{ {

View file

@ -206,7 +206,7 @@ bool Action::Action::update()
uint64_t tickCount = Common::Util::getTimeMs(); uint64_t tickCount = Common::Util::getTimeMs();
if( !hasCastTime() || std::difftime( tickCount, m_startTime ) > m_castTimeMs ) if( !hasCastTime() || std::difftime( static_cast< time_t >( tickCount ), static_cast< time_t >( m_startTime ) ) > m_castTimeMs )
{ {
execute(); execute();
return true; return true;
@ -257,7 +257,7 @@ void Action::Action::start()
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
// check the lut too and see if we have something usable, otherwise cancel the cast // check the lut too and see if we have something usable, otherwise cancel the cast
if( !pScriptMgr->onStart( *this ) && !ActionLut::validEntryExists( getId() ) ) if( !pScriptMgr->onStart( *this ) && !ActionLut::validEntryExists( static_cast< uint16_t >( getId() ) ) )
{ {
// script not implemented and insufficient lut data (no potencies) // script not implemented and insufficient lut data (no potencies)
interrupt(); interrupt();
@ -391,8 +391,9 @@ void Action::Action::buildEffects()
snapshotAffectedActors( m_hitActors ); snapshotAffectedActors( m_hitActors );
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
auto hasLutEntry = ActionLut::validEntryExists( static_cast< uint16_t >( getId() ) );
if( !pScriptMgr->onExecute( *this ) && !ActionLut::validEntryExists( getId() ) ) if( !pScriptMgr->onExecute( *this ) && !hasLutEntry )
{ {
if( auto player = m_pSource->getAsPlayer() ) if( auto player = m_pSource->getAsPlayer() )
{ {
@ -402,10 +403,10 @@ void Action::Action::buildEffects()
return; return;
} }
if( m_hitActors.empty() ) if( !hasLutEntry || m_hitActors.empty() )
return; return;
auto lutEntry = ActionLut::getEntry( getId() ); auto lutEntry = ActionLut::getEntry( static_cast< uint16_t >( getId() ) );
// no script exists but we have a valid lut entry // no script exists but we have a valid lut entry
if( auto player = getSourceChara()->getAsPlayer() ) if( auto player = getSourceChara()->getAsPlayer() )
@ -545,11 +546,11 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
auto cost = m_primaryCost * 100; auto cost = m_primaryCost * 100;
if( curMp < cost ) if( curMp < static_cast< uint32_t >( cost ) )
return false; return false;
if( subtractCosts ) if( subtractCosts )
m_pSource->setMp( curMp - cost ); m_pSource->setMp( curMp - static_cast< uint32_t >( cost ) );
return true; return true;
} }

View file

@ -301,7 +301,7 @@ Sapphire::Entity::CharaPtr Sapphire::Entity::BNpc::hateListGetHighest()
void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount ) void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount )
{ {
auto hateEntry = std::make_shared< HateListEntry >(); auto hateEntry = std::make_shared< HateListEntry >();
hateEntry->m_hateAmount = hateAmount; hateEntry->m_hateAmount = static_cast< uint32_t >( hateAmount );
hateEntry->m_pChara = pChara; hateEntry->m_pChara = pChara;
m_hateList.insert( hateEntry ); m_hateList.insert( hateEntry );
@ -318,13 +318,13 @@ void Sapphire::Entity::BNpc::hateListUpdate( Sapphire::Entity::CharaPtr pChara,
{ {
if( listEntry->m_pChara == pChara ) if( listEntry->m_pChara == pChara )
{ {
listEntry->m_hateAmount += hateAmount; listEntry->m_hateAmount += static_cast< uint32_t >( hateAmount );
return; return;
} }
} }
auto hateEntry = std::make_shared< HateListEntry >(); auto hateEntry = std::make_shared< HateListEntry >();
hateEntry->m_hateAmount = hateAmount; hateEntry->m_hateAmount = static_cast< uint32_t >( hateAmount );
hateEntry->m_pChara = pChara; hateEntry->m_pChara = pChara;
m_hateList.insert( hateEntry ); m_hateList.insert( hateEntry );
} }
@ -590,7 +590,7 @@ void Sapphire::Entity::BNpc::onDeath()
// TODO: handle drops // TODO: handle drops
auto pPlayer = pHateEntry->m_pChara->getAsPlayer(); auto pPlayer = pHateEntry->m_pChara->getAsPlayer();
if( pPlayer ) if( pPlayer )
pPlayer->onMobKill( m_bNpcNameId ); pPlayer->onMobKill( static_cast< uint16_t >( m_bNpcNameId ) );
} }
hateListClear(); hateListClear();
} }
@ -654,7 +654,7 @@ void Sapphire::Entity::BNpc::setOwner( Sapphire::Entity::CharaPtr m_pChara )
{ {
auto setOwnerPacket = makeZonePacket< FFXIVIpcActorOwner >( getId() ); auto setOwnerPacket = makeZonePacket< FFXIVIpcActorOwner >( getId() );
setOwnerPacket->data().type = 0x01; setOwnerPacket->data().type = 0x01;
setOwnerPacket->data().actorId = INVALID_GAME_OBJECT_ID; setOwnerPacket->data().actorId = static_cast< uint32_t >( INVALID_GAME_OBJECT_ID );
sendToInRangeSet( setOwnerPacket ); sendToInRangeSet( setOwnerPacket );
} }
} }
@ -697,7 +697,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 ); auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
Common::EffectEntry effectEntry{}; Common::EffectEntry effectEntry{};
effectEntry.value = damage; effectEntry.value = static_cast< int16_t >( damage );
effectEntry.effectType = ActionEffectType::Damage; effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage; effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage;
effectEntry.param = 0x71; effectEntry.param = 0x71;
@ -705,7 +705,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
sendToInRangeSet( effectPacket ); sendToInRangeSet( effectPacket );
pTarget->takeDamage( damage ); pTarget->takeDamage( static_cast< uint16_t >( damage ) );
} }
} }
@ -727,17 +727,17 @@ void Sapphire::Entity::BNpc::calculateStats()
m_baseStats.vit = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierVitality ) / 100 ) ); m_baseStats.vit = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierVitality ) / 100 ) );
m_baseStats.inte = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierIntelligence ) / 100 ) ); m_baseStats.inte = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierIntelligence ) / 100 ) );
m_baseStats.mnd = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierMind ) / 100 ) ); m_baseStats.mnd = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierMind ) / 100 ) );
m_baseStats.pie = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierPiety ) / 100 ) ); //m_baseStats.pie = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierPiety ) / 100 ) );
m_baseStats.determination = static_cast< uint32_t >( base ); m_baseStats.determination = static_cast< uint32_t >( base );
m_baseStats.pie = static_cast< uint32_t >( base ); m_baseStats.pie = static_cast< uint32_t >( base );
m_baseStats.skillSpeed = paramGrowthInfo->baseSpeed; m_baseStats.skillSpeed = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.spellSpeed = paramGrowthInfo->baseSpeed; m_baseStats.spellSpeed = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.accuracy = paramGrowthInfo->baseSpeed; m_baseStats.accuracy = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.critHitRate = paramGrowthInfo->baseSpeed; m_baseStats.critHitRate = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.attackPotMagic = paramGrowthInfo->baseSpeed; m_baseStats.attackPotMagic = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.healingPotMagic = paramGrowthInfo->baseSpeed; m_baseStats.healingPotMagic = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.tenacity = paramGrowthInfo->baseSpeed; m_baseStats.tenacity = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.attack = m_baseStats.str; m_baseStats.attack = m_baseStats.str;
m_baseStats.attackPotMagic = m_baseStats.inte; m_baseStats.attackPotMagic = m_baseStats.inte;

View file

@ -245,14 +245,14 @@ void Sapphire::Entity::Chara::setMp( uint32_t mp )
/*! \param gp amount to set*/ /*! \param gp amount to set*/
void Sapphire::Entity::Chara::setGp( uint32_t gp ) void Sapphire::Entity::Chara::setGp( uint32_t gp )
{ {
m_gp = gp; m_gp = static_cast< uint16_t >( gp );
sendStatusUpdate(); sendStatusUpdate();
} }
/*! \param tp amount to set*/ /*! \param tp amount to set*/
void Sapphire::Entity::Chara::setTp( uint32_t tp ) void Sapphire::Entity::Chara::setTp( uint32_t tp )
{ {
m_tp = tp; m_tp = static_cast< uint16_t >( tp );
sendStatusUpdate(); sendStatusUpdate();
} }
@ -316,7 +316,7 @@ bool Sapphire::Entity::Chara::face( const Common::FFXIVARR_POSITION3& p )
setRot( newRot ); setRot( newRot );
return oldRot != newRot; return ( fabs( oldRot - newRot ) <= std::numeric_limits< float >::epsilon() * fmax( fabs( oldRot ), fabs( newRot ) ) );
} }
/*! /*!
@ -354,14 +354,14 @@ bool Sapphire::Entity::Chara::checkAction()
void Sapphire::Entity::Chara::update( uint64_t tickCount ) void Sapphire::Entity::Chara::update( uint64_t tickCount )
{ {
if( std::difftime( tickCount, m_lastTickTime ) > 3000 ) if( std::difftime( static_cast< time_t >( tickCount ), m_lastTickTime ) > 3000 )
{ {
onTick(); onTick();
m_lastTickTime = tickCount; m_lastTickTime = static_cast< time_t >( tickCount );
} }
m_lastUpdate = tickCount; m_lastUpdate = static_cast< time_t >( tickCount );
} }
/*! /*!
@ -494,7 +494,7 @@ void Sapphire::Entity::Chara::autoAttack( CharaPtr pTarget )
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 ); auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
Common::EffectEntry effectEntry{}; Common::EffectEntry effectEntry{};
effectEntry.value = damage; effectEntry.value = static_cast< int16_t >( damage );
effectEntry.effectType = ActionEffectType::Damage; effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage; effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage;
effectEntry.param = 0x71; effectEntry.param = 0x71;
@ -522,19 +522,21 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
statusEffectAdd->data().actor_id = pEffect->getTargetActorId(); statusEffectAdd->data().actor_id = pEffect->getTargetActorId();
statusEffectAdd->data().current_hp = getHp(); statusEffectAdd->data().current_hp = getHp();
statusEffectAdd->data().current_mp = getMp(); statusEffectAdd->data().current_mp = static_cast< uint16_t >( getMp() );
statusEffectAdd->data().current_tp = getTp(); //statusEffectAdd->data().current_tp = getTp();
statusEffectAdd->data().max_hp = getMaxHp(); statusEffectAdd->data().max_hp = getMaxHp();
statusEffectAdd->data().max_mp = getMaxMp(); statusEffectAdd->data().max_mp = static_cast< uint16_t >( getMaxMp() );
statusEffectAdd->data().max_something = 1; //statusEffectAdd->data().max_something = 1;
//statusEffectAdd->data().unknown2 = 28; //statusEffectAdd->data().unknown2 = 28;
statusEffectAdd->data().classId = static_cast< uint8_t >(getClass());
statusEffectAdd->data().unkFlag = 1;
auto& status = statusEffectAdd->data().statusEntries[0]; auto& status = statusEffectAdd->data().statusEntries[0];
status.sourceActorId = pEffect->getSrcActorId(); status.sourceActorId = pEffect->getSrcActorId();
status.duration = static_cast< float >( pEffect->getDuration() ) / 1000; status.duration = static_cast< float >( pEffect->getDuration() ) / 1000;
status.id = pEffect->getId(); status.id = static_cast< uint16_t >( pEffect->getId() );
status.index = nextSlot; status.index = static_cast< uint8_t >( nextSlot );
status.param = pEffect->getParam(); status.param = pEffect->getParam();
sendToInRangeSet( statusEffectAdd, isPlayer() ); sendToInRangeSet( statusEffectAdd, isPlayer() );
@ -568,7 +570,7 @@ int8_t Sapphire::Entity::Chara::getStatusEffectFreeSlot()
if( m_statusEffectFreeSlotQueue.empty() ) if( m_statusEffectFreeSlotQueue.empty() )
return freeEffectSlot; return freeEffectSlot;
freeEffectSlot = m_statusEffectFreeSlotQueue.front(); freeEffectSlot = static_cast< int8_t >( m_statusEffectFreeSlotQueue.front() );
m_statusEffectFreeSlotQueue.pop(); m_statusEffectFreeSlotQueue.pop();
return freeEffectSlot; return freeEffectSlot;
@ -929,4 +931,4 @@ uint32_t Sapphire::Entity::Chara::getStatValue( Sapphire::Common::BaseParam base
} }
return value + getBonusStat( baseParam ); return value + getBonusStat( baseParam );
} }

View file

@ -272,8 +272,8 @@ void Sapphire::Entity::Player::calculateStats()
tribeInfo->iNT ); tribeInfo->iNT );
m_baseStats.mnd = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierMind ) / 100 ) + m_baseStats.mnd = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierMind ) / 100 ) +
tribeInfo->mND ); tribeInfo->mND );
m_baseStats.pie = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierPiety ) / 100 ) + /*m_baseStats.pie = static_cast< uint32_t >( base * ( static_cast< float >( classInfo->modifierPiety ) / 100 ) +
tribeInfo->pIE ); tribeInfo->pIE );*/
m_baseStats.determination = static_cast< uint32_t >( base ); m_baseStats.determination = static_cast< uint32_t >( base );
m_baseStats.pie = static_cast< uint32_t >( base ); m_baseStats.pie = static_cast< uint32_t >( base );
@ -384,7 +384,7 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
// TODO: this should be simplified and a type created in server_common/common.h. // TODO: this should be simplified and a type created in server_common/common.h.
if( type == 1 ) // teleport if( type == 1 ) // teleport
{ {
prepareZoning( data->territory, true, 1, 112 ); // TODO: Really? prepareZoning( data->territory, true, 1, 0 ); // TODO: Really?
sendToInRangeSet( makeActorControl( getId(), ActorDespawnEffect, 0x04 ) ); sendToInRangeSet( makeActorControl( getId(), ActorDespawnEffect, 0x04 ) );
setZoningType( Common::ZoneingType::Teleport ); setZoningType( Common::ZoneingType::Teleport );
} }

View file

@ -141,7 +141,7 @@ void Sapphire::Entity::Player::playGilShop( uint32_t eventId, uint32_t flags,
pEvent->setEventReturnCallback( eventCallback ); pEvent->setEventReturnCallback( eventCallback );
pEvent->setSceneChainCallback( nullptr ); pEvent->setSceneChainCallback( nullptr );
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() ); auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventPlay255 >( getId() );
openGilShopPacket->data().eventId = eventId; openGilShopPacket->data().eventId = eventId;
openGilShopPacket->data().sceneFlags = flags; openGilShopPacket->data().sceneFlags = flags;
openGilShopPacket->data().actorId = getId(); openGilShopPacket->data().actorId = getId();

View file

@ -593,6 +593,8 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_
quantity = newStackSize - maxStack; quantity = newStackSize - maxStack;
newStackSize = maxStack; newStackSize = maxStack;
} }
else
quantity = 0;
item->setStackSize( newStackSize ); item->setStackSize( newStackSize );
writeItem( item ); writeItem( item );
@ -605,6 +607,11 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_
{ {
queuePacket( makeActorControlSelf( getId(), ItemObtainIcon, catalogId, originalQuantity ) ); queuePacket( makeActorControlSelf( getId(), ItemObtainIcon, catalogId, originalQuantity ) );
auto soundEffectPacket = makeZonePacket< FFXIVIpcInventoryActionAck >( getId() );
soundEffectPacket->data().sequence = 0xFFFFFFFF;
soundEffectPacket->data().type = 6;
queuePacket( soundEffectPacket );
return item; return item;
} }
@ -636,6 +643,11 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_
queuePacket( invUpdate ); queuePacket( invUpdate );
queuePacket( makeActorControlSelf( getId(), ItemObtainIcon, catalogId, originalQuantity ) ); queuePacket( makeActorControlSelf( getId(), ItemObtainIcon, catalogId, originalQuantity ) );
auto soundEffectPacket = makeZonePacket< FFXIVIpcInventoryActionAck >( getId() );
soundEffectPacket->data().sequence = 0xFFFFFFFF;
soundEffectPacket->data().type = 6;
queuePacket( soundEffectPacket );
} }
return item; return item;
@ -666,7 +678,9 @@ Sapphire::Entity::Player::moveItem( uint16_t fromInventoryId, uint8_t fromSlotId
if( static_cast< InventoryType >( fromInventoryId ) == GearSet0 ) if( static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
unequipItem( static_cast< GearSetSlot >( fromSlotId ), tmpItem, true ); unequipItem( static_cast< GearSetSlot >( fromSlotId ), tmpItem, true );
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
sendStatusEffectUpdate(); // send if any equip is changed
} }
bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem ) bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem )
@ -801,6 +815,10 @@ void Sapphire::Entity::Player::swapItem( uint16_t fromInventoryId, uint8_t fromS
updateContainer( toInventoryId, toSlot, fromItem ); updateContainer( toInventoryId, toSlot, fromItem );
updateContainer( fromInventoryId, fromSlotId, toItem ); updateContainer( fromInventoryId, fromSlotId, toItem );
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
sendStatusEffectUpdate(); // send if any equip is changed
} }
void Sapphire::Entity::Player::discardItem( uint16_t fromInventoryId, uint8_t fromSlotId ) void Sapphire::Entity::Player::discardItem( uint16_t fromInventoryId, uint8_t fromSlotId )

View file

@ -15,14 +15,19 @@ using namespace Sapphire::Network::Packets::Server;
void Sapphire::Entity::Player::finishQuest( uint16_t questId ) void Sapphire::Entity::Player::finishQuest( uint16_t questId )
{ {
int8_t idx = getQuestIndex( questId ); int8_t idx = getQuestIndex( questId );
removeQuest( questId ); removeQuest( questId );
auto questFinishPacket = makeZonePacket< FFXIVIpcQuestFinish >( getId() );
questFinishPacket->data().questId = questId;
questFinishPacket->data().flag1 = 1;
questFinishPacket->data().flag2 = 1;
queuePacket( questFinishPacket );
updateQuestsCompleted( questId ); updateQuestsCompleted( questId );
sendQuestTracker(); //sendQuestTracker(); already sent in removeQuest()
} }
void Sapphire::Entity::Player::unfinishQuest( uint16_t questId ) void Sapphire::Entity::Player::unfinishQuest( uint16_t questId )
@ -33,24 +38,16 @@ void Sapphire::Entity::Player::unfinishQuest( uint16_t questId )
void Sapphire::Entity::Player::removeQuest( uint16_t questId ) void Sapphire::Entity::Player::removeQuest( uint16_t questId )
{ {
int8_t idx = getQuestIndex( questId ); int8_t idx = getQuestIndex( questId );
if( ( idx != -1 ) && ( m_activeQuests[ idx ] != nullptr ) ) if( ( idx != -1 ) && ( m_activeQuests[ idx ] != nullptr ) )
{ {
auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() ); auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() );
questUpdatePacket->data().slot = static_cast< uint8_t >( idx ); questUpdatePacket->data().slot = static_cast< uint8_t >( idx );
questUpdatePacket->data().questInfo.c.questId = 0; questUpdatePacket->data().questInfo.c.questId = 0;
questUpdatePacket->data().questInfo.c.sequence = 0xFF; questUpdatePacket->data().questInfo.c.sequence = 0xFF;
queuePacket( questUpdatePacket ); queuePacket( questUpdatePacket );
auto questFinishPacket = makeZonePacket< FFXIVIpcQuestFinish >( getId() );
questFinishPacket->data().questId = questId;
questFinishPacket->data().flag1 = 1;
questFinishPacket->data().flag2 = 1;
queuePacket( questFinishPacket );
for( int32_t ii = 0; ii < 5; ii++ ) for( int32_t ii = 0; ii < 5; ii++ )
{ {
if( m_questTracking[ ii ] == idx ) if( m_questTracking[ ii ] == idx )
@ -67,7 +64,6 @@ void Sapphire::Entity::Player::removeQuest( uint16_t questId )
} }
sendQuestTracker(); sendQuestTracker();
} }
bool Sapphire::Entity::Player::hasQuest( uint32_t questId ) bool Sapphire::Entity::Player::hasQuest( uint32_t questId )
@ -1067,7 +1063,7 @@ bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t opti
if( rewardItemCount > 0 ) if( rewardItemCount > 0 )
{ {
for( uint32_t i = 0; i < questInfo->itemReward0.size(); i++ ) for( uint32_t i = 0; i < rewardItemCount; i++ )
{ {
addItem( questInfo->itemReward0.at( i ), questInfo->itemCountReward0.at( i ) ); addItem( questInfo->itemReward0.at( i ), questInfo->itemCountReward0.at( i ) );
} }
@ -1075,8 +1071,15 @@ bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t opti
if( optionalItemCount > 0 ) if( optionalItemCount > 0 )
{ {
auto itemId = questInfo->itemReward1.at( optionalChoice ); for( uint32_t i = 0; i < optionalItemCount; i++ )
addItem( itemId, questInfo->itemCountReward1.at( optionalChoice ) ); {
auto itemId = questInfo->itemReward1.at( i );
if( itemId == optionalChoice )
{
addItem( itemId, questInfo->itemCountReward1.at( i ) );
break;
}
}
} }
if( gilReward > 0 ) if( gilReward > 0 )

View file

@ -217,6 +217,10 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
m_modelSubWeapon = 0; m_modelSubWeapon = 0;
m_lastTickTime = 0; m_lastTickTime = 0;
//m_pInventory->load();
initInventory(); // moved up so we don't lose hp every login
calculateStats(); calculateStats();
// first login, run the script event // first login, run the script event
@ -242,10 +246,6 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
setStateFlag( PlayerStateFlag::BetweenAreas ); setStateFlag( PlayerStateFlag::BetweenAreas );
//m_pInventory->load();
initInventory();
initHateSlotQueue(); initHateSlotQueue();
initSpawnIdQueue(); initSpawnIdQueue();

View file

@ -3,6 +3,7 @@
#include <Common.h> #include <Common.h>
#include <set> #include <set>
#include <string>
namespace Sapphire namespace Sapphire
{ {

View file

@ -200,7 +200,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
int32_t aetheryteId; int32_t aetheryteId;
sscanf( params.c_str(), "%i", &aetheryteId ); sscanf( params.c_str(), "%i", &aetheryteId );
player.teleport( aetheryteId ); player.teleport( static_cast< uint16_t >( aetheryteId ) );
} }
else if( ( subCommand == "discovery" ) && ( params != "" ) ) else if( ( subCommand == "discovery" ) && ( params != "" ) )
{ {
@ -209,8 +209,8 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%i %i", &map_id, &discover_id ); sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() ); auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() );
discoveryPacket->data().mapId = map_id; discoveryPacket->data().mapId = static_cast< uint32_t >( map_id );
discoveryPacket->data().mapPartId = discover_id; discoveryPacket->data().mapPartId = static_cast< uint32_t >( discover_id );
player.queuePacket( discoveryPacket ); player.queuePacket( discoveryPacket );
} }
else if( subCommand == "discovery_reset" ) else if( subCommand == "discovery_reset" )
@ -237,7 +237,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
int32_t minutes; int32_t minutes;
sscanf( params.c_str(), "%d", &minutes ); sscanf( params.c_str(), "%d", &minutes );
player.setCFPenaltyMinutes( minutes ); player.setCFPenaltyMinutes( static_cast< uint32_t >( minutes ) );
} }
else if( subCommand == "eorzeatime" ) else if( subCommand == "eorzeatime" )
{ {
@ -253,7 +253,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
player.dismount(); player.dismount();
player.mount( id ); player.mount( static_cast< uint32_t >( id ) );
} }
else if( subCommand == "msqguide" ) else if( subCommand == "msqguide" )
{ {
@ -261,7 +261,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerProgress >( player.getId() ); auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerProgress >( player.getId() );
msqPacket->data().id = id; msqPacket->data().id = static_cast< uint32_t >( id );
player.queuePacket( msqPacket ); player.queuePacket( msqPacket );
player.sendDebug( "MSQ Guide updated " ); player.sendDebug( "MSQ Guide updated " );
@ -272,7 +272,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerComplete >( player.getId() ); auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerComplete >( player.getId() );
msqPacket->data().id = id; msqPacket->data().id = static_cast< uint32_t >( id );
player.queuePacket( msqPacket ); player.queuePacket( msqPacket );
player.sendDebug( "MSQ Guide updated " ); player.sendDebug( "MSQ Guide updated " );
@ -413,7 +413,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
uint32_t titleId; uint32_t titleId;
sscanf( params.c_str(), "%u", &titleId ); sscanf( params.c_str(), "%u", &titleId );
player.addTitle( titleId ); player.addTitle( static_cast< uint16_t >( titleId ) );
player.sendNotice( "Added title (id#{0})", titleId ); player.sendNotice( "Added title (id#{0})", titleId );
} }
else if( subCommand == "bnpc" ) else if( subCommand == "bnpc" )
@ -474,13 +474,13 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
player.sendNotice( "Injecting ACTOR_CONTROL {0}", opcode ); player.sendNotice( "Injecting ACTOR_CONTROL {0}", opcode );
auto actorControl = makeZonePacket< FFXIVIpcActorControlSelf >( playerId, player.getId() ); auto actorControl = makeZonePacket< FFXIVIpcActorControlSelf >( playerId, player.getId() );
actorControl->data().category = opcode; actorControl->data().category = static_cast< uint16_t >( opcode );
actorControl->data().param1 = param1; actorControl->data().param1 = static_cast< uint16_t >( param1 );
actorControl->data().param2 = param2; actorControl->data().param2 = static_cast< uint16_t >( param2 );
actorControl->data().param3 = param3; actorControl->data().param3 = static_cast< uint16_t >( param3 );
actorControl->data().param4 = param4; actorControl->data().param4 = static_cast< uint16_t >( param4 );
actorControl->data().param5 = param5; actorControl->data().param5 = static_cast< uint16_t >( param5 );
actorControl->data().param6 = param6; actorControl->data().param6 = static_cast< uint16_t >( param6 );
player.queuePacket( actorControl ); player.queuePacket( actorControl );
@ -500,7 +500,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
uint32_t id; uint32_t id;
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
player.learnAction( id ); player.learnAction( static_cast< uint16_t >( id ) );
} }
else if ( subCommand == "effect") else if ( subCommand == "effect")
{ {
@ -511,7 +511,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
effectPacket->setRotation( Common::Util::floatToUInt16Rot( player.getRot() ) ); effectPacket->setRotation( Common::Util::floatToUInt16Rot( player.getRot() ) );
Common::EffectEntry entry{}; Common::EffectEntry entry{};
entry.value = param1; entry.value = static_cast< int16_t >( param1 );
entry.effectType = Common::ActionEffectType::Damage; entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage; entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage;

View file

@ -159,7 +159,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
continue; continue;
} }
container->second->setItem( slot, item ); container->second->setItem( static_cast< uint8_t >( slot ), item );
itemCount++; itemCount++;
} }
@ -182,7 +182,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
// land stuff // land stuff
entry.m_landSetId = res->getUInt64( "LandSetId" ); entry.m_landSetId = res->getUInt64( "LandSetId" );
entry.m_landId = res->getUInt( "LandId" ); entry.m_landId = static_cast< uint16_t >( res->getUInt( "LandId" ) );
entry.m_type = static_cast< Common::LandType >( res->getUInt( "Type" ) ); entry.m_type = static_cast< Common::LandType >( res->getUInt( "Type" ) );
entry.m_size = static_cast< Common::HouseSize >( res->getUInt8( "Size" ) ); entry.m_size = static_cast< Common::HouseSize >( res->getUInt8( "Size" ) );
@ -233,9 +233,9 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
// setup containers // setup containers
// todo: this is pretty garbage // todo: this is pretty garbage
Common::LandIdent ident; Common::LandIdent ident;
ident.territoryTypeId = entry.m_landSetId >> 16; ident.territoryTypeId = static_cast< int16_t >( entry.m_landSetId >> 16 );
ident.wardNum = entry.m_landSetId & 0xFFFF; ident.wardNum = static_cast< int16_t >( entry.m_landSetId & 0xFFFF );
ident.landId = entry.m_landId; ident.landId = static_cast< int16_t >( entry.m_landId );
ident.worldId = 67; ident.worldId = 67;
auto& containers = getEstateInventory( ident ); auto& containers = getEstateInventory( ident );
@ -305,20 +305,20 @@ Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32
if( !hZone ) if( !hZone )
return nullptr; return nullptr;
return hZone->getLand( res->getUInt( 2 ) ); return hZone->getLand( static_cast< uint8_t >( res->getUInt( 2 ) ) );
} }
void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident )
{ {
player.setActiveLand( ident.landId, ident.wardNum ); player.setActiveLand( static_cast< uint8_t >( ident.landId ), static_cast< uint8_t >( ident.wardNum ) );
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -335,7 +335,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
std::strcpy( landInfoSignPacket->data().estateGreeting, house->getHouseGreeting().c_str() ); std::strcpy( landInfoSignPacket->data().estateGreeting, house->getHouseGreeting().c_str() );
} }
uint32_t playerId = land->getOwnerId(); uint32_t playerId = static_cast< uint32_t >( land->getOwnerId() );
std::string playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( playerId ); std::string playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( playerId );
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() ); memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
@ -345,15 +345,15 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& player, const Common::LandIdent ident )
{ {
player.setActiveLand( ident.landId, ident.wardNum ); player.setActiveLand( static_cast< uint8_t >( ident.landId ), static_cast< uint8_t >( ident.wardNum ) );
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() ); auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() );
plotPricePacket->data().price = land->getCurrentPrice(); plotPricePacket->data().price = land->getCurrentPrice();
plotPricePacket->data().timeLeft = land->getDevaluationTime(); plotPricePacket->data().timeLeft = land->getDevaluationTime();
@ -471,7 +471,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
auto wardInfoPacket = makeZonePacket< Server::FFXIVIpcHousingWardInfo >( player.getId() ); auto wardInfoPacket = makeZonePacket< Server::FFXIVIpcHousingWardInfo >( player.getId() );
wardInfoPacket->data().landIdent.wardNum = wardId; wardInfoPacket->data().landIdent.wardNum = wardId;
wardInfoPacket->data().landIdent.territoryTypeId = territoryTypeId; wardInfoPacket->data().landIdent.territoryTypeId = static_cast< int16_t >( territoryTypeId );
// todo: properly get worldId // todo: properly get worldId
wardInfoPacket->data().landIdent.worldId = 67; wardInfoPacket->data().landIdent.worldId = 67;
@ -509,7 +509,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned; entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
auto owner = land->getOwnerId(); auto owner = land->getOwnerId();
auto playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( owner ); auto playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( static_cast< uint32_t >( owner ) );
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() ); memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
break; break;
@ -524,13 +524,13 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -630,9 +630,9 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
if( item.second == 0 ) if( item.second == 0 )
continue; continue;
auto pItem = invMgr->createItem( player, item.second ); auto pItem = invMgr->createItem( player, static_cast< uint32_t >( item.second ) );
container->setItem( item.first, pItem ); container->setItem( static_cast< uint8_t >( item.first ), pItem );
} }
invMgr->saveHousingContainer( land->getLandIdent(), container ); invMgr->saveHousingContainer( land->getLandIdent(), container );
@ -701,7 +701,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
// start house built event // start house built event
// CmnDefHousingBuildHouse_00149 // CmnDefHousingBuildHouse_00149
player.eventStart( player.getId(), 0x000B0095, Event::EventHandler::EventType::Housing, 1, 1 ); player.eventStart( player.getId(), 0x000B0095, Event::EventHandler::EventType::Housing, 1, 1 );
player.playScene( 0x000B0095, 0, SET_BASE | HIDE_HOTBAR , 0, 1, plotNum, nullptr ); player.playScene( 0x000B0095, 0, static_cast< uint32_t >( SET_BASE | HIDE_HOTBAR ) , 0, 1, plotNum, nullptr );
player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, ident ); player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, ident );
player.sendLandFlagsSlot( LandFlagsSlot::Private ); player.sendLandFlagsSlot( LandFlagsSlot::Private );
@ -711,13 +711,13 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
auto house = land->getHouse(); auto house = land->getHouse();
if( !house ) if( !house )
@ -733,13 +733,13 @@ void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player&
void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -757,13 +757,13 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Pl
void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player& player, const Common::LandIdent ident, const std::string& greeting ) void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player& player, const Common::LandIdent ident, const std::string& greeting )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto zone = getHousingZoneByLandSetId( landSetId ); auto zone = getHousingZoneByLandSetId( landSetId );
if( !zone ) if( !zone )
return; return;
auto land = zone->getLand( ident.landId ); auto land = zone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -782,7 +782,7 @@ void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player&
void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
@ -804,13 +804,13 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity:
Sapphire::Common::LandIdent Sapphire::World::Manager::HousingMgr::clientTriggerParamsToLandIdent( uint32_t param11, uint32_t param12, bool use16bits ) const Sapphire::Common::LandIdent Sapphire::World::Manager::HousingMgr::clientTriggerParamsToLandIdent( uint32_t param11, uint32_t param12, bool use16bits ) const
{ {
Common::LandIdent ident; Common::LandIdent ident;
ident.worldId = param11 >> 16; ident.worldId = static_cast< int16_t >( param11 >> 16 );
ident.territoryTypeId = param11 & 0xFFFF; ident.territoryTypeId = static_cast< int16_t >( param11 & 0xFFFF );
if( use16bits ) if( use16bits )
{ {
ident.wardNum = param12 >> 16; ident.wardNum = static_cast< int16_t >( param12 >> 16 );
ident.landId = param12 & 0xFFFF; ident.landId = static_cast< int16_t >( param12 & 0xFFFF );
} }
else else
{ {
@ -837,13 +837,13 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
auto ident = internalZone->getLandIdent(); auto ident = internalZone->getLandIdent();
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto exteriorZone = getHousingZoneByLandSetId( landSetId ); auto exteriorZone = getHousingZoneByLandSetId( landSetId );
if( !exteriorZone ) if( !exteriorZone )
return; return;
targetLand = exteriorZone->getLand( ident.landId ); targetLand = exteriorZone->getLand( static_cast< uint8_t >( ident.landId ) );
} }
else else
{ {
@ -974,7 +974,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
// inside housing territory // inside housing territory
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) ) if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
{ {
land = zone->getLand( landId ); land = zone->getLand( static_cast< uint8_t >( landId ) );
isOutside = true; isOutside = true;
} }
@ -985,9 +985,9 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
// todo: this whole process is retarded and needs to be fixed // todo: this whole process is retarded and needs to be fixed
// perhaps maintain a list of estates by ident inside housingmgr? // perhaps maintain a list of estates by ident inside housingmgr?
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
} }
// wtf? // wtf?
else else
@ -1047,7 +1047,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) ) if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
{ {
land = zone->getLand( landId ); land = zone->getLand( static_cast< uint8_t >( landId ) );
isOutside = true; isOutside = true;
} }
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
@ -1056,9 +1056,9 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
// todo: this whole process is retarded and needs to be fixed // todo: this whole process is retarded and needs to be fixed
// perhaps maintain a list of estates by ident inside housingmgr? // perhaps maintain a list of estates by ident inside housingmgr?
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
} }
if( !hasPermission( player, *land, 0 ) ) if( !hasPermission( player, *land, 0 ) )
@ -1080,7 +1080,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
if( !item ) if( !item )
return; return;
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->saveHousingContainer( ident, container ); invMgr->saveHousingContainer( ident, container );
} }
@ -1103,7 +1103,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
if( !item ) if( !item )
return; return;
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->saveHousingContainer( ident, container ); invMgr->saveHousingContainer( ident, container );
} }
@ -1125,7 +1125,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
return false; return false;
// add item to inv // add item to inv
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
// we need to save the item again as removing it from the container on the player will remove it from charaglobalitem // we need to save the item again as removing it from the container on the player will remove it from charaglobalitem
// todo: this needs to be handled a bit better as it might be possible to overwrite another item that is created in the meantime // todo: this needs to be handled a bit better as it might be possible to overwrite another item that is created in the meantime
@ -1139,7 +1139,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ); auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
assert( zone ); assert( zone );
zone->spawnYardObject( ident.landId, freeSlot, *item ); zone->spawnYardObject( static_cast< uint8_t >( ident.landId ), static_cast< uint16_t >( freeSlot ), *item );
return true; return true;
} }
@ -1173,7 +1173,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
} }
// have a free slot // have a free slot
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
// resend container // resend container
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
@ -1183,7 +1183,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() ); auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
assert( zone ); assert( zone );
zone->spawnHousingObject( containerIdx, freeSlot, containerId, item ); zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item );
return true; return true;
} }
@ -1235,8 +1235,8 @@ void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& p
Common::LandIdent ident, uint8_t slot, Common::LandIdent ident, uint8_t slot,
Common::FFXIVARR_POSITION3 pos, float rot ) Common::FFXIVARR_POSITION3 pos, float rot )
{ {
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -1282,7 +1282,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
auto container = it->second; auto container = it->second;
auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( slotIdx ) ); auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( static_cast< uint8_t >( slotIdx ) ) );
if( !item ) if( !item )
return false; return false;
@ -1293,10 +1293,10 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
invMgr->updateHousingItemPosition( item ); invMgr->updateHousingItemPosition( item );
terri.updateHousingObjectPosition( player, slot, item->getPos(), item->getRot() ); terri.updateHousingObjectPosition( player, slot, item->getPos(), static_cast< uint16_t >( item->getRot() ) );
// send confirmation to player // send confirmation to player
uint32_t param1 = ( ident.landId << 16 ) | containerId; uint32_t param1 = static_cast< uint32_t >( ( ident.landId << 16 ) | containerId );
player.queuePacket( player.queuePacket(
Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slotIdx ) ); Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slotIdx ) );
@ -1309,7 +1309,7 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
Sapphire::HousingZone& terri, Common::FFXIVARR_POSITION3 pos, Sapphire::HousingZone& terri, Common::FFXIVARR_POSITION3 pos,
float rot ) float rot )
{ {
auto land = terri.getLand( ident.landId ); auto land = terri.getLand( static_cast< uint8_t >( ident.landId ) );
if( !hasPermission( player, *land, 0 ) ) if( !hasPermission( player, *land, 0 ) )
return false; return false;
@ -1331,9 +1331,9 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
invMgr->updateHousingItemPosition( item ); invMgr->updateHousingItemPosition( item );
terri.updateYardObjectPos( player, slot, ident.landId, *item ); terri.updateYardObjectPos( player, slot, static_cast< uint16_t >( ident.landId ), *item );
uint32_t param1 = ( ident.landId << 16 ) | InventoryType::HousingExteriorPlacedItems; uint32_t param1 = static_cast< uint32_t >( ( ident.landId << 16 ) | InventoryType::HousingExteriorPlacedItems );
player.queuePacket( Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slot ) ); player.queuePacket( Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slot ) );
@ -1348,8 +1348,8 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
player.getCurrentTerritory() ) ) player.getCurrentTerritory() ) )
{ {
auto ident = terri->getLandIdent(); auto ident = terri->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -1361,7 +1361,7 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
} }
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) ) else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
{ {
auto land = terri->getLand( plot ); auto land = terri->getLand( static_cast< uint8_t >( plot ) );
if( !land ) if( !land )
return; return;
@ -1406,7 +1406,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
auto container = it->second; auto container = it->second;
auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( slotId ) ); auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( static_cast< uint8_t >( slotId ) ) );
if( !item ) if( !item )
return false; return false;
@ -1420,7 +1420,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
// remove it from housing inventory // remove it from housing inventory
container->removeItem( slotId ); container->removeItem( static_cast< uint8_t >( slotId ) );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->removeHousingItemPosition( *item ); invMgr->removeHousingItemPosition( *item );
invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId ); invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
@ -1441,12 +1441,12 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
container->removeItem( slotId ); container->removeItem( static_cast< uint8_t >( slotId ) );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->removeHousingItemPosition( *item ); invMgr->removeHousingItemPosition( *item );
invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId ); invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
freeContainer->setItem( slotId, item ); freeContainer->setItem( static_cast< uint8_t >( slotId ), item );
invMgr->sendInventoryContainer( player, freeContainer ); invMgr->sendInventoryContainer( player, freeContainer );
invMgr->saveHousingContainer( terri.getLandIdent(), freeContainer ); invMgr->saveHousingContainer( terri.getLandIdent(), freeContainer );
} }
@ -1455,7 +1455,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
if( containerIdx != -1 ) if( containerIdx != -1 )
{ {
auto arraySlot = ( containerIdx * 50 ) + slotId; auto arraySlot = ( containerIdx * 50 ) + slotId;
terri.removeHousingObject( arraySlot ); terri.removeHousingObject( static_cast< uint16_t >( arraySlot ) );
} }
return true; return true;
@ -1494,7 +1494,7 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
invMgr->removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId ); invMgr->removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId );
invMgr->removeHousingItemPosition( *item ); invMgr->removeHousingItemPosition( *item );
storeroomContainer->setItem( freeSlot, item ); storeroomContainer->setItem( static_cast< uint8_t >( freeSlot ), item );
invMgr->sendInventoryContainer( player, storeroomContainer ); invMgr->sendInventoryContainer( player, storeroomContainer );
invMgr->saveHousingContainer( land.getLandIdent(), storeroomContainer ); invMgr->saveHousingContainer( land.getLandIdent(), storeroomContainer );
} }
@ -1515,7 +1515,7 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
} }
if( shouldDespawnItem ) if( shouldDespawnItem )
terri.despawnYardObject( land.getLandIdent().landId, slotId ); terri.despawnYardObject( static_cast< uint16_t >( land.getLandIdent().landId ), slotId );
return true; return true;
} }
@ -1552,7 +1552,7 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
if( !terri ) if( !terri )
return; return;
auto land = terri->getLand( plot ); auto land = terri->getLand( static_cast< uint8_t >( plot ) );
if( !land ) if( !land )
return; return;
@ -1580,8 +1580,8 @@ void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::E
return; return;
auto ident = terri->getLandIdent(); auto ident = terri->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -1622,4 +1622,4 @@ Sapphire::Inventory::HousingItemPtr Sapphire::World::Manager::HousingMgr::getHou
return nullptr; return nullptr;
return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId(), framework() ); return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId(), framework() );
} }

View file

@ -345,13 +345,13 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createInstanceCon
auto pTeri = getTerritoryDetail( pContentFinderCondition->territoryType ); auto pTeri = getTerritoryDetail( pContentFinderCondition->territoryType );
if( !pTeri || pInstanceContent->name.empty() ) if( !pTeri || pContentFinderCondition->name.empty() )
return nullptr; return nullptr;
Logger::debug( "Starting instance for InstanceContent id: {0} ({1})", instanceContentId, pInstanceContent->name ); Logger::debug( "Starting instance for InstanceContent id: {0} ({1})", instanceContentId, pInstanceContent->name );
auto pZone = make_InstanceContent( pInstanceContent, pContentFinderCondition->territoryType, getNextInstanceId(), auto pZone = make_InstanceContent( pInstanceContent, pContentFinderCondition->territoryType, getNextInstanceId(),
pTeri->name, pInstanceContent->name, instanceContentId, framework() ); pTeri->name, pContentFinderCondition->name, instanceContentId, framework() );
pZone->init(); pZone->init();
m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone; m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone;

View file

@ -19,55 +19,55 @@ const int levelTable[81][6] =
{ {
// MAIN,SUB,DIV,HP,ELMT,THREAT // MAIN,SUB,DIV,HP,ELMT,THREAT
{ 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1 },
{ 20, 56, 56, 0, 52, 2 }, { 20, 56, 56, 86, 52, 2 },
{ 21, 57, 57, 0, 54, 2 }, { 21, 57, 57, 101, 54, 2 },
{ 22, 60, 60, 0, 56, 3 }, { 22, 60, 60, 109, 56, 3 },
{ 24, 62, 62, 0, 58, 3 }, { 24, 62, 62, 116, 58, 3 },
{ 26, 65, 65, 0, 60, 3 }, { 26, 65, 65, 123, 60, 3 },
{ 27, 68, 68, 0, 62, 3 }, { 27, 68, 68, 131, 62, 3 },
{ 29, 70, 70, 0, 64, 4 }, { 29, 70, 70, 138, 64, 4 },
{ 31, 73, 73, 0, 66, 4 }, { 31, 73, 73, 145, 66, 4 },
{ 33, 76, 76, 0, 68, 4 }, { 33, 76, 76, 153, 68, 4 },
{ 35, 78, 78, 0, 70, 5 }, { 35, 78, 78, 160, 70, 5 },
{ 36, 82, 82, 0, 73, 5 }, { 36, 82, 82, 174, 73, 5 },
{ 38, 85, 85, 0, 75, 5 }, { 38, 85, 85, 188, 75, 5 },
{ 41, 89, 89, 0, 78, 6 }, { 41, 89, 89, 202, 78, 6 },
{ 44, 93, 93, 0, 81, 6 }, { 44, 93, 93, 216, 81, 6 },
{ 46, 96, 96, 0, 84, 7 }, { 46, 96, 96, 230, 84, 7 },
{ 49, 100, 100, 0, 86, 7 }, { 49, 100, 100, 244, 86, 7 },
{ 52, 104, 104, 0, 89, 8 }, { 52, 104, 104, 258, 89, 8 },
{ 54, 109, 109, 0, 93, 9 }, { 54, 109, 109, 272, 93, 9 },
{ 57, 113, 113, 0, 95, 9 }, { 57, 113, 113, 286, 95, 9 },
{ 60, 116, 116, 0, 98, 10 }, { 60, 116, 116, 300, 98, 10 },
{ 63, 122, 122, 0, 102, 10 }, { 63, 122, 122, 333, 102, 10 },
{ 67, 127, 127, 0, 105, 11 }, { 67, 127, 127, 366, 105, 11 },
{ 71, 133, 133, 0, 109, 12 }, { 71, 133, 133, 399, 109, 12 },
{ 74, 138, 138, 0, 113, 13 }, { 74, 138, 138, 432, 113, 13 },
{ 78, 144, 144, 0, 117, 14 }, { 78, 144, 144, 465, 117, 14 },
{ 81, 150, 150, 0, 121, 15 }, { 81, 150, 150, 498, 121, 15 },
{ 85, 155, 155, 0, 125, 16 }, { 85, 155, 155, 531, 125, 16 },
{ 89, 162, 162, 0, 129, 17 }, { 89, 162, 162, 564, 129, 17 },
{ 92, 168, 168, 0, 133, 18 }, { 92, 168, 168, 597, 133, 18 },
{ 97, 173, 173, 0, 137, 19 }, { 97, 173, 173, 630, 137, 19 },
{ 101, 181, 181, 0, 143, 20 }, { 101, 181, 181, 669, 143, 20 },
{ 106, 188, 188, 0, 148, 22 }, { 106, 188, 188, 708, 148, 22 },
{ 110, 194, 194, 0, 153, 23 }, { 110, 194, 194, 747, 153, 23 },
{ 115, 202, 202, 0, 159, 25 }, { 115, 202, 202, 786, 159, 25 },
{ 119, 209, 209, 0, 165, 27 }, { 119, 209, 209, 825, 165, 27 },
{ 124, 215, 215, 0, 170, 29 }, { 124, 215, 215, 864, 170, 29 },
{ 128, 223, 223, 0, 176, 31 }, { 128, 223, 223, 903, 176, 31 },
{ 134, 229, 229, 0, 181, 33 }, { 134, 229, 229, 942, 181, 33 },
{ 139, 236, 236, 0, 186, 35 }, { 139, 236, 236, 981, 186, 35 },
{ 144, 244, 244, 0, 192, 38 }, { 144, 244, 244, 1020, 192, 38 },
{ 150, 253, 253, 0, 200, 40 }, { 150, 253, 253, 1088, 200, 40 },
{ 155, 263, 263, 0, 207, 43 }, { 155, 263, 263, 1156, 207, 43 },
{ 161, 272, 272, 0, 215, 46 }, { 161, 272, 272, 1224, 215, 46 },
{ 166, 283, 283, 0, 223, 49 }, { 166, 283, 283, 1292, 223, 49 },
{ 171, 292, 292, 0, 231, 52 }, { 171, 292, 292, 1360, 231, 52 },
{ 177, 302, 302, 0, 238, 55 }, { 177, 302, 302, 1428, 238, 55 },
{ 183, 311, 311, 0, 246, 58 }, { 183, 311, 311, 1496, 246, 58 },
{ 189, 322, 322, 0, 254, 62 }, { 189, 322, 322, 1564, 254, 62 },
{ 196, 331, 331, 0, 261, 66 }, { 196, 331, 331, 1632, 261, 66 },
{ 202, 341, 341, 1700, 269, 70 }, { 202, 341, 341, 1700, 269, 70 },
{ 204, 342, 393, 1774, 270, 84 }, { 204, 342, 393, 1774, 270, 84 },
{ 205, 344, 444, 1851, 271, 99 }, { 205, 344, 444, 1851, 271, 99 },
@ -92,7 +92,7 @@ const int levelTable[81][6] =
// todo: add proper shbr values - hp/elmt/threat // todo: add proper shbr values - hp/elmt/threat
// sub/div added from http://theoryjerks.akhmorning.com/resources/levelmods/ // sub/div added from http://theoryjerks.akhmorning.com/resources/levelmods/
{ 296, 365, 2263, 3600, 466, 466 }, { 296, 365, 2263, 3600, 295, 466 },
{ 300, 366, 2360, 3600, 295, 466 }, { 300, 366, 2360, 3600, 295, 466 },
{ 305, 367, 2461, 3600, 295, 466 }, { 305, 367, 2461, 3600, 295, 466 },
{ 310, 368, 2566, 3600, 295, 466 }, { 310, 368, 2566, 3600, 295, 466 },
@ -131,7 +131,7 @@ float CalcStats::calculateBaseStat( const Chara& chara )
if( level > Common::MAX_PLAYER_LEVEL ) if( level > Common::MAX_PLAYER_LEVEL )
level = Common::MAX_PLAYER_LEVEL; level = Common::MAX_PLAYER_LEVEL;
return static_cast< float >( levelTable[level][2] ); return static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::MAIN ] );
} }
// Leggerless' HP Formula // Leggerless' HP Formula
@ -154,19 +154,22 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer, Sapphire::FrameworkPtr pF
auto vitMod = pPlayer->getBonusStat( Common::BaseParam::Vitality ); auto vitMod = pPlayer->getBonusStat( Common::BaseParam::Vitality );
float baseStat = calculateBaseStat( *pPlayer ); float baseStat = calculateBaseStat( *pPlayer );
uint16_t vitStat = pPlayer->getStats().vit + static_cast< uint16_t >( vitMod ); uint16_t vitStat = static_cast< uint16_t >( pPlayer->getStats().vit ) + static_cast< uint16_t >( vitMod );
uint16_t hpMod = paramGrowthInfo->hpModifier; uint16_t hpMod = paramGrowthInfo->hpModifier;
uint16_t jobModHp = classInfo->modifierHitPoints; uint16_t jobModHp = classInfo->modifierHitPoints;
float approxBaseHp = 0.0f; // Read above float approxBaseHp = 0.0f; // Read above
// These values are not precise. // These values are not precise.
/*
if( level >= 60 ) if( level >= 60 )
approxBaseHp = static_cast< float >( 2600 + ( level - 60 ) * 100 ); approxBaseHp = static_cast< float >( 2600 + ( level - 60 ) * 100 );
else if( level >= 50 ) else if( level >= 50 )
approxBaseHp = 1700 + ( ( level - 50 ) * ( 1700 * 1.04325f ) ); approxBaseHp = 1700 + ( ( level - 50 ) * ( 1700 * 1.04325f ) );
else else
approxBaseHp = paramGrowthInfo->mpModifier * 0.7667f; approxBaseHp = paramGrowthInfo->mpModifier * 0.7667f;
*/
// just use the table at least better than what it was
approxBaseHp = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::HP ] );
uint16_t result = static_cast< uint16_t >( floor( jobModHp * ( approxBaseHp / 100.0f ) ) + uint16_t result = static_cast< uint16_t >( floor( jobModHp * ( approxBaseHp / 100.0f ) ) +
floor( hpMod / 100.0f * ( vitStat - baseStat ) ) ); floor( hpMod / 100.0f * ( vitStat - baseStat ) ) );
@ -483,7 +486,7 @@ float CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_
// D = ⌊ f(pot) × f(wd) × f(ap) × f(det) × f(tnc) × traits ⌋ // 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... ⌋ // × f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ buff_1 ⌋ × buff_1 ⌋ × buff... ⌋
auto pot = potency( ptc ); auto pot = potency( static_cast< uint16_t >( ptc ) );
auto wd = weaponDamage( chara, wepDmg ); auto wd = weaponDamage( chara, wepDmg );
auto ap = getPrimaryAttackPower( chara ); auto ap = getPrimaryAttackPower( chara );
auto det = determination( chara ); auto det = determination( chara );

View file

@ -224,7 +224,7 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac
Logger::debug( "[{0}] Undefined World 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 ] ), Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ),
pPacket.segHdr.size ) ); static_cast< uint16_t >( pPacket.segHdr.size) ) );
} }
} }
@ -392,7 +392,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
{ {
case SEGMENTTYPE_SESSIONINIT: case SEGMENTTYPE_SESSIONINIT:
{ {
char* id = ( char* ) &( inPacket.data[ 4 ] ); char* id = reinterpret_cast< char* >( &( inPacket.data[ 4 ] ) );
uint32_t playerId = std::stoul( id ); uint32_t playerId = std::stoul( id );
auto pCon = std::static_pointer_cast< GameConnection, Connection >( shared_from_this() ); auto pCon = std::static_pointer_cast< GameConnection, Connection >( shared_from_this() );
@ -423,15 +423,15 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
m_pSession = session; m_pSession = session;
auto pe = std::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 ); auto pe = std::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 );
*( unsigned int* ) ( &pe->data()[ 0 ] ) = 0xE0037603; *reinterpret_cast< unsigned int* >( &pe->data()[ 0 ] ) = 0xE0037603;
*( unsigned int* ) ( &pe->data()[ 4 ] ) = Common::Util::getTimeSeconds(); *reinterpret_cast< unsigned int* >( &pe->data()[ 4 ] ) = Common::Util::getTimeSeconds();
sendSinglePacket( pe ); sendSinglePacket( pe );
// main connection, assinging it to the session // main connection, assinging it to the session
if( ipcHeader.connectionType == ConnectionType::Zone ) if( ipcHeader.connectionType == ConnectionType::Zone )
{ {
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 ); auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId; *reinterpret_cast< unsigned int* >( &pe1->data()[ 0 ] ) = playerId;
sendSinglePacket( pe1 ); sendSinglePacket( pe1 );
Logger::info( "[{0}] Setting session for world connection", id ); Logger::info( "[{0}] Setting session for world connection", id );
session->setZoneConnection( pCon ); session->setZoneConnection( pCon );
@ -440,11 +440,11 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
else if( ipcHeader.connectionType == ConnectionType::Chat ) else if( ipcHeader.connectionType == ConnectionType::Chat )
{ {
auto pe2 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 ); auto pe2 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe2->data()[ 0 ] ) = playerId; *reinterpret_cast< unsigned int* >( &pe2->data()[ 0 ] ) = playerId;
sendSinglePacket( pe2 ); sendSinglePacket( pe2 );
auto pe3 = std::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId ); auto pe3 = std::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId );
*( unsigned short* ) ( &pe3->data()[ 2 ] ) = 0x02; *reinterpret_cast< unsigned short* >( &pe3->data()[ 2 ] ) = 0x02;
sendSinglePacket( pe3 ); sendSinglePacket( pe3 );
Logger::info( "[{0}] Setting session for chat connection", id ); Logger::info( "[{0}] Setting session for chat connection", id );
@ -461,12 +461,12 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
} }
case SEGMENTTYPE_KEEPALIVE: // keep alive case SEGMENTTYPE_KEEPALIVE: // keep alive
{ {
uint32_t id = *( uint32_t* ) &inPacket.data[ 0 ]; uint32_t id = *reinterpret_cast< uint32_t* >( &inPacket.data[ 0 ] );
uint32_t timeStamp = *( uint32_t* ) &inPacket.data[ 4 ]; uint32_t timeStamp = *reinterpret_cast< uint32_t* >( &inPacket.data[ 4 ] );
auto pe4 = std::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 ); auto pe4 = std::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 );
*( unsigned int* ) ( &pe4->data()[ 0 ] ) = id; *reinterpret_cast< unsigned int* >( &pe4->data()[ 0 ] ) = id;
*( unsigned int* ) ( &pe4->data()[ 4 ] ) = timeStamp; *reinterpret_cast< unsigned int* >( &pe4->data()[ 4 ] ) = timeStamp;
sendSinglePacket( pe4 ); sendSinglePacket( pe4 );
break; break;

View file

@ -32,7 +32,7 @@ void Sapphire::Network::GameConnection::cfDutyInfoRequest( FrameworkPtr pFw,
// cap it since it's uint8_t in packets // cap it since it's uint8_t in packets
penaltyMinutes = 255; penaltyMinutes = 255;
} }
dutyInfoPacket->data().penaltyTime = penaltyMinutes; dutyInfoPacket->data().penaltyTime = static_cast< uint8_t >( penaltyMinutes );
queueOutPacket( dutyInfoPacket ); queueOutPacket( dutyInfoPacket );
auto inNeedsPacket = makeZonePacket< FFXIVIpcCFPlayerInNeed >( player.getId() ); auto inNeedsPacket = makeZonePacket< FFXIVIpcCFPlayerInNeed >( player.getId() );
@ -62,7 +62,7 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( FrameworkPtr pFw,
} }
// todo: rand bias problem, will do for now tho // todo: rand bias problem, will do for now tho
auto index = std::rand() % selectedContent.size(); auto index = static_cast< uint32_t >( std::rand() ) % selectedContent.size();
auto contentId = selectedContent.at( index ); auto contentId = selectedContent.at( index );
player.sendDebug( "Duty register request for contentid#{0}", contentId ); player.sendDebug( "Duty register request for contentid#{0}", contentId );

View file

@ -21,6 +21,7 @@
#include "Network/PacketWrappers/ChatPacket.h" #include "Network/PacketWrappers/ChatPacket.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket.h" #include "Network/PacketWrappers/ActorControlPacket.h"
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
#include "Manager/DebugCommandMgr.h" #include "Manager/DebugCommandMgr.h"
#include "Manager/EventMgr.h" #include "Manager/EventMgr.h"
@ -127,7 +128,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
} }
case ClientTriggerType::SpawnCompanionReq: case ClientTriggerType::SpawnCompanionReq:
{ {
player.spawnCompanion( param1 ); player.spawnCompanion( static_cast< uint16_t >( param1 ) );
break; break;
} }
case ClientTriggerType::RemoveStatusEffect: // Remove status (clicking it off) case ClientTriggerType::RemoveStatusEffect: // Remove status (clicking it off)
@ -236,14 +237,14 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
case ClientTriggerType::PoseChange: // change pose case ClientTriggerType::PoseChange: // change pose
case ClientTriggerType::PoseReapply: // reapply pose case ClientTriggerType::PoseReapply: // reapply pose
{ {
player.setPose( param12 ); player.setPose( static_cast< uint8_t >( param12 ) );
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 ); auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
player.sendToInRangeSet( pSetStatusPacket, true ); player.sendToInRangeSet( pSetStatusPacket, true );
break; break;
} }
case ClientTriggerType::PoseCancel: // cancel pose case ClientTriggerType::PoseCancel: // cancel pose
{ {
player.setPose( param12 ); player.setPose( static_cast< uint8_t >( param12 ) );
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 ); auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
player.sendToInRangeSet( pSetStatusPacket, true ); player.sendToInRangeSet( pSetStatusPacket, true );
break; break;
@ -273,7 +274,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
case ClientTriggerType::Teleport: // Teleport case ClientTriggerType::Teleport: // Teleport
{ {
player.teleportQuery( param11 ); player.teleportQuery( static_cast< uint16_t >( param11 ) );
break; break;
} }
case ClientTriggerType::DyeItem: // Dye item case ClientTriggerType::DyeItem: // Dye item
@ -317,7 +318,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
if (!hZone) if (!hZone)
return; return;
player.setActiveLand( param11, hZone->getWardNum() ); player.setActiveLand( static_cast< uint8_t >( param11 ), hZone->getWardNum() );
auto pShowBuildPresetUIPacket = makeActorControl( player.getId(), ShowBuildPresetUI, param11 ); auto pShowBuildPresetUIPacket = makeActorControl( player.getId(), ShowBuildPresetUI, param11 );
player.queuePacket( pShowBuildPresetUIPacket ); player.queuePacket( pShowBuildPresetUIPacket );
@ -348,7 +349,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
if( !pHousingMgr ) if( !pHousingMgr )
break; break;
pHousingMgr->sendWardLandInfo( player, param12, param11 ); pHousingMgr->sendWardLandInfo( player, static_cast< uint8_t >( param12 ), static_cast< uint8_t >( param11 ) );
break; break;
} }
@ -462,7 +463,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
auto sendToStoreroom = ( param4 >> 16 ) != 0; auto sendToStoreroom = ( param4 >> 16 ) != 0;
//player, plot, containerId, slot, sendToStoreroom //player, plot, containerId, slot, sendToStoreroom
housingMgr->reqRemoveHousingItem( player, param12, param2, slot, sendToStoreroom ); housingMgr->reqRemoveHousingItem( player, static_cast< uint16_t >( param12 ), static_cast< uint16_t >( param2 ), static_cast< uint8_t >( slot ), sendToStoreroom );
break; break;
} }
@ -470,7 +471,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
{ {
auto housingMgr = m_pFw->get< HousingMgr >(); auto housingMgr = m_pFw->get< HousingMgr >();
housingMgr->reqEstateExteriorRemodel( player, param11 ); housingMgr->reqEstateExteriorRemodel( player, static_cast< uint16_t >( param11 ) );
break; break;
} }
@ -493,6 +494,14 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
canTeleport, unk1, privateEstateAccess, unk ); canTeleport, unk1, privateEstateAccess, unk );
break; break;
} }
case ClientTriggerType::RequestEventBattle:
{
auto packet = makeActorControlSelf( player.getId(), ActorControl::EventBattleDialog, 0, param12, param2 );
player.queuePacket( packet );
player.sendDebug( "event battle level sync: {0}, ilevel sync?: {1}", param12, param2 );
break;
}
default: default:
{ {

View file

@ -130,13 +130,13 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
{ {
case GmCommand::Lv: case GmCommand::Lv:
{ {
targetPlayer->setLevel( param1 ); targetPlayer->setLevel( static_cast< uint8_t >( param1 ) );
player.sendNotice( "Level for {0} was set to {1}", targetPlayer->getName(), param1 ); player.sendNotice( "Level for {0} was set to {1}", targetPlayer->getName(), param1 );
break; break;
} }
case GmCommand::Race: case GmCommand::Race:
{ {
targetPlayer->setLookAt( CharaLook::Race, param1 ); targetPlayer->setLookAt( CharaLook::Race, static_cast< uint8_t >( param1 ) );
player.sendNotice( "Race for {0} was set to {1}", targetPlayer->getName(), param1 ); player.sendNotice( "Race for {0} was set to {1}", targetPlayer->getName(), param1 );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
@ -152,7 +152,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
case GmCommand::Tribe: case GmCommand::Tribe:
{ {
targetPlayer->setLookAt( CharaLook::Tribe, param1 ); targetPlayer->setLookAt( CharaLook::Tribe, static_cast< uint8_t >( param1 ) );
player.sendNotice( "Tribe for {0} was set to ", targetPlayer->getName(), param1 ); player.sendNotice( "Tribe for {0} was set to ", targetPlayer->getName(), param1 );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
@ -168,7 +168,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
case GmCommand::Sex: case GmCommand::Sex:
{ {
targetPlayer->setLookAt( CharaLook::Gender, param1 ); targetPlayer->setLookAt( CharaLook::Gender, static_cast< uint8_t >( param1 ) );
player.sendNotice( "Sex for {0} was set to ", targetPlayer->getName(), param1 ); player.sendNotice( "Sex for {0} was set to ", targetPlayer->getName(), param1 );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetActor->getInRangeActors(); auto inRange = targetActor->getInRangeActors();
@ -325,7 +325,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
else else
{ {
targetActor->getAsPlayer()->learnSong( param2, 0 ); targetActor->getAsPlayer()->learnSong( static_cast< uint8_t >( param2 ), 0 );
player.sendNotice( "Song {0} for {1} was turned on.", param2, targetPlayer->getName() ); player.sendNotice( "Song {0} for {1} was turned on.", param2, targetPlayer->getName() );
} }
} }
@ -374,27 +374,27 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
case GmCommand::QuestAccept: case GmCommand::QuestAccept:
{ {
targetPlayer->updateQuest( param1, 1 ); targetPlayer->updateQuest( static_cast< uint16_t >( param1 ), 1 );
break; break;
} }
case GmCommand::QuestCancel: case GmCommand::QuestCancel:
{ {
targetPlayer->removeQuest( param1 ); targetPlayer->removeQuest( static_cast< uint16_t >( param1 ) );
break; break;
} }
case GmCommand::QuestComplete: case GmCommand::QuestComplete:
{ {
targetPlayer->finishQuest( param1 ); targetPlayer->finishQuest( static_cast< uint16_t >( param1 ) );
break; break;
} }
case GmCommand::QuestIncomplete: case GmCommand::QuestIncomplete:
{ {
targetPlayer->unfinishQuest( param1 ); targetPlayer->unfinishQuest( static_cast< uint16_t >( param1 ) );
break; break;
} }
case GmCommand::QuestSequence: case GmCommand::QuestSequence:
{ {
targetPlayer->updateQuest( param1, param2 ); targetPlayer->updateQuest( static_cast< uint16_t >( param1 ), static_cast< uint8_t >( param2 ) );
break; break;
} }
case GmCommand::GC: case GmCommand::GC:
@ -405,7 +405,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
return; return;
} }
targetPlayer->setGc( param1 ); targetPlayer->setGc( static_cast< uint8_t >( param1 ) );
// if we're changing them to a GC, check if they have a rank and if not, set it to the lowest rank // if we're changing them to a GC, check if they have a rank and if not, set it to the lowest rank
if( param1 > 0 ) if( param1 > 0 )
@ -413,7 +413,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
auto gcRankIdx = static_cast< uint8_t >( param1 ) - 1; auto gcRankIdx = static_cast< uint8_t >( param1 ) - 1;
if( targetPlayer->getGcRankArray()[ gcRankIdx ] == 0 ) if( targetPlayer->getGcRankArray()[ gcRankIdx ] == 0 )
{ {
player.setGcRankAt( gcRankIdx, 1 ); player.setGcRankAt( static_cast< uint8_t >( gcRankIdx ), 1 );
} }
} }
@ -430,7 +430,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
return; return;
} }
targetPlayer->setGcRankAt( gcId, param1 ); targetPlayer->setGcRankAt( static_cast< uint8_t >( gcId ), static_cast< uint8_t >( param1 ) );
player.sendNotice( "GC Rank for {0} for GC {1} was set to {2}", targetPlayer->getName(), targetPlayer->getGc(), player.sendNotice( "GC Rank for {0} for GC {1} was set to {2}", targetPlayer->getName(), targetPlayer->getGc(),
targetPlayer->getGcRankArray()[ targetPlayer->getGc() - 1 ] ); targetPlayer->getGcRankArray()[ targetPlayer->getGc() - 1 ] );
break; break;
@ -448,7 +448,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
else else
{ {
targetActor->getAsPlayer()->registerAetheryte( param2 ); targetActor->getAsPlayer()->registerAetheryte( static_cast< uint8_t >( param2 ) );
player.sendNotice( "Aetheryte {0} for {1} was turned on.", param2, targetPlayer->getName() ); player.sendNotice( "Aetheryte {0} for {1} was turned on.", param2, targetPlayer->getName() );
} }
} }
@ -521,7 +521,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
if( data->isAetheryte ) if( data->isAetheryte )
{ {
doTeleport = true; doTeleport = true;
teleport = i; teleport = static_cast< uint16_t >( i );
break; break;
} }
} }
@ -533,7 +533,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
else else
{ {
targetPlayer->setPos( targetPlayer->getPos() ); targetPlayer->setPos( targetPlayer->getPos() );
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 ); targetPlayer->performZoning( static_cast< uint16_t >( param1 ), targetPlayer->getPos(), 0 );
} }
player.sendNotice( "{0} was warped to zone {1}", targetPlayer->getName(), param1, pZone->getName() ); player.sendNotice( "{0} was warped to zone {1}", targetPlayer->getName(), param1, pZone->getName() );

View file

@ -436,12 +436,12 @@ void Sapphire::Network::GameConnection::socialListHandler( FrameworkPtr pFw,
uint8_t type = inPacket.data[ 0x1A ]; uint8_t type = inPacket.data[ 0x1A ];
uint8_t count = inPacket.data[ 0x1B ]; uint8_t count = inPacket.data[ 0x1B ];
if( type == 0x02 ) if( type == 1 )
{ // party list { // party list
auto listPacket = makeZonePacket< FFXIVIpcSocialList >( player.getId() ); auto listPacket = makeZonePacket< FFXIVIpcSocialList >( player.getId() );
listPacket->data().type = 2; listPacket->data().type = 1;
listPacket->data().sequence = count; listPacket->data().sequence = count;
int32_t entrysizes = sizeof( listPacket->data().entries ); int32_t entrysizes = sizeof( listPacket->data().entries );
@ -462,19 +462,21 @@ void Sapphire::Network::GameConnection::socialListHandler( FrameworkPtr pFw,
memcpy( listPacket->data().entries[ 0 ].name, player.getName().c_str(), strlen( player.getName().c_str() ) ); memcpy( listPacket->data().entries[ 0 ].name, player.getName().c_str(), strlen( player.getName().c_str() ) );
// TODO: actually store and read language from somewhere // GC icon
listPacket->data().entries[ 0 ].bytes1[ 0 ] = 0x01;//flags (lang) listPacket->data().entries[ 0 ].bytes1[ 0 ] = 2;
// TODO: these flags need to be figured out // client language J = 0, E = 1, D = 2, F = 3
//listPacket.data().entries[0].bytes1[1] = 0x00;//flags listPacket->data().entries[ 0 ].bytes1[ 1 ] = 1;
// user language settings flag J = 1, E = 2, D = 4, F = 8
listPacket->data().entries[ 0 ].bytes1[ 2 ] = 1 + 2;
listPacket->data().entries[ 0 ].onlineStatusMask = player.getOnlineStatusMask(); listPacket->data().entries[ 0 ].onlineStatusMask = player.getOnlineStatusMask();
queueOutPacket( listPacket ); queueOutPacket( listPacket );
} }
else if( type == 0x0b ) else if( type == 2 )
{ // friend list { // friend list
auto listPacket = makeZonePacket< FFXIVIpcSocialList >( player.getId() ); auto listPacket = makeZonePacket< FFXIVIpcSocialList >( player.getId() );
listPacket->data().type = 0x0B; listPacket->data().type = 2;
listPacket->data().sequence = count; listPacket->data().sequence = count;
memset( listPacket->data().entries, 0, sizeof( listPacket->data().entries ) ); memset( listPacket->data().entries, 0, sizeof( listPacket->data().entries ) );

View file

@ -25,8 +25,8 @@ Sapphire::Cell::~Cell()
void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone ) void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone )
{ {
m_pZone = pZone; m_pZone = pZone;
m_posX = x; m_posX = static_cast< uint16_t >( x );
m_posY = y; m_posY = static_cast< uint16_t >( y );
m_actors.clear(); m_actors.clear();
} }

View file

@ -34,7 +34,7 @@ void Sapphire::House::updateHouseDb()
auto stmt = pDB->getPreparedStatement( Db::HOUSING_HOUSE_UP ); auto stmt = pDB->getPreparedStatement( Db::HOUSING_HOUSE_UP );
stmt->setUInt( 6, m_houseId ); stmt->setUInt( 6, m_houseId );
stmt->setInt64( 1, m_buildTime ); stmt->setInt64( 1, static_cast< int64_t >( m_buildTime ) );
stmt->setBool( 2, m_hasAetheryte ); stmt->setBool( 2, m_hasAetheryte );
stmt->setString( 3, m_estateComment ); stmt->setString( 3, m_estateComment );
@ -117,4 +117,4 @@ bool Sapphire::House::getHasAetheryte() const
void Sapphire::House::setHasAetheryte( bool hasAetheryte ) void Sapphire::House::setHasAetheryte( bool hasAetheryte )
{ {
m_hasAetheryte = hasAetheryte; m_hasAetheryte = hasAetheryte;
} }

View file

@ -63,8 +63,8 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
indoorInitPacket->data().u3 = 0; indoorInitPacket->data().u3 = 0;
indoorInitPacket->data().u4 = 0; indoorInitPacket->data().u4 = 0;
auto landSetId = pHousingMgr->toLandSetId( m_landIdent.territoryTypeId, m_landIdent.wardNum ); auto landSetId = pHousingMgr->toLandSetId( static_cast< uint16_t >( m_landIdent.territoryTypeId ), static_cast< uint8_t >( m_landIdent.wardNum ) );
auto pLand = pHousingMgr->getHousingZoneByLandSetId( landSetId )->getLand( m_landIdent.landId ); auto pLand = pHousingMgr->getHousingZoneByLandSetId( landSetId )->getLand( static_cast< uint8_t >( m_landIdent.landId ) );
auto pHouse = pLand->getHouse(); auto pHouse = pLand->getHouse();
for( auto i = 0; i < 10; i++ ) for( auto i = 0; i < 10; i++ )
@ -154,7 +154,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousin
auto obj = housingMgr->getYardObjectForItem( housingItem ); auto obj = housingMgr->getYardObjectForItem( housingItem );
m_housingObjects[ offset ] = obj; m_housingObjects[static_cast< size_t >( offset ) ] = obj;
} }
containerIdx++; containerIdx++;
@ -171,14 +171,14 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnHousing
auto offset = ( containerIdx * 50 ) + slot; auto offset = ( containerIdx * 50 ) + slot;
auto obj = housingMgr->getYardObjectForItem( item ); auto obj = housingMgr->getYardObjectForItem( item );
m_housingObjects[ offset ] = obj; m_housingObjects[ static_cast< size_t >( offset ) ] = obj;
for( const auto& player : m_playerMap ) for( const auto& player : m_playerMap )
{ {
auto objectSpawnPkt = makeZonePacket< Server::FFXIVIpcHousingInternalObjectSpawn >( player.second->getId() ); auto objectSpawnPkt = makeZonePacket< Server::FFXIVIpcHousingInternalObjectSpawn >( player.second->getId() );
objectSpawnPkt->data().containerId = containerType; objectSpawnPkt->data().containerId = containerType;
objectSpawnPkt->data().containerOffset = slot; objectSpawnPkt->data().containerOffset = static_cast< uint8_t >( slot );
objectSpawnPkt->data().object.itemId = item->getAdditionalData() & 0xFFFF; objectSpawnPkt->data().object.itemId = item->getAdditionalData() & 0xFFFF;
objectSpawnPkt->data().object.rotation = item->getRot(); objectSpawnPkt->data().object.rotation = item->getRot();
@ -207,7 +207,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousin
auto moveObjPkt = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() ); auto moveObjPkt = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() );
moveObjPkt->data().itemRotation = obj.rotation; moveObjPkt->data().itemRotation = static_cast< uint16_t >( obj.rotation );
moveObjPkt->data().pos = obj.pos; moveObjPkt->data().pos = obj.pos;
// todo: how does this work when an item is in a slot >50 or u8 max? my guess is landid is the container index, but not sure... // todo: how does this work when an item is in a slot >50 or u8 max? my guess is landid is the container index, but not sure...