コード例 #1
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            MyClass skriptum = (MyClass)type;

            // @SCRIPT SetupType
        }
コード例 #2
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            GameString gameString = (GameString)type;

            //Language_cbb_SelectedIndexChanged();
        }
コード例 #3
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            Skill skill = (Skill)type;

            #region Translation / Description

            description_txt.Text = skill.Description;

            Language_cbb_SelectedIndexChanged();

            #endregion

            #region Flags & MaxLevel

            ulong flags         = skill.FlagsGZ;
            int   baseAttribute = (int)(flags & 0xF);
            switch (baseAttribute)
            {
            //case 0:
            //    str_rb.Checked = true;
            //    break;
            case 1:
                agi_rb.Checked = true;
                break;

            case 2:
                int_rb.Checked = true;
                break;

            case 3:
                cha_rb.Checked = true;
                break;

            default:
                str_rb.Checked = true;
                break;
            }

            if ((flags & 0x10) == 0x10)
            {
                effects_party_cb.Checked = true;
            }

            if ((flags & 0x100) == 0x100)
            {
                inactive_cb.Checked = true;
            }

            maxLevel_num.Value = skill.MaxLevel;

            #endregion
        }
コード例 #4
0
        protected Skriptum GetTypeByID(string typeID)
        {
            Skriptum typeX = null;

            for (int i = 0; i < types.Count; i++)
            {
                if (types[i].ID.Equals(typeID))
                {
                    typeX = types[i];
                    i     = types.Count;
                }
            }
            return(typeX);
        }
コード例 #5
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            Quest quest = (Quest)type;

            #region Translation / Description

            //description_txt.Text = skill.Description;

            Language_cbb_SelectedIndexChanged();

            #endregion

            #region Flags & MaxLevel



            #endregion
        }
コード例 #6
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            string tmp = string.Empty;

            tmp += values[0] + ';';
            tmp += values[1] + ';';

            // @SCRIPT SaveTypeByIndex

            values.Clear();
            values = new List <string>(tmp.Split(';'));

            string[] valuesX = values.ToArray();
            MyClass  obj     = new MyClass(valuesX);

            CodeWriter.SavePseudoCodeByType(obj, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, changed);
        }
コード例 #7
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            string tmp = values[0] + ';';

            tmp += values[1] + ';';
            tmp += GetFlags() + ";";

            values.Clear();
            values = new List <string>(tmp.Split(';'));

            string[] valuesX = values.ToArray();
            Quest    q       = new Quest(valuesX);

            CodeWriter.SavePseudoCodeByType(q, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, changed);
        }
コード例 #8
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            string tmp = values[0] + ';';

            tmp += values[1] + ';';
            tmp += GetFlags() + ";";
            tmp += maxLevel_num.Value + ';';
            tmp += description_txt.Text.Replace(' ', '_');

            values.Clear();
            values = new List <string>(tmp.Split(';'));

            string[] valuesX = values.ToArray();
            Skill    s       = new Skill(valuesX);

            CodeWriter.SavePseudoCodeByType(s, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, changed);
        }
コード例 #9
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            string tmp = values[0] + " " + GetFlags();

            //language_cbb.SelectedIndex = LANGUAGE_EN_GZ;
            //tmp += ' ' + singleNameTranslation_txt.Text.Replace(' ', '_');
            //tmp += ' ' + name_txt.Text.Replace(' ', '_');
            tmp += ' ' + values[1];

            tmp += ' ' + meshName_txt.Text;
            tmp += SourceReader.GetCompiledCodeLines(opCodes_rtb.Lines);
            tmp += " " + (mno_choose_lb.Items.Count - 1);
            tmp += ';';

            foreach (GameMenuOption c_mno in currentGameMenuOptions)
            {
                tmp += " " + c_mno.Name;
                tmp += SourceReader.GetCompiledCodeLines(c_mno.ConditionBlock);
                tmp += " " + c_mno.Text.Replace(' ', '_');
                tmp += SourceReader.GetCompiledCodeLines(c_mno.ConsequenceBlock);
                tmp += " " + c_mno.DoorText.Replace(' ', '_') + ' ';
            }

            values.Clear();
            values = new List <string>(tmp.Split(';'));

            string[] valuesX = values.ToArray();
            GameMenu m       = new GameMenu(valuesX);

            CodeWriter.SavePseudoCodeByType(m, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, m);
        }
