public void UpdateCoconuts(int SendedAmount = 0, int ReceivedAmount = 0) { this.ReceivedCoconuts += ReceivedAmount; this.SendedCoconuts += SendedAmount; using (DatabaseClient DatabaseClient = DatabaseManager.GetClient()) { DatabaseClient.SetParameter("@ID", this.ID); DatabaseClient.SetParameter("@SendedAmount", SendedAmount); DatabaseClient.SetParameter("@ReceivedAmount", ReceivedAmount); DatabaseClient.ExecuteScalar("UPDATE boombang_users SET SendedCoconuts = SendedCoconuts+@SendedAmount, ReceivedCoconuts = ReceivedCoconuts+@ReceivedAmount WHERE ID = @ID"); } if (SessionsManager.Online(ID)) { if (this.SpaceInstance != null) { if (this.SpaceInstance is AreaInstance) { AreaInstance Area = (AreaInstance)this.SpaceInstance; Area.SendToAll(new ServerMessage(new byte[] { 146 }, new object[] { this.ID, 5, this.SendedCoconuts, this.ReceivedCoconuts })); } if (this.SpaceInstance is SalaInstance) { SalaInstance Sala = (SalaInstance)this.SpaceInstance; Sala.SendToAll(new ServerMessage(new byte[] { 146 }, new object[] { this.ID, 5, this.SendedCoconuts, this.ReceivedCoconuts })); } } } }
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(); } } }