Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        private void RenderObject(LayEntity obj)
        {
            OGLTexture text = Textures.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Objects\" + obj.EntityDescriptionID + ".png"));

            if (text == null)
            {
                OGLTools.DrawFilledRectangle(Color.Green, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize));
                return;
            }

            OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize), 1f);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        private void RenderDebugPattern()
        {
            LayEntity ent = Plugin.LayFile.FindEntity("13029");

            if (ent == null)
            {
                return;
            }

            // draw the console!
            OGLTexture text = Textures.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Objects\13029.png"));

            //OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(ent.Pattern.Location.X * BoxSize - m_PositionX, ent.Pattern.Location.Y * BoxSize - m_PositionY), text.Size, 1.0f);
            OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(GetPosition(ent.Pattern.Location.X * BoxSize) - m_PositionX + BoxSize, GetPosition(ent.Pattern.Location.Y * BoxSize) - m_PositionY + BoxSize), new Position2D(ent.Pattern.Location.X * BoxSize - m_PositionX + BoxSize * 5, ent.Pattern.Location.Y * BoxSize - m_PositionY + BoxSize + BoxSize), 1.0f);

            OGLTools.DrawRectangle(Color.Red, new Position2D(ent.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, ent.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize));
        }
Esempio n. 7
0
        private void oGL_Click_1(object sender, EventArgs e)
        {
            LayMapTile tile = m_LastHoveredTile;

            if (tile == null)
            {
                return;
            }

            LayEntity parent = Plugin.LayFile.FindEntityByGridLocation(tile.Position.X, tile.Position.Y);

            if (parent == null)
            {
                return;
            }
            if (parent.TilesGrid.Tiles.Count > 0)
            {
                MapTools.UnselectAllTiles();
                MapTools.SelectGrid(parent.TilesGrid);
            }
        }
Esempio n. 8
0
        void frmMapEditor_Click(object sender, EventArgs e)
        {
            LayEntity obj = (LayEntity)((ToolStripMenuItem)sender).OwnerItem.Tag;

            obj.Delete();
        }
Esempio n. 9
0
        void pendingDeletion_Click(object sender, EventArgs e)
        {
            LayEntity obj = (LayEntity)((ToolStripMenuItem)sender).OwnerItem.Tag;

            obj.UndoDelete();
        }
Esempio n. 10
0
        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;
                }
            }
        }
Esempio n. 11
0
        private void LoadFields(EvilPlug.Filetypes.Lay.LayFile layObject)
        {
            try
            {
                txtMoney.Text = layObject.FindProperty("Cash").Value;
                if (layObject.FindProperty("GeniusEntityID") == null)
                {
                    throw new Exception("Invalid savegame.");
                }

                m_GeniusEntityID = layObject.FindProperty("GeniusEntityID").Value;

                cmbAlertState.SelectedIndex = int.Parse(layObject.FindProperty("AlertStatus").Value);
                cmbDifficulty.SelectedIndex = int.Parse(layObject.FindProperty("DifficultyLevel").Value);

                // Find the evil genius entry
                m_EvilGenius = layObject.FindEntityById(m_GeniusEntityID);

                txtEGHealth.Text    = m_EvilGenius.Stats.Health;
                txtEGName.Text      = m_EvilGenius.Name;
                txtEGID.Text        = m_EvilGenius.EntityDescriptionID;
                txtEGLoyalty.Text   = m_EvilGenius.Stats.Loyalty;
                txtEGSmarts.Text    = m_EvilGenius.Stats.Smarts;
                txtEGAttention.Text = m_EvilGenius.Stats.Attention;
                txtEGEndurance.Text = m_EvilGenius.Stats.Endurance;

                // Load the minion recruitment fields
                for (int c = 0; c < grpRec.Controls.Count; c++)
                {
                    Control ctrl = grpRec.Controls[c];

                    if (ctrl.GetType() == typeof(TextBox))
                    {
                        string minID = (string)((TextBox)ctrl).Tag;

                        // Load minion stuff
                        List <LayProperty> props = SaveGamePlugin.LayFile.FindProperties("DesiredMinionCount");

                        for (int i = 0; i < props.Count; i++)
                        {
                            LayProperty prop = props[i];

                            try
                            {
                                if (prop.Value.Substring(0, 4) == minID + ",")
                                {
                                    ((TextBox)ctrl).Text = prop.Value.Substring(prop.Value.IndexOf(",") + 1);
                                    break;
                                }
                            }
                            catch { }
                        }
                    }
                }

                txtRecCost.Text = layObject.FindProperty("MinionRecruitmentCost").Value;
                txtRecRate.Text = layObject.FindProperty("MinionRecruitmentRate").Value;
                txtRecTime.Text = layObject.FindProperty("SecondsSinceLastAutoSpawned").Value;

                txtBasePower.Text = layObject.FindProperty("BasePowerSupply").Value;

                #region Load henchmen tab
                string[] henchmenIds = new string[] { "500", "501", "502", "503", "504", "505", "507", "508", "509", "510", "511" };
                string[] henchNames  = new string[] { "Moko the big strong dumb one.", "Jubei the Samurai swordsman and sushi master.", "Eli the hard-hitting, fast-talking gangster.", "Red Ivan, always ready for action.", "Montezuma, the dark and sinister voodoo man.", "The Matron - isn't it past your bedtime?", "Lord Kane, the arch-conspirator himself.", "That looks nasty, would you like me to take a closer look?", "Look into my eye, you are feeling sleepy...", "The charming Dr Neurocide, insane or genius ahead of her time?", "Colonel Blackheart, he has your trail." };

                bool found       = false;
                int  locModifier = 0;

                GroupBox baseBox = null;

                for (int c = 0; c < tabHenchman.Controls.Count; c++)
                {
                    Control ctrl = tabHenchman.Controls[c];

                    if (ctrl.GetType() != typeof(GroupBox))
                    {
                        continue;
                    }

                    baseBox = (GroupBox)ctrl;
                    break;
                }
                int ix = 0;

                // evilHench1
                int cntx = -1;
                foreach (string hID in henchmenIds)
                {
                    LayEntity hench = SaveGamePlugin.LayFile.FindEntity(hID);
                    cntx++;
                    if (hench == null)
                    {
                        continue;
                    }
                    string           henchName = henchNames[cntx];
                    EvilHenchControl ectrl     = new EvilHenchControl();
                    tabHenchman.SuspendLayout();
                    tabHenchman.Controls.Add(ectrl);
                    ectrl.Tag  = hID;
                    ectrl.Left = 0;
                    ectrl.Top  = 0 + (ectrl.Height * ix);
                    ectrl.BringToFront();
                    ectrl.Text = henchName;
                    tabHenchman.ResumeLayout();
                    tabHenchman.PerformLayout();
                    tabHenchman.Refresh();
                    ix++;
                }

                foreach (string hID in henchmenIds)
                {
                    // See if we have the henchman
                    LayEntity hench = SaveGamePlugin.LayFile.FindEntity(hID);
                    if (hench == null)
                    {
                        found = false;
                    }
                    else
                    {
                        found = true;
                    }


                    for (int c = 0; c < tabHenchman.Controls.Count; c++)
                    {
                        Control ctrl = tabHenchman.Controls[c];

                        if (ctrl.GetType() != typeof(EvilHenchControl))
                        {
                            continue;
                        }

                        EvilHenchControl evilHench = (EvilHenchControl)ctrl;

                        GroupBox hBox = evilHench.groupBox2;

                        if ((string)evilHench.Tag == hID)
                        {
                            evilHench.Entity = hench;
                        }
                    }
                }
                #endregion


                #region Load regions tab
                string[] regionIds = new string[] { "1550", "1551", "1552", "1553", "1554" }; // TODO order alphabetical

                cntx = -1;
                ix   = 0;
                int regHeight = lblTotalNotoriety.Height;

                foreach (string rID in regionIds)
                {
                    LayEntity region = SaveGamePlugin.LayFile.FindEntity(rID);
                    cntx++;
                    if (region == null)
                    {
                        continue;
                    }
                    EvilRegionControl ectrl = new EvilRegionControl();
                    tabRegions.SuspendLayout();
                    tabRegions.Controls.Add(ectrl);
                    ectrl.Tag  = rID;
                    ectrl.Left = 0;
                    ectrl.Top  = regHeight + (ectrl.Height * ix);
                    ectrl.BringToFront();
                    tabRegions.ResumeLayout();
                    tabRegions.PerformLayout();
                    tabRegions.Refresh();
                    m_Regions.Add(ectrl);
                    ix++;
                }

                foreach (string rID in regionIds)
                {
                    // See if we have the henchman
                    LayEntity region = SaveGamePlugin.LayFile.FindEntity(rID);
                    if (region == null)
                    {
                        found = false;
                    }
                    else
                    {
                        found = true;
                    }


                    for (int c = 0; c < tabRegions.Controls.Count; c++)
                    {
                        Control ctrl = tabRegions.Controls[c];

                        if (ctrl.GetType() != typeof(EvilRegionControl))
                        {
                            continue;
                        }

                        EvilRegionControl evilRegion = (EvilRegionControl)ctrl;


                        if ((string)evilRegion.Tag == rID)
                        {
                            evilRegion.Entity = region;
                        }
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                lblStatus.Text          = "Error loading saved game: " + ex.Message;
                tmrLoadProgress.Enabled = false;
                tabEditor.Enabled       = false;
            }
        }