Advertisement
AlisaCodeDragon

ActionWnd

Apr 1st, 2023
1,647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ActionWnd extends UICommonAPI;
  2.  
  3. var bool m_bShow;
  4. var WindowHandle Me;
  5. var WindowHandle tabContainerWnd;
  6. var WindowHandle actionContainerWnd;
  7.  
  8. function InitControls()
  9. {
  10.     local string ownerFullPath;
  11.  
  12.     ownerFullPath = m_hOwnerWnd.m_WindowNameWithFullPath;
  13.     Me = GetWindowHandle(ownerFullPath);
  14.     tabContainerWnd = GetWindowHandle(ownerFullPath $ ".Tab_Wnd");
  15.     actionContainerWnd = GetWindowHandle(ownerFullPath $ ".ActionItem_Wnd");
  16.     return;
  17. }
  18.  
  19. function OnRegisterEvent()
  20. {
  21.     RegisterEvent(1311);
  22.     RegisterEvent(1300);
  23.     RegisterEvent(1310);
  24.     RegisterEvent(1900);
  25.     RegisterEvent(8000);
  26.     return;
  27. }
  28.  
  29. function OnLoad()
  30. {
  31.     SetClosingOnESC();
  32.    
  33.     if(1 == 0)
  34.     {
  35.         OnRegisterEvent();
  36.     }
  37.     m_bShow = false;
  38.     InitControls();
  39.     HideScrollBar();
  40.     return;
  41. }
  42.  
  43. function OnShow()
  44. {
  45.     class'ActionAPI'.static.RequestActionList();
  46.     m_bShow = true;
  47.    
  48.     if((IsUseRenewalSkillWnd()) == true)
  49.     {
  50.         Me.SetWindowTitle(GetSystemString(127));
  51.         tabContainerWnd.HideWindow();
  52.         actionContainerWnd.SetAnchor("ActionWnd", "TopLeft", "TopLeft", 0, 46);
  53.         Me.SetWindowSize(300, 584 - 140);        
  54.     }
  55.     else
  56.     {
  57.         Me.SetWindowTitle(GetSystemString(14230));
  58.         tabContainerWnd.ShowWindow();
  59.         actionContainerWnd.SetAnchor("ActionWnd", "TopLeft", "TopLeft", 0, 85);
  60.         GetWindowHandle("MagicSkillWnd").HideWindow();
  61.         getInstanceL2Util().syncWindowLoc(getCurrentWindowName(string(self)), "MagicSkillWnd");
  62.         GetWindowHandle("ActionWnd").SetFocus();
  63.     }
  64.     return;
  65. }
  66.  
  67. function OnHide()
  68. {
  69.     m_bShow = false;
  70.    
  71.     if((IsUseRenewalSkillWnd()) == false)
  72.     {
  73.         getInstanceL2Util().syncWindowLoc(getCurrentWindowName(string(self)), "MagicSkillWnd");
  74.     }
  75.     return;
  76. }
  77.  
  78. function OnEvent(int Event_ID, string param)
  79. {
  80.    
  81.     if(Event_ID == 1300)
  82.     {
  83.         HandleActionListStart();        
  84.     }
  85.     else
  86.     {
  87.        
  88.         if(Event_ID == 1310)
  89.         {
  90.             HandleActionList(param);            
  91.         }
  92.         else
  93.         {
  94.            
  95.             if(Event_ID == 1900)
  96.             {
  97.                 HandleLanguageChanged();                
  98.             }
  99.             else
  100.             {
  101.                
  102.                 if(Event_ID == 1311)
  103.                 {
  104.                     HandleActionListNew();                    
  105.                 }
  106.                 else
  107.                 {
  108.                    
  109.                     if(Event_ID == 8000)
  110.                     {
  111.                         checkClassicForm();
  112.                     }
  113.                 }
  114.             }
  115.         }
  116.     }
  117.     return;
  118. }
  119.  
  120. function checkClassicForm()
  121. {
  122.     local int containerPosY;
  123.     local WindowHandle Me;
  124.     local TextBoxHandle txtMark;
  125.     local TextureHandle SlotMark_01, SlotMark_02;
  126.     local ItemWindowHandle ActionMarkItem;
  127.     local TextBoxHandle txtSocial;
  128.     local TextureHandle SlotSocial_01, SlotSocial_02;
  129.     local ItemWindowHandle ActionSocialItem;
  130.  
  131.     containerPosY = 85;
  132.     txtSocial = GetTextBoxHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".txtSocial");
  133.     SlotSocial_01 = GetTextureHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".SlotSocial_01");
  134.     SlotSocial_02 = GetTextureHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".SlotSocial_02");
  135.     ActionSocialItem = GetItemWindowHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionSocialItem");
  136.     txtMark = GetTextBoxHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".txtMark");
  137.     SlotMark_01 = GetTextureHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".SlotMark_01");
  138.     SlotMark_02 = GetTextureHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".SlotMark_02");
  139.     ActionMarkItem = GetItemWindowHandle(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionMarkItem");
  140.    
  141.     if(IsAdenServer())
  142.     {
  143.         SlotMark_01.HideWindow();
  144.         SlotMark_02.HideWindow();
  145.         txtMark.HideWindow();
  146.         ActionMarkItem.HideWindow();
  147.         txtSocial.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 15, 353 - containerPosY);
  148.         SlotSocial_01.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 6, 371 - containerPosY);
  149.         SlotSocial_02.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 258, 371 - containerPosY);
  150.         ActionSocialItem.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 7, 371 - containerPosY);
  151.         Me.SetWindowSize(300, 575);        
  152.     }
  153.     else
  154.     {
  155.         SlotMark_01.ShowWindow();
  156.         SlotMark_02.ShowWindow();
  157.         txtMark.ShowWindow();
  158.         ActionMarkItem.ShowWindow();
  159.         txtSocial.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 15, 445 - containerPosY);
  160.         SlotSocial_01.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 6, 463 - containerPosY);
  161.         SlotSocial_02.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 258, 463 - containerPosY);
  162.         ActionSocialItem.SetAnchor(actionContainerWnd.m_WindowNameWithFullPath, "TopLeft", "TopLeft", 7, 463 - containerPosY);
  163.         Me.SetWindowSize(300, 575);
  164.     }
  165.     return;
  166. }
  167.  
  168. function OnClickButton(string Name)
  169. {
  170.     switch(Name)
  171.     {
  172.        
  173.         case "WindowHelp_BTN":
  174.             ExecuteEvent(1210, "6");
  175.            
  176.             break;
  177.        
  178.         case "SkillTap_Btn":
  179.             GetWindowHandle("MagicSkillWnd").ShowWindow();
  180.            
  181.             break;
  182.        
  183.         default:
  184.             break;
  185.     }
  186.     return;
  187. }
  188.  
  189. function OnClickItem(string strID, int Index)
  190. {
  191.     local ItemInfo infItem;
  192.  
  193.    
  194.     if((strID == "ActionBasicItem") && Index > -1)
  195.     {
  196.        
  197.         if(!class'UIAPI_ITEMWINDOW'.static.GetItem(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionBasicItem", Index, infItem))
  198.         {
  199.             return;
  200.         }
  201.         class'UIAPI_ITEMWINDOW'.static.SetItem(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionBasicItem", Index, infItem);        
  202.     }
  203.     else
  204.     {
  205.        
  206.         if((strID == "ActionPartyItem") && Index > -1)
  207.         {
  208.            
  209.             if(!class'UIAPI_ITEMWINDOW'.static.GetItem(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionPartyItem", Index, infItem))
  210.             {
  211.                 return;
  212.             }            
  213.         }
  214.         else
  215.         {
  216.            
  217.             if((strID == "ActionMarkItem") && Index > -1)
  218.             {
  219.                
  220.                 if(!class'UIAPI_ITEMWINDOW'.static.GetItem(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionMarkItem", Index, infItem))
  221.                 {
  222.                     return;
  223.                 }                
  224.             }
  225.             else
  226.             {
  227.                
  228.                 if((strID == "ActionSocialItem") && Index > -1)
  229.                 {
  230.                    
  231.                     if(!class'UIAPI_ITEMWINDOW'.static.GetItem(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionSocialItem", Index, infItem))
  232.                     {
  233.                         return;
  234.                     }
  235.                 }
  236.             }
  237.         }
  238.     }
  239.     DoAction(infItem.Id);
  240.     return;
  241. }
  242.  
  243. function HideScrollBar()
  244. {
  245.     class'UIAPI_ITEMWINDOW'.static.ShowScrollBar(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionBasicItem", false);
  246.     class'UIAPI_ITEMWINDOW'.static.ShowScrollBar(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionPartyItem", false);
  247.     class'UIAPI_ITEMWINDOW'.static.ShowScrollBar(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionMarkItem", false);
  248.     class'UIAPI_ITEMWINDOW'.static.ShowScrollBar(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionSocialItem", false);
  249.     return;
  250. }
  251.  
  252. function HandleLanguageChanged()
  253. {
  254.     class'ActionAPI'.static.RequestActionList();
  255.     return;
  256. }
  257.  
  258. function HandleActionListStart()
  259. {
  260.     Clear();
  261.     return;
  262. }
  263.  
  264. function Clear()
  265. {
  266.     class'UIAPI_ITEMWINDOW'.static.Clear(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionBasicItem");
  267.     class'UIAPI_ITEMWINDOW'.static.Clear(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionPartyItem");
  268.     class'UIAPI_ITEMWINDOW'.static.Clear(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionMarkItem");
  269.     class'UIAPI_ITEMWINDOW'.static.Clear(actionContainerWnd.m_WindowNameWithFullPath $ ".ActionSocialItem");
  270.     return;
  271. }
  272.  
  273. function HandleActionList(string param)
  274. {
  275.     local string wndname;
  276.     local int tmp;
  277.     local NWindow.UIEventManager.EActionCategory Type;
  278.     local string strActionName, strIconName, strIconNameEx1, strDescription, strCommand;
  279.  
  280.     local ItemInfo infItem;
  281.  
  282.     ParseItemID(param, infItem.Id);
  283.     ParseInt(param, "Type", tmp);
  284.     ParseString(param, "Name", strActionName);
  285.     ParseString(param, "IconName", strIconName);
  286.     ParseString(param, "IconNameEx1", strIconNameEx1);
  287.     ParseString(param, "Description", strDescription);
  288.     ParseString(param, "Command", strCommand);
  289.     infItem.Name = strActionName;
  290.     infItem.IconName = strIconName;
  291.     infItem.IconNameEx1 = strIconNameEx1;
  292.     infItem.Description = strDescription;
  293.     infItem.ShortcutType = int(3);
  294.     infItem.MacroCommand = strCommand;
  295.     Type = byte(tmp);
  296.    
  297.     if(int(Type) == int(1))
  298.     {
  299.         wndname = "ActionBasicItem";        
  300.     }
  301.     else
  302.     {
  303.        
  304.         if(int(Type) == int(2))
  305.         {
  306.             wndname = "ActionPartyItem";            
  307.         }
  308.         else
  309.         {
  310.            
  311.             if(int(Type) == int(3))
  312.             {
  313.                 wndname = "ActionMarkItem";                
  314.             }
  315.             else
  316.             {
  317.                
  318.                 if(int(Type) == int(4))
  319.                 {
  320.                     wndname = "ActionSocialItem";                    
  321.                 }
  322.                 else
  323.                 {
  324.                     return;
  325.                 }
  326.             }
  327.         }
  328.     }
  329.     class'UIAPI_ITEMWINDOW'.static.AddItem((actionContainerWnd.m_WindowNameWithFullPath $ ".") $ wndname, infItem);
  330.     return;
  331. }
  332.  
  333. function HandleActionListNew()
  334. {
  335.     class'ActionAPI'.static.RequestActionList();
  336.     return;
  337. }
  338.  
  339. function OnReceivedCloseUI()
  340. {
  341.     PlayConsoleSound(6);
  342.     GetWindowHandle("ActionWnd").HideWindow();
  343.     return;
  344. }
  345.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement