Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. modded class DayZGame
  2. {
  3. private int m_CustomQueueTime;
  4. private bool m_NewCharacter;
  5. private bool m_CanSpawn;
  6. private bool m_Complete;
  7. private bool m_IsRespawn = false;
  8. private string m_LoadoutJson;
  9. ref array<ref Param> m_CustomizationParams;
  10.  
  11. void DayZGame()
  12. {
  13. m_CustomQueueTime = 0;
  14. m_Complete = false;
  15. Print("DayZ Vanilla PlusPlus!");
  16. }
  17.  
  18. void UpdateCharacterItems(ref array<ref Param> params)
  19. {
  20. if (params)
  21. {
  22. m_CustomizationParams = new array<ref Param>;
  23. m_CustomizationParams = params;
  24. }
  25. }
  26.  
  27. void ProcessLoadout()
  28. {
  29. if (!m_Complete)
  30. {
  31. m_Complete = true;
  32. Param2<string,string> oParams = new Param2<string,string>(m_LoadoutJson,GetGame().GetPlayer().GetIdentity().GetId());
  33. GetRPCManager().SendRPC( "RPC_SpawnStartKit", "SpawnStartKit", oParams, true );
  34. GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(this.ResetMemes, 2200, false);
  35. }
  36. }
  37.  
  38. int GetQueueTime()
  39. {
  40. return m_CustomQueueTime;
  41. }
  42.  
  43. void SetSelectedLoadout(string JsonData)
  44. {
  45. m_LoadoutJson = JsonData;
  46. }
  47.  
  48. void IsReadyToSpawn()
  49. {
  50. if (m_CustomizationParams != NULL)
  51. {
  52. m_CanSpawn = true;
  53. }
  54. else
  55. {
  56. m_CanSpawn = false;
  57. }
  58. }
  59.  
  60. void ResetMemes()
  61. {
  62. m_Complete = false;
  63. m_CustomizationParams = NULL;
  64. }
  65.  
  66. void TriggerRespawn()
  67. {
  68. m_IsRespawn = true;
  69. }
  70.  
  71. override void CancelQueueTime()
  72. {
  73. if (m_NewCharacter)
  74. {
  75. GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(this.ProcessLoadout, 1200, false);
  76. }
  77. m_NewCharacter = false;
  78. m_CanSpawn = false;
  79. m_CustomQueueTime = 0;
  80. m_Complete = false;
  81. GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(this.ClientSpawning);
  82. GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(this.IsReadyToSpawn);
  83. }
  84. // ------------------------------------------------------------
  85. override void OnClientSpawningEvent(int queueTime, bool newChar)
  86. {
  87. if (newChar)
  88. {
  89. m_CustomQueueTime = 120;
  90. m_NewCharacter = true;
  91. GetUIManager().EnterScriptedMenu( VPP_MENU_SPAWN_SCENE, NULL );
  92. }
  93. else
  94. {
  95. m_CustomQueueTime = queueTime;
  96. GetGame().SetEVUser(-5);
  97. m_NewCharacter = false;
  98. }
  99.  
  100. //Count down part
  101. GetGame().GetUserManager().GetUserDatabaseIdAsync();
  102. if (m_CustomQueueTime > 0)
  103. {
  104. GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.ClientSpawning, 1000, true, newChar);
  105. GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.IsReadyToSpawn, 100, true);
  106. }
  107. }
  108. // ------------------------------------------------------------
  109. override void ClientSpawning(bool newChar)
  110. {
  111. if (m_NewCharacter)
  112. {
  113. //Waiting....for player to select gear.
  114. m_CustomQueueTime --;
  115. if (m_CustomQueueTime <= 0)
  116. {
  117. if (m_CanSpawn)
  118. {
  119. ClientSpawningFinished(newChar);
  120. GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
  121. }
  122. else
  123. {
  124. //TODO: Kick/Disconnect Fucntion
  125. Print("Timesup....Kick");
  126. g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().DisconnectSessionForce);
  127. GetGame().GetUIManager().Back();
  128. GetGame().GetUIManager().CloseDialog();
  129. GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
  130. }
  131. }
  132. else if (m_CanSpawn) //Player Finished selecting b4 timer...process spawn
  133. {
  134. ClientSpawningFinished(newChar);
  135. GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
  136. }
  137. }
  138. else
  139. {
  140. if (m_CustomQueueTime >= 0)
  141. {
  142. #ifndef NO_GUI
  143. string text = "#dayz_game_spawning_in" + " " + m_CustomQueueTime.ToString() + " " + "#dayz_game_seconds";
  144. GetUIManager().ScreenFadeIn(0, text, FadeColors.BLACK, FadeColors.WHITE);
  145. m_CustomQueueTime --;
  146. #endif
  147. }
  148. else
  149. {
  150. ClientSpawningFinished(newChar);
  151. GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
  152. }
  153. }
  154. }
  155.  
  156. // ------------------------------------------------------------
  157. override void ClientSpawningFinished(bool newChar)
  158. {
  159. super.ClientSpawningFinished(newChar);
  160. }
  161.  
  162. override void StoreLoginData()
  163. {
  164. if (m_NewCharacter && !m_IsRespawn)
  165. {
  166. GetGame().StoreLoginData(m_CustomizationParams);
  167. }
  168. else if (m_IsRespawn)
  169. {
  170. GetGame().StoreLoginData(m_CustomizationParams);
  171. }
  172. else if (!m_NewCharacter && !m_IsRespawn)
  173. {
  174. ref array<ref Param> mParams = new array<ref Param>;
  175.  
  176. ref Param topParam = new Param1<int>(-1);
  177. mParams.Insert(topParam);
  178.  
  179. ref Param bottomParam = new Param1<int>(-1);
  180. mParams.Insert(bottomParam);
  181.  
  182. ref Param shoesParam = new Param1<int>(-1);
  183. mParams.Insert(shoesParam);
  184.  
  185. ref Param skinParam = new Param1<int>(-1);
  186. mParams.Insert(skinParam);
  187. GetGame().StoreLoginData(mParams);
  188. }
  189. }
  190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement