Exemplo n.º 1
0
 public virtual void Buy(Player player)
 {
     Manager.Database.DoActionAsync(db =>
     {
         if (ObjectType == 0x0505) //Vault chest
         {
             if (player._buyCooldown > 0)
             {
                 player.SendDialogError("You are buying vaults too fast, please slow down and re-enter the world if needed");
                 return;
             }
             if (TryDeduct(player))
             {
                 player._buyCooldown = 10;
                 VaultChest chest    = db.CreateChest(player.Client.Account);
                 db.UpdateFame(player.Client.Account, -Price);
                 (Owner as Vault).AddChest(chest, this);
                 player.Client.SendPacket(new BuyResultPacket
                 {
                     Result  = 0,
                     Message = "{\"key\":\"server.buy_success\"}"
                 });
             }
             else
             {
                 player.Client.SendPacket(new BuyResultPacket
                 {
                     Result  = 6,
                     Message = "{\"key\":\"server.not_enough_fame\"}"
                 });
             }
         }
         if (ObjectType == 0x0736)
         {
             player.Client.SendPacket(new BuyResultPacket
             {
                 Result  = 9,
                 Message = "{\"key\":\"server.not_enough_fame\"}"
             });
         }
     });
 }