Better naming for NightStatModifier effect.
This commit is contained in:
+1
-1
@@ -232,6 +232,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -332,7 +333,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
@@ -49,7 +49,7 @@ public class StatAddForNight extends AbstractEffect
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
@@ -6458,7 +6458,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -202,6 +202,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -301,7 +302,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -232,6 +232,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -332,7 +333,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
@@ -49,7 +49,7 @@ public class StatAddForNight extends AbstractEffect
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
@@ -6456,7 +6456,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -202,6 +202,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -301,7 +302,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -232,6 +232,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -332,7 +333,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
@@ -49,7 +49,7 @@ public class StatAddForNight extends AbstractEffect
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
@@ -6456,7 +6456,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -202,6 +202,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -301,7 +302,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -236,6 +236,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -337,7 +338,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
@@ -49,7 +49,7 @@ public class StatAddForNight extends AbstractEffect
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
@@ -6484,7 +6484,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -206,6 +206,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -306,7 +307,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -240,6 +240,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -342,7 +343,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6484,7 +6484,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -210,6 +210,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -311,7 +312,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -241,6 +241,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -343,7 +344,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6484,7 +6484,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -211,6 +211,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -312,7 +313,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -241,6 +241,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -343,7 +344,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6507,7 +6507,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -211,6 +211,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -312,7 +313,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -241,6 +241,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -343,7 +344,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6490,7 +6490,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -211,6 +211,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -311,7 +312,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -242,6 +242,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -346,7 +347,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6480,7 +6480,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -212,6 +212,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -314,7 +315,6 @@ SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
Vendored
+1
-1
@@ -243,6 +243,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -347,7 +348,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6480,7 +6480,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -212,6 +212,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -314,7 +315,6 @@ SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -244,6 +244,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -349,7 +350,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForStat", StatAddForStat::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6480,7 +6480,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -213,6 +213,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -316,7 +317,6 @@ SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatAddForStat: Adds a fixed amount of a Stat based on player current value. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
|
||||
+1
-1
@@ -246,6 +246,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -351,7 +352,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForStat", StatAddForStat::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6480,7 +6480,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -215,6 +215,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -318,7 +319,6 @@ SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatAddForStat: Adds a fixed amount of a Stat based on player current value. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
|
||||
+1
-1
@@ -230,6 +230,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -329,7 +330,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/NightStatModifier.java
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6634,7 +6634,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -200,6 +200,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -298,7 +299,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -230,6 +230,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -329,7 +330,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6652,7 +6652,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -200,6 +200,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -298,7 +299,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -232,6 +232,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -331,7 +332,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7192,7 +7192,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -202,6 +202,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -300,7 +301,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -235,6 +235,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -335,7 +336,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7234,7 +7234,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -205,6 +205,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -304,7 +305,6 @@ SpiritExpModify: Spirit EXP modify stat effect. (JoeAlisson)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
Vendored
+1
-1
@@ -235,6 +235,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -335,7 +336,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7817,7 +7817,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -205,6 +205,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -304,7 +305,6 @@ SpiritExpModify: Spirit EXP modify stat effect. (JoeAlisson)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -237,6 +237,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -337,7 +338,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/StatAddForNight.java
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7817,7 +7817,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -207,6 +207,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -306,7 +307,6 @@ SpiritExpModify: Spirit EXP modify stat effect. (JoeAlisson)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -232,6 +232,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -332,7 +333,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("SpModify", SpModify::new);
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6462,7 +6462,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
@@ -202,6 +202,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -300,7 +301,6 @@ SpeedLimit: Increase a character's max Speed limit. (l2jmobius)
|
||||
SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
Vendored
+1
-1
@@ -242,6 +242,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -345,7 +346,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7752,7 +7752,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
+1
-1
@@ -212,6 +212,7 @@ MpRegen: MP Regeneration stat.
|
||||
MpShield: Transfers given percentage of damage as mana damage. Mana Shield.
|
||||
MpVampiricAttack: Absorbs given percentage of mana during attack.
|
||||
Mute: Prevents target from using magical skills. Silence.
|
||||
NightStatModifier: Modify a specific stat at night time. (l2jmobius)
|
||||
NoblesseBless: Does not remove buffs upon death except itself.
|
||||
OpenChest: Opens a treasure chest.
|
||||
OpenCommonRecipeBook: Shows the common recipe book window.
|
||||
@@ -314,7 +315,6 @@ SpModify: Bonus SP stat.
|
||||
Spoil: Spoils a mob activating its extra sweep drop.
|
||||
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
|
||||
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
|
||||
StatAddForNight: Modify a specific stat at night time. (l2jmobius)
|
||||
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
|
||||
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
|
||||
StatByMoveType: Adds stat based on your movement type (standing, running, walking).
|
||||
|
||||
+1
-1
@@ -243,6 +243,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("MpShield", MpShield::new);
|
||||
EffectHandler.getInstance().registerHandler("MpVampiricAttack", MpVampiricAttack::new);
|
||||
EffectHandler.getInstance().registerHandler("Mute", Mute::new);
|
||||
EffectHandler.getInstance().registerHandler("NightStatModifier", NightStatModifier::new);
|
||||
EffectHandler.getInstance().registerHandler("NoblesseBless", NoblesseBless::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenChest", OpenChest::new);
|
||||
EffectHandler.getInstance().registerHandler("OpenCommonRecipeBook", OpenCommonRecipeBook::new);
|
||||
@@ -347,7 +348,6 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
|
||||
EffectHandler.getInstance().registerHandler("StatAddForNight", StatAddForNight::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
|
||||
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class NightStatModifier extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public NightStatModifier(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/StatAddForNight.java
Vendored
-130
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.effecthandlers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class StatAddForNight extends AbstractEffect
|
||||
{
|
||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||
private static final int SHADOW_SENSE = 294;
|
||||
|
||||
private final Stat _stat;
|
||||
private final int _amount;
|
||||
protected final StatModifierType _mode;
|
||||
|
||||
public StatAddForNight(StatSet params)
|
||||
{
|
||||
_stat = params.getEnum("stat", Stat.class);
|
||||
_amount = params.getInt("amount");
|
||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||
|
||||
// Init a global day-night change listener.
|
||||
final ListenersContainer container = Containers.Global();
|
||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.add(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
NIGHT_STAT_CHARACTERS.remove(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pump(Creature effected, Skill skill)
|
||||
{
|
||||
// Not night.
|
||||
if (!GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply stat.
|
||||
switch (_mode)
|
||||
{
|
||||
case DIFF:
|
||||
{
|
||||
effected.getStat().mergeAdd(_stat, _amount);
|
||||
break;
|
||||
}
|
||||
case PER:
|
||||
{
|
||||
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDayNightChange(OnDayNightChange event)
|
||||
{
|
||||
synchronized (DAY_TIME)
|
||||
{
|
||||
final boolean isNight = event.isNight();
|
||||
|
||||
// Run only once per daytime change.
|
||||
if (isNight == DAY_TIME.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DAY_TIME.set(isNight);
|
||||
|
||||
// System message for Shadow Sense.
|
||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||
msg.addSkillName(SHADOW_SENSE);
|
||||
|
||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||
{
|
||||
// Pump again.
|
||||
creature.getStat().recalculateStats(true);
|
||||
|
||||
// Send Shadow Sense message when player has skill.
|
||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||
{
|
||||
creature.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7943,7 +7943,7 @@
|
||||
<operateType>P</operateType>
|
||||
<magicCriticalRate>5</magicCriticalRate>
|
||||
<effects>
|
||||
<effect name="StatAddForNight">
|
||||
<effect name="NightStatModifier">
|
||||
<stat>ACCURACY_COMBAT</stat>
|
||||
<amount>3</amount>
|
||||
</effect>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user