コード例 #1
0
        public bool Parse()
        {
            if (!File.Exists(_filename))
            {
                return(false);
            }

            List <Faction> factions = _gameParser.GetFactions();

            List <string>            fogmNames  = _gmParser.GetGroupGameNames();
            Dictionary <int, string> protoNames = _fodlgParser.GetData();

            foreach (KeyValuePair <int, string> kvp in protoNames)
            {
                if (kvp.Key % 2 == 1)
                {
                    continue;
                }
                CritterProto critterProto = new CritterProto((kvp.Key / 10));
                critterProto.Name = kvp.Value;
                _crProtos.Add(critterProto);
            }

            foreach (EncounterGroup grp in _groups)
            {
                grp.NpcCount = grp.Npcs.Count;
                grp.GMName   = fogmNames[grp.Id];

                foreach (Faction f in factions)
                {
                    if (grp.FactionId == f.Id)
                    {
                        grp.FactionName = f.Name;
                    }
                }
            }

            _IsParsed = true;
            return(true);
        }
コード例 #2
0
        private void frmEncounterGroupEditor_Paint(object sender, PaintEventArgs e)
        {
            if (IsFirstPaint)
            {
                cmbGroupPosition.SelectedIndex = 0;
                numDialog.Maximum = Int32.MaxValue;
                numProto.Maximum  = Int32.MaxValue;
                Groups            = GroupParser.GetGroups();

                foreach (FOCommon.Worldmap.EncounterGroup.EncounterGroup Grp in Groups)
                {
                    CalculateGroupZoneStats(Grp);
                }

                List <Item> items = ItemPid.GetItems();

                foreach (Item item in items)
                {
                    cmbItemPid.Items.Add(item.Define);
                }
                cmbItemPid.Sorted = true;


                if (TableSerializer.Exists("lstGroups"))
                {
                    lstGroups.RestoreState(TableSerializer.Load("lstGroups"));
                }
                if (TableSerializer.Exists("lstNpcs"))
                {
                    lstNpcs.RestoreState(TableSerializer.Load("lstNpcs"));
                }
                if (TableSerializer.Exists("lstNpcItems"))
                {
                    lstNpcItems.RestoreState(TableSerializer.Load("lstNpcItems"));
                }

                Factions = GameParser.GetFactions();

                ProtoNames = FODLG.GetData();

                foreach (KeyValuePair <int, string> kvp in ProtoNames)
                {
                    if (kvp.Key % 2 == 1)
                    {
                        continue;
                    }
                    CritterProto CrP = new CritterProto((kvp.Key / 10));
                    CrP.Name = kvp.Value;
                    CrProtos.Add(CrP);
                }
                foreach (FOCommon.Worldmap.EncounterGroup.EncounterGroup grp in Groups)
                {
                    foreach (Faction f in Factions)
                    {
                        if (grp.FactionId == f.Id)
                        {
                            grp.FactionName = f.Name;
                        }
                    }
                }


                lstGroups.SetObjects(Groups);

                cmbPerkDefine.Items.AddRange(DefineParser.GetDefinesByPrefix("PE_").Keys.ToArray <String>());

                IsFirstPaint = false;
            }
        }