Jump to content
  • 0

Attack Speed problem with ultra status server [aCis]


Question

Posted

I'm developing an ultra status server using an L2jAcis revision, but after a certain amount of attack speed, it becomes possible to bug your attacks, and you start attacking at an exponential speed. I would like to know if anyone has already developed a mod that resolves this situation, something similar to what was developed for l2jfrozen.

 

 

Heres the frozen code example. I tryed to migrate this code to aCis, but didint work.

 

Quote
### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer_831

Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java (revisão 957)
+++ head-src/com/l2jfrozen/Config.java (cópia de trabalho)
@@ -2299,6 +2299,17 @@
public static boolean CUSTOM_MERCHANT_TABLES = true;
public static boolean ALLOW_SIMPLE_STATS_VIEW;
public static boolean ALLOW_DETAILED_STATS_VIEW;
+ //By Jonas
+ public static long ALT_STOP_MOVE_DELAY;
+ public static long ALT_ATTACK_DELAY_BOW;
+ public static long ALT_ATTACK_DELAY_OTHER;
+ public static long ALT_ATTACK_DELAY_MAGIC;
+ public static long ALT_STOP_MOVE_DELAY_MAGIC;
+ public static long ALT_ATTACK_DELAY_WITH_ATKSPD;

public static boolean ALLOW_ONLINE_VIEW;
public static boolean WELCOME_HTM;
public static String ALLOWED_SKILLS;
@@ -2432,6 +2443,19 @@
ALLOW_DETAILED_STATS_VIEW = Boolean.valueOf(L2JFrozenSettings.getProperty("AllowDetailedStatsView", "False"));
ALLOW_ONLINE_VIEW = Boolean.valueOf(L2JFrozenSettings.getProperty("AllowOnlineView", "False"));

+ //BY JONAS
+ ALT_STOP_MOVE_DELAY = Long.parseLong(L2JFrozenSettings.getProperty("AltStopMoveDelay", "50"));
+ ALT_ATTACK_DELAY_BOW = Long.parseLong(L2JFrozenSettings.getProperty("AltAttackDelayBow", "50"));
+ ALT_ATTACK_DELAY_OTHER = Long.parseLong(L2JFrozenSettings.getProperty("AltAttackDelayOther", "50"));
+ ALT_ATTACK_DELAY_WITH_ATKSPD = Long.parseLong(L2JFrozenSettings.getProperty("AltAttackDelayWithAtkSpd", "50"));
+ ALT_ATTACK_DELAY_MAGIC = Long.parseLong(L2JFrozenSettings.getProperty("AltAttackDelayMagic", "50"));
+ ALT_STOP_MOVE_DELAY_MAGIC = Long.parseLong(L2JFrozenSettings.getProperty("AltStopMoveDelayMagic", "50"));
+
KEEP_SUBCLASS_SKILLS = Boolean.parseBoolean(L2JFrozenSettings.getProperty("KeepSubClassSkills", "False"));

ALLOWED_SKILLS = L2JFrozenSettings.getProperty("AllowedSkills", "541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,617,618,619");
@@ -5465,6 +5489,55 @@
{
DM_REVIVE_DELAY = Long.parseLong(pValue);
}
+
+ //By jonas
+ else if(pName.equalsIgnoreCase("AltStopMoveDelay"))
+ {
+ ALT_STOP_MOVE_DELAY = Long.parseLong(pValue);
+ }
+
+ else if(pName.equalsIgnoreCase("AltAttackDelayBow"))
+ {
+ ALT_ATTACK_DELAY_BOW = Long.parseLong(pValue);
+ }
+
+ else if(pName.equalsIgnoreCase("AltAttackDelayOther"))
+ {
+ ALT_ATTACK_DELAY_OTHER = Long.parseLong(pValue);
+ }
+
+ else if(pName.equalsIgnoreCase("AltAttackDelayWithAtkSpd"))
+ {
+ ALT_ATTACK_DELAY_WITH_ATKSPD = Long.parseLong(pValue);
+ }
+
+ else if(pName.equalsIgnoreCase("AltAttackDelayMagic"))
+ {
+ ALT_STOP_MOVE_DELAY_MAGIC = Long.parseLong(pValue);
+ }
+
+ else if(pName.equalsIgnoreCase("AltStopMoveDelayMagic"))
+ {
+ ALT_ATTACK_DELAY_MAGIC = Long.parseLong(pValue);
+ }
+
+
+
+
else
return false;
return true;

Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revisão 957)
+++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (cópia de trabalho)
@@ -294,6 +294,11 @@

