Thread: Fix for dropping max amount of an item.

Results 1 to 2 of 2
  1. #1 Fix for dropping max amount of an item. 
    Donator


    Join Date
    Jul 2011
    Posts
    921
    Thanks given
    199
    Thanks received
    178
    Rep Power
    189
    This will fix the overflow when dropping a ground item. This happens because in 317 clients, the max amount of an item is 999M.

    Client class: In the ground item spawn method or search for:
    Code:
    0xfa0a1f01
    The loop below is for selecting the top item based on the item amount and value:
    Code:
    int k = 0xfa0a1f01;
    Object obj = null;
    for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
    	ItemDef itemDef = ItemDef.forID(item.ID);
    	int l = itemDef.value;
    	if (itemDef.stackable) {
    		l *= item.anInt1559 + 1;
    	}
    	if (l > k) {
    		k = l;
    		obj = item;
    	}
    }
    You have to change the value calculations from int to long.

    So it looks like this:
    Code:
    long minValue = -Integer.MAX_VALUE;
    Object obj = null;
    for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
    	ItemDef itemDef = ItemDef.forID(item.ID);
    	long value = itemDef.value;
    	if (itemDef.stackable) {
    		value *= (long) (item.anInt1559 + (long) 1);
    	}
    	if (value > minValue) {
    		minValue = value;
    		obj = item;
    	}
    }
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Erethium Developer
    Code Kiwi's Avatar
    Join Date
    Jan 2015
    Posts
    432
    Thanks given
    179
    Thanks received
    23
    Rep Power
    72
    int i1 = i + (j << 7) + 0x60000000;
    worldController.method281(i, i1, ((Animable) (obj1)), getCenterHeight(plane, j * 128 + 64, i * 128 + 64),((Animable) (obj2)), ((Animable) (obj)), plane, j);
    Is this needed too?
    Last edited by Code Kiwi; 07-16-2020 at 08:58 PM. Reason: Don't worry, i figured it.
    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. Replies: 3
    Last Post: 03-05-2014, 10:01 PM
  2. Maximum amount of an item
    By Glenn in forum Help
    Replies: 15
    Last Post: 12-03-2011, 05:09 PM
  3. Replies: 8
    Last Post: 06-07-2011, 03:04 PM
  4. Random amount of an item on a drop[DELTA]
    By shoopdawhoop in forum Snippets
    Replies: 2
    Last Post: 12-10-2010, 11:43 AM
  5. Changing the max amount of an Item
    By Elid in forum Tutorials
    Replies: 10
    Last Post: 10-06-2008, 10:58 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •