private void btnFixStuckFleeing_Click(object sender, EventArgs evar) { DialogResult res = MessageBox.Show("Do you want to try fix stuck minions? If so, make sure you do not save to the same map file OR have made a backup!", "Confirm fix", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (res == DialogResult.Cancel) { return; } int fixedMinions = 0; LayFile lay = SaveGamePlugin.LayFile; List <LayEntity> entities = new List <LayEntity>(); for (int i = 100; i < 113; i++) { entities = lay.FindEntities(i.ToString()); for (int e = 0; e < entities.Count; e++) { LayEntity minion = entities[e]; if (minion.Stats.Health.ToInteger() < 1) { if ((minion.GetProperty("IsDead") != null) || (minion.GetProperty("IsUnconscious") != null) || (minion.GetProperty("IsIncapacitated") != null)) { continue; } minion.GetProperty("EarmarkedForEntityID").Value = "0"; minion.GetProperty("ForceDesert").Value = "false"; if (minion.GetProperty("InteractionObject") != null) { minion.GetProperty("InteractionObject").Deleted = true; } if (minion.GetProperty("InteractionSlotIndex") != null) { minion.GetProperty("InteractionSlotIndex").Deleted = true; } if (minion.GetProperty("InteractionTermReq") != null) { minion.GetProperty("InteractionTermReq").Deleted = true; } fixedMinions++; } } } MessageBox.Show("Fixed " + fixedMinions.ToString() + " minion(s). Be sure to test out if the fix worked!", "Fix applied.", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void txtMoney_TextChanged(object sender, EventArgs e) { SaveGamePlugin.LayFile.FindProperty("Cash").Value = (((int)(txtMoney.Text.ToInteger() / 500)) * 500).ToString(); LayEntity lt = SaveGamePlugin.LayFile.FindEntity("13007"); if (lt == null) { return; } lt.GetProperty("NumGoldBars").Value = ((int)(txtMoney.Text.ToInteger() / 500)).ToString(); List <LayEntity> allGoldBars = SaveGamePlugin.LayFile.FindEntities("13007"); for (int i = 0; i < allGoldBars.Count; i++) { if (allGoldBars[i] == lt) { continue; } allGoldBars[i].Delete(); } }
private void btlCleanDeadMinions_Click(object sender, EventArgs ex) { DialogResult res = MessageBox.Show("Do you want to try clean hidden dead minions? If so, make sure you do not save to the same map file OR have made a backup!", "Confirm fix", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (res == DialogResult.Cancel) { return; } int fixedMinions = 0; LayFile lay = SaveGamePlugin.LayFile; List <LayEntity> entities = new List <LayEntity>(); for (int i = 100; i < 113; i++) { entities = lay.FindEntities(i.ToString()); for (int e = 0; e < entities.Count; e++) { LayEntity minion = entities[e]; if (minion.Stats.Health.ToInteger() < 1) { if ((minion.GetProperty("IsDead") != null) && (minion.GetProperty("IsUnconscious") != null) && (minion.GetProperty("IsIncapacitated") != null) && (minion.GetProperty("Destroyed") != null) && (minion.GetProperty("NotInGame") == null)) { int cnt = 0; List <LayProperty> props = lay.FindProperties("EntityID"); foreach (LayProperty prop in props) { if (prop.Value == minion.EntityID) { cnt++; } } if (cnt == 1) { minion.Delete(); fixedMinions++; } } } } } MessageBox.Show("Cleaned " + fixedMinions.ToString() + " dead hidden minion(s). Be sure to test out if the fix worked!", "Fix applied.", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void comboFields_SelectedIndexChanged(object sender, EventArgs e) { string tag = (string)((ComboBox)sender).Tag; int selectedItem = ((ComboBox)sender).SelectedIndex; string text = ((ComboBox)sender).SelectedItem.ToString(); switch (tag) { case "Lives": m_Entity.Stats.Lives = text; break; case "Skill1": m_Entity.GetProperty("SpecialAbility", 1).Value = text; break; case "Skill2": m_Entity.GetProperty("SpecialAbility", 2).Value = text; break; } // ((Control)sender).Text = text; }
private void ProcessEntity(LayEntity value) { txtHeat.Text = m_Entity.GetProperty("HeatLevel").Value; txtNotoriety.Text = m_Entity.GetProperty("NotorietyLevel").Value; txtTouristNumber.Text = m_Entity.GetProperty("DesiredTouristPopulation").Value; if (m_Entity.GetProperty("SuperAgentLocked").Value == "true") { chkAUnlocked.Checked = false; } else { chkAUnlocked.Checked = true; } if (m_Entity.GetProperty("SuperAgentDefeated").Value == "true") { chkADefeated.Checked = true; } else { chkADefeated.Checked = false; } groupBox1.Text = RegionName; }
private void ProcessEntity(LayEntity value) { LayEntity hench = m_Entity; GroupBox hBox = groupBox2; for (int c2 = 0; c2 < hBox.Controls.Count; c2++) { Control ctrl2 = hBox.Controls[c2]; string ctrlTag = (string)ctrl2.Tag; switch (ctrlTag) { case "Name": ((TextBox)ctrl2).Text = hench.Name; break; case "Health": ((TextBox)ctrl2).Text = hench.Stats.Health; break; case "Smarts": ((TextBox)ctrl2).Text = hench.Stats.Smarts; break; case "Loyalty": ((TextBox)ctrl2).Text = hench.Stats.Loyalty; break; case "Endurance": ((TextBox)ctrl2).Text = hench.Stats.Endurance; break; case "Attention": ((TextBox)ctrl2).Text = hench.Stats.Attention; break; case "Lives": try { ((ComboBox)ctrl2).SelectedIndex = hench.Stats.Lives.ToInteger(); } catch { } break; case "Abilities": // groupbox for (int c3 = 0; c3 < ((GroupBox)ctrl2).Controls.Count; c3++) { Control ctrl3 = ((GroupBox)ctrl2).Controls[c3]; int index = 0; switch ((string)ctrl3.Tag) { case "Skill1": ComboBox cbS1 = (ComboBox)ctrl3; foreach (string skill in cbS1.Items) { if (skill == hench.GetProperty("SpecialAbility", 1).Value) { cbS1.SelectedIndex = index; break; } index++; } break; case "Skill2": ComboBox cbS2 = (ComboBox)ctrl3; foreach (string skill in cbS2.Items) { if (skill == hench.GetProperty("SpecialAbility", 2).Value) { cbS2.SelectedIndex = index; break; } index++; } break; case "Skill1Learned": CheckBox cb1 = (CheckBox)ctrl3; if (hench.GetProperty("TrainingComplete", 1).Value == "true") { cb1.Checked = true; } else { cb1.Checked = false; } break; case "Skill2Learned": CheckBox cb2 = (CheckBox)ctrl3; if (hench.GetProperty("TrainingComplete", 2).Value == "true") { cb2.Checked = true; } else { cb2.Checked = false; } break; } } break; } } }