// // EventNetwork.h // // Copyright (C) 1999-2009 Rockstar Games. All Rights Reserved. // #ifndef EVENT_NETWORK_H #define EVENT_NETWORK_H // --- Include Files ------------------------------------------------------------ // Framework headers #include "fwevent/Event.h" #include "fwnet/nettypes.h" #include "fwtl/Pool.h" // Rage includes #include "script/thread.h" #include "atl/string.h" // Game includes #include "event/system/EventData.h" #include "network/NetworkTypes.h" #include "network/NetworkInterface.h" #include "network/Cloud/CloudManager.h" #include "network/Players/NetGamePlayer.h" #include "network/Objects/Entities/NetObjPhysical.h" #include "pickups/Data/PickupIds.h" #include "rline/rlgamerinfo.h" #include "Peds/PlayerSpecialAbility.h" // this is the (exact) size needed to send CEventNetworkPlayerScript #define MAX_SCRIPTED_EVENT_DATA_SIZE (54 * sizeof(scrValue)) // an additional 4 because arrays in script have a leading int static const unsigned SCRIPT_GAMER_HANDLE_SIZE = 13; typedef scrValue scrGamerHandle[SCRIPT_GAMER_HANDLE_SIZE]; static const unsigned GAMER_HANDLE_SIZE = sizeof(scrGamerHandle); static const unsigned MAX_NUM_SCRIPTS = 20; class CGameScriptId; class CPed; // Structures used by network events. Duplicate structs exist in a script header. They must match as these are used to retrieve the event data. struct sPlayerSessionData { scrTextLabel63 PlayerName; scrValue PlayerIndex; scrValue PlayerTeam; }; struct sPlayerScriptData { scrTextLabel63 PlayerName; scrValue PlayerIndex; scrValue PlayerTeam; scrValue nSource; scrValue nNumScripts; scrValue arraySize; // size of aScripts array scrValue aScripts[MAX_NUM_SCRIPTS]; scrGamerHandle m_hPlayer; //< Only used in EVENT_NETWORK_PLAYER_LEFT_SCRIPT. Pretty redundant in EVENT_NETWORK_PLAYER_JOIN_SCRIPT scrValue iPlayerFlags; scrValue nBailReason; }; struct sStorePlayerData { scrTextLabel31 m_szGamerTag; scrGamerHandle m_hGamer; }; struct sPlayerDiedData { scrTextLabel23 PlayerName; scrValue PlayerIndex; scrValue PlayerTeam; scrValue PlayerWantedLevel; scrTextLabel23 KillerName; scrValue KillerIndex; scrValue KillerTeam; scrValue KilledByPlayer; scrValue KillerWeaponType; }; struct sEntityDamagedData { scrValue VictimId; scrValue DamagerId; scrValue Damage; scrValue EnduranceDamage; scrValue VictimIncapacitated; scrValue VictimDestroyed; scrValue WeaponUsed; scrValue VictimSpeed; scrValue DamagerSpeed; scrValue IsResponsibleForCollision; scrValue IsHeadShot; scrValue WithMeleeWeapon; scrValue HitMaterial; }; struct sPickupCollectedData { scrValue PlacementReference; scrValue PlayerIndex; scrValue PickupHash; scrValue PickupAmount; scrValue PickupModel; scrValue PickupCollected; }; struct sPickupRespawnData { scrValue PlacementReference; scrValue PickupHash; scrValue PickupModel; }; struct sAmbientPickupCollectedData { scrValue PickupHash; scrValue PickupAmount; scrValue PlayerIndex; scrValue PickupModel; scrValue PlayerGift; scrValue DroppedByPed; scrValue PickupCollected; scrValue PickupIndex; }; struct sPortablePickupCollectedData { scrValue PickupID; scrValue PickupNetID; scrValue PlayerIndex; scrValue PickupModel; }; struct sPlayerArrestedData { scrValue ArresterIndex; scrValue ArresteeIndex; scrValue ArrestType; }; struct sPlayerEnteredVehicleData { scrValue PlayerIndex; scrValue VehicleIndex; }; struct sPlayerActivatedSpecialAbilityData { scrValue PlayerIndex; scrValue SpecialAbility; }; struct sPlayerDeactivatedSpecialAbilityData { scrValue PlayerIndex; scrValue SpecialAbility; }; struct sPlayerSpecialAbilityFailedActivation { scrValue PlayerIndex; scrValue SpecialAbility; }; struct sInviteArrivedData { scrValue InviteIndex; scrValue GameMode; scrValue IsFriend; }; struct sInviteData { scrGamerHandle m_hInviter; scrValue nGameMode; scrValue nSessionPurpose; scrValue bViaParty; scrValue nAimType; scrValue nActivityType; scrValue nActivityID; scrValue bIsSCTV; scrValue nFlags; scrValue nNumBosses; }; struct sSummonData { scrValue nGameMode; scrValue nSessionPurpose; }; struct sBroadcastVariablesUpdatedData { scrValue ThreadId; scrValue Type; }; struct sHostMigrateData { scrValue ThreadId; scrValue HostPlayerIndex; }; struct sJoinResponseData { scrValue bWasSuccessful; scrValue nResponse; }; struct sScriptEventData { u8 Data[MAX_SCRIPTED_EVENT_DATA_SIZE]; }; struct sCheatEventData { scrValue CheatType; }; struct sTimedExplosionData { scrValue nVehicleIndex; scrValue nCulpritIndex; }; struct sDummyProjectileLaunchedData { scrValue nFiringPedIndex; scrValue nFiredProjectileIndex; scrValue nWeaponType; }; struct sVehicleProjectileLaunchedData { scrValue nFiringVehicleIndex; scrValue nFiringPedIndex; scrValue nFiredProjectileIndex; scrValue nWeaponType; }; struct sSignInChangedData { scrValue nIndex; scrValue bIsActiveUser; scrValue bWasSignedIn; scrValue bWasOnline; scrValue bIsSignedIn; scrValue bIsOnline; scrValue bIsDuplicateSignIn; }; struct sRosChangedData { scrValue bValidCredentials; scrValue bValidRockstarID; }; struct sBailData { scrValue nBailReason; scrValue nBailErrorCode; }; struct sLeaveSessionData { scrValue nLeaveReason; }; struct sVoiceSessionRequestData { scrTextLabel31 m_szGamerTag; scrGamerHandle m_hGamer; }; struct sVoiceSessionResponseData { scrValue nResponse; scrValue nResponseCode; scrGamerHandle m_hGamer; }; struct sVoiceSessionTerminatedData { scrTextLabel31 m_szGamerTag; scrGamerHandle m_hGamer; }; struct sCloudResponseData { scrValue nRequestID; scrValue bWasSuccessful; }; struct sGamePresenceEvent_StatUpdate { scrValue m_statNameHash; scrTextLabel63 m_fromGamer; scrValue m_iValue; scrValue m_fValue; scrValue m_value2; scrTextLabel63 m_stringValue; }; struct sPedLeftBehindData { scrValue m_PedId; scrValue m_Reason; }; struct sSessionEventData { scrValue m_nEventID; scrValue m_nEventParam; scrGamerHandle m_hGamer; }; struct sTransitionStartedData { scrValue m_bSuccess; }; struct sTransitionEventData { scrValue m_nEventID; scrValue m_nEventParam; scrGamerHandle m_hGamer; }; struct sTransitionMemberData { scrTextLabel63 m_szGamerTag; scrGamerHandle m_hGamer; scrValue m_nCharacterRank; }; struct sParameterData { scrValue m_id; scrValue m_value; }; struct sDroppedWeaponData { scrValue m_ObjectGuid; scrValue m_PedGuid; }; struct sTransitionParameterData { public: static const u32 MAX_NUM_PARAMS = 10; public: scrGamerHandle m_hGamer; scrValue m_nNumberValues; scrValue m_PADDING_SizeOfColArray; //This is necessary to match the way the memory structure as laid out in SCRIPT sParameterData m_nParamData[MAX_NUM_PARAMS]; }; struct sClanEventInfo { scrValue m_clanId; scrValue m_bPrimary; }; struct sClanRankChangedInfo { scrValue m_clanId; scrValue m_iRankOrder; scrValue m_bPromotion; scrTextLabel31 m_rankName; }; struct sTransitionStringData { scrGamerHandle m_hGamer; scrValue m_nParameterID; scrTextLabel31 m_szParameter; }; struct sTransitionGamerInstructionData { scrGamerHandle m_hFromGamer; scrGamerHandle m_hToGamer; scrTextLabel63 m_szGamerTag; scrValue m_nInstruction; scrValue m_nInstructionParam; }; struct sPresenceInviteData { scrTextLabel63 m_szGamerTag; scrGamerHandle m_hGamer; scrTextLabel23 m_szContentID; scrValue m_nPlaylistLength; scrValue m_nPlaylistCurrent; scrValue m_bScTv; scrValue m_nInviteID; }; struct sPresenceInviteRemovedData { scrValue m_nInviteID; scrValue m_nReason; }; struct sInviteReplyData { scrGamerHandle m_hInvitee; scrValue m_nStatus; scrValue m_nCharacterRank; scrTextLabel15 m_ClanTag; scrValue m_bDecisionMade; scrValue m_bDecision; }; struct sCrewInviteReceivedData { scrValue m_clanId; scrTextLabel31 m_clanName; scrTextLabel7 m_clanTag; scrTextLabel31 m_RankName; scrValue m_bHasMessage; }; struct sCrewInviteRequestReceivedData { scrValue m_clanId; }; struct sCashTransactionLog { scrValue m_TransactionId; scrValue m_Id; scrValue m_Type; scrValue m_Amount; scrValue m_ItemId; scrGamerHandle m_hGamer; scrTextLabel63 m_StrAmount; }; struct sVehicleUndrivableData { scrValue VehicleId; scrValue DamagerId; scrValue WeaponUsed; }; struct sTextMessageData { scrTextLabel63 szTextMessage; scrGamerHandle hGamer; }; struct sGamePresenceEventTrigger { scrValue m_nEventNameHash; scrValue m_nEventParam1; scrValue m_nEventParam2; scrTextLabel63 m_nEventString; }; struct sFollowInviteData { scrGamerHandle hGamer; }; struct sAdminInviteData { scrGamerHandle hGamer; scrValue bIsSCTV; }; struct sSpectateLocalData { scrGamerHandle hGamer; }; struct sCloudEventData { scrValue m_nEventID; scrValue m_nEventParam1; scrValue m_nEventParam2; scrTextLabel63 m_nEventString; }; struct sNetworkShopTransaction { scrValue m_Id; scrValue m_Type; scrValue m_ResultCode; scrValue m_Action; scrValue m_Serviceid; scrValue m_Bank; scrValue m_Wallet; }; struct sPermissionCheckResult { scrValue m_nCheckID; scrValue m_bAllowed; }; struct sAppLaunchedData { scrValue m_nFlags; }; struct sSystemServiceEventData { scrValue m_nEventID; scrValue m_nFlags; }; struct sNetworkRequestDelayData { scrValue m_delayTimeMs; }; struct sNetworkScAdminPlayerUpdate { public: static const u32 MAX_NUM_ITEMS = 20; public: scrValue m_fullRefreshRequested; scrValue m_updatePlayerBalance; scrValue m_awardTypeHash; scrValue m_awardAmount; scrValue m_padding; // Padding scrValue m_items[MAX_NUM_ITEMS]; }; struct sNetworkScAdminReceivedCash { public: scrValue m_characterIndex; scrValue m_cashAmount; }; struct sNetworkStuntPerformed { public: scrValue m_stuntType; scrValue m_stuntValue; }; struct sPlayerTimedOutData { scrValue PlayerIndex; }; struct sScMembershipData { scrValue m_EventType; scrScMembershipInfo m_MembershipInfo; scrScMembershipInfo m_PrevMembershipInfo; }; struct sScBenefitsData { scrValue m_EventType; scrValue m_NumBenefits; scrValue m_BenefitValue; }; // ================================================================================================================ // CEventNetwork // // Base class for all network events. // Network game events are events generated in the game that the running script should know about and deal with. // These can be a variety of things such as the network event to start a game, etc. // ================================================================================================================ class CEventNetwork : public fwEvent { public: static const unsigned MAX_NETWORK_EVENTS = 500; virtual fwEvent* Clone() const; // all network events have the same priority at the moment virtual int GetEventPriority() const { return 0; } virtual atString GetName() const; FW_REGISTER_CLASS_POOL(CEventNetwork); // Only declare it virtual in the base class so it can be dead-stripped out of no-output builds. OUTPUT_ONLY(virtual void SpewEventInfo() const = 0); void SpewDeletionInfo() const; static bool CanCreateEvent(); protected: virtual fwEvent* CloneInternal() const = 0; #if !__NO_OUTPUT void SpewToTTY_Impl(const char* str, ...) const; #define SpewToTTY(...) CEventNetwork::SpewToTTY_Impl(__VA_ARGS__) #else #define SpewToTTY(fmt,...) do {} while (0) #endif }; // ================================================================================================================ // CEventNetworkNoData - A handy templated class to handle network events that have no associated data // ================================================================================================================ template class CEventNetworkNoData : public CEventNetwork { public: virtual int GetEventType() const { return EventType; } virtual bool operator==(const fwEvent& event) const { return (event.GetEventType() == this->GetEventType()); } virtual bool RetrieveData(u8* UNUSED_PARAM(data), const unsigned UNUSED_PARAM(sizeOfData)) const { Assertf(0, "%s: This event has no data to retrieve", GetName().c_str()); return false; } void SpewEventInfo() const {} protected: virtual fwEvent* CloneInternal() const { return rage_new DerivedClass(); } }; // ================================================================================================================ // CEventNetworkNoData - A handy templated class to handle network events with an associated struct that is retrieved by the scripts // ================================================================================================================ template class CEventNetworkWithData : public CEventNetwork { public: CEventNetworkWithData() {} CEventNetworkWithData(const EventData& eventData) : m_EventData(eventData) {} virtual int GetEventType() const { return EventType; } virtual bool operator==(const fwEvent& event) const { if (event.GetEventType() == this->GetEventType()) { Assert(dynamic_cast(&event)); if (memcmp(&static_cast(&event)->m_EventData, &m_EventData, sizeof(m_EventData)) == 0) { #if !__NO_OUTPUT SpewEventInfo(); SpewToTTY("Event dumped : This event already exists on the queue\n"); #endif return true; } } return false; } virtual bool RetrieveData(u8* data, const unsigned sizeOfData) const { if (AssertVerify(data) && Verifyf(sizeOfData == sizeof(m_EventData), "%s: Size of struct is wrong. Size \"%u\" should be \"%" SIZETFMT "u\".", GetName().c_str(), sizeOfData, sizeof(m_EventData))) { #if !__NO_OUTPUT SpewToTTY("Script retrieving data for event %s\n", GetName().c_str()); SpewEventInfo(); #endif sysMemCpy(data, &m_EventData, sizeof(m_EventData)); return true; } return false; } protected: virtual fwEvent* CloneInternal() const { return rage_new DerivedClass(m_EventData); } mutable EventData m_EventData; }; // ================================================================================================================ // CEventNetworkPlayerSession - base class for player session events // ================================================================================================================ template class CEventNetworkPlayerSession : public CEventNetworkWithData { public: CEventNetworkPlayerSession(const CNetGamePlayer& player) : CEventNetworkWithData() { Assert(player.GetPhysicalPlayerIndex() != INVALID_PLAYER_INDEX); safecpy(this->m_EventData.PlayerName, player.GetGamerInfo().GetDisplayName()); this->m_EventData.PlayerIndex.Int = player.GetPhysicalPlayerIndex(); this->m_EventData.PlayerTeam.Int = player.GetTeam(); } CEventNetworkPlayerSession(const sPlayerSessionData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... player name: \"%s\"", this->m_EventData.PlayerName); SpewToTTY("... player index: \"%d\"", this->m_EventData.PlayerIndex); SpewToTTY("... player team: \"%d\"", this->m_EventData.PlayerTeam); } }; // ================================================================================================================ // CEventNetworkPlayerScript - base class for player script events // ================================================================================================================ template class CEventNetworkPlayerScript : public CEventNetworkWithData { public: enum eSource { SOURCE_NORMAL, SOURCE_TRANSITION, SOURCE_STORE, }; enum FlagTypes { IS_BOSS = BIT0, }; CEventNetworkPlayerScript(const scrThreadId threadId, const CNetGamePlayer& player, eSource nSource, int nBailReason) { Assert(player.GetPhysicalPlayerIndex() != INVALID_PLAYER_INDEX); this->m_EventData.aScripts[0].Int = threadId; this->m_EventData.nNumScripts.Int = 1; safecpy(this->m_EventData.PlayerName, player.GetGamerInfo().GetDisplayName()); this->m_EventData.PlayerIndex.Int = player.GetPhysicalPlayerIndex(); this->m_EventData.PlayerTeam.Int = player.GetTeam(); this->m_EventData.nSource.Int = static_cast(nSource); this->m_EventData.nBailReason.Int = nBailReason; player.GetGamerInfo().GetGamerHandle().Export(this->m_EventData.m_hPlayer, sizeof(this->m_EventData.m_hPlayer)); int playerFlags = 0; if(player.IsBoss()) { playerFlags |= FlagTypes::IS_BOSS; } this->m_EventData.iPlayerFlags.Int = playerFlags; } CEventNetworkPlayerScript(const sPlayerScriptData& eventData) : CEventNetworkWithData(eventData) { } virtual bool RetrieveData(u8* data, const unsigned sizeOfData) const { // account for script array prefix, containing the array size int arraySize = ((sPlayerScriptData*)data)->arraySize.Int; if (CEventNetworkWithData::RetrieveData(data, sizeOfData)) { ((sPlayerScriptData*)data)->arraySize.Int = arraySize; return true; } return false; } bool CollateEvent(const netPlayer& player, eSource nSource, const scrThreadId threadId) const { if (this->m_EventData.PlayerIndex.Int == player.GetPhysicalPlayerIndex() && this->m_EventData.nSource.Int == static_cast(nSource)) { #if !__FINAL SpewToTTY("%s triggered - collated with previous event", this->GetName().c_str()); this->SpewEventInfo(); #endif // !__FINAL int playerFlags = 0; CNetGamePlayer* pPlayer = NetworkInterface::GetPhysicalPlayerFromIndex(player.GetPhysicalPlayerIndex()); if(pPlayer && pPlayer->IsBoss()) { playerFlags |= FlagTypes::IS_BOSS; } this->m_EventData.iPlayerFlags.Int = playerFlags; int numScripts = this->m_EventData.nNumScripts.Int; if (numScripts < MAX_NUM_SCRIPTS) { for (u32 i=0; im_EventData.aScripts[i].Int == threadId) { return true; } } this->m_EventData.aScripts[numScripts].Int = threadId; this->m_EventData.nNumScripts.Int++; } return true; } return false; } void SpewEventInfo() const { SpewToTTY("... player name: \"%s\"", this->m_EventData.PlayerName); SpewToTTY("... player index: \"%d\"", this->m_EventData.PlayerIndex.Int); SpewToTTY("... player team: \"%d\"", this->m_EventData.PlayerTeam.Int); SpewToTTY("... source: %d", this->m_EventData.nSource.Int); SpewToTTY("... player flags: %d", this->m_EventData.iPlayerFlags.Int); for (u32 i=0; im_EventData.nNumScripts.Int; i++) { SpewToTTY("... script thread: \"%d\"", this->m_EventData.aScripts[i].Int); } } }; // ================================================================================================================ // CEventNetworkPlayerJoinSession - triggered when a player joins the game. // ================================================================================================================ class CEventNetworkPlayerJoinSession : public CEventNetworkPlayerSession { public: CEventNetworkPlayerJoinSession(const CNetGamePlayer& player) : CEventNetworkPlayerSession(player) { } CEventNetworkPlayerJoinSession(const sPlayerSessionData& eventData) : CEventNetworkPlayerSession(eventData) { } }; // ================================================================================================================ // CEventNetworkPlayerLeftSession - triggered when a player leaves the game. // ================================================================================================================ class CEventNetworkPlayerLeftSession : public CEventNetworkPlayerSession { public: CEventNetworkPlayerLeftSession(const CNetGamePlayer& player) : CEventNetworkPlayerSession(player) { } CEventNetworkPlayerLeftSession(const sPlayerSessionData& eventData) : CEventNetworkPlayerSession(eventData) { } }; // ================================================================================================================ // CEventNetworkPlayerJoinScript - triggered when a player joins a script session // ================================================================================================================ class CEventNetworkPlayerJoinScript : public CEventNetworkPlayerScript { public: CEventNetworkPlayerJoinScript(const scrThreadId threadId, const CNetGamePlayer& player, CEventNetworkPlayerScript::eSource nSource) : CEventNetworkPlayerScript(threadId, player, nSource, -1) { } CEventNetworkPlayerJoinScript(const sPlayerScriptData& eventData) : CEventNetworkPlayerScript(eventData) { } }; // ================================================================================================================ // CEventNetworkPlayerLeftScript - triggered when a player leaves a script session // ================================================================================================================ class CEventNetworkPlayerLeftScript : public CEventNetworkPlayerScript { public: CEventNetworkPlayerLeftScript(const scrThreadId threadId, const CNetGamePlayer& player, CEventNetworkPlayerScript::eSource nSource, const int nBailReason) : CEventNetworkPlayerScript(threadId, player, nSource, nBailReason) { } CEventNetworkPlayerLeftScript(const sPlayerScriptData& eventData) : CEventNetworkPlayerScript(eventData) { } }; // ================================================================================================================ // CEventNetworkStorePlayerLeft - Triggered when a player who leaves for the store times out // ================================================================================================================ class CEventNetworkStorePlayerLeft : public CEventNetworkWithData { public: CEventNetworkStorePlayerLeft(const rlGamerHandle& hGamer, const char* szName) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); safecpy(m_EventData.m_szGamerTag, szName); } CEventNetworkStorePlayerLeft(const sStorePlayerData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... name: %s", m_EventData.m_szGamerTag); } }; // ================================================================================================================ // CEventNetworkStartGame - triggered when the network game should start. // ================================================================================================================ class CEventNetworkStartSession : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkEndSession - triggered when the network has ended and the Single Player game is re-started. // ================================================================================================================ class CEventNetworkEndSession : public CEventNetworkWithData { public: CEventNetworkEndSession(const LeaveSessionReason nLeaveReason) { m_EventData.nLeaveReason.Int = nLeaveReason; } CEventNetworkEndSession(const sLeaveSessionData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Leave Reason: %d", m_EventData.nLeaveReason); } }; // ================================================================================================================ // CEventNetworkStartMatch - triggered when the network game should start play. // ================================================================================================================ class CEventNetworkStartMatch : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkEndMatch - triggered when the network game should end play. // ================================================================================================================ class CEventNetworkEndMatch : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkRemovedFromSessionDueToStall - triggered when local player self ejects from a session due to a long stall // ================================================================================================================ class CEventNetworkRemovedFromSessionDueToStall : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkRemovedFromSessionDueToComplaints - triggered when local player is ejected from the session by the host // due to peer complaints // ================================================================================================================ class CEventNetworkRemovedFromSessionDueToComplaints : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkConnectionTimeout - Triggered when a remote connection times out // ================================================================================================================ class CEventNetworkConnectionTimeout : public CEventNetworkWithData { public: CEventNetworkConnectionTimeout(PhysicalPlayerIndex nPlayerIndex) { m_EventData.PlayerIndex.Int = (int)nPlayerIndex; } CEventNetworkConnectionTimeout() : CEventNetworkWithData() { m_EventData.PlayerIndex.Int = INVALID_PLAYER_INDEX; } CEventNetworkConnectionTimeout(const sPlayerTimedOutData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("...PPI: %d",m_EventData.PlayerIndex.Int); } }; // ================================================================================================================ // CEventNetworkPlayerSpawn - triggered when a player respawns // ================================================================================================================ class CEventNetworkPlayerSpawn : public CEventNetworkPlayerSession { public: CEventNetworkPlayerSpawn(const CNetGamePlayer& player) : CEventNetworkPlayerSession(player) { } CEventNetworkPlayerSpawn(const sPlayerSessionData& eventData) : CEventNetworkPlayerSession(eventData) { } }; // ================================================================================================================ // CEventNetworkEntityDamage - triggered when a entity is damaged. // ================================================================================================================ class CEventNetworkEntityDamage : public CEventNetworkWithData { public: CEventNetworkEntityDamage(const CNetObjPhysical* victim, const CNetObjPhysical::NetworkDamageInfo& damageInfo, const bool isResponsibleForCollision); CEventNetworkEntityDamage(const sEntityDamagedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const; //Returns true if the damage event should be added. // Exceptions: // - 2 vehicles colliding and if one is stopped we dont want to add a damage event if the damager is the car stopped; static bool IsVehicleResponsibleForCollision(const CVehicle* victim, const CVehicle* damager, const u32 weaponHash); static CVehicle* GetVehicle(CEntity* entity); virtual bool operator==(const fwEvent& event) const { if (CEventNetworkWithData::operator==(event)) { Assert(dynamic_cast(&event)); const CEventNetworkEntityDamage* pDamageEvent = static_cast(&event); if (pDamageEvent->m_pVictim.Get() == m_pVictim.Get() && pDamageEvent->m_pDamager.Get() == m_pDamager.Get()) { return true; } } return false; } virtual bool RetrieveData(u8* data, const unsigned sizeOfData) const; private: static bool IsVehicleVictim(const CVehicle* victim, const CVehicle* damager, const bool victimDriverIsPlayer, const bool damagerDriverIsPlayer); static bool PointSameDirection(const float dot); static bool PointOppositeDirection(const float dot); void ApplyCopsCrooksModifiers(const CVehicle* victimVehicle, const CVehicle* damagerVehicle); virtual fwEvent* CloneInternal() const; RegdEnt m_pVictim; RegdEnt m_pDamager; }; // ================================================================================================================ // CEventNetworkPlayerCollectedPickup - triggered when a player collects a pickup. // ================================================================================================================ class CEventNetworkPlayerCollectedPickup : public CEventNetworkWithData { public: CEventNetworkPlayerCollectedPickup(const CNetGamePlayer& player, const int placementReference, u32 pickupHash, const int pickupAmount, const u32 customModel, const int pickupCollected); CEventNetworkPlayerCollectedPickup(const int placementReference, u32 pickupHash, const int pickupAmount, const u32 customModel, const int pickupCollected); CEventNetworkPlayerCollectedPickup(const sPickupCollectedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... pickup ref: \"%d\"", m_EventData.PlacementReference); SpewToTTY("... player index: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... pickup hash: \"%d\"", m_EventData.PickupHash); SpewToTTY("... pickup amount: \"%d\"", m_EventData.PickupAmount); SpewToTTY("... pickup model: \"%d\"", m_EventData.PickupModel); SpewToTTY("... pickup amount collected: \"%d\"", m_EventData.PickupCollected); } }; // ================================================================================================================ // CEventNetworkPlayerCollectedAmbientPickup - triggered when a player collects an ambient pickup. // ================================================================================================================ class CEventNetworkPlayerCollectedAmbientPickup : public CEventNetworkWithData { public: CEventNetworkPlayerCollectedAmbientPickup(const CNetGamePlayer& player, u32 pickupHash, const int pickupID, const int pickupAmount, const u32 customModel, bool bPlayerGift, bool bDroppedByPed, const int pickupCollected, const int pickupIndex); CEventNetworkPlayerCollectedAmbientPickup(u32 pickupHash, const int pickupID, const int pickupAmount, const u32 customModel, bool bDroppedByPed, bool bPlayerGift, const int pickupCollected, const int pickupIndex); CEventNetworkPlayerCollectedAmbientPickup(const sAmbientPickupCollectedData& eventData) : CEventNetworkWithData(eventData) { } virtual bool operator==(const fwEvent& event) const { if (CEventNetworkWithData::operator==(event)) { Assert(dynamic_cast(&event)); const CEventNetworkPlayerCollectedAmbientPickup* pEvent = static_cast(&event); if (pEvent->m_PickupID == m_PickupID) { return true; } } return false; } void SpewEventInfo() const { SpewToTTY("... pickup id: \"%d\"", m_PickupID); SpewToTTY("... pickup type: \"%d\"", m_EventData.PickupHash); SpewToTTY("... pickup amount: \"%d\"", m_EventData.PickupAmount); SpewToTTY("... player index: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... pickup model: \"%d\"", m_EventData.PickupModel); SpewToTTY("... player gift: \"%d\"", m_EventData.PlayerGift); SpewToTTY("... dropped by ped: \"%d\"", m_EventData.DroppedByPed); SpewToTTY("... player amount collected: \"%d\"", m_EventData.PickupCollected); SpewToTTY("... pickup index: \"%d\"", m_EventData.PickupIndex); } private: fwEvent* CloneInternal() const { CEventNetworkPlayerCollectedAmbientPickup* pClone = rage_new CEventNetworkPlayerCollectedAmbientPickup(m_EventData); pClone->m_PickupID = m_PickupID; return pClone; } int m_PickupID; }; // ================================================================================================================ // CEventNetworkPlayerCollectedPortablePickup - triggered when a player collects an ambient pickup. // ================================================================================================================ class CEventNetworkPlayerCollectedPortablePickup : public CEventNetworkWithData { public: CEventNetworkPlayerCollectedPortablePickup(const CNetGamePlayer& player, const int pickupID, const ObjectId pickupNetID, const u32 customModel); CEventNetworkPlayerCollectedPortablePickup(const int pickupID, const u32 customModel); CEventNetworkPlayerCollectedPortablePickup(const sPortablePickupCollectedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... pickup id: \"%d\"", m_EventData.PickupID); SpewToTTY("... pickup net id: \"%d\"", m_EventData.PickupNetID); SpewToTTY("... player id: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... pickup model: \"%d\"", m_EventData.PickupModel); } }; // ================================================================================================================ // CEventNetworkPlayerDroppedPortablePickup - triggered when a player collects an ambient pickup. // ================================================================================================================ class CEventNetworkPlayerDroppedPortablePickup : public CEventNetworkWithData { public: CEventNetworkPlayerDroppedPortablePickup(const CNetGamePlayer& player, const int pickupID, const ObjectId pickupNetID); CEventNetworkPlayerDroppedPortablePickup(const int pickupID); CEventNetworkPlayerDroppedPortablePickup(const sPortablePickupCollectedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... pickup id: \"%d\"", m_EventData.PickupID); SpewToTTY("... player id: \"%d\"", m_EventData.PlayerIndex); } }; // ================================================================================================================ // CEventNetworkPedDroppedWeapon - triggered when a ped drops a weapon // ================================================================================================================ class CEventNetworkPedDroppedWeapon : public CEventNetworkWithData { public: CEventNetworkPedDroppedWeapon(int objectGuid, CPed& ped); CEventNetworkPedDroppedWeapon(const sDroppedWeaponData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... dropped weapon guid: \"%d\"", m_EventData.m_ObjectGuid); SpewToTTY("... ped ned Id: \"%d\"", m_PedId); SpewToTTY("... ped guid: \"%d\"", m_EventData.m_PedGuid); } private: ObjectId m_PedId; }; // ================================================================================================================ // CEventNetworkPlayerArrest - triggered when a player is arrested // ================================================================================================================ class CEventNetworkPlayerArrest : public CEventNetworkWithData { public: CEventNetworkPlayerArrest(CPed* arrester, CPed* arrestee, int type); CEventNetworkPlayerArrest(const sPlayerArrestedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... arrester id: \"%d\"", m_EventData.ArresterIndex); SpewToTTY("... arrestee id: \"%d\"", m_EventData.ArresteeIndex); SpewToTTY("... type: \"%d\"", m_EventData.ArrestType); } }; class CEventNetworkPlayerEnteredVehicle : public CEventNetworkWithData { public: CEventNetworkPlayerEnteredVehicle (const CNetGamePlayer& player, CVehicle& vehicle); CEventNetworkPlayerEnteredVehicle(const sPlayerEnteredVehicleData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... player id: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... vehicle id: \"%d\"", m_EventData.VehicleIndex); } }; // ================================================================================================================ // CEventNetworkPlayerActivatedSpecialAbility - triggered when a player activates their special ability // ================================================================================================================ class CEventNetworkPlayerActivatedSpecialAbility : public CEventNetworkWithData { public: CEventNetworkPlayerActivatedSpecialAbility(const CNetGamePlayer& player, SpecialAbilityType specialAbility); CEventNetworkPlayerActivatedSpecialAbility(const sPlayerActivatedSpecialAbilityData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... player id: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... special ability id: \"%d\"", m_EventData.SpecialAbility); } }; // ================================================================================================================ // CEventNetworkPlayerDeactivatedSpecialAbility - triggered when a player special ability has deactivated // ================================================================================================================ class CEventNetworkPlayerDeactivatedSpecialAbility : public CEventNetworkWithData { public: CEventNetworkPlayerDeactivatedSpecialAbility(const CNetGamePlayer& player, SpecialAbilityType specialAbility); CEventNetworkPlayerDeactivatedSpecialAbility(const sPlayerDeactivatedSpecialAbilityData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... player id: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... special ability id: \"%d\"", m_EventData.SpecialAbility); } }; // ================================================================================================================ // CEventNetworkPlayerSpecialAbilityFailedActivation - triggered when a player has attempted to use a special ability but the activation has failed // ================================================================================================================ class CEventNetworkPlayerSpecialAbilityFailedActivation : public CEventNetworkWithData { public: CEventNetworkPlayerSpecialAbilityFailedActivation(const CNetGamePlayer& player, SpecialAbilityType specialAbility); CEventNetworkPlayerSpecialAbilityFailedActivation(const sPlayerSpecialAbilityFailedActivation& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... player id: \"%d\"", m_EventData.PlayerIndex); SpewToTTY("... special ability id: \"%d\"", m_EventData.SpecialAbility); } }; // ================================================================================================================ // CEventNetworkTimedExplosion - triggered when a vehicle timed explosion is triggered // ================================================================================================================ class CEventNetworkTimedExplosion : public CEventNetworkWithData { public: CEventNetworkTimedExplosion(CEntity* pVehicle, CEntity* pCulprit); CEventNetworkTimedExplosion(const sTimedExplosionData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... vehicle id: \"%d\"", m_EventData.nVehicleIndex); SpewToTTY("... culprit id: \"%d\"", m_EventData.nCulpritIndex); } }; // ================================================================================================================ // CEventNetworkFiredDummyProjectile - triggered when an NPC fires a dummy projectile that explodes close to the target without affecting it // ================================================================================================================ class CEventNetworkFiredDummyProjectile : public CEventNetworkWithData { public: CEventNetworkFiredDummyProjectile(CEntity* pFiringPed, CEntity* pProjectile, u32 weaponType); CEventNetworkFiredDummyProjectile(const sDummyProjectileLaunchedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Firing Ped index: \"%d\"", m_EventData.nFiringPedIndex); SpewToTTY("... Weapon type: \"%d\"", m_EventData.nWeaponType); } }; // ================================================================================================================ // CEventNetworkFiredVehicleProjectile - triggered when a projectile has been fired. // ================================================================================================================ class CEventNetworkFiredVehicleProjectile : public CEventNetworkWithData { public: CEventNetworkFiredVehicleProjectile(CEntity* pFiringVehicle, CEntity* pFiringPed, CEntity* pProjectile, u32 weaponType); CEventNetworkFiredVehicleProjectile(const sVehicleProjectileLaunchedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Firing Vehicle index: \"%d\"", m_EventData.nFiringVehicleIndex); SpewToTTY("... Firing Ped index: \"%d\"", m_EventData.nFiringPedIndex); SpewToTTY("... Weapon type: \"%d\"", m_EventData.nWeaponType); } }; // ================================================================================================================ // CEventNetworkInviteArrived - triggered when an invite arrives. // ================================================================================================================ class CEventNetworkInviteArrived : public CEventNetworkWithData { public: CEventNetworkInviteArrived(const unsigned index); CEventNetworkInviteArrived(const sInviteArrivedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... index: \"%d\"", m_EventData.InviteIndex); SpewToTTY("... gamemode: \"%d\"", m_EventData.GameMode); SpewToTTY("... isFriend: \"%s\"", (m_EventData.IsFriend.Int == TRUE) ? "true" : "false"); } }; // ================================================================================================================ // CEventNetworkInviteAccepted - triggered when a user accepts an invite (through Platform UI) // ================================================================================================================ class CEventNetworkInviteAccepted : public CEventNetworkWithData { public: CEventNetworkInviteAccepted(const rlGamerHandle& hInviter, const unsigned gameMode, const SessionPurpose sessionPurpose, const bool bViaParty, const unsigned aimType, const int activityType, const unsigned activityId, const bool bIsSCTV, const unsigned nFlags, const u8 nNumBosses) { if(hInviter.IsValid()) hInviter.Export(m_EventData.m_hInviter, sizeof(m_EventData.m_hInviter)); m_EventData.nGameMode.Int = static_cast(gameMode); m_EventData.nSessionPurpose.Int = static_cast(sessionPurpose); m_EventData.bViaParty.Int = bViaParty ? TRUE : FALSE; m_EventData.nAimType.Int = aimType; m_EventData.nActivityType.Int = activityType; m_EventData.nActivityID.Int = static_cast(activityId); m_EventData.bIsSCTV.Int = bIsSCTV ? TRUE : FALSE; m_EventData.nFlags.Int = static_cast(nFlags); m_EventData.nNumBosses.Int = static_cast(nNumBosses); } CEventNetworkInviteAccepted(const sInviteData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... nGameMode: \"%d\"", m_EventData.nGameMode.Int); SpewToTTY("... nSessionPurpose: \"%d\"", m_EventData.nSessionPurpose.Int); SpewToTTY("... bViaParty: \"%s\"", (m_EventData.bViaParty.Int == TRUE) ? "true" : "false"); SpewToTTY("... nAimType: \"%d\"", m_EventData.nAimType.Int); SpewToTTY("... nActivityType: \"%d\"", m_EventData.nActivityType.Int); SpewToTTY("... nActivityID: \"%08x\"", m_EventData.nActivityID.Int); SpewToTTY("... bIsSCTV: \"%s\"", (m_EventData.bIsSCTV.Int == TRUE) ? "true" : "false"); SpewToTTY("... Flags: \"%d\"", m_EventData.nFlags.Int); SpewToTTY("... Num Bosses: \"%d\"", m_EventData.nNumBosses.Int); } }; // ================================================================================================================ // CEventNetworkInviteConfirmed - triggered when an invite arrives. // ================================================================================================================ class CEventNetworkInviteConfirmed : public CEventNetworkWithData { public: CEventNetworkInviteConfirmed(const rlGamerHandle& hInviter, const unsigned gameMode, const SessionPurpose sessionPurpose, const bool bViaParty, const unsigned aimType, const int activityType, const unsigned activityId, const bool bIsSCTV, const unsigned nFlags, const u8 nNumBosses) { if(hInviter.IsValid()) hInviter.Export(m_EventData.m_hInviter, sizeof(m_EventData.m_hInviter)); m_EventData.nGameMode.Int = static_cast(gameMode); m_EventData.nSessionPurpose.Int = static_cast(sessionPurpose); m_EventData.bViaParty.Int = bViaParty ? TRUE : FALSE; m_EventData.nAimType.Int = static_cast(aimType); m_EventData.nActivityType.Int = activityType; m_EventData.nActivityID.Int = static_cast(activityId); m_EventData.bIsSCTV.Int = bIsSCTV ? TRUE : FALSE; m_EventData.nFlags.Int = static_cast(nFlags); m_EventData.nNumBosses.Int = static_cast(nNumBosses); } CEventNetworkInviteConfirmed(const sInviteData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... nGameMode: \"%d\"", m_EventData.nGameMode.Int); SpewToTTY("... nSessionPurpose: \"%d\"", m_EventData.nSessionPurpose.Int); SpewToTTY("... bViaParty: \"%s\"", (m_EventData.bViaParty.Int == TRUE) ? "true" : "false"); SpewToTTY("... nAimType: \"%d\"", m_EventData.nAimType.Int); SpewToTTY("... nActivityType: \"%d\"", m_EventData.nActivityType.Int); SpewToTTY("... nActivityID: \"%08x\"", m_EventData.nActivityID.Int); SpewToTTY("... bIsSCTV: \"%s\"", (m_EventData.bIsSCTV.Int == TRUE) ? "true" : "false"); SpewToTTY("... Flags: \"%d\"", m_EventData.nFlags.Int); SpewToTTY("... Num Bosses: \"%d\"", m_EventData.nNumBosses.Int); } }; // ================================================================================================================ // CEventNetworkInviteRejected - Triggered when a player rejects an invite // ================================================================================================================ class CEventNetworkInviteRejected : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkSummon - triggered when a summon is done, i.e., when the player moves into an invite session // ================================================================================================================ class CEventNetworkSummon : public CEventNetworkWithData { public: CEventNetworkSummon(const unsigned gameMode, const SessionPurpose sessionPurpose) { m_EventData.nGameMode.Int = static_cast(gameMode); m_EventData.nSessionPurpose.Int = static_cast(sessionPurpose); } CEventNetworkSummon(const sSummonData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... nGameMode: \"%d\"", m_EventData.nGameMode.Int); SpewToTTY("... nSessionPurpose: \"%d\"", m_EventData.nSessionPurpose.Int); } }; // ================================================================================================================ // CEventNetworkReceivedData - Triggered when a scripted event containing data is received. // ================================================================================================================ class CEventNetworkScriptEvent : public CEventNetworkWithData { public: CEventNetworkScriptEvent(void* data, const unsigned sizeOfData, const netPlayer* fromPlayer); CEventNetworkScriptEvent(const sScriptEventData& eventData) : CEventNetworkWithData(eventData) { } // redefine this because sizeOfData is allowed to be less than the size of the EventData (script events vary in size) virtual bool RetrieveData(u8* data, const unsigned sizeOfData) const { if (AssertVerify(data) && Verifyf(sizeOfData <= sizeof(m_EventData), "%s: Size of struct (%d) is too large, it can't exceeed %" SIZETFMT "d", GetName().c_str(), sizeOfData, sizeof(m_EventData))) { sysMemCpy(data, &m_EventData, sizeOfData); return true; } return false; } void SpewEventInfo() const; }; // ================================================================================================================ // CEventNetworkPlayerSignedOffline - triggered when the local player signs out. // ================================================================================================================ class CEventNetworkPlayerSignedOffline : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkSignInStateChanged - Triggered when the players sign in state changes // ================================================================================================================ class CEventNetworkSignInStateChanged : public CEventNetworkWithData { public: CEventNetworkSignInStateChanged(int nIndex, bool bIsActiveUser, bool bWasSignedIn, bool bWasOnline, bool bIsSignedIn, bool bIsOnline, bool bIsDuplicateSignIn) { m_EventData.nIndex.Int = nIndex; m_EventData.bIsActiveUser.Int = bIsActiveUser; m_EventData.bWasSignedIn.Int = bWasSignedIn; m_EventData.bWasOnline.Int = bWasOnline; m_EventData.bIsSignedIn.Int = bIsSignedIn; m_EventData.bIsOnline.Int = bIsOnline; m_EventData.bIsDuplicateSignIn.Int = bIsDuplicateSignIn; } CEventNetworkSignInStateChanged(const sSignInChangedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY(" nIndex: %d", m_EventData.nIndex.Int); SpewToTTY(" bIsActiveUser: %s", m_EventData.bIsActiveUser.Int ? "True" : "False"); SpewToTTY(" bWasSignedIn: %s", m_EventData.bWasSignedIn.Int ? "True" : "False"); SpewToTTY(" bWasOnline: %s", m_EventData.bWasOnline.Int ? "True" : "False"); SpewToTTY(" bIsSignedIn: %s", m_EventData.bIsSignedIn.Int ? "True" : "False"); SpewToTTY(" bIsOnline: %s", m_EventData.bIsOnline.Int ? "True" : "False"); SpewToTTY("bIsDuplicateSignIn: %s", m_EventData.bIsDuplicateSignIn.Int ? "True" : "False"); } }; // ================================================================================================================ // CEventNetworkSignInChangeActioned - triggered when we actually action a sign in state change // ================================================================================================================ class CEventNetworkSignInChangeActioned : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkRosChanged - Triggered when ROS settings change // ================================================================================================================ class CEventNetworkRosChanged : public CEventNetworkWithData { public: CEventNetworkRosChanged(bool bValidCredentials, bool bValidRockstarID) { m_EventData.bValidCredentials.Int = bValidCredentials; m_EventData.bValidRockstarID.Int = bValidRockstarID; } CEventNetworkRosChanged(const sRosChangedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("Valid Credentials: %s", m_EventData.bValidCredentials.Int ? "True" : "False"); SpewToTTY("Valid Rockstar ID: %s", m_EventData.bValidRockstarID.Int ? "True" : "False"); } }; // ================================================================================================================ // CEventNetworkBail - triggered when the network game finishes abruptly by a sign out, connection lost, etc. // ================================================================================================================ class CEventNetworkBail : public CEventNetworkWithData { public: CEventNetworkBail(int nBailReason, int nBailErrorCode) { m_EventData.nBailReason.Int = nBailReason; m_EventData.nBailErrorCode.Int = nBailErrorCode; } CEventNetworkBail(const sBailData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("Bail Reason: %d", m_EventData.nBailReason.Int); SpewToTTY("Bail Error Code: %d", m_EventData.nBailErrorCode.Int); } }; // ================================================================================================================ // CEventNetworkHostMigration - triggered when the host has migrated. // ================================================================================================================ class CEventNetworkHostMigration : public CEventNetworkWithData { public: CEventNetworkHostMigration(const scrThreadId threadId, const CNetGamePlayer& player); CEventNetworkHostMigration(const sHostMigrateData& eventData) : CEventNetworkWithData(eventData) { } virtual bool operator==(const fwEvent& event) const { if (event.GetEventType() == this->GetEventType()) { Assert(dynamic_cast(&event)); const CEventNetworkHostMigration* pMigrationEvent = static_cast(&event); if (pMigrationEvent->m_EventData.ThreadId == this->m_EventData.ThreadId) { // the host can migrate multiple times during a frame, if multiple players leave at once. So copy the most recent // host player index and dump the event. #if !__NO_OUTPUT int prevId = this->m_EventData.HostPlayerIndex.Int; #endif this->m_EventData.HostPlayerIndex = pMigrationEvent->m_EventData.HostPlayerIndex; #if !__NO_OUTPUT SpewEventInfo(); SpewToTTY("Event dumped : This event already exists on the queue. New host id (%d) copied to existing event (prev id: %d). \n", this->m_EventData.HostPlayerIndex, prevId); #endif return true; } } return false; } void SpewEventInfo() const; }; // ================================================================================================================ // CEventNetworkAttemptHostMigration - triggered when the host migration is attempted // ================================================================================================================ class CEventNetworkAttemptHostMigration : public CEventNetworkWithData { public: CEventNetworkAttemptHostMigration(const scrThreadId threadId, const CNetGamePlayer& player); CEventNetworkAttemptHostMigration(const sHostMigrateData& eventData) : CEventNetworkWithData(eventData) { } virtual bool operator==(const fwEvent& event) const { if (event.GetEventType() == this->GetEventType()) { Assert(dynamic_cast(&event)); const CEventNetworkAttemptHostMigration* pMigrationEvent = static_cast(&event); if (pMigrationEvent->m_EventData.ThreadId == this->m_EventData.ThreadId) { // the host can migrate multiple times during a frame, if multiple players leave at once. So copy the most recent // host player index and dump the event. #if !__NO_OUTPUT int prevId = this->m_EventData.HostPlayerIndex.Int; #endif this->m_EventData.HostPlayerIndex = pMigrationEvent->m_EventData.HostPlayerIndex; #if !__NO_OUTPUT SpewEventInfo(); SpewToTTY("Event dumped : This event already exists on the queue. New host id (%d) copied to existing event (prev id: %d). \n", this->m_EventData.HostPlayerIndex, prevId); #endif return true; } } return false; } void SpewEventInfo() const; }; // ================================================================================================================ // CEventNetworkFindSession - triggered when we start the search for a session to join. // ================================================================================================================ class CEventNetworkFindSession : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkHostSession - triggered when a session is hosted. // ================================================================================================================ class CEventNetworkHostSession : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkJoinSession - triggered when we start to join a session. // ================================================================================================================ class CEventNetworkJoinSession : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkJoinSessionResponse - triggered when we have a response to a join request // ================================================================================================================ class CEventNetworkJoinSessionResponse : public CEventNetworkWithData { public: CEventNetworkJoinSessionResponse(const bool bWasSuccessful, const int nResponseCode) { m_EventData.bWasSuccessful.Int = bWasSuccessful ? TRUE : FALSE; m_EventData.nResponse.Int = nResponseCode; } CEventNetworkJoinSessionResponse(const sJoinResponseData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Was Successful: \"%s\"", (m_EventData.bWasSuccessful.Int == TRUE) ? "true" : "false"); SpewToTTY("... Request Code: \"%d\"", m_EventData.nResponse.Int); } }; // ================================================================================================================ // CEventNetworkCheatTriggered - triggered when a player uses a cheat (give weapons, invincible, etc) // ================================================================================================================ class CEventNetworkCheatTriggered : public CEventNetworkWithData { public: enum eCheatType { CHEAT_INVINCIBLE, CHEAT_WEAPONS, CHEAT_HEALTH, CHEAT_VEHICLE, CHEAT_WARP }; public: CEventNetworkCheatTriggered(const eCheatType cheatType) { m_EventData.CheatType.Int = cheatType; } CEventNetworkCheatTriggered(const sCheatEventData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { switch (m_EventData.CheatType.Int) { case CHEAT_INVINCIBLE: SpewToTTY("... cheat: INVINCIBLE"); break; case CHEAT_WEAPONS: SpewToTTY("... cheat: WEAPONS"); break; case CHEAT_HEALTH: SpewToTTY("... cheat: HEALTH"); break; case CHEAT_VEHICLE: SpewToTTY("... cheat: VEHICLE"); break; case CHEAT_WARP: SpewToTTY("... cheat: WARP"); break; default: Assertf(0, "CEventNetworkCheatTriggered: unrecognised cheat type"); } } }; // ================================================================================================================ // CEventNetworkIncrementStat - Trigged when a stat is incremented over the network (eg, player got reported) // ================================================================================================================ class CEventNetworkIncrementStat : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkPrimaryClanChanged - triggered when the primary clan membership changes. // ================================================================================================================ class CEventNetworkPrimaryClanChanged : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkClanJoined - triggered when we join a clan. // ================================================================================================================ class CEventNetworkClanJoined : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkClanLeft - triggered when we leave a clan. // ================================================================================================================ class CEventNetworkClanLeft : public CEventNetworkWithData { public: CEventNetworkClanLeft(rlClanId clanId, bool bPrimary) { m_EventData.m_clanId.Int = (u32)clanId; m_EventData.m_bPrimary.Int = bPrimary; } CEventNetworkClanLeft() : CEventNetworkWithData() { m_EventData.m_clanId.Int = (u32)RL_INVALID_CLAN_ID; m_EventData.m_bPrimary.Int = false; } CEventNetworkClanLeft(const sClanEventInfo& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... crewID: %d", m_EventData.m_clanId.Int); SpewToTTY("... Primary: %s", m_EventData.m_bPrimary.Int ? "TRUE" : "FALSE"); } }; // ================================================================================================================ // CEventNetworkClanInviteReceived - triggered when we receive a clan invite. // ================================================================================================================ class CEventNetworkClanInviteReceived : public CEventNetworkWithData { public: CEventNetworkClanInviteReceived(rlClanId clanId, const char* clanName, const char* clanTag, const char* rankName, bool bMessage) { m_EventData.m_clanId.Int = (u32)clanId; safecpy(m_EventData.m_clanName, clanName); safecpy(m_EventData.m_clanTag, clanTag); safecpy(m_EventData.m_RankName, rankName); m_EventData.m_bHasMessage.Int = bMessage ? 1 : 0; } CEventNetworkClanInviteReceived() : CEventNetworkWithData() { m_EventData.m_clanId.Int = (u32)RL_INVALID_CLAN_ID; m_EventData.m_clanName[0] = '\0'; m_EventData.m_clanTag[0] = '\0'; m_EventData.m_RankName[0] = '\0'; m_EventData.m_bHasMessage.Int = 0; } CEventNetworkClanInviteReceived(const sCrewInviteReceivedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("...crewid: %d",m_EventData.m_clanId.Int); SpewToTTY("...crew name: '%s'",m_EventData.m_clanName); SpewToTTY("...crew tag: '%s'",m_EventData.m_clanTag); SpewToTTY("...rank: '%s'",m_EventData.m_RankName); SpewToTTY("...Has Message: %s",m_EventData.m_bHasMessage.Int == 0 ? "false" : "true"); } }; // ================================================================================================================ // CEventNetworkClanInviteRequestReceived - triggered when we receive a clan invite request. // ================================================================================================================ class CEventNetworkClanInviteRequestReceived : public CEventNetworkWithData { public: CEventNetworkClanInviteRequestReceived(rlClanId clanId) { m_EventData.m_clanId.Int = (u32)clanId; } CEventNetworkClanInviteRequestReceived() : CEventNetworkWithData() { m_EventData.m_clanId.Int = (u32)RL_INVALID_CLAN_ID; } CEventNetworkClanInviteRequestReceived(const sCrewInviteRequestReceivedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("...crewid: %d",m_EventData.m_clanId.Int); } }; // ================================================================================================================ // CEventNetworkClanKicked - triggered when we're kicked from a clan // ================================================================================================================ class CEventNetworkClanKicked : public CEventNetworkWithData { public: CEventNetworkClanKicked(rlClanId clanId, bool bPrimary) { m_EventData.m_clanId.Int = (u32)clanId; m_EventData.m_bPrimary.Int = bPrimary; } CEventNetworkClanKicked(const sClanEventInfo& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... crewID: %d", m_EventData.m_clanId.Int); SpewToTTY("... Primary: %s", m_EventData.m_bPrimary.Int ? "TRUE" : "FALSE"); } }; class CEventNetworkClanRankChanged : public CEventNetworkWithData { public: CEventNetworkClanRankChanged(rlClanId clanId, int rankOrder, const char* rankName, bool bPromotion) { m_EventData.m_clanId.Int = (int)clanId; m_EventData.m_iRankOrder.Int = rankOrder; safecpy(m_EventData.m_rankName, rankName); m_EventData.m_bPromotion.Int = bPromotion ? 1 : 0; } CEventNetworkClanRankChanged(const sClanRankChangedInfo& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... crewID: %d", m_EventData.m_clanId.Int); SpewToTTY("... iRankOrder: %d", m_EventData.m_iRankOrder.Int); SpewToTTY("... rankName: %s", m_EventData.m_rankName); SpewToTTY("... promotion: %s", m_EventData.m_bPromotion.Int != 0 ? "true" : "false" ); } }; // ================================================================================================================ // CEventNetworkVoiceSessionStarted - triggered when we successfully start a voice session (host / client) // ================================================================================================================ class CEventNetworkVoiceSessionStarted : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkVoiceSessionEnded - triggered when we leave a voice session // ================================================================================================================ class CEventNetworkVoiceSessionEnded : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkVoiceConnectionRequested - triggered when a connection is requested by remote player // ================================================================================================================ class CEventNetworkVoiceConnectionRequested : public CEventNetworkWithData { public: CEventNetworkVoiceConnectionRequested(const rlGamerHandle& hGamer, const char* szName) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); safecpy(m_EventData.m_szGamerTag, szName); } CEventNetworkVoiceConnectionRequested(const sVoiceSessionRequestData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... name: %s", m_EventData.m_szGamerTag); } }; // ================================================================================================================ // CEventNetworkVoiceConnectionResponse - triggered when we receive a response to a voice connection request // ================================================================================================================ class CEventNetworkVoiceConnectionResponse : public CEventNetworkWithData { public: enum eResponse { RESPONSE_ACCEPTED, RESPONSE_REJECTED, RESPONSE_BUSY, RESPONSE_TIMED_OUT, RESPONSE_ERROR, RESPONSE_BLOCKED, }; public: CEventNetworkVoiceConnectionResponse(const rlGamerHandle& hGamer, const eResponse nResponse, const int nResponseCode) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); m_EventData.nResponse.Int = nResponse; m_EventData.nResponseCode.Int = nResponseCode; } CEventNetworkVoiceConnectionResponse(const sVoiceSessionResponseData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { switch (m_EventData.nResponse.Int) { case RESPONSE_ACCEPTED: SpewToTTY("... response: ACCEPTED"); break; case RESPONSE_REJECTED: SpewToTTY("... response: REJECTED"); break; case RESPONSE_BUSY: SpewToTTY("... response: BUSY"); break; case RESPONSE_TIMED_OUT: SpewToTTY("... response: TIMED OUT"); break; case RESPONSE_ERROR: SpewToTTY("... response: ERROR"); break; default: Assertf(0, "CEventNetworkVoiceConnectionResponse: unrecognised response"); } SpewToTTY("... Response Code: %d", m_EventData.nResponseCode.Int); } }; // ================================================================================================================ // CEventNetworkVoiceConnectionTerminated - triggered when a connection is terminated (player leaves) // ================================================================================================================ class CEventNetworkVoiceConnectionTerminated : public CEventNetworkWithData { public: CEventNetworkVoiceConnectionTerminated(const rlGamerHandle& hGamer, const char* szName) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); safecpy(m_EventData.m_szGamerTag, szName); } CEventNetworkVoiceConnectionTerminated(const sVoiceSessionTerminatedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... name: %s", m_EventData.m_szGamerTag); } }; // ================================================================================================================ // CEventNetworkTextMessageReceived - // ================================================================================================================ class CEventNetworkTextMessageReceived : public CEventNetworkWithData { public: CEventNetworkTextMessageReceived(const char* szText, const rlGamerHandle& hGamer) { if(hGamer.IsValid()) hGamer.Export(m_EventData.hGamer, sizeof(m_EventData.hGamer)); safecpy(m_EventData.szTextMessage, szText); } CEventNetworkTextMessageReceived(const sTextMessageData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Text Message : %s", m_EventData.szTextMessage); } }; // ================================================================================================================ // CEventNetworkCloudFileResponse - triggered when a cloud file request has finished // ================================================================================================================ class CEventNetworkCloudFileResponse : public CEventNetworkWithData { public: CEventNetworkCloudFileResponse(const CloudRequestID nRequestID, bool bWasSuccessful) { m_EventData.nRequestID.Int = nRequestID; m_EventData.bWasSuccessful.Int = bWasSuccessful ? TRUE : FALSE; } CEventNetworkCloudFileResponse(const sCloudResponseData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... RequestID: \"%d\"", m_EventData.nRequestID.Int); SpewToTTY("... Was Successful: \"%s\"", (m_EventData.bWasSuccessful.Int == TRUE) ? "true" : "false"); } }; // ================================================================================================================ // CEventNetworkPickupRespawned - triggered when a pickup placement respawns a pickup. // ================================================================================================================ class CEventNetworkPickupRespawned : public CEventNetworkWithData { public: CEventNetworkPickupRespawned(const int placementReference, u32 pickupHash, const u32 customModel) { m_EventData.PlacementReference.Int = placementReference; m_EventData.PickupHash.Int = pickupHash; m_EventData.PickupModel.Int = customModel; } CEventNetworkPickupRespawned(const sPickupRespawnData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... pickup ref: \"%d\"", m_EventData.PlacementReference.Int); SpewToTTY("... pickup hash: \"%d\"", m_EventData.PickupHash.Int); SpewToTTY("... pickup model: \"%d\"", m_EventData.PickupModel.Int); } }; // ================================================================================================================ // CEventNetworkPresence_StatUpdate - triggered when a presence message comes in related to a stat update // ================================================================================================================ class CEventNetworkPresence_StatUpdate : public CEventNetworkWithData { public: CEventNetworkPresence_StatUpdate(const u32 statHash, const char* fromGamer, int value, int value2, const char* stringData) { m_EventData.m_statNameHash.Int = statHash; safecpy(m_EventData.m_fromGamer, fromGamer); m_EventData.m_iValue.Int = value; m_EventData.m_fValue.Float = 0.0f; m_EventData.m_value2.Int = value2; safecpy(m_EventData.m_stringValue, stringData); } CEventNetworkPresence_StatUpdate(const u32 statHash, const char* fromGamer, float value, int value2, const char* stringData) { m_EventData.m_statNameHash.Int = statHash; safecpy(m_EventData.m_fromGamer, fromGamer); m_EventData.m_fValue.Float = value; m_EventData.m_iValue.Int = 0; m_EventData.m_value2.Int = value2; safecpy(m_EventData.m_stringValue, stringData); } CEventNetworkPresence_StatUpdate(const sGamePresenceEvent_StatUpdate& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... statNameHash: \"%d\"", m_EventData.m_statNameHash.Int); SpewToTTY("....fromGamer: %s", m_EventData.m_fromGamer); SpewToTTY("... iValue: \"%d\"", m_EventData.m_iValue.Int); SpewToTTY("... fValue: \"%5.2f\"", m_EventData.m_fValue.Float); SpewToTTY("... value2: \"%d\"", m_EventData.m_value2.Int); SpewToTTY("....stringValue: \"%s\"", m_EventData.m_stringValue); } }; // ================================================================================================================ // CEventNetwork_InboxMsgReceived - triggered when new messages have been received in the inbox // ================================================================================================================ class CEventNetwork_InboxMsgReceived : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkPedLeftBehind // ================================================================================================================ class CEventNetworkPedLeftBehind : public CEventNetworkWithData { public: enum eReasonCodes { REASON_DEFAULT ,REASON_PLAYER_LEFT_SESSION }; public: CEventNetworkPedLeftBehind(CPed* ped, const u32 reason = REASON_DEFAULT); CEventNetworkPedLeftBehind(const sPedLeftBehindData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const; virtual bool RetrieveData(u8* data, const unsigned sizeOfData) const; virtual bool operator==(const fwEvent& event) const { if (CEventNetworkWithData::operator==(event)) { Assert(dynamic_cast(&event)); const CEventNetworkPedLeftBehind* pEvent = static_cast(&event); if (pEvent->m_pPed.Get() == m_pPed.Get()) { return true; } } return false; } private: fwEvent* CloneInternal() const; private: RegdEnt m_pPed; u32 m_Reason; #if __ASSERT ObjectId m_PedId; #endif }; // ================================================================================================================ // CEventNetworkSessionEvent - // ================================================================================================================ class CEventNetworkSessionEvent : public CEventNetworkWithData { public: enum eEventID { EVENT_MIGRATE_END }; CEventNetworkSessionEvent(eEventID nEventID, int nEventParam = 0) { m_EventData.m_nEventID.Int = static_cast(nEventID); m_EventData.m_nEventParam.Int = nEventParam; for(int i = 0; i < SCRIPT_GAMER_HANDLE_SIZE; i++) m_EventData.m_hGamer[i].Int = 0; } CEventNetworkSessionEvent(eEventID nEventID, const rlGamerHandle& hGamer, int nEventParam = 0) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); m_EventData.m_nEventID.Int = static_cast(nEventID); m_EventData.m_nEventParam.Int = nEventParam; } CEventNetworkSessionEvent(const sSessionEventData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Event ID: %d", m_EventData.m_nEventID); SpewToTTY("... Param: %d", m_EventData.m_nEventParam); } }; // ================================================================================================================ // CEventNetworkTransitionStarted - // ================================================================================================================ class CEventNetworkTransitionStarted : public CEventNetworkWithData { public: CEventNetworkTransitionStarted(bool bSuccess) { m_EventData.m_bSuccess.Int = bSuccess ? TRUE : FALSE; } CEventNetworkTransitionStarted(const sTransitionStartedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Success: %s", m_EventData.m_bSuccess.Int ? "True" : "False"); } }; // ================================================================================================================ // CEventNetworkTransitionEvent - // ================================================================================================================ class CEventNetworkTransitionEvent : public CEventNetworkWithData { public: enum eEventID { EVENT_HOSTING, EVENT_HOSTED, EVENT_HOST_FAILED, EVENT_JOINING, EVENT_JOINED, EVENT_JOINED_LAUNCHED, EVENT_JOIN_FAILED, EVENT_STARTING, EVENT_STARTED, EVENT_ENDING, EVENT_ENDED, EVENT_QUICKMATCH, EVENT_QUICKMATCH_JOINING, EVENT_QUICKMATCH_HOSTING, EVENT_START_LAUNCH, EVENT_END_LAUNCH, EVENT_KICKED, EVENT_ERROR, EVENT_MIGRATE_START, EVENT_MIGRATE_END, EVENT_TO_GAME_START, EVENT_TO_GAME_JOINING, EVENT_TO_GAME_JOINED, EVENT_TO_GAME_HOSTING, EVENT_TO_GAME_FINISH, EVENT_QUICKMATCH_FAILED, EVENT_QUICKMATCH_TIME_OUT, EVENT_GROUP_QUICKMATCH_STARTED, EVENT_GROUP_QUICKMATCH_FINISHED, EVENT_NUM, }; CEventNetworkTransitionEvent(eEventID nEventID, int nEventParam = 0) { m_EventData.m_nEventID.Int = static_cast(nEventID); m_EventData.m_nEventParam.Int = nEventParam; for(int i = 0; i < SCRIPT_GAMER_HANDLE_SIZE; i++) m_EventData.m_hGamer[i].Int = 0; } CEventNetworkTransitionEvent(eEventID nEventID, const rlGamerHandle& hGamer, int nEventParam = 0) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); m_EventData.m_nEventID.Int = static_cast(nEventID); m_EventData.m_nEventParam.Int = nEventParam; } CEventNetworkTransitionEvent(const sTransitionEventData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { #if !__NO_OUTPUT static const char* s_EventNames[EVENT_NUM] = { "EVENT_HOSTING", "EVENT_HOSTED", "EVENT_HOST_FAILED", "EVENT_JOINING", "EVENT_JOINED", "EVENT_JOINED_LAUNCHED", "EVENT_JOIN_FAILED", "EVENT_STARTING", "EVENT_STARTED", "EVENT_ENDING", "EVENT_ENDED", "EVENT_QUICKMATCH", "EVENT_QUICKMATCH_JOINING", "EVENT_QUICKMATCH_HOSTING", "EVENT_START_LAUNCH", "EVENT_END_LAUNCH", "EVENT_KICKED", "EVENT_ERROR", "EVENT_MIGRATE_START", "EVENT_MIGRATE_END", "EVENT_TO_GAME_START", "EVENT_TO_GAME_JOINING", "EVENT_TO_GAME_JOINED", "EVENT_TO_GAME_HOSTING", "EVENT_TO_GAME_FINISH", "EVENT_QUICKMATCH_FAILED", "EVENT_QUICKMATCH_TIME_OUT", "EVENT_GROUP_QUICKMATCH_STARTED", "EVENT_GROUP_QUICKMATCH_FINISHED", }; #endif SpewToTTY("... Event ID: %s", s_EventNames[m_EventData.m_nEventID.Int]); SpewToTTY("... Param: %d", m_EventData.m_nEventParam); } }; // ================================================================================================================ // CEventNetworkTransitionMemberJoined - // ================================================================================================================ class CEventNetworkTransitionMemberJoined : public CEventNetworkWithData { public: CEventNetworkTransitionMemberJoined(const rlGamerHandle& hGamer, const char* szName, const int nCharacterRank) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); safecpy(m_EventData.m_szGamerTag, szName); m_EventData.m_nCharacterRank.Int = nCharacterRank; } CEventNetworkTransitionMemberJoined(const sTransitionMemberData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... name: %s", m_EventData.m_szGamerTag); SpewToTTY("... rank: %d", m_EventData.m_nCharacterRank.Int); } }; // ================================================================================================================ // CEventNetworkTransitionMemberLeft - // ================================================================================================================ class CEventNetworkTransitionMemberLeft : public CEventNetworkWithData { public: CEventNetworkTransitionMemberLeft(const rlGamerHandle& hGamer, const char* szName) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); safecpy(m_EventData.m_szGamerTag, szName); m_EventData.m_nCharacterRank.Int = 0; } CEventNetworkTransitionMemberLeft(const sTransitionMemberData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... name: %s", m_EventData.m_szGamerTag); } }; // ================================================================================================================ // CEventNetworkTransitionParameterChanged - // ================================================================================================================ class CEventNetworkTransitionParameterChanged : public CEventNetworkWithData { public: CEventNetworkTransitionParameterChanged(const rlGamerHandle& hGamer, const int numValues, sParameterData (¶mData)[sTransitionParameterData::MAX_NUM_PARAMS]) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); m_EventData.m_nNumberValues.Int = numValues; m_EventData.m_PADDING_SizeOfColArray.Int = sTransitionParameterData::MAX_NUM_PARAMS; for (int i=0; i(eventData) { } void SpewEventInfo() const { for (int i=0; i { public: CEventNetworkTransitionStringChanged(const rlGamerHandle& hGamer, int nID, const char* szParameter) { hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); m_EventData.m_nParameterID.Int = nID; safecpy(m_EventData.m_szParameter, szParameter); } CEventNetworkTransitionStringChanged(const sTransitionStringData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... ID: %d", m_EventData.m_nParameterID.Int); SpewToTTY("... Parameter: %s", m_EventData.m_szParameter); } }; // ================================================================================================================ // CEventNetworkTransitionGamerInstruction - // ================================================================================================================ class CEventNetworkTransitionGamerInstruction : public CEventNetworkWithData { public: CEventNetworkTransitionGamerInstruction(const rlGamerHandle& hFromGamer, const rlGamerHandle& hToGamer, const char* szGamerTag, int nInstruction, int nInstructionParam) { hFromGamer.Export(m_EventData.m_hFromGamer, sizeof(m_EventData.m_hFromGamer)); hToGamer.Export(m_EventData.m_hToGamer, sizeof(m_EventData.m_hToGamer)); safecpy(m_EventData.m_szGamerTag, szGamerTag); m_EventData.m_nInstruction.Int = nInstruction; m_EventData.m_nInstructionParam.Int = nInstructionParam; } CEventNetworkTransitionGamerInstruction(const sTransitionGamerInstructionData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... GamerName: %s", m_EventData.m_szGamerTag); SpewToTTY("... Instruction: %d", m_EventData.m_nInstruction.Int); SpewToTTY("... Param: %d", m_EventData.m_nInstructionParam.Int); } }; // ================================================================================================================ // CEventNetworkPresenceInvite - // ================================================================================================================ class CEventNetworkPresenceInvite : public CEventNetworkWithData { public: CEventNetworkPresenceInvite(const rlGamerHandle& hGamer, const char* szGamer, const char* szContentID, unsigned nPlaylistLength, unsigned nPlaylistCurrent, bool bScTv, int nInviteID) { if(hGamer.IsValid()) hGamer.Export(m_EventData.m_hGamer, sizeof(m_EventData.m_hGamer)); safecpy(m_EventData.m_szGamerTag, szGamer); safecpy(m_EventData.m_szContentID, szContentID); m_EventData.m_nPlaylistLength.Int = static_cast(nPlaylistLength); m_EventData.m_nPlaylistCurrent.Int = static_cast(nPlaylistCurrent); m_EventData.m_bScTv.Int = bScTv ? TRUE : FALSE; m_EventData.m_nInviteID.Int = static_cast(nInviteID); } CEventNetworkPresenceInvite(const sPresenceInviteData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... Inviter: %s", m_EventData.m_szGamerTag); SpewToTTY("... ContentID: %s", m_EventData.m_szContentID); SpewToTTY("... PlaylistLength: %d", m_EventData.m_nPlaylistLength.Int); SpewToTTY("... PlaylistCurrent: %d", m_EventData.m_nPlaylistCurrent.Int); SpewToTTY("... ScTv: %s", m_EventData.m_bScTv.Int == TRUE ? "True" : "False"); SpewToTTY("... InviteID: %d", m_EventData.m_nInviteID.Int); } }; // ================================================================================================================ // CEventNetworkPresenceInviteRemoved - // ================================================================================================================ class CEventNetworkPresenceInviteRemoved : public CEventNetworkWithData { public: CEventNetworkPresenceInviteRemoved(int nInviteID, int nReason) { m_EventData.m_nInviteID.Int = static_cast(nInviteID); m_EventData.m_nReason.Int = static_cast(nReason); } CEventNetworkPresenceInviteRemoved(const sPresenceInviteRemovedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... InviteID: %d", m_EventData.m_nInviteID.Int); SpewToTTY("... Reason: %d", m_EventData.m_nReason.Int); } }; // ================================================================================================================ // CEventNetworkPresenceInviteReply - // ================================================================================================================ class CEventNetworkPresenceInviteReply : public CEventNetworkWithData { public: CEventNetworkPresenceInviteReply(const rlGamerHandle& hGamer, const unsigned nStatus, const int nCharacterRank, const char* szClanTag, const bool bDecisionMade, const bool bDecision) { hGamer.Export(m_EventData.m_hInvitee, sizeof(m_EventData.m_hInvitee)); m_EventData.m_nStatus.Int = static_cast(nStatus); m_EventData.m_nCharacterRank.Int = nCharacterRank; safecpy(m_EventData.m_ClanTag, szClanTag); m_EventData.m_bDecisionMade.Int = bDecisionMade ? TRUE : FALSE; m_EventData.m_bDecision.Int = bDecision ? TRUE : FALSE; } CEventNetworkPresenceInviteReply(const sInviteReplyData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_nStatus: %d", m_EventData.m_nStatus.Int); SpewToTTY("... m_nCharacterRank: %d", m_EventData.m_nCharacterRank.Int); SpewToTTY("... m_szClanTag: %d", m_EventData.m_nCharacterRank.Int); SpewToTTY("... m_bDecisionMade: %s", m_EventData.m_bDecisionMade.Int == TRUE ? "True" : "False"); SpewToTTY("... m_bDecision: %s", m_EventData.m_bDecision.Int == TRUE ? "True" : "False"); } }; // ================================================================================================================ // CEventNetworkCashTransactionLog - Triggered when a cash transaction is done with details about the transaction. // ================================================================================================================ class CEventNetworkCashTransactionLog : public CEventNetworkWithData { public: enum eTransactionTypes { CASH_TRANSACTION_DEPOSIT ,CASH_TRANSACTION_WITHDRAW }; enum eTransactionIds { CASH_TRANSACTION_ATM //Money deposited/withdrawn by the player - this is relation to VC commands - So deposit or withdraw from BANk Account. ,CASH_TRANSACTION_GAMER //Money received/paid from friends. ,CASH_TRANSACTION_STORE //STORE money always credits the BANK account ,CASH_TRANSACTION_BANK //BANK account transaction }; public: CEventNetworkCashTransactionLog(int transactionId, eTransactionIds id, eTransactionTypes type, s64 amount, const rlGamerHandle& hGamer, int itemId = -1); CEventNetworkCashTransactionLog(const sCashTransactionLog& eventData) : CEventNetworkWithData(eventData) { } virtual bool operator==(const fwEvent&) const { return false; } void SpewEventInfo() const { SpewToTTY("... m_TransactionId: %d", m_EventData.m_TransactionId.Int); SpewToTTY("... m_Id: %d", m_EventData.m_Id.Int); SpewToTTY("... m_Type: %d", m_EventData.m_Type.Int); SpewToTTY("... m_Amount: %d", m_EventData.m_Amount.Int); SpewToTTY("... m_ItemId: %d", m_EventData.m_ItemId.Int); SpewToTTY("... m_Amount: %s", m_EventData.m_StrAmount); } }; // ================================================================================================================ // CEventNetworkVehicleUndrivable - triggered when a vehicle becomes undrivable. // ================================================================================================================ class CEventNetworkVehicleUndrivable : public CEventNetworkWithData { public: CEventNetworkVehicleUndrivable(CEntity* vehicle, CEntity* damager, const int weaponHash); CEventNetworkVehicleUndrivable(const sVehicleUndrivableData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const; private: virtual fwEvent* CloneInternal() const; #if !__FINAL RegdEnt m_pVehicle; RegdEnt m_pDamager; #endif }; // ================================================================================================================ // CEventNetworkPresenceTriggerEvent - Triggered by a game trigger presence message. // ================================================================================================================ class CEventNetworkPresenceTriggerEvent : public CEventNetworkWithData { public: CEventNetworkPresenceTriggerEvent(const u32 nEventNameHash, int nEventParam1, int nEventParam2, const char* szEventString) { m_EventData.m_nEventNameHash.Int = nEventNameHash; m_EventData.m_nEventParam1.Int = nEventParam1; m_EventData.m_nEventParam2.Int = nEventParam2; safecpy(m_EventData.m_nEventString, szEventString); } CEventNetworkPresenceTriggerEvent(const sGamePresenceEventTrigger& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_nEventNameHash: \"%d\"", m_EventData.m_nEventNameHash.Int); SpewToTTY("... m_nEventParam1: \"%d\"", m_EventData.m_nEventParam1.Int); SpewToTTY("... m_nEventParam2: \"%d\"", m_EventData.m_nEventParam2.Int); SpewToTTY("....m_nEventString: \"%s\"", m_EventData.m_nEventString); } }; // ================================================================================================================ // CEventNetworkEmailReceivedEvent - Triggered when an email arrives for the local player // ================================================================================================================ class CEventNetworkEmailReceivedEvent : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkEmailReceivedEvent - Triggered when an email arrives for the local player // ================================================================================================================ class CEventNetworkMarketingEmailReceivedEvent : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkFollowInviteReceived - Triggered when we receive a follow invite // ================================================================================================================ class CEventNetworkFollowInviteReceived : public CEventNetworkWithData { public: CEventNetworkFollowInviteReceived(const rlGamerHandle& hGamer) { hGamer.Export(m_EventData.hGamer, sizeof(m_EventData.hGamer)); } CEventNetworkFollowInviteReceived(const sFollowInviteData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { } }; // ================================================================================================================ // CEventNetworkAdminInvited - Triggered when an admin is being invited // ================================================================================================================ class CEventNetworkAdminInvited : public CEventNetworkWithData { public: CEventNetworkAdminInvited(const rlGamerHandle& hGamer, const bool bIsSCTV) { hGamer.Export(m_EventData.hGamer, sizeof(m_EventData.hGamer)); m_EventData.bIsSCTV.Int = bIsSCTV ? 1 : 0; } CEventNetworkAdminInvited(const sAdminInviteData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... SCTV: %s", m_EventData.bIsSCTV.Int == 1 ? "True" : "False"); } }; // ================================================================================================================ // CEventNetworkSpectateLocal - // ================================================================================================================ class CEventNetworkSpectateLocal : public CEventNetworkWithData { public: CEventNetworkSpectateLocal(const rlGamerHandle& hGamer) { hGamer.Export(m_EventData.hGamer, sizeof(m_EventData.hGamer)); } CEventNetworkSpectateLocal(const sSpectateLocalData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { } }; // ================================================================================================================ // CEventNetworkCloudEvent - Triggered by a cloud event // ================================================================================================================ class CEventNetworkCloudEvent : public CEventNetworkWithData { public: enum eEventID { CLOUD_EVENT_TUNABLES_ADDED, CLOUD_EVENT_BGSCRIPT_ADDED, }; CEventNetworkCloudEvent(const eEventID nEventID, int nEventParam1 = 0, int nEventParam2 = 0, const char* szEventString = NULL) { m_EventData.m_nEventID.Int = nEventID; m_EventData.m_nEventParam1.Int = nEventParam1; m_EventData.m_nEventParam2.Int = nEventParam2; if(szEventString) safecpy(m_EventData.m_nEventString, szEventString); else safecpy(m_EventData.m_nEventString, ""); } CEventNetworkCloudEvent(const sCloudEventData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_nEventID: \"%d\"", m_EventData.m_nEventID.Int); SpewToTTY("... m_nEventParam1: \"%d\"", m_EventData.m_nEventParam1.Int); SpewToTTY("... m_nEventParam2: \"%d\"", m_EventData.m_nEventParam2.Int); SpewToTTY("....m_nEventString: \"%s\"", m_EventData.m_nEventString); } }; // CNetworkShopTransactionEvent - Triggered when a network shop transaction is done // ================================================================================================================ class CEventNetworkShopTransaction : public CEventNetworkWithData { public: CEventNetworkShopTransaction(const int id, const int type, const int action, const int resultcode, const int serviceid, const int bank, const int wallet) { m_EventData.m_Id.Int = id; m_EventData.m_Type.Int = type; m_EventData.m_Action.Int = action; m_EventData.m_ResultCode.Int = resultcode; m_EventData.m_Serviceid.Int = serviceid; m_EventData.m_Bank.Int = bank; m_EventData.m_Wallet.Int = wallet; } CEventNetworkShopTransaction(const sNetworkShopTransaction& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_Id: \"0x%08X\"", static_cast(m_EventData.m_Id.Int)); SpewToTTY("... m_Type: \"0x%08X\"", static_cast(m_EventData.m_Type.Int)); SpewToTTY("... m_Action: \"0x%08X\"", static_cast(m_EventData.m_Action.Int)); SpewToTTY("... m_ResultCode: \"%d\"", m_EventData.m_ResultCode.Int); SpewToTTY("... m_Serviceid: \"%d\"", m_EventData.m_Serviceid.Int); SpewToTTY("... m_Bank: \"%d\"", m_EventData.m_Bank.Int); SpewToTTY("... m_Wallet: \"%d\"", m_EventData.m_Wallet.Int); } }; // ================================================================================================================ // CEventNetworkPermissionCheckResult - triggered when we complete a permissions check // ================================================================================================================ class CEventNetworkPermissionCheckResult : public CEventNetworkWithData { public: CEventNetworkPermissionCheckResult(const int nCheckID, bool bAllowed) { m_EventData.m_nCheckID.Int = nCheckID; m_EventData.m_bAllowed.Int = bAllowed ? TRUE : FALSE; } CEventNetworkPermissionCheckResult(const sPermissionCheckResult& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_nCheckID: %d", m_EventData.m_nCheckID.Int); SpewToTTY("... m_bAllowed: %s", m_EventData.m_bAllowed.Int == TRUE ? "True" : "False"); } }; // ================================================================================================================ // CEventNetworkOnlinePermissionsUpdated - triggered when online permissions are updated // ================================================================================================================ class CEventNetworkOnlinePermissionsUpdated : public CEventNetworkNoData { }; // ================================================================================================================ // CNetworkShopTransactionEvent - Triggered when a social club account is linked // ================================================================================================================ class CEventNetworkSocialClubAccountLinked : public CEventNetworkNoData { }; // ================================================================================================================ // CEventNetworkAppLaunched - Triggered when we receive an app launched system event // ================================================================================================================ class CEventNetworkAppLaunched : public CEventNetworkWithData { public: CEventNetworkAppLaunched(const unsigned nFlags) { m_EventData.m_nFlags.Int = static_cast(nFlags); } CEventNetworkAppLaunched(const sAppLaunchedData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_nFlags: %d", m_EventData.m_nFlags.Int); } }; // ================================================================================================================ // CEventNetworkSystemServiceEvent - Triggered when we receive an system event // ================================================================================================================ class CEventNetworkSystemServiceEvent : public CEventNetworkWithData { public: CEventNetworkSystemServiceEvent(const int nEventID, const unsigned nFlags) { m_EventData.m_nEventID.Int = nEventID; m_EventData.m_nFlags.Int = static_cast(nFlags); } CEventNetworkSystemServiceEvent(const sSystemServiceEventData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_nEventID: %d", m_EventData.m_nEventID.Int); SpewToTTY("... m_nFlags: %d", m_EventData.m_nFlags.Int); } }; // CEventNetworkRequestDelay - Triggered when there is a service access request delay due to the conductor doing a GEO_MOVE // ================================================================================================================ class CEventNetworkRequestDelay : public CEventNetworkWithData { public: CEventNetworkRequestDelay(const int retryTimeMs) { m_EventData.m_delayTimeMs.Int = retryTimeMs; } CEventNetworkRequestDelay(const sNetworkRequestDelayData& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("... m_delayTimeMs: \"0x%08X\"", static_cast(m_EventData.m_delayTimeMs.Int)); } }; // CEventNetworkScAdminPlayerUpdated - Triggered when scAdmin updates the player balance/inventory. // ================================================================================================================ class CEventNetworkScAdminPlayerUpdated : public CEventNetworkWithData { public: CEventNetworkScAdminPlayerUpdated(const sNetworkScAdminPlayerUpdate* eventData) { if (gnetVerify(eventData)) { m_EventData.m_fullRefreshRequested.Int = eventData->m_fullRefreshRequested.Int; m_EventData.m_updatePlayerBalance.Int = eventData->m_updatePlayerBalance.Int; m_EventData.m_awardTypeHash.Int = eventData->m_awardTypeHash.Int; m_EventData.m_awardAmount.Int = eventData->m_awardAmount.Int; for (int i=0; im_items[i].Int; } } CEventNetworkScAdminPlayerUpdated(const sNetworkScAdminPlayerUpdate& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("..... m_fullRefreshRequested: \"%s\"", m_EventData.m_fullRefreshRequested.Int > 0 ? "True" : "False"); SpewToTTY("...... m_updatePlayerBalance: \"%s\"", m_EventData.m_updatePlayerBalance.Int > 0 ? "True" : "False"); SpewToTTY("............ m_awardTypeHash: \"%d\"", m_EventData.m_awardTypeHash.Int); SpewToTTY(".............. m_awardAmount: \"%d\"", m_EventData.m_awardAmount.Int); for (int i=0; i { public: CEventNetworkScAdminReceivedCash(const sNetworkScAdminReceivedCash* eventData) { if (gnetVerify(eventData)) { m_EventData.m_characterIndex.Int = eventData->m_characterIndex.Int; m_EventData.m_cashAmount.Int = eventData->m_cashAmount.Int; } } CEventNetworkScAdminReceivedCash(const sNetworkScAdminReceivedCash& eventData) : CEventNetworkWithData(eventData) { } void SpewEventInfo() const { SpewToTTY("...... m_characterIndex: %d", m_EventData.m_characterIndex.Int ); SpewToTTY("...... m_cashAmount: %d $", m_EventData.m_cashAmount.Int ); } }; // ================================================================================================================ // CEventNetworkStuntPerformed - Triggered when the player performs a stunt and the stunt tracking has been enabled (see command PLAYSTATS_START_TRACKING_STUNTS/PLAYSTATS_STOP_TRACKING_STUNTS) // ================================================================================================================ class CEventNetworkStuntPerformed : public CEventNetworkWithData { public: CEventNetworkStuntPerformed(const sNetworkStuntPerformed* eventData) { if (gnetVerify(eventData)) { m_EventData.m_stuntType.Int = eventData->m_stuntType.Int; m_EventData.m_stuntValue.Float = eventData->m_stuntValue.Float; } } CEventNetworkStuntPerformed(const sNetworkStuntPerformed& eventData) : CEventNetworkWithData(eventData) { } CEventNetworkStuntPerformed(const int stuntType, const float stuntValue) { m_EventData.m_stuntType.Int = stuntType; m_EventData.m_stuntValue.Float = stuntValue; } void SpewEventInfo() const { SpewToTTY("...... m_stuntType: %d", m_EventData.m_stuntType.Int ); SpewToTTY("...... m_stuntValue: %f", m_EventData.m_stuntValue.Float ); } }; // ================================================================================================================ // CEventNetworkScMembershipStatus - Triggered if membership status changes // ================================================================================================================ class CEventNetworkScMembershipStatus : public CEventNetworkWithData { public: enum EventType { EventType_StatusReceived, EventType_StatusChanged, }; CEventNetworkScMembershipStatus(const sScMembershipData* eventData) { if(gnetVerify(eventData)) { m_EventData.m_EventType.Int = eventData->m_EventType.Int; m_EventData.m_MembershipInfo.m_HasMembership.Int = eventData->m_MembershipInfo.m_HasMembership.Int; m_EventData.m_MembershipInfo.m_MembershipStartPosix.Int = eventData->m_MembershipInfo.m_MembershipStartPosix.Int; m_EventData.m_MembershipInfo.m_MembershipEndPosix.Int = eventData->m_MembershipInfo.m_MembershipEndPosix.Int; m_EventData.m_PrevMembershipInfo.m_HasMembership.Int = eventData->m_PrevMembershipInfo.m_HasMembership.Int; m_EventData.m_PrevMembershipInfo.m_MembershipStartPosix.Int = eventData->m_PrevMembershipInfo.m_MembershipStartPosix.Int; m_EventData.m_PrevMembershipInfo.m_MembershipEndPosix.Int = eventData->m_PrevMembershipInfo.m_MembershipEndPosix.Int; } } CEventNetworkScMembershipStatus(const sScMembershipData& eventData) : CEventNetworkWithData(eventData) { } #if NET_ENABLE_MEMBERSHIP_FUNCTIONALITY CEventNetworkScMembershipStatus(const EventType eventType, const rlScMembershipInfo& info, const rlScMembershipInfo& prevInfo) { m_EventData.m_EventType.Int = eventType; m_EventData.m_MembershipInfo.m_HasMembership.Int = info.HasMembership() ? 1 : 0; m_EventData.m_MembershipInfo.m_MembershipStartPosix.Int = static_cast(info.GetStartPosix()); m_EventData.m_MembershipInfo.m_MembershipEndPosix.Int = static_cast(info.GetExpirePosix()); m_EventData.m_PrevMembershipInfo.m_HasMembership.Int = prevInfo.HasMembership() ? 1 : 0; m_EventData.m_PrevMembershipInfo.m_MembershipStartPosix.Int = static_cast(prevInfo.GetStartPosix()); m_EventData.m_PrevMembershipInfo.m_MembershipEndPosix.Int = static_cast(prevInfo.GetExpirePosix()); } #endif void SpewEventInfo() const { SpewToTTY("...... EventType: %d", m_EventData.m_EventType.Int); SpewToTTY("...... HasMembership: %d", m_EventData.m_MembershipInfo.m_HasMembership.Int); SpewToTTY("...... MembershipStart: %d", m_EventData.m_MembershipInfo.m_MembershipStartPosix.Int); SpewToTTY("...... MembershipExpiry: %d", m_EventData.m_MembershipInfo.m_MembershipEndPosix.Int); SpewToTTY("...... HasMembership (Prev): %d", m_EventData.m_PrevMembershipInfo.m_HasMembership.Int); SpewToTTY("...... MembershipStart (Prev): %d", m_EventData.m_PrevMembershipInfo.m_MembershipStartPosix.Int); SpewToTTY("...... MembershipExpiry (Prev): %d", m_EventData.m_PrevMembershipInfo.m_MembershipEndPosix.Int); } }; // ================================================================================================================ // CEventNetworkScBenefitsStatus - Triggered for benefits changes / notifications // ================================================================================================================ class CEventNetworkScBenefitsStatus : public CEventNetworkWithData { public: enum EventType { EventType_BenefitsClaimed, }; CEventNetworkScBenefitsStatus(const sScBenefitsData* eventData) { if(gnetVerify(eventData)) { m_EventData.m_EventType.Int = eventData->m_EventType.Int; m_EventData.m_NumBenefits.Int = eventData->m_NumBenefits.Int; m_EventData.m_BenefitValue.Int = eventData->m_BenefitValue.Int; } } CEventNetworkScBenefitsStatus(const sScBenefitsData& eventData) : CEventNetworkWithData(eventData) { } #if NET_ENABLE_MEMBERSHIP_FUNCTIONALITY CEventNetworkScBenefitsStatus(const EventType eventType, const unsigned numBenefits, const unsigned benefitValue) { m_EventData.m_EventType.Int = eventType; m_EventData.m_NumBenefits.Int = numBenefits; m_EventData.m_BenefitValue.Int = benefitValue; } #endif void SpewEventInfo() const { SpewToTTY("...... EventType: %d", m_EventData.m_EventType.Int); SpewToTTY("...... NumBenefits: %d", m_EventData.m_NumBenefits.Int); SpewToTTY("...... BenefitValue: %d", m_EventData.m_BenefitValue.Int); } }; #endif // EVENT_NETWORK_H // eof