-
ushort to int
Hey,
I needed to convert in my items_base table the item_id column to int(11), but now i also have to edit my emulator.
Can somebody help me with that?
I get now some random errors like "cannot convert from 'int' to 'ushort'" and i dont know how to solve that.
Greets,
Twan
-
Re: ushort to int
Convert.ToInt32(); ?
It says cannot convert to ushort.
Convert.ToUInt16();
https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
-
Re: ushort to int
So, now this is my Item.cs now:
Code:
using System;
using System.Collections.Generic;
using Butterfly.HabboHotel.Items;
using Butterfly.HabboHotel.Items.FurniInitializers;
using Butterfly.HabboHotel.Items.FurniInteractors;
using Butterfly.HabboHotel.Items.FurniTriggers;
namespace Butterfly.HabboHotel.Items
{
class Item
{
internal int Id;
internal int SpriteId;
internal string PublicName;
internal string Name;
internal char Type;
internal int Width;
internal int Length;
internal double Height;
internal bool Stackable;
internal bool Walkable;
internal bool IsSeat;
internal bool IsGift;
internal bool AllowRecycle;
internal bool AllowTrade;
internal bool AllowMarketplaceSell;
internal bool AllowGift;
internal bool AllowInventoryStack;
internal InteractionType InteractionType;
internal IInteractable FurniInteractor;
internal IInitializer<RoomItem> FurniInitializer;
internal IFurniTrigger FurniTrigger;
internal SortedDictionary<uint, double> HeightModes;
internal List<int> VendingIds;
internal int Modes;
internal bool IsGroupItem;
internal int ItemId
{
get
{
return Id;
}
}
internal bool IsMultiHeight
{
get
{
return HeightModes != null;
}
}
internal Item(int Id, int Sprite, string PublicName, string Name, string Type, int Width, int Length,
double Height, bool Stackable, bool Walkable, bool IsSeat, bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack,
InteractionType InteractionType, int Modes, string VendingIds, SortedDictionary<uint, double> heightModes, bool isGroupItem)
{
this.Id = Id;
this.SpriteId = Sprite;
this.PublicName = PublicName;
this.Name = Name;
this.Type = char.ToLower(Type[0]);
this.Width = Width;
this.Length = Length;
this.Height = Height;
this.Stackable = Stackable;
this.Walkable = Walkable;
this.IsSeat = IsSeat;
this.AllowRecycle = AllowRecycle;
this.HeightModes = heightModes;
this.AllowTrade = AllowTrade;
this.AllowMarketplaceSell = AllowMarketplaceSell;
this.AllowGift = AllowGift;
this.AllowInventoryStack = AllowInventoryStack;
this.InteractionType = InteractionType;
this.FurniInteractor = FurniInteractorFactory.GetInteractable(this.InteractionType);
this.FurniInitializer = FurniIInitializerFactory.GetInteractable(this.InteractionType);
this.FurniTrigger = FurniTriggerFactory.GetInteractable(this.InteractionType);
this.Modes = Modes;
this.VendingIds = new List<int>();
this.IsGift = false;
this.IsGroupItem = isGroupItem;
foreach (string VendingId in VendingIds.Split(','))
{
this.VendingIds.Add(int.Parse(VendingId));
}
}
}
}
But i still get errors on lines like this (The best overloaded method match for 'Butterfly.HabboHotel.Users.Inventory.InventoryComponent.AddNewItem(uint, ushort, string, bool, bool, uint)' has some invalid arguments:)
Code:
uint id = Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, Item.ItemId, ExtraData, true, false, 0).itemID;
and cannot convert from 'int' to 'ushort
Code:
uint idTwo = Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, Item.ItemId, "0", true, false, 0).itemID;