コード例 #1
0
ファイル: NetState.cs プロジェクト: notsentient/RunZHA
 public bool SupportsExpansion( ExpansionInfo info )
 {
     return SupportsExpansion( info, true );
 }
コード例 #2
0
ファイル: NetState.cs プロジェクト: notsentient/RunZHA
        public bool SupportsExpansion( ExpansionInfo info, bool checkCoreExpansion )
        {
            if ( info == null || ( checkCoreExpansion && ( int ) Core.Expansion < info.ID ) )
                return false;

            if ( info.RequiredClient != null )
                return ( this.Version >= info.RequiredClient );

            return ( ( this.Flags & info.NetStateFlag ) != 0 );
        }
コード例 #3
0
ファイル: NetState.cs プロジェクト: PepeBiondi/runsa
		public bool SupportsExpansion( ExpansionInfo info, bool checkCoreExpansion ) {
            if (info == null || (checkCoreExpansion && (int)Core.Expansion < info.ID))
                return true;

            // genova: support uo:kr
			if ( info.RequiredClient != null )
				return ( this.IsKRClient || this.Version >= info.RequiredClient );

            return ((this.Flags & info.NetStateFlag) != 0);
		}
コード例 #4
0
ファイル: NetState.cs プロジェクト: PepeBiondi/runsa
		public bool SupportsExpansion( ExpansionInfo info ) {
            return true;
		}
コード例 #5
0
        static ProfessionInfo()
        {
            var profs = new List <ProfessionInfo>
            {
                new()
                {
                    ID       = 0, // Custom
                    Name     = "Advanced",
                    TopLevel = false,
                    GumpID   = 5571
                }
            };

            var file = Core.FindDataFile("prof.txt", false);

            if (!File.Exists(file))
            {
                var parent = Path.Combine(Core.BaseDirectory, "Data/Professions");
                file = Path.Combine(ExpansionInfo.GetEraFolder(parent), "prof.txt");
            }

            var maxProf = 0;

            if (File.Exists(file))
            {
                using var s = File.OpenText(file);

                while (!s.EndOfStream)
                {
                    var line = s.ReadLine();

                    if (string.IsNullOrWhiteSpace(line))
                    {
                        continue;
                    }

                    line = line.Trim();

                    if (!line.InsensitiveStartsWith("Begin"))
                    {
                        continue;
                    }

                    var prof = new ProfessionInfo();

                    int stats;
                    int valid;
                    var skills = stats = valid = 0;

                    while (!s.EndOfStream)
                    {
                        line = s.ReadLine();

                        if (string.IsNullOrWhiteSpace(line))
                        {
                            continue;
                        }

                        line = line.Trim();

                        if (line.InsensitiveStartsWith("End"))
                        {
                            if (valid >= 4)
                            {
                                profs.Add(prof);
                            }

                            break;
                        }

                        var cols  = line.Split('\t', StringSplitOptions.RemoveEmptyEntries);
                        var key   = cols[0].ToLowerInvariant();
                        var value = cols[1].Trim('"');

                        if (key == "type" && value != "profession")
                        {
                            break;
                        }

                        switch (key)
                        {
                        case "truename":
                        {
                            prof.Name = value;
                            ++valid;
                        }
                        break;

                        case "nameid":
                            prof.NameID = Utility.ToInt32(value);
                            break;

                        case "descid":
                            prof.DescID = Utility.ToInt32(value);
                            break;

                        case "desc":
                        {
                            prof.ID = Utility.ToInt32(value);
                            if (prof.ID > maxProf)
                            {
                                maxProf = prof.ID;
                            }

                            ++valid;
                        }
                        break;

                        case "toplevel":
                            prof.TopLevel = Utility.ToBoolean(value);
                            break;

                        case "gump":
                            prof.GumpID = Utility.ToInt32(value);
                            break;

                        case "skill":
                        {
                            if (!TryGetSkillName(value, out var skillName))
                            {
                                break;
                            }

                            prof.Skills[skills++] = new SkillNameValue(skillName, Utility.ToInt32(cols[2]));

                            if (skills == prof.Skills.Length)
                            {
                                ++valid;
                            }
                        }
                        break;

                        case "stat":
                        {
                            if (!Enum.TryParse(value, out StatType stat))
                            {
                                break;
                            }

                            prof.Stats[stats++] = new StatNameValue(stat, Utility.ToInt32(cols[2]));

                            if (stats == prof.Stats.Length)
                            {
                                ++valid;
                            }
                        }
                        break;
                        }
                    }
                }
            }

            Professions = new ProfessionInfo[1 + maxProf];

            foreach (var p in profs)
            {
                Professions[p.ID] = p;
            }

            profs.Clear();
            profs.TrimExcess();
        }