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

    • Introducing: Containers to Roll   Players now have the ability to win containers/cases via the Roll System. Additionally I also added a global leaderboard displaying the users with the most roll games. This can be disabled/enabled via Admin Management Panel. Also improved the winning display with a volumetric Godrays effect.  
    • I search job: posting your advertisement(sale,service) on various forums. Contacts for communication. You can find link for download messenger using Google search.   Telegram https://t.me/negotiato_r @negotiato_r   Element(based in United Kingdom) You can find me using this name. @negotiato-r:matrix.org   Session(based in Switzerland) You can find me using this name. 05770c2eda571fc8d10ec0e79e258ec0d9189def2a3e1f2ace1cd29a2174d40723   Delta Chat(based in Germany) You can find me using the link below. https://i.delta.chat/#1ABEBFFCBC1AEE629111387073FFDA1835BB423E&i=6WtJxcgJGcFD3vIpglQfhe5J&s=f2EkRsqxAeFYep9g9s1y1aIf&a=xuozjaudg%40nine.testrun.org&n=negotiator   I ask administrator or moderator not to consider this link an advertisement for messenger.  This is only link that people can use to contact me.  There is also QR code option,but you have to use mobile phone to access QR code.  This means you have to install VPN app on your mobile phone,then sync your account from your mobile phone to your laptop or computer.  This is a very cumbersome process.  It's much easier to use pre-made link for laptop or computer. Hello. I intermediary. I search job: posting your advertisement(sale,service) on various forums.  My service is free: posting your advertisement(sale,service) on various forums. I know these forum addresses,i can post your ad(for sale,service) on various forums. Dear sellers and those who provide any services. I offer you cooperation. My commission is not taken from your amount,my commission is added to your amount. From money received from guarantor,you pay me my commission.  Payment is made on Tether USDT TRC20 or on Tron TRX. Commission for sending from your wallet to my wallet paid by buyer. When communicating via messenger,please tell me what your commission is for sending on Tether USDT TRC20 or on Tron TRX.  Amount(fees) you'll pay as shipping fee to my wallet will be added to total amount. Payment will be made by guarantor to your payment details. Buyer deposits total amount with my percentage. Send me in messenger your ad copy with price(s). Independently from that through which messenger will be communication,buyer suggests using forum guarantor,gives forum address(http address) and send link(http address) to me,link i will pass on to you(seller) for consideration. If you as seller are not satisfied garant service on proposed forum,i say buyer goodbye and he goes to look for his product(service) from someone else,as result i will wait new buyer.   If sale amount is less than $1000,i receive 20 percent above your total amount. If sale amount is more than $1000,i receive 10 percent above your total amount. I do not deal with either buyers or sellers from Ukraine(i do not cooperate with this country). I will not accept any advertising related to Ukraine,as i do not cooperate with this country. For buyers from other countries guarantor's services are entirely at buyer's expense. You can offer me any other area cooperation that does not violate law.  I do not give 100% guarantee that i will accept your offer,which is not initially related to my advertising area.  It is 50/50 that i will either refuse you or accept your offer.  Everything will depend on whether this offer does not violate law.  I will read information about your product(service) in Google search engine that you offer me for advertising and make decision,which i will inform you in messenger for communication.  I will need some time to familiarize myself with information from Google search engine. I'm currently interested in 4 areas: 1)promotional offers with discounts only(coupons or promo codes):food,shoes,clothing,furniture,cosmetics,household appliances,consumer electronics,taxis,bus tickets,train tickets,plane tickets,hotel tickets,gas coupons or promo codes for car owners I do not advertise Ukraine,do not cooperate with it and have no dealings with it. I will not advertise anything related to carding.  Buyer deposits amount for product(service) plus my commission(20 percent based on amount for product or service) into guarantor and then receives their product(service) in forum transaction.  I would be grateful if it were possible for buyer to receive their goods somehow after depositing money with guarantor,without return address or contact information for future purchases. It's not in my best interests for buyer to communicate directly with you after first purchase. If this isn't possible,then you will simply agree with buyer to receive money with my percentage higher than your initial payment each time. If same customer purchases from you second time,customer pay you together with my percentage and i receive this percentage from you,this will provide additional incentive to advertise,i will promoting you on other forums.     2)selling real estate(houses or apartments) I'm not interested renting. I'm willing to advertise all countries except Russia and Ukraine.  I won't advertise these two countries. I don't advertise Ukraine,don't cooperate with it and have no dealings with it. I'm not interested house or apartment listings that appear on Google search pages,as buyer can find information there themselves without my help and buy house or apartment in desired country. I'm interested house or apartment that aren't listed on Google search. How i see this ad:buyer sees my listing for desired country and if they're interested,they deposit 10 percent listed price for house or apartment in Garant Service. Buyer sets  deadline in forum transaction,during which i either receive my money or don't.  Then buyer receive an address,day and time to meet with seller. Buyer takes lawyer and notary with them and flies(or is driving car) to  given address. If purchase transaction falls through,buyer collects their percentage from guarantor. I don't think buyer willing to buy  house or apartment worth more than 12545$ is willing to cheat me out  that 10 percent by making up  fake story about  failed deal.       3)selling telegram premium status Buyer has two options: 1) transaction through guarantor 2) transaction without guarantor   If transaction is through guarantor. I(intermediary) conduct transaction with guarantor. Buyer specifies following terms in terms transaction: 1) i authorize the disclosure of the transaction name to third parties(that is to you) 2) i authorize the disclosure of the seller's payment details(your payment details) to third parties(that is to you) 3) i authorize the disclosure of the total transaction amount to third parties(that is to you) 4) i do not authorize the disclosure of my profile link on this forum to third parties 5) i do not authorize the disclosure of my contact information(if i have any in my profile on this forum) to third parties   If activating premium status requires logging into buyer's account,i will do this.  You will provide me with instructions on how to activate premium status for buyer's account. If you want to contact me about selling premium status on telegram, but my telegram account is unavailable(account is frozen or telegram system has deleted it),you can contact me using my other contact information. To activate premium status by logging into buyer's account,i will download portable version telegram from official website and launch it on my laptop.  I will enter mobile phone number buyer provides me in messenger they originally contacted me through and send login code to this number.  Buyer will then send me login code. Once transaction is finalized and buyer has deposited funds into guarantor's account I'll notify you via messenger. You register on  forum suggested by buyer.  Message guarantor privately on forum,asking them to share all points I've outlined above.  Buyer will provide  link to guarantor's forum profile in advance or you can find guarantor's forum profile on forum yourself,it's up to you to decide. After verifying that your payment details are included and that transaction amount matches amount agreed upon in messenger, you upgrade buyer to premium status. Your payment details are specified in application,in formquestionnaire for forum transaction,but you won't receive money from guarantor until buyer will not receive service(product),as soon as buyer receives service from you,guarantor will pay you. If buyer has received premium status,you receive funds from guarantor and then pay me my commission using my payment details. The fee for sending from your wallet to my wallet is covered by buyer,not you. When communicating via messenger please tell me your fee for sending to Tether USDT TRC20 or Tron TRX. Buyer deposits funds into guarantor with total amount already including my percentage plus buyer's fee for sending,which you will spend by paying me my percentage when transferring from Tether USDT TRC20 or Tron TRX. If transaction is without guarantor. Buyer pays money to your payment details received from me via messenger and waits for service to be rendered. I will inform buyer total amount when communicating via messenger. You upgrade buyer to premium status through me and then you pay me my percentage to my payment details.  If activating premium status requires logging into buyer's account. I will do so.  You will provide me with instructions on how to activate premium status for buyer's account. Fee for sending from your wallet to my wallet is covered by buyer,not you.  When communicating via messenger please tell me your fee for sending to Tether(USDT TRC20) or Tron(TRX). Buyer pays you total amount,including my percentage plus buyer's fee for sending,which you will spend by paying me my percentage when transferring from Tether USDT TRC20 or Tron TRX.       4)i offer cooperation to specialists who provide services for collecting and submitting documents to consulate for citizenship,residence permits,visas and schengen visas I will advertise service collecting and sending documents to consulate only for following countries:Commonwealth of Independent States,Europe,Mexico,United states america,Canada,United Kingdom,Asia,Africa. Russia and Ukraine:these two countries i will not advertise. Buyer pays guarantor(amount from seller) for service for collecting and sending documents to consulate plus my commission(10 or 20 percent based on service fee). Buyer sets deadline in forum transaction within which they must receive service. Then in forum transaction buyer wait provision service. If after specified period(which will be specified in transaction),consulate refuses client's service,you as specialist have right to charge exact amount for your work through guarantor,since you spent your time on it(this clause will be specified in transaction). What will be amount you will decide,send solution through me.I'll let the buyer know. Client does not pay my percentage if consulate refuses client's service(this clause will be specified in transaction).  In case refusal to buyer from consulate you will need to confirm this refusal through website. Whenever you collect and submit documents on country's website,request is created through their website.  You will provide access to this request to guarantor.  This is necessary to ensure that buyer doesn't pay for nothing,meaning amount you will be required to receive through  guarantor for service provided if  consulate's request is unsuccessful.
    • Hey MaxCheaters! 👋 Introducing L2Soon.com — a free international platform for Lineage 2 server announcements.   Why L2Soon? No more searching through dozens of forums and Discord servers. All new L2 server openings are in one place — updated daily, with real player online counts so you always know where people actually play.   Features: 🔔 Telegram Bot (@l2Soon_bot) — alerts 24h & 1h before server launch 📅 Accurate launch times — in your local timezone ⚔️ All chronicles — Interlude, High Five, GoD, Classic, Essence, Grand Crusade and more 🎯 Filters — by chronicle, rates (x1–x1000+) and server type (PvP, RvR, GvE, Craft, Low Rate...) ⭐ VIP servers — verified projects pinned at the top 🌍 Multi-language — EN, UK, RU, PT   Listing is completely FREE. 🔗 https://l2soon.com/en Feedback welcome — drop a comment or contact us via Telegram @l2Soon_bot
  • 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..