27 int m_DetailedInfoRequested = 0;
35 string m_PlayerModsDetailedSynced;
36 string m_EnvironmentDebugMessage;
39 bool m_StatsUpdateStatus;
40 bool m_LevelsUpdateStatus;
41 bool m_ModsUpdateStatus;
42 bool m_AgentsUpdateStatus;
43 bool m_StomachUpdateStatus;
45 void PluginDeveloperSync()
54 m_StatsUpdateStatus =
false;
55 m_LevelsUpdateStatus =
false;
56 m_ModsUpdateStatus =
false;
57 m_AgentsUpdateStatus =
false;
58 m_StomachUpdateStatus =
false;
76 void EnableUpdate(
bool enable,
int type,
PlayerBase player )
79 if ( !IsPlayerRegistered(player))
80 RegisterPlayer( player );
85 case ERPCs.DEV_STATS_UPDATE:
87 SetSystemInBitmask(player,
PDS_SYSTEMS.STATS, enable);
91 case ERPCs.DEV_LEVELS_UPDATE:
93 SetSystemInBitmask(player,
PDS_SYSTEMS.LEVELS, enable);
97 case ERPCs.DEV_MODS_UPDATE:
99 SetSystemInBitmask(player,
PDS_SYSTEMS.MODS, enable);
103 case ERPCs.DEV_AGENTS_UPDATE:
105 SetSystemInBitmask(player,
PDS_SYSTEMS.AGENTS, enable);
109 case ERPCs.DEV_STOMACH_UPDATE:
111 SetSystemInBitmask(player,
PDS_SYSTEMS.STOMACH, enable);
114 case ERPCs.DEV_TEMP_UPDATE:
116 SetSystemInBitmask(player,
PDS_SYSTEMS.TEMPERATURE, enable);
122 for (
int i = 0; i < m_RegisteredPlayers.Count(); i++)
124 if (m_RegisteredPlayers.GetElement(i).m_Bitmask == 0)
126 m_RegisteredPlayers.RemoveElement(i);
134 if ( m_RegisteredPlayers.Count() == 0)
150 for (
int i = 0; i < m_RegisteredPlayers.Count(); i++ )
152 PlayerBase player = m_RegisteredPlayers.GetKey( i );
153 if ( !player || !player.IsAlive() )
155 m_RegisteredPlayers.RemoveElement(i);
160 int bit_mask = m_RegisteredPlayers.Get( player ).m_Bitmask;
164 SendRPCMods( player);
166 SendRPCModsDetail( player);
170 SendRPCLevels( player );
175 SendRPCStats( player );
179 SendRPCStomach( player );
183 SendRPCAgents( player );
187 SendRPCTemp( player );
195 void SetSystemInBitmask(
PlayerBase player,
int system_bit,
bool state)
197 if ( IsPlayerRegistered(player) )
199 int current_mask = m_RegisteredPlayers.Get(player).m_Bitmask;
201 m_RegisteredPlayers.Get(player).m_Bitmask = current_mask | system_bit;
203 m_RegisteredPlayers.Get(player).m_Bitmask = current_mask & ~system_bit;
209 bool IsSetSystemInBitmask(
PlayerBase player,
int system_bit)
211 if ( IsPlayerRegistered(player) )
213 return (m_RegisteredPlayers.Get(player).m_Bitmask & system_bit);
224 if ( !IsPlayerRegistered( player ) )
241 if ( m_RegisteredPlayers.Contains( player ))
261 case ERPCs.DEV_STATS_UPDATE:
263 EnableUpdate( GetRPCUpdateState( ctx ),
ERPCs.DEV_STATS_UPDATE, player );
break;
266 case ERPCs.DEV_LEVELS_UPDATE:
268 EnableUpdate( GetRPCUpdateState( ctx ),
ERPCs.DEV_LEVELS_UPDATE, player );
break;
271 case ERPCs.DEV_MODS_UPDATE:
273 EnableUpdate( GetRPCUpdateState( ctx ),
ERPCs.DEV_MODS_UPDATE, player );
break;
276 case ERPCs.DEV_AGENTS_UPDATE:
278 EnableUpdate( GetRPCUpdateState( ctx ),
ERPCs.DEV_AGENTS_UPDATE, player );
break;
281 case ERPCs.DEV_STOMACH_UPDATE:
283 EnableUpdate( GetRPCUpdateState( ctx ),
ERPCs.DEV_STOMACH_UPDATE, player );
break;
286 case ERPCs.DEV_RPC_STATS_DATA:
288 OnRPCStats( ctx );
break;
291 case ERPCs.DEV_RPC_LEVELS_DATA:
293 OnRPCLevels( ctx );
break;
296 case ERPCs.DEV_RPC_MODS_DATA:
298 OnRPCMods( ctx );
break;
301 case ERPCs.DEV_RPC_MODS_DATA_DETAILED:
303 OnRPCModsDetailed( ctx );
break;
306 case ERPCs.DEV_RPC_AGENTS_DATA:
308 OnRPCAgents( ctx );
break;
310 case ERPCs.DEV_RPC_STOMACH_DATA:
312 OnRPCStomach( ctx );
break;
315 case ERPCs.DEV_RPC_MODS_ACTIVATE:
319 case ERPCs.DEV_RPC_MODS_DETAILED:
324 case ERPCs.DEV_RPC_MODS_DEACTIVATE:
329 case ERPCs.DEV_RPC_MODS_LOCK:
333 GetRPCModifierLock( ctx,
id, lock );
337 case ERPCs.DEV_RPC_MODS_RESET:
339 player.GetModifiersManager().DeactivateAllModifiers();
343 case ERPCs.DEV_RPC_STATS_RESET:
345 player.GetPlayerStats().ResetAllStats();
349 case ERPCs.DEV_RPC_STAT_SET:
351 OnRPCStatSet(ctx, player);
354 case ERPCs.DEV_TEMP_UPDATE:
356 OnRPCTemp(ctx, player);
365 Param1<bool> p =
new Param1<bool>( 0 );
377 Param1<int> p =
new Param1<int>( 0 );
409 for (
int i = 0; i < player.m_PlayerStats.GetPCO().
Get().
Count(); i++ )
411 string label = player.m_PlayerStats.GetPCO().Get().Get( i ).GetLabel();
412 float value = (
float) player.m_PlayerStats.GetPCO().Get().Get( i ).Get();
413 float value_norm = (
float) player.m_PlayerStats.GetPCO().Get().Get( i ).GetNormalized();
419 rpc_params.InsertAt(
new Param1<int>(rpc_params.Count() ), 0);
421 GetDayZGame().RPC( player,
ERPCs.DEV_RPC_STATS_DATA, rpc_params,
true, player.GetIdentity() );
429 m_PlayerStatsSynced.Clear();
432 Param1<int> p_count =
new Param1<int>(0);
438 if ( ctx.Read(p_count) )
440 param_count = p_count.param1;
444 for (
int i = 0; i < param_count; i++ )
447 m_PlayerStatsSynced.Insert(
new SyncedValue( p.param1, p.param2,
false, p.param3 ) );
452 void UpdateStatsLocal()
457 m_PlayerStatsSynced.Clear();
460 for (
int i = 0; i < player.m_PlayerStats.GetPCO().
Get().
Count(); i++ )
462 string label = player.m_PlayerStats.GetPCO().Get().Get( i ).GetLabel();
463 float value = player.m_PlayerStats.GetPCO().Get().Get( i ).Get();
464 float value_norm = player.m_PlayerStats.GetPCO().Get().Get( i ).GetNormalized();
465 m_PlayerStatsSynced.Insert(
new SyncedValue( label, value,
false, value_norm ) );
468 m_PlayerStatsSynced.Insert(
new SyncedValue(
"(NaS)Immunity", player.GetImmunity() ,
false, 0));
469 m_PlayerStatsSynced.Insert(
new SyncedValue(
"(NaS) BrokenLegs", player.m_BrokenLegState,
false, 0));
477 for (
int i = 0; i < player.m_PlayerStats.GetPCO().
Get().
Count(); i++ )
479 string label = player.m_PlayerStats.GetPCO().Get().Get( i ).GetLabel();
480 if ( label == p.param1 )
482 player.m_PlayerStats.GetPCO().Get().Get( i).SetByFloatEx(p.param2);
507 int param_count = rpc_params.Count();
510 GetDayZGame().RPC( player,
ERPCs.DEV_RPC_LEVELS_DATA, rpc_params,
true, player.GetIdentity() );
518 m_PlayerLevelsSynced.Clear();
526 param_count = p3.param2;
530 for (
int i = 0; i < param_count; i++ )
533 m_PlayerLevelsSynced.Insert(
new SyncedValueLevel( p3.param1, p3.param2, p3.param3 ) );
550 mods_manager.DbgGetModifiers( modifiers );
552 float param_count = (
float ) modifiers.Count();
553 rpc_params.Insert(
new Param1<int>( param_count ));
556 for (
int i = 0; i < modifiers.Count(); ++i )
558 int id = modifiers.Get(i).GetID();
559 string name = modifiers.Get(i).GetName();
560 bool active = modifiers.Get(i).IsActive();
561 bool locked = modifiers.Get(i).IsLocked();
563 rpc_params.Insert(
new Param4<int, string, bool, bool>(
id,
name, active, locked ) );
567 GetDayZGame().RPC( player,
ERPCs.DEV_RPC_MODS_DATA, rpc_params,
true, player.GetIdentity() );
580 Param1<string> p1 =
new Param1<string>(
"");
582 int mod_id = m_RegisteredPlayers.Get(player).m_DetailedModifierIndex;
583 p1.param1 = mods_manager.GetModifier(mod_id).GetDebugText();
586 GetDayZGame().RPCSingleParam( player,
ERPCs.DEV_RPC_MODS_DATA_DETAILED, p1,
true, player.GetIdentity() );
594 m_PlayerModsSynced.Clear();
597 Param1<int> p1 =
new Param1<int>(0);
598 Param4<int, string, bool, bool> p4 =
new Param4<int, string, bool, bool>( 0,
"",
false,
false );
603 param_count = (
int) p1.param1;
607 for (
int i = 0; i < param_count; i++ )
611 m_PlayerModsSynced.Insert(
new SyncedValueModifier( p4.param1, p4.param2, p4.param3, p4.param4 ) );
618 Param1<string> p1 =
new Param1<string>(
"");
623 m_PlayerModsDetailedSynced = p1.param1;
646 int modifier_id =
Math.AbsInt(
id );
647 m_RegisteredPlayers.Get(player).m_DetailedModifierIndex = modifier_id;
649 if (IsSetSystemInBitmask(player,
PDS_SYSTEMS.MODS_DETAILED ))
651 SetSystemInBitmask(player,
PDS_SYSTEMS.MODS_DETAILED,
false);
655 SetSystemInBitmask(player,
PDS_SYSTEMS.MODS_DETAILED,
true);
668 mods_manager.ActivateModifier(
Math.AbsInt(
id ) );
679 mods_manager.DeactivateModifier(
Math.AbsInt(
id ) );
690 mods_manager.SetModifierLock(
Math.AbsInt(
id ), lock );
693 bool IsModifierLocked(
int id,
PlayerBase player = NULL )
701 return mods_manager.GetModifierLock(
Math.AbsInt(
id ) );
721 EnableUpdate( GetRPCUpdateState( ctx ),
ERPCs.DEV_TEMP_UPDATE, player );
740 if ( ( player && player.GetIdentity() && player.m_AgentPool !=
null ) || ( player && !
GetGame().IsMultiplayer() && player.m_AgentPool !=
null ) )
745 player.m_AgentPool.GetDebugObject( agent_pool );
747 GetDayZGame().RPC( player,
ERPCs.DEV_RPC_AGENTS_DATA, agent_pool,
true, player.GetIdentity() );
755 m_PlayerAgentsSynced.Clear();
758 Param1<int> p1 =
new Param1<int>(0);
764 param_count = p1.param1;
768 for (
int i = 0; i < param_count; i++ )
771 m_PlayerAgentsSynced.Insert(
new SyncedValueAgent( p3.param1, p3.param2, p3.param3 ) );
785 int count = player.m_PlayerStomach.GetDebugObject( stomach );
786 stomach.InsertAt(
new Param1<int>(count), 0);
788 GetDayZGame().RPC( player,
ERPCs.DEV_RPC_STOMACH_DATA, stomach,
true, player.GetIdentity() );
796 m_PlayerStomachSynced.Clear();
798 Param1<int> p1 =
new Param1<int>(0);
802 param_count = p1.param1;
808 for (
int i = 0; i < param_count; i++ )
810 Param4<int,int,int,float> p4 =
new Param4<int,int,int,float>(0,0,0,0);
812 m_PlayerStomachSynced.Insert(p4);
815 Param1<float> p1b =
new Param1<float>(0);
817 m_PlayerStomachSynced.Insert(p1b);
855 GetGame().GetInput().ChangeGameFocus( 1 );
856 GetGame().GetUIManager().ShowUICursor(
true );
861 GetGame().GetInput().ChangeGameFocus( -1 );
862 GetGame().GetUIManager().ShowUICursor(
false );
869 GetGame().GetInput().ChangeGameFocus( 1 );
870 GetGame().GetUIManager().ShowUICursor(
true );
874 GetGame().GetInput().ResetGameFocus();
875 GetGame().GetUIManager().ShowUICursor(
false );