mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-30 05:07:46 +00:00
Merge branch 'origin/patch_catchup' into social_implementation
This commit is contained in:
commit
634ad59bd5
72 changed files with 10578 additions and 1103 deletions
|
@ -51,5 +51,6 @@ add_subdirectory( "src/tools/exd_common_gen" )
|
|||
add_subdirectory( "src/tools/exd_struct_gen" )
|
||||
add_subdirectory( "src/tools/exd_struct_test" )
|
||||
add_subdirectory( "src/tools/quest_parser" )
|
||||
add_subdirectory( "src/tools/discovery_parser" )
|
||||
#add_subdirectory("src/tools/pcb_reader")
|
||||
#add_subdirectory("src/tools/event_object_parser")
|
||||
|
|
|
@ -47,6 +47,4 @@ ALTER TABLE `charainfo` CHANGE `Mounts` `Mounts` BINARY(15) NULL DEFAULT NULL;
|
|||
ALTER TABLE `charainfo` CHANGE `Orchestrion` `Orchestrion` BINARY(40) NULL DEFAULT NULL;
|
||||
ALTER TABLE `charainfo` CHANGE `Minions` `Minions` BINARY(37) NULL DEFAULT NULL;
|
||||
ALTER TABLE `charainfo` CHANGE `QuestCompleteFlags` `QuestCompleteFlags` VARBINARY(396) NULL DEFAULT NULL;
|
||||
|
||||
ALTER TABLE `charainfofriendlist` CHANGE `CharacterIdList` `CharacterIdList` VARBINARY(1600) NULL DEFAULT NULL;
|
||||
ALTER TABLE `charainfofriendlist` CHANGE `InviteDataList` `InviteDataList` VARBINARY(1600) NULL DEFAULT NULL;
|
||||
ALTER TABLE `charainfo` ADD COLUMN `EquipDisplayFlags` INT(3) NULL DEFAULT '0' AFTER `GMRank`;
|
4422
sql/update_discovery.sql
Normal file
4422
sql/update_discovery.sql
Normal file
File diff suppressed because it is too large
Load diff
|
@ -562,9 +562,11 @@ namespace Core {
|
|||
SetFavorite = 0x1FC,
|
||||
LearnTeleport = 0x1FD,
|
||||
|
||||
ArmoryErrorMsg = 0x201,
|
||||
|
||||
AchievementPopup = 0x203,
|
||||
SetStatusIcon = 0x1F8,
|
||||
LimitBreakGauge = 0x1F9, // Max level, amount, build type (chop sound), lb type(0=pve lb 1=pvp lb)
|
||||
SetHomepoint = 0x1FB,
|
||||
SetFavorite = 0x1FC,
|
||||
LearnTeleport = 0x1FD,
|
||||
|
||||
Unk7 = 0x205, // LogMessage?
|
||||
AchievementMsg = 0x206,
|
||||
|
@ -588,126 +590,38 @@ namespace Core {
|
|||
Dismount = 0x3a0
|
||||
};
|
||||
|
||||
enum struct ChatType : uint16_t
|
||||
{
|
||||
LogKindError,
|
||||
ServerDebug,
|
||||
ServerUrgent,
|
||||
ServerNotice,
|
||||
Unused4,
|
||||
Unused5,
|
||||
Unused6,
|
||||
Unused7,
|
||||
Unused8,
|
||||
Unused9,
|
||||
Say,
|
||||
Shout,
|
||||
Tell,
|
||||
TellReceive,
|
||||
Party,
|
||||
Alliance,
|
||||
LS1,
|
||||
LS2,
|
||||
LS3,
|
||||
LS4,
|
||||
LS5,
|
||||
LS6,
|
||||
LS7,
|
||||
LS8,
|
||||
FreeCompany,
|
||||
Unused25,
|
||||
Unused26,
|
||||
NoviceNetwork,
|
||||
CustomEmote,
|
||||
StandardEmote,
|
||||
Yell,
|
||||
Unknown31,
|
||||
PartyUnk2,
|
||||
Unused33,
|
||||
Unused34,
|
||||
Unused35,
|
||||
Unused36,
|
||||
Unused37,
|
||||
Unused38,
|
||||
Unused39,
|
||||
Unused40,
|
||||
BattleDamage,
|
||||
BattleFailed,
|
||||
BattleActions,
|
||||
BattleItems,
|
||||
BattleHealing,
|
||||
BattleBeneficial,
|
||||
BattleDetrimental,
|
||||
BattleUnk48,
|
||||
BattleUnk49,
|
||||
Unused50,
|
||||
Unused51,
|
||||
Unused52,
|
||||
Unused53,
|
||||
Unused54,
|
||||
Unused55,
|
||||
Echo,
|
||||
SystemMessage,
|
||||
SystemErrorMessage,
|
||||
BattleSystem,
|
||||
GatheringSystem,
|
||||
NPCMessage,
|
||||
LootMessage,
|
||||
Unused63,
|
||||
CharProgress,
|
||||
Loot,
|
||||
Crafting,
|
||||
Gathering,
|
||||
NPCAnnouncement,
|
||||
FCAnnouncement,
|
||||
FCLogin,
|
||||
RetainerSale,
|
||||
PartySearch,
|
||||
PCSign,
|
||||
DiceRoll,
|
||||
NoviceNetworkNotice,
|
||||
Unknown76,
|
||||
Unused77,
|
||||
Unused78,
|
||||
Unused79,
|
||||
GMTell,
|
||||
GMSay,
|
||||
GMShout,
|
||||
GMYell,
|
||||
GMParty,
|
||||
GMFreeCompany,
|
||||
GMLS1,
|
||||
GMLS2,
|
||||
GMLS3,
|
||||
GMLS4,
|
||||
GMLS5,
|
||||
GMLS6,
|
||||
GMLS7,
|
||||
GMLS8,
|
||||
GMNoviceNetwork,
|
||||
Unused95,
|
||||
Unused96,
|
||||
Unused97,
|
||||
Unused98,
|
||||
Unused99,
|
||||
Unused100
|
||||
};
|
||||
SetFestival = 0x386, // param1: festival.exd index
|
||||
|
||||
enum EquipDisplayFlags : uint8_t
|
||||
{
|
||||
HideNothing = 0x0,
|
||||
HideHead = 0x1,
|
||||
HideWeapon = 0x2,
|
||||
LegacyMark = 0x4,
|
||||
ToggleOrchestrionUnlock = 0x396,
|
||||
Dismount = 0x3A0,
|
||||
|
||||
// Duty Recorder
|
||||
BeginReplayAck = 0x3A1,
|
||||
EndReplayAck = 0x3A2,
|
||||
|
||||
// PvP Duel
|
||||
SetPvPState = 0x5E0, // param3 must be 6 to engage a duel (hardcoded in the client)
|
||||
EndDuelSession = 0x5E1, // because someone went oob?
|
||||
StartDuelCountdown = 0x5E2, // begins a countdown; also does some duel bgm thing.
|
||||
StartDuel = 0x5E3, // actually all it does is set the challenger actor id;
|
||||
DuelResultScreen = 0x5E4, // win/lose thing, also reset a target id just like what EndDuelSession does.
|
||||
|
||||
// Duty Action
|
||||
SetDutyActionId = 0x5E8, // ContentExAction
|
||||
SetDutyActionHud = 0x5E9, // disable/enable
|
||||
SetDutyActionActive = 0x5EA,
|
||||
SetDutyActionRemaining = 0x5EB,
|
||||
};
|
||||
|
||||
Visor = 0x40,
|
||||
};
|
||||
|
||||
enum SkillType : uint8_t
|
||||
{
|
||||
Normal = 0x1,
|
||||
MountSkill = 0xD,
|
||||
};
|
||||
enum EquipDisplayFlags : uint8_t
|
||||
{
|
||||
HideNothing = 0x0,
|
||||
HideHead = 0x1,
|
||||
HideWeapon = 0x2,
|
||||
HideLegacyMark = 0x4,
|
||||
|
||||
enum SocialCategory : uint8_t
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ void Core::Db::CharaDbConnection::doPrepareStatements()
|
|||
"FavoritePoint, RestPoint, StartTown, ActiveTitle, TitleList, Achievement, "
|
||||
"Aetheryte, HowTo, Minions, Mounts, Orchestrion, EquippedMannequin, ConfigFlags, "
|
||||
"QuestCompleteFlags, OpeningSequence, QuestTracking, GrandCompany, "
|
||||
"GrandCompanyRank, Discovery, GMRank, Unlocks, CFPenaltyUntil "
|
||||
"GrandCompanyRank, Discovery, GMRank, EquipDisplayFlags, Unlocks, CFPenaltyUntil "
|
||||
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ void Core::Db::CharaDbConnection::doPrepareStatements()
|
|||
"Class = ?, Status = ?, TotalPlayTime = ?, HomePoint = ?, FavoritePoint = ?, RestPoint = ?, "
|
||||
"ActiveTitle = ?, TitleList = ?, Achievement = ?, Aetheryte = ?, HowTo = ?, Minions = ?, Mounts = ?, Orchestrion = ?, "
|
||||
"EquippedMannequin = ?, ConfigFlags = ?, QuestCompleteFlags = ?, OpeningSequence = ?, "
|
||||
"QuestTracking = ?, GrandCompany = ?, GrandCompanyRank = ?, Discovery = ?, GMRank = ?, Unlocks = ?, "
|
||||
"QuestTracking = ?, GrandCompany = ?, GrandCompanyRank = ?, Discovery = ?, GMRank = ?, EquipDisplayFlags = ?, Unlocks = ?, "
|
||||
"CFPenaltyUntil = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
|
||||
|
@ -101,6 +101,7 @@ void Core::Db::CharaDbConnection::doPrepareStatements()
|
|||
prepareStatement( CHARA_UP_GRANDCOMPANYRANKS, "UPDATE charainfo SET GrandCompanyRank = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_UP_DISCOVERY, "UPDATE charainfo SET Discovery = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_UP_GMRANK, "UPDATE charainfo SET GMRank = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_UP_EQUIPDISPLAYFLAGS, "UPDATE charainfo SET EquipDisplayFlags = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_UP_UNLOCKS, "UPDATE charainfo SET Unlocks = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_UP_CFPENATLY, "UPDATE charainfo SET CFPenaltyUntil = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ enum CharaDbStatements : uint32_t
|
|||
CHARA_UP_GRANDCOMPANYRANKS,
|
||||
CHARA_UP_DISCOVERY,
|
||||
CHARA_UP_GMRANK,
|
||||
CHARA_UP_EQUIPDISPLAYFLAGS,
|
||||
CHARA_UP_UNLOCKS,
|
||||
CHARA_UP_CFPENATLY,
|
||||
CHARA_SEARCHINFO_INS,
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -49,7 +49,7 @@ namespace Packets {
|
|||
Ping = 0x0065,
|
||||
Init = 0x0066,
|
||||
|
||||
ActorSpawn = 0x0190, // DEPRECATED
|
||||
//ActorSpawn = 0x0190, // DEPRECATED
|
||||
ActorFreeSpawn = 0x0191,
|
||||
InitZone = 0x019A,
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace Packets {
|
|||
///////////////////////////////////////////////////
|
||||
|
||||
ChatBanned = 0x006B,
|
||||
Logout = 0x0077,
|
||||
Logout = 0x0077, // updated 4.3
|
||||
CFNotify = 0x0078,
|
||||
CFMemberStatus = 0x0079,
|
||||
CFDutyInfo = 0x007A,
|
||||
|
@ -71,21 +71,17 @@ namespace Packets {
|
|||
Playtime = 0x00DF, // updated 4.2
|
||||
CFRegistered = 0x00B8, // updated 4.1
|
||||
CancelAllianceForming = 0x00C6, // updated 4.2
|
||||
Chat = 0x00E1, // updated 4.2
|
||||
Chat = 0x00F7, // updated 4.3
|
||||
SocialList = 0x00FD, // updated 4.3
|
||||
|
||||
SocialRequestError = 0x00E4, // updated 4.2
|
||||
SocialRequestResponse = 0x00E5, // updated 4.2
|
||||
SocialRequestReceive = 0x00E6, // updated 4.2
|
||||
SocialList = 0x00E7, // updated 4.2
|
||||
UpdateSearchInfo = 0x0100, // updated 4.3
|
||||
InitSearchInfo = 0x0101, // updated 4.3
|
||||
|
||||
UpdateSearchInfo = 0x00EA, // updated 4.2
|
||||
InitSearchInfo = 0x00EB, // updated 4.2
|
||||
ServerNotice = 0x0106, // updated 4.3
|
||||
SetOnlineStatus = 0x0107, // updated 4.3
|
||||
|
||||
ServerNotice = 0x00F0, // updated 4.2
|
||||
SetOnlineStatus = 0x00F1, // updated 4.2
|
||||
|
||||
CountdownInitiate = 0x00FB, // updated 4.2
|
||||
CountdownCancel = 0x00FC, // updated 4.2
|
||||
CountdownInitiate = 0x0111, // updated 4.3
|
||||
CountdownCancel = 0x0112, // updated 4.3
|
||||
|
||||
BlackList = 0x00FF, // updated 4.2
|
||||
|
||||
|
@ -93,84 +89,85 @@ namespace Packets {
|
|||
|
||||
LinkshellList = 0x0106, // updated 4.2
|
||||
SetCharacterFCInfo = 0x0114, // updated 4.2
|
||||
StatusEffectList = 0x0125, // updated 4.2
|
||||
Effect = 0x0128, // updated 4.2
|
||||
PersistantEffect = 0x013B, // updated 4.2
|
||||
|
||||
StatusEffectList = 0x014E, // updated 4.3
|
||||
Effect = 0x0151, // updated 4.3
|
||||
PersistantEffect = 0x0158, // updated 4.3
|
||||
|
||||
GCAffiliation = 0xCCFC, // OUTDATED
|
||||
|
||||
PlayerSpawn = 0x015C, // updated 4.2
|
||||
NpcSpawn = 0x015D, // updated 4.2
|
||||
ActorMove = 0x015E, // updated 4.2
|
||||
ActorSetPos = 0x0160, // updated 4.2
|
||||
PlayerSpawn = 0x0172, // updated 4.3
|
||||
NpcSpawn = 0x0173, // updated 4.3
|
||||
ActorMove = 0x0174, // updated 4.3
|
||||
ActorSetPos = 0x0176, // updated 4.3
|
||||
|
||||
ActorCast = 0x0162, // updated 4.2
|
||||
ActorCast = 0x0178, // updated 4.3
|
||||
|
||||
HateList = 0x0165, // updated 4.2
|
||||
HateList = 0x017B, // updated 4.3
|
||||
|
||||
ObjectSpawn = 0x0167, // updated 4.2
|
||||
ObjectDespawn = 0x0168, // updated 4.2
|
||||
UpdateClassInfo = 0x0169, // updated 4.2
|
||||
ObjectSpawn = 0x017D, // updated 4.3
|
||||
ObjectDespawn = 0x017E, // updated 4.3
|
||||
UpdateClassInfo = 0x018A, // updated 4.3
|
||||
|
||||
InitUI = 0x016B, // updated 4.2
|
||||
PlayerStats = 0x016C, // updated 4.2
|
||||
ActorOwner = 0x016D, // updated 4.2 ?
|
||||
PlayerStateFlags = 0x016E, // updated 4.2
|
||||
PlayerClassInfo = 0x016F, // updated 4.2
|
||||
ModelEquip = 0x0170, // updated 4.2
|
||||
InitUI = 0x0181, // updated 4.3
|
||||
PlayerStats = 0x0182, // updated 4.3
|
||||
ActorOwner = 0x0183, // updated 4.3 ?
|
||||
PlayerStateFlags = 0x0184, // updated 4.3
|
||||
PlayerClassInfo = 0x0185, // updated 4.3
|
||||
ModelEquip = 0x0186, // updated 4.3
|
||||
|
||||
ItemInfo = 0x017A, // updated 4.2
|
||||
ContainerInfo = 0x017B, // updated 4.2
|
||||
InventoryTransactionFinish = 0x017C, // updated 4.2
|
||||
InventoryTransaction = 0x017D, // updated 4.2
|
||||
CurrencyCrystalInfo = 0x017E, // updated 4.2
|
||||
ItemInfo = 0x0190, // updated 4.3
|
||||
ContainerInfo = 0x0192, // updated 4.3
|
||||
InventoryTransactionFinish = 0x0193, // updated 4.3
|
||||
InventoryTransaction = 0x0194, // updated 4.3
|
||||
CurrencyCrystalInfo = 0x0197, // updated 4.3
|
||||
|
||||
InventoryActionAck = 0x0180, // updated 4.2 ?
|
||||
UpdateInventorySlot = 0x0181, // updated 4.2
|
||||
UpdateInventorySlot = 0x0198, // updated 4.3
|
||||
|
||||
EventPlay = 0x018E, // updated 4.2
|
||||
DirectorPlayScene = 0x0192, // updated 4.2
|
||||
EventPlay = 0x01A6, // updated 4.3
|
||||
DirectorPlayScene = 0x01AA, // updated 4.3
|
||||
|
||||
EventStart = 0x0198, // updated 4.2
|
||||
EventFinish = 0x0199, // updated 4.2
|
||||
EventStart = 0x01AF, // updated 4.3
|
||||
EventFinish = 0x01B0, // updated 4.3
|
||||
|
||||
EventLinkshell = 0x1169,
|
||||
|
||||
QuestMessage = 0x01B8, // updated 4.2
|
||||
QuestTracker = 0x01BD, // updated 4.2
|
||||
QuestMessage = 0x01CE, // updated 4.3
|
||||
QuestTracker = 0x01D3, // updated 4.3
|
||||
|
||||
QuestFinish = 0x01B0, // updated 4.2
|
||||
MSQTrackerComplete = 0x01B1, // updated 4.2
|
||||
MSQTrackerProgress = 0x01B2, // updated 4.2
|
||||
QuestFinish = 0x01C6, // updated 4.3
|
||||
MSQTrackerComplete = 0x01C7, // updated 4.3
|
||||
MSQTrackerProgress = 0x01C8, // updated 4.3
|
||||
|
||||
QuestActiveList = 0x01AD, // updated 4.2
|
||||
QuestActiveList = 0x01C3, // updated 4.3
|
||||
QuestUpdate = 0x01C4, // updated 4.3
|
||||
QuestCompleteList = 0x01C5, // updated 4.3
|
||||
|
||||
QuestUpdate = 0x01AE, // updated 4.2
|
||||
QuestCompleteList = 0x01AF, // updated 4.2
|
||||
Mount = 0x01E3, // updated 4.3
|
||||
|
||||
Mount = 0x01CD, // updated 4.2
|
||||
DirectorVars = 0x01E5, // updated 4.3
|
||||
|
||||
DirectorVars = 0x01CF, // updated 4.2
|
||||
WeatherChange = 0x0200, // updated 4.3
|
||||
PlayerTitleList = 0x0201, // updated 4.3
|
||||
Discovery = 0x0202, // updated 4.3
|
||||
|
||||
WeatherChange = 0x01EA, // updated 4.2
|
||||
PlayerTitleList = 0x01EB, // updated 4.2
|
||||
Discovery = 0x01EC, // updated 4.2
|
||||
EorzeaTimeOffset = 0x0204, // updated 4.3
|
||||
|
||||
EorzeaTimeOffset = 0x01EE, // updated 4.2
|
||||
|
||||
EquipDisplayFlags = 0x01FA, // updated 4.2
|
||||
EquipDisplayFlags = 0x0210, // updated 4.3
|
||||
|
||||
CFAvailableContents = 0x01FD, // updated 4.2
|
||||
|
||||
PrepareZoning = 0x027C, // updated 4.2
|
||||
ActorGauge = 0x027D, // updated 4.2
|
||||
PrepareZoning = 0x0291, // updated 4.3
|
||||
ActorGauge = 0x0292, // updated 4.3
|
||||
|
||||
PerformNote = 0x0286, // updated 4.2
|
||||
DuelChallenge = 0x0277, // 4.2; this is the responsible for opening an ui
|
||||
PerformNote = 0x0286, // updated 4.3
|
||||
|
||||
// Unknown IPC types that still need to be sent
|
||||
// TODO: figure all these out properly
|
||||
IPCTYPE_UNK_320 = 0x0235, // updated 4.2
|
||||
IPCTYPE_UNK_322 = 0x0237, // updated 4.2
|
||||
IPCTYPE_UNK_320 = 0x024C, // updated 4.3
|
||||
IPCTYPE_UNK_322 = 0x024E, // updated 4.3
|
||||
|
||||
};
|
||||
|
||||
|
@ -182,10 +179,10 @@ namespace Packets {
|
|||
enum ClientZoneIpcType : uint16_t
|
||||
{
|
||||
|
||||
PingHandler = 0x0065, // unchanged 4.2
|
||||
InitHandler = 0x0066, // unchanged 4.2
|
||||
PingHandler = 0x0065, // unchanged 4.3
|
||||
InitHandler = 0x0066, // unchanged 4.3
|
||||
|
||||
FinishLoadingHandler = 0x0069, // unchanged 4.2
|
||||
FinishLoadingHandler = 0x0069, // unchanged 4.3
|
||||
|
||||
CFCommenceHandler = 0x006F,
|
||||
|
||||
|
@ -193,24 +190,24 @@ namespace Packets {
|
|||
|
||||
CFRegisterDuty = 0x0071,
|
||||
CFRegisterRoulette = 0x0072,
|
||||
PlayTimeHandler = 0x0073, // unchanged 4.2
|
||||
LogoutHandler = 0x0074, // unchanged 4.2
|
||||
PlayTimeHandler = 0x0073, // unchanged 4.3
|
||||
LogoutHandler = 0x0074, // unchanged 4.3
|
||||
|
||||
CFDutyInfoHandler = 0x0078, // updated 4.2
|
||||
|
||||
SocialReqSendHandler = 0x00CA, // updated 4.2
|
||||
SocialReqProcessHandler = 0x00CC, // updated 4.2
|
||||
|
||||
ChatHandler = 0x00C7, // updated 4.2
|
||||
ChatHandler = 0x00D3, // updated 4.3
|
||||
|
||||
SocialListHandler = 0x00CF, // updated 4.2
|
||||
ReqSearchInfoHandler = 0x00D4, // updated 4.2
|
||||
SetSearchInfoHandler = 0x00D2, // updated 4.2
|
||||
SocialListHandler = 0x00DB, // updated 4.3
|
||||
ReqSearchInfoHandler = 0x00E0, // updated 4.3
|
||||
SetSearchInfoHandler = 0x00DE, // updated 4.3
|
||||
|
||||
BlackListHandler = 0x00E0, // updated 4.2
|
||||
BlackListHandler = 0x00EC, // updated 4.3
|
||||
PlayerSearchHandler = 0x00E2, // updated 4.2
|
||||
|
||||
LinkshellListHandler = 0x00E8, // updated 4.2
|
||||
LinkshellListHandler = 0x00F4, // updated 4.3
|
||||
|
||||
FcInfoReqHandler = 0x011A, // updated 4.2
|
||||
|
||||
|
@ -219,34 +216,34 @@ namespace Packets {
|
|||
ReqCountdownInitiate = 0x012C, // updated 4.2
|
||||
ReqCountdownCancel = 0x012D, // updated 4.2
|
||||
|
||||
ZoneLineHandler = 0x0130, // updated 4.2
|
||||
ActionHandler = 0x0131, // updated 4.2
|
||||
DiscoveryHandler = 0x0132, // updated 4.2
|
||||
ZoneLineHandler = 0x013C, // updated 4.3
|
||||
ActionHandler = 0x013D, // updated 4.3
|
||||
DiscoveryHandler = 0x013E, // updated 4.3
|
||||
|
||||
SkillHandler = 0x0134, // updated 4.2
|
||||
GMCommand1 = 0x0135, // updated 4.2
|
||||
GMCommand2 = 0x0136, // updated 4.2
|
||||
UpdatePositionHandler = 0x0138, // updated 4.2
|
||||
UpdatePositionInstance = 0x0177, // updated 4.2
|
||||
SkillHandler = 0x0140, // updated 4.3
|
||||
GMCommand1 = 0x0141, // updated 4.3
|
||||
GMCommand2 = 0x0142, // updated 4.3
|
||||
|
||||
InventoryModifyHandler = 0x013F, // updated 4.2
|
||||
UpdatePositionHandler = 0x0144, // updated 4.3
|
||||
UpdatePositionInstance = 0x0183, // updated 4.3
|
||||
|
||||
TalkEventHandler = 0x0148, // updated 4.2
|
||||
EmoteEventHandler = 0x0149, // updated 4.2
|
||||
WithinRangeEventHandler = 0x014A, // updated 4.2
|
||||
OutOfRangeEventHandler = 0x014B, // updated 4.2
|
||||
EnterTeriEventHandler = 0x014C, // updated 4.2
|
||||
InventoryModifyHandler = 0x014B, // updated 4.3
|
||||
|
||||
ReturnEventHandler = 0x0151, // updated 4.2
|
||||
TradeReturnEventHandler = 0x0152, // updated 4.2
|
||||
TalkEventHandler = 0x0154, // updated 4.3
|
||||
EmoteEventHandler = 0x0155, // updated 4.3
|
||||
WithinRangeEventHandler = 0x0156, // updated 4.3
|
||||
OutOfRangeEventHandler = 0x0157, // updated 4.3
|
||||
EnterTeriEventHandler = 0x0158, // updated 4.3
|
||||
|
||||
ReturnEventHandler = 0x015D, // updated 4.3
|
||||
TradeReturnEventHandler = 0x015E, // updated 4.3
|
||||
|
||||
LinkshellEventHandler = 0x0144, // updated 4.1 ??
|
||||
LinkshellEventHandler1 = 0x0145, // updated 4.1 ??
|
||||
LinkshellEventHandler = 0x0150, // updated 4.1 ??
|
||||
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
|
||||
|
||||
PerformNoteHandler = 0x0160,
|
||||
PerformNoteHandler = 0x029B, // updated 4.3
|
||||
|
||||
ReqEquipDisplayFlagsChange = 0x016C, // updated 4.2
|
||||
ReqEquipDisplayFlagsChange = 0x0178, // updated 4.3
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -87,8 +87,10 @@ struct FFXIVIpcCharList : FFXIVIpcBasePacket<LobbyCharList>
|
|||
uint32_t index;
|
||||
uint32_t padding2;
|
||||
uint16_t serverId;
|
||||
uint16_t serverId1;
|
||||
char nameChara[32];
|
||||
char nameServer[32];
|
||||
char nameServer1[32];
|
||||
char charDetailJson[1030];
|
||||
} charaDetails[2];
|
||||
|
||||
|
|
|
@ -663,35 +663,13 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint32_t unknownC;
|
||||
uint32_t charId;
|
||||
uint32_t restedExp;
|
||||
uint16_t currentLevel;
|
||||
uint8_t maxLevel;
|
||||
uint8_t expansion;
|
||||
uint8_t unknown1A;
|
||||
uint8_t race;
|
||||
uint8_t tribe;
|
||||
uint8_t gender;
|
||||
uint8_t currentJob;
|
||||
uint8_t currentClass;
|
||||
uint8_t deity;
|
||||
uint8_t namedayMonth;
|
||||
uint8_t namedayDay;
|
||||
uint8_t cityState;
|
||||
uint8_t homepoint;
|
||||
uint8_t unknown26; // 2 if "warrior of light"
|
||||
uint8_t petHotBar;
|
||||
uint8_t companionRank;
|
||||
uint8_t companionStars;
|
||||
uint8_t companionSp;
|
||||
uint8_t companionUnk2B;
|
||||
uint8_t companionColor;
|
||||
uint8_t companionFavoFeed;
|
||||
uint8_t companionUnk2E;
|
||||
float companionTimePassed;
|
||||
|
||||
uint32_t companionCurrentExp;
|
||||
uint32_t unknown38;
|
||||
|
||||
uint32_t unknown3C;
|
||||
uint32_t fishCaught;
|
||||
uint32_t useBaitCatalogId;
|
||||
|
||||
uint32_t pvpWolfFoldMatches;
|
||||
uint16_t pvpWolfFoldWeeklyMatches;
|
||||
uint16_t pvpWolfFoldWeeklyVictories;
|
||||
|
@ -707,21 +685,61 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint8_t unknown6A;
|
||||
uint8_t unknown6B;
|
||||
uint8_t unknown6C[4];
|
||||
uint8_t unknown70[61];
|
||||
uint8_t preNamePadding;
|
||||
char name[32];
|
||||
uint8_t unknownOword[16];
|
||||
uint8_t unknownDE[2];
|
||||
uint8_t unknown70[34];
|
||||
|
||||
uint16_t unknown18;
|
||||
uint8_t maxLevel;
|
||||
uint8_t expansion;
|
||||
uint8_t unknown;
|
||||
uint8_t race;
|
||||
uint8_t tribe;
|
||||
uint8_t gender;
|
||||
uint8_t currentJob;
|
||||
uint8_t currentClass;
|
||||
uint8_t deity;
|
||||
uint8_t namedayMonth;
|
||||
uint8_t namedayDay;
|
||||
uint8_t cityState;
|
||||
uint8_t homepoint;
|
||||
uint8_t unknown26;
|
||||
uint8_t petHotBar;
|
||||
uint8_t companionRank;
|
||||
uint8_t companionStars;
|
||||
uint8_t companionSp;
|
||||
uint8_t companionUnk2B;
|
||||
uint8_t companionColor;
|
||||
uint8_t companionFavoFeed;
|
||||
uint8_t companionUnk2E;
|
||||
uint8_t companionTimePassed[4];
|
||||
uint16_t unknown38[11];
|
||||
|
||||
uint32_t exp[25];
|
||||
uint8_t unknown564[16];
|
||||
uint32_t pvpFrontlineOverall1st;
|
||||
uint32_t pvpFrontlineOverall2nd;
|
||||
uint32_t pvpFrontlineOverall3rd;
|
||||
uint8_t relicBookCompletion1[4];
|
||||
uint16_t levels[25];
|
||||
uint16_t levelsPadding;
|
||||
uint32_t exp[25];
|
||||
uint8_t unknown__[16];
|
||||
uint16_t fishingRecordsFish[26];
|
||||
uint16_t fishingRecordsFishWeight[26];
|
||||
uint8_t unknownMask554[44];
|
||||
|
||||
uint8_t companion_name[21];
|
||||
uint8_t companionDefRank;
|
||||
uint8_t companionAttRank;
|
||||
uint8_t companionHealRank;
|
||||
uint8_t mountGuideMask[16];
|
||||
char name[32];
|
||||
uint8_t unknownOword[16];
|
||||
uint8_t unlockBitmask[64];
|
||||
uint8_t aetheryte[16];
|
||||
uint8_t aetheryte[17];
|
||||
uint8_t discovery[421];
|
||||
uint8_t howto[33];
|
||||
uint8_t minions[37];
|
||||
uint8_t minions[38];
|
||||
uint8_t chocoboTaxiMask[8];
|
||||
uint8_t contentClearMask[108];
|
||||
uint8_t contentClearMask[111];
|
||||
uint8_t contentClearPadding;
|
||||
uint16_t unknown428[8];
|
||||
uint8_t companionBardingMask[8];
|
||||
|
@ -730,18 +748,13 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint8_t companionEquippedFeet;
|
||||
uint8_t companionUnk4[4];
|
||||
uint8_t companion_fields[11];
|
||||
uint8_t companion_name[21];
|
||||
uint8_t companionDefRank;
|
||||
uint8_t companionAttRank;
|
||||
uint8_t companionHealRank;
|
||||
uint8_t mountGuideMask[15];
|
||||
|
||||
uint8_t fishingGuideMask[89];
|
||||
uint8_t fishingSpotVisited[25];
|
||||
uint16_t fishingRecordsFish[26];
|
||||
uint16_t fishingRecordsFishWeight[26];
|
||||
uint8_t unknownMask554[15];
|
||||
|
||||
|
||||
uint8_t unknownMask4Padding;
|
||||
uint8_t unknown564[19];
|
||||
|
||||
uint8_t rankAmalJaa;
|
||||
uint8_t rankSylph;
|
||||
uint8_t rankKobold;
|
||||
|
@ -769,18 +782,16 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint8_t unknownMask5C1[28];
|
||||
uint8_t unknown_03411;
|
||||
uint32_t unknownDword5E0;
|
||||
uint8_t relicBookCompletion[12];
|
||||
uint8_t sightseeingMask[26];
|
||||
uint16_t unknown_XXX;
|
||||
uint32_t pvpFrontlineOverall1st;
|
||||
uint32_t pvpFrontlineOverall2nd;
|
||||
uint32_t pvpFrontlineOverall3rd;
|
||||
uint16_t pvpFrontlineWeekly1st;
|
||||
uint16_t pvpFrontlineWeekly2nd;
|
||||
uint16_t pvpFrontlineWeekly3rd;
|
||||
uint8_t relicBookCompletion2[8];
|
||||
uint8_t sightseeingMask[26];
|
||||
uint16_t unknown_XXX;
|
||||
|
||||
uint8_t unknown61E;
|
||||
uint8_t centurioSealHunts[32];
|
||||
uint8_t alliedSealHunts[22];
|
||||
uint8_t unknown61F[32];
|
||||
uint8_t unknown63F[22];
|
||||
uint8_t tripleTriadCards[28];
|
||||
uint8_t unknown671[11];
|
||||
uint8_t unknownMask67C[22];
|
||||
|
@ -788,7 +799,7 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint8_t orchestrionMask[40];
|
||||
uint8_t hallOfNoviceCompleteMask[3];
|
||||
uint8_t unknownMask6C0[11];
|
||||
uint8_t animaRelicMask[16]; // [2] = anima glass key item, [1] = ulan's note key item
|
||||
uint8_t unknownMask6CB[16];
|
||||
uint8_t unknown6DB[14];
|
||||
uint8_t unlockedRaids[28];
|
||||
uint8_t unlockedDungeons[18];
|
||||
|
@ -796,8 +807,9 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
|||
uint8_t unlockedTrials[7];
|
||||
uint8_t unlockedPvp[5];
|
||||
uint8_t unknownMask72D[28];
|
||||
uint8_t unknownMask749[18];
|
||||
uint8_t unknown749[23];
|
||||
// uint8_t unknownMask749[18];
|
||||
//uint8_t unknown749[13];
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1412,6 +1424,18 @@ struct FFXIVIpcObjectDespawn : FFXIVIpcBasePacket<ObjectDespawn>
|
|||
uint8_t padding[7];
|
||||
};
|
||||
|
||||
struct FFXIVIpcDuelChallenge : FFXIVIpcBasePacket<DuelChallenge>
|
||||
{
|
||||
uint8_t otherClassJobId;
|
||||
uint8_t otherLevel; // class job level
|
||||
uint8_t challengeByYou; // 0 if the other challenges you, 1 if you challenges the other.
|
||||
uint8_t otherItemLevel;
|
||||
|
||||
uint32_t otherActorId;
|
||||
|
||||
char otherName[32];
|
||||
};
|
||||
|
||||
|
||||
} /* Server */
|
||||
} /* Packets */
|
||||
|
|
|
@ -14,7 +14,7 @@ set(RUNTIME_OUTPUT_DIRECTORY "${SCRIPT_LIB_DIR}")
|
|||
file(GLOB children "${CMAKE_CURRENT_SOURCE_DIR}/*" )
|
||||
foreach(_scriptDir ${children})
|
||||
get_filename_component(_name "${_scriptDir}" NAME_WE)
|
||||
if(IS_DIRECTORY ${_scriptDir} AND NOT ${_name} MATCHES "CMakeFiles")
|
||||
if(IS_DIRECTORY ${_scriptDir} AND NOT ${_name} MATCHES "CMakeFiles" AND NOT ${_name} MATCHES "\\.dir$")
|
||||
message("discovered plugin lib: ${_scriptDir} (${_name})")
|
||||
|
||||
file(GLOB_RECURSE SCRIPT_BUILD_FILES "${_scriptDir}/*.cpp")
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
|
||||
#include <Event/EventDefs.h>
|
||||
|
||||
|
||||
#endif //SAPPHIRE_SCRIPTOBJECT_H
|
||||
|
|
|
@ -21,11 +21,11 @@ public:
|
|||
{
|
||||
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
|
||||
{
|
||||
player.eventPlay( eventId, 2, 0, []( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( eventId, 2, 0, []( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param1 == 256 )
|
||||
if( result.param1 == 256 )
|
||||
{
|
||||
player.teleport( param2, 2 );
|
||||
player.teleport( result.param2, 2 );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
player.eventActionStart( eventId, ACTION_ATTUNE, []( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||
{
|
||||
player.registerAetheryte( eventId & 0xFFFF );
|
||||
player.eventPlay( eventId, 3, 0, 0, 0 );
|
||||
player.playScene( eventId, 3, 0, 0, 0 );
|
||||
},
|
||||
[] ( Entity::Player& ply, uint32_t evntId, uint64_t additional )
|
||||
{
|
||||
|
|
|
@ -23,20 +23,19 @@ public:
|
|||
{
|
||||
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
|
||||
{
|
||||
player.eventPlay( eventId, 0, 1, []( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( eventId, 0, 1, []( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param1 == 256 ) // set homepoint
|
||||
if( result.param1 == 256 ) // set homepoint
|
||||
{
|
||||
player.setHomepoint( eventId & 0xFFFF );
|
||||
player.sendQuestMessage( eventId, 2, 0xEA, 0, 0 );
|
||||
}
|
||||
else if( param1 == 512 ) // aethernet access
|
||||
player.setHomepoint( result.eventId & 0xFFFF );
|
||||
player.sendQuestMessage( result.eventId, 2, 0xEA, 0, 0 );
|
||||
} else if( result.param1 == 512 ) // aethernet access
|
||||
{
|
||||
if( param2 == 4 )
|
||||
if( result.param2 == 4 )
|
||||
{
|
||||
player.teleport( param3, 2 );
|
||||
player.teleport( result.param3, 2 );
|
||||
}
|
||||
else if( param2 == 2 ) // register favored destination
|
||||
else if( result.param2 == 2 ) // register favored destination
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -10,25 +10,25 @@ public:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 != 0 )
|
||||
if( result.param2 != 0 )
|
||||
{
|
||||
Scene00001( player, param2 );
|
||||
Scene00001( player, result.param2 );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, 0x2000, 0, 1, callback );
|
||||
player.playScene( getId(), 0, 0x2000, 0, 1, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player, uint16_t returnScene )
|
||||
{
|
||||
auto callback = []( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// todo: this is fucked
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, 0xFB2EC8F8, 0, 1, returnScene, callback );
|
||||
player.playScene( getId(), 1, 0xFB2EC8F8, 0, 1, returnScene, callback );
|
||||
}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
|
|
|
@ -11,39 +11,39 @@ public:
|
|||
// menu
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 > 0 )
|
||||
Scene00001( player, param2 );
|
||||
if( result.param2 > 0 )
|
||||
Scene00001( player, result.param2 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, 0x2000, 0, 1, callback );
|
||||
player.playScene( getId(), 0, 0x2000, 0, 1, callback );
|
||||
}
|
||||
|
||||
// lay down
|
||||
void Scene00001( Entity::Player& player, uint16_t param )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
Scene00002( player, param2 );
|
||||
Scene00002( player, result.param2 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, 0xF32E48F8, 0, 1, param, callback );
|
||||
player.playScene( getId(), 1, 0xF32E48F8, 0, 1, param, callback );
|
||||
}
|
||||
|
||||
// logout
|
||||
void Scene00002( Entity::Player& player, uint16_t param )
|
||||
{
|
||||
player.eventPlay( getId(), 2, 0xF32E48F8, 0, 1, param, nullptr );
|
||||
player.playScene( getId(), 2, 0xF32E48F8, 0, 1, param, nullptr );
|
||||
}
|
||||
|
||||
// wake up
|
||||
void Scene00100( Entity::Player& player )
|
||||
{
|
||||
auto callback = []( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{};
|
||||
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
|
||||
{ };
|
||||
|
||||
player.eventPlay( getId(), 100, 0x800, 0, 0, callback );
|
||||
player.playScene( getId(), 100, 0x800, 0, 0, callback );
|
||||
}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
Scene00000( player );
|
||||
}
|
||||
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
Scene00100( player );
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ public:
|
|||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
switch( param2 )
|
||||
switch( result.param2 )
|
||||
{
|
||||
case ACTION_CREATE:
|
||||
Scene00002( player );
|
||||
|
@ -32,25 +32,25 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, 0, 0, 0, callback );
|
||||
player.playScene( getId(), 1, 0, 0, 0, callback );
|
||||
}
|
||||
|
||||
// create linkshell
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 2, 0, 0, 0 );
|
||||
player.playScene( getId(), 2, 0, 0, 0 );
|
||||
}
|
||||
|
||||
// rename linkshell
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 3, 0, 0, 0 );
|
||||
player.playScene( getId(), 3, 0, 0, 0 );
|
||||
}
|
||||
|
||||
// remove linkshell
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 4, 0, 0, 0 );
|
||||
player.playScene( getId(), 4, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
|
|
|
@ -10,7 +10,7 @@ public:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 0, 0x2000, 0, 1 );
|
||||
player.playScene( getId(), 0, 0x2000, 0, 1 );
|
||||
}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
|
|
|
@ -28,35 +28,35 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setOpeningSequence( 1 );
|
||||
Scene00001( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, NO_DEFAULT_CAMERA | INVIS_ENPC |
|
||||
player.playScene( getId(), 0, NO_DEFAULT_CAMERA | INVIS_ENPC |
|
||||
CONDITION_CUTSCENE | HIDE_UI |
|
||||
HIDE_HOTBAR | SILENT_ENTER_TERRI_ENV, 0, 1, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 1, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 1, 0x32 );
|
||||
player.playScene( getId(), 1, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 1, 0x32 );
|
||||
}
|
||||
|
||||
void Scene00020( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 20, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 1 );
|
||||
player.playScene( getId(), 20, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 1 );
|
||||
}
|
||||
|
||||
void Scene00030( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 30, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0 );
|
||||
player.playScene( getId(), 30, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00040( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( player.getOpeningSequence() == 2 )
|
||||
{
|
||||
|
@ -65,20 +65,19 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 40, 1, 2, 1, callback );
|
||||
player.playScene( getId(), 40, 1, 2, 1, callback );
|
||||
}
|
||||
|
||||
public:
|
||||
OpeningGridania() : EventScript( 1245186 )
|
||||
{}
|
||||
{ }
|
||||
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
if( player.getOpeningSequence() == 0 )
|
||||
{
|
||||
Scene00000( player );
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
Scene00040( player );
|
||||
}
|
||||
|
|
|
@ -43,35 +43,35 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setOpeningSequence( 1 );
|
||||
Scene00001( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, NO_DEFAULT_CAMERA | INVIS_ENPC |
|
||||
player.playScene( getId(), 0, NO_DEFAULT_CAMERA | INVIS_ENPC |
|
||||
CONDITION_CUTSCENE | HIDE_UI |
|
||||
HIDE_HOTBAR | SILENT_ENTER_TERRI_ENV, 0, 1, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 1, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 1, 0x32 );
|
||||
player.playScene( getId(), 1, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 1, 0x32 );
|
||||
}
|
||||
|
||||
void Scene00020( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 20, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 1 );
|
||||
player.playScene( getId(), 20, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 1 );
|
||||
}
|
||||
|
||||
void Scene00030( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 30, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0 );
|
||||
player.playScene( getId(), 30, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00040( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( player.getOpeningSequence() == 2 )
|
||||
{
|
||||
|
@ -80,14 +80,15 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 40, NO_DEFAULT_CAMERA, 2, 1, callback );
|
||||
player.playScene( getId(), 40, NO_DEFAULT_CAMERA, 2, 1, callback );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
OpeningLimsa() : EventScript( 1245185 ) {}
|
||||
OpeningLimsa() : EventScript( 1245185 )
|
||||
{ }
|
||||
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
if( player.getOpeningSequence() == 0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -29,49 +29,49 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setOpeningSequence( 1 );
|
||||
Scene00001( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, NO_DEFAULT_CAMERA | INVIS_ENPC |
|
||||
player.playScene( getId(), 0, NO_DEFAULT_CAMERA | INVIS_ENPC |
|
||||
CONDITION_CUTSCENE | HIDE_UI |
|
||||
HIDE_HOTBAR | SILENT_ENTER_TERRI_ENV, 0, 1, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 1, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 1, 0x32 );
|
||||
player.playScene( getId(), 1, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 1, 0x32 );
|
||||
}
|
||||
|
||||
void Scene00020( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 20, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 1 );
|
||||
player.playScene( getId(), 20, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 1 );
|
||||
}
|
||||
|
||||
void Scene00030( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 30, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 );
|
||||
player.playScene( getId(), 30, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00040( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( player.getOpeningSequence() == 2 )
|
||||
Scene00030( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 40, NO_DEFAULT_CAMERA, 2, 1, callback );
|
||||
player.playScene( getId(), 40, NO_DEFAULT_CAMERA, 2, 1, callback );
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
OpeningUldah() : EventScript( 1245187 ) {}
|
||||
OpeningUldah() : EventScript( 1245187 )
|
||||
{ }
|
||||
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
if( player.getOpeningSequence() == 0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <sapphire_zone/Event/EventHandler.h>
|
||||
#include "../ScriptObject.h"
|
||||
#include "Event/EventHelper.h"
|
||||
|
||||
|
@ -34,66 +35,57 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
{
|
||||
player.setOpeningSequence( 2 );
|
||||
Scene00001( player );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00002( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, 0, 0, callback );
|
||||
player.playSceneChain( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, bindScene( &ManFst001::Scene00002 ) );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_FINISH );
|
||||
|
||||
player.eventPlay( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 );
|
||||
player.playScene( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, 0, 0, 0, callback );
|
||||
player.playScene( getId(), 2, 0, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00005( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 4, FADE_OUT | HIDE_HOTBAR | CONDITION_CUTSCENE | HIDE_UI , 0, 0, callback );
|
||||
player.playSceneChain( getId(), 4, FADE_OUT | HIDE_HOTBAR | CONDITION_CUTSCENE | HIDE_UI, bindScene( &ManFst001::Scene00005 ) );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 5, INVIS_OTHER_PC, 0, 0, callback );
|
||||
player.playScene( getId(), 5, INVIS_OTHER_PC, 0, 0, callback );
|
||||
}
|
||||
|
||||
public:
|
||||
ManFst001() : EventScript( 65575 ) {}
|
||||
ManFst001() : EventScript( 65575 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <sapphire_zone/Event/EventHandler.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "../ScriptObject.h"
|
||||
|
||||
|
@ -15,6 +16,7 @@ private:
|
|||
|
||||
static constexpr auto SEQ_0 = 0;
|
||||
static constexpr auto SEQ_1 = 1;
|
||||
static constexpr auto SEQ_2 = 2;
|
||||
static constexpr auto SEQ_FINISH = 255;
|
||||
//this.SEQ_OFFER = ?;
|
||||
|
||||
|
@ -80,107 +82,97 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
Scene00050( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_0_ACTOR0, HIDE_HOTBAR, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setQuestUI8AL( getId(), 1 );
|
||||
checkQuestCompletion( player, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, 0x0EFB, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_1_ACTOR1, 0x0EFB, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setQuestUI8BH( getId(), 1 );
|
||||
checkQuestCompletion( player, 3 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, NONE, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_1_ACTOR2, NONE, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
Scene00100( player );
|
||||
else
|
||||
Scene00099( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 3, NONE, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_1_ACTOR3, NONE, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 4, NONE, 0, 0 );
|
||||
player.playScene( getId(), SEQ_1_ACTOR0, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // finish quest
|
||||
if( result.param2 == 1 ) // finish quest
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
if( player.giveQuestRewards( getId(), 0 ))
|
||||
player.finishQuest( getId());
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 5, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_2_ACTOR4, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00050( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// on quest accept
|
||||
player.updateQuest( getId(), 1 );
|
||||
player.updateQuest( getId(), SEQ_1 );
|
||||
player.setQuestUI8CH( getId(), 1 ); // receive key item
|
||||
|
||||
// teleport to real gridania
|
||||
player.forceZoneing( 132 );
|
||||
player.forceZoneing( TERRITORYTYPE0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_0_ACTOR0_LQ, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00051( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00001( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 51, NONE, 0, 0, callback );
|
||||
player.playSceneChain( getId(), SEQ_1_ACTOR1_WAIT, NONE, bindScene( &ManFst002::Scene00001 ));
|
||||
}
|
||||
|
||||
void Scene00099( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00004( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 99, NONE, 0, 0, callback );
|
||||
player.playSceneChain( getId(), SEQ_1_ACTOR3_NPCTRADENO, NONE, bindScene( &ManFst002::Scene00005 ));
|
||||
}
|
||||
|
||||
void Scene00100( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setQuestUI8CH( getId(), 0 ); // remove traded key item
|
||||
player.setQuestUI8BL( getId(), 1 );
|
||||
|
@ -188,11 +180,12 @@ private:
|
|||
checkQuestCompletion( player, 2 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 100, 0x0EFB, 0, 0, callback );
|
||||
player.playScene( getId(), SEQ_1_ACTOR3_NPCTRADEOK, 0x0EFB, 0, 0, callback );
|
||||
}
|
||||
|
||||
public:
|
||||
ManFst002() : EventScript( 65621 ) {}
|
||||
ManFst002() : EventScript( 65621 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
@ -214,8 +207,7 @@ public:
|
|||
|
||||
player.eventActionStart( 0x050002, 0x13, event, nullptr, 0x050002 );
|
||||
|
||||
}
|
||||
else if( actor == ACTOR2 )
|
||||
} else if( actor == ACTOR2 )
|
||||
Scene00002( player );
|
||||
else if( actor == ACTOR3 )
|
||||
Scene00003( player );
|
||||
|
|
|
@ -15,7 +15,8 @@ private:
|
|||
|
||||
|
||||
public:
|
||||
ManFst003() : EventScript( 65659 ) {}
|
||||
ManFst003() : EventScript( 65659 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -11,72 +11,76 @@
|
|||
|
||||
class ManFst004 : public EventScript
|
||||
{
|
||||
private:
|
||||
// Basic quest information
|
||||
// Quest vars / flags used
|
||||
// GetQuestBitFlag8
|
||||
// GetQuestUI8AL
|
||||
// GetQuestUI8BH
|
||||
// GetQuestUI8BL
|
||||
// GetQuestUI8CH
|
||||
private:
|
||||
// Basic quest information
|
||||
// Quest vars / flags used
|
||||
// GetQuestBitFlag8
|
||||
// GetQuestUI8AL
|
||||
// GetQuestUI8BH
|
||||
// GetQuestUI8BL
|
||||
// GetQuestUI8CH
|
||||
|
||||
// Steps in this quest ( 0 is before accepting,
|
||||
// 1 is first, 255 means ready for turning it in
|
||||
enum Sequence : uint8_t
|
||||
{
|
||||
Seq0 = 0,
|
||||
Seq1 = 1,
|
||||
SeqFinish = 255,
|
||||
};
|
||||
// Steps in this quest ( 0 is before accepting,
|
||||
// 1 is first, 255 means ready for turning it in
|
||||
enum Sequence : uint8_t
|
||||
{
|
||||
Seq0 = 0,
|
||||
Seq1 = 1,
|
||||
SeqFinish = 255,
|
||||
};
|
||||
|
||||
// Quest rewards
|
||||
static constexpr auto RewardExpFactor = 100;
|
||||
static constexpr auto RewardGil = 107;
|
||||
// Quest rewards
|
||||
static constexpr auto RewardExpFactor = 100;
|
||||
static constexpr auto RewardGil = 107;
|
||||
|
||||
// Entities found in the script data of the quest
|
||||
static constexpr auto Actor0 = 1001140;
|
||||
static constexpr auto Actor1 = 2;
|
||||
static constexpr auto Actor2 = 1000323;
|
||||
static constexpr auto Actor20 = 1000159;
|
||||
static constexpr auto Actor3 = 1000768;
|
||||
static constexpr auto Actor4 = 1000100;
|
||||
static constexpr auto BindActor0 = 6229224;
|
||||
static constexpr auto Item0 = 2000120;
|
||||
static constexpr auto LocActor0 = 1003159;
|
||||
static constexpr auto LocMarker01 = 2153091;
|
||||
static constexpr auto LocMarker02 = 2153104;
|
||||
static constexpr auto LocMarker03 = 2153111;
|
||||
static constexpr auto LocMarker04 = 2154539;
|
||||
static constexpr auto LocMarker05 = 2154540;
|
||||
static constexpr auto LocMarker06 = 2154541;
|
||||
static constexpr auto LocMarker07 = 2210446;
|
||||
static constexpr auto LocMarker08 = 2210454;
|
||||
static constexpr auto LocMarker09 = 2210461;
|
||||
static constexpr auto LocMotion0 = 799;
|
||||
static constexpr auto Poprange0 = 2280858;
|
||||
static constexpr auto RewardDesion = 1;
|
||||
static constexpr auto Seq0Actor0 = 0;
|
||||
static constexpr auto Seq0Actor0Lq = 50;
|
||||
static constexpr auto Seq1Actor0 = 4;
|
||||
static constexpr auto Seq1Actor1 = 1;
|
||||
static constexpr auto Seq1Actor1Wait = 51;
|
||||
static constexpr auto Seq1Actor2 = 2;
|
||||
static constexpr auto Seq1Actor3 = 3;
|
||||
static constexpr auto Seq1Actor3Npctradeno = 99;
|
||||
static constexpr auto Seq1Actor3Npctradeok = 100;
|
||||
static constexpr auto Seq2Actor4 = 5;
|
||||
static constexpr auto Territorytype0 = 132;
|
||||
static constexpr auto UnlockDesion = 14;
|
||||
// Entities found in the script data of the quest
|
||||
static constexpr auto Actor0 = 1001140;
|
||||
static constexpr auto Actor1 = 2;
|
||||
static constexpr auto Actor2 = 1000323;
|
||||
static constexpr auto Actor20 = 1000159;
|
||||
static constexpr auto Actor3 = 1000768;
|
||||
static constexpr auto Actor4 = 1000100;
|
||||
static constexpr auto BindActor0 = 6229224;
|
||||
static constexpr auto Item0 = 2000120;
|
||||
static constexpr auto LocActor0 = 1003159;
|
||||
static constexpr auto LocMarker01 = 2153091;
|
||||
static constexpr auto LocMarker02 = 2153104;
|
||||
static constexpr auto LocMarker03 = 2153111;
|
||||
static constexpr auto LocMarker04 = 2154539;
|
||||
static constexpr auto LocMarker05 = 2154540;
|
||||
static constexpr auto LocMarker06 = 2154541;
|
||||
static constexpr auto LocMarker07 = 2210446;
|
||||
static constexpr auto LocMarker08 = 2210454;
|
||||
static constexpr auto LocMarker09 = 2210461;
|
||||
static constexpr auto LocMotion0 = 799;
|
||||
static constexpr auto Poprange0 = 2280858;
|
||||
static constexpr auto RewardDesion = 1;
|
||||
static constexpr auto Seq0Actor0 = 0;
|
||||
static constexpr auto Seq0Actor0Lq = 50;
|
||||
static constexpr auto Seq1Actor0 = 4;
|
||||
static constexpr auto Seq1Actor1 = 1;
|
||||
static constexpr auto Seq1Actor1Wait = 51;
|
||||
static constexpr auto Seq1Actor2 = 2;
|
||||
static constexpr auto Seq1Actor3 = 3;
|
||||
static constexpr auto Seq1Actor3Npctradeno = 99;
|
||||
static constexpr auto Seq1Actor3Npctradeok = 100;
|
||||
static constexpr auto Seq2Actor4 = 5;
|
||||
static constexpr auto Territorytype0 = 132;
|
||||
static constexpr auto UnlockDesion = 14;
|
||||
|
||||
public:
|
||||
ManFst004() : EventScript( 65660 ){};
|
||||
~ManFst004(){};
|
||||
public:
|
||||
ManFst004() : EventScript( 65660 )
|
||||
{ };
|
||||
|
||||
~ManFst004()
|
||||
{ };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Event Handlers
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ManFst004::Actor0 )
|
||||
{
|
||||
Scene00000( player );
|
||||
|
@ -87,15 +91,16 @@ class ManFst004 : public EventScript
|
|||
// player.eventStart( actorId, 0x050002, 7, 0, 0);
|
||||
// starting the eventaction 0x13 ( attuning )
|
||||
player.eventActionStart( 0x050002, 0x13,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||
{
|
||||
player.sendQuestMessage( 0x050002, 0, 1, 0, 0 );
|
||||
player.registerAetheryte( 2 );
|
||||
player.learnAction( 1 );
|
||||
Scene00051( player );
|
||||
},
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional ) {},
|
||||
eventId );
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||
{
|
||||
player.sendQuestMessage( 0x050002, 0, 1, 0, 0 );
|
||||
player.registerAetheryte( 2 );
|
||||
player.learnAction( 1 );
|
||||
Scene00051( player );
|
||||
},
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||
{ },
|
||||
eventId );
|
||||
}
|
||||
else if( actor == ManFst004::Actor2 )
|
||||
{
|
||||
|
@ -111,19 +116,17 @@ class ManFst004 : public EventScript
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void checkQuestCompletion( Entity::Player& player, uint32_t varIdx )
|
||||
{
|
||||
if( varIdx == 3 )
|
||||
{
|
||||
player.sendQuestMessage( m_id, 1, 0, 0, 0 );
|
||||
}
|
||||
else if( varIdx == 2 )
|
||||
} else if( varIdx == 2 )
|
||||
{
|
||||
player.sendQuestMessage( m_id, 2, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
player.sendQuestMessage( m_id, 0, 0, 0, 0 );
|
||||
}
|
||||
|
@ -139,80 +142,80 @@ class ManFst004 : public EventScript
|
|||
player.updateQuest( questId, SeqFinish );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Available Scenes in this quest, not necessarly all are used
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 0, 0x2000,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 0, 0x2000,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
{
|
||||
Scene00050( player );
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 1, 0,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 1, 0,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setQuestUI8AL( m_id, 1 );
|
||||
checkQuestCompletion( player, 0 );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 2, 0,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 2, 0,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setQuestUI8BH( m_id, 1 );
|
||||
checkQuestCompletion( player, 3 );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 3, 0,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 3, 0,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
Scene00100( player );
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
Scene00099( player );
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 4, 0, 0, 0 );
|
||||
player.playScene( m_id, 4, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 5, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 5, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // finish quest
|
||||
if( result.param2 == 1 ) // finish quest
|
||||
{
|
||||
if( player.giveQuestRewards( m_id, 0 ) )
|
||||
{
|
||||
player.finishQuest( m_id );
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00050( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0/*unk*/, 0/*unk*/,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0/*unk*/, 0/*unk*/,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// accepting quest "close to home"
|
||||
player.updateQuest( m_id, 1 );
|
||||
|
@ -220,36 +223,36 @@ class ManFst004 : public EventScript
|
|||
// event is done, need to teleport to real zone.
|
||||
player.setZone( 132 );
|
||||
//player.setZone(183); back to starting griania for debug purpose
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00051( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 51, NONE,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 51, NONE,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
Scene00001( player );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00099( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 99, NONE,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 99, NONE,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
Scene00004( player );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00100( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( m_id, 100, NONE,
|
||||
[&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( m_id, 100, NONE,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.setQuestUI8CH( m_id, 0 ); // remove key item, since we have just traded it
|
||||
player.setQuestUI8BL( m_id, 1 );
|
||||
checkQuestCompletion( player, 2 );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
};
|
|
@ -1,13 +1,18 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "../ScriptObject.h"
|
||||
#include <ScriptObject.h>
|
||||
|
||||
// Quest Script: ManSea001_00107
|
||||
// Quest Name: Coming to Limsa Lominsa
|
||||
// Quest ID: 65643
|
||||
// Start NPC: 1001028
|
||||
// End NPC: 1002697
|
||||
|
||||
class ManSea001 : public EventScript
|
||||
{
|
||||
private:
|
||||
// Steps in this quest ( 0 is before accepting,
|
||||
// 1 is first, 255 means ready for turning it in
|
||||
|
||||
static constexpr auto SEQ_0 = 0;
|
||||
static constexpr auto SEQ_1 = 1;
|
||||
static constexpr auto SEQ_FINISH = 255;
|
||||
|
@ -27,126 +32,107 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( getId(), 0, 8192,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
player.setOpeningSequence( 2 );
|
||||
Scene00001( player );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00002( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, 0, 0, callback );
|
||||
player.playSceneChain( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, bindScene( &ManSea001::Scene00002 ) );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00003( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, NONE, 0, 0, callback );
|
||||
player.updateQuest( getId(), 1 );
|
||||
player.playSceneChain( getId(), 2, NONE, bindScene( &ManSea001::Scene00003 ) );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( getId(), 3, NONE,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.eventPlay( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 1, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 3, NONE, 0, 0, callback );
|
||||
player.playScene( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 1, 0 );
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 4, NONE, 0, 0 );
|
||||
player.playScene( getId(), 4, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00006( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 5, HIDE_HOTBAR, 0, 0, callback );
|
||||
player.playSceneChain( getId(), 5, HIDE_HOTBAR, bindScene( &ManSea001::Scene00006 ) );
|
||||
}
|
||||
|
||||
void Scene00006( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( getId(), 6, INVIS_OTHER_PC,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_FINISH );
|
||||
player.prepareZoning( player.getZoneId(), true, 1, 0 );
|
||||
player.changePosition( 9, 40, 14, 2 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 6, INVIS_OTHER_PC, 0, 0, callback );
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_FINISH );
|
||||
player.prepareZoning( player.getZoneId(), true, 1, 0 );
|
||||
player.changePosition( 9, 40, 14, 2 );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00007( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 7, NONE, 0, 0 );
|
||||
player.playScene( getId(), 7, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00008( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 8, NONE, 0, 0 );
|
||||
player.playScene( getId(), 8, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00009( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 9, NONE, 0, 0 );
|
||||
player.playScene( getId(), 9, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00010( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 10, NONE, 0, 0 );
|
||||
player.playScene( getId(), 10, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00011( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00012( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 11, 0x2c02, 0, 0, callback );
|
||||
player.playSceneChain( getId(), 11, 0x2c02, 0, 0, bindScene( &ManSea001::Scene00012 ) );
|
||||
}
|
||||
|
||||
void Scene00012( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
player.playScene( getId(), 12, INVIS_OTHER_PC,
|
||||
[&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // finish quest
|
||||
if( result.param2 == 1 ) // finish quest
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
if(player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 12, INVIS_OTHER_PC, 0, 0, callback );
|
||||
} );
|
||||
}
|
||||
|
||||
void Scene00013( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 13, NONE, 0, 0 );
|
||||
player.playScene( getId(), 13, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
public:
|
||||
ManSea001() : EventScript( 65643 ) {}
|
||||
ManSea001() : EventScript( 65643 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -35,98 +35,98 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
Scene00050( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, NONE, callback );
|
||||
player.playScene( getId(), 1, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, NONE, callback );
|
||||
player.playScene( getId(), 2, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 3, NONE, callback );
|
||||
player.playScene( getId(), 3, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 4, NONE, callback );
|
||||
player.playScene( getId(), 4, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 5, NONE, callback );
|
||||
player.playScene( getId(), 5, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00006( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 6, NONE, callback );
|
||||
player.playScene( getId(), 6, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00007( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 7, NONE, callback );
|
||||
player.playScene( getId(), 7, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00008( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 8, NONE, callback );
|
||||
player.playScene( getId(), 8, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00050( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// on quest accept
|
||||
player.updateQuest( getId(), 1 );
|
||||
|
@ -136,10 +136,12 @@ private:
|
|||
player.forceZoneing( 128 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
player.playScene( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
}
|
||||
|
||||
public:
|
||||
ManSea002() : EventScript( 65644 ) {}
|
||||
ManSea002() : EventScript( 65644 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -28,110 +28,106 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
player.setOpeningSequence( 2 );
|
||||
Scene00001( player );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
Scene00002( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, 0, 0, callback );
|
||||
player.playScene( getId(), 1, DISABLE_SKIP | HIDE_HOTBAR | SET_BASE, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.eventPlay( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 );
|
||||
player.playScene( OPENING_EVENT_HANDLER, 0x1E, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, NONE, 0, 0, callback );
|
||||
player.playScene( getId(), 2, NONE, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 3, NONE, 0, 0 );
|
||||
player.playScene( getId(), 3, NONE, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
{
|
||||
Scene00005( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 4, 0x2c02, 0, 0, callback );
|
||||
player.playSceneChain( getId(), 4, 0x2c02, bindScene( &ManWil001::Scene00005 ) );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
auto callback = [ this ]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
if( player.giveQuestRewards( getId(), 0 ))
|
||||
player.finishQuest( getId());
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 5, INVIS_OTHER_PC, 0, 0, callback );
|
||||
player.playScene( getId(), 5, INVIS_OTHER_PC, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00006( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 6, 0, 0, 0 );
|
||||
player.playScene( getId(), 6, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00007( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 7, 0, 0, 0 );
|
||||
player.playScene( getId(), 7, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00008( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 8, 0, 0, 0 );
|
||||
player.playScene( getId(), 8, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00009( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 9, 0, 0, 0 );
|
||||
player.playScene( getId(), 9, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00010( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 10, 0, 0, 0 );
|
||||
player.playScene( getId(), 10, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00011( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 11, 0, 0, 0 );
|
||||
player.playScene( getId(), 11, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00012( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 12, 0, 0, 0 );
|
||||
player.playScene( getId(), 12, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void Scene00013( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 13, 0, 0, 0 );
|
||||
player.playScene( getId(), 13, 0, 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
ManWil001() : EventScript( 66130 ) {}
|
||||
ManWil001() : EventScript( 66130 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -41,98 +41,98 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
Scene00050( player );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, NONE, callback );
|
||||
player.playScene( getId(), 1, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, NONE, callback );
|
||||
player.playScene( getId(), 2, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 3, NONE, callback );
|
||||
player.playScene( getId(), 3, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 4, NONE, callback );
|
||||
player.playScene( getId(), 4, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 5, NONE, callback );
|
||||
player.playScene( getId(), 5, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00006( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 6, NONE, callback );
|
||||
player.playScene( getId(), 6, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00007( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 7, NONE, callback );
|
||||
player.playScene( getId(), 7, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00008( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 8, NONE, callback );
|
||||
player.playScene( getId(), 8, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00050( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// on quest accept
|
||||
player.updateQuest( getId(), 1 );
|
||||
|
@ -142,12 +142,13 @@ private:
|
|||
player.forceZoneing( 130 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
player.playScene( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
ManWil002() : EventScript( 66104 ) { }
|
||||
ManWil002() : EventScript( 66104 )
|
||||
{ }
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -24,9 +24,9 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
{
|
||||
player.setQuestUI8AL( getId(), 1 );
|
||||
player.setQuestUI8BH( getId(), 1 );
|
||||
|
@ -34,40 +34,41 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, NONE, callback );
|
||||
player.playScene( getId(), 0, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 1, NONE );
|
||||
player.playScene( getId(), 1, NONE );
|
||||
}
|
||||
|
||||
void Scene00099( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 99, NONE );
|
||||
player.playScene( getId(), 99, NONE );
|
||||
}
|
||||
|
||||
void Scene00100( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
if( player.giveQuestRewards( getId(), 0 ))
|
||||
player.finishQuest( getId());
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 100, NONE, callback );
|
||||
player.playScene( getId(), 100, NONE, callback );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
SubFst001() : EventScript( 65560 ) {}
|
||||
SubFst001() : EventScript( 65560 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ));
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
@ -75,8 +76,7 @@ public:
|
|||
Scene00000( player );
|
||||
else
|
||||
Scene00001( player );
|
||||
}
|
||||
else if( actor == ACTOR1 )
|
||||
} else if( actor == ACTOR1 )
|
||||
{
|
||||
if( !player.hasQuest( getId() ) )
|
||||
Scene00099( player );
|
||||
|
|
|
@ -23,33 +23,34 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_1 );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId (), 0, NONE, callback );
|
||||
player.playScene( getId(), 0, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00001(Entity::Player& player)
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // finish quest
|
||||
if( result.param2 == 1 ) // finish quest
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, NONE, callback );
|
||||
player.playScene( getId(), 1, NONE, callback );
|
||||
}
|
||||
|
||||
public:
|
||||
SubFst002() : EventScript( 65561 ) {}
|
||||
SubFst002() : EventScript( 65561 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ public:
|
|||
if( npcId != ENEMY0 )
|
||||
return;
|
||||
|
||||
auto currentKC = player.getQuestUI8AL( getId() ) + 1;
|
||||
auto currentKC = player.getQuestUI8AL( getId()) + 1;
|
||||
|
||||
if( currentKC >= 6 )
|
||||
player.updateQuest( getId(), SEQ_FINISH );
|
||||
|
|
|
@ -21,31 +21,32 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // accept quest
|
||||
if( result.param2 == 1 ) // accept quest
|
||||
player.updateQuest( getId(), SEQ_FINISH );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, NONE, callback );
|
||||
player.playScene( getId(), 0, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // finish quest
|
||||
if( result.param2 == 1 ) // finish quest
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 1, NONE, callback );
|
||||
player.playScene( getId(), 1, NONE, callback );
|
||||
}
|
||||
|
||||
public:
|
||||
SubFst010() : EventScript( 65537 ) {}
|
||||
SubFst010() : EventScript( 65537 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
|
|
|
@ -41,123 +41,124 @@ private:
|
|||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 )
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_1 );
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 0, NONE, callback );
|
||||
player.playScene( getId(), 0, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00001( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 2, NONE );
|
||||
player.playScene( getId(), 2, NONE );
|
||||
}
|
||||
|
||||
void Scene00002( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_3 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 2, NONE, callback );
|
||||
player.playScene( getId(), 2, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00003( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 3, NONE );
|
||||
player.playScene( getId(), 3, NONE );
|
||||
}
|
||||
|
||||
void Scene00004( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_5 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 4, NONE, callback );
|
||||
player.playScene( getId(), 4, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00005( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 5, NONE );
|
||||
player.playScene( getId(), 5, NONE );
|
||||
}
|
||||
|
||||
void Scene00006( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( param2 == 1 ) // finish quest
|
||||
if( result.param2 == 1 ) // finish quest
|
||||
{
|
||||
if( player.giveQuestRewards( getId(), 0 ) )
|
||||
player.finishQuest( getId() );
|
||||
if( player.giveQuestRewards( getId(), 0 ))
|
||||
player.finishQuest( getId());
|
||||
}
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 6, NONE, callback );
|
||||
player.playScene( getId(), 6, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00095( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 95, NONE );
|
||||
player.playScene( getId(), 95, NONE );
|
||||
}
|
||||
|
||||
void Scene00096( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_FINISH );
|
||||
player.sendQuestMessage( getId(), 4, 2, 0, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 96, NONE, callback );
|
||||
player.playScene( getId(), 96, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00097( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 97, NONE );
|
||||
player.playScene( getId(), 97, NONE );
|
||||
}
|
||||
|
||||
void Scene00098( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_4 );
|
||||
player.sendQuestMessage( getId(), 2, 2, 0, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 98, NONE, callback );
|
||||
player.playScene( getId(), 98, NONE, callback );
|
||||
}
|
||||
|
||||
void Scene00099( Entity::Player& player )
|
||||
{
|
||||
player.eventPlay( getId(), 99, NONE );
|
||||
player.playScene( getId(), 99, NONE );
|
||||
}
|
||||
|
||||
void Scene00100( Entity::Player& player )
|
||||
{
|
||||
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||||
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
player.updateQuest( getId(), SEQ_2 );
|
||||
player.sendQuestMessage( getId(), 0, 2, 0, 0 );
|
||||
};
|
||||
|
||||
player.eventPlay( getId(), 100, NONE, callback );
|
||||
player.playScene( getId(), 100, NONE, callback );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
SubFst013() : EventScript( 65576 ) {}
|
||||
SubFst013() : EventScript( 65576 )
|
||||
{}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( !player.hasQuest( getId() ) )
|
||||
if( !player.hasQuest( getId()))
|
||||
{
|
||||
Scene00000( player );
|
||||
return;
|
||||
|
@ -175,7 +176,7 @@ public:
|
|||
|
||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ));
|
||||
|
||||
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
||||
Scene00100( player );
|
||||
|
|
|
@ -110,12 +110,20 @@ namespace Core {
|
|||
std::string PlayerMinimal::getInfoJson()
|
||||
{
|
||||
std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," +
|
||||
"[" + getClassString() + "]," +
|
||||
"\"0\",\"0\",\"0\",\"" + std::to_string( getBirthMonth() ) + "\",\"" + std::to_string( getBirthDay() ) + "\",\"" + std::to_string( getGuardianDeity() ) + "\",\"" + std::to_string( m_class ) + "\",\"0\",\"" + std::to_string( getZoneId() ) + "\"," +
|
||||
//"[" + getClassString() + "]," +
|
||||
"[\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"],"
|
||||
"\"0\",\"0\",\"0\",\"" +
|
||||
std::to_string( getBirthMonth() ) +
|
||||
"\",\"" + std::to_string( getBirthDay() ) +
|
||||
"\",\"" + std::to_string( getGuardianDeity() ) +
|
||||
"\",\"" + std::to_string( m_class ) +
|
||||
"\",\"0\",\"" + std::to_string( getZoneId() ) +
|
||||
"\",\"0\"," +
|
||||
|
||||
"[" + getLookString() + "]," +
|
||||
"\"0\",\"0\"," +
|
||||
"[" + getModelString() + "]," +
|
||||
"\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]," +
|
||||
"\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"\",\"0\",\"0\"]," +
|
||||
"\"classname\":\"ClientSelectData\",\"classid\":116}";
|
||||
return charDetails;
|
||||
}
|
||||
|
|
|
@ -150,6 +150,16 @@ namespace Core {
|
|||
m_gmRank = rank;
|
||||
}
|
||||
|
||||
bool getGmInvis() const
|
||||
{
|
||||
return m_gmInvis;
|
||||
}
|
||||
|
||||
bool setGmInvis( bool invis )
|
||||
{
|
||||
m_gmInvis = invis;
|
||||
}
|
||||
|
||||
void createInvDbContainer( uint16_t slot ) const;
|
||||
|
||||
void createFriendsListContainer( uint32_t characterId ) const;
|
||||
|
@ -179,6 +189,7 @@ namespace Core {
|
|||
uint8_t m_look[26];
|
||||
|
||||
uint8_t m_gmRank;
|
||||
bool m_gmInvis;
|
||||
|
||||
char m_name[34];
|
||||
|
||||
|
|
|
@ -475,8 +475,8 @@ void Core::Network::GameConnection::generateEncryptionKey( uint32_t key, const s
|
|||
m_baseKey[2] = 0x34;
|
||||
m_baseKey[3] = 0x12;
|
||||
memcpy( m_baseKey + 0x04, &key, 4 );
|
||||
m_baseKey[8] = 0xA0;
|
||||
m_baseKey[9] = 0x0F;
|
||||
m_baseKey[8] = 0xCC;
|
||||
m_baseKey[9] = 0x10;
|
||||
memcpy( ( char* )m_baseKey + 0x0C, keyPhrase.c_str(), keyPhrase.size() );
|
||||
Core::Util::md5( m_baseKey, m_encKey, 0x2C );
|
||||
}
|
||||
|
|
|
@ -136,6 +136,16 @@ void Core::Entity::Player::setGmRank( uint8_t rank )
|
|||
m_gmRank = rank;
|
||||
}
|
||||
|
||||
bool Core::Entity::Player::getGmInvis() const
|
||||
{
|
||||
return m_gmInvis;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setGmInvis( bool invis )
|
||||
{
|
||||
m_gmInvis = invis;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getMode() const
|
||||
{
|
||||
return m_mode;
|
||||
|
@ -163,43 +173,33 @@ bool Core::Entity::Player::isMarkedForRemoval() const
|
|||
|
||||
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
||||
{
|
||||
uint64_t newMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::NewAdventurer );
|
||||
uint64_t afkMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::AwayfromKeyboard );
|
||||
uint64_t busyMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Busy );
|
||||
uint64_t dcMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Disconnected );
|
||||
uint64_t meldMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LookingtoMeldMateria );
|
||||
uint64_t ptMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LookingforParty );
|
||||
uint64_t rpMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Roleplaying );
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
if( !pExdData )
|
||||
return OnlineStatus::Online;
|
||||
|
||||
OnlineStatus status = OnlineStatus::Online;
|
||||
uint32_t statusDisplayOrder = 0xFF14;
|
||||
uint32_t applicableStatus = static_cast< uint32_t >( OnlineStatus::Online );
|
||||
|
||||
//if( hasStateFlag( Common::PlayerStateFlag::NewAdventurer ) )
|
||||
if( m_onlineStatus & newMask )
|
||||
status = OnlineStatus::NewAdventurer;
|
||||
for( uint32_t i = 0; i < std::numeric_limits< decltype( m_onlineStatus ) >::digits; i++ )
|
||||
{
|
||||
bool bit = ( m_onlineStatus >> i ) & 1;
|
||||
|
||||
if( m_onlineStatus & afkMask )
|
||||
status = OnlineStatus::AwayfromKeyboard;
|
||||
if( !bit )
|
||||
continue;
|
||||
|
||||
if( m_onlineStatus & busyMask )
|
||||
status = OnlineStatus::Busy;
|
||||
auto pOnlineStatus = pExdData->get< Data::OnlineStatus >( i );
|
||||
if( !pOnlineStatus )
|
||||
continue;
|
||||
|
||||
if( m_onlineStatus & dcMask )
|
||||
status = OnlineStatus::Disconnected;
|
||||
if( pOnlineStatus->priority < statusDisplayOrder )
|
||||
{
|
||||
// todo: also check that the status can actually be set here, otherwise we need to ignore it (and ban the player obv)
|
||||
statusDisplayOrder = pOnlineStatus->priority;
|
||||
applicableStatus = i;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_onlineStatus & meldMask )
|
||||
status = OnlineStatus::LookingtoMeldMateria;
|
||||
|
||||
if( m_onlineStatus & ptMask )
|
||||
status = OnlineStatus::LookingforParty;
|
||||
|
||||
if( m_onlineStatus & rpMask )
|
||||
status = OnlineStatus::Roleplaying;
|
||||
|
||||
if( hasStateFlag( PlayerStateFlag::WatchingCutscene ) )
|
||||
status = OnlineStatus::ViewingCutscene;
|
||||
|
||||
// TODO: add all the logic for returning the proper online status, there probably is a better way for this alltogether
|
||||
return status;
|
||||
return static_cast< OnlineStatus >( applicableStatus );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setOnlineStatusMask( uint64_t status )
|
||||
|
@ -326,7 +326,7 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
|||
}
|
||||
|
||||
setStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
auto targetPos = pTeriMgr->getTerritoryPosition( data->levelId );
|
||||
auto targetPos = pTeriMgr->getTerritoryPosition( data->level.at( 0 ) );
|
||||
|
||||
Common::FFXIVARR_POSITION3 pos;
|
||||
pos.x = 0;
|
||||
|
@ -1610,16 +1610,34 @@ void Core::Entity::Player::sendTitleList()
|
|||
queuePacket( titleListPacket );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendZoneInPackets( uint32_t param1, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, bool shouldSetStatus = false )
|
||||
{
|
||||
auto zoneInPacket = ActorControlPacket143( getId(), ZoneIn, param1, param2, param3, param4 );
|
||||
auto SetStatusPacket = ActorControlPacket142( getId(), SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) );
|
||||
|
||||
if( !getGmInvis() )
|
||||
sendToInRangeSet( zoneInPacket, true );
|
||||
if( shouldSetStatus )
|
||||
sendToInRangeSet( SetStatusPacket );
|
||||
else
|
||||
queuePacket( zoneInPacket );
|
||||
if ( shouldSetStatus )
|
||||
queuePacket( SetStatusPacket );
|
||||
|
||||
setZoningType( Common::ZoneingType::None );
|
||||
unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::finishZoning()
|
||||
{
|
||||
switch( getZoningType() )
|
||||
{
|
||||
case ZoneingType::None:
|
||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01 ), true );
|
||||
sendZoneInPackets( 0x01 );
|
||||
break;
|
||||
|
||||
case ZoneingType::Teleport:
|
||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||
sendZoneInPackets( 0x01, 0, 0, 110 );
|
||||
break;
|
||||
|
||||
case ZoneingType::Return:
|
||||
|
@ -1630,22 +1648,16 @@ void Core::Entity::Player::finishZoning()
|
|||
resetHp();
|
||||
resetMp();
|
||||
setStatus( Entity::Chara::ActorStatus::Idle );
|
||||
|
||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
||||
sendToInRangeSet( ActorControlPacket142( getId(), SetStatus,
|
||||
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ), true );
|
||||
sendZoneInPackets( 0x01, 0x01, 0, 111, true );
|
||||
}
|
||||
else
|
||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
||||
sendZoneInPackets( 0x01, 0x00, 0, 111 );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ZoneingType::FadeIn:
|
||||
break;
|
||||
}
|
||||
|
||||
setZoningType( Common::ZoneingType::None );
|
||||
unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId )
|
||||
|
|
|
@ -56,22 +56,35 @@ public:
|
|||
/*! start/register a normal event */
|
||||
void eventStart( uint64_t actorId, uint32_t eventId, Event::EventHandler::EventType eventParam, uint8_t eventParam1, uint32_t eventParam2 );
|
||||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
|
||||
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
|
||||
|
||||
void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam5 = 0 );
|
||||
|
||||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
uint32_t eventParam2, uint32_t eventParam3, Event::EventHandler::SceneReturnCallback eventReturnCallback );
|
||||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4,
|
||||
Event::EventHandler::SceneReturnCallback eventReturnCallback );
|
||||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
Event::EventHandler::SceneReturnCallback eventReturnCallback );
|
||||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags );
|
||||
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags );
|
||||
/*! play a subevent */
|
||||
void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4,
|
||||
Event::EventHandler::SceneChainCallback sceneChainCallback );
|
||||
/*! play a subevent */
|
||||
void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
uint32_t eventParam2, uint32_t eventParam3,
|
||||
Event::EventHandler::SceneChainCallback sceneChainCallback );
|
||||
/*! play a subevent */
|
||||
void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
Event::EventHandler::SceneChainCallback sceneChainCallback );
|
||||
/*! setup the event and return a ptr to it */
|
||||
Event::EventHandlerPtr bootstrapSceneEvent( uint32_t eventId, uint32_t flags );
|
||||
/*! finish / unregister an event */
|
||||
void eventFinish( uint32_t eventId, uint32_t freePlayer );
|
||||
/*! add an event to the event array */
|
||||
|
@ -165,12 +178,12 @@ public:
|
|||
uint16_t getQuestUI16C( uint16_t questId );
|
||||
uint32_t getQuestUI32A( uint16_t questId );
|
||||
|
||||
uint8_t getQuestBitFlag8( uint16_t questId );
|
||||
uint8_t getQuestBitFlag16( uint16_t questId );
|
||||
uint8_t getQuestBitFlag24( uint16_t questId );
|
||||
uint8_t getQuestBitFlag32( uint16_t questId );
|
||||
uint8_t getQuestBitFlag40( uint16_t questId );
|
||||
uint8_t getQuestBitFlag48( uint16_t questId );
|
||||
bool getQuestBitFlag8( uint16_t questId, uint8_t index );
|
||||
bool getQuestBitFlag16( uint16_t questId, uint8_t index );
|
||||
bool getQuestBitFlag24( uint16_t questId, uint8_t index );
|
||||
bool getQuestBitFlag32( uint16_t questId, uint8_t index );
|
||||
bool getQuestBitFlag40( uint16_t questId, uint8_t index );
|
||||
bool getQuestBitFlag48( uint16_t questId, uint8_t index );
|
||||
|
||||
|
||||
void setQuestUI8A( uint16_t questId, uint8_t val );
|
||||
|
@ -196,12 +209,12 @@ public:
|
|||
void setQuestUI16C( uint16_t questId, uint16_t val );
|
||||
void setQuestUI32A( uint16_t questId, uint32_t val );
|
||||
|
||||
void setQuestBitFlag8( uint16_t questId, uint8_t val );
|
||||
void setQuestBitFlag16( uint16_t questId, uint8_t val );
|
||||
void setQuestBitFlag24( uint16_t questId, uint8_t val );
|
||||
void setQuestBitFlag32( uint16_t questId, uint8_t val );
|
||||
void setQuestBitFlag40( uint16_t questId, uint8_t val );
|
||||
void setQuestBitFlag48( uint16_t questId, uint8_t val );
|
||||
void setQuestBitFlag8( uint16_t questId, uint8_t index, bool val );
|
||||
void setQuestBitFlag16( uint16_t questId, uint8_t index, bool val );
|
||||
void setQuestBitFlag24( uint16_t questId, uint8_t index, bool val );
|
||||
void setQuestBitFlag32( uint16_t questId, uint8_t index, bool val );
|
||||
void setQuestBitFlag40( uint16_t questId, uint8_t index, bool val );
|
||||
void setQuestBitFlag48( uint16_t questId, uint8_t index, bool val );
|
||||
|
||||
// Inventory / Item / Currency
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -501,6 +514,8 @@ public:
|
|||
|
||||
void emote( uint32_t emoteId, uint64_t targetId );
|
||||
|
||||
void sendZoneInPackets( uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, bool pSetStatus );
|
||||
|
||||
void finishZoning();
|
||||
|
||||
void sendZonePackets();
|
||||
|
@ -538,6 +553,9 @@ public:
|
|||
uint8_t getGmRank() const;
|
||||
void setGmRank( uint8_t rank );
|
||||
|
||||
bool getGmInvis() const;
|
||||
void setGmInvis( bool invis );
|
||||
|
||||
uint8_t getMode() const;
|
||||
void setMode( uint8_t mode );
|
||||
|
||||
|
@ -663,6 +681,7 @@ private:
|
|||
uint8_t m_stateFlags[12];
|
||||
uint8_t m_gmRank;
|
||||
uint16_t zoneId;
|
||||
bool m_gmInvis = false;
|
||||
|
||||
// Social-based
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "Action/EventAction.h"
|
||||
#include "Action/EventItemAction.h"
|
||||
|
||||
#include "Event/EventHandler.h"
|
||||
#include "Event/EventHandler.h"
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
|
@ -114,56 +113,32 @@ void Core::Entity::Player::eventStart( uint64_t actorId, uint32_t eventId,
|
|||
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventPlay( uint32_t eventId, uint32_t scene,
|
||||
void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
|
||||
uint32_t flags, uint32_t eventParam2,
|
||||
uint32_t eventParam3 )
|
||||
{
|
||||
eventPlay( eventId, scene, flags, eventParam2, eventParam3, nullptr );
|
||||
playScene( eventId, scene, flags, eventParam2, eventParam3, nullptr );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventPlay( uint32_t eventId, uint32_t scene,
|
||||
void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
|
||||
uint32_t flags, Event::EventHandler::SceneReturnCallback eventCallback )
|
||||
{
|
||||
eventPlay( eventId, scene, flags, 0, 0, eventCallback );
|
||||
playScene( eventId, scene, flags, 0, 0, eventCallback );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags )
|
||||
void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene, uint32_t flags )
|
||||
{
|
||||
eventPlay( eventId, scene, flags, 0, 0, nullptr );
|
||||
playScene( eventId, scene, flags, 0, 0, nullptr );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventPlay( uint32_t eventId, uint32_t scene,
|
||||
void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
|
||||
uint32_t flags, uint32_t eventParam2,
|
||||
uint32_t eventParam3, Event::EventHandler::SceneReturnCallback eventCallback )
|
||||
{
|
||||
if( flags & 0x02 )
|
||||
setStateFlag( PlayerStateFlag::WatchingCutscene );
|
||||
|
||||
auto pEvent = getEvent( eventId );
|
||||
if( !pEvent && getEventCount() )
|
||||
{
|
||||
// We're trying to play a nested event, need to start it first.
|
||||
eventStart( getId(), eventId, Event::EventHandler::Nest, 0, 0 );
|
||||
pEvent = getEvent( eventId );
|
||||
}
|
||||
else if( !pEvent )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
return;
|
||||
}
|
||||
|
||||
pEvent->setPlayedScene( true );
|
||||
pEvent->setEventReturnCallback( eventCallback );
|
||||
EventPlayPacket eventPlay( getId(), pEvent->getActorId(), pEvent->getId(),
|
||||
scene, flags, eventParam2, eventParam3 );
|
||||
|
||||
queuePacket( eventPlay );
|
||||
playScene( eventId, scene, flags, eventParam2, eventParam3, 0, eventCallback );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventPlay( uint32_t eventId, uint32_t scene,
|
||||
uint32_t flags, uint32_t eventParam2,
|
||||
uint32_t eventParam3, uint32_t eventParam4, Event::EventHandler::SceneReturnCallback eventCallback )
|
||||
Core::Event::EventHandlerPtr Core::Entity::Player::bootstrapSceneEvent( uint32_t eventId, uint32_t flags )
|
||||
{
|
||||
if( flags & 0x02 )
|
||||
setStateFlag( PlayerStateFlag::WatchingCutscene );
|
||||
|
@ -179,17 +154,59 @@ void Core::Entity::Player::eventPlay( uint32_t eventId, uint32_t scene,
|
|||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pEvent;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
|
||||
uint32_t flags, uint32_t eventParam2,
|
||||
uint32_t eventParam3, uint32_t eventParam4, Event::EventHandler::SceneReturnCallback eventCallback )
|
||||
{
|
||||
auto pEvent = bootstrapSceneEvent( eventId, flags );
|
||||
if( !pEvent )
|
||||
return;
|
||||
|
||||
pEvent->setPlayedScene( true );
|
||||
pEvent->setEventReturnCallback( eventCallback );
|
||||
pEvent->setSceneChainCallback( nullptr );
|
||||
EventPlayPacket eventPlay( getId(), pEvent->getActorId(), pEvent->getId(),
|
||||
scene, flags, eventParam2, eventParam3, eventParam4 );
|
||||
|
||||
queuePacket( eventPlay );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4,
|
||||
Core::Event::EventHandler::SceneChainCallback sceneChainCallback )
|
||||
{
|
||||
auto pEvent = bootstrapSceneEvent( eventId, flags );
|
||||
if( !pEvent )
|
||||
return;
|
||||
|
||||
pEvent->setPlayedScene( true );
|
||||
pEvent->setSceneChainCallback( sceneChainCallback );
|
||||
pEvent->setEventReturnCallback( nullptr );
|
||||
EventPlayPacket eventPlay( getId(), pEvent->getActorId(), pEvent->getId(),
|
||||
scene, flags, eventParam2, eventParam3, eventParam4 );
|
||||
|
||||
queuePacket( eventPlay );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
uint32_t eventParam2, uint32_t eventParam3,
|
||||
Core::Event::EventHandler::SceneChainCallback sceneChainCallback )
|
||||
{
|
||||
playSceneChain( eventId, scene, flags, eventParam2, eventParam3, 0, sceneChainCallback );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
Core::Event::EventHandler::SceneChainCallback sceneChainCallback )
|
||||
{
|
||||
playSceneChain( eventId, scene, flags, 0, 0, 0, sceneChainCallback );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
|
||||
{
|
||||
auto pEvent = getEvent( eventId );
|
||||
|
|
|
@ -89,82 +89,82 @@ int8_t Core::Entity::Player::getQuestIndex( uint16_t questId )
|
|||
return -1;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag8( uint16_t questId )
|
||||
bool Core::Entity::Player::getQuestBitFlag8( uint16_t questId, uint8_t index )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
value = pNewQuest->a.BitFlag8;
|
||||
return pNewQuest->a.BitFlag8 & ( 1 << index );
|
||||
}
|
||||
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag16( uint16_t questId )
|
||||
bool Core::Entity::Player::getQuestBitFlag16( uint16_t questId, uint8_t index )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
value = pNewQuest->a.BitFlag16;
|
||||
return pNewQuest->a.BitFlag16 & ( 1 << index );
|
||||
}
|
||||
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag24( uint16_t questId )
|
||||
bool Core::Entity::Player::getQuestBitFlag24( uint16_t questId, uint8_t index )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
value = pNewQuest->a.BitFlag24;
|
||||
return pNewQuest->a.BitFlag24 & ( 1 << index );
|
||||
}
|
||||
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag32( uint16_t questId )
|
||||
bool Core::Entity::Player::getQuestBitFlag32( uint16_t questId, uint8_t index )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
value = pNewQuest->a.BitFlag32;
|
||||
return pNewQuest->a.BitFlag32 & ( 1 << index );
|
||||
}
|
||||
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag40( uint16_t questId )
|
||||
bool Core::Entity::Player::getQuestBitFlag40( uint16_t questId, uint8_t index )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
value = pNewQuest->a.BitFlag40;
|
||||
return pNewQuest->a.BitFlag40 & ( 1 << index );
|
||||
}
|
||||
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag48( uint16_t questId )
|
||||
bool Core::Entity::Player::getQuestBitFlag48( uint16_t questId, uint8_t index )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
value = pNewQuest->a.BitFlag48;
|
||||
return pNewQuest->a.BitFlag48 & ( 1 << index );
|
||||
}
|
||||
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getQuestUI8A( uint16_t questId )
|
||||
|
@ -762,7 +762,7 @@ void Core::Entity::Player::setQuestUI32A( uint16_t questId, uint32_t val )
|
|||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t val )
|
||||
void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t index, bool val )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
|
@ -770,13 +770,15 @@ void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t val )
|
|||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
|
||||
pNewQuest->a.BitFlag8 = val;
|
||||
uint8_t flag = val ? 1 : 0;
|
||||
|
||||
pNewQuest->a.BitFlag8 |= ( val << index );
|
||||
|
||||
updateQuest( questId, pNewQuest->c.sequence );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t val )
|
||||
void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t index, bool val )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
|
@ -784,13 +786,15 @@ void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t val )
|
|||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
|
||||
pNewQuest->a.BitFlag16 = val;
|
||||
uint8_t flag = val ? 1 : 0;
|
||||
|
||||
pNewQuest->a.BitFlag16 |= ( val << index );
|
||||
|
||||
updateQuest( questId, pNewQuest->c.sequence );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t val )
|
||||
void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t index, bool val )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
|
@ -798,12 +802,14 @@ void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t val )
|
|||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
|
||||
pNewQuest->a.BitFlag24 = val;
|
||||
uint8_t flag = val ? 1 : 0;
|
||||
|
||||
pNewQuest->a.BitFlag24 |= ( val << index );
|
||||
|
||||
updateQuest( questId, pNewQuest->c.sequence );
|
||||
}
|
||||
}
|
||||
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
||||
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t index, bool val )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
|
@ -811,13 +817,15 @@ void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
|||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
|
||||
pNewQuest->a.BitFlag32 = val;
|
||||
uint8_t flag = val ? 1 : 0;
|
||||
|
||||
pNewQuest->a.BitFlag32 |= ( val << index );
|
||||
|
||||
updateQuest( questId, pNewQuest->c.sequence );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t val )
|
||||
void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t index, bool val )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
|
@ -825,13 +833,15 @@ void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t val )
|
|||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
|
||||
pNewQuest->a.BitFlag40 = val;
|
||||
uint8_t flag = val ? 1 : 0;
|
||||
|
||||
pNewQuest->a.BitFlag40 |= ( val << index );
|
||||
|
||||
updateQuest( questId, pNewQuest->c.sequence );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t val )
|
||||
void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t index, bool val )
|
||||
{
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
|
@ -839,7 +849,9 @@ void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t val )
|
|||
{
|
||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||
|
||||
pNewQuest->a.BitFlag48 = val;
|
||||
uint8_t flag = val ? 1 : 0;
|
||||
|
||||
pNewQuest->a.BitFlag48 |= ( val << index );
|
||||
|
||||
updateQuest( questId, pNewQuest->c.sequence );
|
||||
}
|
||||
|
|
|
@ -155,6 +155,8 @@ bool Core::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
|||
|
||||
m_gmRank = res->getUInt8( "GMRank" );
|
||||
|
||||
m_equipDisplayFlags = res->getUInt8( "EquipDisplayFlags" );
|
||||
|
||||
// Blobs
|
||||
|
||||
auto howTo = res->getBlobVector( "HowTo" );
|
||||
|
@ -443,13 +445,15 @@ void Core::Entity::Player::updateSql()
|
|||
|
||||
stmt->setInt( 52, m_gmRank );
|
||||
|
||||
stmt->setInt( 53, m_equipDisplayFlags );
|
||||
|
||||
std::vector< uint8_t > unlockVec( sizeof( m_unlocks ) );
|
||||
memcpy( unlockVec.data(), m_unlocks, sizeof( m_unlocks ) );
|
||||
stmt->setBinary( 53, unlockVec );
|
||||
stmt->setBinary( 54, unlockVec );
|
||||
|
||||
stmt->setInt( 54, m_cfPenaltyUntil );
|
||||
stmt->setInt( 55, m_cfPenaltyUntil );
|
||||
|
||||
stmt->setInt( 55, m_id );
|
||||
stmt->setInt( 56, m_id );
|
||||
|
||||
pDb->execute( stmt );
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost:
|
|||
void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
auto pTerriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
std::string subCommand = "";
|
||||
std::string params = "";
|
||||
|
@ -310,6 +311,17 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
|
|||
|
||||
player.getCurrentZone()->setWeatherOverride( static_cast< Common::Weather >( weatherId ) );
|
||||
}
|
||||
else if( subCommand == "festival" )
|
||||
{
|
||||
uint16_t festivalId;
|
||||
sscanf( params.c_str(), "%hu", &festivalId );
|
||||
|
||||
pTerriMgr->setCurrentFestival( festivalId );
|
||||
}
|
||||
else if( subCommand == "festivaldisable" )
|
||||
{
|
||||
pTerriMgr->disableCurrentFestival();
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendUrgent( subCommand + " is not a valid SET command." );
|
||||
|
@ -830,21 +842,6 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
|
|||
|
||||
instance->setBranch( branch );
|
||||
}
|
||||
else if( subCommand == "festival" )
|
||||
{
|
||||
uint32_t festivalId;
|
||||
sscanf( params.c_str(), "%d", &festivalId );
|
||||
|
||||
player.getCurrentZone()->setCurrentFestival( static_cast< uint16_t >( festivalId ) );
|
||||
}
|
||||
else if( subCommand == "disablefestival" )
|
||||
{
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( player.getId() );
|
||||
actorControl.data().category = Core::Common::ActorControlType::DisableCurrentFestival;
|
||||
player.queuePacket( actorControl );
|
||||
|
||||
player.getCurrentZone()->setCurrentFestival( 0 );
|
||||
}
|
||||
else if ( subCommand == "qte_start" )
|
||||
{
|
||||
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
|
||||
|
|
|
@ -20,14 +20,16 @@ class Director
|
|||
public:
|
||||
enum DirectorType
|
||||
{
|
||||
InstanceContent = 0x8003, // used for dungeons/raids
|
||||
CompanyLeve = 0x8007,
|
||||
QuestBattle = 0x8006,
|
||||
GatheringLeve = 0x8002,
|
||||
BattleLeve = 0x8001,
|
||||
GatheringLeve = 0x8002,
|
||||
InstanceContent = 0x8003, // used for dungeons/raids
|
||||
PublicContent = 0x8004,
|
||||
QuestBattle = 0x8006,
|
||||
CompanyLeve = 0x8007,
|
||||
GoldSaucer = 0x800A,
|
||||
Fate = 0x801A,
|
||||
DpsChallange = 0x800D
|
||||
DpsChallange = 0x800D,
|
||||
Fate = 0x801A
|
||||
|
||||
};
|
||||
|
||||
Director( DirectorType type, uint16_t contentId );
|
||||
|
|
|
@ -10,7 +10,7 @@ Core::Event::EventHandler::EventHandler( Entity::Player* pOwner, uint64_t actorI
|
|||
m_entryId = static_cast< uint16_t >( eventId );
|
||||
m_type = static_cast< uint16_t >( eventId >> 16 );
|
||||
m_eventParam = eventParam;
|
||||
m_callback = nullptr;
|
||||
m_returnCallback = nullptr;
|
||||
}
|
||||
|
||||
uint64_t Core::Event::EventHandler::getActorId() const
|
||||
|
@ -45,12 +45,22 @@ uint32_t Core::Event::EventHandler::getEventParam() const
|
|||
|
||||
Core::Event::EventHandler::SceneReturnCallback Core::Event::EventHandler::getEventReturnCallback() const
|
||||
{
|
||||
return m_callback;
|
||||
return m_returnCallback;
|
||||
}
|
||||
|
||||
void Core::Event::EventHandler::setEventReturnCallback( SceneReturnCallback callback )
|
||||
{
|
||||
m_callback = callback;
|
||||
m_returnCallback = callback;
|
||||
}
|
||||
|
||||
Core::Event::EventHandler::SceneChainCallback Core::Event::EventHandler::getSceneChainCallback() const
|
||||
{
|
||||
return m_chainCallback;
|
||||
}
|
||||
|
||||
void Core::Event::EventHandler::setSceneChainCallback( Core::Event::EventHandler::SceneChainCallback callback )
|
||||
{
|
||||
m_chainCallback = callback;
|
||||
}
|
||||
|
||||
bool Core::Event::EventHandler::hasPlayedScene() const
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
namespace Core {
|
||||
namespace Event {
|
||||
|
||||
struct SceneResult
|
||||
{
|
||||
uint32_t eventId;
|
||||
uint16_t param1;
|
||||
uint16_t param2;
|
||||
uint16_t param3;
|
||||
};
|
||||
|
||||
class EventHandler
|
||||
{
|
||||
public:
|
||||
|
@ -64,7 +72,8 @@ namespace Core {
|
|||
ICDirector = 0x8003,
|
||||
};
|
||||
|
||||
using SceneReturnCallback = std::function< void( Entity::Player&, uint32_t, uint16_t, uint16_t, uint16_t ) > ;
|
||||
using SceneReturnCallback = std::function< void( Entity::Player&, const SceneResult& ) >;
|
||||
using SceneChainCallback = std::function< void( Entity::Player& ) >;
|
||||
|
||||
EventHandler( Entity::Player* pOwner, uint64_t actorId, uint32_t eventId, EventType eventType, uint32_t eventParam );
|
||||
|
||||
|
@ -90,6 +99,10 @@ namespace Core {
|
|||
|
||||
void setEventReturnCallback( SceneReturnCallback callback );
|
||||
|
||||
SceneChainCallback getSceneChainCallback() const;
|
||||
|
||||
void setSceneChainCallback( SceneChainCallback callback );
|
||||
|
||||
bool hasNestedEvent() const;
|
||||
|
||||
void removeNestedEvent();
|
||||
|
@ -106,7 +119,8 @@ namespace Core {
|
|||
uint32_t m_eventParam;
|
||||
EventHandlerPtr m_pNestedEvent;
|
||||
bool m_playedScene;
|
||||
SceneReturnCallback m_callback;
|
||||
SceneReturnCallback m_returnCallback;
|
||||
SceneChainCallback m_chainCallback;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ enum ClientTrigger
|
|||
HuntingLogDetails = 0x194,
|
||||
|
||||
Timers = 0x1AB,
|
||||
|
||||
|
||||
DyeItem = 0x1B5,
|
||||
|
||||
RequestChocoboInventory = 0x1C4,
|
||||
|
@ -103,6 +103,13 @@ enum ClientTrigger
|
|||
CompanionActionUnlock = 0x6A6,
|
||||
|
||||
OpenPerformInstrumentUI = 0x71C,
|
||||
|
||||
StartReplay = 0x7BC,
|
||||
EndReplay = 0x7BD, // request for restoring the original player state (actor, buff, gauge, etc..)
|
||||
|
||||
OpenDuelUI = 0x898, // Open a duel ui
|
||||
DuelRequestResult = 0x899, // either accept/reject
|
||||
|
||||
};
|
||||
|
||||
void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& inPacket,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <Network/GamePacketNew.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <sapphire_zone/Event/EventHandler.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
|
@ -209,7 +210,18 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::GamePacke
|
|||
auto eventCallback = pEvent->getEventReturnCallback();
|
||||
// if there is one, proceed to call it
|
||||
if( eventCallback )
|
||||
eventCallback( player, eventId, param1, param2, param3 );
|
||||
{
|
||||
Event::SceneResult result;
|
||||
result.eventId = eventId;
|
||||
result.param1 = param1;
|
||||
result.param2 = param2;
|
||||
result.param3 = param3;
|
||||
eventCallback( player, result );
|
||||
}
|
||||
// we might have a scene chain callback instead so check for that too
|
||||
else if( auto chainCallback = pEvent->getSceneChainCallback() )
|
||||
chainCallback( player );
|
||||
|
||||
}
|
||||
|
||||
player.checkEvent( eventId );
|
||||
|
|
|
@ -224,6 +224,19 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Invis:
|
||||
{
|
||||
player.setGmInvis( !player.getGmInvis() );
|
||||
player.sendNotice( "Invisibility flag for " + player.getName() +
|
||||
" was toggled to " + std::to_string( !player.getGmInvis() ) );
|
||||
|
||||
for( auto actor : player.getInRangeActors() )
|
||||
{
|
||||
player.despawn( actor->getAsPlayer() );
|
||||
player.spawn( actor->getAsPlayer() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GmCommand::Kill:
|
||||
{
|
||||
targetActor->getAsChara()->takeDamage( 9999999 );
|
||||
|
|
|
@ -291,6 +291,8 @@ void Core::Network::GameConnection::reqEquipDisplayFlagsHandler( const Packets::
|
|||
Entity::Player& player )
|
||||
{
|
||||
player.setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
|
||||
player.sendDebug( "EquipDisplayFlag CHANGE: " + std::to_string( player.getEquipDisplayFlags() ) );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket& inPacket,
|
||||
|
@ -801,16 +803,25 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
{
|
||||
case ChatType::Say:
|
||||
{
|
||||
if (player.getGmRank() > 0)
|
||||
chatPacket.data().chatType = ChatType::GMSay;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Yell:
|
||||
{
|
||||
if( player.getGmRank() > 0 )
|
||||
chatPacket.data().chatType = ChatType::GMYell;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Shout:
|
||||
{
|
||||
if( player.getGmRank() > 0 )
|
||||
chatPacket.data().chatType = ChatType::GMShout;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
m_data.gender = player.getLookAt( Common::CharaLook::Gender );
|
||||
m_data.currentClass = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.currentJob = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.currentLevel = player.getLevel();
|
||||
m_data.maxLevel = player.getLevel();
|
||||
m_data.deity = static_cast< uint8_t >( player.getGuardianDeity() );
|
||||
m_data.namedayMonth = player.getBirthMonth();
|
||||
m_data.namedayDay = player.getBirthDay();
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Server {
|
|||
// 0x20 == spawn hidden to be displayed by the spawneffect control
|
||||
m_data.displayFlags = player.getStance();
|
||||
|
||||
if( player.getZoningType() != Common::ZoneingType::None )
|
||||
if( player.getZoningType() != Common::ZoneingType::None || player.getGmInvis() == true )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Chara::DisplayFlags::Invisible;
|
||||
}
|
||||
|
@ -111,6 +111,11 @@ namespace Server {
|
|||
m_data.displayFlags |= Entity::Chara::DisplayFlags::Visor;
|
||||
}
|
||||
|
||||
if( !( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideLegacyMark ) )
|
||||
{
|
||||
m_data.look[0xC] = m_data.look[0xC] | 1 << 7;
|
||||
}
|
||||
|
||||
m_data.currentMount = player.getCurrentMount();
|
||||
|
||||
m_data.targetId = player.getTargetId();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <string>
|
||||
#include <typeinfo>
|
||||
#include <typeindex>
|
||||
#include <sapphire_zone/Event/EventHandler.h>
|
||||
#include "Forwards.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -75,6 +76,13 @@ public:
|
|||
|
||||
class EventScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
template< typename Ret, class Obj >
|
||||
inline Event::EventHandler::SceneChainCallback bindScene( Ret ( Obj::*f )( Entity::Player& ) )
|
||||
{
|
||||
return std::bind( f, static_cast< Obj* >( this ), std::placeholders::_1 );
|
||||
}
|
||||
|
||||
public:
|
||||
explicit EventScript( uint32_t questId ) :
|
||||
ScriptObject( questId, typeid( EventScript ).hash_code() )
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <winbase.h>
|
||||
typedef HMODULE ModuleHandle;
|
||||
using ModuleHandle = HMODULE;
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
typedef void* ModuleHandle;
|
||||
using ModuleHandle = void*;
|
||||
#endif
|
||||
|
||||
namespace Core {
|
||||
|
@ -40,7 +40,6 @@ namespace Scripting {
|
|||
ScriptInfo* getScriptInfo( std::string name );
|
||||
|
||||
ScriptObject** getScripts( ModuleHandle handle );
|
||||
ScriptObject* getScriptObject( ModuleHandle handle );
|
||||
|
||||
bool isModuleLoaded( std::string name );
|
||||
|
||||
|
|
|
@ -54,9 +54,15 @@ bool Core::Scripting::ScriptMgr::init()
|
|||
auto pConfig = g_fw.get< XMLConfig >();
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
|
||||
loadDir( pConfig->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ),
|
||||
auto status = loadDir( pConfig->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ),
|
||||
files, m_nativeScriptMgr->getModuleExtension() );
|
||||
|
||||
if( !status )
|
||||
{
|
||||
pLog->error( std::string( __func__ ) + ": failed to load scripts, the server will not function correctly without scripts loaded." );
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t scriptsFound = 0;
|
||||
uint32_t scriptsLoaded = 0;
|
||||
|
||||
|
@ -114,11 +120,17 @@ void Core::Scripting::ScriptMgr::watchDirectories()
|
|||
});
|
||||
}
|
||||
|
||||
void Core::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set<std::string> &files, const std::string& ext )
|
||||
bool Core::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set<std::string>& files, const std::string& ext )
|
||||
{
|
||||
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->info( "ScriptEngine: loading scripts from " + dirname );
|
||||
pLog->info( "ScriptMgr: loading scripts from " + dirname );
|
||||
|
||||
if( !boost::filesystem::exists( dirname ) )
|
||||
{
|
||||
pLog->error( "ScriptMgr: scripts directory doesn't exist" );
|
||||
return false;
|
||||
}
|
||||
|
||||
boost::filesystem::path targetDir( dirname );
|
||||
|
||||
|
@ -132,6 +144,14 @@ void Core::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set<s
|
|||
files.insert( i.string() );
|
||||
}
|
||||
}
|
||||
|
||||
if( files.size() )
|
||||
return true;
|
||||
else
|
||||
{
|
||||
pLog->error( "ScriptMgr: couldn't find any script modules" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Scripting::ScriptMgr::onPlayerFirstEnterWorld( Entity::Player& player )
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Core
|
|||
bool onInstanceUpdate( InstanceContentPtr instance, uint32_t currTime );
|
||||
bool onInstanceEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
||||
|
||||
void loadDir( const std::string& dirname, std::set<std::string> &files, const std::string& ext );
|
||||
bool loadDir( const std::string& dirname, std::set<std::string> &files, const std::string& ext );
|
||||
|
||||
NativeScriptMgr& getNativeScriptHandler();
|
||||
};
|
||||
|
|
|
@ -356,5 +356,25 @@ Core::ZonePtr Core::TerritoryMgr::getLinkedInstance( uint32_t playerId ) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const uint16_t Core::TerritoryMgr::getCurrentFestival() const
|
||||
{
|
||||
return m_currentFestival;
|
||||
}
|
||||
|
||||
void Core::TerritoryMgr::setCurrentFestival( uint16_t festivalId )
|
||||
{
|
||||
m_currentFestival = festivalId;
|
||||
|
||||
for( const auto& zone : m_zoneSet )
|
||||
{
|
||||
zone->setCurrentFestival( m_currentFestival );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::TerritoryMgr::disableCurrentFestival()
|
||||
{
|
||||
setCurrentFestival( 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -118,6 +118,10 @@ namespace Core
|
|||
/*! returns an instancePtr if the player is still bound to an isntance */
|
||||
ZonePtr getLinkedInstance( uint32_t playerId ) const;
|
||||
|
||||
void setCurrentFestival( uint16_t festivalId );
|
||||
void disableCurrentFestival();
|
||||
const uint16_t getCurrentFestival() const;
|
||||
|
||||
private:
|
||||
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
||||
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||
|
@ -154,6 +158,9 @@ namespace Core
|
|||
/*! set of ZonePtrs for quick iteration*/
|
||||
std::set< ZonePtr > m_instanceZoneSet;
|
||||
|
||||
/*! id of current festival to set for public zones from festival.exd */
|
||||
uint16_t m_currentFestival;
|
||||
|
||||
public:
|
||||
/*! returns a list of instanceContent InstanceIds currently active */
|
||||
InstanceIdList getInstanceContentIdList( uint16_t instanceContentId ) const;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Database/DatabaseDef.h>
|
||||
#include <Network/PacketWrappers/ActorControlPacket143.h>
|
||||
|
||||
#include "Zone.h"
|
||||
#include "InstanceContent.h"
|
||||
|
@ -136,8 +137,15 @@ uint16_t Core::Zone::getCurrentFestival() const
|
|||
void Core::Zone::setCurrentFestival( uint16_t festivalId )
|
||||
{
|
||||
m_currentFestivalId = festivalId;
|
||||
}
|
||||
|
||||
for( const auto& playerEntry : m_playerMap )
|
||||
{
|
||||
auto player = playerEntry.second;
|
||||
|
||||
ActorControlPacket143 enableFestival( player->getId(), SetFestival, m_currentFestivalId );
|
||||
playerEntry.second->queuePacket( enableFestival );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Zone::loadCellCache()
|
||||
{
|
||||
|
|
39
src/tools/discovery_parser/CMakeLists.txt
Normal file
39
src/tools/discovery_parser/CMakeLists.txt
Normal file
|
@ -0,0 +1,39 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
project(Tool_discovery_parser)
|
||||
|
||||
set(SAPPHIRE_BOOST_VER 1.63.0)
|
||||
set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/")
|
||||
|
||||
|
||||
file(GLOB SERVER_PUBLIC_INCLUDE_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/*"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/BMP-DDS_Converter/*"
|
||||
)
|
||||
file(GLOB SERVER_SOURCE_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}*.c*"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/BMP-DDS_Converter/*.c*"
|
||||
)
|
||||
|
||||
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin/")
|
||||
add_executable(discovery_parser ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
|
||||
|
||||
set_target_properties(discovery_parser PROPERTIES
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS ON
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
|
||||
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries (discovery_parser common xivdat pthread mysqlclient dl z)
|
||||
else()
|
||||
target_link_libraries (discovery_parser common xivdat libmysql zlib1)
|
||||
endif()
|
||||
|
||||
target_link_libraries(discovery_parser ${Boost_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
26
src/tools/discovery_parser/README.md
Normal file
26
src/tools/discovery_parser/README.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
collision data exporter for sapphire
|
||||
|
||||
compile with STANDALONE defined to compile without boost and sapphire dependencies
|
||||
|
||||
usage:
|
||||
- regular
|
||||
- compile with root sapphire dir cmakelists
|
||||
- sapphire/src/tools/bin/pcb_reader2 <territory> "<path/to/game/sqpack/ffxiv>"
|
||||
- standalone
|
||||
- compile main.cpp with STANDALONE defined in build arg
|
||||
- download ffxivexplorer <http://ffxivexplorer.fragmenterworks.com/>
|
||||
- ffxivexplorer > path/to/ffxiv's/game/sqpack/ffxiv/0a0000.dat
|
||||
- exd/territorytype.exh > `File > Export` and copy `territorytype.exh.csv` from exproted directory to `pcb_reader.exe` directory
|
||||
- ffxivexplorer > path/to/ffxiv's/game/sqpack/ffxiv/020000.dat
|
||||
- ctrl click the following:
|
||||
- `bg/ffxiv/[REGION]/common/collision`
|
||||
- `bg/ffxiv/[REGION]/[dun|fld|twn|etc..]/common/collision/`
|
||||
- `bg/ffxiv/[REGION]/[dun|fld|twn|etc..]/collision/`
|
||||
- `bg/ffxiv/region/shared/[for_bg|for_hou]/`
|
||||
- `bg/ffxiv/[REGION]/[dun|fld|twn|etc..]/ZONE/level/`
|
||||
- `bg/ffxiv/[REGION]/[dun|fld|twn|etc..]/ZONE/collision/`
|
||||
- `bgcommon/world/sys/shared/for_bg/`
|
||||
and `File > Export Raw` to pcb_reader exe dir (common and shared files are optional but you will be missing a lot of objects if you skip them)
|
||||
- note: at this time ffxivexplorer is still missing some hashes, though any tool which can export the exds should work fine
|
||||
- main "" <territory>
|
||||
|
363
src/tools/discovery_parser/lgb.h
Normal file
363
src/tools/discovery_parser/lgb.h
Normal file
|
@ -0,0 +1,363 @@
|
|||
#ifndef _LGB_H
|
||||
#define _LGB_H
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "matrix4.h"
|
||||
#include "vec3.h"
|
||||
#include "sgb.h"
|
||||
|
||||
// garbage to skip model loading
|
||||
extern bool ignoreModels;
|
||||
|
||||
// all credit to
|
||||
// https://github.com/ufx/SaintCoinach/blob/master/SaintCoinach/Graphics/Lgb/
|
||||
// this is simply their work ported to c++ since we dont c#
|
||||
struct LGB_FILE;
|
||||
struct LGB_FILE_HEADER;
|
||||
struct LGB_GROUP;
|
||||
struct LGB_GROUP_HEADER;
|
||||
|
||||
enum class LgbEntryType : uint32_t
|
||||
{
|
||||
BgParts = 1,
|
||||
Light = 3,
|
||||
Vfx = 4,
|
||||
PositionMarker = 5,
|
||||
Gimmick = 6,
|
||||
SharedGroup6 = 6,// secondary variable is set to 2
|
||||
Sound = 7,
|
||||
EventNpc = 8,
|
||||
BattleNpc = 9,
|
||||
Aetheryte = 12,
|
||||
EnvSpace = 13,
|
||||
Gathering = 14,
|
||||
SharedGroup15 = 15,// secondary variable is set to 13
|
||||
Treasure = 16,
|
||||
Weapon = 39,
|
||||
PopRange = 40,
|
||||
ExitRange = 41,
|
||||
MapRange = 43,
|
||||
NaviMeshRange = 44,
|
||||
EventObject = 45,
|
||||
EnvLocation = 47,
|
||||
EventRange = 49,
|
||||
QuestMarker = 51,
|
||||
CollisionBox = 57,
|
||||
DoorRange = 58,
|
||||
LineVfx = 59,
|
||||
ClientPath = 65,
|
||||
ServerPath = 66,
|
||||
GimmickRange = 67,
|
||||
TargetMarker = 68,
|
||||
ChairMarker = 69,
|
||||
ClickableRange = 70,
|
||||
PrefetchRange = 71,
|
||||
FateRange = 72,
|
||||
SphereCastRange = 75,
|
||||
};
|
||||
|
||||
struct LGB_ENTRY_HEADER
|
||||
{
|
||||
LgbEntryType type;
|
||||
uint32_t unknown;
|
||||
uint32_t nameOffset;
|
||||
vec3 translation;
|
||||
vec3 rotation;
|
||||
vec3 scale;
|
||||
};
|
||||
|
||||
class LGB_ENTRY
|
||||
{
|
||||
public:
|
||||
char* m_buf;
|
||||
uint32_t m_offset;
|
||||
LGB_ENTRY_HEADER header;
|
||||
|
||||
LGB_ENTRY()
|
||||
{
|
||||
m_buf = nullptr;
|
||||
m_offset = 0;
|
||||
memset( &header, 0, sizeof( header ) );
|
||||
};
|
||||
LGB_ENTRY( char* buf, uint32_t offset )
|
||||
{
|
||||
m_buf = buf;
|
||||
m_offset = offset;
|
||||
header = *reinterpret_cast< LGB_ENTRY_HEADER* >( buf + offset );
|
||||
};
|
||||
const LgbEntryType getType() const
|
||||
{
|
||||
return header.type;
|
||||
};
|
||||
virtual ~LGB_ENTRY() {};
|
||||
};
|
||||
|
||||
|
||||
struct LGB_BGPARTS_HEADER : public LGB_ENTRY_HEADER
|
||||
{
|
||||
uint32_t modelFileOffset;
|
||||
uint32_t collisionFileOffset;
|
||||
uint32_t unknown4;
|
||||
uint32_t unknown5;
|
||||
uint32_t unknown6;
|
||||
uint32_t unknown7;
|
||||
uint32_t unknown8;
|
||||
uint32_t unknown9;
|
||||
};
|
||||
|
||||
class LGB_BGPARTS_ENTRY : public LGB_ENTRY
|
||||
{
|
||||
public:
|
||||
LGB_BGPARTS_HEADER header;
|
||||
std::string name;
|
||||
std::string modelFileName;
|
||||
std::string collisionFileName;
|
||||
LGB_BGPARTS_ENTRY() {};
|
||||
LGB_BGPARTS_ENTRY( char* buf, uint32_t offset ) : LGB_ENTRY( buf, offset )
|
||||
{
|
||||
header = *reinterpret_cast<LGB_BGPARTS_HEADER*>( buf + offset );
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
modelFileName = std::string( buf + offset + header.modelFileOffset );
|
||||
collisionFileName = std::string( buf + offset + header.collisionFileOffset );
|
||||
};
|
||||
};
|
||||
|
||||
struct LGB_GIMMICK_HEADER : public LGB_ENTRY_HEADER
|
||||
{
|
||||
uint32_t gimmickFileOffset;
|
||||
char unknownBytes[100];
|
||||
};
|
||||
|
||||
class LGB_GIMMICK_ENTRY : public LGB_ENTRY
|
||||
{
|
||||
public:
|
||||
LGB_GIMMICK_HEADER header;
|
||||
std::string name;
|
||||
std::string gimmickFileName;
|
||||
|
||||
LGB_GIMMICK_ENTRY( char* buf, uint32_t offset ) : LGB_ENTRY( buf, offset )
|
||||
{
|
||||
header = *reinterpret_cast<LGB_GIMMICK_HEADER*>( buf + offset );
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
gimmickFileName = std::string( buf + offset + header.gimmickFileOffset );
|
||||
//std::cout << "\t " << gimmickFileName << " unknown: " << header.unknown << "\n";
|
||||
};
|
||||
};
|
||||
|
||||
struct LGB_ENPC_HEADER : public LGB_ENTRY_HEADER
|
||||
{
|
||||
uint32_t enpcId;
|
||||
uint8_t unknown1[0x24];
|
||||
};
|
||||
|
||||
class LGB_ENPC_ENTRY : public LGB_ENTRY
|
||||
{
|
||||
public:
|
||||
LGB_ENPC_HEADER header;
|
||||
std::string name;
|
||||
|
||||
LGB_ENPC_ENTRY( char* buf, uint32_t offset ) : LGB_ENTRY( buf, offset )
|
||||
{
|
||||
header = *reinterpret_cast< LGB_ENPC_HEADER* >( buf + offset );
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
//std::cout << "\t ENpc " << header.enpcId << " " << name << "\n";
|
||||
};
|
||||
};
|
||||
|
||||
struct LGB_EOBJ_HEADER : public LGB_ENTRY_HEADER
|
||||
{
|
||||
uint32_t eobjId;
|
||||
uint32_t levelHierachyId;
|
||||
uint8_t unknown1[0xC];
|
||||
};
|
||||
|
||||
class LGB_EOBJ_ENTRY : public LGB_ENTRY
|
||||
{
|
||||
public:
|
||||
LGB_EOBJ_HEADER header;
|
||||
std::string name;
|
||||
|
||||
LGB_EOBJ_ENTRY( char* buf, uint32_t offset ) : LGB_ENTRY( buf, offset )
|
||||
{
|
||||
header = *reinterpret_cast< LGB_EOBJ_HEADER* >( buf + offset );
|
||||
//std::cout << "\t " << header.eobjId << " " << name << " unknown: " << header.unknown << "\n";
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
};
|
||||
};
|
||||
|
||||
struct LGB_MAPRANGE_HEADER : public LGB_ENTRY_HEADER
|
||||
{
|
||||
uint32_t type;
|
||||
uint16_t unknown2;
|
||||
uint16_t unknown3;
|
||||
uint8_t unknown4[0x10];
|
||||
};
|
||||
|
||||
struct LGB_MAPRANGE_ENTRY : public LGB_ENTRY
|
||||
{
|
||||
public:
|
||||
LGB_MAPRANGE_HEADER header;
|
||||
std::string name;
|
||||
|
||||
LGB_MAPRANGE_ENTRY( char* buf, uint32_t offset ) : LGB_ENTRY( buf, offset )
|
||||
{
|
||||
header = *reinterpret_cast< LGB_MAPRANGE_HEADER* >( buf + offset );
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
};
|
||||
};
|
||||
|
||||
struct LGB_GROUP_HEADER
|
||||
{
|
||||
uint32_t unknown;
|
||||
int32_t groupNameOffset;
|
||||
int32_t entriesOffset;
|
||||
int32_t entryCount;
|
||||
uint32_t unknown2;
|
||||
uint32_t unknown3;
|
||||
uint32_t unknown4;
|
||||
uint32_t unknown5;
|
||||
uint32_t unknown6;
|
||||
uint32_t unknown7;
|
||||
uint32_t unknown8;
|
||||
uint32_t unknown9;
|
||||
uint32_t unknown10;
|
||||
};
|
||||
|
||||
struct LGB_GROUP
|
||||
{
|
||||
LGB_FILE* parent;
|
||||
LGB_GROUP_HEADER header;
|
||||
std::string name;
|
||||
std::vector< std::shared_ptr< LGB_ENTRY > > entries;
|
||||
|
||||
LGB_GROUP( char* buf, LGB_FILE* parentStruct, uint32_t offset )
|
||||
{
|
||||
parent = parentStruct;
|
||||
header = *reinterpret_cast< LGB_GROUP_HEADER* >( buf + offset );
|
||||
name = std::string( buf + offset + header.groupNameOffset );
|
||||
//entries.resize( header.entryCount );
|
||||
//std::cout << name << "\n\t unknown: " << header.unknown << "\n";
|
||||
const auto entriesOffset = offset + header.entriesOffset;
|
||||
for( auto i = 0; i < header.entryCount; ++i )
|
||||
{
|
||||
const auto entryOffset = entriesOffset + *reinterpret_cast< int32_t* >( buf + ( entriesOffset + i * 4 ) );
|
||||
|
||||
try
|
||||
{
|
||||
const auto type = *reinterpret_cast<LgbEntryType*>( buf + entryOffset );
|
||||
// garbage to skip model loading
|
||||
if( !ignoreModels && type == LgbEntryType::BgParts )
|
||||
{
|
||||
entries.push_back( std::make_shared< LGB_BGPARTS_ENTRY >( buf, entryOffset ) );
|
||||
}
|
||||
else if( !ignoreModels && type == LgbEntryType::Gimmick )
|
||||
{
|
||||
entries.push_back( std::make_shared< LGB_GIMMICK_ENTRY >( buf, entryOffset ) );
|
||||
}
|
||||
else if( type == LgbEntryType::EventNpc )
|
||||
{
|
||||
entries.push_back( std::make_shared< LGB_ENPC_ENTRY >( buf, entryOffset ) );
|
||||
}
|
||||
else if( type == LgbEntryType::EventObject )
|
||||
{
|
||||
entries.push_back( std::make_shared< LGB_EOBJ_ENTRY >( buf, entryOffset ) );
|
||||
}
|
||||
else if( type == LgbEntryType::MapRange )
|
||||
{
|
||||
entries.push_back( std::make_shared< LGB_MAPRANGE_ENTRY >( buf, entryOffset ) );
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
entries[i] = nullptr;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cout << name << " " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct LGB_FILE_HEADER
|
||||
{
|
||||
char magic[4]; // LGB 1
|
||||
uint32_t fileSize;
|
||||
uint32_t unknown;
|
||||
char magic2[4]; // LGP1
|
||||
uint32_t unknown2;
|
||||
uint32_t unknown3;
|
||||
uint32_t unknown4;
|
||||
uint32_t unknown5;
|
||||
int32_t groupCount;
|
||||
};
|
||||
|
||||
struct LGB_FILE
|
||||
{
|
||||
LGB_FILE_HEADER header;
|
||||
std::vector< LGB_GROUP > groups;
|
||||
std::string name;
|
||||
|
||||
LGB_FILE( char* buf, const std::string& name )
|
||||
{
|
||||
header = *reinterpret_cast< LGB_FILE_HEADER* >( buf );
|
||||
if( strncmp( &header.magic[0], "LGB1", 4 ) != 0 || strncmp( &header.magic2[0], "LGP1", 4 ) != 0 )
|
||||
throw std::runtime_error( "Invalid LGB file!" );
|
||||
|
||||
//groups.resize(header.groupCount);
|
||||
|
||||
constexpr auto baseOffset = sizeof( header );
|
||||
for( auto i = 0; i < header.groupCount; ++i )
|
||||
{
|
||||
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
|
||||
const auto group = LGB_GROUP( buf, this, groupOffset );
|
||||
groups.push_back( group );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
#if __cplusplus >= 201703L
|
||||
#include <experimental/filesystem>
|
||||
std::map<std::string, LGB_FILE> getLgbFiles( const std::string& dir )
|
||||
{
|
||||
namespace fs = std::experimental::filesystem;
|
||||
std::map<std::string, LGB_FILE> fileMap;
|
||||
for( const auto& path : fs::recursive_directory_iterator( dir ) )
|
||||
{
|
||||
if( path.path().extension() == ".lgb" )
|
||||
{
|
||||
const auto& strPath = path.path().string();
|
||||
auto f = fopen( strPath.c_str(), "rb" );
|
||||
fseek( f, 0, SEEK_END );
|
||||
const auto size = ftell( f );
|
||||
std::vector<char> bytes( size );
|
||||
rewind( f );
|
||||
fread( bytes.data(), 1, size, f );
|
||||
fclose( f );
|
||||
try
|
||||
{
|
||||
LGB_FILE lgbFile( bytes.data() );
|
||||
fileMap.insert( std::make_pair( strPath, lgbFile ) );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cout << "Unable to load " << strPath << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return fileMap;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
#endif
|
818
src/tools/discovery_parser/main.cpp
Normal file
818
src/tools/discovery_parser/main.cpp
Normal file
|
@ -0,0 +1,818 @@
|
|||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <regex>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <memory>
|
||||
|
||||
#include "pcb.h"
|
||||
#include "lgb.h"
|
||||
#include "sgb.h"
|
||||
#include "tex.h"
|
||||
#include "tex_decode.h"
|
||||
|
||||
//#include "s3tc/s3tc.h"
|
||||
|
||||
#ifndef STANDALONE
|
||||
#include <GameData.h>
|
||||
#include <File.h>
|
||||
#include <DatCat.h>
|
||||
#include <ExdData.h>
|
||||
#include <ExdCat.h>
|
||||
#include <Exd.h>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#endif
|
||||
|
||||
// garbage to ignore models
|
||||
bool ignoreModels = false;
|
||||
|
||||
// parsing shit
|
||||
std::string gamePath( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
||||
std::unordered_map< uint32_t, std::string > eobjNameMap;
|
||||
std::unordered_map< uint16_t, std::string > zoneNameMap;
|
||||
std::unordered_map< uint16_t, std::vector< std::pair< uint16_t, std::string > > > zoneInstanceMap;
|
||||
uint32_t zoneId;
|
||||
|
||||
std::set< std::string > zoneDumpList;
|
||||
|
||||
xiv::dat::GameData* data1 = nullptr;
|
||||
xiv::exd::ExdData* eData = nullptr;
|
||||
|
||||
void readFileToBuffer( const std::string& path, std::vector< char >& buf );
|
||||
|
||||
|
||||
|
||||
// discovery shit
|
||||
struct vec2
|
||||
{
|
||||
float x, y;
|
||||
};
|
||||
|
||||
struct DiscoveryMap
|
||||
{
|
||||
std::string path;
|
||||
Image img;
|
||||
uint16_t mapScale;
|
||||
int16_t mapOffsetX, mapOffsetY;
|
||||
int mapId;
|
||||
constexpr static int discoveryMapRows = 3;
|
||||
constexpr static int discoveryMapCols = 4;
|
||||
constexpr static int tileWidth = 128;
|
||||
constexpr static int tiles = discoveryMapCols * discoveryMapRows;
|
||||
|
||||
uint32_t getColour( uint8_t mapIndex, float x, float y )
|
||||
{
|
||||
auto ogX = x, ogY = y;
|
||||
int col = mapIndex % (img.width / tileWidth);
|
||||
int row = mapIndex / (img.width / tileWidth);
|
||||
x = ( x / 2048.0f ) * (float)tileWidth;
|
||||
y = ( y / 2048.0f ) * (float)tileWidth;
|
||||
int tileX = (col * tileWidth) + x;
|
||||
int tileY = ( row * tileWidth ) + y;
|
||||
|
||||
if (tileX < 0 || tileY < 0)
|
||||
{
|
||||
std::cout << "Unable to find tile coord for " << x << " " << y << " mapIndex " << mapIndex << "\n";
|
||||
return 0;
|
||||
}
|
||||
if( tileY > img.data.size() )
|
||||
return 0;
|
||||
|
||||
if( tileX > img.data[0].size() )
|
||||
return 0;
|
||||
|
||||
//std::cout << "getColour col " << col << " row " << row << " tileX " << tileX << " tileY " << tileY << " tile index " << std::to_string( mapIndex ) << "\n";
|
||||
auto colour = img.data[tileY][tileX];
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
vec3 get3dPosFrom2d( float x, float y )
|
||||
{
|
||||
vec3 ret;
|
||||
float scale2 = mapScale / 100;
|
||||
ret.x = ( x * scale2 ) + ( img.height * 2 ); //( x / scale2 ) - mapOffsetX;
|
||||
ret.z = ( y * scale2 ) + ( img.height * 2 ); //( y / scale2 ) - mapOffsetY;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec2 get2dPosFrom3d( float x, float y )
|
||||
{
|
||||
//int a = (mapPictureBox.Height / 2) + (x / (System.Convert.ToInt32(myMap.sizeFactor) / 100));
|
||||
//int b = (mapPictureBox.Height / 2) + (y / (System.Convert.ToInt32(myMap.sizeFactor) / 100));
|
||||
|
||||
vec2 ret;
|
||||
float scale2 = mapScale / 100;
|
||||
ret.x = ( x * scale2 ) + (2048.f /2);
|
||||
ret.y = ( y * scale2 ) + (2048.f /2);
|
||||
//ret.x = ( x * scale2 ) + mapOffsetX;
|
||||
//ret.y = ( y * scale2 ) + mapOffsetY;
|
||||
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
std::map< uint16_t, DiscoveryMap > discoveryMaps;
|
||||
|
||||
|
||||
|
||||
|
||||
enum class TerritoryTypeExdIndexes : size_t
|
||||
{
|
||||
TerritoryType = 0,
|
||||
Path = 1
|
||||
};
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
struct face
|
||||
{
|
||||
int32_t f1, f2, f3;
|
||||
};
|
||||
|
||||
// init
|
||||
void initExd( const std::string& gamePath )
|
||||
{
|
||||
data1 = data1 ? data1 : new xiv::dat::GameData( gamePath );
|
||||
eData = eData ? eData : new xiv::exd::ExdData( *data1 );
|
||||
}
|
||||
|
||||
int parseBlockEntry( char* data, std::vector<PCB_BLOCK_ENTRY>& entries, int gOff )
|
||||
{
|
||||
int offset = 0;
|
||||
bool isgroup = true;
|
||||
while( isgroup )
|
||||
{
|
||||
PCB_BLOCK_ENTRY block_entry;
|
||||
memcpy( &block_entry.header, data + offset, sizeof( block_entry.header ) );
|
||||
isgroup = block_entry.header.type == 0x30;
|
||||
|
||||
//printf( " BLOCKHEADER_%X: type: %i, group_size: %i\n", gOff + offset, block_entry.header.type, block_entry.header.group_size );
|
||||
|
||||
if( isgroup )
|
||||
{
|
||||
parseBlockEntry( data + offset + 0x30, entries, gOff + offset );
|
||||
offset += block_entry.header.group_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n",
|
||||
block_entry.header.num_v16, block_entry.header.num_indices, block_entry.header.num_vertices );*/
|
||||
int doffset = sizeof( block_entry.header ) + offset;
|
||||
uint16_t block_size = sizeof( block_entry.header ) +
|
||||
block_entry.header.num_vertices * 3 * 4 +
|
||||
block_entry.header.num_v16 * 6 +
|
||||
block_entry.header.num_indices * 6;
|
||||
|
||||
if( block_entry.header.num_vertices != 0 )
|
||||
{
|
||||
block_entry.data.vertices.resize( block_entry.header.num_vertices );
|
||||
|
||||
int32_t size_vertexbuffer = block_entry.header.num_vertices * 3;
|
||||
memcpy( &block_entry.data.vertices[0], data + doffset, size_vertexbuffer * 4 );
|
||||
doffset += size_vertexbuffer * 4;
|
||||
}
|
||||
if( block_entry.header.num_v16 != 0 )
|
||||
{
|
||||
block_entry.data.vertices_i16.resize( block_entry.header.num_v16 );
|
||||
int32_t size_unknownbuffer = block_entry.header.num_v16 * 6;
|
||||
memcpy( &block_entry.data.vertices_i16[0], data + doffset, size_unknownbuffer );
|
||||
doffset += block_entry.header.num_v16 * 6;
|
||||
}
|
||||
if( block_entry.header.num_indices != 0 )
|
||||
{
|
||||
block_entry.data.indices.resize( block_entry.header.num_indices );
|
||||
int32_t size_indexbuffer = block_entry.header.num_indices * 12;
|
||||
memcpy( &block_entry.data.indices[0], data + doffset, size_indexbuffer );
|
||||
doffset += size_indexbuffer;
|
||||
}
|
||||
entries.push_back( block_entry );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string getMapExdEntries( uint32_t mapId )
|
||||
{
|
||||
static auto& cat = eData->get_category( "Map" );
|
||||
static auto exd = static_cast< xiv::exd::Exd >( cat.get_data_ln( xiv::exd::Language::none ) );
|
||||
//static std::unique_ptr< Converter > pConverter = std::make_unique< Converter >();
|
||||
|
||||
static auto& rows = exd.get_rows();
|
||||
for( auto& row : rows )
|
||||
{
|
||||
// fields from SaintCoinach https://github.com/ufx/SaintCoinach/blob/master/SaintCoinach/ex.json#L6358
|
||||
auto id = row.first;
|
||||
if( id != mapId )
|
||||
continue;
|
||||
|
||||
auto& fields = row.second;
|
||||
|
||||
/* TYPES !!
|
||||
case DataType::boolean: 1
|
||||
case DataType::int8: 2
|
||||
case DataType::uint8: 3
|
||||
case DataType::int16: 4
|
||||
case DataType::uint16: 5
|
||||
case DataType::int32: 6
|
||||
case DataType::uint32: 7
|
||||
case DataType::float32: 8
|
||||
case DataType::uint64: 9
|
||||
*/
|
||||
|
||||
auto mapZoneIndex = *boost::get< int8_t >( &fields.at( 2 ) );
|
||||
auto hierarchy = *boost::get< uint8_t >( &fields.at( 3 ) );
|
||||
auto pathStr = *boost::get< std::string >( &fields.at( 5 ) );
|
||||
auto sizeFactor = *boost::get< uint16_t >( &fields.at( 6 ) );
|
||||
auto mapOffsetX = *boost::get< int16_t >( &fields.at( 7 ) );
|
||||
auto mapOffsetY = *boost::get< int16_t >( &fields.at( 8 ) );
|
||||
auto discoveryIdx = *boost::get< int16_t >( &fields.at( 12 ) );
|
||||
auto discoveryCompleteBitmask = *boost::get< uint32_t >( &fields.at( 13 ) );
|
||||
auto territory = *boost::get< uint16_t >( &fields.at( 14 ) );
|
||||
char texStr[255];
|
||||
auto teriStr = pathStr.substr( 0, pathStr.find_first_of( '/' ) );
|
||||
sprintf( &texStr[0], "ui/map/%s/%s%02Xd.tex", pathStr.c_str(), teriStr.c_str(), mapZoneIndex );
|
||||
|
||||
|
||||
if( discoveryMaps.find( territory ) == discoveryMaps.end() )
|
||||
{
|
||||
auto texFile = data1->getFile( &texStr[0] );
|
||||
std::string rawTexFile( teriStr + "0" + std::to_string( mapZoneIndex ) );
|
||||
texFile->exportToFile( rawTexFile + "d.tex" );
|
||||
auto tex = TEX_FILE( rawTexFile + "d.tex" );
|
||||
|
||||
int mipMapDivide = 1;
|
||||
int h = tex.header.uncompressedHeight;
|
||||
int w = tex.header.uncompressedWidth;
|
||||
DiscoveryMap discoveryMap;
|
||||
discoveryMap.img = DecodeTexDXT1( tex, tex.header.mipMaps[0], h / mipMapDivide, w / mipMapDivide,
|
||||
( h / mipMapDivide ) / 4, ( w / mipMapDivide ) / 4
|
||||
);
|
||||
|
||||
discoveryMap.img.toFile( rawTexFile + ".img" );
|
||||
discoveryMap.mapId = id;
|
||||
discoveryMap.path = &texStr[0];
|
||||
discoveryMap.mapOffsetX = mapOffsetX;
|
||||
discoveryMap.mapOffsetY = mapOffsetY;
|
||||
discoveryMap.mapScale = sizeFactor;
|
||||
|
||||
std::cout << "Image Height: " << discoveryMap.img.height << " Width: " << discoveryMap.img.width << "\n";
|
||||
|
||||
discoveryMaps.emplace( territory, discoveryMap );
|
||||
}
|
||||
return std::string( std::to_string( mapZoneIndex ) + ", " + std::to_string( hierarchy ) + ", " + "\"" + std::string( &texStr[0] ) + "\", " +
|
||||
std::to_string( discoveryIdx ) + ", " + std::to_string( discoveryCompleteBitmask ) );
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void dumpLevelExdEntries( uint32_t zoneId, const std::string& name = std::string() )
|
||||
{
|
||||
static auto& cat = eData->get_category( "Level" );
|
||||
static auto exd = static_cast< xiv::exd::Exd >( cat.get_data_ln( xiv::exd::Language::none ) );
|
||||
|
||||
std::string fileName( name + "_" + std::to_string( zoneId ) + "_Level" + ".csv" );
|
||||
std::ofstream outfile( fileName, std::ios::trunc );
|
||||
std::cout << "[Info] Writing level.exd entries to " << fileName << "\n";
|
||||
if( outfile.good() )
|
||||
{
|
||||
outfile.close();
|
||||
outfile.open( fileName, std::ios::app );
|
||||
static std::string levelHeader( "id, objectid, mapid, x, y, z, yaw, radius, type, zone, " );
|
||||
static std::string header( levelHeader + "mapZoneIdx, hierarchy, path, size, discoveryIdx, discoveryCompleteBitmask \n" );
|
||||
outfile.write( header.c_str(), header.size() );
|
||||
|
||||
static auto& rows = exd.get_rows();
|
||||
for( auto& row : rows )
|
||||
{
|
||||
auto id = row.first;
|
||||
auto& fields = row.second;
|
||||
auto x = *boost::get< float >( &fields.at( 0 ) );
|
||||
auto y = *boost::get< float >( &fields.at( 1 ) );
|
||||
auto z = *boost::get< float >( &fields.at( 2 ) );
|
||||
auto yaw = *boost::get< float >( &fields.at( 3 ) );
|
||||
auto radius = *boost::get< float >( &fields.at( 4 ) );
|
||||
auto type = *boost::get< uint8_t >( &fields.at( 5 ) );
|
||||
auto objectid = *boost::get< uint32_t >( &fields.at( 6 ) );
|
||||
auto mapid = *boost::get< uint16_t >( &fields.at( 7 ) );
|
||||
auto zone = *boost::get< uint16_t >( &fields.at( 9 ) );
|
||||
|
||||
if( zone == zoneId )
|
||||
{
|
||||
std::string outStr(
|
||||
std::to_string( id ) + ", " + std::to_string( objectid ) + ", " + std::to_string( mapid ) + ", " +
|
||||
std::to_string( x ) + ", " + std::to_string( y ) + ", " + std::to_string( z ) + ", " +
|
||||
std::to_string( yaw ) + ", " + std::to_string( radius ) + ", " + std::to_string( type ) + ", " + std::to_string( zone ) + ", " +
|
||||
getMapExdEntries( mapid ) + "\n"
|
||||
);
|
||||
outfile.write( outStr.c_str(), outStr.size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string zoneNameToPath( const std::string& name )
|
||||
{
|
||||
std::string path;
|
||||
bool found = false;
|
||||
|
||||
#ifdef STANDALONE
|
||||
auto inFile = std::ifstream( "territorytype.exh.csv" );
|
||||
if( inFile.good() )
|
||||
{
|
||||
std::string line;
|
||||
std::regex re( "(\\d+),\"(.*)\",\"(.*)\",.*" );
|
||||
while( std::getline( inFile, line ) )
|
||||
{
|
||||
std::smatch match;
|
||||
if( std::regex_match( line, match, re )
|
||||
{
|
||||
auto tmpId = std::stoul( match[1].str() );
|
||||
if( !found && name == match[2].str() )
|
||||
{
|
||||
zoneId = tmpId;
|
||||
path = match[3].str();
|
||||
found = true;
|
||||
}
|
||||
zoneNameMap[tmpId] = match[2].str();
|
||||
}
|
||||
}
|
||||
inFile.close();
|
||||
}
|
||||
#else
|
||||
|
||||
static auto& cat = eData->get_category( "TerritoryType" );
|
||||
static auto exd = static_cast< xiv::exd::Exd >( cat.get_data_ln( xiv::exd::Language::none ) );
|
||||
static auto& rows = exd.get_rows();
|
||||
for( auto& row : rows )
|
||||
{
|
||||
auto& fields = row.second;
|
||||
auto teriName = *boost::get< std::string >( &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
|
||||
if( teriName.empty() )
|
||||
continue;
|
||||
auto teriPath = *boost::get< std::string >( &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
|
||||
if( !found && boost::iequals( name, teriName ) )
|
||||
{
|
||||
path = teriPath;
|
||||
found = true;
|
||||
zoneId = row.first;
|
||||
}
|
||||
zoneNameMap[row.first] = teriName;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( found )
|
||||
{
|
||||
//path = path.substr( path.find_first_of( "/" ) + 1, path.size() - path.find_first_of( "/" ));
|
||||
//path = std::string( "ffxiv/" ) + path;
|
||||
path = std::string( "bg/" ) + path.substr( 0, path.find( "/level/" ) );
|
||||
std::cout << "[Info] " << "Found path for " << name << ": " << path << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error( "Unable to find path for " + name +
|
||||
".\n\tPlease double check spelling or open 0a0000.win32.index with FFXIV Explorer and extract territorytype.exh as CSV\n\tand copy territorytype.exh.csv into pcb_reader.exe directory if using standalone" );
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void loadEobjNames()
|
||||
{
|
||||
static auto& cat = eData->get_category( "EObjName" );
|
||||
static auto exd = static_cast< xiv::exd::Exd >( cat.get_data_ln( xiv::exd::Language::en ) );
|
||||
for( auto& row : exd.get_rows() )
|
||||
{
|
||||
auto id = row.first;
|
||||
auto& fields = row.second;
|
||||
auto name = *boost::get< std::string >( &fields.at( 0 ) );
|
||||
eobjNameMap[id] = name;
|
||||
}
|
||||
}
|
||||
|
||||
void writeEobjEntry( std::ofstream& out, LGB_ENTRY* pObj )
|
||||
{
|
||||
static std::string mapRangeStr( "\"MapRange\", " );
|
||||
static std::ofstream discoverySql( "discovery.sql" , std::ios::app );
|
||||
uint32_t id;
|
||||
uint32_t unknown = 0, unknown2 = 0;
|
||||
std::string name;
|
||||
std::string typeStr;
|
||||
uint32_t eobjlevelHierachyId = 0;
|
||||
|
||||
auto pMapRange = reinterpret_cast< LGB_MAPRANGE_ENTRY* >( pObj );
|
||||
id = pMapRange->header.unknown;
|
||||
unknown = pMapRange->header.unknown2;
|
||||
unknown2 = pMapRange->header.unknown3;
|
||||
typeStr = mapRangeStr;
|
||||
|
||||
// discovery shit
|
||||
vec2 pos;
|
||||
auto subArea = -1;
|
||||
auto mapId = -1;
|
||||
|
||||
bool found = false;
|
||||
auto it = discoveryMaps.find( zoneId );
|
||||
if( it != discoveryMaps.end() )
|
||||
{
|
||||
auto map = it->second;
|
||||
pos = map.get2dPosFrom3d( pObj->header.translation.x, pObj->header.translation.z );
|
||||
mapId = map.mapId;
|
||||
|
||||
//std::cout << "3d coords " << pObj->header.translation.x << " " << pObj->header.translation.z << "\n";
|
||||
//std::cout << "2d coords " << pos.x << " " << pos.y << "\n";
|
||||
for( auto i = 0; i < map.tiles; ++i )
|
||||
{
|
||||
auto colour = map.getColour( i, pos.x, pos.y );
|
||||
|
||||
auto r = ( colour >> 16 ) & 0xFF;
|
||||
auto g = ( colour >> 8 ) & 0xFF;
|
||||
auto b = ( colour >> 0 ) & 0xFF;
|
||||
|
||||
//std::cout << "R " << r << " G " << g << " B " << b << "\n";
|
||||
|
||||
if( ( found = ( r != 0 || g != 0 || b != 0 ) ) )
|
||||
{
|
||||
if( r != 0 )
|
||||
{
|
||||
// out of bounds
|
||||
if( i == 0 )
|
||||
break;
|
||||
subArea = i * 3 + 1;
|
||||
}
|
||||
else if( g != 0 )
|
||||
{
|
||||
subArea = i * 3 + 2;
|
||||
}
|
||||
else if( b != 0 )
|
||||
{
|
||||
subArea = i * 3 + 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
subArea--;
|
||||
|
||||
if( subArea == -2 || mapId == -1 )
|
||||
{
|
||||
if( it != discoveryMaps.end() )
|
||||
{
|
||||
auto map = it->second;
|
||||
pos = map.get2dPosFrom3d( pObj->header.translation.x, pObj->header.translation.z );
|
||||
mapId = map.mapId;
|
||||
|
||||
//std::cout << "3d coords " << pObj->header.translation.x << " " << pObj->header.translation.z << "\n";
|
||||
//std::cout << "2d coords " << pos.x << " " << pos.y << "\n";
|
||||
for( auto i = 0; i < map.tiles; ++i )
|
||||
{
|
||||
auto colour = map.getColour( i, pos.x, pos.y );
|
||||
|
||||
auto r = ( colour >> 16 ) & 0xFF;
|
||||
auto g = ( colour >> 8 ) & 0xFF;
|
||||
auto b = ( colour >> 0 ) & 0xFF;
|
||||
|
||||
//std::cout << "R " << r << " G " << g << " B " << b << "\n";
|
||||
|
||||
if( ( found = ( r != 0 || g != 0 || b != 0 ) ) )
|
||||
{
|
||||
if( r != 0 )
|
||||
{
|
||||
// out of bounds
|
||||
if( i == 0 )
|
||||
break;
|
||||
//subArea = i * 3 + 1;
|
||||
}
|
||||
else if( g != 0 )
|
||||
{
|
||||
// subArea = i * 3 + 2;
|
||||
}
|
||||
else if( b != 0 )
|
||||
{
|
||||
// subArea = i * 3 + 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "\tUnable to find subarea for maprange " << std::to_string( id ) << "\n";
|
||||
return;
|
||||
}
|
||||
std::string outStr( "INSERT INTO discoveryinfo VALUES (" +
|
||||
std::to_string( id ) + ", " + std::to_string( mapId ) + ", " + std::to_string( subArea ) + ");\n"
|
||||
//std::to_string( pObj->header.translation.x ) + ", " + std::to_string( pObj->header.translation.y ) + ", " + std::to_string( pObj->header.translation.z ) +
|
||||
//", " + std::to_string( subArea ) + "" + "\n"
|
||||
);
|
||||
discoverySql.write( outStr.c_str(), outStr.size() );
|
||||
//out.write( outStr.c_str(), outStr.size() );
|
||||
}
|
||||
|
||||
void readFileToBuffer( const std::string& path, std::vector< char >& buf )
|
||||
{
|
||||
auto inFile = std::ifstream( path, std::ios::binary );
|
||||
if( inFile.good() )
|
||||
{
|
||||
inFile.seekg( 0, inFile.end );
|
||||
int32_t fileSize = (int32_t)inFile.tellg();
|
||||
buf.resize( fileSize );
|
||||
inFile.seekg( 0, inFile.beg );
|
||||
inFile.read( &buf[0], fileSize );
|
||||
inFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error( "Unable to open " + path );
|
||||
}
|
||||
}
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
auto startTime = std::chrono::system_clock::now();
|
||||
auto entryStartTime = std::chrono::system_clock::now();
|
||||
|
||||
std::vector< std::string > argVec( argv + 1, argv + argc );
|
||||
// todo: support expansions
|
||||
std::string zoneName = "f1f1";
|
||||
|
||||
bool dumpAll = ignoreModels = std::remove_if( argVec.begin(), argVec.end(), []( auto arg ){ return arg == "--dump-all"; } ) != argVec.end();
|
||||
dumpAll = true;
|
||||
ignoreModels = false;
|
||||
if( argc > 1 )
|
||||
{
|
||||
zoneName = argv[1];
|
||||
if( argc > 2 )
|
||||
{
|
||||
std::string tmpPath( argv[2] );
|
||||
if( !tmpPath.empty() )
|
||||
gamePath = argv[2];
|
||||
}
|
||||
}
|
||||
|
||||
initExd( gamePath );
|
||||
std::ofstream discoverySql( "discovery.sql", std::ios::trunc );
|
||||
discoverySql.close();
|
||||
|
||||
if( dumpAll )
|
||||
{
|
||||
zoneNameToPath( "f1t1" );
|
||||
|
||||
for( const auto& zone : zoneNameMap )
|
||||
zoneDumpList.emplace( zone.second );
|
||||
}
|
||||
else
|
||||
{
|
||||
zoneDumpList.emplace( zoneName );
|
||||
}
|
||||
|
||||
LABEL_DUMP:
|
||||
entryStartTime = std::chrono::system_clock::now();
|
||||
zoneName = *zoneDumpList.begin();
|
||||
try
|
||||
{
|
||||
const auto& zonePath = zoneNameToPath( zoneName );
|
||||
|
||||
std::string listPcbPath( zonePath + "/collision/list.pcb" );
|
||||
std::string bgLgbPath( zonePath + "/level/bg.lgb" );
|
||||
std::string planmapLgbPath( zonePath + "/level/planmap.lgb" );
|
||||
std::string collisionFilePath( zonePath + "/collision/" );
|
||||
std::vector< char > section;
|
||||
std::vector< char > section1;
|
||||
std::vector< char > section2;
|
||||
|
||||
#ifndef STANDALONE
|
||||
const xiv::dat::Cat& test = data1->getCategory( "bg" );
|
||||
|
||||
auto test_file = data1->getFile( bgLgbPath );
|
||||
section = test_file->access_data_sections().at( 0 );
|
||||
|
||||
auto planmap_file = data1->getFile( planmapLgbPath );
|
||||
section2 = planmap_file->access_data_sections().at( 0 );
|
||||
|
||||
auto test_file1 = data1->getFile( listPcbPath );
|
||||
section1 = test_file1->access_data_sections().at( 0 );
|
||||
#else
|
||||
{
|
||||
readFileToBuffer( bgLgbPath, section );
|
||||
readFileToBuffer( listPcbPath, section1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector< std::string > stringList;
|
||||
|
||||
uint32_t offset1 = 0x20;
|
||||
|
||||
loadEobjNames();
|
||||
dumpLevelExdEntries( zoneId, zoneName );
|
||||
std::string eobjFileName( zoneName + "_eobj.csv" );
|
||||
std::ofstream eobjOut( eobjFileName, std::ios::trunc );
|
||||
if( !eobjOut.good() )
|
||||
throw std::string( "Unable to create " + zoneName + "_eobj.csv for eobj entries. Run as admin or check there isnt already a handle on the file." ).c_str();
|
||||
|
||||
eobjOut.close();
|
||||
eobjOut.open( eobjFileName, std::ios::app );
|
||||
|
||||
if( !eobjOut.good() )
|
||||
throw std::string( "Unable to create " + zoneName + "_eobj.csv for eobj entries. Run as admin or check there isnt already a handle on the file." ).c_str();
|
||||
|
||||
if( 0 )
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
|
||||
uint16_t trId = *(uint16_t*)§ion1[offset1];
|
||||
|
||||
char someString[200];
|
||||
sprintf( someString, "%str%04d.pcb", collisionFilePath.c_str(), trId );
|
||||
stringList.push_back( std::string( someString ) );
|
||||
//std::cout << someString << "\n";
|
||||
offset1 += 0x20;
|
||||
|
||||
if( offset1 >= section1.size() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
LGB_FILE bgLgb( §ion[0], "bg" );
|
||||
LGB_FILE planmapLgb( §ion2[0], "planmap" );
|
||||
|
||||
std::vector< LGB_FILE > lgbList { bgLgb, planmapLgb };
|
||||
uint32_t max_index = 0;
|
||||
|
||||
// dont bother if we cant write to a file
|
||||
FILE* fp_out = nullptr;
|
||||
//auto fp_out = ignoreModels ? ( FILE* )nullptr : fopen( ( zoneName + ".obj" ).c_str(), "w" );
|
||||
if( fp_out )
|
||||
{
|
||||
fprintf( fp_out, "\n" );
|
||||
fclose( fp_out );
|
||||
}
|
||||
else if( /*!ignoreModels*/ false )
|
||||
{
|
||||
std::string errorMessage( "Cannot create " + zoneName + ".obj\n" +
|
||||
" Check no programs have a handle to file and run as admin.\n" );
|
||||
std::cout << errorMessage;
|
||||
throw std::runtime_error( errorMessage.c_str() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
std::map< std::string, PCB_FILE > pcbFiles;
|
||||
std::map< std::string, SGB_FILE > sgbFiles;
|
||||
std::map< std::string, uint32_t > objCount;
|
||||
auto loadPcbFile = [&]( const std::string& fileName ) -> bool
|
||||
{
|
||||
if( ignoreModels )
|
||||
return false;
|
||||
try
|
||||
{
|
||||
if( fileName.find( '.' ) == std::string::npos )
|
||||
return false;
|
||||
else if( fileName.substr( fileName.find_last_of( '.' ) ) != ".pcb" )
|
||||
throw std::runtime_error( "Not a PCB file." );
|
||||
|
||||
char* dataSection = nullptr;
|
||||
//std::cout << fileName << " ";
|
||||
#ifndef STANDALONE
|
||||
auto file = data1->getFile( fileName );
|
||||
auto sections = file->get_data_sections();
|
||||
dataSection = §ions.at( 0 )[0];
|
||||
#else
|
||||
std::vector< char > buf;
|
||||
readFileToBuffer( fileName, buf );
|
||||
dataSection = &buf[0];
|
||||
#endif
|
||||
//std::cout << sections.size() << "\n";
|
||||
|
||||
uint32_t offset = 0;
|
||||
PCB_FILE pcb_file;
|
||||
memcpy( &pcb_file.header, &dataSection[0], sizeof( pcb_file.header ) );
|
||||
offset += sizeof( pcb_file.header );
|
||||
pcb_file.entries.resize( pcb_file.header.num_entries );
|
||||
bool isgroup = true;
|
||||
while( isgroup )
|
||||
{
|
||||
PCB_BLOCK_ENTRY block_entry;
|
||||
memcpy( &block_entry.header, &dataSection[0] + offset, sizeof( block_entry.header ) );
|
||||
isgroup = block_entry.header.type == 0x30;
|
||||
|
||||
//printf( "BLOCKHEADER_%X: type: %i, group_size: %i\n", offset, block_entry.header.type, block_entry.header.group_size );
|
||||
//
|
||||
if( isgroup )
|
||||
{
|
||||
parseBlockEntry( &dataSection[0] + offset + 0x30, pcb_file.entries, offset );
|
||||
offset += block_entry.header.group_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
parseBlockEntry( &dataSection[0] + offset, pcb_file.entries, offset );
|
||||
}
|
||||
}
|
||||
pcbFiles.insert( std::make_pair( fileName, pcb_file ) );
|
||||
return true;
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cout << "[Error] " << "Unable to load collision mesh " << fileName << "\n\tError:\n\t" << e.what() << "\n";
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
auto loadSgbFile = [&]( const std::string& fileName ) -> bool
|
||||
{
|
||||
SGB_FILE sgbFile;
|
||||
try
|
||||
{
|
||||
char* dataSection = nullptr;
|
||||
//std::cout << fileName << " ";
|
||||
#ifndef STANDALONE
|
||||
auto file = data1->getFile( fileName );
|
||||
auto sections = file->get_data_sections();
|
||||
dataSection = §ions.at( 0 )[0];
|
||||
#else
|
||||
std::vector< char > buf;
|
||||
readFileToBuffer( fileName, buf );
|
||||
dataSection = &buf[0];
|
||||
#endif
|
||||
sgbFile = SGB_FILE( &dataSection[0] );
|
||||
sgbFiles.insert( std::make_pair( fileName, sgbFile ) );
|
||||
return true;
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cout << "[Error] " << "Unable to load SGB " << fileName << "\n\tError:\n\t" << e.what() << "\n";
|
||||
sgbFiles.insert( std::make_pair( fileName, sgbFile ) );
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
{
|
||||
for( const auto& fileName : stringList )
|
||||
{
|
||||
loadPcbFile( fileName );
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "[Info] " << ( ignoreModels ? "Dumping MapRange and EObj" : "Writing obj file " ) << "\n";
|
||||
uint32_t totalGroups = 0;
|
||||
uint32_t totalGroupEntries = 0;
|
||||
|
||||
for( const auto& lgb : lgbList )
|
||||
{
|
||||
for( const auto& group : lgb.groups )
|
||||
{
|
||||
//std::cout << "\t" << group.name << " Size " << group.header.entryCount << "\n";
|
||||
totalGroups++;
|
||||
for( const auto& pEntry : group.entries )
|
||||
{
|
||||
auto pGimmick = dynamic_cast< LGB_GIMMICK_ENTRY* >( pEntry.get() );
|
||||
auto pBgParts = dynamic_cast< LGB_BGPARTS_ENTRY* >( pEntry.get() );
|
||||
|
||||
std::string fileName( "" );
|
||||
fileName.resize( 256 );
|
||||
totalGroupEntries++;
|
||||
|
||||
if( pEntry->getType() == LgbEntryType::MapRange )
|
||||
{
|
||||
writeEobjEntry( eobjOut, pEntry.get() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "[Info] " << "Loaded " << pcbFiles.size() << " PCB Files \n";
|
||||
std::cout << "[Info] " << "Total Groups " << totalGroups << " Total entries " << totalGroupEntries << "\n";
|
||||
}
|
||||
std::cout << "[Success] " << "Exported " << zoneName << " in " <<
|
||||
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::system_clock::now() - entryStartTime ).count() << " seconds\n";
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cout << "[Error] " << e.what() << std::endl;
|
||||
std::cout << "[Error] " << "Unable to extract collision data.\n\tIf using standalone ensure your working directory folder layout is \n\tbg/[ffxiv|ex1|ex2]/teri/type/zone/[level|collision]" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "[Info] " << "Usage: pcb_reader2 territory \"path/to/game/sqpack/ffxiv\" " << std::endl;
|
||||
}
|
||||
std::cout << "\n\n\n";
|
||||
LABEL_NEXT_ZONE_ENTRY:
|
||||
zoneDumpList.erase( zoneName );
|
||||
if( !zoneDumpList.empty() )
|
||||
goto LABEL_DUMP;
|
||||
|
||||
std::cout << "\n\n\n[Success] Finished all tasks in " <<
|
||||
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::system_clock::now() - startTime ).count() << " seconds\n";
|
||||
|
||||
getchar();
|
||||
|
||||
if( eData )
|
||||
delete eData;
|
||||
if( data1 )
|
||||
delete data1;
|
||||
return 0;
|
||||
}
|
100
src/tools/discovery_parser/matrix4.h
Normal file
100
src/tools/discovery_parser/matrix4.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
#ifndef _MATRIX4_H
|
||||
#define _MATRIX4_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
|
||||
// https://github.com/jpd002/Play--Framework/tree/master/include/math
|
||||
struct matrix4
|
||||
{
|
||||
// 4x4
|
||||
float grid[16];
|
||||
matrix4()
|
||||
{
|
||||
memset( &grid[0], 0, sizeof( grid ) );
|
||||
}
|
||||
|
||||
float operator()( int row, int col ) const
|
||||
{
|
||||
return grid[(row * 4) + col];
|
||||
}
|
||||
|
||||
float& operator()( int row, int col )
|
||||
{
|
||||
return grid[(row * 4) + col];
|
||||
}
|
||||
static matrix4 rotateX( float angle )
|
||||
{
|
||||
matrix4 ret = matrix4();
|
||||
ret(0, 0) = 1.000000000f;
|
||||
ret(1, 1) = cos(angle);
|
||||
ret(1, 2) = -sin(angle);
|
||||
ret(2, 1) = sin(angle);
|
||||
ret(2, 2) = cos(angle);
|
||||
ret(3, 3) = 1.000000000f;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static matrix4 rotateY( float angle )
|
||||
{
|
||||
matrix4 ret = matrix4();
|
||||
ret(0, 0) = cos(angle);
|
||||
ret(0, 2) = sin(angle);
|
||||
ret(1, 1) = 1.000000000f;
|
||||
ret(2, 0) = -sin(angle);
|
||||
ret(2, 2) = cos(angle);
|
||||
ret(3, 3) = 1.000000000f;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static matrix4 rotateZ( float angle )
|
||||
{
|
||||
matrix4 ret = matrix4();
|
||||
ret(0, 0) = cos(angle);
|
||||
ret(0, 1) = -sin(angle);
|
||||
ret(1, 0) = sin(angle);
|
||||
ret(1, 1) = cos(angle);
|
||||
ret(2, 2) = 1.000000000f;
|
||||
ret(3, 3) = 1.000000000f;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static matrix4 scale( float x, float y, float z )
|
||||
{
|
||||
matrix4 ret = matrix4();
|
||||
ret(0, 0) = x;
|
||||
ret(1, 1) = y;
|
||||
ret(2, 2) = z;
|
||||
ret(3, 3) = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static matrix4 translate( float x, float y, float z )
|
||||
{
|
||||
matrix4 ret = matrix4();
|
||||
ret(0, 0) = 1;
|
||||
ret(1, 1) = 1;
|
||||
ret(2, 2) = 1;
|
||||
ret(3, 3) = 1;
|
||||
|
||||
ret(3, 0) = x;
|
||||
ret(3, 1) = y;
|
||||
ret(3, 2) = z;
|
||||
return ret;
|
||||
}
|
||||
|
||||
matrix4 operator *( const matrix4& rhs ) const
|
||||
{
|
||||
matrix4 ret;
|
||||
for( unsigned int i = 0; i < 4; i++ )
|
||||
{
|
||||
ret( i, 0 ) = (*this)(i, 0) * rhs( 0, 0 ) + (*this)(i, 1) * rhs( 1, 0 ) + (*this)(i, 2) * rhs( 2, 0 ) + (*this)(i, 3) * rhs( 3, 0 );
|
||||
ret( i, 1 ) = (*this)(i, 0) * rhs( 0, 1 ) + (*this)(i, 1) * rhs( 1, 1 ) + (*this)(i, 2) * rhs( 2, 1 ) + (*this)(i, 3) * rhs( 3, 1 );
|
||||
ret( i, 2 ) = (*this)(i, 0) * rhs( 0, 2 ) + (*this)(i, 1) * rhs( 1, 2 ) + (*this)(i, 2) * rhs( 2, 2 ) + (*this)(i, 3) * rhs( 3, 2 );
|
||||
ret( i, 3 ) = (*this)(i, 0) * rhs( 0, 3 ) + (*this)(i, 1) * rhs( 1, 3 ) + (*this)(i, 2) * rhs( 2, 3 ) + (*this)(i, 3) * rhs( 3, 3 );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
#endif
|
92
src/tools/discovery_parser/pcb.h
Normal file
92
src/tools/discovery_parser/pcb.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
#ifndef _PCB_H
|
||||
#define _PCB_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
struct PCB_HEADER
|
||||
{
|
||||
uint32_t unknown_1;
|
||||
uint32_t unknown_2;
|
||||
uint32_t num_entries; // count starts at 0
|
||||
uint32_t total_indices;
|
||||
uint64_t padding;
|
||||
};
|
||||
|
||||
struct PCB_BLOCK_HEADER
|
||||
{
|
||||
uint32_t type; // 0 for entry, 0x30 for group
|
||||
uint32_t group_size; // when group size in bytes for the group block
|
||||
// bounding box
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float x1;
|
||||
float y1;
|
||||
float z1;
|
||||
// number of vertices packed into 16 bit
|
||||
uint16_t num_v16;
|
||||
// number of indices
|
||||
uint16_t num_indices;
|
||||
// number of normal floar vertices
|
||||
uint32_t num_vertices;
|
||||
};
|
||||
|
||||
struct PCB_VERTEXDATA
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
struct PCB_INDEXDATA
|
||||
{
|
||||
uint8_t index[3];
|
||||
uint8_t unknown[3];
|
||||
uint8_t unknown1[6];
|
||||
};
|
||||
|
||||
struct PCB_VERTEXDATAI16
|
||||
{
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t z;
|
||||
};
|
||||
|
||||
struct PCB_BLOCK_DATA
|
||||
{
|
||||
std::vector< PCB_VERTEXDATA > vertices;
|
||||
std::vector< PCB_VERTEXDATAI16 > vertices_i16;
|
||||
std::vector< PCB_INDEXDATA > indices;
|
||||
};
|
||||
|
||||
struct PCB_BLOCK_ENTRY
|
||||
{
|
||||
PCB_BLOCK_HEADER header;
|
||||
PCB_BLOCK_DATA data;
|
||||
};
|
||||
|
||||
struct PCB_FILE
|
||||
{
|
||||
PCB_HEADER header;
|
||||
std::vector< PCB_BLOCK_ENTRY > entries;
|
||||
};
|
||||
|
||||
struct PCB_LIST_ENTRY
|
||||
{
|
||||
uint32_t id;
|
||||
float x, y, z, x2, y2, z2, rot;
|
||||
};
|
||||
|
||||
struct PCB_LIST_BASE_ENTRY
|
||||
{
|
||||
float x, y, z, x2, y2, z2, rot;
|
||||
};
|
||||
|
||||
struct PCB_LIST_FILE
|
||||
{
|
||||
uint32_t count;
|
||||
PCB_LIST_BASE_ENTRY entry;
|
||||
std::vector<PCB_LIST_ENTRY> entries;
|
||||
};
|
||||
#endif
|
213
src/tools/discovery_parser/sgb.h
Normal file
213
src/tools/discovery_parser/sgb.h
Normal file
|
@ -0,0 +1,213 @@
|
|||
#ifndef _SGB_H
|
||||
#define _SGB_H
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "vec3.h"
|
||||
|
||||
// garbage to skip model loading
|
||||
extern bool ignoreModels;
|
||||
|
||||
//
|
||||
// ported from https://github.com/ufx/SaintCoinach/blob/master/SaintCoinach/Graphics/Sgb/SgbDataType.cs
|
||||
|
||||
struct SGB_FILE;
|
||||
struct SGB_HEADER;
|
||||
struct SGB_MODEL_ENTRY;
|
||||
struct SGB_MODEL_HEADER;
|
||||
struct SGB_GROUP;
|
||||
struct SGB_GROUP_HEADER;
|
||||
|
||||
|
||||
enum SgbDataType : uint32_t
|
||||
{
|
||||
Unknown0008 = 0x0008,
|
||||
Group = 0x0100,
|
||||
};
|
||||
|
||||
enum SgbGroupEntryType : uint32_t
|
||||
{
|
||||
Model = 0x01,
|
||||
};
|
||||
|
||||
struct SGB_GROUP_HEADER
|
||||
{
|
||||
SgbDataType type;
|
||||
int32_t nameOffset;
|
||||
uint32_t unknown08;
|
||||
uint32_t unknown0C;
|
||||
|
||||
uint32_t unknown10;
|
||||
uint32_t unknown14;
|
||||
uint32_t unknown18;
|
||||
uint32_t unknown1C;
|
||||
|
||||
int32_t entryCount;
|
||||
uint32_t unknown24;
|
||||
uint32_t unknown28;
|
||||
uint32_t unknown2C;
|
||||
|
||||
uint32_t unknown30;
|
||||
uint32_t unknown34;
|
||||
uint32_t unknown38;
|
||||
uint32_t unknown3C;
|
||||
|
||||
uint32_t unknown40;
|
||||
uint32_t unknown44;
|
||||
};
|
||||
|
||||
struct SGB_GROUP_ENTRY
|
||||
{
|
||||
public:
|
||||
char* m_buf;
|
||||
uint32_t m_offset;
|
||||
|
||||
SGB_GROUP_ENTRY()
|
||||
{
|
||||
m_buf = nullptr;
|
||||
m_offset = 0;
|
||||
};
|
||||
SGB_GROUP_ENTRY( char* buf, uint32_t offset )
|
||||
{
|
||||
m_buf = buf;
|
||||
m_offset = offset;
|
||||
};
|
||||
virtual ~SGB_GROUP_ENTRY() {};
|
||||
};
|
||||
|
||||
struct SGB_ENTRY_HEADER
|
||||
{
|
||||
SgbGroupEntryType type;
|
||||
uint32_t unknown2;
|
||||
int32_t nameOffset;
|
||||
vec3 translation;
|
||||
vec3 rotation;
|
||||
vec3 scale;
|
||||
};
|
||||
|
||||
struct SGB_MODEL_HEADER : public SGB_ENTRY_HEADER
|
||||
{
|
||||
int32_t modelFileOffset;
|
||||
int32_t collisionFileOffset;
|
||||
};
|
||||
|
||||
struct SGB_MODEL_ENTRY : public SGB_GROUP_ENTRY
|
||||
{
|
||||
SGB_MODEL_HEADER header;
|
||||
SgbGroupEntryType type;
|
||||
std::string name;
|
||||
std::string modelFileName;
|
||||
std::string collisionFileName;
|
||||
|
||||
SGB_MODEL_ENTRY( char* buf, uint32_t offset )
|
||||
{
|
||||
header = *reinterpret_cast< SGB_MODEL_HEADER* >( buf + offset );
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
modelFileName = std::string( buf + offset + header.modelFileOffset );
|
||||
collisionFileName = std::string( buf + offset + header.collisionFileOffset );
|
||||
}
|
||||
};
|
||||
|
||||
struct SGB_GROUP
|
||||
{
|
||||
SGB_GROUP_HEADER header;
|
||||
std::string name;
|
||||
SGB_FILE* parent;
|
||||
std::vector< std::shared_ptr< SGB_GROUP_ENTRY > > entries;
|
||||
|
||||
SGB_GROUP( char* buf, SGB_FILE* file, uint32_t fileSize, uint32_t offset )
|
||||
{
|
||||
parent = file;
|
||||
header = *reinterpret_cast< SGB_GROUP_HEADER* >( buf + offset );
|
||||
name = std::string( buf + offset + header.nameOffset );
|
||||
|
||||
auto entriesOffset = offset + sizeof( header );
|
||||
|
||||
for( auto i = 0; i < header.entryCount; ++i )
|
||||
{
|
||||
auto entryOffset = entriesOffset + *reinterpret_cast< uint32_t* >( buf + ( entriesOffset + ( i * 4 ) ) );
|
||||
if( entryOffset > fileSize )
|
||||
throw std::runtime_error( "SGB_GROUP entry offset was larger than SGB file size!" );
|
||||
auto type = *reinterpret_cast< uint32_t* >( buf + entryOffset );
|
||||
if( type == SgbGroupEntryType::Model && !ignoreModels )
|
||||
{
|
||||
entries.push_back( std::make_shared< SGB_MODEL_ENTRY >( buf, entryOffset ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// std::cout << "\t\tUnknown SGB entry! Group: " << name << " type: " << type << " index: " << i << " entryOffset: " << entryOffset << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct SGB_HEADER
|
||||
{
|
||||
char magic[4]; // SGB1
|
||||
uint32_t fileSize;
|
||||
uint32_t unknown1;
|
||||
char magic2[4]; // SCN1
|
||||
|
||||
uint32_t unknown10;
|
||||
int32_t sharedOffset;
|
||||
uint32_t unknown18;
|
||||
int32_t offset1C;
|
||||
|
||||
uint32_t unknown20;
|
||||
uint32_t unknown24;
|
||||
uint32_t unknown28;
|
||||
uint32_t unknown2C;
|
||||
|
||||
uint32_t unknown30;
|
||||
uint32_t unknown34;
|
||||
uint32_t unknown38;
|
||||
uint32_t unknown3C;
|
||||
|
||||
uint32_t unknown40;
|
||||
uint32_t unknown44;
|
||||
uint32_t unknown48;
|
||||
uint32_t unknown4C;
|
||||
|
||||
uint32_t unknown50;
|
||||
uint32_t unknown54;
|
||||
};
|
||||
|
||||
struct SGB_FILE
|
||||
{
|
||||
SGB_HEADER header;
|
||||
std::vector<SGB_GROUP> entries;
|
||||
|
||||
SGB_FILE()
|
||||
{
|
||||
memset( &header, 0, sizeof( header ) );
|
||||
}
|
||||
SGB_FILE( char* buf )
|
||||
{
|
||||
constexpr int baseOffset = 0x14;
|
||||
header = *reinterpret_cast< SGB_HEADER* >( buf );
|
||||
|
||||
if( strncmp( &header.magic[0], "SGB1", 4 ) != 0 || strncmp( &header.magic2[0], "SCN1", 4 ) != 0 )
|
||||
throw std::runtime_error( "Unable to load SGB File!" );
|
||||
|
||||
try
|
||||
{
|
||||
auto group = SGB_GROUP( buf, this, header.fileSize, baseOffset + header.sharedOffset );
|
||||
entries.push_back( group );
|
||||
auto group2 = SGB_GROUP( buf, this, header.fileSize, baseOffset + header.offset1C );
|
||||
entries.push_back( group2 );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cout << e.what() << "\n";
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif // !_SGB_H
|
65
src/tools/discovery_parser/tex.h
Normal file
65
src/tools/discovery_parser/tex.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#ifndef _TEX_H
|
||||
#define _TEX_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
// ported Ioncannon's tex file parsing
|
||||
// https://bitbucket.org/Ioncannon/ffxiv-explorer/src/9330429c1540cf35f947fe7321739d857f4f31a7/src/com/fragmenterworks/ffxivextract/models/Texture_File.java
|
||||
|
||||
struct TEX_HEADER
|
||||
{
|
||||
uint32_t unknown; // 00
|
||||
uint16_t compressionType; // 04
|
||||
uint16_t unknown2; // 06
|
||||
uint16_t uncompressedWidth; // 08
|
||||
uint16_t uncompressedHeight; // 0A
|
||||
uint16_t unknown5; // 0C
|
||||
uint16_t numMipMaps; // 0F
|
||||
uint16_t unknown4[0x0B]; // 11 - 0x1C
|
||||
std::vector< uint32_t > mipMaps;
|
||||
};
|
||||
|
||||
struct TEX_FILE
|
||||
{
|
||||
std::string name;
|
||||
TEX_HEADER header;
|
||||
std::vector< char > data;
|
||||
|
||||
TEX_FILE( const std::string& path )
|
||||
{
|
||||
name = path;
|
||||
std::ifstream in( path, std::ios::binary );
|
||||
if ( in.good() )
|
||||
{
|
||||
std::size_t size = 0;
|
||||
in.seekg( 0, in.end );
|
||||
size = in.tellg();
|
||||
in.seekg( 0, in.beg );
|
||||
data.resize( size );
|
||||
in.read( &data[0], size );
|
||||
|
||||
header = *reinterpret_cast< TEX_HEADER* >( &data[0] );
|
||||
|
||||
header.mipMaps.clear();
|
||||
|
||||
for( auto i = 0; i < header.numMipMaps; ++i)
|
||||
header.mipMaps.push_back( *reinterpret_cast< uint32_t* >( &data[0x1C + ( i * 4 )] ) );
|
||||
|
||||
std::cout << path << "\n\tcompressionType " << header.compressionType << " uncompressedWidth " <<
|
||||
header.uncompressedWidth << " uncompressedHeight " << header.uncompressedHeight << " numMipMaps " <<
|
||||
header.numMipMaps << " mipMaps " << header.mipMaps.size() << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string errorStr( "Unable to open " + path );
|
||||
throw std::runtime_error( errorStr.c_str() );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
250
src/tools/discovery_parser/tex_decode.h
Normal file
250
src/tools/discovery_parser/tex_decode.h
Normal file
|
@ -0,0 +1,250 @@
|
|||
#ifndef _TEX_DECODE_H
|
||||
#define _TEX_DECODE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "tex.h"
|
||||
|
||||
// all credit to Ioncannon
|
||||
// copied/pasted from https://bitbucket.org/Ioncannon/ffxiv-explorer/src/9330429c1540cf35f947fe7321739d857f4f31a7/src/com/fragmenterworks/ffxivextract/helpers/ImageDecoding.java
|
||||
|
||||
struct Colour
|
||||
{
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
Colour( int r, int g, int b, int a )
|
||||
{
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
this->a = a;
|
||||
}
|
||||
|
||||
uint32_t getRGB()
|
||||
{
|
||||
return ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b << 0 );
|
||||
}
|
||||
};
|
||||
|
||||
struct ImageHeader
|
||||
{
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
};
|
||||
|
||||
struct Image
|
||||
{
|
||||
uint32_t height, width;
|
||||
std::vector< std::vector< uint32_t > > data;
|
||||
|
||||
Image()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Image( int height, int width )
|
||||
{
|
||||
this->height = height;
|
||||
this->width = width;
|
||||
}
|
||||
|
||||
Image( char* buf )
|
||||
{
|
||||
height = *reinterpret_cast< uint32_t* >( buf + 0 );
|
||||
width = *reinterpret_cast< uint32_t* >( buf + 4 );
|
||||
data.resize( *reinterpret_cast< uint32_t* >( buf + 8 ) );
|
||||
|
||||
auto offset = 12;
|
||||
for( auto y = 0; y < data.size(); ++y )
|
||||
{
|
||||
auto row = *reinterpret_cast< uint32_t* >( buf + offset );
|
||||
auto entries = *reinterpret_cast< uint32_t* >( buf + offset + 4 );
|
||||
data[y].resize( entries );
|
||||
offset += 8;
|
||||
|
||||
for( auto x = 0; x < entries; ++x )
|
||||
data[y][x] = *reinterpret_cast< uint32_t* >( buf + offset + ( x * 4 ) );
|
||||
offset += entries * 4;
|
||||
}
|
||||
}
|
||||
|
||||
void toFile( const std::string& path )
|
||||
{
|
||||
std::ofstream out( path.c_str(), std::ios::trunc );
|
||||
out.close();
|
||||
out.open( path, std::ios::binary | std::ios::app );
|
||||
|
||||
out.write( reinterpret_cast< char* >( &height ), 4 ); // 0
|
||||
out.write( reinterpret_cast< char* >( &width ), 4 ); // 4
|
||||
|
||||
auto size = data.size();
|
||||
out.write( reinterpret_cast< char* >( &size ), 4 ); // 8
|
||||
|
||||
for( auto y = 0; y < data.size(); ++y )
|
||||
{
|
||||
out.write( reinterpret_cast< char* >( &y ), 4 );
|
||||
auto entries = data[y].size();
|
||||
out.write( reinterpret_cast< char* >( &entries ), 4);
|
||||
for( auto x = 0; x < data[y].size(); ++x )
|
||||
{
|
||||
out.write( reinterpret_cast< char* >( &data[y][x] ), 4 );
|
||||
}
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
void setRGB( unsigned int x, unsigned int y, uint32_t colour )
|
||||
{
|
||||
if( data.size() <= y )
|
||||
data.resize( y + 1 );
|
||||
if( data[y].size() <= x )
|
||||
data[y].resize( x + 1 );
|
||||
data[y][x] = colour;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
void DecompressBlockDTX1( int x, const int y, const int width, const int color0, const int color1, const int txl1, const int txl2, Image& img )
|
||||
{
|
||||
float temp = ((color0 >> 11) * 255.0f) + 16.0f;
|
||||
const float r0 = (((temp / 32.0f) + temp) / 32.0f);
|
||||
temp = (((color0 & 0x07E0) >> 5) * 255.0f) + 32.0f;
|
||||
const float g0 = (((temp / 64.0f) + temp) / 64.0f);
|
||||
temp = ((color0 & 0x001F) * 255.0f) + 16.0f;
|
||||
const float b0 = (((temp / 32.0f) + temp) / 32.0f);
|
||||
temp = ((color1 >> 11) * 255.0f) + 16.0f;
|
||||
const float r1 = (((temp / 32.0f) + temp) / 32.0f);
|
||||
temp = (((color1 & 0x07E0) >> 5) * 255.0f) + 32.0f;
|
||||
const float g1 = (((temp / 64.0f) + temp) / 64.0f);
|
||||
temp = ((color1 & 0x001F) * 255.0f) + 16.0f;
|
||||
const float b1 = (((temp / 32.0f) + temp) / 32.0f);
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// Color FinalColor;
|
||||
const int d = (4 * j) + i;
|
||||
int positionCode;
|
||||
if ((d * 2) >= 16) {
|
||||
positionCode = (txl2 >> ((d * 2) % 16)) & 0x03;
|
||||
} else {
|
||||
positionCode = (txl1 >> (d * 2)) & 0x03;
|
||||
}
|
||||
float fr, fg, fb, fa;
|
||||
if (color0 > color1) {
|
||||
switch (positionCode) {
|
||||
case 0: {
|
||||
fr = r0;
|
||||
fg = g0;
|
||||
fb = b0;
|
||||
fa = 0;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
fr = r1;
|
||||
fg = g1;
|
||||
fb = b1;
|
||||
fa = 0;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
fr = ((2.0f * (float) r0) + (float) r1) / 3.0f;
|
||||
fg = ((2.0f * (float) g0) + (float) g1) / 3.0f;
|
||||
fb = ((2.0f * (float) b0) + (float) b1) / 3.0f;
|
||||
fa = 0;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
fr = ((float) r0 + (2.0f * (float) r1)) / 3.0f;
|
||||
fg = ((float) g0 + (2.0f * (float) g1)) / 3.0f;
|
||||
fb = ((float) b0 + (2.0f * (float) b1)) / 3.0f;
|
||||
fa = 0;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
fr = 0;
|
||||
fg = 0;
|
||||
fb = 0;
|
||||
fa = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (positionCode) {
|
||||
case 0: {
|
||||
fr = r0;
|
||||
fg = g0;
|
||||
fb = b0;
|
||||
fa = 0xff;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
fr = r1;
|
||||
fg = g1;
|
||||
fb = b1;
|
||||
fa = 0xff;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
fr = ((float) r0 + (float) r1) / 2.0f;
|
||||
fg = ((float) g0 + (float) g1) / 2.0f;
|
||||
fb = ((float) b0 + (float) b1) / 2.0f;
|
||||
fa = 0xff;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
fr = 0;
|
||||
fg = 0;
|
||||
fb = 0;
|
||||
fa = 0xff;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
fr = 0;
|
||||
fg = 0;
|
||||
fb = 0;
|
||||
fa = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((x + i) < width) {
|
||||
int alpha = 0;
|
||||
if ((fr == fg) && (fr == fb) && (fr == 0)) {
|
||||
alpha = 0xff;
|
||||
}
|
||||
img.setRGB(x + i, y + j, Colour((int) fr, (int) fg, (int) fb, 255 - alpha).getRGB());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image DecodeTexDXT1( const TEX_FILE& tex, uint32_t offset, uint32_t targetHeight, uint32_t targetWidth,
|
||||
uint32_t compressedHeight, uint32_t compressedWidth )
|
||||
{
|
||||
if( offset > tex.data.size() )
|
||||
throw std::runtime_error( "Unable to decode TEX file " + tex.name + ": offset too large" );
|
||||
else if( tex.data.size() < ( ( targetHeight * targetWidth ) / 2 ) )
|
||||
throw std::runtime_error( "Unable to decode TEX file " + tex.name + ": data too small" );
|
||||
|
||||
std::vector< char > ret;
|
||||
auto data = tex.data.data() + offset;
|
||||
int pos = 0;
|
||||
|
||||
Image img( targetHeight, targetWidth );
|
||||
|
||||
for( int y = 0; y < compressedHeight; y++ )
|
||||
{
|
||||
for( int x = 0; x < compressedWidth; x++ )
|
||||
{
|
||||
const int t0 = *reinterpret_cast< const uint16_t* >( data + pos + 0 ) & 0xffff;
|
||||
const int t1 = *reinterpret_cast< const uint16_t* >( data + pos + 2 ) & 0xffff;
|
||||
const int t2 = *reinterpret_cast< const uint16_t* >( data + pos + 4 ) & 0xffff;
|
||||
const int t3 = *reinterpret_cast< const uint16_t* >( data + pos + 6 ) & 0xffff;
|
||||
|
||||
pos += 8;
|
||||
DecompressBlockDTX1( x * 4, y * 4, targetWidth, t0, t1, t2, t3, img );
|
||||
}
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
#endif
|
31
src/tools/discovery_parser/vec3.h
Normal file
31
src/tools/discovery_parser/vec3.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef _VEC3_H
|
||||
#define _VEC3_H
|
||||
|
||||
#include <cstdint>
|
||||
#include "matrix4.h"
|
||||
|
||||
struct vec3
|
||||
{
|
||||
float x, y, z;
|
||||
vec3()
|
||||
{
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
z = 0.0f;
|
||||
}
|
||||
vec3(float x, float y, float z)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
};
|
||||
};
|
||||
static vec3 operator *(const vec3& lhs, const matrix4& rhs)
|
||||
{
|
||||
vec3 ret;
|
||||
ret.x = rhs(0, 0) * lhs.x + rhs(0, 1) * lhs.y + rhs(0, 2) * lhs.z;
|
||||
ret.y = rhs(1, 0) * lhs.x + rhs(1, 1) * lhs.y + rhs(1, 2) * lhs.z;
|
||||
ret.z = rhs(2, 0) * lhs.x + rhs(2, 1) * lhs.y + rhs(2, 2) * lhs.z;
|
||||
return ret;
|
||||
};
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -25,14 +25,35 @@
|
|||
#include <fstream>
|
||||
#include <streambuf>
|
||||
#include <regex>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
|
||||
|
||||
Core::Logger g_log;
|
||||
Core::Data::ExdData g_exdData;
|
||||
bool skipUnmapped = true;
|
||||
|
||||
std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
//std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
||||
std::map< char, std::string > numberToStringMap
|
||||
{
|
||||
{ '0', "zero" },
|
||||
{ '1', "one" },
|
||||
{ '2', "two" },
|
||||
{ '3', "three" },
|
||||
{ '4', "four" },
|
||||
{ '5', "five" },
|
||||
{ '6', "six" },
|
||||
{ '7', "seven" },
|
||||
{ '8', "eight" },
|
||||
{ '9', "nine" },
|
||||
};
|
||||
|
||||
std::vector< std::string > cppKeyWords
|
||||
{
|
||||
"new",
|
||||
"class"
|
||||
};
|
||||
|
||||
//std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
||||
std::map< uint8_t, std::string > g_typeMap;
|
||||
|
||||
|
||||
|
@ -179,7 +200,23 @@ std::string generateStruct( const std::string &exd )
|
|||
fieldName = indexToNameMap[count];
|
||||
}
|
||||
fieldName[0] = std::tolower( fieldName[0] );
|
||||
fieldName.erase( boost::remove_if( fieldName, boost::is_any_of(",-':![](){}<>% \x02\x1f\x01\x03") ), fieldName.end() );
|
||||
fieldName.erase( boost::remove_if( fieldName, boost::is_any_of(",-':![](){}<>% \x02\x1f\x01\x03") ), fieldName.end() );
|
||||
|
||||
for( auto entry : numberToStringMap )
|
||||
{
|
||||
if( fieldName[0] == entry.first )
|
||||
{
|
||||
fieldName.erase( 0, 1 );
|
||||
fieldName.insert( 0, entry.second );
|
||||
}
|
||||
}
|
||||
|
||||
for( std::string keyword : cppKeyWords )
|
||||
{
|
||||
if( fieldName == keyword )
|
||||
fieldName[0] = toupper( fieldName[0] );
|
||||
}
|
||||
|
||||
indexToNameMap[count] = fieldName;
|
||||
indexToTypeMap[count] = type;
|
||||
if( indexToTarget.find( count ) != indexToTarget.end() )
|
||||
|
|
|
@ -271,7 +271,7 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
constructor += rewards + "\n";
|
||||
constructor += sentities + "\n";
|
||||
constructor += " public:\n";
|
||||
constructor += " " + className + "() : EventScript" + "( \"" + pQuestData->name + "\", " + std::to_string( pQuestData->id ) + " ){}; \n";
|
||||
constructor += " " + className + "() : EventScript" + "( " + std::to_string( pQuestData->id ) + " ){}; \n";
|
||||
constructor += " ~" + className + "(){}; \n";
|
||||
|
||||
std::string classString(
|
||||
|
@ -299,12 +299,15 @@ int main( int argc, char** argv )
|
|||
|
||||
bool unluac = false;
|
||||
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
std::string datLocation( "C:/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
||||
//std::string datLocation( "C:/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
||||
std::string datLocation( "C:/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/sqpack" );
|
||||
if ( argc > 1 )
|
||||
datLocation = std::string( argv[1] );
|
||||
if ( argc > 2 )
|
||||
unluac = (bool)atoi( argv[2] );
|
||||
|
||||
unluac = true;
|
||||
|
||||
g_log.info( "Setting up EXD data" );
|
||||
if( !g_exdData.init( datLocation ) )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue