Ejemplo n.º 1
0
        private void HandlePlayerUpdate(object source, Client client, Account account)
        {
            // Save the player's last position.
            account.LastPosition = JsonConvert.SerializeObject(client.Position);
            account.Health       = client.Health;
            account.Armor        = client.Armor;

            Clothing clothing = Database.GetById <Clothing>(account.UserID);

            clothing.Update();

            Appearance appearance = Database.GetById <Appearance>(account.UserID);

            appearance.Update();

            client.TriggerEvent("eventRecieveRanks", account.LevelRanks);
            client.TriggerEvent("eventUpdateCurrency", Convert.ToSingle(account.Money));

            Database.UpdateData(account);
        }
Ejemplo n.º 2
0
        public static void TopOutfit(Client client, InventoryItem item)
        {
            Account  account  = AccountUtil.RetrieveAccount(client);
            Clothing clothing = Clothing.RetrieveClothing(account);

            TopOutfit topOutfit = JsonConvert.DeserializeObject <TopOutfit>(item.Properties);

            if (topOutfit == null)
            {
                return;
            }

            InventoryItem oldOutfit = new InventoryItem
            {
                ID         = 0,
                Name       = $"TopOutfit{new Random().Next(0, 999)}",
                StackCount = 1
            };

            oldOutfit.CreateTopOutfit(
                clothing.Mask,
                clothing.Undershirt,
                clothing.Torso,
                clothing.Top,
                clothing.Hats,
                clothing.Glasses
                );

            topOutfit.Equip(clothing);
            clothing.Update();
            clothing.UpdateClothing(client);

            Utilities.ForceCloseInventory(client);
            NAPI.Task.Run(() =>
            {
                InventoryHandler.AddItemToInventory(client, oldOutfit.Name, 1, oldOutfit);
            }, 1000);
        }