Thread: Instanced Item System (For 99999+ unique items)

Results 1 to 2 of 2
  1. #1 Instanced Item System (For 99999+ unique items) 
    Registered Member
    Join Date
    Feb 2010
    Posts
    279
    Thanks given
    43
    Thanks received
    26
    Rep Power
    7
    Just as the thread title says, I would like help creating an instanced item system. I know it has been done before and I have seen examples in the community, such as "Borderscape" from the past.

    I would like to know if anyone knows how to do this, knows of a source with this, or can point me in the right direction to help me create this.

    For those of you who have no idea what this is but could probably help in making it, its a system that basically makes every itemid be attached to another value for further customization.

    The example of what I'd like to create would be:

    4151:0:1 Which would mean a player has 1 of a normal whip
    4151:2:1 Which would mean a player has 1 of an abnormal whip

    Or another example is

    18349:100000:1 Which would mean a player has 1 rapier with 100k uses
    18349:50:1 Which would mean a player has 1 rapier with 50 uses


    The possibilities are endless when it comes to attaching a value to every single item, with common usages being "charges" of some form and alterations of an items stat values based on the ints, but I'd like to take it farther than that, which is why I would like help with creating this system.
    Reply With Quote  
     

  2. #2  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    967
    Thanks given
    47
    Thanks received
    161
    Rep Power
    366
    The best would be to make use of Item objects (as opposed to an array containing the ids and an array containing the amounts).
    Such a plain Item object would contain the itemId and itemCount/itemAmount.
    A special item such as a rapier would have its own class.
    A class extending the Item class with an aditional variable: charge.

    Before items would be differentiated by itemId but now things should be done a bit different.

    In the Item class, you would have a method named (for example): isSameTypeAs.
    It could look like this:
    Code:
    public boolean isSameTypeAs(Item compare){
       return this.getSpecialIdentifier() == compare.getSpecialIdentifier();
    }
    The Item class should then have the method getSpecialIdentifier():
    Code:
    private int getSpecialIdentifier(){
       return id;
    }
    For normal items (items not extending the Item class), the special identifier would be the same as the id of the item.
    (This would be NOT the same method as getId(), despite returning the same value.)

    An item extending the Item class would override this method in order to create an output different from the normal one.
    For the abnormal whip it COULD be:
    Code:
    private int getSpecialIdentifier(){
       return 1 << 16 | id;
    }
    The 1 would indicate it's different. Another, different type of, abnormal would have another value.
    The rapier could include the charge in this special identifier.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Latest Item.java for silabs client!
    By P Hatz Own in forum Downloads
    Replies: 27
    Last Post: 01-21-2008, 03:16 AM
  2. Newest Updated Item.Java for Miss Silabsoft
    By BLooDHounD in forum Tutorials
    Replies: 11
    Last Post: 09-16-2007, 02:36 AM
  3. Newest Item.java for Silab's Client!
    By Brandon™ in forum Downloads
    Replies: 13
    Last Post: 09-12-2007, 01:56 AM
  4. Item.java for Miss Silab's Client!
    By Brandon™ in forum Configuration
    Replies: 10
    Last Post: 09-07-2007, 08:23 PM
  5. Item.java for Miss Silab's Client!
    By Brandon™ in forum Downloads
    Replies: 13
    Last Post: 09-07-2007, 05:08 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •