コード例 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            InfoGather.DatabasePassword = ConfigurationSettings.AppSettings["DatabasePassword"];
            InfoGather.DatabaseSchema   = ConfigurationSettings.AppSettings["DatabaseSchema"];
            InfoGather.DatabaseServer   = ConfigurationSettings.AppSettings["DatabaseServer"];
            InfoGather.DatabasePort     = ConfigurationSettings.AppSettings["DatabasePort"];
            InfoGather.DatabaseUser     = ConfigurationSettings.AppSettings["DatabaseUser"];
            InfoGather.BuildConnectionString();
            Players.ListByPlayerId = new Dictionary <uint, Player>();
            Players.ListByKey      = new Dictionary <string, Player>();
            Characters.List        = new Dictionary <uint, Character>();
            Logs.AdvancementAlerts = new Dictionary <uint, Log>();
            Logs.DeathAlerts       = new Dictionary <uint, Log>();
            Logs.EnforcementAlerts = new Dictionary <uint, Log>();
            Logs.RecentLogins      = new Dictionary <uint, Log>();
            Servers.List           = new Dictionary <uint, Server>();
            if (InfoGather.GetPlayers())
            {
                InfoGather.GetCharacters();
                InfoGather.CountBankValue();
                InfoGather.CountpChestValue();
                InfoGather.GetAlerts();
                InfoGather.GetLogins();
                InfoGather.IdentifyLogins();
                InfoGather.GetDMTime();
                InfoGather.currentLoader.Close();
                InfoGather.currentLoader.Dispose();
                if (ServerFocus >= 0)
                {
                    foreach (Server srv in Servers.List.Values)
                    {
                        if (srv.ServerId == Math.Abs(ServerFocus))
                        {
                            Application.Run(new ServerView(srv));
                        }
                    }
                }
                else
                {
                    foreach (Server srv in Servers.List.Values)
                    {
                        new ServerView(srv).Show();
                    }
                    new ServerView(null).Show();
                    Application.Run(new PrimaryDisplay());
                }
            }
        }
