actioncheckpulse.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //!DEPRECATED
  2. class ActionCheckPulse: ActionInteractBase
  3. {
  4. const int TARGET_IRREGULAR_PULSE_BIT = 1 << 31;
  5. void ActionCheckPulse()
  6. {
  7. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
  8. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  9. m_Text = "#check_pulse_target";
  10. }
  11. override void CreateConditionComponents()
  12. {
  13. m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
  14. m_ConditionItem = new CCINone;
  15. }
  16. static string GetPulseMessage(EPulseType pulse_type, int blood_level)
  17. {
  18. //builds string table keys:
  19. //pulse_strong
  20. //pulse_decent
  21. //pulse_moderate
  22. //pulse_weak
  23. //pulse_faint
  24. //pulse_strong_irregular
  25. //pulse_decent_irregular
  26. //pulse_moderate_irregular
  27. //pulse_weak_irregular
  28. //pulse_faint_irregular
  29. string blood_msg = "strong";
  30. string pulse_msg = "";
  31. if(pulse_type == EPulseType.IRREGULAR)
  32. {
  33. pulse_msg = "_irregular";
  34. }
  35. if( blood_level == EStatLevels.HIGH )
  36. {
  37. blood_msg = "decent";
  38. }
  39. if( blood_level == EStatLevels.MEDIUM )
  40. {
  41. blood_msg = "moderate";
  42. }
  43. if( blood_level == EStatLevels.LOW )
  44. {
  45. blood_msg = "weak";
  46. }
  47. if( blood_level == EStatLevels.CRITICAL )
  48. {
  49. blood_msg = "faint";
  50. }
  51. //string message = blood_msg + " " + pulse_msg + " pulse";
  52. string message = "#"+ "pulse_" + blood_msg + pulse_msg;
  53. return message;
  54. }
  55. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  56. {
  57. PlayerBase ntarget = PlayerBase.Cast( target.GetObject() );
  58. if( ntarget && ntarget.IsAlive())
  59. {
  60. return true;
  61. }
  62. return false;
  63. }
  64. override void OnExecuteServer( ActionData action_data )
  65. {
  66. PlayerBase target_player = PlayerBase.Cast(action_data.m_Target.GetObject());
  67. if (target_player)
  68. {
  69. PlayerBase player = action_data.m_Player;
  70. CachedObjectsParams.PARAM1_INT.param1 = target_player.GetStatLevelBlood();
  71. bool pulse_type = target_player.GetPulseType();
  72. if (pulse_type == EPulseType.IRREGULAR)
  73. CachedObjectsParams.PARAM1_INT.param1 = CachedObjectsParams.PARAM1_INT.param1 | (1 << TARGET_IRREGULAR_PULSE_BIT);
  74. GetGame().RPCSingleParam( player ,ERPCs.RPC_CHECK_PULSE, CachedObjectsParams.PARAM1_INT, true, player.GetIdentity() );
  75. }
  76. }
  77. override void OnExecuteClient( ActionData action_data )
  78. {
  79. PlayerBase ntarget = PlayerBase.Cast( action_data.m_Target.GetObject() );
  80. if(ntarget)
  81. {
  82. action_data.m_Player.m_CheckPulseLastTarget = ntarget;
  83. }
  84. }
  85. }