• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJass] (System) CustomInventory

By far the biggest inventory system for Warcraft 3.
It's designed to have optional features, like FullScreenInventory-UI.

With a little bit of modification you can use this Inventory System in the normal Warcraft 3 Inventory too.

It is written in vJASS and has the following features:
- 12 Slot Equipment
- MPI
- Very flexible
- Easy to add bonuses to items
- Item Stacking
- Item Forging
- Item Sets (With bonuses)
- Inventory fixes warcraft 3 bugs (Double pickup bug)
- Fast
- Gives the ability to add your own areas with a little bit of code

A small note on the classes:

##############################################################################
# USER INTERFACE - CUSTOM WINDOW
##############################################################################
---------------
CWDestructable
---------------
It's an object that has an destructable for a local player.
(Such as icons, borders and more)

---------------
CWTrackable
---------------
This is basically an object that triggers player events for hovering the icons (CWDestructable).
Whenever an event occurs, it fires an action to the CustomWindow

---------------
CustomWindow
---------------
A collection of CWTrackable and CWDestructable. Every destructable will have an trackable object.
So whenever you hover over or click a trackable, this will be fired.
You will use this object to create hooks to the inventory system.

##############################################################################
# CUSTOM WINDOW - HOOK AND EXTENDING
##############################################################################

---------------
CIAll
---------------
This is a container object of items. It has conditions for pickup and drop and is the base
class for any container, like Slots, Potions, Equipment or even spell slots that you could create!
It has a variety of methods like adding, removing and checks and throws errors.

---------------
CIActions
---------------
This is a library which only use is to find out what the user wants to do. It supports up to 5
different steps which can be done in a row so if you need to build up something complicated here you go.
This action decides when to move, drop, pick and destroy items. It's bound to CIWindow and uses its
events to trigger / delegate events to the CISlots/CIEquips/CIPotions objects.

---------------
CIContent
---------------
This is a little help class for the CIActions object which puts a wrapper around the Equipment,
Potions and Slots. It will also update the camera.

---------------
CIWindow
---------------
This is the hook between CustomWindow, CIActions and the CustomInventory. It also provides
fake units to provide the Interface Functionality and delegates events to CIActions.

---------------
CISlots / CIEquips / CIPotions
---------------
The containers you see (Top left, top right and bottom left) are basically these objects.
They have special / unique conditions for pickup / drop and handle when to add or remove bonuses from the hero.

##############################################################################
# CUSTOM INVENTORY - CORE
##############################################################################

---------------
CIForging
---------------
This module forges items. You can combine any items and merge them to a bigger item. This will
always happen when your inventory updates.

---------------
CIStacking
---------------
You like items that can stack in your Inventory? Well this module is for you!
Create stackable items and make a maximum conditions. Item stacking is automatic, whenever
inventory updates.

---------------
CISet
---------------
Don't we all love this thing from World of Warcraft? Collecting items of a special set and
then get some bonus stuff once we have all of them. If you are cool, use this feature. It
even supports SET STACKING!

---------------
CIAttachment
---------------
Not done yet.

---------------
CIBonus
---------------
This is the hook between items and the unit state modifier library. You can use this module
to add and remove bonuses to the hero on the fly whenever needed.

---------------
CIError
---------------
Throw errors to the user whenever something bad happens.

---------------
CIEventHandler
---------------
Like every other Inventory system, we need some kind of hook for pickup/drop actions to
connect them with our CustomInventory. This will trigger the CustomInventory events.

---------------
CIEvents
---------------
Name may not be completely self-speaking, but this actually triggers the events on the item.
But only when the unit really has the item. (Safety layer)

---------------
CIItemDrop
---------------
This will allow pickup/drop actions of the items WITHOUT triggering the inventory events.
It will be required for many things so this module is a life safer!

---------------
CIItemInfo
---------------
Wouldn't it be cool if items could display what they are in a multiboard. Yes it would.
This module is exactly for that.

---------------
CIItemBoard
---------------
Yes, this is the multiboard which displays all the item statistics. It uses hooks to get
the attached events from the CUstomWindow.

---------------
CIItemProtection
---------------
Every item has states, like locked, owend, equiped and such. This module gives the ability
to change the states and make them available.

---------------
CIItemDest
---------------
Simple module for setting the destructable (icon) for the CustomWindow.

---------------
CIItemSeek
---------------
Module which is build to search and collect information about the inventory.
Find out how many items of which type you have that are not stacked, find out how many duplicated
items you have and even if you have errors in your inventory indexing.

---------------
CIItemSlot
---------------
Small module that adds classes to the items. You can only equip items with the right class
on the right positions.

---------------
CIItemEffect
---------------
This module allows to attach effects to an item wearer. Do whatever you want, but keep in mind
that one item has a maximum of 3 effects.

---------------
CIPowerup
---------------
Not done yet.

---------------
CISetup
---------------
Changes the area around the inventory to be black and create the UI for all players.


---------------
CustomItem
---------------
The item object itself. Will trigger and get triggered from all kind of sources.
Modules are completing the collection of members and methods.

---------------
CustomInventory
---------------
The main object. It forges, stacks, creates sets, triggers events, gets triggered and uses
optional modules to provide the full repository of features to the user.



-Fixed a bug found by Dr. Boom:
Dead units were able to change the inventory and caused bugs.
-Also added a little bit of documentation.


Keywords:
CustomInventory, Inventory, Custom, Anachron, FullScreen, Module, vJass, Stack, Forge, Combine, Set, Powerup, Drop, Equip, Equipment, Equip, System
Contents

CustomInventory - 0.2.2.6 (Map)

Reviews
18:27, 18th Feb 2010 The_Reborn_Devil: Ohsh- That describes pretty much what I'm thinking. My eyes were sore even before I was done reviewing half of the code. The code looks really good and I couldn't find just one little thing that would be...
Level 14
Joined
Mar 30, 2009
Messages
971
CONGRATULATIONS!!!!

you did it. tested 3 times, couldnt bug.

now we'll see some more features?

EDIT: after further testing i must admit that i am not able to reproduce the white icon bug.
even if i lagg my computer to the extent that my input starts crying, i still cant bug it anyhow.

though 2 bugs still exist: i can equip any item as a weapon.
when i pick items up really fast, system bugs: cant pick up anything else. ever (in that runtime i mean)
 
Level 17
Joined
Jun 9, 2007
Messages
2,493
Yepp, it does work.
But i got another problem.
The 3rd time played the map, it told me that i couldent pickup any of the items.
I could not reverse this so that im able to pickup items again, im gonna watch replay (if it works) to see if i can find what i did..

Edit:
I could not find anything special in the replay..
I just open the inventory & then clicked around...
Maybe the system wasnt done loading when i opened it???

The bug is! Some Warcraft III Versions / OS are not compactible with CreateDestructableZ and thus placing them ON THE BOTTOM instead in the air above the trackable.
Zomg D:
When i think of it.... I have 2 different versions of warcraft 3 home (different installers, boxes, etc).
Does this mean that the one i currently use is bugged? xD
 
You picked up items before the 5nd ingame time minute.
One of the next bugfixes I'll do.
(Currently fixing potion into weaponslot bug)

Edit:
I could not find anything special in the replay..
I just open the inventory & then clicked around...
Maybe the system wasnt done loading when i opened it???
Exactly

Zomg D:
When i think of it.... I have 2 different versions of warcraft 3 home (different installers, boxes, etc).
Does this mean that the one i currently use is bugged? xD
Yes :D

EDIT: after further testing i must admit that i am not able to reproduce the white icon bug.
even if i lagg my computer to the extent that my input starts crying, i still cant bug it anyhow.
Yes. Thats nice :)