/** The _meditated. */
private boolean _meditated;
+
+ /**By Jonas*/
+ private boolean moved = false;
+ private boolean movedMagic = false;
+ private boolean movedDelay = true;

/** Zone system<br> x^2 or x*x. */
public static final int ZONE_PVP = 1;
@@ -1102,9 +1107,85 @@
_log.fine(getName() + " doAttack: target=" + target);
}

+ // Get the active weapon item corresponding to the active weapon instance (always equiped in the right hand)
+ L2Weapon weaponItem = getActiveWeaponItem();
+
+ //By jonas
+
+
+ if(isMoving() || getMoved() && weaponItem != null && weaponItem.getItemType() == L2WeaponType.BOW)
+ {
+ try
+ {
+ Thread.sleep(Config.ALT_STOP_MOVE_DELAY);
+ stopMove(null);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Houve uma falha com bow");
+ }
+
+ try
+ {
+ //Parou de atacar com bow
+ Thread.sleep(Config.ALT_ATTACK_DELAY_BOW);
+ }
+ catch (InterruptedException ex)
+ {
+ System.out.println("Houve uma falha com bow");
+ }
+ //Voltou a atacar com bow
+ setMoved(false);
+
+
+
+ }
+
+ if(isMoving() || getMoved() && weaponItem != null && weaponItem.getItemType() != L2WeaponType.BOW)
+ {
+ try
+ {
+ Thread.sleep(Config.ALT_STOP_MOVE_DELAY);
+ stopMove(null);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Houve uma falha sem bow");
+ }
+
+ try
+ {
+ //Parou de atacar sem bow
+ Thread.sleep(Config.ALT_ATTACK_DELAY_OTHER);
+ }
+ catch (InterruptedException ex)
+ {
+ System.out.println("Houve uma falha sem bow");
+ }
+ //Voltou a atacar sem bow
+ setMoved(false);
+
+
+ }
+
+ if(getPAtkSpd() > 500)
+ {
+ try
+ {
+ //Parou de atacar
+ Thread.sleep(Config.ALT_ATTACK_DELAY_WITH_ATKSPD);
+
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Houve um erro (atkspd)");
+ }
+ }
+
if(target == null)
return;

+
if(isAlikeDead())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
@@ -1217,9 +1298,7 @@
// Get the active weapon instance (always equiped in the right hand)
L2ItemInstance weaponInst = getActiveWeaponInstance();

- // Get the active weapon item corresponding to the active weapon instance (always equiped in the right hand)
- L2Weapon weaponItem = getActiveWeaponItem();
-
+
if(weaponItem != null && weaponItem.getItemType() == L2WeaponType.ROD)
{
// You can't make an attack with a fishing pole.
@@ -1790,6 +1869,31 @@
return;
}

+ //by j
+ if(isMoving() || getMovedMagic())
+ {
+ try
+ {
+ Thread.sleep(Config.ALT_ATTACK_DELAY_MAGIC);
+ stopMove(null);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Houve uma falha com bow");
+ }
+
+ try
+ {
+ //Parou de atacar com bow
+ Thread.sleep(Config.ALT_STOP_MOVE_DELAY_MAGIC);
+ }
+ catch (InterruptedException ex)
+ {
+ System.out.println("Houve uma falha com bow");
+ }
+ setMovedMagic(false);
+ }
+
if(isSkillDisabled(skill.getId()))
{
if(activeChar instanceof L2PcInstance && !(skill.getId() == 2166))
@@ -11256,4 +11360,25 @@
{
return _triggeredSkills;
}
+
+ public void setMoved(boolean x)
+ {
+ moved = x;
+ }
+
+ public boolean getMoved()
+ {
+ return moved;
+ }
+
+ public void setMovedMagic(boolean x)
+ {
+ movedMagic = x;
+ }
+
+ public boolean getMovedMagic()
+ {
+ return movedMagic;
+ }
+
}
Index: config/functions/l2jfrozen.properties
===================================================================
--- config/functions/l2jfrozen.properties (revisão 957)
+++ config/functions/l2jfrozen.properties (cópia de trabalho)
@@ -280,4 +280,38 @@
ProtectorSkillLevel = 13
ProtectorSkillTime = 600
# Npc Protector Message
-ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
\ No newline at end of file
+ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
+
+
+##############################################
+# CONFIGS FOR CRAZYWAR PVP #
+##############################################
+
+# Delay com bow
+AltAttackDelayBow = 50
+
+# Delay sem bow
+AltAttackDelayOther = 400
+
+# Delay magic
+AltAttackDelayMagic = 50
+
+# Delay for AtkSpd
+AltAttackDelayWithAtkSpd = 50
+
+# Delay For stopMove in attack
+AltStopMoveDelay = 300
+
+# Delay For stopMove in attack
+AltStopMoveDelayMagic = 500
+

Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java (revisão 957)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java (cópia de trabalho)
@@ -125,6 +125,9 @@
double dx = _targetX - _curX;
double dy = _targetY - _curY;

