Advertisement
AlisaCodeDragon

AutomaticPlay.uc

Apr 1st, 2024
3,911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Class AutomaticPlay  Extends UICommonAPI
  2.     dependson(YetiQuickSlotWnd)
  3.     dependson(YetiQuickSlotWnd);
  4. var WindowHandle AutoTargetWnd;
  5. var TextBoxHandle AutoTargetTitle_text;
  6. var AnimTextureHandle AutoTargetAllON_ToggleEffect_Anim;
  7. var AnimTextureHandle AutoTargetAllON_ToggleEffect_Anim2;
  8. var ButtonHandle WinMinBTN;
  9. var TextureHandle AutoCircleFrameExpand;
  10. var TextureHandle LineBG;
  11. var ButtonHandle TargetNext_BTN;
  12. var ButtonHandle TargetSwap_BTN;
  13. var ButtonHandle TargetPickupToggle_BTN;
  14. var ButtonHandle TargetMannerToggle_BTN;
  15. var ButtonHandle Combat_BTN;
  16. var WindowHandle AutoTargetAllON_Win;
  17. var WindowHandle AutoTargetAllOFF_Win;
  18. var ButtonHandle AutoTargetAll_BTN;
  19. var bool autotarget_bShortTarget;
  20. var bool autotarget_bUseAutoTarget;
  21. var bool autotarget_bIsPickupOn;
  22. var NWindow.UIEventManager.EAutoNextTargetMode autotarget_nTargetMode;
  23. var int autotarget_nHPPotionPercent;
  24. var bool autotarget_bIsMannerModeOn;
  25. var bool bActivateAll;
  26. var int nCombatOnOff;
  27. var int autotarget_nHPPetPotionPercent;
  28. var YetiQuickSlotWnd YetiQuickSlotwndScript;
  29. var Rect rectWndLDowned;
  30. function OnRegisterEvent()
  31. {
  32.     RegisterEvent(9750);
  33.     RegisterEvent(40);
  34.     RegisterEvent(11170);
  35.     RegisterEvent(11030);
  36.     RegisterEvent(5720);
  37.     RegisterEvent(11152);
  38.     RegisterEvent(11280);
  39.     RegisterEvent(11620);
  40.     return;
  41. }
  42. function OnLoad()
  43. {
  44.     Initialize();
  45.     return;
  46. }
  47. function Initialize()
  48. {
  49.     AutoTargetWnd = GetWindowHandle("AutomaticPlay.AutoTargetWnd");
  50.     AutoTargetTitle_text = GetTextBoxHandle("AutomaticPlay.AutoTargetWnd.AutoTargetTitle_text");
  51.     AutoTargetAllON_ToggleEffect_Anim = GetAnimTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win.ToggleEffect_Anim");
  52.     AutoTargetAllON_ToggleEffect_Anim2 = GetAnimTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win.AutoAllArrowOn_texture");
  53.     AutoTargetAllON_Win = GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win");
  54.     WinMinBTN = GetButtonHandle("AutomaticPlay.WinMinBTN");
  55.     LineBG = GetTextureHandle("AutomaticPlay.LineBgTex");
  56.     AutoCircleFrameExpand = GetTextureHandle("AutomaticPlay.AutoTargetWnd.AutoCircleFrameExpand");
  57.     TargetNext_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetNext_BTN");
  58.     TargetSwap_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetSwap_BTN");
  59.     TargetPickupToggle_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetPickupToggle_BTN");
  60.     TargetMannerToggle_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetMannerToggle_BTN");
  61.     AutoTargetAllOFF_Win = GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win");
  62.     AutoTargetAll_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAll_BTN");
  63.     Combat_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.Combat_BTN");
  64.     setCombatTooltip();
  65.     Autotarget_updateCombatButton();
  66.     YetiQuickSlotwndScript = YetiQuickSlotWnd(GetScript("YetiQuickSlotwnd"));
  67.     WinMinBTN.SetButtonValue(0);
  68.     return;
  69. }
  70. function OnShow()
  71. {
  72.     if(getInstanceUIData().getIsLiveServer())
  73.     {
  74.         m_hOwnerWnd.HideWindow();
  75.         return;
  76.     }
  77.     OptionIniLoad();
  78.     updateElements();
  79.     return;
  80. }
  81. function updateElements()
  82. {
  83.     Autotarget_UpdateAutoTargetState();
  84.     Autotarget_updateSwapTargetButton();
  85.     Autotarget_SwapTargetSetCusomTooltip();
  86.     Autotarget_updatePickupButton();
  87.     Autotarget_PickupSetCusomTooltip();
  88.     Autotarget_updateMannerModeButton();
  89.     Autotarget_MannerModeSetCusomTooltip();
  90.     Autotarget_updateNextTargetButton();
  91.     Autotarget_NextTargetSetCusomTooltip();
  92.     return;
  93. }
  94. function OnEvent(int Event_ID, string param)
  95. {
  96.     if(getInstanceUIData().getIsLiveServer())
  97.     {
  98.         return;
  99.     }
  100.     switch(Event_ID)
  101.     {
  102.         case 9750:
  103.             initAll();
  104.             break;
  105.         case 40:
  106.             bActivateAll = False;
  107.             nCombatOnOff = 0;
  108.             setCombatTooltip();
  109.             Autotarget_updateCombatButton();
  110.             Autotarget_Init();
  111.             break;
  112.         case 11170:
  113.             AutoplaySettingHandler(param);
  114.             break;
  115.         case 11030:
  116.         case 5720:
  117.             NextTargetModeHandler();
  118.             break;
  119.         case 11152:
  120.             if(autotarget_bUseAutoTarget)
  121.             {
  122.                 requestAutoPlay(False);
  123.             }
  124.             break;
  125.         case 11280:
  126.             ParseInt(param, "OnOff", nCombatOnOff);
  127.             setCombatTooltip();
  128.             Autotarget_updateCombatButton();
  129.             break;
  130.         case 11620:
  131.             HandleUpdatePlayerAutoAttacking();
  132.             break;
  133.         default:
  134.             break;
  135.     }
  136.     return;
  137. }
  138. function setCombatTooltip()
  139. {
  140.     local array<DrawItemInfo> drawListArr;
  141.     if(nCombatOnOff > 0)
  142.     {
  143.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13263), getInstanceL2Util().PKNameColor, "", True, True);
  144.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13264), getInstanceL2Util().White, "", True, True);
  145.     }
  146.     else
  147.     {
  148.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13263), getInstanceL2Util().White, "", True, True);
  149.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13264), getInstanceL2Util().PKNameColor, "", True, True);
  150.     }
  151.     Combat_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  152.     return;
  153. }
  154. function initAll()
  155. {
  156.     m_hOwnerWnd.ShowWindow();
  157.     bActivateAll = False;
  158.     YetiQuickSlotwndScript.setPlayAutoTargetActiveAnim();
  159.     return;
  160. }
  161. function NextTargetModeHandler()
  162. {
  163.     local NWindow.UIEventManager.EAutoNextTargetMode nTargetMode;
  164.     nTargetMode = GetNextTargetModeOption();
  165.     if(int(autotarget_nTargetMode) != int(nTargetMode))
  166.     {
  167.         if(autotarget_bUseAutoTarget)
  168.         {
  169.             requestAutoPlay(autotarget_bUseAutoTarget);
  170.         }
  171.     }
  172.     Autotarget_NextTargetSetCusomTooltip();
  173.     return;
  174. }
  175. function AutoplaySettingHandler(string param)
  176. {
  177.     local int nIsAutoPlayOn, nNextTargetMode, nIsNearTargetMode, nIsPickupOn, nHPPotionPercent, nIsMannerModeOn,
  178.         nHPPetPotionPercent;
  179.     ParseInt(param, "IsPickupOn", nIsPickupOn);
  180.     ParseInt(param, "IsAutoPlayOn", nIsAutoPlayOn);
  181.     ParseInt(param, "NextTargetMode", nNextTargetMode);
  182.     ParseInt(param, "IsNearTargetMode", nIsNearTargetMode);
  183.     ParseInt(param, "HPPotionPercent", nHPPotionPercent);
  184.     ParseInt(param, "HPPetPotionPercent", nHPPetPotionPercent);
  185.     ParseInt(param, "IsMannerModeOn", nIsMannerModeOn);
  186.     autotarget_bUseAutoTarget = numToBool(nIsAutoPlayOn);
  187.     autotarget_bShortTarget = numToBool(nIsNearTargetMode);
  188.     autotarget_bIsPickupOn = numToBool(nIsPickupOn);
  189.     autotarget_bIsMannerModeOn = numToBool(nIsMannerModeOn);
  190.     autotarget_nHPPotionPercent = nHPPotionPercent;
  191.     autotarget_nHPPetPotionPercent = nHPPetPotionPercent;
  192.     updateElements();
  193.     return;
  194. }
  195. function bool getActivateAll()
  196. {
  197.     return bActivateAll;
  198. }
  199. function OnClickButton(string Name)
  200. {
  201.     if(CheckDrag())
  202.     {
  203.         return;
  204.     }
  205.     switch(Name)
  206.     {
  207.         case "WinMinBTN":
  208.             WinMinMax();
  209.             break;
  210.         case "AutoAll_BTN":
  211.             Class'ShortcutWndAPI'.static.RequestAutomaticUseItemActivateAll(!bActivateAll);
  212.             break;
  213.         case "TargetSwap_BTN":
  214.             Autotarget_OnSwap_Target_BTNClick();
  215.             requestAutoPlay(autotarget_bUseAutoTarget);
  216.             break;
  217.         case "TargetPickupToggle_BTN":
  218.             Autotarget_TargetPickupToggle_BTNClick();
  219.             requestAutoPlay(autotarget_bUseAutoTarget);
  220.             break;
  221.         case "TargetMannerToggle_BTN":
  222.             Autotarget_TargetMannerToggle_BTNClick();
  223.             requestAutoPlay(autotarget_bUseAutoTarget);
  224.             break;
  225.         case "AutoTargetAll_BTN":
  226.             requestAutoPlay(!autotarget_bUseAutoTarget);
  227.             break;
  228.         case "Combat_BTN":
  229.             ExecuteCommand("/combatmode");
  230.             break;
  231.         case "TargetNext_BTN":
  232.             Autotarget_OnNext_Target_BTNClick();
  233.             break;
  234.         default:
  235.             break;
  236.     }
  237.     return;
  238. }
  239. function OnRButtonDown(WindowHandle a_WindowHandle, int X, int Y)
  240. {
  241.     if("AutoAll_BTN" == a_WindowHandle.GetWindowName())
  242.     {
  243.         OnClickButton(a_WindowHandle.GetWindowName());
  244.     }
  245.     return;
  246. }
  247. function bool CheckDrag()
  248. {
  249.     local Rect rectWnd;
  250.     rectWnd = m_hOwnerWnd.GetRect();
  251.     return ((GetAbs(rectWndLDowned.nX - rectWnd.nX)) > 5) || (GetAbs(rectWndLDowned.nY - rectWnd.nY)) > 5;
  252. }
  253. event OnLButtonDown(WindowHandle a_WindowHandle, int X, int Y)
  254. {
  255.     rectWndLDowned = m_hOwnerWnd.GetRect();
  256.     return;
  257. }
  258. function OptionIniLoad()
  259. {
  260.     local int nLongTarget, nIsPickupOn, nIsMannerModeOn, nMinimize;
  261.     if(!GetINIBool("AutomaticPlay", "e", nIsPickupOn, "windowsInfo.ini"))
  262.     {
  263.         nIsPickupOn = 1;
  264.         SetINIBool("AutomaticPlay", "e", numToBool(nIsPickupOn), "windowsInfo.ini");
  265.     }
  266.     if(!GetINIBool("AutomaticPlay", "a", nLongTarget, "windowsInfo.ini"))
  267.     {
  268.         nLongTarget = 1;
  269.         SetINIBool("AutomaticPlay", "a", numToBool(nLongTarget), "windowsInfo.ini");
  270.     }
  271.     if(!GetINIBool("AutomaticPlay", "p", nIsMannerModeOn, "windowsInfo.ini"))
  272.     {
  273.         nIsMannerModeOn = 1;
  274.         SetINIBool("AutomaticPlay", "p", numToBool(nIsMannerModeOn), "windowsInfo.ini");
  275.     }
  276.     GetINIBool("AutomaticPlay", "v", nMinimize, "windowsInfo.ini");
  277.     if(nMinimize == 1)
  278.     {
  279.         SetMin();
  280.     }
  281.     else
  282.     {
  283.         SetMax();
  284.     }
  285.     autotarget_bIsPickupOn = numToBool(nIsPickupOn);
  286.     autotarget_bShortTarget = !numToBool(nLongTarget);
  287.     autotarget_bIsMannerModeOn = numToBool(nIsMannerModeOn);
  288.     return;
  289. }
  290. function Autotarget_Init()
  291. {
  292.     autotarget_bUseAutoTarget = False;
  293.     return;
  294. }
  295. function executeTarget()
  296. {
  297.     if(autotarget_bShortTarget)
  298.     {
  299.         ExecuteCommand("/targetnext");
  300.     }
  301.     else
  302.     {
  303.         ExecuteCommand("/targetnext2");
  304.     }
  305.     return;
  306. }
  307. function setShortcutTooltip(string tooltipStr)
  308. {
  309.     AutoTargetAll_BTN.SetTooltipCustomType(MakeTooltipMultiText(GetSystemString(2165), getInstanceL2Util().White,, True, tooltipStr, getInstanceL2Util().BWhite,, True));
  310.     return;
  311. }
  312. function Autotarget_SwapTargetSetCusomTooltip()
  313. {
  314.     local Color b0, b1;
  315.     local array<DrawItemInfo> drawListArr;
  316.     b0 = getInstanceL2Util().Gray;
  317.     b1 = getInstanceL2Util().Gray;
  318.     if(autotarget_bShortTarget)
  319.     {
  320.         b0 = getInstanceL2Util().Yellow;
  321.     }
  322.     else
  323.     {
  324.         b1 = getInstanceL2Util().Yellow;
  325.     }
  326.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3956), b0, "", True, True);
  327.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3957), b1, "", True, True);
  328.     TargetSwap_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  329.     return;
  330. }
  331. function Autotarget_PickupSetCusomTooltip()
  332. {
  333.     local Color b0, b1;
  334.     local array<DrawItemInfo> drawListArr;
  335.     b0 = getInstanceL2Util().Gray;
  336.     b1 = getInstanceL2Util().Gray;
  337.     TargetPickupToggle_BTN.ClearTooltip();
  338.     TargetPickupToggle_BTN.SetTooltipType("text");
  339.     if(autotarget_bIsPickupOn)
  340.     {
  341.         b0 = getInstanceL2Util().Yellow;
  342.     }
  343.     else
  344.     {
  345.         b1 = getInstanceL2Util().Yellow;
  346.     }
  347.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3993), b0, "", True, True);
  348.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3992), b1, "", True, True);
  349.     TargetPickupToggle_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  350.     return;
  351. }
  352. function Autotarget_MannerModeSetCusomTooltip()
  353. {
  354.     local Color b0, b1;
  355.     local array<DrawItemInfo> drawListArr;
  356.     b0 = getInstanceL2Util().Gray;
  357.     b1 = getInstanceL2Util().Gray;
  358.     TargetMannerToggle_BTN.ClearTooltip();
  359.     TargetMannerToggle_BTN.SetTooltipType("text");
  360.     if(autotarget_bIsMannerModeOn)
  361.     {
  362.         b0 = getInstanceL2Util().Yellow;
  363.     }
  364.     else
  365.     {
  366.         b1 = getInstanceL2Util().Yellow;
  367.     }
  368.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13080), b0, "", True, True);
  369.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13081), b1, "", True, True);
  370.     TargetMannerToggle_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  371.     return;
  372. }
  373. function Autotarget_NextTargetSetCusomTooltip()
  374. {
  375.     local int N;
  376.     local Color b0, b1, b2, b3, b4;
  377.     local array<DrawItemInfo> drawListArr;
  378.     local string toolString;
  379.     b0 = getInstanceL2Util().Gray;
  380.     b1 = getInstanceL2Util().Gray;
  381.     b2 = getInstanceL2Util().Gray;
  382.     b3 = getInstanceL2Util().Gray;
  383.     b4 = getInstanceL2Util().Gray;
  384.     TargetNext_BTN.ClearTooltip();
  385.     TargetNext_BTN.SetTooltipType("text");
  386.     N = GetOptionInt("Communication", "NextTargetModeClassic");
  387.     if(N == 0)
  388.     {
  389.         TargetNext_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.L2UI_NewTex.Automaticplay.TargetBTN_threat", "L2UI_NewTex.Automaticplay.TargetBTN_threat_Over", "L2UI_NewTex.Automaticplay.TargetBTN_threat_Down");
  390.         b0 = getInstanceL2Util().Yellow;
  391.     }
  392.     else
  393.     {
  394.         if(N == 1)
  395.         {
  396.             TargetNext_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_Next_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_Next_Over", "L2UI_NewTex.AutomaticPlay.TargetBTN_Next_Normal");
  397.             b2 = getInstanceL2Util().Yellow;
  398.         }
  399.         else
  400.         {
  401.             if(N == 2)
  402.             {
  403.                 TargetNext_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_pc", "L2UI_NewTex.Automaticplay.TargetBTN_pc_Over", "L2UI_NewTex.Automaticplay.TargetBTN_pc_Down");
  404.                 b3 = getInstanceL2Util().Yellow;
  405.             }
  406.             else
  407.             {
  408.                 if(N == 3)
  409.                 {
  410.                     TargetNext_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_Next_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_Next_Over", "L2UI_NewTex.AutomaticPlay.TargetBTN_Next_Normal");
  411.                     b4 = getInstanceL2Util().Yellow;
  412.                 }
  413.                 else
  414.                 {
  415.                     if(N == 4)
  416.                     {
  417.                         TargetNext_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.L2UI_NewTex.Automaticplay.TargetBTN_threat", "L2UI_NewTex.Automaticplay.TargetBTN_threat_Over", "L2UI_NewTex.Automaticplay.TargetBTN_threat_Down");
  418.                         b1 = getInstanceL2Util().Yellow;
  419.                     }
  420.                 }
  421.             }
  422.         }
  423.     }
  424.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3862), b0, "", True, True);
  425.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13732), b1, "", True, True);
  426.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3863), b2, "", True, True);
  427.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3864), b3, "", True, True);
  428.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3865), b4, "", True, True);
  429.     drawListArr[drawListArr.Length] = addDrawItemBlank(4);
  430.     drawListArr[drawListArr.Length] = AddCrossLineForCustomToolTip(130);
  431.     drawListArr[drawListArr.Length] = addDrawItemBlank(4);
  432.     toolString = MenuEntireWnd(GetScript("MenuEntireWnd")).setMainShortcutString(MenuEntireWnd(GetScript("MenuEntireWnd")).getAssignedKeyGroup(), "NextTargetModeChange");
  433.     drawListArr[drawListArr.Length] = addDrawItemText(toolString, getInstanceL2Util().White, "", True, True);
  434.     TargetNext_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  435.     return;
  436. }
  437. function OnRButtonUp(WindowHandle a_WindowHandle, int X, int Y)
  438. {
  439.     switch(a_WindowHandle.GetWindowName())
  440.     {
  441.         case "AutoTargetAll_BTN":
  442.         case "MacroShortcutItem":
  443.             requestAutoPlay(!autotarget_bUseAutoTarget);
  444.             break;
  445.         default:
  446.             break;
  447.     }
  448.     return;
  449. }
  450. function bool getUseAutoTarget()
  451. {
  452.     return autotarget_bUseAutoTarget;
  453. }
  454. function Autotarget_OnNext_Target_BTNClick()
  455. {
  456.     local string strParam;
  457.     local int targetMode;
  458.     strParam = "";
  459.     switch(GetOptionInt("CommunIcation", "NextTargetModeClassic"))
  460.     {
  461.         case 0:
  462.             targetMode = 4;
  463.             break;
  464.         case 1:
  465.             targetMode = 2;
  466.             break;
  467.         case 2:
  468.             targetMode = 3;
  469.             break;
  470.         case 3:
  471.             targetMode = 0;
  472.             break;
  473.         case 4:
  474.             targetMode = 1;
  475.             break;
  476.         default:
  477.             break;
  478.     }
  479.     SetOptionInt("Communication", "NextTargetModeClassic", targetMode);
  480.     ParamAdd(strParam, "NextTargetMode", string(targetMode));
  481.     ExecuteEvent(11030, strParam);
  482.     Autotarget_NextTargetSetCusomTooltip();
  483.     Autotarget_updateNextTargetButton();
  484.     return;
  485. }
  486. function Autotarget_OnSwap_Target_BTNClick()
  487. {
  488.     autotarget_bShortTarget = !autotarget_bShortTarget;
  489.     SetINIBool("AutomaticPlay", "a", !autotarget_bShortTarget, "windowsInfo.ini");
  490.     if(autotarget_bShortTarget)
  491.     {
  492.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3956));
  493.     }
  494.     else
  495.     {
  496.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3957));
  497.     }
  498.     Autotarget_SwapTargetSetCusomTooltip();
  499.     Autotarget_updateSwapTargetButton();
  500.     return;
  501. }
  502. function Autotarget_TargetMannerToggle_BTNClick()
  503. {
  504.     autotarget_bIsMannerModeOn = !autotarget_bIsMannerModeOn;
  505.     SetINIBool("AutomaticPlay", "p", autotarget_bIsMannerModeOn, "windowsInfo.ini");
  506.     if(autotarget_bIsMannerModeOn)
  507.     {
  508.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(13080));
  509.     }
  510.     else
  511.     {
  512.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(13081));
  513.     }
  514.     Autotarget_updateMannerModeButton();
  515.     Autotarget_MannerModeSetCusomTooltip();
  516.     return;
  517. }
  518. function Autotarget_TargetPickupToggle_BTNClick()
  519. {
  520.     autotarget_bIsPickupOn = !autotarget_bIsPickupOn;
  521.     SetINIBool("AutomaticPlay", "e", autotarget_bIsPickupOn, "windowsInfo.ini");
  522.     if(autotarget_bIsPickupOn)
  523.     {
  524.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3993));
  525.     }
  526.     else
  527.     {
  528.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3992));
  529.     }
  530.     Autotarget_updatePickupButton();
  531.     Autotarget_PickupSetCusomTooltip();
  532.     return;
  533. }
  534. function Autotarget_updateSwapTargetButton()
  535. {
  536.     if(autotarget_bShortTarget)
  537.     {
  538.         TargetSwap_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_ShotD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_ShotD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_ShotD_Over");
  539.     }
  540.     else
  541.     {
  542.         TargetSwap_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_LongD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_LongD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_LongD_Over");
  543.     }
  544.     return;
  545. }
  546. function Autotarget_updateNextTargetButton()
  547. {
  548.     return;
  549. }
  550. function Autotarget_updatePickupButton()
  551. {
  552.     if(autotarget_bIsPickupOn)
  553.     {
  554.         TargetPickupToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.GetBTNON_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNON_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNON_Over");
  555.     }
  556.     else
  557.     {
  558.         TargetPickupToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.GetBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNOff_Over");
  559.     }
  560.     return;
  561. }
  562. function Autotarget_updateMannerModeButton()
  563. {
  564.     if(autotarget_bIsMannerModeOn)
  565.     {
  566.         TargetMannerToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.MannerBTNON_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNON_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNON_over");
  567.     }
  568.     else
  569.     {
  570.         TargetMannerToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.MannerBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNOff_over");
  571.     }
  572.     return;
  573. }
  574. function Autotarget_updateCombatButton()
  575. {
  576.     if(nCombatOnOff > 0)
  577.     {
  578.         Combat_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.CombatBTNON_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNON_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNON_Over");
  579.     }
  580.     else
  581.     {
  582.         Combat_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.CombatBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNOff_Over");
  583.     }
  584.     return;
  585. }
  586. function Autotarget_UpdateAutoTargetState()
  587. {
  588.     if(autotarget_bUseAutoTarget)
  589.     {
  590.         AnimTexturePlay(AutoTargetAllON_ToggleEffect_Anim, True);
  591.         AnimTexturePlay(AutoTargetAllON_ToggleEffect_Anim2, True);
  592.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win").ShowWindow();
  593.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win").HideWindow();
  594.     }
  595.     else
  596.     {
  597.         AnimTextureStop(AutoTargetAllON_ToggleEffect_Anim, True);
  598.         AnimTextureStop(AutoTargetAllON_ToggleEffect_Anim2, True);
  599.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win").HideWindow();
  600.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win").ShowWindow();
  601.     }
  602.     YetiQuickSlotwndScript.setPlayAutoTargetActiveAnim();
  603.     return;
  604. }
  605. function requestAutoPlay(bool bUseAutoTarget, optional int nHPPotionPercent, optional int nHPPetPotionPercent)
  606. {
  607.     local AutoplaySettingData pAutoplaySettingData;
  608.     autotarget_nTargetMode = GetNextTargetModeOption();
  609.     pAutoplaySettingData.IsAutoPlayOn = bUseAutoTarget;
  610.     pAutoplaySettingData.IsPickupOn = autotarget_bIsPickupOn;
  611.     pAutoplaySettingData.NextTargetMode = autotarget_nTargetMode;
  612.     pAutoplaySettingData.IsNearTargetMode = autotarget_bShortTarget;
  613.     pAutoplaySettingData.IsMannerModeOn = autotarget_bIsMannerModeOn;
  614.     if(nHPPotionPercent > 0)
  615.     {
  616.         pAutoplaySettingData.HPPotionPercent = nHPPotionPercent;
  617.     }
  618.     else
  619.     {
  620.         pAutoplaySettingData.HPPotionPercent = autotarget_nHPPotionPercent;
  621.     }
  622.     if(nHPPetPotionPercent > 0)
  623.     {
  624.         pAutoplaySettingData.HPPetPotionPercent = nHPPetPotionPercent;
  625.     }
  626.     else
  627.     {
  628.         pAutoplaySettingData.HPPetPotionPercent = autotarget_nHPPetPotionPercent;
  629.     }
  630.     UpdateAutoplaySetting(pAutoplaySettingData);
  631.     return;
  632. }
  633. function requestAutoPlayForAutoPotion(int nHPPotionPercent)
  634. {
  635.     requestAutoPlay(autotarget_bUseAutoTarget, nHPPotionPercent);
  636.     return;
  637. }
  638. function requestAutoPlayForAutoPotionPet(int nHPPetPotionPercent)
  639. {
  640.     requestAutoPlay(autotarget_bUseAutoTarget, autotarget_nHPPotionPercent, nHPPetPotionPercent);
  641.     return;
  642. }
  643. function requestAutoPlayForAutoPotionWithPet(int nHPPotionPercent, int nHPPetPotionPercent)
  644. {
  645.     requestAutoPlay(autotarget_bUseAutoTarget, nHPPotionPercent, nHPPetPotionPercent);
  646.     return;
  647. }
  648. function showHideForYeti(bool bShow)
  649. {
  650.     if(bShow)
  651.     {
  652.         m_hOwnerWnd.ShowWindow();
  653.     }
  654.     else
  655.     {
  656.         m_hOwnerWnd.HideWindow();
  657.     }
  658.     return;
  659. }
  660. function WinMinMax()
  661. {
  662.     if(WinMinBTN.GetButtonValue() == 0)
  663.     {
  664.         SetMin();
  665.     }
  666.     else
  667.     {
  668.         SetMax();
  669.     }
  670.     return;
  671. }
  672. private function SetMin()
  673. {
  674.     SetINIBool("AutomaticPlay", "v", True, "windowsInfo.ini");
  675.     WinMinBTN.SetButtonValue(1);
  676.     WinMinBTN.SetTexture("L2UI_NewTex.AutomaticPlay.WinExpandButton_Normal", "L2UI_NewTex.AutomaticPlay.WinExpandButton_Down", "L2UI_NewTex.AutomaticPlay.WinExpandButton_Over");
  677.     LineBG.SetTexture("");
  678.     AutoCircleFrameExpand.SetTexture("L2UI_NewTex.AutomaticPlay.AutoCircleFrameSmall");
  679.     TargetNext_BTN.HideWindow();
  680.     TargetSwap_BTN.HideWindow();
  681.     TargetPickupToggle_BTN.HideWindow();
  682.     TargetMannerToggle_BTN.HideWindow();
  683.     Combat_BTN.HideWindow();
  684.     return;
  685. }
  686. private function SetMax()
  687. {
  688.     SetINIBool("AutomaticPlay", "v", False, "windowsInfo.ini");
  689.     WinMinBTN.SetButtonValue(0);
  690.     WinMinBTN.SetTexture("L2UI_NewTex.AutomaticPlay.WinMinButton_Normal", "L2UI_NewTex.AutomaticPlay.WinMinButton_Down", "L2UI_NewTex.AutomaticPlay.WinMinButton_Over");
  691.     LineBG.SetTexture("L2UI_NewTex.AutomaticPlay.LineBG");
  692.     AutoCircleFrameExpand.SetTexture("L2UI_NewTex.AutomaticPlay.AutoCircleFrameExpand");
  693.     TargetNext_BTN.ShowWindow();
  694.     TargetSwap_BTN.ShowWindow();
  695.     TargetPickupToggle_BTN.ShowWindow();
  696.     TargetMannerToggle_BTN.ShowWindow();
  697.     Combat_BTN.ShowWindow();
  698.     return;
  699. }
  700. private function HandleUpdatePlayerAutoAttacking()
  701. {
  702.     if(API_IsAutoAttacking())
  703.     {
  704.         GetTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win.AutoAllIcon_Off_texture").SetTexture("L2UI_NewTex.AutomaticPlay.FightOn");
  705.         GetTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win.AutoAllIcon_On_texture").SetTexture("L2UI_NewTex.AutomaticPlay.FightOn_Auto");
  706.     }
  707.     else
  708.     {
  709.         GetTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win.AutoAllIcon_Off_texture").SetTexture("L2UI_NewTex.AutomaticPlay.FightOff");
  710.         GetTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win.AutoAllIcon_On_texture").SetTexture("L2UI_NewTex.AutomaticPlay.FightOff_Auto");
  711.     }
  712.     return;
  713. }
  714. private function bool API_IsAutoAttacking()
  715. {
  716.     return Class'UIDATA_PLAYER'.static.IsAutoAttacking();
  717. }
  718. function int GetAbs(int Num)
  719. {
  720.     if(Num < 0)
  721.     {
  722.         return -Num;
  723.     }
  724.     return Num;
  725. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement