static void OnConnect(Player p) { FootballStats futstats = Stats.LoadFootballStats(p.name); p.ExtraData.ChangeOrCreate("TotalRounds", futstats.TotalRounds); p.ExtraData.ChangeOrCreate("Wins", futstats.Wins); p.ExtraData.ChangeOrCreate("Losses", futstats.Losses); p.ExtraData.ChangeOrCreate("Draws", futstats.Draws); p.ExtraData.ChangeOrCreate("Assists", futstats.Assists); p.ExtraData.ChangeOrCreate("Goals", futstats.Goals); p.ExtraData.ChangeOrCreate("Saves", futstats.Saves); p.ExtraData.ChangeOrCreate("OwnGoals", futstats.OwnGoals); if (futstats.Skills == 0) { p.ExtraData.ChangeOrCreate("Skills", 1); } else { p.ExtraData.ChangeOrCreate("Skills", futstats.Skills); } p.ExtraData.ChangeOrCreate("Fouls", futstats.Fouls); //Go ahead and create all the ExtraData variables so nothing goes wrong p.ExtraData.ChangeOrCreate("Speed", Constants.DefaultSpeed); p.ExtraData.ChangeOrCreate("OldSpeed", Constants.DefaultSpeed); p.ExtraData.ChangeOrCreate("InControl", 0); p.ExtraData.ChangeOrCreate("Spec", false); p.ExtraData.ChangeOrCreate("ShotPower", 1d); p.ExtraData.ChangeOrCreate("SpinY", 0d); p.ExtraData.ChangeOrCreate("SpinZ", 0d); p.ExtraData.ChangeOrCreate("SkillSequence", ""); p.ExtraData.ChangeOrCreate("SkillTime", DateTime.Now); p.ExtraData.ChangeOrCreate("IsSkilling", false); p.ExtraData.ChangeOrCreate("Teleported", true); p.Send(Packet.TextHotKey("SpinYAdd", "/spinball y add◙", 200, 0, true)); p.Send(Packet.TextHotKey("SpinYSub", "/spinball y sub◙", 208, 0, true)); p.Send(Packet.TextHotKey("SpinZAdd", "/spinball z add◙", 205, 0, true)); p.Send(Packet.TextHotKey("SpinZSub", "/spinball z sub◙", 203, 0, true)); p.Send(Packet.TextHotKey("ShotPowerAdd", "/spinball p add◙", 13, 0, true)); p.Send(Packet.TextHotKey("ShotPowerAdd", "/spinball p sub◙", 12, 0, true)); p.Send(Packet.TextHotKey("SkillY", "/skill y◙", 21, 0, true)); p.Send(Packet.TextHotKey("SkillH", "/skill h◙", 35, 0, true)); p.Send(Packet.TextHotKey("SkillN", "/skill n◙", 49, 0, true)); p.Send(Packet.TextHotKey("SkillM", "/skill m◙", 50, 0, true)); p.Send(Packet.TextHotKey("Skill,", "/skill ,◙", 51, 0, true)); p.Send(Packet.TextHotKey("SkillK", "/skill k◙", 37, 0, true)); p.Send(Packet.TextHotKey("SkillI", "/skill i◙", 23, 0, true)); p.Send(Packet.TextHotKey("SkillU", "/skill u◙", 22, 0, true)); Team.OnJoin(p); }
public static FootballStats LoadFootballStats(string name) { DataTable table = Database.Backend.GetRows("FootballStats", "*", "WHERE Name=@0", name); FootballStats stats = default(FootballStats); if (table.Rows.Count > 0) { DataRow row = table.Rows[0]; stats.TotalRounds = int.Parse(row["TotalRounds"].ToString()); stats.Wins = int.Parse(row["Wins"].ToString()); stats.Losses = int.Parse(row["Losses"].ToString()); stats.Draws = int.Parse(row["Draws"].ToString()); stats.Goals = int.Parse(row["Goals"].ToString()); stats.Assists = int.Parse(row["Assists"].ToString()); stats.Saves = int.Parse(row["Saves"].ToString()); stats.Skills = int.Parse(row["Skills"].ToString()); stats.OwnGoals = int.Parse(row["OwnGoals"].ToString()); stats.Fouls = int.Parse(row["Fouls"].ToString()); } table.Dispose(); return(stats); }