コード例 #10
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            Troop troop = (Troop)type;

            #region GROUP1 - Flags & Guarantee

            troopTypes_lb.SelectedIndex = (int)(troop.FlagsGZ & 0xF);
            if (troop.FlagsGZ > 0)
            {
                foreach (string flag in troop.Flags.Split('|'))
                {
                    Control[] cc = groupBox_1_gb.Controls.Find(flag.Substring(3) + "_cb", false);
                    if (cc.Length == 1 && !flag.Contains("tf_guarantee_"))
                    {
                        ((CheckBox)cc[0]).CheckState = CheckState.Checked;
                    }
                    //else if (cc.Length > 1 && !flag.Contains("tf_guarantee_"))
                    //    MessageBox.Show("ERROR: Double Flags found! --> " + cc.Length); // enable if needed again
                    else
                    {
                        for (int i = 0; i < guarantee_gb.Controls.Count; i++)
                        {
                            CheckBox c = (CheckBox)guarantee_gb.Controls[i];
                            if (c.Name.Remove(c.Name.LastIndexOf('_')).Equals(flag.Replace("tf_guarantee_", string.Empty)))
                            {
                                c.CheckState = CheckState.Checked;
                                i            = guarantee_gb.Controls.Count;
                            }
                        }
                    }
                }
            }

            #endregion

            #region GROUP2 - Faction & Special Values

            factions_lb.SelectedIndex = troop.FactionID;
            reserved_txt.Text         = troop.Reserved;
            string[] sceneCode = troop.SceneCode.Split('|');
            if (IsNumeric(sceneCode[0]))
            {
                scenes_lb.SelectedIndex = int.Parse(sceneCode[0]);
            }
            else
            {
                scenes_lb.SelectedIndex = 0;
            }
            if (sceneCode.Length > 1)
            {
                entryPoint_numeric.Value = byte.Parse(sceneCode[1]);
            }

            #endregion

            #region GROUP3 - Items

            IsDataLoaded = false;

            foreach (int itemID in troop.Items)
            {
                Item itemX = (Item)itemsRList[itemID];
                AddItemToInventarComboboxByKind(itemID, itemX.Prefix + itemX.ID);
                usedItems_lb.Items.Add(itemID + " - " + itemX.Prefix + itemX.ID);
            }

            inventoryItemFlags = troop.ItemFlags;

            SelectFirstInventarComboBoxItems();

            #endregion

            #region GROUP4 - Attributes & Level

            str_txt.Text = troop.Strength.ToString();
            agi_txt.Text = troop.Agility.ToString();
            int_txt.Text = troop.Intelligence.ToString();
            cha_txt.Text = troop.Charisma.ToString();

            level_txt.Text = troop.Level.ToString();

            #endregion

            #region GROUP5 - Proficiencies

            onehandedWeapon_txt.Text = troop.OneHanded.ToString();
            twohandedWeapon_txt.Text = troop.TwoHanded.ToString();
            polearms_txt.Text        = troop.Polearm.ToString();
            archery_txt.Text         = troop.Archery.ToString();
            crossbows_txt.Text       = troop.Crossbow.ToString();
            throwing_txt.Text        = troop.Throwing.ToString();
            firearms_txt.Text        = troop.Firearm.ToString();

            #endregion

            #region GROUP6 - Skills

            SetupTroopSkills(troop);

            #endregion

            #region GROUP7 - Upgrade Paths

            if (troop.UpgradeTroop1 < upgradeTroop1_lb.Items.Count)
            {
                upgradeTroop1_lb.SelectedIndex = troop.UpgradeTroop1;
            }
            else
            {
                MessageBox.Show("TROOP_UPGRADE_PATH1:" + Environment.NewLine + troop.UpgradeTroop1ErrorCode, Application.ProductName + " : Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (troop.UpgradeTroop2 < upgradeTroop2_lb.Items.Count)
            {
                upgradeTroop2_lb.SelectedIndex = troop.UpgradeTroop2;
            }
            else
            {
                MessageBox.Show("TROOP_UPGRADE_PATH2:" + Environment.NewLine + troop.UpgradeTroop2ErrorCode, Application.ProductName + " : Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            #endregion

            #region GROUP8 - Face

            face1_txt.Text = troop.Face1;
            face2_txt.Text = troop.Face2;

            var troopType  = troop.GetTroopType();
            var mergedFace = Face.MergeTroopFaces(troop);

            // - - -

            skin_tb.Maximum = mergedFace.MaxSkin;
            skin_tb.Value   = (int)mergedFace.Skin;

            if (troopType.HasHair)
            {
                hair_tb.Maximum = mergedFace.MaxHair;
                hair_tb.Value   = (int)mergedFace.Hair;
            }
            hair_lbl.Visible = troopType.HasHair;
            hair_tb.Visible  = troopType.HasHair;

            if (troopType.HasBeard)
            {
                beard_tb.Maximum = mergedFace.MaxBeard;
                beard_tb.Value   = (int)mergedFace.Beard;
            }
            beard_lbl.Visible = troopType.HasBeard;
            beard_tb.Visible  = troopType.HasBeard;

            // - - -

            age_tb.Maximum = Face.MAX_AGE_P;
            age_tb.Value   = (int)mergedFace.Age;

            hairColor_tb.Maximum = Face.MAX_HAIR_COLOR_P;
            hairColor_tb.Value   = (int)mergedFace.HairColorCode;

            #endregion
        }
コード例 #11
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            string tmp = values[0] + " " + values[1] + " " + GetFlags() + " " + menuID_cbb.SelectedIndex + " " + faction_cbb.SelectedIndex + " " + GetPersonality();

            for (int i = 0; i < stack_troops_lb.Items.Count; i++)
            {
                tmp += " " + CodeReader.Troops.IndexOf("trp_" + stack_troops_lb.Items[i].ToString()) + " " + memberValues[i][0] + " " + memberValues[i][1] + " " + memberValues[i][2];
            }

            //for invalid troops
            for (int i = 0; i < 6 - stack_troops_lb.Items.Count; i++)
            {
                tmp += " -1 0 0 0";
            }
            //for invalid troops

            values.Clear();
            foreach (string value in tmp.Split())
            {
                values.Add(value);
            }
            values[0] = values[0].Substring(3);

            string[]      valuesX = values.ToArray();
            PartyTemplate p       = new PartyTemplate(valuesX);

            CodeWriter.SavePseudoCodeByType(p, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, p);
        }
コード例 #12
0
 protected virtual void Exit_btn_Click(object sender, EventArgs e)
 {
     ResetToOriginalModule();
     SelectedType = null;
 }
コード例 #13
0
 protected virtual void Types_cbb_SelectedIndexChanged(object sender, EventArgs e)
 {
     SelectedType = GetTypeByID(type_cbb.SelectedItem.ToString());
     addTypeFromMod_btn.Enabled = true;
     TypeMode = true;
 }
コード例 #14
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            GameMenu menu = (GameMenu)type;

            name_txt.Text = menu.Text;

            #region Group2 - Flags & Textcolor & Meshname

            meshName_txt.Text = menu.MeshName;

            List <string> flags = new List <string>(menu.Flags.Split('|'));

            if (flags.Contains("mnf_join_battle"))
            {
                mnf_join_battle_cb.Checked = true;
            }
            if (flags.Contains("mnf_auto_enter"))
            {
                mnf_auto_enter_cb.Checked = true;
            }
            if (flags.Contains("mnf_enable_hot_keys"))
            {
                mnf_enable_hot_keys_cb.Checked = true;
            }
            if (flags.Contains("mnf_disable_all_keys"))
            {
                mnf_disable_all_keys_cb.Checked = true;
            }
            if (flags.Contains("mnf_scale_picture"))
            {
                mnf_scale_picture_cb.Checked = true;
            }

            for (int i = 0; i < flags.Count; i++)
            {
                if (flags[i].Contains("menu_text_color"))
                {
                    string tmp = flags[i].Substring(flags[i].IndexOf('(') + 1);
                    tmp = tmp.Remove(tmp.IndexOf(')'));
                    hexColor_txt.Text = tmp;
                    i = flags.Count;
                }
            }

            //MessageBox.Show(HexConverter.Dec2Hex_16CHARS(menu.FlagsGZ));

            /*
             * mnf_join_battle            = 0x00000001 #Consider this menu when the player joins a battle
             * mnf_auto_enter             = 0x00000010 #Automatically enter the town with the first menu option.
             * mnf_enable_hot_keys        = 0x00000100 #Enables P,I,C keys
             * mnf_disable_all_keys       = 0x00000200 #Disables all keys
             * mnf_scale_picture          = 0x00001000 #Scale menu picture to offest screen aspect ratio
             * def menu_text_color(color):*/

            #endregion

            #region Group3 - Operations Code

            string[] opCode = menu.OperationBlock;
            foreach (string codeLine in opCode)
            {
                opCodes_rtb.AppendText(codeLine + Environment.NewLine);
            }

            #endregion

            #region Group4 - Menu Options

            mno_choose_lb.Items.Clear(); // Check why this isn't cleared automaticly

            currentGameMenuOptions = new List <GameMenuOption>(menu.MenuOptions);
            foreach (GameMenuOption mno in currentGameMenuOptions)
            {
                mno_choose_lb.Items.Add(mno.Name);
            }

            //if (mno_choose_lb.Items.Count == 0)
            mno_choose_lb.Items.Add(NEW_OPTION);

            mno_choose_lb.SelectedIndex = 0;

            #endregion
        }
コード例 #15
0
        protected override void SetupType(Skriptum type)
        {
            base.SetupType(type);

            Party party = (Party)type;

            name_txt.Text = party.Name;

            #region GROUP2 - Flags

            List <string> flags    = new List <string>(party.Flags.Split('|'));
            List <string> mapicons = new List <string>(CodeReader.MapIcons);

            map_icon_cbb.SelectedIndex = mapicons.IndexOf(flags[0]);

            if (flags.Contains("pf_label_large"))
            {
                large_label_rb.Checked = true;
            }
            else if (flags.Contains("pf_label_medium"))
            {
                medium_label_rb.Checked = true;
            }
            else if (flags.Contains("pf_label_small"))
            {
                small_label_rb.Checked = true;
            }
            if (flags.Contains("pf_no_label"))
            {
                no_label_rb.Checked = true;
            }

            Control c;
            string  nameEnd;
            bool    found = false;
            foreach (string flag in flags)
            {
                for (int i = 0; i < groupBox_1_gb.Controls.Count; i++)
                {
                    c       = groupBox_1_gb.Controls[i];
                    nameEnd = GetNameEndOfControl(c);
                    if (flag.Equals("pf_" + c.Name.Remove(c.Name.LastIndexOf('_'))))
                    {
                        if (nameEnd.Equals("rb"))
                        {
                            ((RadioButton)c).Checked = true;
                        }
                        else
                        {
                            ((CheckBox)c).CheckState = CheckState.Checked;
                        }
                        found = true;
                    }
                    else if (flag.Contains("carries_"))
                    {
                        string f = flag.Substring(flag.IndexOf('(') + 1).Split(')')[0];
                        if (flag.Contains("goods"))
                        {
                            carries_goods_txt.Text = f;
                        }
                        else
                        {
                            carries_gold_txt.Text = f;
                        }
                        found = true;
                    }
                    if (found)
                    {
                        i = groupBox_1_gb.Controls.Count;
                    }
                }
            }

            #endregion

            #region GROUP3

            menuID_cbb.SelectedIndex         = party.MenuID;
            party_template_cbb.SelectedIndex = party.PartyTemplateID;
            faction_cbb.SelectedIndex        = party.FactionID;
            ai_bhvr_cbb.SelectedIndex        = party.AIBehavior;
            ai_target_p_cbb.SelectedIndex    = party.AITargetParty;

            #endregion

            #region GROUP4

            char[] personality = HexConverter.Dec2Hex(party.Personality).ToString().Substring(5).ToCharArray();
            courage_num.Value        = int.Parse(personality[0].ToString());
            aggressiveness_num.Value = int.Parse(personality[1].ToString());
            if (personality[2] != '0')
            {
                banditness_cb.CheckState = CheckState.Checked;
            }
            double[] coords = party.InitialCoordinates;
            x_axis_txt.Text = CodeReader.Repl_CommaWDot(coords[0].ToString());
            y_axis_txt.Text = CodeReader.Repl_CommaWDot(coords[1].ToString());
            direction_in_degrees_txt.Text = CodeReader.Repl_CommaWDot(party.PartyDirectionInDegrees.ToString());

            #endregion

            #region Stack Troops - GROUP5

            memberValues.Clear();
            stack_troops_lb.Items.Clear();
            if (party.Members.Length > 0)
            {
                foreach (PMember member in party.Members)
                {
                    stack_troops_lb.Items.Add(member.Troop);
                    int[] values = new int[3];
                    values[0] = member.MinimumTroops;
                    values[1] = member.MaximumTroops;
                    values[2] = member.Flags;
                    memberValues.Add(values);
                }
                if (party.Members.Length > 0)
                {
                    stack_troops_lb.SelectedIndex = 0;
                }
            }

            #endregion
        }
コード例 #16
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            string tmp = "   " + values[0] + " " + values[1] + " " + GetFlags() + " " + menuID_cbb.SelectedIndex + " " + party_template_cbb.SelectedIndex + " " + faction_cbb.SelectedIndex + " ";

            tmp += GetPersonality() + "  " + ai_bhvr_cbb.SelectedIndex + " " + ai_target_p_cbb.SelectedIndex + "  ";
            tmp += x_axis_txt.Text + " " + y_axis_txt.Text + "      " + stack_troops_lb.Items.Count;

            for (int i = 0; i < stack_troops_lb.Items.Count; i++)
            {
                tmp += " " + CodeReader.Troops.IndexOf("trp_" + stack_troops_lb.Items[i].ToString()) + " " + memberValues[i][0] + " " + memberValues[i][1] + " " + memberValues[i][2];
            }

            //for invalid troops - still needed?
            //for (int i = 0; i < 6 - stack_troops_lb.Items.Count; i++)
            //    values[0] += " -1 0 0 0";
            //for invalid troops

            values.Clear();
            values = new List <string>(tmp.Split())
            {
                direction_in_degrees_txt.Text
            };
            string[] valuesX = values.ToArray();
            Party    p       = new Party(valuesX);

            CodeWriter.SavePseudoCodeByType(p, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, p);
        }
