/// <summary> Adds a new rank to the list. Checks for duplicates. </summary>
        public static void AddRank([NotNull] Rank rank)
        {
            if (rank == null)
            {
                throw new ArgumentNullException("rank");
            }
            if (PlayerDB.IsLoaded)
            {
                throw new InvalidOperationException("You may not add ranks after PlayerDB has already been loaded.");
            }
            // check for duplicate rank names
            if (RanksByName.ContainsKey(rank.Name.ToLower()))
            {
                throw new RankDefinitionException(rank.Name,
                                                  "Duplicate definition for rank \"{0}\" (by Name) was ignored.",
                                                  rank.Name);
            }

            if (RanksByID.ContainsKey(rank.ID))
            {
                throw new RankDefinitionException(rank.Name,
                                                  "Duplicate definition for rank \"{0}\" (by ID) was ignored.",
                                                  rank.Name);
            }

            Ranks.Add(rank);
            RanksByName[rank.Name.ToLower()] = rank;
            RanksByFullName[rank.FullName]   = rank;
            RanksByID[rank.ID] = rank;
            RebuildIndex();
        }
Beispiel #2
0
 /// <summary>
 /// Initializes all vertices ranks to 0.
 /// </summary>
 public void InitializeRanks()
 {
     Ranks.Clear();
     foreach (TVertex vertex in VisitedGraph.Vertices)
     {
         Ranks.Add(vertex, 0);
     }
 }
Beispiel #3
0
        public TalentNode AddRank(params string [] values)
        {
            var rank = new TalentRank(++ranksCtr, values, this);

            Ranks.Add(rank);

            return(this);
        }
Beispiel #4
0
 private void WindowLoadedCommandExecute(object obj)
 {
     IsBusy = true;
     Logger.For(this).Info("AddUserWindow is loading");
     OnPropertyChanged(nameof(User));
     foreach (var item in Enum.GetValues(typeof(RankDto)).Cast <RankDto>())
     {
         Ranks.Add(item);
     }
     IsBusy = false;
 }
Beispiel #5
0
        public void AddRank(string title) //adds a new rank at the lowest tier
        {
            if (Ranks.Any(x => x.Name == title)) return;

            var lowestRank = Ranks.Aggregate((r1, r2) => r1.Level > r2.Level ? r1 : r2);

            var rank = new GuildRank() { Uuid = Guid.NewGuid().ToString(), Name = title, Level = lowestRank.Level + 1 };

            Ranks.Add(rank);
            GameLog.Info($"Guild {Name}: New rank {rank.Name} added as level {rank.Level}");
        }
Beispiel #6
0
 /// <summary>
 /// Adds a rank to the ranks container.
 /// </summary>
 /// <param name="name">The name of the character.</param>
 /// <param name="rank">The rank for the character.</param>
 public void AddRank(long name, Rank rank)
 {
     lock (this.Ranks)
     {
         if (this.Ranks.ContainsKey(name))
         {
             this.Ranks[name] = rank;
             return;
         }
         Ranks.Add(name, rank);
     }
 }
    //public static HttpServerUtility ServerInstance = null;
    public static void LoadRanks()
    {
        var path      = "ranks.txt";
        var ranksList = File.ReadAllLines(path);

        foreach (var x in ranksList)
        {
            var data = x.Split(';');
            try
            { Ranks.Add(data[0], data[1]); }
            catch { }
        }
    }
Beispiel #8
0
        private void InitialiseRanks()
        {
            int rankId = 0;

            Ranks.Add(new Rank(rankId++, "Impoverished trader", 10, 2500));
            Ranks.Add(new Rank(rankId++, "Small-time trader", 50, 10000));
            Ranks.Add(new Rank(rankId++, "Minor trader", 250, 50000));
            Ranks.Add(new Rank(rankId++, "Major trader", 1000, 250000));
            Ranks.Add(new Rank(rankId++, "Minor broker", 5000, 1000000));
            Ranks.Add(new Rank(rankId++, "Major broker", 50000, 10000000));
            Ranks.Add(new Rank(rankId++, "Renowned broker", 1000000, 1000000000));
            Ranks.Add(new Rank(rankId++, "Crypto Tycoon", int.MaxValue, -1));
        }
Beispiel #9
0
        public void Write(GamePacketWriter writer)
        {
            writer.Write(GuildId);
            writer.WriteStringWide(GuildName);
            writer.Write(Flags, 32u);
            writer.Write(Type, 4u);

            if (Ranks.Count < 10)
            {
                for (int i = Ranks.Count; i < 10; i++)
                {
                    Ranks.Add(new GuildRank());
                }
            }
            Ranks.ForEach(c => c.Write(writer));

            GuildStandard.Write(writer);

            writer.Write(MemberCount);
            writer.Write(OnlineMemberCount);
            writer.Write(Influence);
            writer.Write(DailyInfluenceRemaining);
            writer.Write(Money);
            writer.Write(WarCoins);
            writer.Write(BankTabCount);

            foreach (string str in BankTabNames)
            {
                writer.WriteStringWide(str);
            }

            foreach (ulong perk in Perks)
            {
                writer.Write(perk);
            }

            writer.Write(ActivePerks.Count);
            ActivePerks.ForEach(c => c.Write(writer));

            GuildInfo.Write(writer);
        }
Beispiel #10
0
        public void NewMember(PlayerObject newMember)
        {
            if (Ranks.Count < 2)
            {
                Ranks.Add(new GuildRank()
                {
                    Name = "Members", Index = 1
                });
            }

            GuildRank   lowestRank = Ranks[Ranks.Count - 1];
            GuildMember member     = new GuildMember()
            {
                Name = newMember.Info.Name, Player = newMember, Id = newMember.Info.Index, LastLogin = Envir.Now, Online = true
            };

            lowestRank.Members.Add(member);

            PlayerLogged(newMember, true, true);
            Info.Membercount++;
            NeedSave = true;
        }
Beispiel #11
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "XNAM":
                    if (Relationships == null)
                    {
                        Relationships = new List <Relationship>();
                    }

                    Relationship tempXNAM = new Relationship();
                    tempXNAM.ReadBinary(reader);
                    Relationships.Add(tempXNAM);
                    break;

                case "DATA":
                    if (Data == null)
                    {
                        Data = new FactionData();
                    }

                    Data.ReadBinary(reader);
                    break;

                case "CNAM":
                    if (Unused == null)
                    {
                        Unused = new SimpleSubrecord <Single>();
                    }

                    Unused.ReadBinary(reader);
                    break;

                case "RNAM":
                    if (Ranks == null)
                    {
                        Ranks = new List <FactionRank>();
                    }

                    FactionRank tempRNAM = new FactionRank();
                    tempRNAM.ReadBinary(reader);
                    Ranks.Add(tempRNAM);
                    break;

                case "WMI1":
                    if (Reputation == null)
                    {
                        Reputation = new RecordReference();
                    }

                    Reputation.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
Beispiel #12
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Relationships", false, out subEle))
            {
                if (Relationships == null)
                {
                    Relationships = new List <Relationship>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    Relationship tempXNAM = new Relationship();
                    tempXNAM.ReadXML(e, master);
                    Relationships.Add(tempXNAM);
                }
            }
            if (ele.TryPathTo("Data", false, out subEle))
            {
                if (Data == null)
                {
                    Data = new FactionData();
                }

                Data.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unused", false, out subEle))
            {
                if (Unused == null)
                {
                    Unused = new SimpleSubrecord <Single>();
                }

                Unused.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Ranks", false, out subEle))
            {
                if (Ranks == null)
                {
                    Ranks = new List <FactionRank>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    FactionRank tempRNAM = new FactionRank();
                    tempRNAM.ReadXML(e, master);
                    Ranks.Add(tempRNAM);
                }
            }
            if (ele.TryPathTo("Reputation", false, out subEle))
            {
                if (Reputation == null)
                {
                    Reputation = new RecordReference();
                }

                Reputation.ReadXML(subEle, master);
            }
        }
Beispiel #13
0
        public DataContext()
        {
            // 人物
            List <List <String> > skills = new List <List <string> >()
            {
                new List <String> {
                    "剣スキル", "ヤリスキル", "ブーメラン", "格闘スキル", "ゆうき"
                },
                new List <String> {
                    "オノスキル", "打撃スキル", "鎌スキル", "格闘スキル", "にんじょう"
                },
                new List <String> {
                    "短剣スキル", "ムチスキル", "杖スキル", "格闘スキル", "おいろけ"
                },
                new List <String> {
                    "剣スキル", "弓スキル", "杖スキル", "格闘スキル", "カリスマ"
                },
                new List <String> {
                    "扇スキル", "ムチスキル", "短剣スキル", "格闘スキル", "アウトロー"
                },
                new List <String> {
                    "爪スキル", "打撃スキル", "ブーメラン", "格闘スキル", "ねっけつ"
                },
            };

            foreach (var member in Info.Instance().Orders)
            {
                if (member.Value == 0xFF)
                {
                    continue;
                }
                Charactor ch = new Charactor(0x11EC + member.Value * 64, 0xA10 + member.Value * 34, skills[(int)member.Value]);
                ch.Name = member.Name;
                Party.Add(ch);
            }

            // ルーラ
            foreach (var item in Info.Instance().Places)
            {
                Place zoom = new Place(item.Value);
                zoom.Name = item.Name;
                Places.Add(zoom);
            }

            // パーティ並び
            for (uint i = 0; i < 6; i++)
            {
                Orders.Add(new Order(0x11A0 + i));
            }

            // 錬金釜
            foreach (var recipe in Info.Instance().Recipes)
            {
                Recipes.Add(new Recipe(recipe.Value)
                {
                    Name = recipe.Name
                });
            }

            // モンスター図鑑
            foreach (var monster in Info.Instance().Monsters)
            {
                Monsters.Add(new Monster(monster.Value)
                {
                    Name = monster.Name
                });
            }

            // アイテム図鑑
            foreach (var item in Info.Instance().Items)
            {
                if (item.Value == 0)
                {
                    continue;
                }
                Items.Add(new Item(item.Value)
                {
                    Name = item.Name
                });
            }

            // バトルロードモンスター
            for (uint i = 0; i < 24; i++)
            {
                BattleLoadMonsters.Add(new BattleMonster(0x13F0 + i * 8));
            }

            String[] names = { "G", "F", "E", "D", "C", "B", "A", "S" };
            for (uint i = 0; i < names.Length; i++)
            {
                Ranks.Add(new BattleMonsterRank(i)
                {
                    Name = "ランク" + names[i]
                });
            }
        }