Advertisement
AlisaCodeDragon

AutomaticPlay.uc

Jan 24th, 2023
2,130
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.  
  5. var WindowHandle Me;
  6. var WindowHandle AutoTargetWnd;
  7. var TextBoxHandle AutoTargetTitle_text;
  8. var AnimTextureHandle AutoTargetAllON_ToggleEffect_Anim;
  9. var ButtonHandle TargetSwap_BTN;
  10. var ButtonHandle TargetPickupToggle_BTN;
  11. var ButtonHandle TargetMannerToggle_BTN;
  12. var ButtonHandle Combat_BTN;
  13. var WindowHandle AutoTargetAllON_Win;
  14. var WindowHandle AutoTargetAllOFF_Win;
  15. var ButtonHandle AutoTargetAll_BTN;
  16. var bool autotarget_bShortTarget;
  17. var bool autotarget_bUseAutoTarget;
  18. var bool autotarget_bIsPickupOn;
  19. var NWindow.UIEventManager.EAutoNextTargetMode autotarget_nTargetMode;
  20. var int autotarget_nHPPotionPercent;
  21. var bool autotarget_bIsMannerModeOn;
  22. var bool bActivateAll;
  23. var int nCombatOnOff;
  24. var YetiQuickSlotWnd YetiQuickSlotwndScript;
  25. var int autotarget_nHPPetPotionPercent;
  26. var int bFixCombatZone;
  27. var int bStopIfMoving;
  28. var int bShowRange;
  29. var int bTownMode;
  30. var int bTargetRaidBoss;
  31. var int iRange1;
  32. var int iRange2;
  33. var string bypass_combat;
  34. var string bypass_moving;
  35. var string bypass_showrange;
  36. var string bypass_targetboss;
  37. var string bypass_townmode;
  38. var ButtonHandle NextTargetDistanceOptionBtn;
  39. var ButtonHandle FixedCombatZoneBtn;
  40. var ButtonHandle StopIfMovingBtn;
  41. var ButtonHandle ShowTargetRangeBtn;
  42. var ButtonHandle TownModeBtn;
  43. var ButtonHandle TargetRaidBossBtn;
  44. var bool bLoadByStart;
  45.  
  46. function OnRegisterEvent()
  47. {
  48.     RegisterEvent(9750);
  49.     RegisterEvent(40);
  50.     RegisterEvent(11170);
  51.     RegisterEvent(11030);
  52.     RegisterEvent(5720);
  53.     RegisterEvent(11152);
  54.     RegisterEvent(11280);
  55.     return;
  56. }
  57.  
  58. function OnLoad()
  59. {
  60.     Initialize();
  61.     return;
  62. }
  63.  
  64. function Initialize()
  65. {
  66.     Me = GetWindowHandle("AutomaticPlay");
  67.     AutoTargetWnd = GetWindowHandle("AutomaticPlay.AutoTargetWnd");
  68.     AutoTargetTitle_text = GetTextBoxHandle("AutomaticPlay.AutoTargetWnd.AutoTargetTitle_text");
  69.     AutoTargetAllON_ToggleEffect_Anim = GetAnimTextureHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win.ToggleEffect_Anim");
  70.     AutoTargetAllON_Win = GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win");
  71.     TargetSwap_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetSwap_BTN");
  72.     TargetPickupToggle_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetPickupToggle_BTN");
  73.     TargetMannerToggle_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.TargetMannerToggle_BTN");
  74.     AutoTargetAllOFF_Win = GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win");
  75.     AutoTargetAll_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAll_BTN");
  76.     Combat_BTN = GetButtonHandle("AutomaticPlay.AutoTargetWnd.Combat_BTN");
  77.     setCombatTooltip();
  78.     Autotarget_updateCombatButton();
  79.     YetiQuickSlotwndScript = YetiQuickSlotWnd(GetScript("YetiQuickSlotwnd"));
  80.     bypass_combat = SettingSectorStr("bypass", "autoplay_FixedCombatZone");
  81.     bypass_moving = SettingSectorStr("bypass", "autoplay_StopIfMoving");
  82.     bypass_showrange = SettingSectorStr("bypass", "autoplay_ShowRange");
  83.     bypass_targetboss = SettingSectorStr("bypass", "autoplay_TargetRaidBoss");
  84.     bypass_townmode = SettingSectorStr("bypass", "autoplay_TownMode");
  85.     NextTargetDistanceOptionBtn = GetButtonHandle("AutomaticPlay.NextTargetDistanceOptionBtn");
  86.     FixedCombatZoneBtn = GetButtonHandle("AutomaticPlay.FixedCombatZoneBtn");
  87.     StopIfMovingBtn = GetButtonHandle("AutomaticPlay.StopIfMovingBtn");
  88.     ShowTargetRangeBtn = GetButtonHandle("AutomaticPlay.ShowTargetRangeBtn");
  89.     TargetRaidBossBtn = GetButtonHandle("AutomaticPlay.TargetRaidBossBtn");
  90.     TownModeBtn = GetButtonHandle("AutomaticPlay.TownModeBtn");
  91.     bFixCombatZone = GetOptionInt("AutoPlay", "FixedCombatZoneBtn");
  92.     bStopIfMoving = GetOptionInt("AutoPlay", "StopIfMovingBtn");
  93.     bShowRange = GetOptionInt("AutoPlay", "ShowTargetRangeBtn");
  94.     bTargetRaidBoss = GetOptionInt("AutoPlay", "TargetRaidBossBtn");
  95.     bTownMode = GetOptionInt("AutoPlay", "TownModeBtn");
  96.     return;
  97. }
  98.  
  99. function RequestBypassLogic(string btnName, optional bool preload)
  100. {
  101.     local string and;
  102.  
  103.    
  104.     if(btnName == "NextTargetDistanceOptionBtn")
  105.     {
  106.        
  107.         if(isShow("ApplyDistanceWnd"))
  108.         {
  109.             HideW("ApplyDistanceWnd");            
  110.         }
  111.         else
  112.         {
  113.             ShowW("ApplyDistanceWnd");
  114.             FocusW("ApplyDistanceWnd");
  115.         }        
  116.     }
  117.     else
  118.     {
  119.        
  120.         if(btnName == "FixedCombatZoneBtn")
  121.         {
  122.            
  123.             if(!preload)
  124.             {
  125.                
  126.                 if(bFixCombatZone == 1)
  127.                 {
  128.                     bFixCombatZone = 0;                    
  129.                 }
  130.                 else
  131.                 {
  132.                     bFixCombatZone = 1;
  133.                 }
  134.             }
  135.             RequestBypassToServer(bypass_combat $ string(bFixCombatZone));
  136.             Say(bypass_combat $ string(bFixCombatZone));
  137.             SetOptionInt("AutoPlay", "FixedCombatZoneBtn", bFixCombatZone);
  138.             TwoLineTooltip("Fixed Combat Zone - On", "Fixed Combat Zone - Off", FixedCombatZoneBtn, bFixCombatZone);
  139.            
  140.             if(bFixCombatZone == 1)
  141.             {
  142.                 and = "ON";                
  143.             }
  144.             else
  145.             {
  146.                 and = "OFF";
  147.             }
  148.             FixedCombatZoneBtn.SetTexture("L2UI_CT9.FixedBTN_ShotD_Normal" $ and, "L2UI_CT9.FixedBTN_ShotD_Normal" $ and, "L2UI_CT9.FixedBTN_ShotD_OverON" $ and);            
  149.         }
  150.         else
  151.         {
  152.            
  153.             if(btnName == "StopIfMovingBtn")
  154.             {
  155.                
  156.                 if(!preload)
  157.                 {
  158.                    
  159.                     if(bStopIfMoving == 1)
  160.                     {
  161.                         bStopIfMoving = 0;                        
  162.                     }
  163.                     else
  164.                     {
  165.                         bStopIfMoving = 1;
  166.                     }
  167.                 }
  168.                 RequestBypassToServer(bypass_moving $ string(bStopIfMoving));
  169.                 Say(bypass_moving $ string(bStopIfMoving));
  170.                 SetOptionInt("AutoPlay", "StopIfMovingBtn", bStopIfMoving);
  171.                 TwoLineTooltip("Stop Farming if Moving - On", "Stop Farming if Moving - Off", StopIfMovingBtn, bStopIfMoving);
  172.                
  173.                 if(bStopIfMoving == 1)
  174.                 {
  175.                     and = "ON";                    
  176.                 }
  177.                 else
  178.                 {
  179.                     and = "OFF";
  180.                 }
  181.                 StopIfMovingBtn.SetTexture("L2UI_CT9.MoveBTN_ShotD_Normal" $ and, "L2UI_CT9.MoveBTN_ShotD_Normal" $ and, "L2UI_CT9.MoveBTN_ShotD_Over" $ and);                
  182.             }
  183.             else
  184.             {
  185.                
  186.                 if(btnName == "ShowTargetRangeBtn")
  187.                 {
  188.                    
  189.                     if(!preload)
  190.                     {
  191.                        
  192.                         if(bShowRange == 1)
  193.                         {
  194.                             bShowRange = 0;                            
  195.                         }
  196.                         else
  197.                         {
  198.                             bShowRange = 1;
  199.                         }
  200.                     }
  201.                     RequestBypassToServer(bypass_showrange $ string(bShowRange));
  202.                     Say(bypass_showrange $ string(bShowRange));
  203.                     SetOptionInt("AutoPlay", "ShowTargetRangeBtn", bShowRange);
  204.                     TwoLineTooltip("Show Targetting Range - On", "Show Targetting Range - Off", ShowTargetRangeBtn, bShowRange);
  205.                    
  206.                     if(bShowRange == 1)
  207.                     {
  208.                         and = "ON";                        
  209.                     }
  210.                     else
  211.                     {
  212.                         and = "OFF";
  213.                     }
  214.                     ShowTargetRangeBtn.SetTexture("L2UI_CT9.ZoneBTN_ShotD_Normal" $ and, "L2UI_CT9.ZoneBTN_ShotD_Normal" $ and, "L2UI_CT9.ZoneBTN_ShotD_Over" $ and);                    
  215.                 }
  216.                 else
  217.                 {
  218.                    
  219.                     if(btnName == "TownModeBtn")
  220.                     {
  221.                        
  222.                         if(!preload)
  223.                         {
  224.                            
  225.                             if(bTownMode == 1)
  226.                             {
  227.                                 bTownMode = 0;                                
  228.                             }
  229.                             else
  230.                             {
  231.                                 bTownMode = 1;
  232.                             }
  233.                         }
  234.                         RequestBypassToServer(bypass_townmode $ string(bTownMode));
  235.                         Say(bypass_townmode $ string(bTownMode));
  236.                         SetOptionInt("AutoPlay", "TownModeBtn", bTownMode);
  237.                         TwoLineTooltip("Town Mode - On", "Town Mode - Off", TownModeBtn, bTownMode);
  238.                        
  239.                         if(bTownMode == 1)
  240.                         {
  241.                             and = "ON";                            
  242.                         }
  243.                         else
  244.                         {
  245.                             and = "OFF";
  246.                         }
  247.                         TownModeBtn.SetTexture("L2UI_CT9.TownBTN_ShotD_Normal" $ and, "L2UI_CT9.TownBTN_ShotD_Normal" $ and, "L2UI_CT9.TownBTN_ShotD_Over" $ and);                        
  248.                     }
  249.                     else
  250.                     {
  251.                        
  252.                         if(btnName == "TargetRaidBossBtn")
  253.                         {
  254.                            
  255.                             if(!preload)
  256.                             {
  257.                                
  258.                                 if(bTargetRaidBoss == 1)
  259.                                 {
  260.                                     bTargetRaidBoss = 0;                                    
  261.                                 }
  262.                                 else
  263.                                 {
  264.                                     bTargetRaidBoss = 1;
  265.                                 }
  266.                             }
  267.                             RequestBypassToServer(bypass_targetboss $ string(bTargetRaidBoss));
  268.                             Say(bypass_targetboss $ string(bTargetRaidBoss));
  269.                             SetOptionInt("AutoPlay", "TargetRaidBossBtn", bTargetRaidBoss);
  270.                             TwoLineTooltip("Target Raid Boss - On", "Target Raid Boss - Off", TargetRaidBossBtn, bTargetRaidBoss);
  271.                            
  272.                             if(bTargetRaidBoss == 1)
  273.                             {
  274.                                 and = "ON2";                                
  275.                             }
  276.                             else
  277.                             {
  278.                                 and = "OFF2";
  279.                             }
  280.                             TargetRaidBossBtn.SetTexture("L2UI_CT9.RaidsBTN_ShotD_Normal" $ and, "L2UI_CT9.RaidsBTN_ShotD_Normal" $ and, "L2UI_CT9.RaidsBTN_ShotD_Over" $ and);
  281.                         }
  282.                     }
  283.                 }
  284.             }
  285.         }
  286.     }
  287.     return;
  288. }
  289.  
  290. function TwoLineTooltip(string text1, string text2, ButtonHandle Handle, int _true)
  291. {
  292.     local Color b0, b1;
  293.     local array<DrawItemInfo> drawListArr;
  294.  
  295.     b0 = getInstanceL2Util().Gray;
  296.     b1 = getInstanceL2Util().Gray;
  297.    
  298.     if(_true == 1)
  299.     {
  300.         b0 = getInstanceL2Util().Yellow;        
  301.     }
  302.     else
  303.     {
  304.         b1 = getInstanceL2Util().Yellow;
  305.     }
  306.     drawListArr[drawListArr.Length] = addDrawItemText(text1, b0, "", true, true);
  307.     drawListArr[drawListArr.Length] = addDrawItemText(text2, b1, "", true, true);
  308.     Handle.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  309.     return;
  310. }
  311.  
  312. function OnShow()
  313. {
  314.    
  315.     if(getInstanceUIData().getIsLiveServer())
  316.     {
  317.         Me.HideWindow();
  318.         return;
  319.     }
  320.     OptionIniLoad();
  321.     updateElements();
  322.     return;
  323. }
  324.  
  325. function updateElements()
  326. {
  327.     Autotarget_UpdateAutoTargetState();
  328.     Autotarget_NextTargetSetCusomTooltip();
  329.     Autotarget_updateNextTargetButton();
  330.     Autotarget_updatePickupButton();
  331.     Autotarget_PickupSetCusomTooltip();
  332.     Autotarget_updateMannerModeButton();
  333.     Autotarget_MannerModeSetCusomTooltip();
  334.     return;
  335. }
  336.  
  337. function OnEvent(int Event_ID, string param)
  338. {
  339.    
  340.     if(getInstanceUIData().getIsLiveServer())
  341.     {
  342.         return;
  343.     }
  344.     switch(Event_ID)
  345.     {
  346.        
  347.         case 9750:
  348.             initAll();
  349.            
  350.             break;
  351.        
  352.         case 40:
  353.             bActivateAll = false;
  354.             nCombatOnOff = 0;
  355.             bLoadByStart = false;
  356.             setCombatTooltip();
  357.             Autotarget_updateCombatButton();
  358.             Autotarget_Init();
  359.            
  360.             break;
  361.        
  362.         case 11170:
  363.             Debug("EV_AutoplaySetting" @ param);
  364.             AutoplaySettingHandler(param);
  365.            
  366.             if(!bLoadByStart)
  367.             {
  368.                 RequestBypassLogic("FixedCombatZoneBtn", true);
  369.                 RequestBypassLogic("StopIfMovingBtn", true);
  370.                 RequestBypassLogic("ShowTargetRangeBtn", true);
  371.                 RequestBypassLogic("TargetRaidBossBtn", true);
  372.                 RequestBypassLogic("TownModeBtn", true);
  373.                 bLoadByStart = true;
  374.             }
  375.            
  376.             break;
  377.        
  378.         case 11030:
  379.        
  380.         case 5720:
  381.             NextTargetModeHandler();
  382.            
  383.             break;
  384.        
  385.         case 11152:
  386.            
  387.             if(autotarget_bUseAutoTarget)
  388.             {
  389.                 requestAutoPlay(false);
  390.             }
  391.            
  392.             break;
  393.        
  394.         case 11280:
  395.             ParseInt(param, "OnOff", nCombatOnOff);
  396.             setCombatTooltip();
  397.             Autotarget_updateCombatButton();
  398.            
  399.             break;
  400.        
  401.         default:
  402.             break;
  403.     }
  404.     return;
  405. }
  406.  
  407. function setCombatTooltip()
  408. {
  409.     local array<DrawItemInfo> drawListArr;
  410.  
  411.    
  412.     if(nCombatOnOff > 0)
  413.     {
  414.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13263), getInstanceL2Util().PKNameColor, "", true, true);
  415.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13264), getInstanceL2Util().White, "", true, true);        
  416.     }
  417.     else
  418.     {
  419.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13263), getInstanceL2Util().White, "", true, true);
  420.         drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13264), getInstanceL2Util().PKNameColor, "", true, true);
  421.     }
  422.     Combat_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  423.     return;
  424. }
  425.  
  426. function initAll()
  427. {
  428.     Me.ShowWindow();
  429.     bActivateAll = false;
  430.     YetiQuickSlotwndScript.setPlayAutoTargetActiveAnim();
  431.     return;
  432. }
  433.  
  434. function NextTargetModeHandler()
  435. {
  436.     local NWindow.UIEventManager.EAutoNextTargetMode nTargetMode;
  437.  
  438.     nTargetMode = GetNextTargetModeOption();
  439.    
  440.     if(int(autotarget_nTargetMode) != int(nTargetMode))
  441.     {
  442.        
  443.         if(autotarget_bUseAutoTarget)
  444.         {
  445.             requestAutoPlay(autotarget_bUseAutoTarget);
  446.         }
  447.     }
  448.     return;
  449. }
  450.  
  451. function AutoplaySettingHandler(string param)
  452. {
  453.     local int nIsAutoPlayOn, nNextTargetMode, nIsNearTargetMode, nIsPickupOn, nHPPotionPercent, nIsMannerModeOn,
  454.         nHPPetPotionPercent;
  455.  
  456.     ParseInt(param, "IsPickupOn", nIsPickupOn);
  457.     ParseInt(param, "IsAutoPlayOn", nIsAutoPlayOn);
  458.     ParseInt(param, "NextTargetMode", nNextTargetMode);
  459.     ParseInt(param, "IsNearTargetMode", nIsNearTargetMode);
  460.     ParseInt(param, "HPPotionPercent", nHPPotionPercent);
  461.     ParseInt(param, "HPPetPotionPercent", nHPPetPotionPercent);
  462.     ParseInt(param, "IsMannerModeOn", nIsMannerModeOn);
  463.     autotarget_bUseAutoTarget = numToBool(nIsAutoPlayOn);
  464.     autotarget_bShortTarget = numToBool(nIsNearTargetMode);
  465.     autotarget_bIsPickupOn = numToBool(nIsPickupOn);
  466.     autotarget_bIsMannerModeOn = numToBool(nIsMannerModeOn);
  467.     autotarget_nHPPotionPercent = nHPPotionPercent;
  468.     autotarget_nHPPetPotionPercent = nHPPetPotionPercent;
  469.     updateElements();
  470.    
  471.     if(nIsAutoPlayOn > 0)
  472.     {
  473.         CallGFxFunction("ExpBar", "AutoCamera_State", "state=OnAutoPlay");        
  474.     }
  475.     else
  476.     {
  477.         CallGFxFunction("ExpBar", "AutoCamera_State", "state=OffAutoPlay");
  478.     }
  479.     return;
  480. }
  481.  
  482. function bool getActivateAll()
  483. {
  484.     return bActivateAll;
  485.     return;
  486. }
  487.  
  488. function OnClickButton(string Name)
  489. {
  490.     switch(Name)
  491.     {
  492.        
  493.         case "AutoAll_BTN":
  494.             Debug("--- Api call : RequestAutomaticUseItemActivateAll, " @ string(!bActivateAll));
  495.             class'ShortcutWndAPI'.static.RequestAutomaticUseItemActivateAll(!bActivateAll);
  496.            
  497.             break;
  498.        
  499.         case "TargetSwap_BTN":
  500.             Autotarget_OnSwap_Target_BTNClick();
  501.             requestAutoPlay(autotarget_bUseAutoTarget);
  502.            
  503.             break;
  504.        
  505.         case "TargetPickupToggle_BTN":
  506.             Autotarget_TargetPickupToggle_BTNClick();
  507.             requestAutoPlay(autotarget_bUseAutoTarget);
  508.            
  509.             break;
  510.        
  511.         case "TargetMannerToggle_BTN":
  512.             Autotarget_TargetMannerToggle_BTNClick();
  513.             requestAutoPlay(autotarget_bUseAutoTarget);
  514.            
  515.             break;
  516.        
  517.         case "AutoTargetAll_BTN":
  518.             requestAutoPlay(!autotarget_bUseAutoTarget);
  519.            
  520.             break;
  521.        
  522.         case "Combat_BTN":
  523.             ExecuteCommand("/combatmode");
  524.            
  525.             break;
  526.        
  527.         case "NextTargetDistanceOptionBtn":
  528.        
  529.         case "FixedCombatZoneBtn":
  530.        
  531.         case "StopIfMovingBtn":
  532.        
  533.         case "ShowTargetRangeBtn":
  534.        
  535.         case "TargetRaidBossBtn":
  536.        
  537.         case "TownModeBtn":
  538.             RequestBypassLogic(Name);
  539.            
  540.             break;
  541.        
  542.         default:
  543.             break;
  544.     }
  545.     return;
  546. }
  547.  
  548. function OnRButtonDown(WindowHandle a_WindowHandle, int X, int Y)
  549. {
  550.    
  551.     if("AutoAll_BTN" == a_WindowHandle.GetWindowName())
  552.     {
  553.         OnClickButton(a_WindowHandle.GetWindowName());
  554.     }
  555.     return;
  556. }
  557.  
  558. function OptionIniLoad()
  559. {
  560.     local int nLongTarget, nIsPickupOn, nIsMannerModeOn;
  561.  
  562.     GetINIBool("AutomaticPlay", "a", nLongTarget, "windowsInfo.ini");
  563.     GetINIBool("AutomaticPlay", "e", nIsPickupOn, "windowsInfo.ini");
  564.     GetINIBool("AutomaticPlay", "p", nIsMannerModeOn, "windowsInfo.ini");
  565.     autotarget_bIsPickupOn = numToBool(nIsPickupOn);
  566.     autotarget_bShortTarget = !numToBool(nLongTarget);
  567.     autotarget_bIsMannerModeOn = numToBool(nIsMannerModeOn);
  568.     return;
  569. }
  570.  
  571. function Autotarget_Init()
  572. {
  573.     autotarget_bUseAutoTarget = false;
  574.     return;
  575. }
  576.  
  577. function executeTarget()
  578. {
  579.    
  580.     if(autotarget_bShortTarget)
  581.     {
  582.         ExecuteCommand("/targetnext");
  583.         Debug("/targetnext");        
  584.     }
  585.     else
  586.     {
  587.         ExecuteCommand("/targetnext2");
  588.         Debug("/targetnext2");
  589.     }
  590.     return;
  591. }
  592.  
  593. function setShortcutTooltip(string tooltipStr)
  594. {
  595.     AutoTargetAll_BTN.SetTooltipCustomType(MakeTooltipMultiText(GetSystemString(2165), getInstanceL2Util().White,, true, tooltipStr, getInstanceL2Util().BWhite,, true));
  596.     return;
  597. }
  598.  
  599. function Autotarget_NextTargetSetCusomTooltip()
  600. {
  601.     local Color b0, b1;
  602.     local array<DrawItemInfo> drawListArr;
  603.  
  604.     b0 = getInstanceL2Util().Gray;
  605.     b1 = getInstanceL2Util().Gray;
  606.    
  607.     if(autotarget_bShortTarget)
  608.     {
  609.         b0 = getInstanceL2Util().Yellow;        
  610.     }
  611.     else
  612.     {
  613.         b1 = getInstanceL2Util().Yellow;
  614.     }
  615.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3956), b0, "", true, true);
  616.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3957), b1, "", true, true);
  617.     TargetSwap_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  618.     return;
  619. }
  620.  
  621. function Autotarget_PickupSetCusomTooltip()
  622. {
  623.     local Color b0, b1;
  624.     local array<DrawItemInfo> drawListArr;
  625.  
  626.     b0 = getInstanceL2Util().Gray;
  627.     b1 = getInstanceL2Util().Gray;
  628.     TargetPickupToggle_BTN.ClearTooltip();
  629.     TargetPickupToggle_BTN.SetTooltipType("text");
  630.    
  631.     if(autotarget_bIsPickupOn)
  632.     {
  633.         b0 = getInstanceL2Util().Yellow;        
  634.     }
  635.     else
  636.     {
  637.         b1 = getInstanceL2Util().Yellow;
  638.     }
  639.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3993), b0, "", true, true);
  640.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3992), b1, "", true, true);
  641.     TargetPickupToggle_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  642.     return;
  643. }
  644.  
  645. function Autotarget_MannerModeSetCusomTooltip()
  646. {
  647.     local Color b0, b1;
  648.     local array<DrawItemInfo> drawListArr;
  649.  
  650.     b0 = getInstanceL2Util().Gray;
  651.     b1 = getInstanceL2Util().Gray;
  652.     TargetMannerToggle_BTN.ClearTooltip();
  653.     TargetMannerToggle_BTN.SetTooltipType("text");
  654.    
  655.     if(autotarget_bIsMannerModeOn)
  656.     {
  657.         b0 = getInstanceL2Util().Yellow;        
  658.     }
  659.     else
  660.     {
  661.         b1 = getInstanceL2Util().Yellow;
  662.     }
  663.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13080), b0, "", true, true);
  664.     drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(13081), b1, "", true, true);
  665.     TargetMannerToggle_BTN.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
  666.     return;
  667. }
  668.  
  669. function OnRButtonUp(WindowHandle a_WindowHandle, int X, int Y)
  670. {
  671.     switch(a_WindowHandle.GetWindowName())
  672.     {
  673.        
  674.         case "AutoTargetAll_BTN":
  675.        
  676.         case "MacroShortcutItem":
  677.             requestAutoPlay(!autotarget_bUseAutoTarget);
  678.            
  679.             break;
  680.        
  681.         default:
  682.             break;
  683.     }
  684.     return;
  685. }
  686.  
  687. function bool getUseAutoTarget()
  688. {
  689.     return autotarget_bUseAutoTarget;
  690.     return;
  691. }
  692.  
  693. function Autotarget_OnSwap_Target_BTNClick()
  694. {
  695.     autotarget_bShortTarget = !autotarget_bShortTarget;
  696.     SetINIBool("AutomaticPlay", "a", !autotarget_bShortTarget, "windowsInfo.ini");
  697.    
  698.     if(autotarget_bShortTarget)
  699.     {
  700.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3956));        
  701.     }
  702.     else
  703.     {
  704.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3957));
  705.     }
  706.     Autotarget_NextTargetSetCusomTooltip();
  707.     Autotarget_updateNextTargetButton();
  708.     return;
  709. }
  710.  
  711. function Autotarget_TargetMannerToggle_BTNClick()
  712. {
  713.     autotarget_bIsMannerModeOn = !autotarget_bIsMannerModeOn;
  714.     SetINIBool("AutomaticPlay", "p", autotarget_bIsMannerModeOn, "windowsInfo.ini");
  715.    
  716.     if(autotarget_bIsMannerModeOn)
  717.     {
  718.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(13080));        
  719.     }
  720.     else
  721.     {
  722.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(13081));
  723.     }
  724.     Autotarget_updateMannerModeButton();
  725.     Autotarget_MannerModeSetCusomTooltip();
  726.     return;
  727. }
  728.  
  729. function Autotarget_TargetPickupToggle_BTNClick()
  730. {
  731.     autotarget_bIsPickupOn = !autotarget_bIsPickupOn;
  732.     SetINIBool("AutomaticPlay", "e", autotarget_bIsPickupOn, "windowsInfo.ini");
  733.    
  734.     if(autotarget_bIsPickupOn)
  735.     {
  736.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3993));        
  737.     }
  738.     else
  739.     {
  740.         getInstanceL2Util().showGfxScreenMessage(GetSystemString(3992));
  741.     }
  742.     Autotarget_updatePickupButton();
  743.     Autotarget_PickupSetCusomTooltip();
  744.     return;
  745. }
  746.  
  747. function Autotarget_updateNextTargetButton()
  748. {
  749.    
  750.     if(autotarget_bShortTarget)
  751.     {
  752.         TargetSwap_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_ShotD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_ShotD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_ShotD_Over");        
  753.     }
  754.     else
  755.     {
  756.         TargetSwap_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.TargetBTN_LongD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_LongD_Normal", "L2UI_NewTex.AutomaticPlay.TargetBTN_LongD_Over");
  757.     }
  758.     return;
  759. }
  760.  
  761. function Autotarget_updatePickupButton()
  762. {
  763.    
  764.     if(autotarget_bIsPickupOn)
  765.     {
  766.         TargetPickupToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.GetBTNON_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNON_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNON_Over");        
  767.     }
  768.     else
  769.     {
  770.         TargetPickupToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.GetBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.GetBTNOff_Over");
  771.     }
  772.     return;
  773. }
  774.  
  775. function Autotarget_updateMannerModeButton()
  776. {
  777.    
  778.     if(autotarget_bIsMannerModeOn)
  779.     {
  780.         TargetMannerToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.MannerBTNON_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNON_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNON_over");        
  781.     }
  782.     else
  783.     {
  784.         TargetMannerToggle_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.MannerBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.MannerBTNOff_over");
  785.     }
  786.     return;
  787. }
  788.  
  789. function Autotarget_updateCombatButton()
  790. {
  791.    
  792.     if(nCombatOnOff > 0)
  793.     {
  794.         Combat_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.CombatBTNON_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNON_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNON_Over");        
  795.     }
  796.     else
  797.     {
  798.         Combat_BTN.SetTexture("L2UI_NewTex.AutomaticPlay.CombatBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNOff_Normal", "L2UI_NewTex.AutomaticPlay.CombatBTNOff_Over");
  799.     }
  800.     return;
  801. }
  802.  
  803. function Autotarget_UpdateAutoTargetState()
  804. {
  805.    
  806.     if(autotarget_bUseAutoTarget)
  807.     {
  808.         AnimTexturePlay(AutoTargetAllON_ToggleEffect_Anim, true);
  809.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win").ShowWindow();
  810.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win").HideWindow();        
  811.     }
  812.     else
  813.     {
  814.         AnimTextureStop(AutoTargetAllON_ToggleEffect_Anim, true);
  815.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllON_Win").HideWindow();
  816.         GetWindowHandle("AutomaticPlay.AutoTargetWnd.AutoTargetAllOFF_Win").ShowWindow();
  817.     }
  818.     YetiQuickSlotwndScript.setPlayAutoTargetActiveAnim();
  819.     return;
  820. }
  821.  
  822. function requestAutoPlay(bool bUseAutoTarget, optional int nHPPotionPercent, optional int nHPPetPotionPercent)
  823. {
  824.     local AutoplaySettingData pAutoplaySettingData;
  825.  
  826.     autotarget_nTargetMode = GetNextTargetModeOption();
  827.     pAutoplaySettingData.IsAutoPlayOn = bUseAutoTarget;
  828.     pAutoplaySettingData.IsPickupOn = autotarget_bIsPickupOn;
  829.     pAutoplaySettingData.NextTargetMode = autotarget_nTargetMode;
  830.     pAutoplaySettingData.IsNearTargetMode = autotarget_bShortTarget;
  831.     pAutoplaySettingData.IsMannerModeOn = autotarget_bIsMannerModeOn;
  832.    
  833.     if(nHPPotionPercent > 0)
  834.     {
  835.         pAutoplaySettingData.HPPotionPercent = nHPPotionPercent;        
  836.     }
  837.     else
  838.     {
  839.         pAutoplaySettingData.HPPotionPercent = autotarget_nHPPotionPercent;
  840.     }
  841.    
  842.     if(nHPPetPotionPercent > 0)
  843.     {
  844.         pAutoplaySettingData.HPPetPotionPercent = nHPPetPotionPercent;        
  845.     }
  846.     else
  847.     {
  848.         pAutoplaySettingData.HPPetPotionPercent = autotarget_nHPPetPotionPercent;
  849.     }
  850.     UpdateAutoplaySetting(pAutoplaySettingData);
  851.     return;
  852. }
  853.  
  854. function requestAutoPlayForAutoPotion(int nHPPotionPercent)
  855. {
  856.     requestAutoPlay(autotarget_bUseAutoTarget, nHPPotionPercent);
  857.     return;
  858. }
  859.  
  860. function requestAutoPlayForAutoPotionPet(int nHPPetPotionPercent)
  861. {
  862.     requestAutoPlay(autotarget_bUseAutoTarget, autotarget_nHPPotionPercent, nHPPetPotionPercent);
  863.     return;
  864. }
  865.  
  866. function requestAutoPlayForAutoPotionWithPet(int nHPPotionPercent, int nHPPetPotionPercent)
  867. {
  868.     requestAutoPlay(autotarget_bUseAutoTarget, nHPPotionPercent, nHPPetPotionPercent);
  869.     return;
  870. }
  871.  
  872. function showHideForYeti(bool bShow)
  873. {
  874.    
  875.     if(bShow)
  876.     {
  877.         Me.ShowWindow();        
  878.     }
  879.     else
  880.     {
  881.         Me.HideWindow();
  882.     }
  883.     return;
  884. }
  885.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement