Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RefineryWndOption extends UICommonAPI;
- var string m_WindowName;
- var WindowHandle Me;
- var WindowHandle RefineryWndProbability;
- var RichListCtrlHandle List_ListCtrl;
- var RichListCtrlHandle ProbabilityList_ListCtrl;
- var TextBoxHandle txtInstruction;
- var ButtonHandle DetailInfo_BTN;
- function OnLoad()
- {
- Initialize();
- return;
- }
- function Initialize()
- {
- m_WindowName = getCurrentWindowName(string(self));
- Me = GetWindowHandle(m_WindowName);
- List_ListCtrl = GetRichListCtrlHandle(m_WindowName $ ".List_ListCtrl");
- txtInstruction = GetTextBoxHandle(m_WindowName $ ".txtInstruction");
- RefineryWndProbability = GetWindowHandle(m_WindowName $ ".RefineryWndProbability");
- ProbabilityList_ListCtrl = GetRichListCtrlHandle(m_WindowName $ ".ProbabilityList_ListCtrl");
- DetailInfo_BTN = GetButtonHandle(m_WindowName $ ".DetailInfo_BTN");
- List_ListCtrl.SetSelectable(false);
- List_ListCtrl.SetAppearTooltipAtMouseX(true);
- List_ListCtrl.SetSelectedSelTooltip(false);
- ProbabilityList_ListCtrl.SetSelectable(false);
- ProbabilityList_ListCtrl.SetAppearTooltipAtMouseX(true);
- ProbabilityList_ListCtrl.SetSelectedSelTooltip(false);
- toggleProbability(false);
- return;
- }
- function toggleProbability(bool bProbability)
- {
- if(bProbability)
- {
- RefineryWndProbability.ShowWindow();
- List_ListCtrl.HideWindow();
- txtInstruction.HideWindow();
- DetailInfo_BTN.SetButtonName(13959);
- updateProbabilityList();
- }
- else
- {
- RefineryWndProbability.HideWindow();
- List_ListCtrl.ShowWindow();
- DetailInfo_BTN.SetButtonName(13960);
- if(List_ListCtrl.GetRecordCount() > 0)
- {
- txtInstruction.HideWindow();
- }
- else
- {
- txtInstruction.ShowWindow();
- }
- }
- return;
- }
- function updateProbabilityList()
- {
- local ItemInfo stoneInfo, TargetInfo;
- local array<VariationProbUIData> Variation1, Variation2;
- local int i, N;
- local string oDesc1, oDesc2, oDesc3, descAll, probabilityStr, OptionStr;
- RefineryWnd(GetScript("RefineryWnd")).GetItemInfoStone(stoneInfo);
- RefineryWnd(GetScript("RefineryWnd")).GetItemInfoTarget(TargetInfo);
- Variation1.Length = 0;
- Variation2.Length = 0;
- class'RefineryAPI'.static.GetOptionProbability(stoneInfo.Id.ClassID, TargetInfo.Id.ClassID, Variation1, Variation2);
- ProbabilityList_ListCtrl.DeleteAllItem();
- if(Variation1.Length > 0)
- {
- OptionStr = "1" $ GetSystemString(397);
- if((int(GetLanguage()) == int(8)) || int(GetLanguage()) == int(9))
- {
- OptionStr = GetSystemString(397) @ "1";
- }
- i = 0;
- J0x107:
- if(i < Variation1.Length)
- {
- if(i == 0)
- {
- ProbabilityList_ListCtrl.InsertRecord(makeTitleListItem(OptionStr, ""));
- }
- N = 0;
- J0x145:
- if(N < Variation1[i].Options.Length)
- {
- class'RefineryAPI'.static.GetOptionDescByOptionID(Variation1[i].Options[N].OptionID, oDesc1, oDesc2, oDesc3);
- if(oDesc1 != "")
- {
- descAll = oDesc1;
- }
- if(oDesc2 != "")
- {
- descAll = (descAll $ ",") $ oDesc2;
- }
- if(oDesc3 != "")
- {
- descAll = (descAll $ ",") $ oDesc3;
- }
- descAll = Locs(descAll, "\\n", " ", false);
- probabilityStr = getInstanceL2Util().CutFloatIntByString(Variation1[i].Options[N].Probablity);
- ProbabilityList_ListCtrl.InsertRecord(makeRecordProbability(descAll, probabilityStr));
- ++ N;
- goto J0x145;
- }
- ++ i;
- goto J0x107;
- }
- }
- if(Variation2.Length > 0)
- {
- OptionStr = "2" $ GetSystemString(397);
- if((int(GetLanguage()) == int(8)) || int(GetLanguage()) == int(9))
- {
- OptionStr = GetSystemString(397) @ "2";
- }
- i = 0;
- J0x2D2:
- if(i < Variation2.Length)
- {
- if(i == 0)
- {
- ProbabilityList_ListCtrl.InsertRecord(makeTitleListItem(OptionStr, ""));
- }
- N = 0;
- J0x310:
- if(N < Variation2[i].Options.Length)
- {
- class'RefineryAPI'.static.GetOptionDescByOptionID(Variation2[i].Options[N].OptionID, oDesc1, oDesc2, oDesc3);
- if(oDesc1 != "")
- {
- descAll = oDesc1;
- }
- if(oDesc2 != "")
- {
- descAll = (descAll $ ", ") $ oDesc2;
- }
- if(oDesc3 != "")
- {
- descAll = (descAll $ ", ") $ oDesc3;
- }
- descAll = Locs(descAll, "\\n", " ", false);
- probabilityStr = getInstanceL2Util().CutFloatIntByString(Variation2[i].Options[N].Probablity);
- ProbabilityList_ListCtrl.InsertRecord(makeRecordProbability(descAll, probabilityStr));
- ++ N;
- goto J0x310;
- }
- ++ i;
- goto J0x2D2;
- }
- }
- return;
- }
- function RichListCtrlRowData makeRecordProbability(string Text, string percentStr)
- {
- local RichListCtrlRowData RowData;
- local string textShort;
- textShort = Text;
- RowData.cellDataList.Length = 2;
- textShort = makeShortStringByPixel(Text, 210, "..");
- if(textShort != Text)
- {
- RowData.szReserved = Text;
- }
- addRichListCtrlString(RowData.cellDataList[0].drawitems, textShort, GTColor().White, false, 0, 0);
- addRichListCtrlString(RowData.cellDataList[1].drawitems, percentStr, GTColor().White, false, 20, 0);
- return RowData;
- return;
- }
- function RichListCtrlRowData makeTitleListItem(string Str, string percentStr)
- {
- local Color applyColor;
- local RichListCtrlRowData RowData;
- RowData.cellDataList.Length = 2;
- RowData.sOverlayTex = "L2UI_EPIC.DethroneWnd.List_HeaderBg_Blue";
- applyColor = GTColor().BrightWhite;
- addRichListCtrlString(RowData.cellDataList[0].drawitems, Str, applyColor, false, 0, 0);
- addRichListCtrlString(RowData.cellDataList[1].drawitems, percentStr, GTColor().White, false, 20, 0);
- RowData.OverlayTexU = 635;
- RowData.OverlayTexV = 26;
- return RowData;
- return;
- }
- function DelIds()
- {
- List_ListCtrl.DeleteAllItem();
- txtInstruction.ShowWindow();
- toggleProbability(false);
- return;
- }
- function SetIDs(int stoneClassID, int targetClassID)
- {
- local array<string> Options, optionsDetail;
- local int i, j;
- API_GetOptionDesc(stoneClassID, targetClassID, Options);
- i = 0;
- J0x1C:
- if(i < Options.Length)
- {
- Debug("SetList" @ Options[i]);
- ++ i;
- goto J0x1C;
- }
- List_ListCtrl.DeleteAllItem();
- i = 0;
- J0x68:
- if(i < Options.Length)
- {
- optionsDetail.Length = 0;
- StringIntoArray(Options[i], "\\n", optionsDetail);
- if(optionsDetail.Length > 0)
- {
- setList(optionsDetail, i + 1);
- }
- ++ i;
- goto J0x68;
- }
- return;
- }
- function setList(array<string> Options, int Quality)
- {
- local int i;
- i = 0;
- J0x07:
- if(i < Options.Length)
- {
- if(Right(Options[i], 1) == "\\")
- {
- Options[i] = Left(Options[i], Len(Options[i]) - 1);
- }
- if(Options[i] != "")
- {
- List_ListCtrl.InsertRecord(makeRecord(Options[i], Quality));
- }
- ++ i;
- goto J0x07;
- }
- if(RefineryWndProbability.IsShowWindow())
- {
- toggleProbability(false);
- }
- else
- {
- toggleProbability(true);
- }
- return;
- }
- function Toggle()
- {
- if(Me.IsShowWindow())
- {
- Me.HideWindow();
- }
- else
- {
- Me.ShowWindow();
- Me.SetFocus();
- }
- return;
- }
- event OnClickButton(string strID)
- {
- Debug("OnClickButton" @ strID);
- if(strID == "DetailInfo_BTN")
- {
- if(RefineryWndProbability.IsShowWindow())
- {
- toggleProbability(false);
- }
- else
- {
- toggleProbability(true);
- }
- }
- return;
- }
- function RichListCtrlRowData makeRecord(string Option, int Quality)
- {
- local RichListCtrlRowData Record;
- local Color tmpTextColor;
- local string optionResult;
- local int R, G, B;
- Record.cellDataList.Length = 1;
- ToolTip(GetScript("Tooltip")).GetRefineryColor(Quality, R, G, B);
- tmpTextColor = GetColor(R, G, B, 255);
- optionResult = makeShortStringByPixel(Option, 320, "..");
- if(optionResult != Option)
- {
- Record.szReserved = Option;
- }
- addRichListCtrlString(Record.cellDataList[0].drawitems, optionResult, tmpTextColor, false);
- return Record;
- return;
- }
- function bool API_GetOptionDesc(int TargetItemClassID, int targetClassID, out array<string> Options)
- {
- local string str1, str2, str3, str4;
- local bool optionExist;
- optionExist = class'RefineryAPI'.static.GetOptionDesc(TargetItemClassID, targetClassID, str1, str2, str3, str4);
- Options[0] = str1;
- Options[1] = str2;
- Options[2] = str3;
- Options[3] = str4;
- return optionExist;
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement