Exemplo n.º 1
0
        internal static void Create(Player p)
        {
            p.prefix       = "";
            p.color        = p.group.Color;
            p.FirstLogin   = DateTime.Now;
            p.TimesVisited = 1;

            string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            Database.Backend.AddRow(DBTable, "Name, IP, FirstLogin, LastLogin, totalLogin, Title, " +
                                    "totalDeaths, Money, totalBlocks, totalKicked, Messages, TimeSpent",
                                    p.name, p.ip, now, now, 1, "", 0, 0, 0, 0, 0, (long)p.TotalTime.TotalSeconds);

            using (DataTable ids = Database.Backend.GetRows(DBTable,
                                                            "ID", "WHERE Name = @0", p.name)) {
                if (ids.Rows.Count > 0)
                {
                    string id = ids.Rows[0]["ID"].ToString();
                    p.DatabaseID = PlayerData.ParseInt(id);
                }
                else
                {
                    p.DatabaseID = NameConverter.InvalidNameID(p.name);
                }
            }
        }
Exemplo n.º 2
0
        void UpdatePlayerID(IDataRecord record)
        {
            int    id;
            string user = record.GetString(0);

            if (!nameCache.TryGetValue(user, out id))
            {
                int[] ids = NameConverter.FindIds(user);
                if (ids.Length > 0)
                {
                    nameCache[user] = ids[0];
                }
                else
                {
                    nameCache[user] = NameConverter.InvalidNameID(user);
                }
            }
            entry.PlayerID = id;
        }
Exemplo n.º 3
0
        internal static void Create(Player p)
        {
            p.prefix = "";
            p.SetColor(p.group.Color);
            p.FirstLogin   = DateTime.Now;
            p.TimesVisited = 1;

            string now = DateTime.Now.ToString(Database.DateFormat);

            Database.AddRow("Players", "Name, IP, FirstLogin, LastLogin, totalLogin, Title, " +
                            "totalDeaths, Money, totalBlocks, totalKicked, Messages, TimeSpent",
                            p.name, p.ip, now, now, 1, "", 0, 0, 0, 0, 0, (long)p.TotalTime.TotalSeconds);

            object id = Database.ReadRows("Players", "ID", null, ReadID, "WHERE Name=@0", p.name);

            if (id != null)
            {
                p.DatabaseID = (int)id;
            }
            else
            {
                p.DatabaseID = NameConverter.InvalidNameID(p.name);
            }
        }