Jump to content
  • 0

[Bug] I Need Help


Question

Posted (edited)
i got 1 small bug on l2j frozen

my character goes to hit one mob

he makes 1 hit and then stops

 if i click somewhere and holding the attack button makes another one and stops

 

 

what it might be? if you need any file to check from source tell me

Edited by Akken

Recommended Posts

  • 0
Posted

No source related then, if you get 2 different behaviors on 2 different machines.

 

 

yeap solved.. lock it

 

mysql needed someconfig and java 7 makes a good performance 

  • 0
Posted (edited)

private l2frozen... please tell me more, it has (x instanceof Object) checks too? Or its just limited to variable nulling ?

Edited by xdem
  • 0
Posted

private l2frozen... please tell me more, it has (x instanceof Object) checks too? Or its just limited to variable nulling ?

i mean a private project based on it 

 

 

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package com.l2jfrozen.gameserver.network.serverpackets;
 
import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.L2Object;
 
/**
 * sample 06 8f19904b 2522d04b 00000000 80 950c0000 4af50000 08f2ffff 0000 - 0 damage (missed 0x80) 06 85071048 bc0e504b
 * 32000000 10 fc41ffff fd240200 a6f5ffff 0100 bc0e504b 33000000 10 3.... format dddc dddh (ddc)
 * 
 * @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/03/27 15:29:39 $
 */
public class Attack extends L2GameServerPacket
{
private class Hit
{
protected int _targetId;
protected int _damage;
protected int _flags;
 
Hit(L2Object target, int damage, boolean miss, boolean crit, boolean shld)
{
_targetId = target.getObjectId();
_damage = damage;
if(soulshot)
{
_flags |= 0x10 | _grade;
}
if(crit)
{
_flags |= 0x20;
}
if(shld)
{
_flags |= 0x40;
}
if(miss)
{
_flags |= 0x80;
}
 
}
}
 
// dh
 
private static final String _S__06_ATTACK = "[S] 06 Attack";
protected final int _attackerObjId;
public final boolean soulshot;
protected int _grade;
private int _x;
private int _y;
private int _z;
private Hit[] _hits;
 
/**
* @param attacker the attacker L2Character
* @param ss true if useing SoulShots
*/
public Attack(L2Character attacker, boolean ss, int grade)
{
_attackerObjId = attacker.getObjectId();
soulshot = ss;
_grade = grade;
_x = attacker.getX();
_y = attacker.getY();
_z = attacker.getZ();
_hits = new Hit[0];
}
 
/**
* Add this hit (target, damage, miss, critical, shield) to the Server-Client packet Attack.<BR>
* <BR>
*/
public void addHit(L2Object target, int damage, boolean miss, boolean crit, boolean shld)
{
// Get the last position in the hits table
int pos = _hits.length;
 
// Create a new Hit object
Hit[] tmp = new Hit[pos + 1];
 
// Add the new Hit object to hits table
for(int i = 0; i < _hits.length; i++)
{
tmp[i] = _hits[i];
}
tmp[pos] = new Hit(target, damage, miss, crit, shld);
_hits = tmp;
}
 
/**
* Return True if the Server-Client packet Attack conatins at least 1 hit.<BR>
* <BR>
*/
public boolean hasHits()
{
return _hits.length > 0;
}
 
@Override
protected final void writeImpl()
{
writeC(0x05);
 
writeD(_attackerObjId);
writeD(_hits[0]._targetId);
writeD(_hits[0]._damage);
writeC(_hits[0]._flags);
writeD(_x);
writeD(_y);
writeD(_z);
writeH(_hits.length - 1);
for(int i = 1; i < _hits.length; i++)
{
writeD(_hits[i]._targetId);
writeD(_hits[i]._damage);
writeC(_hits[i]._flags);
}
}
 
/* (non-Javadoc)
* @see com.l2jfrozen.gameserver.serverpackets.ServerBasePacket#getType()
*/
@Override
public String getType()
{
return _S__06_ATTACK;
}
}
my attack code...
  • 0
Posted

Can come from anywhere, but try doAttack(). If it's not doAttack it comes from intentions... If it's not intentions, it can come from any custom added.

 

 

method doAttack? as i see it seems fine.. if you want the part inform me..

 

 