though 2 bugs still exist: i can equip any item as a weapon.
when i pick items up really fast, system bugs: cant pick up anything else. ever (in that runtime i mean)
Yes. First is fixed now. Redownload new version please.
2nd will be fixed as fast as I have an idea how to fix ;) Basically I somehow have to limits the items you can pick up.

# Update - 0.1.Z
- Only weapons can be equipped into the hand slots now.
 
next you could add new information to the multiboard when hovering over different buttons. like empty equip slots and esc and all of those ("all slots" minus "slots with items" minus "empty inv slots")
Yes, plus fixing the to fast pickup so the system bugs bug and also I start working on the Diablo3 UI for this inventory.
After that I'll make vendors and such.

Edit: Added Known Bugs to the first post!
 
Level 17
Joined
Jun 9, 2007
Messages
2,493
Picking up items to fast will make the engine break.
You really should do something about this.
It is a very serious problem.
Cant you simply make the engine wait with the loading until the current one is done loading?
Well, you cant "simply" do it, but i am sure that you will find a workaround for this issue :)
 
Level 12
Joined
May 21, 2009
Messages
994
You really should do something about this.
It is a very serious problem.
Cant you simply make the engine wait with the loading until the current one is done loading?
Well, you cant "simply" do it, but i am sure that you will find a workaround for this issue :)

Yes I think this is a really good idea, it could maybe be something like: "unit pick up item blah blah" if booleanstuff != true then set booleanstuff = true, timerstart and don't load items until timer is expired. Then when the timer expires it will set the booleanstuff back to false and load item. This is something I wrote fast so it might not be as simple as that.
 
Level 12
Joined
Feb 11, 2008
Messages
809
Thats good! Have you got the custom skins yet?

i dont think he needs them now that the white icon bug is fixed but i hope he will continue to work on this adding more and more customization to it :thumbs_up:

Also im shure he will eventually get the time to really make it more noob friendly as in describing what each trigger/action does maybe in a readme.
 
Yes I think this is a really good idea, it could maybe be something like: "unit pick up item blah blah" if booleanstuff != true then set booleanstuff = true, timerstart and don't load items until timer is expired. Then when the timer expires it will set the booleanstuff back to false and load item. This is something I wrote fast so it might not be as simple as that.
I already have that, I will just need to increase the wait time for the timer back again.

Thats good! Have you got the custom skins yet?
Not yet, waiting for Elenai. (Yes, Elenai will do the skins!)

i dont think he needs them now that the white icon bug is fixed but i hope he will continue to work on this adding more and more customization to it
But ofcourse, I will surely add more stuff now ;-).

Also im shure he will eventually get the time to really make it more noob friendly as in describing what each trigger/action does maybe in a readme.
Woot, that would make at least 100 pages :D But I am quite positive that I will do it on the final 1.0 version :)
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
Pros :
OMFG, this shit is epic! This is everything that i need!
Cons :
Minimap is black. Only thing.
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
Wait. I picked up all 4 hp pots in a second. Then i couldn't pick up any of the other items.

EDIT : I tried it 3 more times here is the result :
In 1/3 tries it didn't happen, but maybe more because of me beign slow then the bug.
 
Yes that means the bug occurs.
But what if you wait a few seconds ingame and then try to pickup items very fast?

Edit:
By the way, I am happy saying that the new version will have a brand new Error system. Now you can see the reason why you can't do an action.

Also I am fixing the to fast pickup bug right now. Stay tuned!
 
Level 14
Joined
Mar 30, 2009
Messages
971
results of first 3 tests:
it bugged every time. the time between pick ups seems irrelevant. o.o

EDIT: but its a different bug. the user interface seems to bug. shows more icons than there is. i can also move those non-existent potions around, but they dissappear on dropping. i can freely drop and pick up other items.
168864-albums3027-picture25856.jpg

when i try to pick them up again they bug:
i can use them, but they dont show up on FSI
168864-albums3027-picture25857.jpg
 
Top