Пример #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 }));
             }
         }
     }
 }