1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  3. Participate in Blizzard's Public Test Realm to give them feedback on the upcoming patches. Info is here.
    Dismiss Notice
  4. Take part in forum poll and decide the winner of Icon Contest #16!
    Dismiss Notice
  5. Congratulate the winners of the first ATC contest!
    Dismiss Notice
  6. Zwiebelchen is hosting a special UI texturing contest. Whomever wins will get a $150 reward through paypal! Come along and draw your texturing tools for the Fantastic Adventurer UI contest.
    Dismiss Notice
  7. Sneak, pickpocket and assassinate! Create a stealth map in Mini-Mapping Contest #14!
    Dismiss Notice
  8. Music Contest #8 - Hive Soundtrack is up! Create the soundtrack for the upcoming videos of Hive Workshop's YouTube Channel.
    Dismiss Notice

[vJass] (System) CustomInventory

Submitted by Anachron
This bundle is marked as approved. It works and satisfies the submission rules.
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:
Basic readme for developers

##############################################################################
# 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.


0.2.2.6

-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
Moderator
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...
  1. Moderator

    Moderator

    Resources:
    0
    Resources:
    0
    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 enough to reject this...
    This is the best inventory system I've seen and I've seen maaaany.


    Edit:
    Since you updated I had to review it again. It looks good, but I did notice one thing >:D

    1. You don't need those null filters like in CIEventHandler
    Code (vJASS):

    private function InvNullFilter takes nothing returns boolean
        return true
    endfunction

    That bug has been fixed.

    Other than that the code looks good and it's very easy to use.
    Would be more awesome if the system had fewer lines though as this system is frikken HUGE. It hurts to review it.


    Status: Approved
    Rating: Director's Cut! [6/5] Plz?

    hvo-busterkomo: After evaluating this system I do not think it meets the standards to be a Director's Cut. However, in respect to The_Reborn_Devil, I have left it as Highly Recommended.
     
  2. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,147
    Resources:
    64
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Resources:
    64
    Bugfree. Enjoy.

    Here is the package of informations:
    View attachment CI.zip

    Subscribing.
    Also please give comments, suggestions, critique, ideas and credits!

    Known Bugs



    Go to the discussion thread.

    ToDo:
    • When you mouse over the exit button, drop button or any of the armor slots, the board should say what it is
    • Attachment system
    • (Maybe) UI update when Elenai did so.
    • Vendors
    • Tradesystem
    Later

    • Enable swapping between units and trackables as selecters.
    • The potion slots should have potion icons to separate them from the normal slots
    • You used the name "hand" for the weapon slot (I think "weapon" would be better because people can confuse hand and gloves i guess
    • I think it would be less confusing to use the inventory icons i linked to so that people can distinguish the slots
    • Create a save/load code generator for this CI.

    How to connect with a save-load system:
    Code (vJASS):

    private function loadItems takes unit theUnit returns nothing
        // Load the inventory
        local CustomInventory inv = CustomInventory.load(GetHandleId(theUnit))
        // Load the item object
        local CustomItem it1 = inv.getItem(0)
        // Get the itemhandle
        local item i1 = it1.getHandle()

        // Print the itemname for testing purposes.
        call BJDebugMsg(GetItemName(i1))
    endfunction
     

    This will load the first item of the inventory of unit theUnit and print the item name.
     

    Attached Files:

    • load.jpg
      load.jpg
      File size:
      482.9 KB
      Views:
      2,611
    Last edited: May 20, 2010
  3. mattstheman

    mattstheman

    Joined:
    Jun 29, 2009
    Messages:
    141
    Resources:
    0
    Resources:
    0
    A few things...

    1) How do I drop an item? It seems a little confusing and doesn't work half the time.
    2) The exit inventory button doesn't work
    3) Is there a sell to vendor button?
    4) If I right click to move on the empty black part of the inventory, the hero moves there. This might cause some problems.
     
  4. Slaydon

    Slaydon

    Joined:
    Jan 6, 2008
    Messages:
    2,437
    Resources:
    0
    Resources:
    0
    very nice :D,

    but the exit button aint working :S
     
  5. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,147
    Resources:
    64
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Resources:
    64
    Select an item and press the drop button. It works in 100% of the times.
    Fuck, forgot to remove that little bastard! :D
    No, its not a feature in the first official beta.
     
  6. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,618
    Resources:
    1
    Spells:
    1
    Resources:
    1
    God!
    AWESOME!
    Finally here!

    I'm going to stress test this system!
     
  7. mattstheman

    mattstheman

    Joined:
    Jun 29, 2009
    Messages:
    141
    Resources:
    0
    Resources:
    0
    Where do I go to change the icon placeholders in the equipment section. I looked around in the code but couldn't find it. I'm sure it's somewhere obvious but I'm not a jasser and can't find it :(

    EDIT: nvm found it haha
     
  8. 88WaRCraFT3

    88WaRCraFT3

    Joined:
    Jun 9, 2009
    Messages:
    1,144
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Unable to save map a little error :
    Error Image
    Errooor.JPG

    I have JNGP thats normal. Fix that.
     
  9. syltman

    syltman

    Joined:
    Jun 13, 2007
    Messages:
    1,328
    Resources:
    0
    Resources:
    0
    When I equipped the claws of attack and then the Clawns of Attack Powerup the item vanished completely and then when I picked up another item it showed up again.

    I can't move my mainhand to offhand, offhand to mainhand.

    The borders seems to be flickering and changing when I equip and unequip stuff.

    If AdvancedTable is basicly Table then you should change it names to something else as there is a chance that someone will make a system named AdvancedTable.

    I think that the multiboard should fill the entire right side from top bottom, that way it feels more UI like.

    The lightning settings are at night, you should add something that makes it turn to day everytime you enter the UI so the lightning doesn't mess up the colours.

    -------------------------------

    I haven't really gotten into the code but these are stuff that I notice for now.
     
  10. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,147
    Resources:
    64
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Resources:
    64
    Thanks, please give feedback and the result of the stress test :p

    CIItemSlot (At modules)
    Code (vJASS):

            constant integer ITEM_CLASS_ICON_HAND        = 'cihn'
            constant integer ITEM_CLASS_ICON_TWOHANDER   = 'cihn'
            constant integer ITEM_CLASS_ICON_RING        = 'cirg'
            constant integer ITEM_CLASS_ICON_MISC        = 'cimc'
            constant integer ITEM_CLASS_ICON_BOOTS       = 'cibt'
            constant integer ITEM_CLASS_ICON_MAIN        = 'cimn'
            constant integer ITEM_CLASS_ICON_TROUSER     = 'citr'
            constant integer ITEM_CLASS_ICON_AMULET      = 'ciam'
            constant integer ITEM_CLASS_ICON_GLOVE       = 'cigv'
            constant integer ITEM_CLASS_ICON_HELMET      = 'cihd'
            constant integer ITEM_CLASS_ICON_SHOULDER    = 'cish'
     

    You have to change the destructables with these IDs in the object editor.
    You will have to put the path to the new icon into the field with id 'texFile'

    I temporary disabled powerups.

    Which version of JassHelper do you have?

    You can't move anything in the equipment.

    Its table for all types, not only integers.

    You can easily do that, and I like it that way imho.

    Yes, the border stuff is currently not very good. I will change that.
     
  11. Frunck

    Frunck

    Joined:
    Nov 11, 2009
    Messages:
    172
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Awesome.
     
  12. mattstheman

    mattstheman

    Joined:
    Jun 29, 2009
    Messages:
    141
    Resources:
    0
    Resources:
    0
  13. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,147
    Resources:
    64
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Resources:
    64
    No problem.
     
  14. Slaydon

    Slaydon

    Joined:
    Jan 6, 2008
    Messages:
    2,437
    Resources:
    0
    Resources:
    0
    when i save i get Unable to find textmacro "optional"
    Code (vJASS):
    //! runtextmacro optional RunAutoEvent("Resurrect")
     
  15. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,618
    Resources:
    1
    Spells:
    1
    Resources:
    1
    After moving the same item on other random slots, the map just crashed! Ô_Ô"
    Anyway, very hard coded, has a lot of functionality, but you waste a lot of space with the slots.
    I mean, seriously, why so much space between the slots? You can make them bigger or make more of them.
    You should also add pages to the inventory. (That you can remove for the D3W project)

    I can't wait for the other modules to be in the beta! :D
     
  16. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,147
    Resources:
    64
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Resources:
    64
    Please make sure you have the latest version of JassHelper.

    Holy crap, really??? :S

    With that functionality its hard to not extreme code it.
     
  17. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,618
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Didn't happend next time I tried.


    I realise :D
     
  18. Slaydon

    Slaydon

    Joined:
    Jan 6, 2008
    Messages:
    2,437
    Resources:
    0
    Resources:
    0
    I have version 0.9.G.1, and you?
     
  19. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,618
    Resources:
    1
    Spells:
    1
    Resources:
    1
    WoW.
    That's quite old.
    Get the newest version. It's always the best. :wink: