Thread: Custom Projectile Convert Issue

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Custom Projectile Convert Issue 
    Christ is King

    Makar's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    2,004
    Thanks given
    545
    Thanks received
    965
    Rep Power
    427
    Ok. I was frustrated with getting custom speeds using the current RS2HD sendProjectile method, so I tried converting Dkk's.

    I converted this:
    Code:
    	public void sendProjectile(Entity receiver, WorldTile startTile, WorldTile endTile, int gfxId, int startHeight, int endHeight, int speed, int delay,  int curve, int startDistanceOffset, int creatorSize) {
    		sendWorldTile(startTile);
    		OutputStream stream = new OutputStream();
    		stream.writePacket(223);
    		int x = startTile.getX()-startTile.getRegionX() << 3;
    		int y = startTile.getY()-startTile.getRegionY() << 3;
    		stream.writeByte((x & 0x7) << 3 | y & 0x7);
    		stream.writeByte(endTile.getX()-startTile.getX());
    		stream.writeByte(endTile.getY()-startTile.getY());
    		stream.writeShort(receiver == null ? 0 : (receiver instanceof Player ? -(receiver.getIndex()+1) : receiver.getIndex()+1));
    		stream.writeShort(gfxId);
    		stream.writeByte(startHeight);
    		stream.writeByte(endHeight);
    		stream.writeShort(delay);
    		int duration = (Utils.getDistance(startTile.getX(), startTile.getY(), endTile.getX(), endTile.getY()) * 30 / ((speed / 10) < 1 ? 1 : (speed / 10))) + delay;
    		stream.writeShort(duration);
    		stream.writeByte(curve);
    		stream.writeByte(creatorSize * 64 + startDistanceOffset * 64);
    		session.write(stream);
    	}
    to this:
    Code:
    	public void sendCustomProjectile(Entity receiver, Location startTile, Location endTile, int gfxId, int startHeight, int endHeight, int speed, int delay,  int curve, int startDistanceOffset, int creatorSize) {
    		sendCoords(startTile);
    		int x = startTile.getX()-startTile.getRegionX() << 3;
    		int y = startTile.getY()-startTile.getRegionY() << 3;
    		int byte2 = (x & 0x7) << 3 | y & 0x7;
    		int byte3 = endTile.getX()-startTile.getX();
    		int byte4 = endTile.getY()-startTile.getY();
    		int duration = (Misc.getDistance(startTile.getX(), startTile.getY(), endTile.getX(), endTile.getY()) * 30 / ((speed / 10) < 1 ? 1 : (speed / 10))) + delay;
    		StaticPacketBuilder spb = new StaticPacketBuilder().setId(223)
    		.addByte((byte) byte2)
    		.addByte((byte) byte3)
    		.addByte((byte) byte4)
    		.addShort(receiver == null ? 0 : (receiver instanceof Player ? -(receiver.getIndex()+1) : receiver.getIndex()+1))
    		.addShort(gfxId)
    		.addByte((byte) startHeight)
    		.addByte((byte) endHeight)
    		.addByte((byte) delay)
    		.addShort(duration)
    		.addByte((byte) curve)
    		.addByte((byte) (creatorSize * 64 + startDistanceOffset * 64));
    		player.getSession().write(spb.toPacket());
    	}
    I have added the method to the projectilemanager like this.. Converting straight from Dkk's manager:
    Code:
    	public void sendProjectile(Location shooter, Location receiver, int gfxId, int startHeight, int endHeight, int speed, int delay,  int curve, int startDistanceOffset) {
    		try {
    		//for(Player p : World.getWorld().getRegionManager().getLocalPlayers(source)) {
    		for(Player p : World.getWorld().getPlayers()) {
    			if(p.getLocation().withinDistance(shooter) && p.getLocation().withinDistance(receiver)) {
    				p.getActionSender().sendCustomProjectile(null, shooter, receiver, gfxId, startHeight, endHeight, speed, delay, curve, startDistanceOffset, 1);
    			}
    		}
    		} catch(Exception e) {
    		
    		}
    	}
    and my usage is like this, same as Dkk's:
    Code:
    World.getInstance().getProjectileManager().sendProjectile(n.getLocation(), p.getLocation(), 2263, 18, 18, 50, 50, 0, 0);
    (if the usage is wrong, don't tell me that's the problem because I am pretty sure it's not considering that I do not get any compiler errors about not compatible shit.)

    It logs me out every time I try to send the projectile. Did I do something wrong?
    Attached image
    The best open-source pre-eoc remake project that isn't in its early stages for once
    Darkan Client (727 Client Refactor)
    Darkan World Server
    “It would not be impossible to prove with sufficient repetition and a psychological understanding of the people concerned that a square is in fact a circle. They are mere words, and words can be molded until they clothe ideas and disguise.”
    Reply With Quote  
     

  2. #2  
    Renown Programmer and Respected Member
    Maxi's Avatar
    Join Date
    Jun 2008
    Posts
    3,197
    Thanks given
    281
    Thanks received
    1,095
    Rep Power
    1366
    That's not Dkk's, it's mine. Shame he removed my @author tags.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Christ is King

    Makar's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    2,004
    Thanks given
    545
    Thanks received
    965
    Rep Power
    427
    Okkkk then. Maxi's projectile method. Did I do something wrong?
    Attached image
    The best open-source pre-eoc remake project that isn't in its early stages for once
    Darkan Client (727 Client Refactor)
    Darkan World Server
    “It would not be impossible to prove with sufficient repetition and a psychological understanding of the people concerned that a square is in fact a circle. They are mere words, and words can be molded until they clothe ideas and disguise.”
    Reply With Quote  
     

  5. #4  
    Member Custom Projectile Convert Issue Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    int duration = (Misc.getDistance(startTile.getX(), startTile.getY(), endTile.getX(), endTile.getY()) * 30 / ((speed / 10) < 1 ? 1 : (speed / 10))) + delay;
    why didnt you just remove that shit

    Attached imageAttached image
    Reply With Quote  
     

  6. #5  
    Christ is King

    Makar's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    2,004
    Thanks given
    545
    Thanks received
    965
    Rep Power
    427
    ..... Is that causing the disconnecting issue, or are you just telling me to clean up my code.
    Attached image
    The best open-source pre-eoc remake project that isn't in its early stages for once
    Darkan Client (727 Client Refactor)
    Darkan World Server
    “It would not be impossible to prove with sufficient repetition and a psychological understanding of the people concerned that a square is in fact a circle. They are mere words, and words can be molded until they clothe ideas and disguise.”
    Reply With Quote  
     

  7. #6  
    Renown Programmer and Respected Member
    Maxi's Avatar
    Join Date
    Jun 2008
    Posts
    3,197
    Thanks given
    281
    Thanks received
    1,095
    Rep Power
    1366
    Your streams are wrong. Client crashes because it can't read the required/correct amount of bytes.
    Reply With Quote  
     

  8. #7  
    Christ is King

    Makar's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    2,004
    Thanks given
    545
    Thanks received
    965
    Rep Power
    427
    Could you tell me what is wrong? Please?
    Attached image
    The best open-source pre-eoc remake project that isn't in its early stages for once
    Darkan Client (727 Client Refactor)
    Darkan World Server
    “It would not be impossible to prove with sufficient repetition and a psychological understanding of the people concerned that a square is in fact a circle. They are mere words, and words can be molded until they clothe ideas and disguise.”
    Reply With Quote  
     

  9. #8  
    Member Custom Projectile Convert Issue Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    ..just compare them..it's not hard, they're named the same.

    Attached imageAttached image
    Reply With Quote  
     

  10. #9  
    Christ is King

    Makar's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    2,004
    Thanks given
    545
    Thanks received
    965
    Rep Power
    427
    I did rofl. I copy pasted Maxi's/Dkk's (idk who's) sendProjectile into my ActionSender, and then I never removed/added a line that adds a byte/short. They have the same amount.
    Attached image
    The best open-source pre-eoc remake project that isn't in its early stages for once
    Darkan Client (727 Client Refactor)
    Darkan World Server
    “It would not be impossible to prove with sufficient repetition and a psychological understanding of the people concerned that a square is in fact a circle. They are mere words, and words can be molded until they clothe ideas and disguise.”
    Reply With Quote  
     

  11. #10  
    Renown Programmer and Respected Member
    Maxi's Avatar
    Join Date
    Jun 2008
    Posts
    3,197
    Thanks given
    281
    Thanks received
    1,095
    Rep Power
    1366
    a.) Different revisions send different variables in different orders
    b.) Different revisions use different buffer reading/writing methods

    Conclusion: you need to identify the packet in your client, refactor the variables, refactor the buffer methods and create the server sides method to compose the data for the projectile packet in the correct order and data types.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Convert a Delta custom to PI
    By XxRoflxX in forum Requests
    Replies: 3
    Last Post: 05-22-2011, 10:55 AM
  2. Kbd projectile issue
    By kopjekoffiee in forum Help
    Replies: 1
    Last Post: 04-30-2011, 10:33 PM
  3. [PI] Adding custom items issue [Rep++]
    By Debugger in forum Help
    Replies: 8
    Last Post: 10-09-2010, 10:50 PM
  4. Custom Crowns Issue
    By Matt-old in forum Help
    Replies: 2
    Last Post: 09-08-2010, 07:15 PM
  5. Custom sprite loading issue
    By Sora in forum Help
    Replies: 5
    Last Post: 02-10-2009, 01:44 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
  •