コード例 #17
0
        protected override void SaveTypeByIndex(List <string> values, int selectedIndex, Skriptum changed = null)
        {
            /// Check if is set by default now - if not make it happen
            if (troopImage_txt.Text.Length == 0)
            {
                troopImage_txt.Text = "0";
            }
            if (reserved_txt.Text.Length == 0)
            {
                reserved_txt.Text = "0";
            }
            if (face1_txt.Text.Length == 0)
            {
                face1_txt.Text = FACE_CODE_ZERO;
            }
            if (face2_txt.Text.Length == 0)
            {
                face2_txt.Text = FACE_CODE_ZERO;
            }
            /// Check if is set by default now - if not make it happen

            /*if (!id_txt.Text.StartsWith("trp_"))//should already be done in ToolForm
             *  id_txt.Text = "trp_" + id_txt.Text;
             * else
             *  id_txt.Text = "trp_" + id_txt.Text;*/

            string tmp =
                /*id_txt.Text.Replace(' ', '_')*/ values[0] + ' ' +
                /*name_txt.Text.Replace(' ', '_')*/ values[1] + ' ' +
                plural_name_txt.Text.Replace(' ', '_') + ' ' +
                troopImage_txt.Text.Replace(' ', '_') + ' ' +
                GetFlagsValue().ToString() + ' ' +
                GetSceneCode().ToString() + ' ' +
                reserved_txt.Text + ' ' +
                factions_lb.SelectedIndex.ToString() + ' ' +
                upgradeTroop1_lb.SelectedIndex.ToString() + ' ' +
                upgradeTroop2_lb.SelectedIndex.ToString() + ";  ";

            for (int i = 0; i < usedItems_lb.Items.Count; i++)
            {
                tmp += usedItems_lb.Items[i].ToString().Split('-')[0] + inventoryItemFlags[i] + " ";//could be a problem when itemFlags are wrong
            }
            for (int i = 0; i < (64 - usedItems_lb.Items.Count); i++)
            {
                tmp += "-1 0 ";
            }

            tmp += ";  ";

            tmp +=
                str_txt.Text + ' ' +
                agi_txt.Text + ' ' +
                int_txt.Text + ' ' +
                cha_txt.Text + ' ' +
                level_txt.Text + "; ";

            tmp += onehandedWeapon_txt.Text + ' ' +
                   twohandedWeapon_txt.Text + ' ' +
                   polearms_txt.Text + ' ' +
                   archery_txt.Text + ' ' +
                   crossbows_txt.Text + ' ' +
                   throwing_txt.Text + ' ' +
                   firearms_txt.Text + ';';

            SuperGZ_192Bit skillsValue = new SuperGZ_192Bit(GetSkillCodes());

            foreach (uint u in skillsValue.ValueUInt)
            {
                tmp += u + " ";
            }
            tmp += ";  ";

            SuperGZ_256Bit faceCode1 = new SuperGZ_256Bit(face1_txt.Text);
            SuperGZ_256Bit faceCode2 = new SuperGZ_256Bit(face2_txt.Text);

            for (int i = 0; i < faceCode1.ValueULong.Length; i++)
            {
                tmp += faceCode1.ValueULong[i] + " ";
            }
            for (int i = 0; i < faceCode2.ValueULong.Length; i++)
            {
                tmp += faceCode2.ValueULong[i] + " ";
            }

            /*bool newOne = false;
             * Troop changed = new Troop(values);
             *
             * MB_Studio.SavePseudoCodeByType(changed, values);
             *
             * if (selectedIndex < typeSelect_lb.Items.Count - 1)
             *  types[selectedIndex] = changed;
             * else
             * {
             *  types.Add(changed);
             *  typeSelect_lb.Items.Add(changed.ID);
             *  newOne = !newOne;
             * }
             *
             * foreach (Troop troop in types)
             *  list.Add(troop);
             *
             * SourceWriter.WriteAllObjects();
             * new SourceWriter().WriteTroops(list);
             *
             * if (newOne)
             *  typeSelect_lb.SelectedIndex = typeSelect_lb.Items.Count - 1;*/

            values.Clear();
            values = new List <string>(tmp.Split(';'));
            string[] valuesX = values.ToArray();
            Troop    t       = new Troop(valuesX);

            CodeWriter.SavePseudoCodeByType(t, valuesX);

            base.SaveTypeByIndex(values, selectedIndex, t);
        }