Would you like to react to this message? Create an account in a few clicks or log in to continue.

Official Community Forums
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  The Wiki  Website  github Project  

 

 Has anyone created item stack?

Go down 
2 posters
AuthorMessage
TheWatcher
Experienced Newbie
Experienced Newbie
avatar


Posts : 21
Join date : 2011-10-18
Location : Blue Cone Rookery(actually, California)

Has anyone created item stack? Empty
PostSubject: Has anyone created item stack?   Has anyone created item stack? EmptyTue 20 Nov - 17:40

Has anyone created item stack? I mean code for stacking items in an inventory slot. (I assume it's not in the basic downloaded game files because I can't find it. But I could be wrong. If so, can someone point me to it?)

If anyone has coded for stacking, would you be willing to share tips and maybe some code samples?

Thank for any help anyone can give.

TheWatcher
Back to top Go down
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Has anyone created item stack? Empty
PostSubject: Re: Has anyone created item stack?   Has anyone created item stack? EmptyWed 21 Nov - 3:12

Not sure if anyone has created one. I can think of two main ways to do implement it the easy way:
Create a stackable property in MarsItem in mars.objects with the stack amount send that information to the client by modifying sendInvUpdateHelper in MarsInventoryClient and modify InvUpdateMessage in multiverse.Plugins.InventoryClient
Then client side handle the message coming in in MarsContainer and count up the number of the items and either make icons with each number value or add a new layer to the item icon display and if stackable display the number there. The problem with this method is that you can't organize the stack and each item in the stack would count towards the total number of items in a bag.


Another possible way would be to create items for each number of stacks and modify addItem so that it replace the current number of items with the next version. And then once used recreate the subtracted item.

The final and probably best way would be to create a structure like the bag to hold the items but you would probably need to make significant changes to implement it.
Back to top Go down
TheWatcher
Experienced Newbie
Experienced Newbie
avatar


Posts : 21
Join date : 2011-10-18
Location : Blue Cone Rookery(actually, California)

Has anyone created item stack? Empty
PostSubject: Re: Has anyone created item stack?   Has anyone created item stack? EmptyWed 21 Nov - 7:14

The inventory display on the client already has a stack count and a displayed count that shows over the items upper left corner for stack-able items. Part of the problem is that I can't seem to get the system to recognize that an item is meant to be stack-able.

Also, several functions in the Mars routines are incomplete or broken. They only return a hard coded value like '0' (zero) or '1'. Ex. in MarsContainer, GetContainerItemInfo always returns a count of 1. But GetInventoryItemCount always returns 0.

I have managed to get item counts to show in the inventory item slots by changing the item count in the inventory slots from 0 to 1. But when I try to drop an item on top of another like item to stack them, the routines just swap the 2 items. The routines do not include include stacking of items, just dropping or swapping.

In my system, I've added, {put(...)}, 2 name/variables to each item that are the Stack_Limit and Stack_Count for stack-able items. I had hoped to just drop the Stack_Count into the Inventory slot's stack count for displaying the stack count on the inventory bag.

The routines I'm working with mostly is in the assets folders; Interface\FrameXML\MvContainer.py and scripts\MarsContainer.py . My items are defined in templates.py in the config folder.

On top of this problem is that I'm learning python at the same time. (I really wish I could re-write these python routines in C++. But I'm thinking that would open up a whole new can of worms.)

Did the Multiverse people write the Mars routines or did that come from someone else?

If no one else has done it yet, I suppose I just have to bite the bullet and figure it out myself. I'll try to keep track of the changes I make so I can post them here for others to use/fix/improve.

Again, thank for the help.
Back to top Go down
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Has anyone created item stack? Empty
PostSubject: Re: Has anyone created item stack?   Has anyone created item stack? EmptyWed 21 Nov - 7:36

They wrote the mars routines but either they wrote swap function last or someone else wrote it because I do not have it in my original mv server. I think they planned on redoing some of the inventory features or adding more functionality but did not get to it.
Back to top Go down
Sponsored content





Has anyone created item stack? Empty
PostSubject: Re: Has anyone created item stack?   Has anyone created item stack? Empty

Back to top Go down
 
Has anyone created item stack?
Back to top 
Page 1 of 1
 Similar topics
-
» Has anybody created a Docker container for a Multiverse server install?
» How does one delete an item?
» Cash Shop Item

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Server Scripting and Development-
Jump to: