コード例 #1
0
ファイル: User.cs プロジェクト: DaLoE99/Servidores-DaLoE
 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 }));
             }
         }
     }
 }