コード例 #2
0
        public CharacterDetails(Character character)
        {
            this.Name = character.Name;
            this.Text = character.Name;

            switch (character.Alignment)
            {
            case Alignment.LawfulGood:
                alignment.Text = "Lawful Good";
                break;

            case Alignment.NeutralGood:
                alignment.Text = "Neutral Good";
                break;

            case Alignment.ChaoticGood:
                alignment.Text = "Chaotic Good";
                break;

            case Alignment.LawfulNeutral:
                alignment.Text = "Lawful Neutral";
                break;

            case Alignment.TrueNeutral:
                alignment.Text = "True Neutral";
                break;

            case Alignment.ChaoticNeutral:
                alignment.Text = "Chaotic Neutral";
                break;

            case Alignment.LawfulEvil:
                alignment.Text = "Lawful Evil";
                break;

            case Alignment.NeutralEvil:
                alignment.Text = "Neutral Evil";
                break;

            case Alignment.ChaoticEvil:
                alignment.Text = "Chaotic Evil";
                break;
            }
            alignment.Text    += " " + SubraceToString(character.SubRace);
            alignment.Size     = alignment.PreferredSize;
            alignment.Location = new Point(leftColumn, 5);

            classLabel.Text     = "Class:";
            classLabel.Size     = classLabel.PreferredSize;
            classLabel.Location = new Point(leftColumn, alignment.Location.Y + alignment.Height);

            string classes = PlayerDetails.ClassToAbbreviation(character.Class1) + character.Level1;

            if (character.Class2 < 255)
            {
                classes += "/" + PlayerDetails.ClassToAbbreviation(character.Class2) + character.Level2;
            }
            if (character.Class3 < 255)
            {
                classes += "/" + PlayerDetails.ClassToAbbreviation(character.Class3) + character.Level3;
            }
            classes            += String.Format(" ({0} XP)", character.XP);
            classValue.Text     = classes;
            classValue.Size     = classValue.PreferredSize;
            classValue.Location = new Point(rightColumn, classLabel.Location.Y);

            wealthLabel.Text     = "Wealth";
            wealthLabel.Size     = wealthLabel.PreferredSize;
            wealthLabel.Location = new Point(leftColumn, classLabel.Location.Y + classLabel.Height);

            WealthLevel lvl    = InfoGather.GetWealthLevel(character);
            uint        target = InfoGather.GetMedWealth(character.XP);

            switch (lvl)
            {
            case WealthLevel.VeryPoor:
                wealthValue.Text      = String.Format("Very Poor ({0} / {1})", character.Wealth, target);
                wealthValue.ForeColor = Color.Red;
                wealthValue.BackColor = Color.Yellow;
                break;

            case WealthLevel.Poor:
                wealthValue.Text = String.Format("Poor ({0} / {1})", character.Wealth, target);
                break;

            case WealthLevel.Target:
                wealthValue.Text = String.Format("Near Target ({0} / {1})", character.Wealth, target);
                break;

            case WealthLevel.Rich:
                wealthValue.Text = String.Format("Rich ({0} / {1})", character.Wealth, target);
                break;

            case WealthLevel.VeryRich:
                wealthValue.Text = String.Format("Very Rich ({0} / {1})", character.Wealth, target);
                break;

            case WealthLevel.Cutoff:
                wealthValue.Text      = String.Format("Cutoff ({0} / {1})", character.Wealth, target);
                wealthValue.ForeColor = Color.Red;
                wealthValue.BackColor = Color.Yellow;
                break;
            }
            wealthValue.Size     = wealthValue.PreferredSize;
            wealthValue.Location = new Point(rightColumn, wealthLabel.Location.Y);

            deityLabel.Text     = "Deity:";
            deityLabel.Size     = deityLabel.PreferredSize;
            deityLabel.Location = new Point(leftColumn, wealthLabel.Location.Y + wealthLabel.Height);

            deityValue.Text     = character.Deity;
            deityValue.Size     = deityValue.PreferredSize;
            deityValue.Location = new Point(rightColumn, deityLabel.Location.Y);

            strengthLabel.Text     = "Strength:";
            strengthLabel.Size     = strengthLabel.PreferredSize;
            strengthLabel.Location = new Point(leftColumn, deityLabel.Location.Y + deityLabel.Height);

            if (character.Strength >= 10)
            {
                strengthValue.Text = String.Format("{0} (+{1})", character.Strength, ((int)character.Strength - 10) / 2);
            }
            else
            {
                strengthValue.Text = String.Format("{0} ({1})", character.Strength, ((int)character.Strength - 10) / 2);
            }
            strengthValue.Size     = strengthValue.PreferredSize;
            strengthValue.Location = new Point(rightColumn, strengthLabel.Location.Y);

            dexterityLabel.Text     = "Dexterity:";
            dexterityLabel.Size     = dexterityLabel.PreferredSize;
            dexterityLabel.Location = new Point(leftColumn, strengthLabel.Location.Y + strengthLabel.Height);

            if (character.Dexterity >= 10)
            {
                dexterityValue.Text = String.Format("{0} (+{1})", character.Dexterity, ((int)character.Dexterity - 10) / 2);
            }
            else
            {
                dexterityValue.Text = String.Format("{0} ({1})", character.Dexterity, ((int)character.Dexterity - 10) / 2);
            }
            dexterityValue.Size     = dexterityValue.PreferredSize;
            dexterityValue.Location = new Point(rightColumn, dexterityLabel.Location.Y);

            constitutionLabel.Text     = "Constitution:";
            constitutionLabel.Size     = constitutionLabel.PreferredSize;
            constitutionLabel.Location = new Point(leftColumn, dexterityLabel.Location.Y + dexterityLabel.Height);

            if (character.Constitution >= 10)
            {
                constitutionValue.Text = String.Format("{0} (+{1})", character.Constitution, ((int)character.Constitution - 10) / 2);
            }
            else
            {
                constitutionValue.Text = String.Format("{0} ({1})", character.Constitution, ((int)character.Constitution - 10) / 2);
            }
            constitutionValue.Size     = constitutionValue.PreferredSize;
            constitutionValue.Location = new Point(rightColumn, constitutionLabel.Location.Y);

            intelligenceLabel.Text     = "Intelligence:";
            intelligenceLabel.Size     = intelligenceLabel.PreferredSize;
            intelligenceLabel.Location = new Point(leftColumn, constitutionLabel.Location.Y + constitutionLabel.Height);

            if (character.Intelligence >= 10)
            {
                intelligenceValue.Text = String.Format("{0} (+{1})", character.Intelligence, ((int)character.Intelligence - 10) / 2);
            }
            else
            {
                intelligenceValue.Text = String.Format("{0} ({1})", character.Intelligence, ((int)character.Intelligence - 10) / 2);
            }
            intelligenceValue.Size     = intelligenceValue.PreferredSize;
            intelligenceValue.Location = new Point(rightColumn, intelligenceLabel.Location.Y);

            wisdomLabel.Text     = "Wisdom:";
            wisdomLabel.Size     = wisdomLabel.PreferredSize;
            wisdomLabel.Location = new Point(leftColumn, intelligenceLabel.Location.Y + intelligenceLabel.Height);

            if (character.Wisdom >= 10)
            {
                wisdomValue.Text = String.Format("{0} (+{1})", character.Wisdom, ((int)character.Wisdom - 10) / 2);
            }
            else
            {
                wisdomValue.Text = String.Format("{0} ({1})", character.Wisdom, ((int)character.Wisdom - 10) / 2);
            }
            wisdomValue.Size     = wisdomValue.PreferredSize;
            wisdomValue.Location = new Point(rightColumn, wisdomLabel.Location.Y);

            charismaLabel.Text     = "Charisma:";
            charismaLabel.Size     = charismaLabel.PreferredSize;
            charismaLabel.Location = new Point(leftColumn, wisdomLabel.Location.Y + wisdomLabel.Height);

            if (character.Charisma >= 10)
            {
                charismaValue.Text = String.Format("{0} (+{1})", character.Charisma, ((int)character.Charisma - 10) / 2);
            }
            else
            {
                charismaValue.Text = String.Format("{0} ({1})", character.Charisma, ((int)character.Charisma - 10) / 2);
            }
            charismaValue.Size     = charismaValue.PreferredSize;
            charismaValue.Location = new Point(rightColumn, charismaLabel.Location.Y);

            this.Controls.Add(alignment);
            this.Controls.Add(classLabel);
            this.Controls.Add(classValue);
            this.Controls.Add(wealthLabel);
            this.Controls.Add(wealthValue);
            this.Controls.Add(deityLabel);
            this.Controls.Add(deityValue);
            this.Controls.Add(strengthLabel);
            this.Controls.Add(strengthValue);
            this.Controls.Add(dexterityLabel);
            this.Controls.Add(dexterityValue);
            this.Controls.Add(constitutionLabel);
            this.Controls.Add(constitutionValue);
            this.Controls.Add(intelligenceLabel);
            this.Controls.Add(intelligenceValue);
            this.Controls.Add(wisdomLabel);
            this.Controls.Add(wisdomValue);
            this.Controls.Add(charismaLabel);
            this.Controls.Add(charismaValue);
        }