Jump to content

Uber Cancellation.


Recommended Posts

Guest Elfocrash

raw code?

raw code means FCA4 8CB8 48A8 4ACE 8488 9D48 94C9 464C

Lol raw code means just the code not a patch simple as that.

Sad to see people talking poor English and trying to be smartasses :(

Link to comment
Share on other sites

Hey guys, as i already said in the main topic it can be exploitable, for example, you join a clan and a hero puts valor on you, then you can have it forever, just cancel your character with a bot or something and you get the buff with 1h delay again.

 

But its easy to avoid it, just some modifications(save the buffs in a map, for example, where the key would be the buff and the value would be the time left to be over).

Link to comment
Share on other sites

Lol raw code means just the code not a patch simple as that.

Sad to see people talking poor English and trying to be smartasses :(

 

raw code, binary, octal or hexademical, a code which human brain cant process/understand

 

Raw code, smth which needs process to understood by humans

 

some kind of codes

 

raw codes, readable code

 

I think that java belongs to readable code dont you agree ?

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 2 months later...

Getting this error:

    [javac] C:\Users\Domantas\Desktop\eclipse\aCis_300\aCis_gameserver\java\net\sf\l2j\gameserver\handler\skillhandlers\Cancel.java:133: error: cannot find symbol
    [javac]             ThreadPoolManager.getInstance().scheduleGeneral(new CustomCancelTask((L2PcInstance)target, cancelledBuffs), 8*1000);
    [javac]                                                                                                ^
    [javac]   symbol:   variable target
    [javac]   location: class Cancel
    [javac] 1 error

 

What should I do ?

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 2 weeks later...

error on acis.

 

ubercancel.png

 

File CustomCancelTask.java

/*
 * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.model.entity.custom;

import javolution.util.FastMap;

import net.sf.l2j.gameserver.model.L2Effect;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.skills.Env;
import net.sf.l2j.gameserver.skills.effects.EffectTemplate;

/**
 * @author Anarchy
 *
 */
public class CustomCancelTask implements Runnable
{
	private L2PcInstance _player = null;
	private FastMap<L2Skill, int[]> _buffs = null;
	
	public CustomCancelTask(L2PcInstance _player, FastMap<L2Skill, int[]> _buffs)
	{
		this._player = _player;
		this._buffs = _buffs;
	}
	
	@Override
	public void run()
	{
		if (_player == null || !_player.isOnline())
		{
			return;
		}
		for (L2Skill s : _buffs.keySet())
		{
			if (s == null)
			{
				continue;
			}
			
             Env env = new Env();
             env.player = _player;
             env.target = _player;
             env.skill = s;
             L2Effect ef;
             for (EffectTemplate et : s.getEffectTemplates())
             {
                ef = et.getEffect(env);
                 if (ef != null)
                 {
                     ef.setCount(_buffs.get(s)[0]);
                     ef.setFirstTime(_buffs.get(s)[1]);
                     ef.scheduleEffect();
                 }
             }
		}
	}
}

Cancel.java

/*
 * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.handler.skillhandlers;

import javolution.util.FastMap;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.handler.ISkillHandler;
import net.sf.l2j.gameserver.model.L2Effect;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.ShotType;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.custom.CustomCancelTask;
import net.sf.l2j.gameserver.skills.Formulas;
import net.sf.l2j.gameserver.templates.skills.L2SkillType;
import net.sf.l2j.util.Rnd;

/**
 * @author DS
 */
public class Cancel implements ISkillHandler
{
	private static final L2SkillType[] SKILL_IDS =
	{
		L2SkillType.CANCEL,
		L2SkillType.MAGE_BANE,
		L2SkillType.WARRIOR_BANE
	};
	
	@Override
	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
	{
		// Delimit min/max % success.
		final int minRate = (skill.getSkillType() == L2SkillType.CANCEL) ? 25 : 40;
		final int maxRate = (skill.getSkillType() == L2SkillType.CANCEL) ? 75 : 95;
		
		// Get skill power (which is used as baseRate).
		final double skillPower = skill.getPower();
		
		for (L2Object obj : targets)
		{
			if (!(obj instanceof L2Character))
				continue;
			
			final L2Character target = (L2Character) obj;
			if (target.isDead())
				continue;
			
			FastMap<L2Skill, int[]> cancelledBuffs = new FastMap<>();
			
			int lastCanceledSkillId = 0;
			int count = skill.getMaxNegatedEffects();
			
			if (!cancelledBuffs.containsKey(effect.getSkill()))
			{
				cancelledBuffs.put(effect.getSkill(), new int[] { effect.getCount(), effect.getTime() });
			}
			
			// Calculate the difference of level between skill level and victim, and retrieve the vuln/prof.
			final int diffLevel = skill.getMagicLevel() - target.getLevel();
			final double skillVuln = Formulas.calcSkillVulnerability(activeChar, target, skill, skill.getSkillType());
			
			for (L2Effect effect : target.getAllEffects())
			{
				// Don't cancel null effects or toggles.
				if (effect == null || effect.getSkill().isToggle())
					continue;
				
				// Mage && Warrior Bane drop only particular stacktypes.
				switch (skill.getSkillType())
				{
					case MAGE_BANE:
						if ("casting_time_down".equalsIgnoreCase(effect.getStackType()))
							break;
						
						if ("ma_up".equalsIgnoreCase(effect.getStackType()))
							break;
						
						continue;
						
					case WARRIOR_BANE:
						if ("attack_time_down".equalsIgnoreCase(effect.getStackType()))
							break;
						
						if ("speed_up".equalsIgnoreCase(effect.getStackType()))
							break;
						
						continue;
				}
				
				// If that skill effect was already canceled, continue.
				if (effect.getSkill().getId() == lastCanceledSkillId)
					continue;
				
				// Calculate the success chance following previous variables.
				if (calcCancelSuccess(effect.getPeriod(), diffLevel, skillPower, skillVuln, minRate, maxRate))
				{
					// Stores the last canceled skill for further use.
					lastCanceledSkillId = effect.getSkill().getId();
					
					if (cancelledBuffs.size() > 0)
					{
						ThreadPoolManager.getInstance().scheduleGeneral(new CustomCancelTask((L2PcInstance)target, cancelledBuffs), 5*1000);
					}
					
					// Exit the effect.
					effect.exit();
				}
				
				// Remove 1 to the stack of buffs to remove.
				count--;
				
				// If the stack goes to 0, then break the loop.
				if (count == 0)
					break;
			}
			
			// Possibility of a lethal strike
			Formulas.calcLethalHit(activeChar, target, skill);
		}
		
		if (skill.hasSelfEffects())
		{
			final L2Effect effect = activeChar.getFirstEffect(skill.getId());
			if (effect != null && effect.isSelfEffect())
				effect.exit();
			
			skill.getEffectsSelf(activeChar);
		}
		activeChar.setChargedShot(activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOT) ? ShotType.BLESSED_SPIRITSHOT : ShotType.SPIRITSHOT, skill.isStaticReuse());
	}
	
	private static boolean calcCancelSuccess(int effectPeriod, int diffLevel, double baseRate, double vuln, int minRate, int maxRate)
	{
		double rate = (2 * diffLevel + baseRate + effectPeriod / 120) * vuln;
		
		if (Config.DEVELOPER)
			_log.info("calcCancelSuccess(): diffLevel:" + diffLevel + ", baseRate:" + baseRate + ", vuln:" + vuln + ", total:" + rate);
		
		if (rate < minRate)
			rate = minRate;
		else if (rate > maxRate)
			rate = maxRate;
		
		return Rnd.get(100) < rate;
	}
	
	@Override
	public L2SkillType[] getSkillIds()
	{
		return SKILL_IDS;
	}
}
Link to comment
Share on other sites

  • 5 months later...
  • 3 months later...

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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




×
×
  • Create New...