public User GetUser(long SessionID) { if(Sessions.ContainsKey(SessionID)) { return SessionsManager.GetSession(SessionID).User; } else { return null; } }
public void RemoveGoldCoins(int Coins) { using (DatabaseClient DatabaseClient = DatabaseManager.GetClient()) { DatabaseClient.SetParameter("@ID", this.ID); DatabaseClient.SetParameter("@Coins", Coins); DatabaseClient.ExecuteScalar("UPDATE boombang_users SET GoldCoins = GoldCoins-@Coins WHERE ID = @ID LIMIT 1"); } this.GoldCoins -= Coins; if (SessionsManager.Online(ID)) { SessionsManager.GetSession(ID).SendMessage(new ServerMessage(new byte[] { 161 }, new object[] { Coins })); } }
public void Banº(DateTime Expiration, bool Permanent = false, string Reason = "Incumplir las Normas.") { if (!this.MOD) { using (DatabaseClient DatabaseClient = DatabaseManager.GetClient()) { DatabaseClient.ExecuteScalar("UPDATE boombang_users SET BanType = '" + ((Permanent) ? 0 : 1) + "', BanReason ? '" + Reason + "', BanExpiration = '" + Utils.Time.ToString(Expiration) + "' WHERE ID = '" + ID); } if (SessionsManager.Online(this.ID)) { Session Session = SessionsManager.GetSession(this.ID); Session.SendMessage(new ServerMessage(new byte[] { 185 }, new object[] { new TimeSpan(Expiration.Ticks - DateTime.Now.Ticks).TotalSeconds, Reason })); Session.End(); } } }
public void Handler_199_121() { int IDSessionChanges = Convert.ToInt32(Message.Parameters[0, 0]); int BuyItemID = Convert.ToInt32(Message.Parameters[1, 0]); int itemID = Convert.ToInt32(Message.Parameters[2, 0]); int something_6 = Convert.ToInt32(Message.Parameters[3, 0]); int OtherUser = IDSessionChanges - User.ID; using(DatabaseClient DatabaseClient = DatabaseManager.GetClient()) { Session SessionByFriendID = SessionsManager.GetSession(OtherUser); DataRow Row = DatabaseClient.ExecuteScalarRow("SELECT * FROM boombang_buyitems WHERE id = " + BuyItemID + " AND itemID = " + itemID); if(SessionByFriendID !=null) { SessionByFriendID.SendMessage(new ServerMessage(new byte[] {199,121}, new object[] { BuyItemID, itemID, (Row["color"].ToString() == "") ? null : Row["color"].ToString(), (Row["rgb_ratio"].ToString() == "") ? null : Row["rgb_Ratio"].ToString());