Page 1 of 1

Cancel Sys for H5

Posted: Sat Apr 12, 2014 2:52 pm
by dasoldier
Hello everyone, i wanted to ask help for a code that returns buffs(cancelled) after a certain amount of time cause i've tried to adapt all existing cancel scripts shared but failed cause
many files removed or codes merged and i cant find a way to do it.

UNSTABLE
DataPack Rev:10247
ServerPack Rev:6478


First code
open eclipse.
Now go to package explorer.
look into L2J_Datapack and go to data.scripts.handlers.effecthandlers and open Cancel.java
open search
Type: package handlers.skillhandlers;
And paste this under: package handlers.skillhandlers;

Code: Select all

 import javolution.util.FastList;import com.l2jserver.gameserver.datatables.SkillTable;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;import com.l2jserver.gameserver.ThreadPoolManager;import com.l2jserver.gameserver.model.skills.L2Skill; 

then open search
Type: return L2EffectType.CANCEL;
}
And paste under: return L2EffectType.CANCEL;
}

Code: Select all

         private int seconds = 13;    private void returnbuffs (L2Character player, FastList<L2Effect>list)    {           for (L2Effect e : list)        {            L2Skill skill = SkillTable.getInstance().getInfo(e.getSkill().getId(), e.getLevel());                            if(skill != null)            {                skill.getEffects(player, player);            }                   }        ((L2PcInstance)player).isoncanceltask=false;        }    


Then open search
Type: ((L2Npc)activeChar)._spiritshotcharged = false;
}
And remove these lines under: ((L2Npc)activeChar)._spiritshotcharged = false;
}

Code: Select all

 L2Character target; 


Then open search
Type: if (!(obj instanceof L2Character))
continue;
And remove line under: if (!(obj instanceof L2Character))
continue;

Code: Select all

target = (L2Character)obj;

Replace it with:

Code: Select all

final L2Character target = (L2Character)obj;
Then open search
Type: final L2Effect[] effects = target.getAllEffects();
And paste under: final L2Effect[] effects = target.getAllEffects();

Code: Select all

     if (target instanceof L2PcInstance)    {    ((L2PcInstance)target).clearcancelbuffs();    } 
Then open search
Type: lastCanceledSkillId = eff.getSkill().getId();
And paste under: lastCanceledSkillId = eff.getSkill().getId();

Code: Select all

 if (target instanceof L2PcInstance)                    {                        ((L2PcInstance)target).addcancelbuffs(effect);                          } 
Then open search
Type: lastCanceledSkillId = eff.getSkill().getId();
And paste under: lastCanceledSkillId = eff.getSkill().getId();

Code: Select all

 if (target instanceof L2PcInstance)                        {                            ((L2PcInstance)target).addcancelbuffs(effect);                              } 
Then open search
Type: //Possibility of a lethal strike
Formulas.calcLethalHit(activeChar, target, skill);
And paste under: //Possibility of a lethal strike
Formulas.calcLethalHit(activeChar, target, skill);

Code: Select all

 if (target instanceof L2PcInstance && ((L2PcInstance)target).getcancelbuffs()!=null && !((L2PcInstance)target).isoncanceltask)            {                ((L2PcInstance)target).sendMessage("You will get back your buffs in "+seconds+" seconds.");                                ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()                {                    @Override                    public void run()                    {                        ((L2PcInstance)target).isoncanceltask=true;                        returnbuffs(target, ((L2PcInstance)target).getcancelbuffs());                       }                },seconds * 1000);                  } 
Second code
Now go to package explorer.
look into com.l2jserver.gameserver.model and open L2Effect.java
Press Ctrl+f to open the search tool.
Type: if (_count == 0 && _icon && getEffected() instanceof L2PcInstance)
{
and press on search.
Remove line under: if (_count == 0 && _icon && getEffected() instanceof L2PcInstance)

Code: Select all

                {   SystemMessage smsg3 = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WORN_OFF);      smsg3.addSkillName(_skill);    getEffected().sendPacket(smsg3);  
and replace with:

Code: Select all

  if (!((L2PcInstance)getEffected()).isoncanceltask)                    {                        SystemMessage smsg3 = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WORN_OFF);                        smsg3.addSkillName(_skill);                        getEffected().sendPacket(smsg3);                    } 
Third code
look into L2J_server and go to com.l2jserver.gameserver.model.actor.instance and open L2PcInstance.java
open search
Type: private static final String DELETE_TP_BOOKMARK = "DELETE FROM character_tpbookmark WHERE charId=? AND Id=?";
And paste this under: private static final String DELETE_TP_BOOKMARK = "DELETE FROM character_tpbookmark WHERE charId=? AND Id=?";

Code: Select all

     //Cancel return back buffs    private FastList<L2Effect> cancelbuffs = new FastList<L2Effect>();  //wyatt    public boolean isoncanceltask = false;        public FastList<L2Effect> getcancelbuffs()    {        return cancelbuffs;    }                public void addcancelbuffs(L2Effect effect)    {        cancelbuffs.add(effect);    }        public void clearcancelbuffs()    {        cancelbuffs.clear();    } 
Cancel.java CHANGED DispelByCategory.java
L2Effect CHANGED AbstractEffect

Thnx in advance.

Re: Cancel Sys for H5

Posted: Sat Apr 12, 2014 4:17 pm
by Zoey76
Something like this was already shared in forum, please use search.

Re: Cancel Sys for H5

Posted: Sat Apr 12, 2014 5:58 pm
by dasoldier
already tried everything shared as mentioned but all codes seem to be OUTDATED cause every code mention about
Cancel.java Disablers.java L2Effect.java and all those files are removed/renamed/merged/seperated to other files
i rly think there needs to be a new post about this patch cause none with basic dev skills will be able to adapt it

Re: Cancel Sys for H5

Posted: Sat Apr 12, 2014 6:13 pm
by JMD
dasoldier wrote:already tried everything shared as mentioned but all codes seem to be OUTDATED cause every code mention about
Cancel.java Disablers.java L2Effect.java and all those files are removed/renamed/merged/seperated to other files
i rly think there needs to be a new post about this patch cause none with basic dev skills will be able to adapt it
you could make a reply to this post viewtopic.php?f=13&t=28868&start=15 requesting an update so it works with latest revs.

Im sure bani will make the time to update it.