Official Community Forums
 
HomeHome  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  The Wiki  Website  github Project  

Share | 
 

 Has anyone created item stack?

View previous topic View next topic Go down 
AuthorMessage
TheWatcher
Experienced Newbie
Experienced Newbie


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

PostSubject: Has anyone created item stack?   Tue 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


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Has anyone created item stack?   Wed 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


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

PostSubject: Re: Has anyone created item stack?   Wed 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


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Has anyone created item stack?   Wed 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




PostSubject: Re: Has anyone created item stack?   

Back to top Go down
 
Has anyone created item stack?
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Requesting a Charged Collection item
» Item Guide--Name and Gifting Level
» Orions Magical Wokshop ITEM LIST
» Does "the shrouding" stack?
» Is it worth leveling my Ultra Rare item acc?

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