DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
AnalyticsManagerClient.c
Go to the documentation of this file.
2{
3 static const int GEAR_COUNT = 3;
4 static string m_FullGear[GEAR_COUNT] = {"Shoulder","Melee","Back"};
5
7 {
10 }
11
13 {
16 }
17
18 //===================================
19 // OnActionEat
20 //===================================
22 {
24 }
25
26 //===================================
27 // OnActionDrink
28 //===================================
30 {
32 }
33
34 //===================================
35 // OnActionCookedSteak - not implemented
36 //===================================
38 {
40 }
41
42 //===================================
43 // OnActionFinishedShaveSelf
44 //===================================
46 {
48 }
49
50 //===================================
51 // OnActionFinishedGutDeer
52 //===================================
54 {
56 }
57
58 //===================================
59 // OnActionRestrain
60 //===================================
62 {
64 }
65
66 //===================================
67 // OnActionBandageTarget
68 //===================================
70 {
72 }
73
74 //===================================
75 // OnItemAttachedAtPlayer
76 //===================================
77 void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
78 {
79 bool weapon_present;
80 bool melee_present;
81 bool backpack_present;
82 HumanInventory inventory;
83
84 if ( GetDayZGame().GetGameState() != DayZGameState.IN_GAME )
85 {
86 return;
87 }
88
89 Man player = GetGame().GetPlayer();
90 if (!player)
91 {
92 return;
93 }
94
95 inventory = player.GetHumanInventory();
96
97 if ( player && inventory )
98 {
99 for ( int i = 0; i < GEAR_COUNT; ++i )
100 {
102 EntityAI att_item = inventory.FindAttachment( slot_id ); // Boris V [27.2.2019]: Consider using player.GetItemOnSlot(m_FullGear[i]) instead.
103
104 if ( !att_item )
105 {
106 //Print("index: "+ i +" slot_id: "+ slot_id +" = "+ att_item + " EMPTY");
107 continue;
108 }
109
110 //checks for firearm
111 if (att_item.IsWeapon())
112 weapon_present = true;
113 //checks for melee weapon
114 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Melee")))
115 melee_present = true;
116 //checks for backpack
117 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Back")))
118 backpack_present = true;
119 //Print("index: "+ i +" slot_id: "+ slot_id +" = "+ att_item + " ATTACHED");
120 }
121
122 //separate check for hand slot; TODO remove duplicates
123 att_item = inventory.GetEntityInHands();
124 if ( att_item )
125 {
126 //checks for firearm
127 if (att_item.IsWeapon())
128 weapon_present = true;
129 //checks for melee weapon
130 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Melee")) )
131 melee_present = true;
132 //checks for backpack
133 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Back")))
134 backpack_present = true;
135 }
136
137 if (weapon_present && melee_present && backpack_present)
138 {
139 //Print("---EAchievementActionId.ACTION_EQUIP_GEAR");
141 }
142 }
143 }
144
145 //===================================
146 // Event_OnPlayerIgnitedFireplace
147 //===================================
149 {
150 switch ( ignite_type )
151 {
152 case EFireIgniteType.Matchbox:
153 {
155 break;
156 }
157 case EFireIgniteType.Roadflare:
158 {
160 break;
161 }
162 case EFireIgniteType.HandDrill:
163 {
165 break;
166 }
167 }
168 }
169
170 //===================================
171 // Event_OnEntityKilled
172 //===================================
173 void Event_OnEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
174 {
175 if ( killer != null && killer.IsPlayer() && killer.GetID() == GetGame().GetPlayer().GetID() )
176 {
177 Achievements.OnPlayerKilled(victim, killer, source, is_headshot);
178 }
179 }
180}
DayZGame GetDayZGame()
Definition DayZGame.c:3656
EFireIgniteType
int GetID()
Get the ID registered in SEffectManager.
Definition Effect.c:525
PlayerBase GetPlayer()
static void OnEquippedFullGear()
static void OnActionHandcuff()
static void OnPlayerKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
static void OnActionIgniteDrill()
static void OnActionMedsSurvivor()
static void OnActionGutDeer()
static void OnActionIgniteMatchbox()
static void OnActionDrink()
static void OnActionShave()
static void OnActionEat()
static void OnActionIgniteRoadflare()
static void OnCookedSteak()
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
void Event_OnPlayerIgnitedFireplace(EFireIgniteType ignite_type)
static string m_FullGear[GEAR_COUNT]
void Event_OnEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
proto native DayZPlayer GetPlayer()
static ref ScriptInvoker SyncEvent_OnPlayerIgnitedFireplace
Definition ClientData.c:5
static ref ScriptInvoker SyncEvent_OnEntityKilled
Definition ClientData.c:4
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
inventory for plain man/human
proto native EntityAI GetEntityInHands()
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
proto native CGame GetGame()