56 TextListboxWidget m_Selector;
57 ButtonWidget m_ButtonStart;
58 TextWidget m_WidgetActionRunning;
59 TextWidget m_WidgetActionEvents;
61 EditBoxWidget m_SetInitStateI;
62 ButtonWidget m_SetInitStateB;
63 ButtonWidget m_WeaponChange;
64 ButtonWidget m_WeaponHide;
65 EditBoxWidget m_WeaponSlotH;
66 EditBoxWidget m_WeaponSlotS;
67 EditBoxWidget m_WeaponActionProgressStart;
68 EditBoxWidget m_WeaponActionProgressEnd;
71 int m_CH_WeapAction = -1;
72 int m_CH_WeapActionType = -1;
73 int m_CH_LastWeapAction = -1;
74 int m_CH_LastWeapActionType = -1;
75 float m_CH_WeapActionProgressStart = 0;
76 float m_CH_WeapActionProgressEnd = 1;
78 string m_CH_WeaponChangeI;
79 int m_CH_WeaponChangeSlotH = -1;
80 int m_CH_WeaponChangeSlotS = -1;
99 PluginDayzPlayerDebug_AbilityConfig(
"Pistol Closed Charged - Reload Mag NoBullet", WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_CLOSED_COCKED),
100 PluginDayzPlayerDebug_AbilityConfig(
"Pistol Closed Charged - Reload NoMag NoBullet", WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_CLOSED_COCKED),
101 PluginDayzPlayerDebug_AbilityConfig(
"Pistol Closed Discharged - Reload Mag NoBullet", WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_CLOSED_UNCOCKED),
102 PluginDayzPlayerDebug_AbilityConfig(
"Pistol Closed Discharged - Reload NoMag NoBullet", WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_CLOSED_UNCOCKED),
128 PluginDayzPlayerDebug_AbilityConfig(
"Chamb Loopable Start Closed keep bullet", WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_CLOSED_KEEP),
132 PluginDayzPlayerDebug_AbilityConfig(
"Chamb Loopable Shotgun Start Uncocked", WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_SHOTGUN_UNCOCKED),
164 int FindAbilityConfig(
int pAction,
int pActionT)
166 int l = m_AbilityConfig.Count();
167 for (
int i = 0; i < l; i++)
185 CreateModuleWidgets();
191 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
192 hcw.DebugResetEvents();
199 DestroyModuleWidgets();
203 void CreateModuleWidgets()
205 m_Selector = TextListboxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionSelector") );
206 m_ButtonStart = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionStart") );
208 m_WidgetActionRunning = TextWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionRunning") );
209 m_WidgetActionEvents = TextWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionEvents") );
211 m_SetInitStateI = EditBoxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapInitStateI") );
212 m_SetInitStateB = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapInitStateB") );
214 m_WeaponChange = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapChange") );
215 m_WeaponHide = ButtonWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapHide") );
216 m_WeaponSlotH = EditBoxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeaponChangeSlotH") );
217 m_WeaponSlotS = EditBoxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeaponChangeSlotS") );
218 m_WeaponActionProgressStart = EditBoxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionProgressStart") );
219 m_WeaponActionProgressEnd = EditBoxWidget.Cast(
m_MainWnd.FindAnyWidget(
"WeapActionProgressEnd") );
222 m_WidgetActionEvents.SetText(
"Events:");
226 void DestroyModuleWidgets()
246 EntityAI entityInHands = player.GetHumanInventory().GetEntityInHands();
248 if (
Class.CastTo(w, entityInHands))
250 if (m_CurrentWeapon != w)
255 m_Selector.ClearItems();
260 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
262 string text =
"Action: " + hcw.GetRunningAction().ToString() +
" " + hcw.GetRunningActionType().ToString();
263 m_WidgetActionRunning.SetText(text);
266 int aEvent = hcw.DebugIsEvent();
269 string eventStr =
"Event: ";
270 eventStr = eventStr + aEvent.ToString() +
" ";
273 aEvent = hcw.DebugIsEvent();
279 Print(
"Event: " + aEvent.ToString());
281 eventStr += aEvent.ToString();
285 m_WidgetActionEvents.SetText(eventStr);
297 m_Selector.ClearItems();
300 int abilityCount = w.GetAbilityCount();
302 for (
int i = 0; i < abilityCount; ++i)
305 int abConfigIndex = FindAbilityConfig(rec.m_action, rec.m_actionType);
306 if (abConfigIndex != -1)
312 m_Selector.AddItem(
"=========== All - not safe =========", NULL, 0);
317 int l = m_AbilityConfig.Count();
318 for (
int a = 0; a < l; a++)
329 void WeaponsStartAction()
331 int row = m_Selector.GetSelectedRow();
338 m_Selector.GetItemData(row, 0, userData);
341 m_CH_WeapAction = userData.GetAction();
342 m_CH_WeapActionType = userData.GetActionType();
343 m_CH_WeapActionProgressStart = m_WeaponActionProgressStart.GetText().ToFloat();
344 m_CH_WeapActionProgressEnd = m_WeaponActionProgressEnd.GetText().ToFloat();
346 Print(
"DayzPlayerImplement_Weapons::WeaponsStartAction");
355 bool OnClick(Widget w,
int x,
int y,
int button)
357 if (w == m_ButtonStart)
359 WeaponsStartAction();
362 else if (w == m_SetInitStateB)
364 int frameI = m_SetInitStateI.GetText().ToInt();
368 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
369 hcw.SetInitState(frameI);
371 else if (w == m_WeaponChange)
373 Print(
"Weapon Change pressed");
378 Print(
"No dispatcher - cannot get selected weapon");
385 Print(
"No selected object");
389 Param1<string> p1 = Param1<string>.Cast(p);
392 m_CH_WeaponChangeI = p1.param1;
393 m_CH_WeaponChangeSlotH = m_WeaponSlotH.GetText().ToInt();
394 m_CH_WeaponChangeSlotS = m_WeaponSlotS.GetText().ToInt();
396 else if (w == m_WeaponHide)
398 m_CH_WeaponChangeI =
"";
399 m_CH_WeaponChangeSlotH = m_WeaponSlotH.GetText().ToInt();
400 m_CH_WeaponChangeSlotS = m_WeaponSlotS.GetText().ToInt();
410 bool IsWeaponChange(out
string pNewWeapon, out
int pHideSlot, out
int pShowSlot)
412 if (m_CH_WeaponChangeSlotH == -1)
417 pNewWeapon = m_CH_WeaponChangeI;
418 pHideSlot = m_CH_WeaponChangeSlotH;
419 pShowSlot = m_CH_WeaponChangeSlotS;
421 m_CH_WeaponChangeSlotH = -1;
422 m_CH_WeaponChangeSlotS = -1;
431 void CommandHandler()
438 m_CH_WeapAction = m_CH_LastWeapAction;
439 m_CH_WeapActionType = m_CH_LastWeapActionType;
441 Print(
"DayzPlayerImplement_Weapons OnKC_MULTIPLY");
445 if (m_CH_WeapAction >= 0)
447 m_CH_LastWeapAction = m_CH_WeapAction;
448 m_CH_LastWeapActionType = m_CH_WeapActionType;
454 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
455 hcw.SetActionProgressParams(m_CH_WeapActionProgressStart, m_CH_WeapActionProgressEnd);
456 hcw.StartAction(m_CH_WeapAction, m_CH_WeapActionType);
458 Print(
"DayzPlayerImplement_Weapons::WeaponsStartAction2");
462 m_CH_WeapAction = -1;