Beispiel #1
0
        void vehicleInstall(PlayerSession session, ItemInstance playerItemInstance, RestrictedInventory vehicleInventory, int slotNumber)
        {
            var im = GlobalItemManager.Instance;

            //Remove attachment from player inventory
            playerItemInstance.ReduceStackSize(1);
            //give 0 "wood plank" (22) to submitter, just to refresh the inventory so the removed item icon disappear.
            im.GiveItem(session.Player, im.GetItem(22), 0);
            //Add attachment to vehicle.
            vehicleInventory.Items[slotNumber] = new ItemInstance(playerItemInstance.Item, playerItemInstance.Item.MaxStackSize);
        }
Beispiel #2
0
        string vehicleSwitch(PlayerSession session, ItemInstance playerItemInstance, RestrictedInventory vehicleInventory, int slotNumber)
        {
            var im = GlobalItemManager.Instance;

            //Remove attachment from player inventory
            playerItemInstance.ReduceStackSize(1);
            //Give vehicle attach to player inventory
            ItemInstance vehicleAttach = vehicleInventory.Items[slotNumber];

            im.GiveItem(session.Player, vehicleAttach.Item, 1);
            //Add attachment to vehicle.
            vehicleInventory.Items[slotNumber] = new ItemInstance(playerItemInstance.Item, playerItemInstance.Item.MaxStackSize);

            return(vehicleAttach.Item.GetNameKey());
        }