bump any possible solution? if you want doAttack method here it is i quess:

 

 

// =========================================================
// Method - Private
/**
* Launch a physical attack against a target (Simple, Bow, Pole or Dual).<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Get the active weapon (always equiped in the right hand)</li><BR>
* <BR>
* <li>If weapon is a bow, check for arrows, MP and bow re-use delay (if necessary, equip the L2PcInstance with
* arrows in left hand)</li> <li>If weapon is a bow, consume MP and set the new period of bow non re-use</li><BR>
* <BR>
* <li>Get the Attack Speed of the L2Character (delay (in milliseconds) before next attack)</li> <li>Select the type
* of attack to start (Simple, Bow, Pole or Dual) and verify if SoulShot are charged then start calculation</li> <li>
* If the Server->Client packet Attack contains at least 1 hit, send the Server->Client packet Attack to the
* L2Character AND to all L2PcInstance in the _KnownPlayers of the L2Character</li> <li>Notify AI with
* EVT_READY_TO_ACT</li><BR>
* <BR>
* 
* @param target The L2Character targeted
*/
protected void doAttack(L2Character target)
{
if (Config.DEBUG)
{
_log.fine(getName() + " doAttack: target=" + target);
}
 
if (target == null)
return;
 
if (isAlikeDead())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (this instanceof L2NpcInstance && target.isAlikeDead())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (this instanceof L2PcInstance && target.isDead() && !target.isFakeDeath())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (!getKnownList().knowsObject(target))
{
// If L2PcInstance is dead or the target is dead, the action is stoped
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (this instanceof L2PcInstance && isDead())
{
// If L2PcInstance is dead or the target is dead, the action is stoped
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (target instanceof L2PcInstance && ((L2PcInstance) target).getDuelState() == Duel.DUELSTATE_DEAD)
{
// If L2PcInstance is dead or the target is dead, the action is stoped
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (target instanceof L2DoorInstance && !((L2DoorInstance) target).isAttackable(this))
return;
 
if (isAttackingDisabled())
return;
 
if (this instanceof L2PcInstance)
{
if (((L2PcInstance) this).inObserverMode())
{
sendPacket(new SystemMessage(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE));
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (target instanceof L2PcInstance)
{
if (((L2PcInstance) target).isCursedWeaponEquiped() && ((L2PcInstance) this).getLevel() <= Config.MAX_LEVEL_NEWBIE)
{
((L2PcInstance) this).sendMessage("Can't attack a cursed player when under level 21.");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (((L2PcInstance) this).isCursedWeaponEquiped() && ((L2PcInstance) target).getLevel() <= Config.MAX_LEVEL_NEWBIE)
{
((L2PcInstance) this).sendMessage("Can't attack a newbie player using a cursed weapon.");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
 
//thank l2dot
if (getObjectId() == target.getObjectId())
{
//((L2PcInstance) this).sendMessage("Can't attack yourself! Suicide? :)");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
if (target instanceof L2NpcInstance && Config.DISABLE_ATTACK_NPC_TYPE)
{
String mobtype = ((L2NpcInstance) target).getTemplate().type;
if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
sm.addString("Npc Protection - No Attack Allowed!");
((L2PcInstance) this).sendPacket(sm);
((L2PcInstance) this).sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
 
}
 
// 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.
((L2PcInstance) this).sendPacket(new SystemMessage(SystemMessageId.CANNOT_ATTACK_WITH_FISHING_POLE));
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
// GeoData Los Check here (or dz > 1000)
if (!GeoData.getInstance().canSeeTarget(this, target))
{
sendPacket(new SystemMessage(SystemMessageId.CANT_SEE_TARGET));
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
// Check for a bow
if (weaponItem != null && weaponItem.getItemType() == L2WeaponType.BOW)
{
 
// Equip arrows needed in left hand and send a Server->Client packet ItemList to the L2PcINstance then return True
if (!checkAndEquipArrows())
{
// Cancel the action because the L2PcInstance have no arrow
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 
sendPacket(ActionFailed.STATIC_PACKET);
sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ARROWS));
return;
}
 
//Check for arrows and MP
if (this instanceof L2PcInstance)
{
// Checking if target has moved to peace zone - only for player-bow attacks at the moment
// Other melee is checked in movement code and for offensive spells a check is done every time
if (target.isInsidePeaceZone((L2PcInstance) this))
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
// Verify if the bow can be use
if (_disableBowAttackEndTime <= GameTimeController.getGameTicks())
{
// Verify if L2PcInstance owns enough MP
int saMpConsume = (int) getStat().calcStat(Stats.MP_CONSUME, 0, null, null);
int mpConsume = saMpConsume == 0 ? weaponItem.getMpConsume() : saMpConsume;
 
if (getCurrentMp() < mpConsume)
{
// If L2PcInstance doesn't have enough MP, stop the attack
ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000);
 
sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_MP));
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// If L2PcInstance have enough MP, the bow consummes it
getStatus().reduceMp(mpConsume);
 
// Set the period of bow non re-use
_disableBowAttackEndTime = 5 * GameTimeController.TICKS_PER_SECOND + GameTimeController.getGameTicks();
}
else
{
// Cancel the action because the bow can't be re-use at this moment
ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000);
 
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
 
}
else if (this instanceof L2NpcInstance)
{
if (_disableBowAttackEndTime > GameTimeController.getGameTicks())
return;
}
}
 
// Add the L2PcInstance to _knownObjects and _knownPlayer of the target
target.getKnownList().addKnownObject(this);
 
// Reduce the current CP if TIREDNESS configuration is activated
if (Config.ALT_GAME_TIREDNESS)
{
setCurrentCp(getCurrentCp() - 10);
}
 
// Recharge any active auto soulshot tasks for player (or player's summon if one exists).
if (this instanceof L2PcInstance)
{
((L2PcInstance) this).rechargeAutoSoulShot(true, false, false);
}
else if (this instanceof L2Summon)
{
((L2Summon) this).getOwner().rechargeAutoSoulShot(true, false, true);
}
 
// Verify if soulshots are charged.
boolean wasSSCharged;
 
if (this instanceof L2Summon && !(this instanceof L2PetInstance))
{
wasSSCharged = ((L2Summon) this).getChargedSoulShot() != L2ItemInstance.CHARGED_NONE;
}
else
{
wasSSCharged = weaponInst != null && weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE;
}
 
// Get the Attack Speed of the L2Character (delay (in milliseconds) before next attack)
int timeAtk = calculateTimeBetweenAttacks(target, weaponItem);
// the hit is calculated to happen halfway to the animation - might need further tuning e.g. in bow case
int timeToHit = timeAtk / 2;
_attackEndTime = GameTimeController.getGameTicks();
_attackEndTime += timeAtk / GameTimeController.MILLIS_IN_TICK;
_attackEndTime -= 1;
 
int ssGrade = 0;
 
if (weaponItem != null)
{
ssGrade = weaponItem.getCrystalType();
}
 
// Create a Server->Client packet Attack
Attack attack = new Attack(this, wasSSCharged, ssGrade);
 
boolean hitted;
 
// Set the Attacking Body part to CHEST
setAttackingBodypart();
 
// Get the Attack Reuse Delay of the L2Weapon
int reuse = calculateReuseTime(target, weaponItem);
 
// Select the type of attack to start
if (weaponItem == null)
{
hitted = doAttackHitSimple(attack, target, timeToHit);
}
else if (weaponItem.getItemType() == L2WeaponType.BOW)
{
hitted = doAttackHitByBow(attack, target, timeAtk, reuse);
}
else if (weaponItem.getItemType() == L2WeaponType.POLE)
{
hitted = doAttackHitByPole(attack, timeToHit);
}
else if (isUsingDualWeapon())
{
hitted = doAttackHitByDual(attack, target, timeToHit);
}
else
{
hitted = doAttackHitSimple(attack, target, timeToHit);
}
 
// Flag the attacker if it's a L2PcInstance outside a PvP area
L2PcInstance player = null;
 
if (this instanceof L2PcInstance)
{
player = (L2PcInstance) this;
}
else if (this instanceof L2Summon)
{
player = ((L2Summon) this).getOwner();
}
 
if (player != null)
{
player.updatePvPStatus(target);
}
 
// Check if hit isn't missed
if (!hitted)
{
//MAJAX fix
sendPacket(new SystemMessage(SystemMessageId.MISSED_TARGET));
// Abort the attack of the L2Character and send Server->Client ActionFailed packet
abortAttack();
}
else
{
/* ADDED BY nexus - 2006-08-17
*
* As soon as we know that our hit landed, we must discharge any active soulshots.
* This must be done so to avoid unwanted soulshot consumption.
*/
 
// If we didn't miss the hit, discharge the shoulshots, if any
if (this instanceof L2Summon && !(this instanceof L2PetInstance))
{
((L2Summon) this).setChargedSoulShot(L2ItemInstance.CHARGED_NONE);
}
else if (weaponInst != null)
{
weaponInst.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);
}
 
if (player != null)
{
if (player.isCursedWeaponEquiped())
{
// If hitted by a cursed weapon, Cp is reduced to 0
if (!target.isInvul())
{
target.setCurrentCp(0);
}
}
else if (player.isHero())
{
if (target instanceof L2PcInstance && ((L2PcInstance) target).isCursedWeaponEquiped())
{
// If a cursed weapon is hitted by a Hero, Cp is reduced to 0
target.setCurrentCp(0);
}
}
}
 
weaponInst = null;
weaponItem = null;
}
 
// If the Server->Client packet Attack contains at least 1 hit, send the Server->Client packet Attack
// to the L2Character AND to all L2PcInstance in the _KnownPlayers of the L2Character
if (attack.hasHits())
{
broadcastPacket(attack);
fireEvent(EventType.ATTACK.name, new Object[]
{
getTarget()
});
}
 
// Notify AI with EVT_READY_TO_ACT
ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), timeAtk + reuse);
 
attack = null;
player = null;
}
 
/**
* Launch a Bow attack.<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Calculate if hit is missed or not</li> <li>Consumme arrows</li> <li>If hit isn't missed, calculate if shield
* defense is efficient</li> <li>If hit isn't missed, calculate if hit is critical</li> <li>If hit isn't missed,
* calculate physical damages</li> <li>If the L2Character is a L2PcInstance, Send a Server->Client packet SetupGauge
* </li> <li>Create a new hit task with Medium priority</li> <li>Calculate and set the disable delay of the bow in
* function of the Attack Speed</li> <li>Add this hit to the Server-Client packet Attack</li><BR>
* <BR>
* 
* @param attack Server->Client packet Attack in which the hit will be added
* @param target The L2Character targeted
* @param sAtk The Attack Speed of the attacker
* @return True if the hit isn't missed
*/
private boolean doAttackHitByBow(Attack attack, L2Character target, int sAtk, int reuse)
{
int damage1 = 0;
boolean shld1 = false;
boolean crit1 = false;
 
// Calculate if hit is missed or not
boolean miss1 = Formulas.getInstance().calcHitMiss(this, target);
 
// Consumme arrows
reduceArrowCount();
 
_move = null;
 
// Check if hit isn't missed
if (!miss1)
{
// Calculate if shield defense is efficient
shld1 = Formulas.getInstance().calcShldUse(this, target);
 
// Calculate if hit is critical
crit1 = Formulas.getInstance().calcCrit(getStat().getCriticalHit(target, null));
 
// Calculate physical damages
damage1 = (int) Formulas.getInstance().calcPhysDam(this, target, null, shld1, crit1, false, attack.soulshot);
}
 
// Check if the L2Character is a L2PcInstance
if (this instanceof L2PcInstance)
{
// Send a system message
sendPacket(new SystemMessage(SystemMessageId.GETTING_READY_TO_SHOOT_AN_ARROW));
 
// Send a Server->Client packet SetupGauge
SetupGauge sg = new SetupGauge(SetupGauge.RED, sAtk + reuse);
sendPacket(sg);
sg = null;
}
 
// Create a new hit task with Medium priority
ThreadPoolManager.getInstance().scheduleAi(new HitTask(target, damage1, crit1, miss1, attack.soulshot, shld1), sAtk);
 
// Calculate and set the disable delay of the bow in function of the Attack Speed
_disableBowAttackEndTime = (sAtk + reuse) / GameTimeController.MILLIS_IN_TICK + GameTimeController.getGameTicks();
 
// Add this hit to the Server-Client packet Attack
attack.addHit(target, damage1, miss1, crit1, shld1);
 
// Return true if hit isn't missed
return !miss1;
}
 
/**
* Launch a Dual attack.<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Calculate if hits are missed or not</li> <li>If hits aren't missed, calculate if shield defense is efficient</li>
* <li>If hits aren't missed, calculate if hit is critical</li> <li>If hits aren't missed, calculate physical
* damages</li> <li>Create 2 new hit tasks with Medium priority</li> <li>Add those hits to the Server-Client packet
* Attack</li><BR>
* <BR>
* 
* @param attack Server->Client packet Attack in which the hit will be added
* @param target The L2Character targeted
* @return True if hit 1 or hit 2 isn't missed
*/
private boolean doAttackHitByDual(Attack attack, L2Character target, int sAtk)
{
int damage1 = 0;
int damage2 = 0;
boolean shld1 = false;
boolean shld2 = false;
boolean crit1 = false;
boolean crit2 = false;
 
// Calculate if hits are missed or not
boolean miss1 = Formulas.getInstance().calcHitMiss(this, target);
boolean miss2 = Formulas.getInstance().calcHitMiss(this, target);
 
// Check if hit 1 isn't missed
if (!miss1)
{
// Calculate if shield defense is efficient against hit 1
shld1 = Formulas.getInstance().calcShldUse(this, target);
 
// Calculate if hit 1 is critical
crit1 = Formulas.getInstance().calcCrit(getStat().getCriticalHit(target, null));
 
// Calculate physical damages of hit 1
damage1 = (int) Formulas.getInstance().calcPhysDam(this, target, null, shld1, crit1, true, attack.soulshot);
damage1 /= 2;
}
 
// Check if hit 2 isn't missed
if (!miss2)
{
// Calculate if shield defense is efficient against hit 2
shld2 = Formulas.getInstance().calcShldUse(this, target);
 
// Calculate if hit 2 is critical
crit2 = Formulas.getInstance().calcCrit(getStat().getCriticalHit(target, null));
 
// Calculate physical damages of hit 2
damage2 = (int) Formulas.getInstance().calcPhysDam(this, target, null, shld2, crit2, true, attack.soulshot);
damage2 /= 2;
}
 
// Create a new hit task with Medium priority for hit 1
ThreadPoolManager.getInstance().scheduleAi(new HitTask(target, damage1, crit1, miss1, attack.soulshot, shld1), sAtk / 2);
 
// Create a new hit task with Medium priority for hit 2 with a higher delay
ThreadPoolManager.getInstance().scheduleAi(new HitTask(target, damage2, crit2, miss2, attack.soulshot, shld2), sAtk);
 
// Add those hits to the Server-Client packet Attack
attack.addHit(target, damage1, miss1, crit1, shld1);
attack.addHit(target, damage2, miss2, crit2, shld2);
 
// Return true if hit 1 or hit 2 isn't missed
return !miss1 || !miss2;
}
 
/**
* Launch a Pole attack.<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Get all visible objects in a spheric area near the L2Character to obtain possible targets</li> <li>If
* possible target is the L2Character targeted, launch a simple attack against it</li> <li>If possible target isn't
* the L2Character targeted but is attakable, launch a simple attack against it</li><BR>
* <BR>
* 
* @param attack Server->Client packet Attack in which the hit will be added
* @return True if one hit isn't missed
*/
private boolean doAttackHitByPole(Attack attack, int sAtk)
{
boolean hitted = false;
 
double angleChar, angleTarget;
int maxRadius = (int) getStat().calcStat(Stats.POWER_ATTACK_RANGE, 66, null, null);
int maxAngleDiff = (int) getStat().calcStat(Stats.POWER_ATTACK_ANGLE, 120, null, null);
 
if (getTarget() == null)
return false;
 
if (Config.DEBUG)
{
_log.info("doAttackHitByPole: Max radius = " + maxRadius);
_log.info("doAttackHitByPole: Max angle = " + maxAngleDiff);
}
 
// o1 x: 83420 y: 148158 (Giran)
// o2 x: 83379 y: 148081 (Giran)
// dx = -41
// dy = -77
// distance between o1 and o2 = 87.24
// arctan2 = -120 (240) degree (excel arctan2(dx, dy); java arctan2(dy, dx))
//
// o2
//
//          o1 ----- (heading)
// In the diagram above:
// o1 has a heading of 0/360 degree from horizontal (facing East)
// Degree of o2 in respect to o1 = -120 (240) degree
//
// o2          / (heading)
//            /
//          o1
// In the diagram above
// o1 has a heading of -80 (280) degree from horizontal (facing north east)
// Degree of o2 in respect to 01 = -40 (320) degree
 
// ===========================================================
// Make sure that char is facing selected target
angleTarget = Util.calculateAngleFrom(this, getTarget());
setHeading((int) (angleTarget / 9.0 * 1610.0)); // = this.setHeading((int)((angleTarget / 360.0) * 64400.0));
 
// Update char's heading degree
angleChar = Util.convertHeadingToDegree(getHeading());
double attackpercent = 85;
int attackcountmax = (int) getStat().calcStat(Stats.ATTACK_COUNT_MAX, 3, null, null);
int attackcount = 0;
 
if (angleChar <= 0)
{
angleChar += 360;
// ===========================================================
}
 
L2Character target;
for (L2Object obj : getKnownList().getKnownObjects().values())
{
//Check if the L2Object is a L2Character
if (obj instanceof L2Character)
{
if (obj instanceof L2PetInstance && this instanceof L2PcInstance && ((L2PetInstance) obj).getOwner() == (L2PcInstance) this)
{
continue;
}
 
if (!Util.checkIfInRange(maxRadius, this, obj, false))
{
continue;
}
 
//otherwise hit too high/low. 650 because mob z coord sometimes wrong on hills
if (Math.abs(obj.getZ() - getZ()) > Config.DIFFERENT_Z_CHANGE_OBJECT)
{
continue;
}
 
angleTarget = Util.calculateAngleFrom(this, obj);
 
if (Math.abs(angleChar - angleTarget) > maxAngleDiff && Math.abs(angleChar + 360 - angleTarget) > maxAngleDiff && // Example: char is at 1 degree and target is at 359 degree
Math.abs(angleChar - (angleTarget + 360)) > maxAngleDiff // Example: target is at 1 degree and char is at 359 degree
)
{
continue;
}
 
target = (L2Character) obj;
 
// Launch a simple attack against the L2Character targeted
if (!target.isAlikeDead())
{
attackcount += 1;
 
if (attackcount <= attackcountmax)
{
if (target == getAI().getAttackTarget() || target.isAutoAttackable(this))
{
 
hitted |= doAttackHitSimple(attack, target, attackpercent, sAtk);
attackpercent /= 1.15;
}
}
}
}
}
 
target = null;
 
// Return true if one hit isn't missed
return hitted;
}
 
/**
* Launch a simple attack.<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Calculate if hit is missed or not</li> <li>If hit isn't missed, calculate if shield defense is efficient</li>
* <li>If hit isn't missed, calculate if hit is critical</li> <li>If hit isn't missed, calculate physical damages</li>
* <li>Create a new hit task with Medium priority</li> <li>Add this hit to the Server-Client packet Attack</li><BR>
* <BR>
* 
* @param attack Server->Client packet Attack in which the hit will be added
* @param target The L2Character targeted
* @return True if the hit isn't missed
*/
private boolean doAttackHitSimple(Attack attack, L2Character target, int sAtk)
{
return doAttackHitSimple(attack, target, 100, sAtk);
}
 
private boolean doAttackHitSimple(Attack attack, L2Character target, double attackpercent, int sAtk)
{
int damage1 = 0;
boolean shld1 = false;
boolean crit1 = false;
 
// Calculate if hit is missed or not
boolean miss1 = Formulas.getInstance().calcHitMiss(this, target);
 
// Check if hit isn't missed
if (!miss1)
{
// Calculate if shield defense is efficient
shld1 = Formulas.getInstance().calcShldUse(this, target);
 
// Calculate if hit is critical
crit1 = Formulas.getInstance().calcCrit(getStat().getCriticalHit(target, null));
 
// Calculate physical damages
damage1 = (int) Formulas.getInstance().calcPhysDam(this, target, null, shld1, crit1, false, attack.soulshot);
 
if (attackpercent != 100)
{
damage1 = (int) (damage1 * attackpercent / 100);
}
}
 
// Create a new hit task with Medium priority
ThreadPoolManager.getInstance().scheduleAi(new HitTask(target, damage1, crit1, miss1, attack.soulshot, shld1), sAtk);
 
// Add this hit to the Server-Client packet Attack
attack.addHit(target, damage1, miss1, crit1, shld1);
 
// Return true if hit isn't missed
return !miss1;
}
  • 0
Posted (edited)

He means, 'you should post your vds specs' I guess :P

 

Well, as you said, on home pc it's workin' fine, so the problem is the vds..

Edited by SweeTs
  • 0
Posted

He means, 'you should post your vds specs' I guess :P

 

Well, as you said, on home pc it's workin' fine, so the problem is the vds..

vds, dedicated, hosting machine, is all the same shit  :rage:

  • 0
Posted

in my home pc all run smoothly idk if my vds got a problem the same on acis,l2jfrozen clean etc... what it might be the failure?

 

No source related then, if you get 2 different behaviors on 2 different machines.

Guest
This topic is now closed to further replies.


  • Posts

    • When you say bots allowed, it means we are allowed to use adrenaline ?
    • https://l2mayhem.ru/   The Mayhem Server is designed for players who want to enjoy the game without unnecessary stress or steep barriers. We focus on a comfortable gaming experience: the mechanics are adapted so that even newcomers can get up to speed quickly, while veterans will be happy to return to the beloved universe. On the server, character progression and content difficulty are well balanced: your character develops steadily, without the need to spend huge amounts of time on repetitive tasks. For players’ convenience, we’ve implemented autofarm - it lets you complete daily tasks efficiently. Moreover, bots are officially allowed on the server: they help automate routine actions, so you can focus on the most exciting parts of the game - sieges, PvP, clan wars, and crafting. The server’s atmosphere is friendly: the active community is always ready to offer advice, and the administration ensures order and fairness. Whether you’re looking for a relaxed leveling and world‑exploration experience or want to take part in intense events, everyone can find their own pace and playstyle here. Right now, the server features new activities: we’ve added new instances and locations with unique mechanics and rewards, as well as rare items that can only be obtained in these zones. This is a great chance to get powerful gear and stand out among other players.   Rates: - Grind: EXP/SP x3 (Raid Bosses: x3). - Loot: Drop/Spoil/Adena x3; Raid/Epic Raid drops x3. - Quests: All rewards x1.   Gameplay: - Accounts are created automatically. - Mammons is located in the Town of Giran. - Each character has access to the unlimited Auto Farm function. - Mass party functions activated by the party leader. - A pre-installed shortcut panel is provided for each new character. - The full list of chat commands is available on the Community Board. - Players have a x25 weight limit and an increased inventory capacity. - All buffs, dances, and songs last for 2 hours. - Spawn protection lasts 10 seconds after teleporting. - Treasure Chests have been removed from spawns. - Cursed Weapons have been removed from drops. - Common items can no longer be purchased or obtained as drops. - Mobs and Raid Bosses no longer use Cancel skill. - Equipment up to the Dynasty can be purchased with adena. - Shots up to S grade and consumables are available in the Community Board. - Offline shops are supported: simply set up a shop and type the .offline command in chat. - No drop penalty on Raid Bosses unless the player is over 5 levels higher than the boss; otherwise, the drop chance is reduced. - Mana Potions restore 1500 MP and have a 10‑second reuse time. Newbie Mana Potions restore 500 MP. - The Vitality, Nevit, and Recommendations systems have been disabled. - The store now offers a lower buy price for player‑sold items. - NPC Victor visits Town of Giran on Wednesdays and Saturdays for gear/doll upgrades and elemental exchange. - Once you hit level 40, every mob can drop one of three medals: Bronze, Silver, or Gold.   Premium: - +35% to EXP/SP, Adena, Seal Stones, Element Stones, and Epaulette drops. - Buffs, dances, and songs last 3 hours. - With Premium, players can get 3‑hour buffs by purchasing them from other players.   Enchanting: - The chance to successfully enchant gear is 65%. Safe enchantment is up to +3; the maximum enchant level is +20. - Elemental Stones: 50% chance. Elemental Crystals: 30% chance.   Skills: - Auto‑learn all skills and Forgotten Skills. - 30 buff slots, 12 Dance/Song slots. - Subclass max level raised to 85.   Quests: - 25 000 Adena is required to obtain the 1st class; 250 000 Adena for the 2nd class; 10 000 000 Adena for the 3rd class. - The subclass quest is not required. - The Freya quest is not required. - The Hard Freya quest is not required. - Access to Frintezza is granted only after completing the quest or upon having the purchased quest item. - Access to Baium is granted only after completing the quest or upon having the purchased quest item. - Access to Antharas is granted only after completing the quest or upon having the purchased quest item. - Access to Valakas is granted only after completing the quest or upon having the purchased quest item. - Hellbound progression is at level 1.   Olympiad: - Olympiads are held monthly. - Enchantment limit is +6. - Starting Olympiad requires 6 characters. - You need 15 battles to receive a reward. - Only non‑class battles are available.   Sieges/Territory Wars: - Flags are returned to their owners at the start of each Territory War, which occurs every 2 weeks. - A clan’s maximum number of captured flags in TW is 3.   Raid Bosses/Epic Bosses/Instance Features: - RB status is available on the Community Board. - Freya - 6-27 chars to enter. - Hard Freya - 6-27 chars to enter. - Frintezza - 6-45 chars to enter. - Ultra Daytime Zaken - 6-9 chars to enter. - Daytime Zaken - 6-9 chars to enter. - Nightly Zaken - 6-450 chars to enter. - Tiat - 9-45 chars to enter. - Beleth - 9 chars to enter. - Day/night restrictions for all Zaken instances have been removed. - Level‑limited zones: Ant Nest (levels 1–45), Sea of Spores (levels 1–56), Core (levels 1–56). - Almost all Raid Bosses listed in the Community Board drop an Enchanting Box with a 100% chance. - New Raid Bosses and their jewelry have been added. Teleport to these bosses via NPC Mirelle in Town of Giran. - New Instances: dolls, timed epic jewelry, and upgrade item for cloaks, bracelets, and accessories. Enter via NPC Ancient Portal in Town of Giran; 6-9 chars to enter.
    • Estou procurando cloacks do classic adaptadas para cliente interlude.
    • 10 Raid Bosses. PvP every 3 hours. Zero donations.   Welcome to L2 Empire. Interlude. x1000. Pure PvP. No donation shop. Not even "cosmetics only". Nothing. Everything in this game drops, gets farmed, or gets taken from someone else. Before we open the gates, we want real players to try to break it.   ⚔️ WHAT'S WAITING FOR YOU - Level 80 from the start, gear from the Starter Voucher, free buffs - Soulshots, spiritshots and potions: free, forever - 10 Raid Bosses on a fixed schedule, 4 arenas, everyone around them flagged - PvP Zone every 3 hours, Team vs Team, 1v1 Tournament, Olympiad, Sieges - Revenge: someone killed you? Get him within 10 minutes for double coins - Solo Dungeon, Player Market, weekly rankings, Hall of Fame - Our own anti cheat. One client per PC. Bots get nothing but a ban.   📡 A DISCORD CONNECTED TO THE GAME Our Discord is not just a chat. It lives with the server: - Live Raid Boss board: which boss is up, where, and when the next one comes - Every event on a countdown, shown in YOUR own time zone - Kill streaks, raid kills and weekly rankings posted live from the game - Link your character and get your PvP rank as a Discord role - The weekly PvP King, crowned on Discord - Your own stats with one command - Support tickets in English, Greek, Spanish and Portuguese - Development updates and sneak peeks before anyone else   🛠️ WHY WE NEED YOU The server is still being built, and we won't pretend otherwise. We want the bugs found now, not on launch night. We want clan leaders to tell us what their clan needs. We want to hear what you always hated on other servers, so it's not here.   🎖️ WHAT YOU GET Every tester gets an exclusive Beta Hero armor skin, forever. Keep the stats of your own armor, wear the look nobody else can ever get. You'll be the ones everyone recognizes as the first of L2 Empire.   👉 JOIN US: https://discord.gg/kQjk9md7fX Testers are picked on the Discord. See you in Giran. L2 Empire
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..