internal class XUiC_TradeDNABlueprintsForBoostsRebirth : XUiController { private static float uiCheck = 0f; public float uiTick = 0.5f; public XUiV_Label LabelTotal; private XUiC_ComboBoxList cbxDNABoostType; public XUiC_ComboBoxInt comboStrength; public XUiC_ComboBoxInt comboDexterity; public XUiC_ComboBoxInt comboConstitution; public XUiC_ComboBoxInt comboIntelligence; public XUiC_ComboBoxInt comboCharisma; public XUiV_Label Resource; public XUiV_Label ResourceMultiplier; public XUiV_Label GatherType; public XUiV_Label LabelDescription; public XUiV_Panel Panel; public XUiV_Sprite spriteDNABoostImage; public override void Init() { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-Init START"); base.Init(); Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent; ((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed; ((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed; spriteDNABoostImage = (XUiV_Sprite)GetChildById("DNABoostImage").ViewComponent; LabelTotal = (XUiV_Label)Panel.Controller.GetChildById("lblTotal").ViewComponent; LabelDescription = (XUiV_Label)Panel.Controller.GetChildById("lblDescription").ViewComponent; LabelTotal.Enabled = false; this.cbxDNABoostType = (base.GetChildById("cbxDNABoostType") as XUiC_ComboBoxList); if (this.cbxDNABoostType != null) { this.cbxDNABoostType.Elements.Add("Strength"); this.cbxDNABoostType.Elements.Add("Dexterity"); this.cbxDNABoostType.Elements.Add("Constitution"); this.cbxDNABoostType.Elements.Add("Intelligence"); this.cbxDNABoostType.Elements.Add("Charisma"); this.cbxDNABoostType.OnValueChanged += this.cbxDNABoostType_OnValueChanged; } comboStrength = GetChildById("cbxStrength").GetChildByType(); comboDexterity = GetChildById("cbxDexterity").GetChildByType(); comboConstitution = GetChildById("cbxConstitution").GetChildByType(); comboIntelligence = GetChildById("cbxIntelligence").GetChildByType(); comboCharisma = GetChildById("cbxCharisma").GetChildByType(); this.comboStrength.OnValueChanged += new XUiC_ComboBox.XUiEvent_ValueChanged(this.comboStrength_OnValueChanged); this.comboDexterity.OnValueChanged += new XUiC_ComboBox.XUiEvent_ValueChanged(this.comboDexterity_OnValueChanged); this.comboConstitution.OnValueChanged += new XUiC_ComboBox.XUiEvent_ValueChanged(this.comboConstitution_OnValueChanged); this.comboIntelligence.OnValueChanged += new XUiC_ComboBox.XUiEvent_ValueChanged(this.comboIntelligence_OnValueChanged); this.comboCharisma.OnValueChanged += new XUiC_ComboBox.XUiEvent_ValueChanged(this.comboCharisma_OnValueChanged); } private void comboStrength_OnValueChanged(XUiController _sender, long _oldValue, long _newValue) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged START"); EntityPlayer player = xui.playerUI.entityPlayer; int maxUnits = RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintStrength", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradable = maxUnits * RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxUnitsOldValue = (int)_oldValue / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradableOldValue = maxUnitsOldValue * RebirthVariables.geneticsBlueprintToDNABoostRatio; /*Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged maxUnits: " + maxUnits); Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged maxTradable: " + maxTradable); Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged maxUnitsOldValue: " + maxUnitsOldValue); Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged maxTradableOldValue: " + maxTradableOldValue); Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged _oldValue: " + _oldValue); Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged _newValue: " + _newValue);*/ if (_oldValue < _newValue) { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged _oldValue < _newValue maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboStrength.Value = _newValue; } else { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboStrength_OnValueChanged _oldValue > _newValue maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboStrength.Value = _newValue; } CalculateDNABlueprintsTotal(player); } private void comboDexterity_OnValueChanged(XUiController _sender, long _oldValue, long _newValue) { EntityPlayer player = xui.playerUI.entityPlayer; int maxUnits = RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintDexterity", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradable = maxUnits * RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxUnitsOldValue = (int)_oldValue / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradableOldValue = maxUnitsOldValue * RebirthVariables.geneticsBlueprintToDNABoostRatio; if (_oldValue < _newValue) { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboDexterity_OnValueChanged _oldValue < _newValue maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboDexterity.Value = _newValue; } else { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboDexterity_OnValueChanged _oldValue > _newValue maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboDexterity.Value = _newValue; } CalculateDNABlueprintsTotal(player); } private void comboConstitution_OnValueChanged(XUiController _sender, long _oldValue, long _newValue) { EntityPlayer player = xui.playerUI.entityPlayer; int maxUnits = RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintConstitution", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradable = maxUnits * RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxUnitsOldValue = (int)_oldValue / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradableOldValue = maxUnitsOldValue * RebirthVariables.geneticsBlueprintToDNABoostRatio; if (_oldValue < _newValue) { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboConstitution_OnValueChanged _oldValue < _newValue maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboConstitution.Value = _newValue; } else { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboConstitution_OnValueChanged _oldValue > _newValue maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboConstitution.Value = _newValue; } CalculateDNABlueprintsTotal(player); } private void comboIntelligence_OnValueChanged(XUiController _sender, long _oldValue, long _newValue) { EntityPlayer player = xui.playerUI.entityPlayer; int maxUnits = RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintIntelligence", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradable = maxUnits * RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxUnitsOldValue = (int)_oldValue / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradableOldValue = maxUnitsOldValue * RebirthVariables.geneticsBlueprintToDNABoostRatio; if (_oldValue < _newValue) { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboIntelligence_OnValueChanged _oldValue < _newValue maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboIntelligence.Value = _newValue; } else { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboIntelligence_OnValueChanged _oldValue > _newValue maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboIntelligence.Value = _newValue; } CalculateDNABlueprintsTotal(player); } private void comboCharisma_OnValueChanged(XUiController _sender, long _oldValue, long _newValue) { EntityPlayer player = xui.playerUI.entityPlayer; int maxUnits = RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintCharisma", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradable = maxUnits * RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxUnitsOldValue = (int)_oldValue / RebirthVariables.geneticsBlueprintToDNABoostRatio; int maxTradableOldValue = maxUnitsOldValue * RebirthVariables.geneticsBlueprintToDNABoostRatio; if (_oldValue < _newValue) { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboCharisma_OnValueChanged _oldValue < _newValue maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue++ * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboCharisma.Value = _newValue; } else { Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-comboCharisma_OnValueChanged _oldValue > _newValue maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio: " + maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio); _newValue = maxUnitsOldValue-- * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboCharisma.Value = _newValue; } CalculateDNABlueprintsTotal(player); } private void cbxDNABoostType_OnValueChanged(XUiController _sender, string _oldValue, string _newValue) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-cbxDNABoostType_OnValueChanged START"); EntityPlayer player = xui.playerUI.entityPlayer; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-XUiC_TradeDNABlueprintsForBoostsRebirth cbxDNABoostType: " + cbxDNABoostType.Value); ResetDNABlueprintsCount(player, cbxDNABoostType.Value); } public override void Update(float _dt) { base.Update(_dt); if ((Time.time - uiCheck) > uiTick) { uiCheck = Time.time; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-Update 1"); } EntityPlayer player = xui.playerUI.entityPlayer; } public override void OnOpen() { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-OnOpen START"); EntityPlayer player = xui.playerUI.entityPlayer; var entityID = 0; if (player.Buffs.HasCustomVar("CurrentNPC")) { entityID = (int)player.Buffs.GetCustomVar("CurrentNPC"); //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-OnOpen 1, entityID: " + entityID); } if (entityID == 0) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-OnOpen 2"); return; } LabelDescription.Text = Localization.Get("xuiTradeDNABlueprintsForBoostsDescription").Replace("{0}", RebirthVariables.geneticsBlueprintToDNABoostRatio.ToString()); cbxDNABoostType.SelectedIndex = 0; ResetDNABlueprintsCount(player, "Strength"); base.OnOpen(); } private void CalculateDNABlueprintsTotal(EntityPlayer player) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-CalculateDNABlueprintsTotal START"); float total = 0; string DNABlueprintsType = cbxDNABoostType.Value; comboStrength.Enabled = false; comboDexterity.Enabled = false; comboConstitution.Enabled = false; comboIntelligence.Enabled = false; comboCharisma.Enabled = false; if (DNABlueprintsType == "Strength") { comboStrength.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintStrength", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboStrength.Enabled = true; total = (comboStrength.Value) / RebirthVariables.geneticsBlueprintToDNABoostRatio; } if (DNABlueprintsType == "Dexterity") { comboDexterity.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintDexterity", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboDexterity.Enabled = true; total = (comboDexterity.Value) / RebirthVariables.geneticsBlueprintToDNABoostRatio; } if (DNABlueprintsType == "Constitution") { comboConstitution.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintConstitution", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboConstitution.Enabled = true; total = (comboConstitution.Value) / RebirthVariables.geneticsBlueprintToDNABoostRatio; } if (DNABlueprintsType == "Intelligence") { comboIntelligence.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintIntelligence", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboIntelligence.Enabled = true; total = (comboIntelligence.Value) / RebirthVariables.geneticsBlueprintToDNABoostRatio; } if (DNABlueprintsType == "Charisma") { comboCharisma.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintCharisma", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboCharisma.Enabled = true; total = (comboCharisma.Value) / RebirthVariables.geneticsBlueprintToDNABoostRatio; } LabelTotal.Text = ((int)total).ToString(); } private void ResetDNABlueprintsCount(EntityPlayer player, string DNABlueprintsType) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-ResetDNABlueprintsCount START"); comboStrength.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintStrength", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboDexterity.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintDexterity", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboConstitution.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintConstitution", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboIntelligence.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintIntelligence", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; comboCharisma.Max = (RebirthUtilities.GetNonProtectedBagItemCount(ItemClass.GetItem("geneticBlueprintCharisma", false), player) / RebirthVariables.geneticsBlueprintToDNABoostRatio) * RebirthVariables.geneticsBlueprintToDNABoostRatio; if (DNABlueprintsType == "Strength") { comboStrength.Value = comboStrength.Max; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-ResetDNABlueprintsCount comboStrength.Value: " + comboStrength.Value); comboDexterity.Max = 0; comboConstitution.Max = 0; comboIntelligence.Max = 0; comboCharisma.Max = 0; comboDexterity.Value = 0; comboConstitution.Value = 0; comboIntelligence.Value = 0; comboCharisma.Value = 0; } if (DNABlueprintsType == "Dexterity") { comboDexterity.Value = comboDexterity.Max; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-ResetDNABlueprintsCount comboDexterity.Value: " + comboDexterity.Value); comboStrength.Max = 0; comboConstitution.Max = 0; comboIntelligence.Max = 0; comboCharisma.Max = 0; comboStrength.Value = 0; comboConstitution.Value = 0; comboIntelligence.Value = 0; comboCharisma.Value = 0; } if (DNABlueprintsType == "Constitution") { comboConstitution.Value = comboConstitution.Max; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-ResetDNABlueprintsCount comboConstitution.Value: " + comboConstitution.Value); comboStrength.Max = 0; comboDexterity.Max = 0; comboIntelligence.Max = 0; comboCharisma.Max = 0; comboStrength.Value = 0; comboDexterity.Value = 0; comboIntelligence.Value = 0; comboCharisma.Value = 0; } if (DNABlueprintsType == "Intelligence") { comboIntelligence.Value = comboIntelligence.Max; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-ResetDNABlueprintsCount comboIntelligence.Value: " + comboIntelligence.Value); comboStrength.Max = 0; comboDexterity.Max = 0; comboConstitution.Max = 0; comboCharisma.Max = 0; comboStrength.Value = 0; comboDexterity.Value = 0; comboConstitution.Value = 0; comboCharisma.Value = 0; } if (DNABlueprintsType == "Charisma") { comboCharisma.Value = comboCharisma.Max; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-ResetDNABlueprintsCount comboCharisma.Value: " + comboCharisma.Value); comboStrength.Max = 0; comboDexterity.Max = 0; comboConstitution.Max = 0; comboIntelligence.Max = 0; comboStrength.Value = 0; comboDexterity.Value = 0; comboConstitution.Value = 0; comboIntelligence.Value = 0; } CalculateDNABlueprintsTotal(player); spriteDNABoostImage.SpriteName = "ui_game_symbol_FR_DNA" + cbxDNABoostType.Value + "_icon"; } private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed START"); int totalReceived = Int32.Parse(LabelTotal.Text); if (totalReceived == 0) { return; } EntityPlayer player = xui.playerUI.entityPlayer; string DNABlueprintsType = cbxDNABoostType.Value; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed DNABlueprintsType: " + DNABlueprintsType); string itemTradeFor = ""; int numStrength = (int)(comboStrength.Value / RebirthVariables.geneticsBlueprintToDNABoostRatio); if (numStrength > 0 && DNABlueprintsType == "Strength") { itemTradeFor = "FuriousRamsayPillStrength"; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed dec Strength: " + numStrength); RebirthUtilities.DecBagItem(ItemClass.GetItem("geneticBlueprintStrength", false), numStrength * RebirthVariables.geneticsBlueprintToDNABoostRatio, player); } int numDexterity = (int)(comboDexterity.Value / RebirthVariables.geneticsBlueprintToDNABoostRatio); if (numDexterity > 0 && DNABlueprintsType == "Dexterity") { itemTradeFor = "FuriousRamsayPillDexterity"; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed dec Dexterity: " + numDexterity); RebirthUtilities.DecBagItem(ItemClass.GetItem("geneticBlueprintDexterity", false), numDexterity * RebirthVariables.geneticsBlueprintToDNABoostRatio, player); } int numConstitution = (int)(comboConstitution.Value / RebirthVariables.geneticsBlueprintToDNABoostRatio); if (numConstitution > 0 && DNABlueprintsType == "Constitution") { itemTradeFor = "FuriousRamsayPillConstitution"; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed dec Constitution: " + numConstitution); RebirthUtilities.DecBagItem(ItemClass.GetItem("geneticBlueprintConstitution", false), numConstitution * RebirthVariables.geneticsBlueprintToDNABoostRatio, player); } int numIntelligence = (int)(comboIntelligence.Value / RebirthVariables.geneticsBlueprintToDNABoostRatio); if (numIntelligence > 0 && DNABlueprintsType == "Intelligence") { itemTradeFor = "FuriousRamsayPillIntelligence"; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed dec Intelligence: " + numIntelligence); RebirthUtilities.DecBagItem(ItemClass.GetItem("geneticBlueprintIntelligence", false), numIntelligence * RebirthVariables.geneticsBlueprintToDNABoostRatio, player); } int numCharisma = (int)(comboCharisma.Value / RebirthVariables.geneticsBlueprintToDNABoostRatio); if (numCharisma > 0 && DNABlueprintsType == "Charisma") { itemTradeFor = "FuriousRamsayPillCharisma"; //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnConfirm_OnPressed dec Charisma: " + numCharisma); RebirthUtilities.DecBagItem(ItemClass.GetItem("geneticBlueprintCharisma", false), numCharisma * RebirthVariables.geneticsBlueprintToDNABoostRatio, player); } ItemValue itemReceived = ItemClass.GetItem(itemTradeFor, false); RebirthUtilities.addToPlayerInventory(itemReceived, player, totalReceived); xui.playerUI.windowManager.Close(windowGroup.ID); } private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton) { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-BtnCancel_OnPressed START"); Panel.IsVisible = false; xui.playerUI.windowManager.Close(windowGroup.ID); } public override void OnClose() { //Log.Out("XUiC_TradeDNABlueprintsForBoostsRebirth-OnClose START"); if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog")) xui.playerUI.windowManager.Close("dialog"); base.OnClose(); } }