Exemplo n.º 1
0
        public frmEncounterGroupEditor(List <IZone> Zones, FOGAMEParser GameParser, EncounterGroupParser GroupParser, DialogListParser DialogParser, MSGParser FOObj, MSGParser FODLG, DefineParser DefineParser)
        {
            this.Zones        = Zones;
            this.FODLG        = FODLG;
            this.DefineParser = DefineParser;
            this.GameParser   = GameParser;
            this.GroupParser  = GroupParser;
            this.DialogParser = DialogParser;
            InitializeComponent();
            LoadCrTypeDefines();
            LoadArmorProtos(Config.PathArmorProtos, Config.PathHelmetProtos, FOObj);

            foreach (ArmorProto ItProt in ArmorProtos)
            {
                AddArmorProtoToCmb(ItProt, cmbArmorPid);
            }
            foreach (ArmorProto ItProt in HelmetProtos)
            {
                AddArmorProtoToCmb(ItProt, cmbHelmetPid);
            }

            cmbArmorPid.SelectedIndex  = 0;
            cmbHelmetPid.SelectedIndex = 0;

            this.frmFilter = new frmFilter(this.DefineParser, null);
        }
Exemplo n.º 2
0
        public bool LoadZones(EncounterGroupParser GroupParser)
        {
            if (Config.ScriptingEnabled)
            {
                if (Scripting.Host.ScriptHost.load_zones(FileName))
                {
                    return(true);
                }
            }

            Utils.Log("Loading zones from " + FileName + "...");
            Zones = WMFormat.LoadZones(FileName, GroupParser);
            return(Zones != null && Zones.Count != 0);
        }
Exemplo n.º 3
0
        private List <EncounterZoneGroup> ParseGroups(String[] Groups, EncounterGroupParser GroupParser, string Pos)
        {
            List <EncounterZoneGroup> Grps = new List <EncounterZoneGroup>();

            if (Groups.Length > 1 || Groups[0] != "")
            {
                foreach (string i in Groups)
                {
                    if (i.Length < 5 || i.Substring(0, 5) != "GROUP")
                    {
                        Message.Show("Invalid group " + i + " at " + Pos + ".", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    String[]           toks  = i.Split(':');
                    EncounterZoneGroup group = new EncounterZoneGroup(toks[0], Int32.Parse(toks[1]), GroupParser.GetGroupByName(toks[0]));
                    Grps.Add(group);
                }
            }
            return(Grps);
        }
Exemplo n.º 4
0
        public List <IZone> LoadZones(string FileName, EncounterGroupParser GroupParser)
        {
            if (!File.Exists(FileName))
            {
                Message.Show("Couldn't open " + FileName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            //try
            // {
            List <IZone>  Zones = new List <IZone>();
            List <string> lines = new List <string>(File.ReadAllLines(FileName));

            if (lines.Count == 0)
            {
                Message.Show("Worldmap file is empty.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            string version;

            if (!WorldMapUtils.VerifyFormat(lines[0], FileName, "2238", out version))
            {
                return(null);
            }

            foreach (string line in lines)
            {
                if (line.Length == 0 || (line.Contains("Format") && line.Contains("Version")))
                {
                    continue;
                }

                List <EncounterZoneLocation> AddLocations = new List <EncounterZoneLocation>();
                List <EncounterZoneGroup>    AddGroups    = new List <EncounterZoneGroup>();
                List <String> AddFlags = new List <String>();

                String[] SplittedLine = line.Split('|');
                String[] Coords       = SplittedLine[0].Split(',');
                String[] Parameters   = SplittedLine[1].Split(',');

                Zone zone = new Zone(Int32.Parse(Coords[0]), Int32.Parse(Coords[1]));
                zone.Difficulty = Int32.Parse(Parameters[0]);
                zone.Terrain    = Parameters[1];
                zone.Fill       = Parameters[2];
                zone.Chance     = Parameters[3];

                if (SplittedLine.Length > 2)
                {
                    if (SplittedLine[2].Length > 2)
                    {
                        zone.EncounterLocations = ParseLocations(SplittedLine[2].Split(','), SplittedLine[0]);
                    }
                }
                if (SplittedLine.Length > 3)
                {
                    if (SplittedLine[3].Length > 2)
                    {
                        zone.EncounterGroups = ParseGroups(SplittedLine[3].Split(','), GroupParser, SplittedLine[0]);
                    }
                }
                if (SplittedLine.Length > 4)
                {
                    zone.Flags = ParseFlags(SplittedLine[4].Split(','), SplittedLine[0]);
                }

                Zones.Add(zone);
            }
            return(Zones);
        }