Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RefineryWnd extends UICommonAPI
- dependson(RefineryWndOption)
- dependson(RefineryWndOption)
- dependson(RefineryWndOption);
- const TWEENID_SLOT1 = 1;
- const TWEENID_SLOT2 = 2;
- const TIMEPROGRESS = 1000;
- const Adena = 57;
- const SHAKEID_ME = 101;
- const DWAFT_ID = 19673;
- const TIMEID_Confirm = 90;
- const TIME_Confirm = 500;
- enum type_State
- {
- stone,
- Target,
- READY,
- ing,
- Result
- };
- struct NewOptionResultInfo
- {
- var bool isConfirm;
- var int targetItemSId;
- var int newItemOption1;
- var int newItemOption2;
- };
- var WindowHandle Me;
- var string m_WindowName;
- var ItemInfo RefineItemInfo;
- var ItemInfo RefinerItemInfo;
- var ItemInfo GemstoneItemInfo;
- var ItemInfo RefinedITemInfo;
- var WindowHandle m_DragBox1;
- var WindowHandle m_DragBox2;
- var WindowHandle m_DragBoxResult;
- var WindowHandle m_ResultAnimation1;
- var WindowHandle m_ResultAnimation2;
- var WindowHandle m_ResultAnimation3;
- var WindowHandle m_ResultAnimation4;
- var AnimTextureHandle m_RefineAnim;
- var AnimTextureHandle m_ResultAnim1;
- var AnimTextureHandle m_ResultAnim2;
- var AnimTextureHandle m_ResultAnim3;
- var AnimTextureHandle m_ResultAnim4;
- var ButtonHandle m_RefineryBtn;
- var ButtonHandle btnReset;
- var ItemWindowHandle m_DragboxItem1;
- var ItemWindowHandle m_DragBoxItem2;
- var ItemWindowHandle m_ResultBoxItem;
- var TextBoxHandle m_InstructionText;
- var TextBoxHandle txtOptions;
- var TextureHandle optionGradeTexture;
- var ItemWindowHandle ItemList;
- var WindowHandle ItemListWindow;
- var CharacterViewportWindowHandle m_ObjectViewport;
- var array<UIControlNeedItem> UIControlNeedItemScripts;
- var ProgressCtrlHandle m_hRefineryWndRefineryProgress;
- var WindowHandle newOptionsWnd;
- var WindowHandle optionBlindWnd;
- var WindowHandle newOptionBlindWnd;
- var WindowHandle newDisableWnd;
- var ButtonHandle newOptionBtn;
- var ButtonHandle closeWndBtn;
- var TextBoxHandle newTxtOptions;
- var TextureHandle newOptionGradeTex;
- var TextureHandle preOptionCheckTex;
- var AnimTextureHandle newOptionApplyAnimTex;
- var RefineryWnd.type_State CurrentState;
- var L2UITween l2uiTweenScript;
- var L2UIInventoryObjectSimple iObject;
- var RefineryWndOption RefineryWndOptionScript;
- var NewOptionResultInfo newResultInfo;
- var bool bHideAndInventoryShow;
- function OnRegisterEvent()
- {
- RegisterEvent(100000 + class'UIPacket'.337);
- RegisterEvent(100000 + class'UIPacket'.340);
- RegisterEvent(100000 + class'UIPacket'.342);
- RegisterEvent(EV_PacketID(class'UIPacket'.1030));
- return;
- }
- function InitHandleListItems()
- {
- local int i;
- local string WindowName;
- i = 0;
- J0x07:
- if(i < 2)
- {
- WindowName = (m_WindowName $ ".NeedItem") $ string(i);
- GetWindowHandle(WindowName).SetScript("UIControlNeedItem");
- UIControlNeedItemScripts[i] = UIControlNeedItem(GetWindowHandle(WindowName).GetScript());
- UIControlNeedItemScripts[i].Init(WindowName);
- UIControlNeedItemScripts[i].__DelegateItemUpdate__Delegate = PeeItemUpdated;
- ++ i;
- goto J0x07;
- }
- return;
- }
- function InitHandleCOD()
- {
- m_WindowName = getCurrentWindowName(string(self));
- Me = GetWindowHandle(m_WindowName);
- InitHandleListItems();
- m_DragBox1 = GetWindowHandle(m_WindowName $ ".ItemDragBox1Wnd");
- m_DragBox2 = GetWindowHandle(m_WindowName $ ".ItemDragBox2Wnd");
- m_DragBoxResult = GetWindowHandle(m_WindowName $ ".ItemDragBoxResultWnd");
- m_ResultAnimation1 = GetWindowHandle(m_WindowName $ ".RefineResultAnimation01");
- m_ResultAnimation2 = GetWindowHandle(m_WindowName $ ".RefineResultAnimation02");
- m_ResultAnimation3 = GetWindowHandle(m_WindowName $ ".RefineResultAnimation03");
- m_ResultAnimation4 = GetWindowHandle(m_WindowName $ ".RefineResultAnimation04");
- m_RefineAnim = GetAnimTextureHandle(m_WindowName $ ".RefineLoadingAnimation.RefineLoadingAnim");
- m_ResultAnim1 = GetAnimTextureHandle(m_WindowName $ ".RefineResultAnimation01.RefineResult1");
- m_ResultAnim2 = GetAnimTextureHandle(m_WindowName $ ".RefineResultAnimation02.RefineResult2");
- m_ResultAnim3 = GetAnimTextureHandle(m_WindowName $ ".RefineResultAnimation03.RefineResult3");
- m_ResultAnim4 = GetAnimTextureHandle(m_WindowName $ ".RefineResultAnimation04.RefineResult4");
- m_DragboxItem1 = GetItemWindowHandle(m_WindowName $ ".ItemDragBox1Wnd.ItemDragBox");
- m_DragBoxItem2 = GetItemWindowHandle(m_WindowName $ ".ItemDragBox2Wnd.ItemDragBox");
- m_ResultBoxItem = GetItemWindowHandle(m_WindowName $ ".ItemDragBoxResultWnd.ItemRefined");
- btnReset = GetButtonHandle(m_WindowName $ ".btnReset");
- m_RefineryBtn = GetButtonHandle(m_WindowName $ ".btnRefine");
- m_InstructionText = GetTextBoxHandle(m_WindowName $ ".txtInstruction");
- ItemListWindow = GetWindowHandle(m_WindowName $ ".ItemListWindow");
- ItemList = GetItemWindowHandle(m_WindowName $ ".ItemListWindow.ItemList");
- l2uiTweenScript = L2UITween(GetScript("l2UITween"));
- RefineryWndOptionScript = RefineryWndOption(GetScript("RefineryWndOption"));
- m_hRefineryWndRefineryProgress = GetProgressCtrlHandle(m_WindowName $ ".RefineryProgress");
- txtOptions = GetTextBoxHandle(m_WindowName $ ".txtOptions");
- optionGradeTexture = GetTextureHandle(m_WindowName $ ".optionGradeTexture");
- m_ObjectViewport = GetCharacterViewportWindowHandle(m_WindowName $ ".ObjectViewport");
- m_ObjectViewport.SetUISound(true);
- m_RefineAnim.SetLoopCount(1);
- m_ResultAnim1.SetLoopCount(1);
- m_ResultAnim2.SetLoopCount(1);
- m_ResultAnim3.SetLoopCount(1);
- m_ResultAnim4.SetLoopCount(1);
- m_hRefineryWndRefineryProgress.SetProgressTime(1000 - 100);
- if(IsSupportedResultChoice())
- {
- newOptionsWnd = GetWindowHandle(m_WindowName $ ".NewOptions_wnd");
- optionBlindWnd = GetWindowHandle(m_WindowName $ ".OptionGradeBlind_wnd");
- newOptionBlindWnd = GetWindowHandle(newOptionsWnd.m_WindowNameWithFullPath $ ".NewOptionGradeBlind_wnd");
- newDisableWnd = GetWindowHandle(m_WindowName $ ".DisableWnd");
- newOptionBtn = GetButtonHandle(newOptionsWnd.m_WindowNameWithFullPath $ ".NewOption_btn");
- closeWndBtn = GetButtonHandle(m_WindowName $ ".exitbutton");
- newTxtOptions = GetTextBoxHandle(newOptionsWnd.m_WindowNameWithFullPath $ ".txtOptions");
- newOptionGradeTex = GetTextureHandle(newOptionsWnd.m_WindowNameWithFullPath $ ".NewOptionGradeTexture");
- newOptionApplyAnimTex = GetAnimTextureHandle(m_WindowName $ ".OptionRgstr_Ani");
- preOptionCheckTex = GetTextureHandle(m_WindowName $ ".CheckTexture");
- }
- return;
- }
- function OnLoad()
- {
- SetClosingOnESC();
- InitHandleCOD();
- return;
- }
- function OnEvent(int a_EventID, string a_Param)
- {
- switch(a_EventID)
- {
- case 100000 + class'UIPacket'.337:
- Decode_S_EX_SHOW_VARIATION_MAKE_WINDOW(a_Param);
- break;
- case 100000 + class'UIPacket'.340:
- Decode_S_EX_PUT_INTENSIVE_RESULT_FOR_VARIATION_MAKE(a_Param);
- break;
- case 100000 + class'UIPacket'.342:
- Decode_S_EX_VARIATION_RESULT(a_Param);
- break;
- case EV_PacketID(class'UIPacket'.1030):
- Rs_S_EX_APPLY_VARIATION_OPTION();
- break;
- default:
- break;
- }
- return;
- }
- function OnDropItem(string a_WindowID, ItemInfo a_itemInfo, int X, int Y)
- {
- if(a_itemInfo.ShortcutType == int(4))
- {
- return;
- }
- switch(a_itemInfo.DragSrcName)
- {
- case "ItemList":
- HandleOnDropItem(a_itemInfo);
- break;
- default:
- break;
- }
- return;
- }
- function OnRClickItem(string strID, int Index)
- {
- switch(strID)
- {
- case "ItemList":
- OnDBClickItem(strID, Index);
- break;
- default:
- break;
- }
- return;
- }
- function OnDBClickItem(string ControlName, int Index)
- {
- local ItemInfo iInfo;
- switch(ControlName)
- {
- case "ItemList":
- ItemList.GetItem(Index, iInfo);
- if(iInfo.Id.ClassID > 0)
- {
- HandleOnDropItem(iInfo);
- }
- break;
- default:
- break;
- }
- return;
- }
- function OnHide()
- {
- ResetAnims();
- RemObjectSimpleByObject(iObject);
- if(IsSupportedResultChoice())
- {
- if(DialogIsMine())
- {
- DialogHide();
- }
- PlayNewOptionApplyEffect(false);
- Rq_C_EX_VARIATION_CLOSE_UI();
- }
- return;
- }
- function OnShow()
- {
- bHideAndInventoryShow = false;
- Me.SetFocus();
- SetDwaft();
- SetState(0);
- getInstanceL2Util().ItemRelationWindowHide(getCurrentWindowName(string(self)));
- class'UIAPI_WINDOW'.static.HideWindow("PetWnd");
- iObject = AddItemListenerSimple(0);
- iObject.__DelegateOnUpdateItem__Delegate = HandleUpdateItemStone;
- if(IsSupportedResultChoice())
- {
- SetDialogModal(false);
- SetNewResultInfo(false, 0, 0, 0);
- PlayNewOptionApplyEffect(false);
- Rq_C_EX_VARIATION_OPEN_UI();
- }
- return;
- }
- function OnClickButton(string strID)
- {
- switch(strID)
- {
- case "btnRefine":
- HandleClickBtnRefine();
- break;
- case "btnClose":
- OnClickbtnClose();
- break;
- case "btnReset":
- if(IsSupportedResultChoice())
- {
- NewResultCheckAndReset();
- }
- else
- {
- SetState(0);
- }
- break;
- case "btnOptions":
- RefineryWndOptionScript.Toggle();
- break;
- case "NewOption_btn":
- OnNewOptionBtnClicked();
- break;
- case "exitbutton":
- NewResultCheckAndCloseWnd();
- break;
- default:
- break;
- }
- return;
- }
- function OnTimer(int TimerID)
- {
- switch(TimerID)
- {
- case 90:
- Me.KillTimer(90);
- if(int(CurrentState) == int(4))
- {
- if(IsSupportedResultChoice())
- {
- if(canBuy())
- {
- m_RefineryBtn.EnableWindow();
- }
- }
- else
- {
- m_RefineryBtn.EnableWindow();
- }
- }
- break;
- default:
- break;
- }
- return;
- }
- function OnTextureAnimEnd(AnimTextureHandle a_WindowHandle)
- {
- switch(a_WindowHandle)
- {
- case m_ResultAnim1:
- m_ResultAnimation1.HideWindow();
- break;
- case m_ResultAnim2:
- m_ResultAnimation2.HideWindow();
- break;
- case m_ResultAnim3:
- m_ResultAnimation3.HideWindow();
- break;
- case m_ResultAnim4:
- m_ResultAnimation4.HideWindow();
- break;
- case newOptionApplyAnimTex:
- newOptionApplyAnimTex.HideWindow();
- break;
- default:
- break;
- }
- return;
- }
- function OnProgressTimeUp(string strID)
- {
- switch(strID)
- {
- case "RefineryProgress":
- RequestRefine();
- break;
- default:
- break;
- }
- return;
- }
- function HandleOnDropItem(ItemInfo iInfo)
- {
- switch(CurrentState)
- {
- case 0:
- AddItemStone(iInfo);
- break;
- case 1:
- AddItemTarget(iInfo);
- break;
- default:
- break;
- }
- return;
- }
- function AddItemStone(ItemInfo iInfo)
- {
- PlaySound("ItemSound2.smelting.Smelting_dragin");
- iInfo.bShowCount = true;
- m_DragboxItem1.AddItem(iInfo);
- SetState(1);
- MakeTweenAlpha(m_DragBox1, 1);
- iObject.setId(iInfo.Id);
- return;
- }
- function AddItemTarget(ItemInfo iInfo)
- {
- PlaySound("ItemSound2.smelting.Smelting_dragin");
- m_DragBoxItem2.AddItem(iInfo);
- AddRefineryText();
- SetPeeItems();
- SetState(2);
- MakeTweenAlpha(m_DragBox2, 2);
- SetOptionList();
- SetNewResultInfo(false, 0, 0, 0);
- UpdateStateNewResult();
- return;
- }
- function SetPeeItems()
- {
- local ItemInfo itemInfoStone, itemInfoTarget;
- local int FeeItemID, FeeItemCount, CancelFee;
- local INT64 feeAdenaCount;
- if(!GetItemInfoStone(itemInfoStone))
- {
- return;
- }
- if(!GetItemInfoTarget(itemInfoTarget))
- {
- return;
- }
- API_GetRefineryFee(itemInfoStone.Id.ClassID, itemInfoTarget.Id.ClassID, FeeItemID, FeeItemCount, feeAdenaCount, CancelFee);
- if((FeeItemID == 0) || FeeItemCount == 0)
- {
- UIControlNeedItemScripts[0].setId(GetItemID(57));
- UIControlNeedItemScripts[0].SetNumNeed(feeAdenaCount);
- UIControlNeedItemScripts[1].Me.HideWindow();
- }
- else
- {
- UIControlNeedItemScripts[0].setId(GetItemID(FeeItemID));
- UIControlNeedItemScripts[0].SetNumNeed((FeeItemCount));
- UIControlNeedItemScripts[1].Me.ShowWindow();
- UIControlNeedItemScripts[1].setId(GetItemID(57));
- UIControlNeedItemScripts[1].SetNumNeed(feeAdenaCount);
- }
- return;
- }
- function SetStones()
- {
- local int i, Len;
- local array<ItemInfo> iInfos;
- ItemList.Clear();
- Len = API_GetTargetItemListFromInven(iInfos);
- i = 0;
- J0x27:
- if(i < Len)
- {
- ItemList.AddItem(iInfos[i]);
- ++ i;
- goto J0x27;
- }
- return;
- }
- function SetTargetItems()
- {
- local int i, Len;
- local array<ItemInfo> iInfos;
- local ItemInfo itemInfoStone;
- ItemList.Clear();
- if(!GetItemInfoStone(itemInfoStone))
- {
- return;
- }
- Len = API_GetItemListFromInven(itemInfoStone.Id.ClassID, iInfos);
- i = 0;
- J0x48:
- if(i < Len)
- {
- ItemList.AddItem(iInfos[i]);
- ++ i;
- goto J0x48;
- }
- return;
- }
- function int API_GetItemListFromInven(int stoneClassID, out array<ItemInfo> iItems)
- {
- return class'RefineryAPI'.static.GetItemListFromInven(stoneClassID, iItems);
- return;
- }
- function int API_GetTargetItemListFromInven(out array<ItemInfo> iItems)
- {
- return class'RefineryAPI'.static.GetTargetItemListFromInven(iItems);
- return;
- }
- function bool API_GetRefineryFee(int TargetItemClassID, int RefinerClassID, out int FeeItemID, out int FeeItemCount, out INT64 FeeAdena, out int CancelFee)
- {
- return class'RefineryAPI'.static.GetRefineryFee(TargetItemClassID, RefinerClassID, FeeItemID, FeeItemCount, FeeAdena, CancelFee);
- return;
- }
- function API_RequestRefine(ItemID TargetItemID, ItemID refineItemID, ItemID getstoneItemID, INT64 getsonteCount)
- {
- class'RefineryAPI'.static.RequestRefine(TargetItemID, refineItemID, getstoneItemID, getsonteCount);
- return;
- }
- function Rq_C_EX_VARIATION_OPEN_UI()
- {
- local array<byte> stream;
- local _C_EX_VARIATION_OPEN_UI packet;
- if(!IsSupportedResultChoice())
- {
- return;
- }
- if(!class'UIPacket'.static.Encode_C_EX_VARIATION_OPEN_UI(stream, packet))
- {
- return;
- }
- class'UIPacket'.static.RequestUIPacket(class'UIPacket'.790, stream);
- return;
- }
- function Rq_C_EX_VARIATION_CLOSE_UI()
- {
- local array<byte> stream;
- local _C_EX_VARIATION_CLOSE_UI packet;
- if(!IsSupportedResultChoice())
- {
- return;
- }
- if(!class'UIPacket'.static.Encode_C_EX_VARIATION_CLOSE_UI(stream, packet))
- {
- return;
- }
- class'UIPacket'.static.RequestUIPacket(class'UIPacket'.791, stream);
- return;
- }
- function Rq_C_EX_APPLY_VARIATION_OPTION(int variationItemSId, int itemOption1, int itemOption2)
- {
- local array<byte> stream;
- local _C_EX_APPLY_VARIATION_OPTION packet;
- if(!IsSupportedResultChoice())
- {
- return;
- }
- packet.nVariationItemSID = variationItemSId;
- packet.nItemOption1 = itemOption1;
- packet.nItemOption2 = itemOption2;
- if(!class'UIPacket'.static.Encode_C_EX_APPLY_VARIATION_OPTION(stream, packet))
- {
- return;
- }
- class'UIPacket'.static.RequestUIPacket(class'UIPacket'.792, stream);
- return;
- }
- function Decode_S_EX_SHOW_VARIATION_MAKE_WINDOW(string a_Param)
- {
- if(Me.IsShowWindow())
- {
- Me.HideWindow();
- }
- else
- {
- Me.ShowWindow();
- }
- return;
- }
- function Decode_S_EX_PUT_INTENSIVE_RESULT_FOR_VARIATION_MAKE(string a_Param)
- {
- local int targetItemServerID, TargetItemClassID, insertResult;
- class'UIPacket'.static.DecodeInt(targetItemServerID);
- class'UIPacket'.static.DecodeInt(TargetItemClassID);
- class'UIPacket'.static.DecodeInt(insertResult);
- Handle_S_EX_PUT_INTENSIVE_RESULT_FOR_VARIATION_MAKE(targetItemServerID, TargetItemClassID, insertResult);
- return;
- }
- function Decode_S_EX_VARIATION_RESULT(string a_Param)
- {
- local int Option1, Option2;
- local INT64 GemStoneCount, NecessaryGemStoneCount;
- local int RefineResult;
- class'UIPacket'.static.DecodeInt(Option1);
- class'UIPacket'.static.DecodeInt(Option2);
- class'UIPacket'.static.DecodeInt64(GemStoneCount);
- class'UIPacket'.static.DecodeInt64(NecessaryGemStoneCount);
- class'UIPacket'.static.DecodeInt(RefineResult);
- Handle_S_EX_VARIATION_RESULT(Option1, Option2, RefineResult);
- return;
- }
- function Handle_S_EX_PUT_INTENSIVE_RESULT_FOR_VARIATION_MAKE(int targetItemServerID, int TargetItemClassID, int insertResult)
- {
- local ItemInfo targetItem;
- class'UIDATA_INVENTORY'.static.FindItem(targetItemServerID, targetItem);
- AddItemStone(targetItem);
- return;
- }
- function Handle_S_EX_VARIATION_RESULT(int Option1, int Option2, int RefineResult)
- {
- local ItemInfo iInfo;
- switch(RefineResult)
- {
- case 1:
- SetState(4);
- if(GetItemInfoTarget(iInfo))
- {
- if(IsSupportedResultChoice())
- {
- SetNewResultInfo(false, iInfo.Id.ServerID, Option1, Option2);
- if((iInfo.RefineryOp1 == 0) && iInfo.RefineryOp1 == 0)
- {
- newOptionBtn.SetEnable(false);
- Rq_C_EX_APPLY_VARIATION_OPTION(iInfo.Id.ServerID, Option1, Option2);
- }
- else
- {
- UpdateStateNewResult();
- }
- }
- else
- {
- iInfo.RefineryOp1 = Option1;
- iInfo.RefineryOp2 = Option2;
- }
- m_ResultBoxItem.ShowWindow();
- m_ResultBoxItem.Clear();
- m_ResultBoxItem.AddItem(iInfo);
- m_DragBoxItem2.Clear();
- m_DragBoxItem2.AddItem(iInfo);
- AddRefineryText();
- }
- if(!IsSupportedResultChoice())
- {
- PlayResultQualityAnimation(GetOptionQuality(Option2));
- }
- break;
- case 0:
- SetHideWindow();
- break;
- default:
- break;
- }
- return;
- }
- function Rs_S_EX_APPLY_VARIATION_OPTION()
- {
- local _S_EX_APPLY_VARIATION_OPTION packet;
- local bool IsSuccess;
- local ItemInfo iInfo;
- local int Quality;
- if(!class'UIPacket'.static.Decode_S_EX_APPLY_VARIATION_OPTION(packet))
- {
- return;
- }
- IsSuccess = bool(packet.bResult);
- if(IsSuccess == true)
- {
- if(GetItemInfoTarget(iInfo))
- {
- SetNewResultInfo(true, packet.nVariationItemSID, 0, 0);
- iInfo.RefineryOp1 = packet.nItemOption1;
- iInfo.RefineryOp2 = packet.nItemOption2;
- m_ResultBoxItem.ShowWindow();
- m_ResultBoxItem.Clear();
- m_ResultBoxItem.AddItem(iInfo);
- m_DragBoxItem2.Clear();
- m_DragBoxItem2.AddItem(iInfo);
- UpdateStateNewResult();
- AddRefineryText();
- PlayNewOptionApplyEffect(true);
- PlayResultQualityAnimation(GetOptionQuality(packet.nItemOption2));
- getInstanceL2Util().showGfxScreenMessage(GetSystemMessage(13659));
- }
- }
- else
- {
- Debug("S_EX_APPLY_VARIATION_OPTION FAIL");
- }
- return;
- }
- function SetState(RefineryWnd.type_State State)
- {
- CurrentState = State;
- ResetAnims();
- switch(State)
- {
- case 0:
- SetStateStone();
- break;
- case 1:
- SetStateTarget();
- break;
- case 2:
- SetStateReady();
- break;
- case 3:
- SetStateIng();
- break;
- case 4:
- SetStateResult();
- break;
- default:
- break;
- }
- SetHighLightsEmpty();
- SetButtonSetting();
- SetInstructionText();
- return;
- }
- function SetStateStone()
- {
- SetStones();
- m_DragBoxResult.HideWindow();
- ItemListWindow.ShowWindow();
- m_DragboxItem1.Clear();
- iObject.setId();
- m_DragBoxItem2.Clear();
- m_DragBox1.ShowWindow();
- m_DragBox2.ShowWindow();
- ClearRefineryText();
- ClearNewRefineryText();
- SetNewResultInfo(false, 0, 0, 0);
- DelOptionList();
- return;
- }
- function SetStateTarget()
- {
- SetTargetItems();
- m_DragBoxResult.HideWindow();
- ItemListWindow.ShowWindow();
- m_DragBox1.ShowWindow();
- m_DragBox2.ShowWindow();
- DelOptionList();
- return;
- }
- function SetStateReady()
- {
- m_DragBoxResult.HideWindow();
- ItemListWindow.HideWindow();
- m_hRefineryWndRefineryProgress.Stop();
- m_hRefineryWndRefineryProgress.Reset();
- m_DragBox1.ShowWindow();
- m_DragBox2.ShowWindow();
- SetNewResultInfo(false, 0, 0, 0);
- UpdateStateNewResult();
- bHideAndInventoryShow = false;
- return;
- }
- function SetStateIng()
- {
- MakeProgressTween();
- m_DragBoxResult.HideWindow();
- ItemListWindow.HideWindow();
- m_RefineAnim.ShowWindow();
- m_RefineAnim.Stop();
- m_RefineAnim.Play();
- m_hRefineryWndRefineryProgress.Stop();
- m_hRefineryWndRefineryProgress.Reset();
- m_hRefineryWndRefineryProgress.Start();
- PlaySound("Itemsound2.smelting.smelting_loding");
- m_DragBox1.ShowWindow();
- m_DragBox2.ShowWindow();
- DwarfPlayAnimation();
- return;
- }
- function SetStateResult()
- {
- MakeShakeTween();
- m_DragBoxResult.ShowWindow();
- ItemListWindow.HideWindow();
- m_DragBox1.HideWindow();
- m_DragBox2.HideWindow();
- return;
- }
- function UpdateStateNewResult()
- {
- local string strDesc1, strDesc2, strDesc3, descAll;
- local int ColorR, ColorG, ColorB, Quality, RefineryOp1, RefineryOp2;
- local ItemInfo item;
- if(!IsSupportedResultChoice())
- {
- return;
- }
- if(!GetItemInfoTarget(item))
- {
- return;
- }
- RefineryOp1 = newResultInfo.newItemOption1;
- RefineryOp2 = newResultInfo.newItemOption2;
- descAll = "";
- if((RefineryOp1 != 0) || RefineryOp2 != 0)
- {
- if(RefineryOp2 != 0)
- {
- Quality = GetOptionQuality(RefineryOp2);
- SetNewQuality(Quality);
- ToolTip(GetScript("Tooltip")).GetRefineryColor(Quality, ColorR, ColorG, ColorB);
- }
- else
- {
- if(RefineryOp1 != 0)
- {
- Quality = GetOptionQuality(RefineryOp1);
- SetNewQuality(Quality);
- ToolTip(GetScript("Tooltip")).GetRefineryColor(Quality, ColorR, ColorG, ColorB);
- }
- }
- if(RefineryOp1 != 0)
- {
- strDesc1 = "";
- strDesc2 = "";
- strDesc3 = "";
- if(class'UIDATA_REFINERYOPTION'.static.GetOptionDescription(RefineryOp1, strDesc1, strDesc2, strDesc3))
- {
- AddDesc(strDesc1, descAll);
- AddDesc(strDesc2, descAll);
- AddDesc(strDesc3, descAll);
- }
- }
- if(RefineryOp2 != 0)
- {
- strDesc1 = "";
- strDesc2 = "";
- strDesc3 = "";
- if(class'UIDATA_REFINERYOPTION'.static.GetOptionDescription(RefineryOp2, strDesc1, strDesc2, strDesc3))
- {
- AddDesc(strDesc1, descAll);
- AddDesc(strDesc2, descAll);
- AddDesc(strDesc3, descAll);
- }
- }
- newTxtOptions.SetTextColor(GetColor(ColorR, ColorG, ColorB, 255));
- newTxtOptions.SetText(descAll);
- if(descAll != "")
- {
- newOptionGradeTex.ShowWindow();
- }
- newOptionBtn.SetEnable(true);
- newOptionBlindWnd.HideWindow();
- }
- else
- {
- newOptionBtn.SetEnable(false);
- newOptionBlindWnd.ShowWindow();
- ClearNewRefineryText();
- newOptionGradeTex.HideWindow();
- }
- return;
- }
- function PlayNewOptionApplyEffect(bool isPlay)
- {
- if(!IsSupportedResultChoice())
- {
- return;
- }
- if(isPlay)
- {
- newOptionApplyAnimTex.Stop();
- newOptionApplyAnimTex.SetLoopCount(1);
- newOptionApplyAnimTex.ShowWindow();
- newOptionApplyAnimTex.Play();
- }
- else
- {
- newOptionApplyAnimTex.Stop();
- newOptionApplyAnimTex.HideWindow();
- }
- return;
- }
- function SetDialogModal(bool isModal)
- {
- if(!IsSupportedResultChoice())
- {
- return;
- }
- if(isModal == true)
- {
- newDisableWnd.ShowWindow();
- }
- else
- {
- newDisableWnd.HideWindow();
- }
- return;
- }
- function SetNewResultInfo(bool confirmed, int itemSId, int newOption1, int newOption2)
- {
- newResultInfo.isConfirm = confirmed;
- newResultInfo.targetItemSId = itemSId;
- newResultInfo.newItemOption1 = newOption1;
- newResultInfo.newItemOption2 = newOption2;
- return;
- }
- function ShowResultChoiceDialog()
- {
- DialogShow(1, 0, GetSystemString(14060), string(self));
- class'DialogBox'.static.Inst().AnchorToOwner(0, 0);
- class'DialogBox'.static.Inst().__DelegateOnOK__Delegate = OnResultChoiceDialogConfirm;
- class'DialogBox'.static.Inst().__DelegateOnCancel__Delegate = OnDialogHide;
- class'DialogBox'.static.Inst().__DelegateOnHide__Delegate = OnDialogHide;
- class'DialogBox'.static.Inst().SetDefaultAction(2);
- SetDialogModal(true);
- return;
- }
- function ShowCloseWndDialog()
- {
- DialogShow(1, 0, GetSystemString(14061), string(self));
- class'DialogBox'.static.Inst().AnchorToOwner(0, 0);
- class'DialogBox'.static.Inst().__DelegateOnOK__Delegate = OnCloseWndDialogConfirm;
- class'DialogBox'.static.Inst().__DelegateOnCancel__Delegate = OnDialogHide;
- class'DialogBox'.static.Inst().__DelegateOnHide__Delegate = OnDialogHide;
- class'DialogBox'.static.Inst().SetDefaultAction(2);
- SetDialogModal(true);
- return;
- }
- function ShowResetRefineryDialog()
- {
- DialogShow(1, 0, GetSystemString(14061), string(self));
- class'DialogBox'.static.Inst().AnchorToOwner(0, 0);
- class'DialogBox'.static.Inst().__DelegateOnOK__Delegate = OnResetRefieryDialogConfirm;
- class'DialogBox'.static.Inst().__DelegateOnCancel__Delegate = OnDialogHide;
- class'DialogBox'.static.Inst().__DelegateOnHide__Delegate = OnDialogHide;
- class'DialogBox'.static.Inst().SetDefaultAction(2);
- SetDialogModal(true);
- return;
- }
- function bool isPossableInventoryShow()
- {
- if(((getInstanceUIData().getIsLiveServer() && Me.IsShowWindow()) && newResultInfo.isConfirm == false) && (newResultInfo.newItemOption1 != 0) || newResultInfo.newItemOption2 != 0)
- {
- return false;
- }
- return true;
- return;
- }
- function setHideAndInventoryShow(bool bFlag)
- {
- bHideAndInventoryShow = bFlag;
- return;
- }
- function NewResultCheckAndCloseWnd()
- {
- if((newResultInfo.isConfirm == false) && (newResultInfo.newItemOption1 != 0) || newResultInfo.newItemOption2 != 0)
- {
- ShowCloseWndDialog();
- }
- else
- {
- SetHideWindow();
- }
- return;
- }
- function NewResultCheckAndReset()
- {
- if((newResultInfo.isConfirm == false) && (newResultInfo.newItemOption1 != 0) || newResultInfo.newItemOption2 != 0)
- {
- ShowResetRefineryDialog();
- }
- else
- {
- SetState(0);
- }
- return;
- }
- function SetInstructionText()
- {
- local int numMsg;
- switch(CurrentState)
- {
- case 0:
- numMsg = 1958;
- break;
- case 1:
- numMsg = 1957;
- break;
- case 2:
- numMsg = 1984;
- break;
- case 3:
- numMsg = 13276;
- break;
- case 4:
- numMsg = 1962;
- break;
- default:
- break;
- }
- m_InstructionText.SetText(GetSystemMessage(numMsg));
- return;
- }
- function SetButtonSetting()
- {
- Me.KillTimer(90);
- switch(CurrentState)
- {
- case 0:
- btnReset.DisableWindow();
- m_RefineryBtn.DisableWindow();
- m_RefineryBtn.SetButtonName(1477);
- break;
- case 1:
- btnReset.EnableWindow();
- m_RefineryBtn.DisableWindow();
- m_RefineryBtn.SetButtonName(1477);
- break;
- case 2:
- btnReset.EnableWindow();
- if(canBuy())
- {
- m_RefineryBtn.EnableWindow();
- }
- else
- {
- m_RefineryBtn.DisableWindow();
- }
- m_RefineryBtn.SetButtonName(1477);
- break;
- case 3:
- btnReset.DisableWindow();
- m_RefineryBtn.EnableWindow();
- m_RefineryBtn.SetButtonName(141);
- break;
- case 4:
- btnReset.EnableWindow();
- m_RefineryBtn.DisableWindow();
- Me.SetTimer(90, 500);
- m_RefineryBtn.SetButtonName(3135);
- break;
- default:
- break;
- }
- return;
- }
- function SetHighLightsEmpty()
- {
- local int i;
- i = 1;
- J0x07:
- if(i < 3)
- {
- if(GetItemWindowHandleByIndex(i).GetItemNum() > 0)
- {
- GetHighLightSelectedByIndex(i).ShowWindow();
- }
- else
- {
- GetHighLightSelectedByIndex(i).HideWindow();
- }
- GetHighLightByIndex(i).HideWindow();
- ++ i;
- goto J0x07;
- }
- switch(CurrentState)
- {
- case 0:
- GetHighLightByIndex(1).ShowWindow();
- break;
- case 1:
- GetHighLightByIndex(2).ShowWindow();
- break;
- default:
- break;
- }
- return;
- }
- function RequestRefine()
- {
- local ItemInfo itemInfoStone, itemInfoTarget;
- if(!GetItemInfoStone(itemInfoStone))
- {
- return;
- }
- if(!GetItemInfoTarget(itemInfoTarget))
- {
- return;
- }
- m_RefineryBtn.DisableWindow();
- API_RequestRefine(itemInfoTarget.Id, itemInfoStone.Id, UIControlNeedItemScripts[0].GetID(), UIControlNeedItemScripts[0].numNeed);
- return;
- }
- function HandleClickBtnRefine()
- {
- local ItemInfo iInfoStone;
- switch(CurrentState)
- {
- case 2:
- SetState(3);
- break;
- case 3:
- SetCancel();
- break;
- case 4:
- if(!GetItemInfoStone(iInfoStone))
- {
- SetState(0);
- }
- if(__NFUN_412__(iInfoStone.ItemNum, (0)))
- {
- SetState(0);
- }
- else
- {
- SetState(2);
- }
- break;
- default:
- break;
- }
- return;
- }
- function OnClickbtnClose()
- {
- SetHideWindow();
- return;
- }
- function SetHideWindow()
- {
- Me.HideWindow();
- PlaySound("Itemsound2.smelting.smelting_dragout");
- if(bHideAndInventoryShow)
- {
- ExecuteEvent(2631);
- }
- return;
- }
- function SetCancel()
- {
- SetDwaft();
- SetState(2);
- return;
- }
- event OnNewOptionBtnClicked()
- {
- ShowResultChoiceDialog();
- return;
- }
- event OnResultChoiceDialogConfirm()
- {
- if((newResultInfo.isConfirm == false) && (newResultInfo.newItemOption1 != 0) || newResultInfo.newItemOption2 != 0)
- {
- newOptionBtn.SetEnable(false);
- Rq_C_EX_APPLY_VARIATION_OPTION(newResultInfo.targetItemSId, newResultInfo.newItemOption1, newResultInfo.newItemOption2);
- }
- return;
- }
- event OnCloseWndDialogConfirm()
- {
- SetHideWindow();
- return;
- }
- event OnResetRefieryDialogConfirm()
- {
- SetState(0);
- return;
- }
- event OnDialogHide()
- {
- SetDialogModal(false);
- return;
- }
- function ClearRefineryText()
- {
- SetQuality(-1);
- txtOptions.SetText("");
- return;
- }
- function ClearNewRefineryText()
- {
- if(!IsSupportedResultChoice())
- {
- return;
- }
- SetNewQuality(-1);
- newTxtOptions.SetText("");
- return;
- }
- function AddRefineryText()
- {
- local string strDesc1, strDesc2, strDesc3, descAll;
- local int ColorR, ColorG, ColorB, Quality;
- local ItemInfo item;
- if(!GetItemInfoTarget(item))
- {
- return;
- }
- descAll = "";
- if((item.RefineryOp1 != 0) || item.RefineryOp2 != 0)
- {
- if(__NFUN_412__(item.SlotBitType, (8192)))
- {
- Quality = GetOptionQuality(item.RefineryOp1);
- SetQuality(Quality);
- ToolTip(GetScript("Tooltip")).GetRefineryColor(Quality, ColorR, ColorG, ColorB);
- }
- else
- {
- if(item.RefineryOp2 != 0)
- {
- Quality = GetOptionQuality(item.RefineryOp2);
- SetQuality(Quality);
- ToolTip(GetScript("Tooltip")).GetRefineryColor(Quality, ColorR, ColorG, ColorB);
- }
- }
- if(item.RefineryOp1 != 0)
- {
- strDesc1 = "";
- strDesc2 = "";
- strDesc3 = "";
- if(class'UIDATA_REFINERYOPTION'.static.GetOptionDescription(item.RefineryOp1, strDesc1, strDesc2, strDesc3))
- {
- AddDesc(strDesc1, descAll);
- AddDesc(strDesc2, descAll);
- AddDesc(strDesc3, descAll);
- }
- }
- if(item.RefineryOp2 != 0)
- {
- strDesc1 = "";
- strDesc2 = "";
- strDesc3 = "";
- if(class'UIDATA_REFINERYOPTION'.static.GetOptionDescription(item.RefineryOp2, strDesc1, strDesc2, strDesc3))
- {
- AddDesc(strDesc1, descAll);
- AddDesc(strDesc2, descAll);
- AddDesc(strDesc3, descAll);
- }
- }
- if(__NFUN_412__(item.SlotBitType, (8192)))
- {
- Quality = GetOptionQuality(item.RefineryOp2);
- SetQuality(Quality);
- ToolTip(GetScript("Tooltip")).GetRefineryColor(Quality, ColorR, ColorG, ColorB);
- }
- txtOptions.SetTextColor(GetColor(ColorR, ColorG, ColorB, 255));
- txtOptions.SetText(descAll);
- if(descAll != "")
- {
- optionGradeTexture.ShowWindow();
- }
- if(IsSupportedResultChoice())
- {
- if(descAll != "")
- {
- preOptionCheckTex.ShowWindow();
- optionBlindWnd.HideWindow();
- }
- }
- }
- else
- {
- optionGradeTexture.HideWindow();
- if(IsSupportedResultChoice())
- {
- preOptionCheckTex.HideWindow();
- optionBlindWnd.ShowWindow();
- }
- }
- return;
- }
- function SetQuality(int Quality)
- {
- optionGradeTexture.SetTexture(GetGradeTextureByQuality(Quality));
- if(Quality <= 0)
- {
- optionGradeTexture.HideWindow();
- }
- else
- {
- optionGradeTexture.ShowWindow();
- }
- return;
- }
- function SetNewQuality(int Quality)
- {
- if(!IsSupportedResultChoice())
- {
- return;
- }
- newOptionGradeTex.SetTexture(GetGradeTextureByQuality(Quality));
- if(Quality <= 0)
- {
- newOptionGradeTex.HideWindow();
- }
- else
- {
- newOptionGradeTex.ShowWindow();
- }
- return;
- }
- function string GetGradeTextureByQuality(int Quality)
- {
- switch(Quality)
- {
- case 1:
- return "L2UI_EPIC.RefineryWnd.RefineryWnd_Frame_Yellow";
- break;
- case 2:
- return "L2UI_EPIC.RefineryWnd.RefineryWnd_Frame_Blue";
- break;
- case 3:
- return "L2UI_EPIC.RefineryWnd.RefineryWnd_Frame_purple";
- break;
- case 4:
- return "L2UI_EPIC.RefineryWnd.RefineryWnd_Frame_Red";
- break;
- default:
- return "L2UI_EPIC.RefineryWnd.RefineryWnd_Frame_Red";
- break;
- }
- }
- function ResetAnims()
- {
- l2uiTweenScript.StopTween(m_WindowName, 1);
- l2uiTweenScript.StopTween(m_WindowName, 2);
- l2uiTweenScript.StopShake(m_WindowName, 101);
- m_DragBox1.ShowWindow();
- m_DragBox1.SetAnchor(m_WindowName $ ".MainBg", "CenterCenter", "CenterCenter", -78, 0);
- m_DragBox1.ClearAnchor();
- m_DragBox1.SetAlpha(255);
- m_DragBox2.ShowWindow();
- m_DragBox2.SetAnchor(m_WindowName $ ".MainBg", "CenterCenter", "CenterCenter", 78, 0);
- m_DragBox2.ClearAnchor();
- m_DragBox2.SetAlpha(255);
- m_RefineAnim.HideWindow();
- m_RefineAnim.Stop();
- m_hRefineryWndRefineryProgress.SetPos(0);
- m_hRefineryWndRefineryProgress.Stop();
- m_ResultBoxItem.HideWindow();
- m_ResultAnimation1.HideWindow();
- m_ResultAnimation2.HideWindow();
- m_ResultAnimation3.HideWindow();
- m_ResultAnimation4.HideWindow();
- return;
- }
- function MakeProgressTween()
- {
- local TweenObject tweenObj0;
- ResetAnims();
- tweenObj0.Owner = m_WindowName;
- tweenObj0.Id = 1;
- tweenObj0.Target = m_DragBox1;
- tweenObj0.Duration = 1000;
- tweenObj0.MoveX = 78;
- tweenObj0.ease = l2uiTweenScript.0;
- l2uiTweenScript.AddTweenObject(tweenObj0);
- tweenObj0.Id = 2;
- tweenObj0.Target = m_DragBox2;
- tweenObj0.MoveX = -tweenObj0.MoveX;
- tweenObj0.ease = l2uiTweenScript.0;
- l2uiTweenScript.AddTweenObject(tweenObj0);
- return;
- }
- function MakeTweenAlpha(WindowHandle targetWindow, int tweenID)
- {
- local TweenObject tweenObj0;
- targetWindow.SetAlpha(0);
- tweenObj0.Owner = m_WindowName;
- tweenObj0.Id = tweenID;
- tweenObj0.Target = targetWindow;
- tweenObj0.Duration = 500;
- tweenObj0.Alpha = 255;
- tweenObj0.ease = l2uiTweenScript.1;
- l2uiTweenScript.AddTweenObject(tweenObj0);
- return;
- }
- function MakeShakeTween()
- {
- local ShakeObject shakeObj;
- shakeObj.Owner = m_WindowName;
- shakeObj.Target = Me;
- shakeObj.Duration = 500;
- shakeObj.shakeSize = 4;
- shakeObj.Direction = l2uiTweenScript.1;
- shakeObj.Id = 101;
- l2uiTweenScript.StartShakeObject(shakeObj);
- return;
- }
- function PlayResultQualityAnimation(int Grade)
- {
- switch(Grade)
- {
- case 1:
- m_ResultAnimation1.ShowWindow();
- PlaySound("ItemSound2.smelting.smelting_finalB");
- m_ResultAnim1.Stop();
- m_ResultAnim1.Play();
- break;
- case 2:
- m_ResultAnimation2.ShowWindow();
- PlaySound("ItemSound2.smelting.smelting_finalC");
- m_ResultAnim2.Stop();
- m_ResultAnim2.Play();
- break;
- case 3:
- m_ResultAnimation3.ShowWindow();
- PlaySound("ItemSound2.smelting.smelting_finalD");
- m_ResultAnim3.Stop();
- m_ResultAnim3.Play();
- break;
- case 4:
- m_ResultAnimation4.ShowWindow();
- PlaySound("ItemSound2.smelting.smelting_finalD");
- m_ResultAnim4.Stop();
- m_ResultAnim4.Play();
- break;
- default:
- break;
- }
- return;
- }
- function SetDwaft()
- {
- m_ObjectViewport.SetNPCInfo(19673);
- m_ObjectViewport.ShowNPC(0.1);
- m_ObjectViewport.SpawnNPC();
- m_ObjectViewport.ShowWindow();
- return;
- }
- function DwarfPlayAnimation()
- {
- local int randNum;
- randNum = Rand(10);
- if(randNum < 2)
- {
- m_ObjectViewport.PlayAnimation(2);
- }
- else
- {
- m_ObjectViewport.PlayAnimation(1);
- }
- return;
- }
- function bool GetItemInfoStone(out ItemInfo iInfo)
- {
- return GetItemInfoByIndex(1, iInfo);
- return;
- }
- function bool GetItemInfoTarget(out ItemInfo iInfo)
- {
- return GetItemInfoByIndex(2, iInfo);
- return;
- }
- function bool GetItemInfoByIndex(int Index, out ItemInfo iInfo)
- {
- return GetItemWindowHandleByIndex(Index).GetItem(0, iInfo);
- return;
- }
- function int GetOptionQuality(int OptionID)
- {
- local int Quality;
- Quality = class'UIDATA_REFINERYOPTION'.static.GetQuality(OptionID);
- if(0 >= Quality)
- {
- Quality = 1;
- }
- else
- {
- if(4 < Quality)
- {
- Quality = 4;
- }
- }
- return Quality;
- return;
- }
- function ItemWindowHandle GetItemWindowHandleByIndex(int Index)
- {
- return GetItemWindowHandle(((m_WindowName $ ".ItemDragBox") $ string(Index)) $ "Wnd.ItemDragBox");
- return;
- }
- function WindowHandle GetHighLightByIndex(int Index)
- {
- return GetWindowHandle(((m_WindowName $ ".ItemDragBox") $ string(Index)) $ "Wnd.DropHighlight");
- return;
- }
- function WindowHandle GetHighLightSelectedByIndex(int Index)
- {
- return GetWindowHandle(((m_WindowName $ ".ItemDragBox") $ string(Index)) $ "Wnd.SelectedItemHighlight");
- return;
- }
- function HandleUpdateItemStone(optional array<ItemInfo> iInfo, optional int Index)
- {
- local ItemInfo iInfoStone;
- iInfoStone = iInfo[0];
- m_DragboxItem1.Clear();
- if(__NFUN_412__(iInfoStone.ItemNum, (0)))
- {
- switch(CurrentState)
- {
- case 4:
- iObject.setId();
- break;
- default:
- SetState(0);
- break;
- }
- }
- else
- {
- iInfoStone.bShowCount = true;
- m_DragboxItem1.AddItem(iInfoStone);
- }
- return;
- }
- function PeeItemUpdated(UIControlNeedItem script)
- {
- switch(CurrentState)
- {
- case 3:
- if(!canBuy())
- {
- SetState(2);
- }
- break;
- default:
- SetButtonSetting();
- break;
- break;
- }
- return;
- }
- function bool canBuy()
- {
- return UIControlNeedItemScripts[0].canBuy() && UIControlNeedItemScripts[1].canBuy();
- return;
- }
- function bool IsSupportedResultChoice()
- {
- if(getInstanceUIData().getIsLiveServer())
- {
- return true;
- }
- return false;
- return;
- }
- function AddDesc(string Desc, out string descAll)
- {
- if(Desc == "")
- {
- return;
- }
- if(descAll != "")
- {
- descAll = (descAll $ "\\n") $ Desc;
- }
- else
- {
- descAll = Desc;
- }
- return;
- }
- function DelOptionList()
- {
- RefineryWndOptionScript.DelIds();
- return;
- }
- function SetOptionList()
- {
- local ItemInfo iInfoStone, iInfoTarget;
- if(!GetItemInfoStone(iInfoStone))
- {
- DelOptionList();
- return;
- }
- if(!GetItemInfoTarget(iInfoTarget))
- {
- DelOptionList();
- return;
- }
- RefineryWndOptionScript.SetIDs(iInfoStone.Id.ClassID, iInfoTarget.Id.ClassID);
- return;
- }
- function OnReceivedCloseUI()
- {
- if(int(CurrentState) == int(3))
- {
- SetCancel();
- }
- else
- {
- if(IsSupportedResultChoice())
- {
- NewResultCheckAndCloseWnd();
- }
- else
- {
- SetHideWindow();
- }
- }
- return;
- }
Advertisement
Advertisement