AdvancedLogParser.InfoGather.CountBankValue C# (CSharp) Method

CountBankValue() public static method

public static CountBankValue ( ) : void
return void
        public static void CountBankValue()
        {
            currentLoader.status.Text = "Counting bank accounts...";
            Application.DoEvents();
            try
            {
                using (MySqlDataReader reader = MySqlHelper.ExecuteReader(ConnectionString, "SELECT * FROM alandsyu_live.pwdata WHERE pwdata.Key='bg_bank_val'"))
                {
                    while (reader.Read())
                    {
                        try
                        {
                            string name = (string)reader.GetValue(0);
                            string tag = (string)reader.GetValue(1);
                            string value = (string)reader.GetValue(3);
                            uint realValue = 0;
                            uint.TryParse(value, out realValue);
                            foreach (Character ch in Characters.List.Values)
                            {
                                if (name == ch.Name && tag == Players.ListByPlayerId[ch.PlayerId].CDKey)
                                {
                                    ch.Wealth += realValue;
                                }
                            }
                        }
                        catch {}
                    }
                }
            }
            catch {}
        }

Usage Example

Beispiel #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());
                }
            }
        }