public class XUiC_PreviewInformationWindowRebirth : XUiController { public XUiV_Sprite imagePreview; public XUiV_Label description; public XUiV_Label title; public XUiV_Panel content; public XUiC_SimpleButton btnOk; public XUiC_SimpleButton btnTrader; public int windowX = -1; public int windowY = -1; public int imageWidth = 0; public int imageHeight = 0; public int previewIndex = -1; public string quest = ""; public string gameevent = ""; public string items = ""; public string trader = ""; public static string ID = ""; public override void Init() { //Log.Out("XUiC_PreviewInformationWindowRebirth-Init START"); base.Init(); XUiC_PreviewInformationWindowRebirth.ID = base.WindowGroup.ID; this.imagePreview = (XUiV_Sprite)GetChildById("imagePreview").ViewComponent; this.btnOk = base.GetChildById("btnOk") as XUiC_SimpleButton; this.btnTrader = base.GetChildById("btnTrader") as XUiC_SimpleButton; this.btnOk.OnPressed += BtnOk_OnPressed; this.btnTrader.OnPressed += BtnTrader_OnPressed; this.description = (XUiV_Label)GetChildById("descriptionText").ViewComponent; this.title = (XUiV_Label)GetChildById("title").ViewComponent; } public override void Update(float _dt) { //Log.Out("XUiC_PreviewInformationWindowRebirth-Update START"); base.Update(_dt); if (this.IsDirty) { base.RefreshBindings(true); this.IsDirty = false; } } private void BtnOk_OnPressed(XUiController _sender, int _mouseButton) { if (this.items != "") { string[] itemList = this.items.Split('~'); for (int i = 0; i < itemList.Length; i++) { string[] itemProperties = itemList[i].Split(','); ItemValue itemValue = null; int quantity = 1; int quality = 1; for (int j = 0; j < itemList.Length; j++) { if (j == 0) { itemValue = ItemClass.GetItem(itemProperties[j]); } else if (j == 1) { quantity = int.Parse(itemProperties[j]); } else if (j == 2) { if (itemValue.HasQuality) { quality = int.Parse(itemProperties[j]); } } } RebirthUtilities.addToPlayerInventory(itemValue, base.xui.playerUI.entityPlayer, quantity, "", quality); } } //Log.Out("XUiC_PreviewInformationWindowRebirth-BtnOk_OnPressed previewIndex: " + this.previewIndex); if (this.previewIndex == 2) { if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolRepairT0StoneAxe"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolRepairT0StoneAxe"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 1); if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolShovelT0StoneShovel"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolShovelT0StoneShovel"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 1); } else if (this.previewIndex == 3) { RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("FuriousRamsayClassBookGeneric"), base.xui.playerUI.entityPlayer, 1, "", 1); string optionJumpstart = RebirthVariables.customJumpstart; if (optionJumpstart == "classbookessentials") { if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolAxeT1IronFireaxe"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolAxeT1IronFireaxe"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 2); if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolPickT1IronPickaxe"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolPickT1IronPickaxe"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 2); if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolShovelT1IronShovel"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolShovelT1IronShovel"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 2); if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolSalvageT1Wrench"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolSalvageT1Wrench"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 1); ProgressionValue progressionValue = base.xui.playerUI.entityPlayer.Progression.GetProgressionValue("FuriousRamsayMiningTools"); if (progressionValue != null) { if (progressionValue.Level < 50) { progressionValue.Level = 50; RebirthVariables.localVariables["$varFuriousRamsayMinePercUnit"] = 0.5f; RebirthUtilities.ProcessAttribute(base.xui.playerUI.entityPlayer, "$varFuriousRamsayMinePercUnit"); } } progressionValue = base.xui.playerUI.entityPlayer.Progression.GetProgressionValue("FuriousRamsayDiggingTools"); if (progressionValue != null) { if (progressionValue.Level < 50) { progressionValue.Level = 50; RebirthVariables.localVariables["$varFuriousRamsayDigPercUnit"] = 0.75f; RebirthUtilities.ProcessAttribute(base.xui.playerUI.entityPlayer, "$varFuriousRamsayDigPercUnit"); } } progressionValue = base.xui.playerUI.entityPlayer.Progression.GetProgressionValue("craftingChoppingTools"); if (progressionValue != null) { if (progressionValue.Level < 50) { progressionValue.Level = 50; RebirthVariables.localVariables["$varFuriousRamsayChopPercUnit"] = 0.5f; RebirthUtilities.ProcessAttribute(base.xui.playerUI.entityPlayer, "$varFuriousRamsayChopPercUnit"); } } progressionValue = base.xui.playerUI.entityPlayer.Progression.GetProgressionValue("craftingSalvageTools"); if (progressionValue != null) { if (progressionValue.Level < 10) { progressionValue.Level = 10; RebirthVariables.localVariables["$varFuriousRamsaySalvageToolsPercUnit"] = 0.1f; RebirthUtilities.ProcessAttribute(base.xui.playerUI.entityPlayer, "$varFuriousRamsaySalvageToolsPercUnit"); } } } else { if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolRepairT0StoneAxe"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolRepairT0StoneAxe"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 1); if (!RebirthUtilities.hasItem(ItemClass.GetItem("meleeToolShovelT0StoneShovel"), base.xui.playerUI.entityPlayer)) RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolShovelT0StoneShovel"), base.xui.playerUI.entityPlayer, 1, "", 1, true, 1); } } if (this.quest != "") { Quest quest = QuestClass.CreateQuest(this.quest); base.xui.playerUI.entityPlayer.QuestJournal.AddQuest(quest); } xui.playerUI.windowManager.Close(windowGroup.ID); } private void BtnTrader_OnPressed(XUiController _sender, int _mouseButton) { if (this.gameevent != "") { GameEventManager.Current.HandleAction(this.gameevent, base.xui.playerUI.entityPlayer as EntityPlayer, base.xui.playerUI.entityPlayer, false, "", "", false, true, "", null); } xui.playerUI.windowManager.Close(windowGroup.ID); } public override bool GetBindingValue(ref string value, string bindingName) { //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue START"); if (bindingName != null) { if (bindingName == "windowX") { value = this.windowX.ToString(); //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue windowX value: " + value); return true; } else if (bindingName == "windowY") { value = this.windowY.ToString(); //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue windowY value: " + value); return true; } else if (bindingName == "imageWidth") { value = this.imageWidth.ToString(); //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue imageWidth value: " + value); return true; } else if (bindingName == "imageHeight") { value = this.imageHeight.ToString(); //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue imageHeight value: " + value); return true; } else if (bindingName == "descriptionHeight") { value = (693 - this.imageHeight).ToString(); //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue imageHeight value: " + value); return true; } else if (bindingName == "traderinfovisible") { value = (this.previewIndex == 4).ToString(); if (RebirthUtilities.ScenarioSkip()) { value = "false"; } //Log.Out("XUiC_PreviewInformationWindowRebirth-GetBindingValue traderinfovisible value: " + value); return true; } } return false; } public override void OnOpen() { //Log.Out("XUiC_PreviewInformationWindowRebirth-OnOpen START"); this.btnTrader.ViewComponent.IsVisible = false; this.previewIndex = -1; base.OnOpen(); } }