+ //DELAY PARA ATACAR OU USAR SKILL NOVAMENTE DEPOIS DE ARDAR
+ activeChar.setMoved(true);
+ activeChar.setMovedMagic(true);
// Can't -ni
if (activeChar.isOutOfControl() || dx * dx + dy * dy > 98010000) // 9900*9900
{


if(isMoving() || getMovedMagic())
+ {
+ try
+ {
+ Thread.sleep(Config.ALT_ATTACK_DELAY_MAGIC);
- stopMove(null);
+ }
Ou remove o método stopMove(null)

 

 

7 answers to this question

Recommended Posts

  • 0
Posted
13 hours ago, Williams said:

I corrected this but the way you took the Frozen example is not the best way to correct it in PlayerAI, good luck.

I tried a lot of things and in my case nothing work as expected. The problem is walk and hit a lot of times, thats make an multiply of your attack speed. Seens like an easy problem, but i work on this for months and cant solve yet.

  • 0
Posted
Thread.sleep should never been used like that, it's the worst you can do.

Dig into lack of synchronization, maybe. Set _isAttackingNow/_isCastingNow to AtomicBoolean, add synchronized over _moveTask if there's not.

Normally, setIntention is synchronized and it's impossible to override it. Another explanation is maybe your atkspd is too big than it generates very, very little tasks timers. Lower than 40ms (depends about your CPU cycle), timers got no guarantee to be properly managed if it uses System.currentTimeInMillis.
  • Upvote 1
  • 0
Posted (edited)
On 1/7/2024 at 6:26 PM, Tryskell said:

Thread.sleep should never been used like that, it's the worst you can do.

Dig into lack of synchronization, maybe. Set _isAttackingNow/_isCastingNow to AtomicBoolean, add synchronized over _moveTask if there's not.

Normally, setIntention is synchronized and it's impossible to override it. Another explanation is maybe your atkspd is too big than it generates very, very little tasks timers. Lower than 40ms (depends about your CPU cycle), timers got no guarantee to be properly managed if it uses System.currentTimeInMillis.

My version of aCis is 382, so I don't have these variables in my review. However, I changed the intentions to synchronized, which already improved part of the process, but unfortunately it didn't fix it. I also checked version 401 to see if it contained the _isAttackingNow variable, but it doesn't either, and moveTask is a complete class, meaning it's not possible to change just one method, unless you're talking about the moment the task was created. I really need help with this, I've been dealing with this for months and haven't been able to resolve it, and it has a huge impact on the gameplay on my servers. This way, if anyone is interested in helping me, I am willing to resolve it.

 

@edit

If i have to change my aCis version, that is not an problem.

Edited by Hash
  • 0
Posted (edited)

sounds like there are two different attack intentions, try to find the usages of the intention, keep in mind that isAttacking doesnt return the correct value in most cases so a quick approach for that is to get the AI of the attacker first 

Edited by Katara512
  • 0
Posted (edited)
On 1/7/2024 at 3:11 AM, Hash said:

Я разрабатываю сервер ультрастатуса, используя ревизию L2jAcis, но после определенной скорости атаки становится возможным прослушивать ваши атаки, и вы начинаете атаковать с экспоненциальной скоростью. Хотелось бы узнать, разработал ли кто-нибудь уже мод, разрешающий эту ситуацию, что-то похожее на то, что было разработано для l2jfrozen.

 

 

Вот пример замороженного кода. Я пытался перенести этот код в aCis, но ничего не вышло.

 

 

The problem is the reuse bow attack in this code. You must rewrite this point.
For servers with large stats, you need to rewrite the function with attack reuse. For correct operation

_disableBowAttackEndTime
Edited by Psygrammator
  • 0
Posted

I tested on version 398 of aCis and the problem does not occur. From what I verified, the attack process and intentions were modified in version 389 of aCis, but I cannot find the diff with this modification to apply in my review. I believe that really the only way to adjust this is to change the way intentions are generated and the way attacks and conjurations happen.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...