Exemplo n.º 1
0
        public void SaveChest(Account acc, VaultChest chest)
        {
            var cmd = CreateQuery();

            cmd.CommandText = "UPDATE vaults SET items=@items WHERE accId=@accId AND chestId=@chestId;";
            cmd.Parameters.AddWithValue("@accId", acc.AccountId);
            cmd.Parameters.AddWithValue("@chestId", chest.ChestId);
            cmd.Parameters.AddWithValue("@items", chest._Items);
            cmd.ExecuteNonQuery();
        }
Exemplo n.º 2
0
        public void AddChest(VaultChest chest, Entity original)
        {
            Container con = new Container(0x0504, null, false);
            var inv = chest.Items.Select(_ => _ == -1 ? null : (XmlDatas.ItemDescs.ContainsKey((short)_) ? XmlDatas.ItemDescs[(short)_] : null)).ToArray();
            for (int j = 0; j < 8; j++)
                con.Inventory[j] = inv[j];
            con.Move(original.X, original.Y);
            LeaveWorld(original);
            EnterWorld(con);

            vaultChests[new Tuple<Container, VaultChest>(con, chest)] = con.UpdateCount;
        }
Exemplo n.º 3
0
        public void AddChest(VaultChest chest, Entity original)
        {
            Container con = new Container(client.Manager, 0x0504, null, false);
            var inv = chest.Items.Select(_ => _ == -1 ? null : Manager.GameData.Items[(ushort)_]).ToArray();
            for (int j = 0; j < 8; j++)
                con.Inventory[j] = inv[j];
            con.Move(original.X, original.Y);
            LeaveWorld(original);
            EnterWorld(con);

            vaultChests[new Tuple<Container, VaultChest>(con, chest)] = con.UpdateCount;
        }
Exemplo n.º 4
0
        public void AddChest(VaultChest chest, Entity original)
        {
            Container con = new Container(client.Manager, 0x0504, null, false);
            var       inv = chest.Items.Select(_ => _ == -1 ? null : Manager.GameData.Items[(ushort)_]).ToArray();

            for (int j = 0; j < 8; j++)
            {
                con.Inventory[j] = inv[j];
            }
            con.Move(original.X, original.Y);
            LeaveWorld(original);
            EnterWorld(con);

            vaultChests[new Tuple <Container, VaultChest>(con, chest)] = con.UpdateCount;
        }
Exemplo n.º 5
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\"}"
             });
         }
     });
 }
Exemplo n.º 6
0
 public virtual void Buy(Player player)
 {
     Manager.Database.DoActionAsync(db =>
     {
         if (ObjectType == 0x0505) //Vault chest
         {
             if (TryDeduct(player))
             {
                 VaultChest chest   = db.CreateChest(player.Client.Account);
                 player.CurrentFame = player.Client.Account.Stats.Fame = db.UpdateFame(player.Client.Account, -Price);
                 player.UpdateCount++;
                 (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  = BUY_NO_FAME,
                     Message = "{\"key\":\"server.not_enough_fame\"}"
                 });
             }
         }
         if (ObjectType == 0x0736)
         {
             player.Client.SendPacket(new BuyResultPacket()
             {
                 Result  = 9,
                 Message = "{\"key\":\"server.not_enough_game\"}"
             });
         }
     });
 }
Exemplo n.º 7
0
 public virtual void Buy(Player player)
 {
     Manager.Database.DoActionAsync(db =>
     {
         if (ObjectType == 0x0505) //Closed Vault Chest
         {
             if (TryDeduct(player))
             {
                 VaultChest chest = db.CreateChest(player.Client.Account);
                 db.UpdateCredit(player.Client.Account, -Price);
                 (Owner as Vault).AddChest(chest, this);
                 player.Client.SendPacket(new BuyResultPacket
                 {
                     Result  = BuyResult.Success,
                     Message = "{\"key\":\"server.buy_success\"}"
                 });
             }
             else
             {
                 player.Client.SendPacket(new BuyResultPacket
                 {
                     Result  = BuyResult.NotEnoughGold,
                     Message = "{\"key\":\"server.not_enough_gold\"}"
                 });
             }
         }
         if (ObjectType == 0x0736) //Guild Hall Upgrade 1
         {
             player.Client.SendPacket(new BuyResultPacket()
             {
                 Result  = BuyResult.NotEnoughFame,
                 Message = "{\"key\":\"server.not_enough_fame\"}"
             });
         }
     });
 }
Exemplo n.º 8
0
 public void SaveChest(Account acc, VaultChest chest)
 {
     var cmd = CreateQuery();
     cmd.CommandText = "UPDATE vaults SET items=@items WHERE accId=@accId AND chestId=@chestId;";
     cmd.Parameters.AddWithValue("@accId", acc.AccountId);
     cmd.Parameters.AddWithValue("@chestId", chest.ChestId);
     cmd.Parameters.AddWithValue("@items", chest._Items);
     cmd.ExecuteNonQuery();
 }