Addition of cancel Skill restore buffs configuration.
Contributed by G-hamsteR.
This commit is contained in:
8
L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/custom/CancelSkillRestoreBuffs.ini
vendored
Normal file
8
L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/custom/CancelSkillRestoreBuffs.ini
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Cancel Skill Restore Buffs
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Restore lost buffs on Cancellation skill after a few seconds.
|
||||
# Input the value in seconds (0 to disable).
|
||||
# Default : 0
|
||||
SecondsToReturnCancelledBuffs = 0
|
@@ -86,6 +86,7 @@ public class Config
|
||||
private static final String EVENT_TW_CONFIG_FILE = "./config/events/TW.ini";
|
||||
// custom
|
||||
private static final String BANK_CONFIG_FILE = "./config/custom/Bank.ini";
|
||||
private static final String CANCEL_SKILL_RESTORE_BUFFS_CONFIG_FILE = "./config/custom/CancelSkillRestoreBuffs.ini";
|
||||
private static final String CHAMPION_CONFIG_FILE = "./config/custom/Champion.ini";
|
||||
private static final String MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/custom/MerchantZeroSellPrice.ini";
|
||||
private static final String OFFLINE_CONFIG_FILE = "./config/custom/Offline.ini";
|
||||
@@ -538,6 +539,8 @@ public class Config
|
||||
public static int BANKING_SYSTEM_GOLDBARS;
|
||||
public static int BANKING_SYSTEM_ADENA;
|
||||
|
||||
public static int RESTORE_CANCELLED_BUFFS_SECONDS;
|
||||
|
||||
public static int BUFFER_MAX_SCHEMES;
|
||||
public static int BUFFER_STATIC_BUFF_COST;
|
||||
|
||||
@@ -1715,6 +1718,12 @@ public class Config
|
||||
BANKING_SYSTEM_ADENA = bankConfig.getInt("BankingAdenaCount", 500000000);
|
||||
}
|
||||
|
||||
public static void loadCancelSkillRestoreBuffsConfig()
|
||||
{
|
||||
final PropertiesParser cancelSkillRestoreBuffsConfig = new PropertiesParser(CANCEL_SKILL_RESTORE_BUFFS_CONFIG_FILE);
|
||||
RESTORE_CANCELLED_BUFFS_SECONDS = cancelSkillRestoreBuffsConfig.getInt("SecondsToReturnCancelledBuffs", 0);
|
||||
}
|
||||
|
||||
public static void loadBufferConfig()
|
||||
{
|
||||
final PropertiesParser shemeBufferConfig = new PropertiesParser(SCHEME_BUFFER_CONFIG_FILE);
|
||||
@@ -3025,6 +3034,7 @@ public class Config
|
||||
loadgeodataConfig();
|
||||
|
||||
// Custom
|
||||
loadCancelSkillRestoreBuffsConfig();
|
||||
loadChampionConfig();
|
||||
loadMerchantZeroPriceConfig();
|
||||
loadWeddingConfig();
|
||||
|
@@ -17,9 +17,12 @@
|
||||
package org.l2jmobius.gameserver.handler.skillhandlers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.AttackableAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
@@ -38,6 +41,7 @@ import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.SiegeSummonInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.player.CancelSkillRestoreTask;
|
||||
import org.l2jmobius.gameserver.model.skills.Formulas;
|
||||
import org.l2jmobius.gameserver.model.skills.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -427,6 +431,8 @@ public class Disablers implements ISkillHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
final List<Skill> cancelledBuffs = new ArrayList<>();
|
||||
int lvlmodifier = 52 + (skill.getLevel() * 2);
|
||||
if (skill.getLevel() == 12)
|
||||
{
|
||||
@@ -480,6 +486,15 @@ public class Disablers implements ISkillHandler
|
||||
|
||||
if (Rnd.get(100) < rate)
|
||||
{
|
||||
if (Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0)
|
||||
{
|
||||
// store them
|
||||
if (!cancelledBuffs.contains(e.getSkill()))
|
||||
{
|
||||
cancelledBuffs.add(e.getSkill());
|
||||
}
|
||||
}
|
||||
// cancel them
|
||||
e.exit(true);
|
||||
maxfive--;
|
||||
if (maxfive == 0)
|
||||
@@ -490,6 +505,10 @@ public class Disablers implements ISkillHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0) && (cancelledBuffs.size() > 0))
|
||||
{
|
||||
ThreadPool.schedule(new CancelSkillRestoreTask((PlayerInstance) target, cancelledBuffs), Config.RESTORE_CANCELLED_BUFFS_SECONDS * 1000);
|
||||
}
|
||||
}
|
||||
else if (creature instanceof PlayerInstance)
|
||||
{
|
||||
|
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
public class CancelSkillRestoreTask implements Runnable
|
||||
{
|
||||
private PlayerInstance _player = null;
|
||||
private List<Skill> _buffs = null;
|
||||
|
||||
public CancelSkillRestoreTask(PlayerInstance player, List<Skill> buffs)
|
||||
{
|
||||
_player = player;
|
||||
_buffs = buffs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if ((_player == null) || !_player.isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Skill skill : _buffs)
|
||||
{
|
||||
if (skill == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
skill.getEffects(_player, _player);
|
||||
}
|
||||
}
|
||||
}
|
8
L2J_Mobius_C6_Interlude/dist/game/config/custom/CancelSkillRestoreBuffs.ini
vendored
Normal file
8
L2J_Mobius_C6_Interlude/dist/game/config/custom/CancelSkillRestoreBuffs.ini
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Cancel Skill Restore Buffs
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Restore lost buffs on Cancellation skill after a few seconds.
|
||||
# Input the value in seconds (0 to disable).
|
||||
# Default : 0
|
||||
SecondsToReturnCancelledBuffs = 0
|
@@ -87,6 +87,7 @@ public class Config
|
||||
private static final String EVENT_TW_CONFIG_FILE = "./config/events/TW.ini";
|
||||
// custom
|
||||
private static final String BANK_CONFIG_FILE = "./config/custom/Bank.ini";
|
||||
private static final String CANCEL_SKILL_RESTORE_BUFFS_CONFIG_FILE = "./config/custom/CancelSkillRestoreBuffs.ini";
|
||||
private static final String CHAMPION_CONFIG_FILE = "./config/custom/Champion.ini";
|
||||
private static final String MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/custom/MerchantZeroSellPrice.ini";
|
||||
private static final String OFFLINE_CONFIG_FILE = "./config/custom/Offline.ini";
|
||||
@@ -558,6 +559,8 @@ public class Config
|
||||
public static int BANKING_SYSTEM_GOLDBARS;
|
||||
public static int BANKING_SYSTEM_ADENA;
|
||||
|
||||
public static int RESTORE_CANCELLED_BUFFS_SECONDS;
|
||||
|
||||
public static int BUFFER_MAX_SCHEMES;
|
||||
public static int BUFFER_STATIC_BUFF_COST;
|
||||
|
||||
@@ -1766,6 +1769,12 @@ public class Config
|
||||
BANKING_SYSTEM_ADENA = bankConfig.getInt("BankingAdenaCount", 500000000);
|
||||
}
|
||||
|
||||
public static void loadCancelSkillRestoreBuffsConfig()
|
||||
{
|
||||
final PropertiesParser cancelSkillRestoreBuffsConfig = new PropertiesParser(CANCEL_SKILL_RESTORE_BUFFS_CONFIG_FILE);
|
||||
RESTORE_CANCELLED_BUFFS_SECONDS = cancelSkillRestoreBuffsConfig.getInt("SecondsToReturnCancelledBuffs", 0);
|
||||
}
|
||||
|
||||
public static void loadBufferConfig()
|
||||
{
|
||||
final PropertiesParser shemeBufferConfig = new PropertiesParser(SCHEME_BUFFER_CONFIG_FILE);
|
||||
@@ -3094,6 +3103,7 @@ public class Config
|
||||
loadgeodataConfig();
|
||||
|
||||
// Custom
|
||||
loadCancelSkillRestoreBuffsConfig();
|
||||
loadChampionConfig();
|
||||
loadMerchantZeroPriceConfig();
|
||||
loadWeddingConfig();
|
||||
|
@@ -17,9 +17,12 @@
|
||||
package org.l2jmobius.gameserver.handler.skillhandlers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.AttackableAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
@@ -38,6 +41,7 @@ import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.SiegeSummonInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.player.CancelSkillRestoreTask;
|
||||
import org.l2jmobius.gameserver.model.skills.Formulas;
|
||||
import org.l2jmobius.gameserver.model.skills.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -427,6 +431,8 @@ public class Disablers implements ISkillHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
final List<Skill> cancelledBuffs = new ArrayList<>();
|
||||
int lvlmodifier = 52 + (skill.getLevel() * 2);
|
||||
if (skill.getLevel() == 12)
|
||||
{
|
||||
@@ -480,6 +486,15 @@ public class Disablers implements ISkillHandler
|
||||
|
||||
if (Rnd.get(100) < rate)
|
||||
{
|
||||
if (Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0)
|
||||
{
|
||||
// store them
|
||||
if (!cancelledBuffs.contains(e.getSkill()))
|
||||
{
|
||||
cancelledBuffs.add(e.getSkill());
|
||||
}
|
||||
}
|
||||
// cancel them
|
||||
e.exit(true);
|
||||
maxfive--;
|
||||
if (maxfive == 0)
|
||||
@@ -490,6 +505,10 @@ public class Disablers implements ISkillHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0) && (cancelledBuffs.size() > 0))
|
||||
{
|
||||
ThreadPool.schedule(new CancelSkillRestoreTask((PlayerInstance) target, cancelledBuffs), Config.RESTORE_CANCELLED_BUFFS_SECONDS * 1000);
|
||||
}
|
||||
}
|
||||
else if (creature instanceof PlayerInstance)
|
||||
{
|
||||
|
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
public class CancelSkillRestoreTask implements Runnable
|
||||
{
|
||||
private PlayerInstance _player = null;
|
||||
private List<Skill> _buffs = null;
|
||||
|
||||
public CancelSkillRestoreTask(PlayerInstance player, List<Skill> buffs)
|
||||
{
|
||||
_player = player;
|
||||
_buffs = buffs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if ((_player == null) || !_player.isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Skill skill : _buffs)
|
||||
{
|
||||
if (skill == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
skill.getEffects(_player, _player);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user