Custom Parameters for Inventory Items

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

Moderators: Lapo, Bax

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

Custom Parameters for Inventory Items

Postby _jrn » 18 Jul 2011, 12:00

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: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 19 Jul 2011, 12:24

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

Postby _jrn » 19 Jul 2011, 12:58

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: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 20 Jul 2011, 06:51

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

Postby _jrn » 20 Jul 2011, 07:05

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: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 25 Jul 2011, 13:12

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

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 19 guests