Akken Posted October 2, 2013 Share Posted October 2, 2013 (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 October 2, 2013 by Akken Link to comment Share on other sites More sharing options...
0 Akken Posted October 4, 2013 Author Share Posted October 4, 2013 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 Link to comment Share on other sites More sharing options...
0 xdem Posted October 2, 2013 Share Posted October 2, 2013 (edited) private l2frozen... please tell me more, it has (x instanceof Object) checks too? Or its just limited to variable nulling ? Edited October 2, 2013 by xdem Link to comment Share on other sites More sharing options...
0 Akken Posted October 2, 2013 Author Share Posted October 2, 2013 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... Link to comment Share on other sites More sharing options...
0 ^Wyatt Posted October 2, 2013 Share Posted October 2, 2013 Jesus, please post in the correct section, moving it... Link to comment Share on other sites More sharing options...
0 Akken Posted October 2, 2013 Author Share Posted October 2, 2013 first post edited more simplier explanations Link to comment Share on other sites More sharing options...
0 Tryskell Posted October 3, 2013 Share Posted October 3, 2013 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. Link to comment Share on other sites More sharing options...
0 Akken Posted October 3, 2013 Author Share Posted October 3, 2013 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; } Link to comment Share on other sites More sharing options...
0 Akken Posted October 4, 2013 Author Share Posted October 4, 2013 bump Link to comment Share on other sites More sharing options...
0 Akken Posted October 4, 2013 Author Share Posted October 4, 2013 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? Link to comment Share on other sites More sharing options...
0 ^Wyatt Posted October 4, 2013 Share Posted October 4, 2013 (edited) Clearly Hosting machine... u should type its characteristics... Edited October 4, 2013 by ^Wyatt Link to comment Share on other sites More sharing options...
0 Akken Posted October 4, 2013 Author Share Posted October 4, 2013 i can hardly understand what you mean.. if possible to explain me some more.. i face this for first time.. Link to comment Share on other sites More sharing options...
0 SweeTs Posted October 4, 2013 Share Posted October 4, 2013 (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 October 4, 2013 by SweeTs Link to comment Share on other sites More sharing options...
0 ^Wyatt Posted October 4, 2013 Share Posted October 4, 2013 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: Link to comment Share on other sites More sharing options...
0 Akken Posted October 4, 2013 Author Share Posted October 4, 2013 (edited) vds 4 gb ram x2 athlon - win7 changed from linux and win 2008 server cause i thought os was problem Edited October 4, 2013 by Akken Link to comment Share on other sites More sharing options...
0 Tryskell Posted October 4, 2013 Share Posted October 4, 2013 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. Link to comment Share on other sites More sharing options...
Question
Akken
Edited by Akken
Link to comment
Share on other sites
16 answers to this question
Recommended Posts