Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AnalyticsDataCollectionLoadoutCostModule.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_AnalyticsDataCollectionLoadoutCostModule
:
SCR_AnalyticsDataCollectionSupplyCostBaseModule
3
{
4
//------------------------------------------------------------------------------------------------
5
protected
override
void
Enable
()
6
{
7
super.Enable();
8
9
SCR_ResourcePlayerControllerInventoryComponent
.
GetOnArsenalItemRequested
().Insert(
OnPlayerItemRequested
);
10
11
SCR_SupportStationManagerComponent
supportStationManager =
SCR_SupportStationManagerComponent
.
GetInstance
();
12
if
(supportStationManager)
13
supportStationManager.
GetOnSupportStationExecutedSuccessfully
().Insert(
OnSupportStationExecuted
);
14
}
15
16
//------------------------------------------------------------------------------------------------
17
protected
override
void
Disable
()
18
{
19
super.Disable();
20
21
SCR_ResourcePlayerControllerInventoryComponent
.
GetOnArsenalItemRequested
().Remove(
OnPlayerItemRequested
);
22
23
SCR_SupportStationManagerComponent
supportStationManager =
SCR_SupportStationManagerComponent
.
GetInstance
();
24
if
(supportStationManager)
25
supportStationManager.
GetOnSupportStationExecutedSuccessfully
().Remove(
OnSupportStationExecuted
);
26
}
27
28
//------------------------------------------------------------------------------------------------
34
protected
override
void
OnPlayerSpawned
(SCR_SpawnRequestComponent requestComponent,
int
playerId,
SCR_SpawnData
data
,
IEntity
controlledEntity)
35
{
36
super.OnPlayerSpawned(requestComponent, playerId,
data
, controlledEntity);
37
38
SCR_SpawnPointSpawnData
spawnPointData =
SCR_SpawnPointSpawnData
.Cast(
data
);
39
if
(!spawnPointData)
40
return
;
41
42
SCR_PlayerLoadoutComponent
loadoutComp =
SCR_PlayerLoadoutComponent
.Cast(requestComponent.GetPlayerController().FindComponent(
SCR_PlayerLoadoutComponent
));
43
if
(!loadoutComp)
44
return
;
45
46
// Get the supply cost of player loadout
47
SCR_CampaignMilitaryBaseComponent
base
;
48
SCR_ResourceComponent resourceComp;
49
int
spawnSupplyCost = SCR_ArsenalManagerComponent.GetLoadoutCalculatedSupplyCost(loadoutComp.
GetLoadout
(),
false
, playerId, null, spawnPointData.
GetSpawnPoint
(),
base
, resourceComp);
50
51
// Player spawned on Main Base or the loadout has a cost of 0, no need to add to any data
52
if
(spawnSupplyCost == 0)
53
return
;
54
55
SCR_BasePlayerLoadout
loadout
= loadoutComp.
GetLoadout
();
56
if
(!
loadout
)
57
return
;
58
59
string
loadoutName =
SCR_AnalyticsDataCollectionHelper
.GetShortEntityPrefabName(
loadout
.GetLoadoutResource());
60
61
AddSupplySpendingData
(playerId, loadoutName, spawnSupplyCost);
62
}
63
64
//------------------------------------------------------------------------------------------------
69
protected
void
OnPlayerItemRequested
(SCR_ResourceComponent resourceComponent,
ResourceName
resourceName
,
IEntity
requesterEntity, BaseInventoryStorageComponent inventoryStorageComponent,
EResourceType
resourceType,
int
resourceValue)
70
{
71
// Item is free, no need to add to collected data
72
if
(resourceValue == 0)
73
return
;
74
75
// In case the item is added to storage inside player inventory, we need to get player entity
76
IEntity
ownerEntity = inventoryStorageComponent.GetOwner();
77
ownerEntity = ownerEntity.
GetRootParent
();
78
79
// User is not a player
80
int
playerId =
GetGame
().GetPlayerManager().GetPlayerIdFromControlledEntity(ownerEntity);
81
if
(playerId == 0)
82
return
;
83
84
string
itemName =
SCR_AnalyticsDataCollectionHelper
.GetShortEntityPrefabName(
resourceName
);
85
86
AddSupplySpendingData
(playerId, itemName, resourceValue);
87
}
88
89
//------------------------------------------------------------------------------------------------
96
protected
void
OnSupportStationExecuted
(SCR_BaseSupportStationComponent supportStation,
ESupportStationType
supportStationType,
IEntity
actionTarget,
IEntity
actionUser,
SCR_BaseUseSupportStationAction
action)
97
{
98
if
(!action)
99
return
;
100
101
// We only care about resupply ammo and resupply medical support stations
102
if
(supportStationType !=
ESupportStationType
.RESUPPLY_AMMO && supportStationType !=
ESupportStationType
.RESUPPLY_MEDICAL)
103
return
;
104
105
// User is not a player
106
int
playerId =
GetGame
().GetPlayerManager().GetPlayerIdFromControlledEntity(actionUser);
107
if
(playerId == 0)
108
return
;
109
110
// The cost is 0, no need to add
111
int
actionCost = action.
GetSupportStationSuppliesOnUse
();
112
if
(actionCost == 0)
113
return
;
114
115
SCR_BaseItemHolderSupportStationAction
itemHolderAction =
SCR_BaseItemHolderSupportStationAction
.Cast(action);
116
if
(!itemHolderAction)
117
return
;
118
119
string
itemName =
SCR_AnalyticsDataCollectionHelper
.GetShortEntityPrefabName(itemHolderAction.
GetItemPrefab
());
120
121
AddSupplySpendingData
(playerId, itemName, actionCost);
122
}
123
124
//------------------------------------------------------------------------------------------------
125
protected
void
~SCR_AnalyticsDataCollectionLoadoutCostModule
()
126
{
127
Disable
();
128
}
129
}
ESupportStationType
ESupportStationType
Definition
ESupportStationType.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
resourceName
ResourceName resourceName
Definition
SCR_AIGroup.c:66
loadout
string loadout
Definition
SCR_ArsenalManagerComponent.c:0
data
Get all prefabs that have the spawner data
Definition
SCR_EntityCatalogManagerComponent.c:320
base
around base
Definition
SCR_HoldCampaignMilitaryBaseTaskEntity.c:9
EResourceType
EResourceType
Definition
SCR_ResourceContainer.c:2
IEntity
Definition
IEntity.c:13
IEntity::GetRootParent
proto external IEntity GetRootParent()
ResourceName
Definition
ResourceName.c:13
SCR_AnalyticsDataCollectionHelper
Definition
SCR_AnalyticsDataCollectionHelper.c:2
SCR_AnalyticsDataCollectionLoadoutCostModule
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:3
SCR_AnalyticsDataCollectionLoadoutCostModule::Enable
override void Enable()
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:5
SCR_AnalyticsDataCollectionLoadoutCostModule::Disable
override void Disable()
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:17
SCR_AnalyticsDataCollectionLoadoutCostModule::OnPlayerItemRequested
void OnPlayerItemRequested(SCR_ResourceComponent resourceComponent, ResourceName resourceName, IEntity requesterEntity, BaseInventoryStorageComponent inventoryStorageComponent, EResourceType resourceType, int resourceValue)
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:69
SCR_AnalyticsDataCollectionLoadoutCostModule::~SCR_AnalyticsDataCollectionLoadoutCostModule
void ~SCR_AnalyticsDataCollectionLoadoutCostModule()
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:125
SCR_AnalyticsDataCollectionLoadoutCostModule::OnSupportStationExecuted
void OnSupportStationExecuted(SCR_BaseSupportStationComponent supportStation, ESupportStationType supportStationType, IEntity actionTarget, IEntity actionUser, SCR_BaseUseSupportStationAction action)
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:96
SCR_AnalyticsDataCollectionLoadoutCostModule::OnPlayerSpawned
override void OnPlayerSpawned(SCR_SpawnRequestComponent requestComponent, int playerId, SCR_SpawnData data, IEntity controlledEntity)
Definition
SCR_AnalyticsDataCollectionLoadoutCostModule.c:34
SCR_AnalyticsDataCollectionSupplyCostBaseModule
Definition
SCR_AnalyticsDataCollectionSupplyCostBaseModule.c:3
SCR_AnalyticsDataCollectionSupplyCostBaseModule::AddSupplySpendingData
void AddSupplySpendingData(int playerID, string itemName, int cost)
Definition
SCR_AnalyticsDataCollectionSupplyCostBaseModule.c:33
SCR_BaseItemHolderSupportStationAction
Definition
SCR_BaseItemHolderSupportStationAction.c:3
SCR_BaseItemHolderSupportStationAction::GetItemPrefab
ResourceName GetItemPrefab()
Definition
SCR_BaseItemHolderSupportStationAction.c:86
SCR_BasePlayerLoadout
Definition
SCR_BasePlayerLoadout.c:3
SCR_BaseUseSupportStationAction
Definition
SCR_BaseUseSupportStationAction.c:2
SCR_BaseUseSupportStationAction::GetSupportStationSuppliesOnUse
int GetSupportStationSuppliesOnUse()
Definition
SCR_BaseUseSupportStationAction.c:472
SCR_CampaignMilitaryBaseComponent
Definition
SCR_CampaignMilitaryBaseComponent.c:38
SCR_PlayerLoadoutComponent
Definition
SCR_PlayerLoadoutComponent.c:17
SCR_PlayerLoadoutComponent::GetLoadout
SCR_BasePlayerLoadout GetLoadout()
Definition
SCR_PlayerLoadoutComponent.c:57
SCR_ResourcePlayerControllerInventoryComponent
Definition
SCR_ResourcePlayerControllerInventoryComponent.c:25
SCR_ResourcePlayerControllerInventoryComponent::GetOnArsenalItemRequested
static OnArsenalItemRequestedInvoker GetOnArsenalItemRequested()
Definition
SCR_ResourcePlayerControllerInventoryComponent.c:56
SCR_SpawnData
Definition
SCR_SpawnData.c:10
SCR_SpawnPointSpawnData
Definition
SCR_SpawnPointSpawnData.c:3
SCR_SpawnPointSpawnData::GetSpawnPoint
SCR_SpawnPoint GetSpawnPoint()
Definition
SCR_SpawnPointSpawnData.c:26
SCR_SupportStationManagerComponent
Definition
SCR_SupportStationManagerComponent.c:11
SCR_SupportStationManagerComponent::GetOnSupportStationExecutedSuccessfully
ScriptInvokerBase< SupportStation_OnSupportStationExecuted > GetOnSupportStationExecutedSuccessfully()
Definition
SCR_SupportStationManagerComponent.c:48
SCR_SupportStationManagerComponent::GetInstance
static SCR_SupportStationManagerComponent GetInstance()
Definition
SCR_SupportStationManagerComponent.c:23
scripts
Game
DataCollection
AnalyticsDataCollectionModules
SCR_AnalyticsDataCollectionLoadoutCostModule.c
Generated by
1.17.0