1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

Merge pull request #357 from NotAdam/develop

new effect packet + base gilshop implementation
This commit is contained in:
Mordred 2018-07-22 23:37:09 +02:00 committed by GitHub
commit b64c56faa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 528 additions and 280 deletions

View file

@ -409,6 +409,7 @@ namespace Common {
TpLoss = 12,
TpGain = 13,
GpGain = 14,
Knockback = 33,
Mount = 38
};
@ -422,6 +423,13 @@ namespace Common {
CritDirectHitDamage = 3
};
enum ActionEffectDisplayType : uint8_t
{
HideActionName = 0,
ShowActionName = 1,
ShowItemName = 2,
};
enum class ActionCollisionType : uint8_t
{
None,

View file

@ -14,13 +14,13 @@ namespace Packets {
*/
enum ServerLobbyIpcType : uint16_t
{
LobbyError = 0x0002,
LobbyServiceAccountList = 0x000C,
LobbyCharList = 0x000D,
LobbyCharCreate = 0x000E,
LobbyEnterWorld = 0x000F,
LobbyServerList = 0x0015,
LobbyRetainerList = 0x0017,
LobbyError = 0x0002,
LobbyServiceAccountList = 0x000C,
LobbyCharList = 0x000D,
LobbyCharCreate = 0x000E,
LobbyEnterWorld = 0x000F,
LobbyServerList = 0x0015,
LobbyRetainerList = 0x0017,
};
@ -29,12 +29,12 @@ namespace Packets {
*/
enum ClientLobbyIpcType : uint16_t
{
ReqCharList = 0x0003,
ReqEnterWorld = 0x0004,
ReqServiceAccountList = 0x0005,
ReqCharList = 0x0003,
ReqEnterWorld = 0x0004,
ReqServiceAccountList = 0x0005,
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
};
////////////////////////////////////////////////////////////////////////////////
@ -46,145 +46,150 @@ namespace Packets {
{
// static opcode ( the ones that rarely, if ever, change )
Ping = 0x0065,
Init = 0x0066,
Ping = 0x0065,
Init = 0x0066,
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
AddStatusEffect = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
UpdateHpMpTp = 0x0145,
AddStatusEffect = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
UpdateHpMpTp = 0x0145,
///////////////////////////////////////////////////
ChatBanned = 0x006B,
Logout = 0x0077, // updated 4.3
CFNotify = 0x0078,
CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F,
ChatBanned = 0x006B,
Logout = 0x0077, // updated 4.3
CFNotify = 0x0078,
CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F,
SocialRequestError = 0x00AD,
SocialRequestError = 0x00AD,
CFRegistered = 0x00B8, // updated 4.1
SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2
CFRegistered = 0x00B8, // updated 4.1
SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2
Playtime = 0x00F5, // updated 4.3
Chat = 0x00F7, // updated 4.3
SocialList = 0x00FD, // updated 4.3
Playtime = 0x00F5, // updated 4.3
Chat = 0x00F7, // updated 4.3
SocialList = 0x00FD, // updated 4.3
UpdateSearchInfo = 0x0100, // updated 4.3
InitSearchInfo = 0x0101, // updated 4.3
UpdateSearchInfo = 0x0100, // updated 4.3
InitSearchInfo = 0x0101, // updated 4.3
ServerNotice = 0x0106, // updated 4.3
SetOnlineStatus = 0x0107, // updated 4.3
ServerNotice = 0x0106, // updated 4.3
SetOnlineStatus = 0x0107, // updated 4.3
CountdownInitiate = 0x0111, // updated 4.3
CountdownCancel = 0x0112, // updated 4.3
CountdownInitiate = 0x0111, // updated 4.3
CountdownCancel = 0x0112, // updated 4.3
BlackList = 0x0115, // updated 4.3
BlackList = 0x0115, // updated 4.3
LogMessage = 0x00D0,
LogMessage = 0x00D0,
LinkshellList = 0x011C, // updated 4.3
CharaFreeCompanyTag = 0x013B, // updated 4.3
FreeCompanyBoardMsg = 0x013C, // updated 4.3
FreeCompanyInfo = 0x013D, // updated 4.3
LinkshellList = 0x011C, // updated 4.3
CharaFreeCompanyTag = 0x013B, // updated 4.3
FreeCompanyBoardMsg = 0x013C, // updated 4.3
FreeCompanyInfo = 0x013D, // updated 4.3
StatusEffectList = 0x014E, // updated 4.3
Effect = 0x0151, // updated 4.3
PersistantEffect = 0x0158, // updated 4.3
StatusEffectList = 0x014E, // updated 4.3
Effect = 0x0151, // updated 4.3
AoeEffect8 = 0x0154, // updated 4.3
AoeEffect16 = 0x0155, // updated 4.3
AoeEffect24 = 0x0156, // updated 4.3
AoeEffect32 = 0x0157, // updated 4.3
PersistantEffect = 0x0158, // updated 4.3
GCAffiliation = 0xCCFC, // OUTDATED
GCAffiliation = 0xCCFC, // OUTDATED
PlayerSpawn = 0x0172, // updated 4.3
NpcSpawn = 0x0173, // updated 4.3
ActorMove = 0x0174, // updated 4.3
ActorSetPos = 0x0176, // updated 4.3
PlayerSpawn = 0x0172, // updated 4.3
NpcSpawn = 0x0173, // updated 4.3
ActorMove = 0x0174, // updated 4.3
ActorSetPos = 0x0176, // updated 4.3
ActorCast = 0x0178, // updated 4.3
ActorCast = 0x0178, // updated 4.3
PartyList = 0x017A, // updated 4.3
HateList = 0x017B, // updated 4.3
PartyList = 0x017A, // updated 4.3
HateList = 0x017B, // updated 4.3
ObjectSpawn = 0x017D, // updated 4.3
ObjectDespawn = 0x017E, // updated 4.3
ObjectSpawn = 0x017D, // updated 4.3
ObjectDespawn = 0x017E, // updated 4.3
SetLevelSync = 0x017F, // updated 4.3
SilentSetClassJob = 0x0180, // updated 4.3 - seems to be the case, not sure if it's actually used for anything
SetLevelSync = 0x017F, // updated 4.3
SilentSetClassJob = 0x0180, // updated 4.3 - seems to be the case, not sure if it's actually used for anything
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
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
UpdateClassInfo = 0x018A, // updated 4.3
UpdateClassInfo = 0x018A, // updated 4.3
ItemInfo = 0x0190, // updated 4.3
ContainerInfo = 0x0192, // updated 4.3
InventoryTransactionFinish = 0x0193, // updated 4.3
InventoryTransaction = 0x0194, // updated 4.3
InventoryActionAck = 0x0197, // updated 4.3
CurrencyCrystalInfo = 0xFFFF, // updated 4.3 - wrong opcode
ItemInfo = 0x0190, // updated 4.3
ContainerInfo = 0x0192, // updated 4.3
InventoryTransactionFinish = 0x0193, // updated 4.3
InventoryTransaction = 0x0194, // updated 4.3
InventoryActionAck = 0x0197, // updated 4.3
CurrencyCrystalInfo = 0xFFFF, // updated 4.3 - wrong opcode
UpdateInventorySlot = 0x0198, // updated 4.3
UpdateInventorySlot = 0x0198, // updated 4.3
EventPlay = 0x01A6, // updated 4.3
DirectorPlayScene = 0x01AA, // updated 4.3
EventPlay = 0x01A6, // updated 4.3
EventOpenGilShop = 0x01AD, // updated 4.3
DirectorPlayScene = 0x01AA, // updated 4.3
EventStart = 0x01AF, // updated 4.3
EventFinish = 0x01B0, // updated 4.3
EventStart = 0x01AF, // updated 4.3
EventFinish = 0x01B0, // updated 4.3
EventLinkshell = 0x1169,
EventLinkshell = 0x1169,
QuestActiveList = 0x01C3, // updated 4.3
QuestUpdate = 0x01C4, // updated 4.3
QuestCompleteList = 0x01C5, // updated 4.3
QuestActiveList = 0x01C3, // updated 4.3
QuestUpdate = 0x01C4, // updated 4.3
QuestCompleteList = 0x01C5, // updated 4.3
QuestFinish = 0x01C6, // updated 4.3
MSQTrackerComplete = 0x01C7, // updated 4.3
MSQTrackerProgress = 0x01C8, // updated 4.3
QuestFinish = 0x01C6, // updated 4.3
MSQTrackerComplete = 0x01C7, // updated 4.3
MSQTrackerProgress = 0x01C8, // updated 4.3
QuestMessage = 0x01CE, // updated 4.3
QuestMessage = 0x01CE, // updated 4.3
QuestTracker = 0x01D3, // updated 4.3
QuestTracker = 0x01D3, // updated 4.3
Mount = 0x01E3, // updated 4.3
Mount = 0x01E3, // updated 4.3
DirectorVars = 0x01E5, // updated 4.3
DirectorVars = 0x01E5, // updated 4.3
CFAvailableContents = 0x01FD, // updated 4.2
CFAvailableContents = 0x01FD, // updated 4.2
WeatherChange = 0x0200, // updated 4.3
PlayerTitleList = 0x0201, // updated 4.3
Discovery = 0x0202, // updated 4.3
WeatherChange = 0x0200, // updated 4.3
PlayerTitleList = 0x0201, // updated 4.3
Discovery = 0x0202, // updated 4.3
EorzeaTimeOffset = 0x0204, // updated 4.3
EorzeaTimeOffset = 0x0204, // updated 4.3
EquipDisplayFlags = 0x0210, // updated 4.3
EquipDisplayFlags = 0x0210, // updated 4.3
WardInfo = 0x0224, // updated 4.3
WardHousingPermission = 0x022D, // updated 4.3
WardYardInfo = 0x022F, // updated 4.3
WardInfo = 0x0224, // updated 4.3
WardHousingPermission = 0x022D, // updated 4.3
WardYardInfo = 0x022F, // updated 4.3
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3
PrepareZoning = 0x0291, // updated 4.3
ActorGauge = 0x0292, // updated 4.3
PrepareZoning = 0x0291, // updated 4.3
ActorGauge = 0x0292, // updated 4.3
// Unknown IPC types that still need to be sent
// TODO: figure all these out properly
IPCTYPE_UNK_320 = 0x024C, // updated 4.3
IPCTYPE_UNK_322 = 0x024E, // updated 4.3
IPCTYPE_UNK_320 = 0x024C, // updated 4.3
IPCTYPE_UNK_322 = 0x024E, // updated 4.3
};
@ -194,75 +199,78 @@ namespace Packets {
enum ClientZoneIpcType : uint16_t
{
PingHandler = 0x0065, // unchanged 4.3
InitHandler = 0x0066, // unchanged 4.3
PingHandler = 0x0065, // unchanged 4.3
InitHandler = 0x0066, // unchanged 4.3
FinishLoadingHandler = 0x0069, // unchanged 4.3
FinishLoadingHandler = 0x0069, // unchanged 4.3
CFCommenceHandler = 0x006F,
CFCommenceHandler = 0x006F,
CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 4.3
LogoutHandler = 0x0074, // unchanged 4.3
CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 4.3
LogoutHandler = 0x0074, // unchanged 4.3
CFDutyInfoHandler = 0x0078, // updated 4.2
CFDutyInfoHandler = 0x0078, // updated 4.2
SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3
SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3
ChatHandler = 0x00D3, // updated 4.3
ChatHandler = 0x00D3, // updated 4.3
SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3
SetSearchInfoHandler = 0x00DE, // updated 4.3
SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3
SetSearchInfoHandler = 0x00DE, // updated 4.3
BlackListHandler = 0x00EC, // updated 4.3
PlayerSearchHandler = 0x00E2, // updated 4.2
BlackListHandler = 0x00EC, // updated 4.3
PlayerSearchHandler = 0x00E2, // updated 4.2
LinkshellListHandler = 0x00F4, // updated 4.3
LinkshellListHandler = 0x00F4, // updated 4.3
FcInfoReqHandler = 0x011A, // updated 4.2
SearchMarketboard = 0x0103, // updated 4.3
FcInfoReqHandler = 0x011A, // updated 4.2
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
ReqMarketWishList = 0x012C, // updated 4.3
ReqCountdownInitiate = 0x0138, // updated 4.3
ReqCountdownCancel = 0x0139, // updated 4.3
ClearWaymarks = 0x013A, // updated 4.3
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
ZoneLineHandler = 0x013C, // updated 4.3
ClientTrigger = 0x013D, // updated 4.3
DiscoveryHandler = 0x013E, // updated 4.3
ReqCountdownInitiate = 0x0138, // updated 4.3
ReqCountdownCancel = 0x0139, // updated 4.3
ClearWaymarks = 0x013A, // updated 4.3
AddWaymark = 0x013F, // updated 4.3
ZoneLineHandler = 0x013C, // updated 4.3
ClientTrigger = 0x013D, // updated 4.3
DiscoveryHandler = 0x013E, // updated 4.3
SkillHandler = 0x0140, // updated 4.3
GMCommand1 = 0x0141, // updated 4.3
GMCommand2 = 0x0142, // updated 4.3
AddWaymark = 0x013F, // updated 4.3
UpdatePositionHandler = 0x0144, // updated 4.3
UpdatePositionInstance = 0x0183, // updated 4.3
SkillHandler = 0x0140, // updated 4.3
GMCommand1 = 0x0141, // updated 4.3
GMCommand2 = 0x0142, // updated 4.3
InventoryModifyHandler = 0x014B, // updated 4.3
UpdatePositionHandler = 0x0144, // updated 4.3
UpdatePositionInstance = 0x0183, // updated 4.3
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
InventoryModifyHandler = 0x014B, // updated 4.3
ReturnEventHandler = 0x015D, // updated 4.3
TradeReturnEventHandler = 0x015E, // updated 4.3
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
LinkshellEventHandler = 0x0150, // updated 4.1 ??
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
ReturnEventHandler = 0x015D, // updated 4.3
TradeReturnEventHandler = 0x015E, // updated 4.3
PerformNoteHandler = 0x029B, // updated 4.3
LinkshellEventHandler = 0x0150, // updated 4.1 ??
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
ReqEquipDisplayFlagsChange = 0x0178, // updated 4.3
PerformNoteHandler = 0x029B, // updated 4.3
ReqEquipDisplayFlagsChange = 0x0178, // updated 4.3
};
@ -274,8 +282,8 @@ namespace Packets {
*/
enum ServerChatIpcType : uint16_t
{
Tell = 0x0064, // updated for sb
TellErrNotFound = 0x0066,
Tell = 0x0064, // updated for sb
TellErrNotFound = 0x0066,
};
/**
@ -283,7 +291,7 @@ namespace Packets {
*/
enum ClientChatIpcType : uint16_t
{
TellReq = 0x0064,
TellReq = 0x0064,
};

View file

@ -65,6 +65,8 @@ struct FFXIVIpcEventHandlerReturn : FFXIVIpcBasePacket< ReturnEventHandler >
/* 0008 */ uint16_t param2;
/* 000A */ char pad_000A[2];
/* 000C */ uint16_t param3;
/* 000E */ char pad_000E[2];
/* 0010 */ uint16_t param4;
};
struct FFXIVIpcEnterTerritoryHandler : FFXIVIpcBasePacket< EnterTeriEventHandler >

View file

@ -299,47 +299,77 @@ struct FFXIVIpcUpdateHpMpTp : FFXIVIpcBasePacket<UpdateHpMpTp>
* Structural representation of the packet sent by the server
* for battle actions
*/
struct effectEntry
struct EffectEntry
{
Common::ActionEffectType effectType;
Common::ActionHitSeverityType hitSeverity;
uint8_t param;
int8_t bonusPercent;
int8_t bonusPercent; // shows an additional percentage in the battle log, will not change the damage number sent & shown
uint8_t valueMultiplier; // This multiplies whatever value is in the 'value' param by 10. Possibly a workaround for big numbers
uint8_t flags;
int16_t value;
};
struct EffectHeader
{
uint64_t animationTargetId; // who the animation targets
uint32_t actionId; // what the casting player casts, shown in battle log/ui
uint32_t globalEffectCounter; // seems to only increment on retail?
float animationLockTime; // maybe? doesn't seem to do anything
uint32_t someTargetId; // always 00 00 00 E0, 0x0E000000 is the internal def for INVALID TARGET ID
uint16_t hiddenAnimation; // if 0, always shows animation, otherwise hides it. counts up by 1 for each animation skipped on a caster
uint16_t rotation;
uint16_t actionAnimationId; // the animation that is played by the casting character
uint8_t unknown1E; // can be 0,1,2 - maybe other values? - doesn't do anything?
Common::ActionEffectDisplayType effectDisplayType;
uint8_t unknown20; // is read by handler, runs code which gets the LODWORD of animationLockTime (wtf?)
uint8_t effectCount; // ignores effects if 0, otherwise parses all of them
uint32_t padding_22[2];
};
struct FFXIVIpcEffect : FFXIVIpcBasePacket<Effect>
{
uint32_t targetId;
uint32_t unknown_1;
uint32_t actionAnimationId;
uint32_t unknown_2;
uint32_t unknown_5;
uint32_t unknown_6;
uint16_t unknown_7;
uint16_t rotation;
uint16_t actionTextId;
uint16_t unknown_8;
EffectHeader header;
uint8_t unknown_9;
uint8_t numEffects;
EffectEntry effects[8];
uint16_t unknown_10;
uint32_t unknown_11;
uint16_t unknown_12;
uint16_t padding_6A[3];
effectEntry effects[8];
uint32_t effectTargetId; // who the effect targets
uint32_t effectFlags; // nonzero = effects do nothing, no battle log, no ui text - only shows animations
uint32_t unknown_13;
uint16_t unknown_14;
uint32_t effectTargetId;
uint64_t unknown_15;
uint32_t padding_78;
};
template< int size >
struct FFXIVIpcAoeEffect
{
EffectHeader header;
EffectEntry effects[size];
uint16_t padding_6A[3];
uint32_t effectTargetId[size];
Common::FFXIVARR_POSITION3 position;
uint32_t effectFlags;
uint32_t padding_78;
};
struct FFXIVIpcAoeEffect8 : FFXIVIpcBasePacket< AoeEffect8 >, FFXIVIpcAoeEffect< 8 > {};
struct FFXIVIpcAoeEffect16 : FFXIVIpcBasePacket< AoeEffect16 >, FFXIVIpcAoeEffect< 16 > {};
struct FFXIVIpcAoeEffect24 : FFXIVIpcBasePacket< AoeEffect24 >, FFXIVIpcAoeEffect< 24 > {};
struct FFXIVIpcAoeEffect32 : FFXIVIpcBasePacket< AoeEffect32 >, FFXIVIpcAoeEffect< 32 > {};
/**
* Structural representation of the packet sent by the server
@ -1063,6 +1093,17 @@ struct FFXIVIpcEventFinish : FFXIVIpcBasePacket<EventFinish>
/* 000C */ uint32_t padding1;
};
struct FFXIVIpcEventOpenGilShop : FFXIVIpcBasePacket<EventOpenGilShop>
{
uint64_t actorId;
uint32_t eventId;
uint16_t scene;
uint16_t padding;
uint32_t sceneFlags;
uint32_t unknown_wtf[0x101];
};
/**
* Structural representation of the packet sent by the server

View file

@ -17,7 +17,7 @@ public:
}
};
player.playScene( getId(), 0, 0x2000, 0, 1, callback );
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1, callback );
}
void Scene00001( Entity::Player& player, uint16_t returnScene )

View file

@ -0,0 +1,19 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefHousingSignboard : public EventScript
{
public:
CmnDefHousingSignboard() : EventScript( 721031 )
{}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -16,7 +16,7 @@ public:
Scene00001( player, result.param2 );
};
player.playScene( getId(), 0, 0x2000, 0, 1, callback );
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1, callback );
}
// lay down

View file

@ -0,0 +1,19 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefMarketBoardGridania : public EventScript
{
public:
CmnDefMarketBoardGridania() : EventScript( 0xB0027 )
{}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -0,0 +1,19 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefNpcRepair : public EventScript
{
public:
CmnDefNpcRepair() : EventScript( 0xB0013 )
{}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -0,0 +1,19 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class ComDefMobHuntBoard : public EventScript
{
public:
ComDefMobHuntBoard() : EventScript( 0xB00CA )
{}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
};

View file

@ -0,0 +1,48 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class GilShop : public EventScript
{
public:
GilShop() : EventScript( 0x00040001 )
{}
constexpr static auto SCENE_FLAGS = HIDE_HOTBAR | NO_DEFAULT_CAMERA;
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
player.playScene( eventId, 0, SCENE_FLAGS, 0, 2, shopCallback );
}
private:
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
{
// item purchase
if( result.param1 == 768 )
{
// buy
if( result.param2 == 1 )
{
}
// sell
else if( result.param2 == 2 )
{
}
player.sendDebug( "got tradeQuantity: " + std::to_string( result.param4 ) );
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
return;
}
// exit
player.playScene( result.eventId, 255, SCENE_FLAGS );
}
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
{
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
}
};

View file

@ -9,7 +9,7 @@ public:
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, 0x2000, 0, 1 );
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 1 );
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override

View file

@ -3,6 +3,7 @@
#include <Util/UtilMath.h>
#include <Logging/Logger.h>
#include <Network/CommonActorControl.h>
#include <sapphire_zone/Network/PacketWrappers/EffectPacket.h>
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
@ -73,19 +74,15 @@ void Core::Action::ActionMount::onFinish()
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 4 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( pPlayer->getRot() ) );
effectPacket->data().targetId = pPlayer->getId();
effectPacket->data().actionAnimationId = m_id;
// Affects displaying action name next to number in floating text
//effectPacket->data().unknown_62 = 13;
effectPacket->data().actionTextId = 4;
effectPacket->data().numEffects = 1;
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( pPlayer->getRot() );
//effectPacket->data().effectTarget = INVALID_GAME_OBJECT_ID;
effectPacket->data().effects[0].effectType = ActionEffectType::Mount;
effectPacket->data().effects[0].hitSeverity = ActionHitSeverityType::CritDamage;
effectPacket->data().effects[0].value = m_id;
Server::EffectEntry effectEntry{};
effectEntry.effectType = ActionEffectType::Mount;
effectEntry.hitSeverity = ActionHitSeverityType::CritDamage;
effectEntry.value = m_id;
effectPacket->addEffect( effectEntry );
pPlayer->sendToInRangeSet( effectPacket, true );

View file

@ -2,6 +2,8 @@
#include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h>
#include <Network/CommonActorControl.h>
#include <sapphire_zone/Network/PacketWrappers/EffectPacket.h>
#include <Util/UtilMath.h>
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
@ -84,20 +86,12 @@ void Core::Action::ActionTeleport::onFinish()
pPlayer->setZoningType( ZoneingType::Teleport );
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
effectPacket->data().targetId = pPlayer->getId();
effectPacket->data().actionAnimationId = 5;
//effectPacket.data().unknown_3 = 1;
effectPacket->data().actionTextId = 5;
effectPacket->data().unknown_5 = 1;
effectPacket->data().numEffects = 1;
effectPacket->data().rotation = static_cast< uint16_t >( 0x8000 * ( ( pPlayer->getRot() + 3.1415926 ) ) / 3.1415926 );
effectPacket->data().effectTargetId = pPlayer->getId();
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 5 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( pPlayer->getRot() ) );
pPlayer->sendToInRangeSet( effectPacket, true );
pPlayer->teleport( m_targetAetheryte );
}
void Core::Action::ActionTeleport::onInterrupt()

View file

@ -7,6 +7,7 @@
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/EffectPacket.h"
#include "Actor/Player.h"
@ -69,15 +70,9 @@ void Core::Action::EventItemAction::onFinish()
try
{
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( m_pSource->getId() );
effectPacket->data().targetId = static_cast< uint32_t >( m_additional );
effectPacket->data().actionAnimationId = 1;
// effectPacket.data().unknown_3 = 3;
effectPacket->data().actionTextId = m_id;
effectPacket->data().unknown_5 = 2;
effectPacket->data().numEffects = 1;
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( m_pSource->getRot() );
effectPacket->data().effectTargetId = static_cast< uint32_t >( m_additional );
auto effectPacket = boost::make_shared< Server::EffectPacket >( m_pSource->getId(), m_additional, m_id );
effectPacket->setAnimationId( 1 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( m_pSource->getRot() ) );
m_pSource->getAsPlayer()->unsetStateFlag( Common::PlayerStateFlag::Casting );
m_pSource->sendToInRangeSet( effectPacket, true );

View file

@ -4,6 +4,7 @@
#include <Exd/ExdDataGenerated.h>
#include <utility>
#include <Network/CommonActorControl.h>
#include <sapphire_zone/Network/PacketWrappers/EffectPacket.h>
#include "Forwards.h"
#include "Action/Action.h"
@ -399,24 +400,20 @@ void Core::Entity::Chara::autoAttack( CharaPtr pTarget )
uint16_t damage = static_cast< uint16_t >( 10 + rand() % 12 );
uint32_t variation = static_cast< uint32_t >( 0 + rand() % 4 );
auto ipcEffect = makeZonePacket< FFXIVIpcEffect >( getId() );
ipcEffect->data().targetId = pTarget->getId();
ipcEffect->data().actionAnimationId = 0x366;
ipcEffect->data().unknown_2 = variation;
// effectPacket->data().unknown_3 = 1;
ipcEffect->data().actionTextId = 0x366;
ipcEffect->data().numEffects = 1;
ipcEffect->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
ipcEffect->data().effectTargetId = pTarget->getId();
ipcEffect->data().effects[0].value = damage;
ipcEffect->data().effects[0].effectType = ActionEffectType::Damage;
ipcEffect->data().effects[0].hitSeverity = static_cast< ActionHitSeverityType >( variation );
//ipcEffect->data().effects[0].unknown_3 = 7;
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 0x336 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
sendToInRangeSet( ipcEffect );
Server::EffectEntry effectEntry{ };
effectEntry.value = damage;
effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = static_cast< ActionHitSeverityType >( variation );
effectPacket->addEffect( effectEntry );
sendToInRangeSet( effectPacket );
if( isPlayer() )
getAsPlayer()->queuePacket( ipcEffect );
getAsPlayer()->queuePacket( effectPacket );
pTarget->takeDamage( damage );
}
@ -443,16 +440,8 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
// Todo: Effect packet generator. 90% of this is basically setting params and it's basically unreadable.
// Prepare packet. This is seemingly common for all packets in the action handler.
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
effectPacket->data().targetId = target.getId();
effectPacket->data().actionAnimationId = actionId;
//effectPacket->data().unknown_62 = 1; // Affects displaying action name next to number in floating text
effectPacket->data().unknown_2 = 1; // This seems to have an effect on the "double-cast finish" animation
effectPacket->data().actionTextId = actionId;
effectPacket->data().numEffects = 1;
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
effectPacket->data().effectTargetId = target.getId();
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), target.getId(), actionId );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
// Todo: for each actor, calculate how much damage the calculated value should deal to them - 2-step damage calc. we only have 1-step
switch( type )
@ -460,10 +449,12 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
case ActionEffectType::Damage:
{
effectPacket->data().effects[0].value = static_cast< uint16_t >( param1 );
effectPacket->data().effects[0].effectType = ActionEffectType::Damage;
effectPacket->data().effects[0].hitSeverity = ActionHitSeverityType::NormalDamage;
//effectPacket->data().effects[0].unknown_3 = 7;
Server::EffectEntry effectEntry{};
effectEntry.value = static_cast< uint16_t >( param1 );
effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage;
effectPacket->addEffect( effectEntry );
if( actionInfoPtr->castType == 1 && actionInfoPtr->effectRange != 0 || actionInfoPtr->castType != 1 )
{
@ -487,8 +478,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
for( const auto& pHitActor : actorsCollided )
{
effectPacket->data().targetId = pHitActor->getId();
effectPacket->data().effectTargetId = pHitActor->getId();
effectPacket->setTargetActor( pHitActor->getId() );
// todo: send to range of what? ourselves? when mob script hits this is going to be lacking
sendToInRangeSet( effectPacket, true );
@ -518,9 +508,12 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
{
uint32_t calculatedHeal = Math::CalcBattle::calculateHealValue( getAsPlayer(), static_cast< uint32_t >( param1 ) );
effectPacket->data().effects[0].value = calculatedHeal;
effectPacket->data().effects[0].effectType = ActionEffectType::Heal;
effectPacket->data().effects[0].hitSeverity = ActionHitSeverityType::NormalHeal;
Server::EffectEntry effectEntry{};
effectEntry.value = calculatedHeal;
effectEntry.effectType = ActionEffectType::Heal;
effectEntry.hitSeverity = ActionHitSeverityType::NormalHeal;
effectPacket->addEffect( effectEntry );
if( actionInfoPtr->castType == 1 && actionInfoPtr->effectRange != 0 || actionInfoPtr->castType != 1 )
{
@ -540,8 +533,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
for( auto pHitActor : actorsCollided )
{
effectPacket->data().targetId = target.getId();
effectPacket->data().effectTargetId = pHitActor->getId();
effectPacket->setTargetActor( pHitActor->getId() );
sendToInRangeSet( effectPacket, true );
pHitActor->getAsChara()->heal( calculatedHeal );

View file

@ -7,6 +7,7 @@
#include <Exd/ExdDataGenerated.h>
#include <Network/PacketContainer.h>
#include <Network/CommonActorControl.h>
#include <Network/PacketWrappers/EffectPacket.h>
#include "Session.h"
#include "Player.h"
@ -1418,46 +1419,35 @@ void Core::Entity::Player::autoAttack( CharaPtr pTarget )
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
{
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
effectPacket->data().targetId = pTarget->getId();
effectPacket->data().actionAnimationId = 8;
// effectPacket.data().unknown_2 = variation;
effectPacket->data().numEffects = 1;
//effectPacket->data().unknown_61 = 1;
//effectPacket->data().unknown_62 = 1;
effectPacket->data().actionTextId = 8;
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
effectPacket->data().effectTargetId = pTarget->getId();
//effectPacket->data().effectTarget = pTarget->getId();
effectPacket->data().effects[0].value = damage;
effectPacket->data().effects[0].effectType = Common::ActionEffectType::Damage;
effectPacket->data().effects[0].hitSeverity = Common::ActionHitSeverityType::NormalDamage;
//effectPacket->data().effects[0].unknown_3 = 7;
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 8 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
sendToInRangeSet(effectPacket, true);
Server::EffectEntry entry;
entry.value = damage;
entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage;
effectPacket->addEffect( entry );
sendToInRangeSet( effectPacket, true );
}
else
{
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
effectPacket->data().targetId = pTarget->getId();
effectPacket->data().actionAnimationId = 7;
// effectPacket.data().unknown_2 = variation;
effectPacket->data().numEffects = 1;
//effectPacket->data().unknown_61 = 1;
//effectPacket->data().unknown_62 = 1;
effectPacket->data().actionTextId = 7;
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
effectPacket->data().effectTargetId = pTarget->getId();
effectPacket->data().effects[0].value = damage;
effectPacket->data().effects[0].effectType = Common::ActionEffectType::Damage;
effectPacket->data().effects[0].hitSeverity = Common::ActionHitSeverityType::NormalDamage;
//effectPacket->data().effects[0].unknown_3 = 71;
Server::EffectEntry entry;
entry.value = damage;
entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage;
effectPacket->addEffect( entry );
sendToInRangeSet( effectPacket, true );
sendToInRangeSet(effectPacket, true);
}
pTarget->takeDamage(damage);
pTarget->takeDamage( damage );
}

View file

@ -58,6 +58,9 @@ public:
/*! play a subevent */
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
void playGilShop( uint32_t eventId, uint32_t flags,
Event::EventHandler::SceneReturnCallback eventCallback );
void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam5 = 0 );
/*! play a subevent */

View file

@ -133,6 +133,27 @@ void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
playScene( eventId, scene, flags, eventParam2, eventParam3, 0, eventCallback );
}
void Core::Entity::Player::playGilShop( uint32_t eventId, uint32_t flags,
Event::EventHandler::SceneReturnCallback eventCallback )
{
auto pEvent = bootstrapSceneEvent( eventId, flags );
if( !pEvent )
return;
pEvent->setPlayedScene( true );
pEvent->setEventReturnCallback( eventCallback );
pEvent->setSceneChainCallback( nullptr );
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() );
openGilShopPacket->data().eventId = eventId;
openGilShopPacket->data().sceneFlags = flags;
openGilShopPacket->data().actorId = getId();
openGilShopPacket->data().scene = 10;
queuePacket( openGilShopPacket );
}
Core::Event::EventHandlerPtr Core::Entity::Player::bootstrapSceneEvent( uint32_t eventId, uint32_t flags )
{
if( flags & 0x02 )

View file

@ -12,6 +12,7 @@ namespace Core {
uint16_t param1;
uint16_t param2;
uint16_t param3;
uint16_t param4;
};
class EventHandler

View file

@ -203,6 +203,7 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_
const auto& param1 = packet.data().param1;
const auto& param2 = packet.data().param2;
const auto& param3 = packet.data().param3;
const auto& param4 = packet.data().param4;
std::string eventName = Event::getEventName( eventId );
@ -228,6 +229,7 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_
result.param1 = param1;
result.param2 = param2;
result.param3 = param3;
result.param4 = param4;
eventCallback( player, result );
}
// we might have a scene chain callback instead so check for that too

View file

@ -0,0 +1,65 @@
#ifndef SAPPHIRE_EFFECTPACKET_H
#define SAPPHIRE_EFFECTPACKET_H
#include <Network/GamePacketNew.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include "Forwards.h"
namespace Core {
namespace Network {
namespace Packets {
namespace Server {
class EffectPacket :
public ZoneChannelPacket< FFXIVIpcEffect >
{
public:
EffectPacket( uint64_t sourceId, uint32_t targetId, uint32_t actionId ) :
ZoneChannelPacket< FFXIVIpcEffect >( sourceId, targetId )
{
m_data.header.actionId = actionId;
m_data.header.actionAnimationId = static_cast< uint16_t >( actionId );
m_data.header.animationTargetId = targetId;
m_data.effectTargetId = targetId;
m_data.header.effectDisplayType = Common::ActionEffectDisplayType::ShowActionName;
}
void addEffect( const Server::EffectEntry& effect )
{
assert( m_data.header.effectCount <= 8 );
std::memcpy( &m_data.effects[m_data.header.effectCount++], &effect, sizeof( Server::EffectEntry ) );
}
void setAnimationId( uint16_t animationId )
{
m_data.header.actionAnimationId = animationId;
}
void setEffectFlags( uint32_t effectFlags )
{
m_data.effectFlags = effectFlags;
}
void setRotation( uint16_t rotation )
{
m_data.header.rotation = rotation;
}
void setTargetActor( const uint32_t targetId )
{
m_data.header.animationTargetId = targetId;
m_data.effectTargetId = targetId;
FFXIVPacketBase::setTargetActor( targetId );
}
};
}
}
}
}
#endif //SAPPHIRE_EFFECTPACKET_H

View file

@ -174,6 +174,7 @@ bool Core::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorI
uint16_t eventType = eventId >> 16;
uint32_t scriptId = eventId;
// todo: replace this shit with something more flexible allowing for handlers for an entire type without a bunch of if statements
// aethernet/aetherytes need to be handled separately
if( eventType == Event::EventHandler::EventHandlerType::Aetheryte )
{
@ -182,6 +183,10 @@ bool Core::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorI
if( !aetherInfo->isAetheryte )
scriptId = EVENTSCRIPT_AETHERNET_ID;
}
else if( eventType == Event::EventHandler::EventHandlerType::Shop )
{
scriptId = 0x00040001;
}
auto script = m_nativeScriptMgr->getScript< EventScript >( scriptId );
if( !script )