Jump to content

Recommended Posts

Posted

This little code will shows the real diff range of async between server and client position. By default, this code was maked for aCis but can be use for any L2J forks.

 

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java	(revision 1133)
+++ java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java	(working copy)
@@ -2,6 +2,8 @@
 
 import java.nio.BufferUnderflowException;
 
+import net.sf.l2j.commons.math.MathUtil;
+
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
 import net.sf.l2j.gameserver.model.actor.instance.Player;
@@ -95,6 +97,18 @@
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
+		
+		// Check async range.
+		dx = _originX - activeChar.getX();
+		dy = _originY - activeChar.getY();
+		double dz1 = _originZ - activeChar.getZ();
+		float diff = (float) Math.sqrt(dx * dx + dy * dy + dz1 * dz1);
+		int heading = MathUtil.calculateHeadingFrom(_originX, _originY, activeChar.getX(), activeChar.getY());
+		if (Math.abs(activeChar.getHeading() - heading) > 16000)
+			diff = diff * -1;
+		
+		activeChar.sendMessage("Async distance: " + diff);
+		
 		activeChar.getAI().setIntention(CtrlIntention.MOVE_TO, new Location(_targetX, _targetY, _targetZ));
 	}
 }
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/network/clientpackets/ValidatePosition.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/ValidatePosition.java	(revision 1133)
+++ java/net/sf/l2j/gameserver/network/clientpackets/ValidatePosition.java	(working copy)
@@ -1,5 +1,7 @@
 package net.sf.l2j.gameserver.network.clientpackets;
 
+import net.sf.l2j.commons.math.MathUtil;
+
 import net.sf.l2j.gameserver.model.actor.instance.Player;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.serverpackets.GetOnVehicle;
@@ -88,5 +90,17 @@
 		player.setClientY(_y);
 		player.setClientZ(_z);
 		player.setClientHeading(_heading); // No real need to validate heading.
+		
+		// Check async range.
+		dx = _x - player.getX();
+		dy = _y - player.getY();
+		dz = _z - player.getZ();
+		float diff = (float) Math.sqrt(dx * dx + dy * dy + dz * dz);
+		
+		int heading = MathUtil.calculateHeadingFrom(_x, _y, player.getX(), player.getY());
+		if (Math.abs(player.getHeading() - heading) > 16000)
+			diff = diff * -1;
+		
+		player.sendMessage("[4] Async distance: " + diff);
 	}
 }
\ No newline at end of file

Have fun, so! :smile:

  • Like 2
Posted
6 hours ago, Pamela32 said:

I love shares like this one

Bcs give a more realistic gameplay

 

?????????????? How a debug is doing that ?????????????? , maybe you mean that help you to fix things and looks more realistic gameplay.

Posted
1 hour ago, StinkyMadness said:

 

?????????????? How a debug is doing that ?????????????? , maybe you mean that help you to fix things and looks more realistic gameplay.

 

Well .. yea .. as u can see ky English sucks anyway 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • L2Elixir – Patch 4 Is Live!   We’re working non-stop, day and night, to deliver the best possible quality and bring back what made L2Elixir special. This project is built with passion, not shortcuts — for the old-school players who remember, and the new ones who want to experience it properly. Thank you for being part of the journey. Together, we’re making L2Elixir great again ❤️ The legends never fade.    ⚙️ General Enabled Class Change service (same class type only) ALT + B → Services → Character Development Enabled Shift + Click on Treasure Chests Players can now identify real chests (Adena, scroll drops) and use Key / Unlock Event deaths now cancel only debuffs, All self buffs are preserved, fixes issues with Root and similar effects Bladedancer class can now log in even when Max Clients (2) is reached. Since an active Bladedancer is not available for every damage dealer and some players tried to abuse this via VPN or a second PC, this feature was added to keep things fair. protections applies, requires testing!    🎒 Items Crystallizing enchanted items now gives the correct increased crystal amount (retail-like behavior) Removed Agathion Seal Bracelet: Rudolph from Santa rewards (Gracia Final item) Added Dualsword Craft Stamp into Milestone Exchange list    🧙 Skills Fixed Banish Undead lethal chance Hot Springs Malaria and similar effects now level up faster while being attacked
    • thats new SEO level tricks you know nothing of noob - bottom line: exposed.
    • Warning: This guy is a big scammer, trying to sell everything, advertising for servers etc. That's his mail address evgesha.nrnr@gmail.com , stay away!   @Atom @Celestine
    • Warning: This guy is a big scammer, trying to sell everything, advertising for servers etc. That's his mail address evgesha.nrnr@gmail.com , stay away! @Celestine @Atom
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock