Custom Parameters for Inventory Items

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
_jrn
Posts: 5
Joined: 18 Jul 2011, 11:43

Custom Parameters for Inventory Items

Post by _jrn »

Hello,

I have a problem with setting custom parameters for inventory items.

When overriding OpenSpaceExtension getInventoryItemsList method i'm browsing the items list in the debugger but none of items has these fields defined in properties hashmap. All i have is:

Code: Select all

[null, null, null, null, null, null, null, null, null, null, null, null, null, null, key=sofa, null]
This is an example of inventory:

Code: Select all

{"cpk":"yName;yId","items":[{"t":"t","p":"furniture_fabric_sofa;88","a":"t6;;t6;;t6;;t6","i":"sofa"},{"t":"t","p":"furniture_design_coffee_table;89","a":"t48;;t48;;t48;;t48","i":"table"},{"t":"t","p":"furniture_design_guitar;90","a":"t19;;t19;;t19;;t19","i":"guitar"}]}
What's wrong with it?

BTW custom parameters are visible on client side after loading the inventory. Is there any possibility to have it on server side?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

How do you "browse the items list" exactly?
Paolo Bax
The SmartFoxServer Team
_jrn
Posts: 5
Joined: 18 Jul 2011, 11:43

Post by _jrn »

At first i tried to get the parameter using ItemProperties method

Code: Select all

getProperties().get( "yName" )
but it didn't work so i set the breakpoint to browse the list using debugger and search for my custom parameters with no success.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

But the list of ItemProperties objects is what you have to return when you override the getInventoryItemsList method. In other words you have to create those objects.
Paolo Bax
The SmartFoxServer Team
_jrn
Posts: 5
Joined: 18 Jul 2011, 11:43

Post by _jrn »

In overridden method getInventoryItemsList I call super.getInventoryItemsList() to get the full list of items and then filter it. The list is fine except not having custom parameters defined in OpenSpace Editor.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Ouch... we might have left some test code behind...
Can you please contact us by email? We will send a test extension to check if it works. If you own a retail license, please send your invoice too.
Thank you.
Paolo Bax
The SmartFoxServer Team
Post Reply