Thread: Names Above Ground Items

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31
  1. #1 Names Above Ground Items 
    Registered Member
    Deku's Avatar
    Join Date
    May 2016
    Posts
    144
    Thanks given
    36
    Thanks received
    101
    Rep Power
    149
    Pretty simple, but haven't seen it released (add a toggle if ya want)



    Code:
    	private void render_ground_item_names() {
    		for (int x = 0; x < 104; x++) {
    			for (int y = 0; y < 104; y++) {
    				Deque node = groundItems[plane][x][y];
    				int offset = 12;
    				if (node != null) {
    					for (Item item = (Item) node.getFirst(); item != null; item = (Item) node.getNext()) {
    						ItemDefinition itemDef = ItemDefinition.lookup(item.ID);
    						get_raster_position((x << 7) + 64, 64, (y << 7) + 64);
    						newSmallFont.drawCenteredString(itemDef.name + (item.anInt1559 > 1 ? " (" + item.anInt1559 + ")" : ""), scene_draw_x, scene_draw_y - offset, 0xffffff, 1);
    						offset += 12;
    					}
    				}
    			}
    		}
    	}
    For reference,
    Code:
    	private void get_raster_position(int raster_x, int height, int raster_y) {//calcEntityScreenPos
    		if (raster_x < 128 || raster_y < 128 || raster_x > 13056 || raster_y > 13056) {
    			scene_draw_x = -1;
    			scene_draw_y = -1;
    			return;
    		}
    		int tile_bounds = method42(plane, raster_y, raster_x) - height;
    		raster_x -= absoluteX;
    		tile_bounds -= anchor;
    		raster_y -= absoluteY;
    		int sine_y = Model.SINE[yCameraCurve];
    		int cosine_y = Model.COSINE[yCameraCurve];
    		int sine_x = Model.SINE[xCameraCurve];
    		int cosine_x = Model.COSINE[xCameraCurve];
    		int pos = raster_y * sine_x + raster_x * cosine_x >> 16;
    		raster_y = raster_y * cosine_x - raster_x * sine_x >> 16;
    		raster_x = pos;
    		pos = tile_bounds * cosine_y - raster_y * sine_y >> 16;
    		raster_y = tile_bounds * sine_y + raster_y * cosine_y >> 16;
    		tile_bounds = pos;
    		if (raster_y >= 50) {
    			scene_draw_x = Rasterizer.textureInt1 + (raster_x << SceneGraph.viewDistance) / raster_y;
    			scene_draw_y = Rasterizer.textureInt2 + (tile_bounds << SceneGraph.viewDistance) / raster_y;
    		} else {
    			scene_draw_x = -1;
    			scene_draw_y = -1;
    		}
    	}
    And call
    Code:
    render_ground_item_names()
    below(*meant above)
    Code:
    draw3dScreen();
    Can add a rarity color and value onto the string if ya want, but this is just basic
    Reply With Quote  
     


  2. #2  
    vippy smells


    Join Date
    Sep 2014
    Age
    20
    Posts
    2,086
    Thanks given
    1,132
    Thanks received
    952
    Rep Power
    3231
    Nice snippet.


    "There's no such thing as a PI client " - Albert Einstein

    Quote Originally Posted by soccerchamp149 View Post
    whats eclipse lol
    Reply With Quote  
     

  3. #3  
    Cynica
    Professor Oak's Avatar
    Join Date
    Jun 2016
    Posts
    1,485
    Thanks given
    996
    Thanks received
    1,182
    Rep Power
    3194
    I've seen that you've released a bunch of useful stuff lately, thanks for that! Keep it up!
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #4  
    Registered Gangster

    Gang's Avatar
    Join Date
    Nov 2013
    Posts
    583
    Thanks given
    105
    Thanks received
    268
    Rep Power
    3728
    Thx, gonna use it.

    "You have given out too much Reputation in the last 24 hours, try again later."
    Reply With Quote  
     

  5. #5  
    Best Rat Donor

    Australisch's Avatar
    Join Date
    Nov 2015
    Age
    22
    Posts
    1,999
    Thanks given
    938
    Thanks received
    391
    Rep Power
    2805
    nice release, good stuff man.
    Working on a project, stay tuned or hmu for details. 24/02/2018......
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Apr 2017
    Posts
    254
    Thanks given
    26
    Thanks received
    46
    Rep Power
    59
    Ive actually tried to me a cheap version of this a while ago, but will use this instead. Thanks D
    Reply With Quote  
     

  7. #7  
    Registered Member
    Deku's Avatar
    Join Date
    May 2016
    Posts
    144
    Thanks given
    36
    Thanks received
    101
    Rep Power
    149
    Quote Originally Posted by VenomRS View Post
    Ive actually tried to me a cheap version of this a while ago, but will use this instead. Thanks D
    Thanks
    Reply With Quote  
     

  8. #8  
    Registered Member
    mige5's Avatar
    Join Date
    Aug 2008
    Posts
    5,061
    Thanks given
    404
    Thanks received
    959
    Rep Power
    1308
    u need to update the packet otherwise larger item amounts wont showup correctly.
    ...
    Reply With Quote  
     

  9. Thankful user:


  10. #9  
    Registered Member
    Deku's Avatar
    Join Date
    May 2016
    Posts
    144
    Thanks given
    36
    Thanks received
    101
    Rep Power
    149
    Quote Originally Posted by mige5 View Post
    u need to update the packet otherwise larger item amounts wont showup correctly.
    Well yeah... just change anInt1559 type to long instead of short and edit the type size from 2 to 8
    Didn't think I'd have to include it but oh well

    Example (Packet44 - sendGroundItem)
    Code:
    if (j == 44) {
    	int k2 = stream.readLEUShortA();
    	long j5 = stream.readLong();//stream.readUShort();
    Code:
    new SendCoordinates(g.getLocation(), base).execute(client);
    StreamBuffer.OutBuffer out = StreamBuffer.newOutBuffer(12);//was 6
    out.writeHeader(client.getEncryptor(), 44);
    out.writeShort(g.getItem().getId(), StreamBuffer.ValueType.A, StreamBuffer.ByteOrder.LITTLE);//2
    out.writeLong(g.getItem().getAmount());//was writeShort 2 // now long 8
    out.writeByte(0);//2
    client.send(out.getBuffer());
    Code:
    public static final int[] PACKET_SIZES = {
    		0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 	//0-9
    		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 	//10-19
    		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 	//20-29
    		0, 0, 0, 0, -2, 4, 3, 0, 0, 0, 	//30-39
    		0, 0, 0, 0, 11, 0, 0, 6, 0, 0, 	//40-49 	//Edited: 11 was 5 - sendGroundItem

    Reply With Quote  
     

  11. #10  
    Special Snowflake

    DeathKid's Avatar
    Join Date
    May 2013
    Posts
    379
    Thanks given
    186
    Thanks received
    92
    Rep Power
    356
    Going to use, thanks .
    "Always remember that you are unique. Just like everyone else" - My Mom
    Reply With Quote  
     

Page 1 of 4 123 ... LastLast

Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Item's name on ground
    By JacobiYounger in forum Help
    Replies: 4
    Last Post: 05-26-2016, 07:48 PM
  2. Replies: 11
    Last Post: 12-02-2015, 11:28 PM
  3. Replies: 8
    Last Post: 02-28-2009, 10:50 PM
  4. 100% Perfect picking up ground items! + Video
    By Pkitten in forum Tutorials
    Replies: 177
    Last Post: 09-26-2008, 10:32 PM
  5. Replies: 1
    Last Post: 10-23-2007, 12:40 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
  •