예제 #1
0
 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 }));
             }
         }
     }
 }
예제 #2
0
 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 }));
     }
 }
예제 #3
0
 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();
         }
     }
 }