Addition of WorldChat and DamageByAttack effect handlers.

Adapted from: L2jUnity free files.
This commit is contained in:
MobiusDev
2017-12-07 22:57:14 +00:00
parent b04890d93c
commit d4187ff765
110 changed files with 870 additions and 345 deletions

View File

@@ -99,6 +99,7 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("CrystalGradeModify", CrystalGradeModify::new);
EffectHandler.getInstance().registerHandler("CubicMastery", CubicMastery::new);
EffectHandler.getInstance().registerHandler("DamageBlock", DamageBlock::new);
EffectHandler.getInstance().registerHandler("DamageByAttack", DamageByAttack::new);
EffectHandler.getInstance().registerHandler("DamageShield", DamageShield::new);
EffectHandler.getInstance().registerHandler("DamageShieldResist", DamageShieldResist::new);
EffectHandler.getInstance().registerHandler("DamOverTime", DamOverTime::new);
@@ -361,6 +362,7 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("VitalityPointUp", VitalityPointUp::new);
EffectHandler.getInstance().registerHandler("WeightLimit", WeightLimit::new);
EffectHandler.getInstance().registerHandler("WeightPenalty", WeightPenalty::new);
EffectHandler.getInstance().registerHandler("WorldChatPoints", WorldChatPoints::new);
LOGGER.info(EffectMasterHandler.class.getSimpleName() + ": Loaded " + EffectHandler.getInstance().size() + " effect handlers.");
}
}

View File

@@ -333,7 +333,7 @@ public class AdminAdmin implements IAdminCommandHandler
activeChar.sendMessage("Your target's level is below the minimum: " + Config.WORLD_CHAT_MIN_LEVEL);
break;
}
activeChar.sendMessage(targetPlayer.getName() + ": has " + targetPlayer.getWorldChatPoints() + " world chat points");
activeChar.sendMessage(targetPlayer.getName() + ": has used world chat " + targetPlayer.getWorldChatUsed() + " times out of maximum " + targetPlayer.getWorldChatPoints() + " times.");
break;
}
case "set":
@@ -354,19 +354,19 @@ public class AdminAdmin implements IAdminCommandHandler
if (!st.hasMoreTokens())
{
activeChar.sendMessage("Incorrect syntax, use: //worldchat set <points>");
activeChar.sendMessage("Incorrect syntax, use: //worldchat set <times used>");
break;
}
final String valueToken = st.nextToken();
if (!Util.isDigit(valueToken))
{
activeChar.sendMessage("Incorrect syntax, use: //worldchat set <points>");
activeChar.sendMessage("Incorrect syntax, use: //worldchat set <times used>");
break;
}
activeChar.sendMessage(targetPlayer.getName() + ": points changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken);
targetPlayer.setWorldChatPoints(Integer.parseInt(valueToken));
activeChar.sendMessage(targetPlayer.getName() + ": times used changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken);
targetPlayer.setWorldChatUsed(Integer.parseInt(valueToken));
if (Config.ENABLE_WORLD_CHAT)
{
targetPlayer.sendPacket(new ExWorldChatCnt(targetPlayer));

View File

@@ -74,7 +74,7 @@ public final class ChatWorld implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
else if (activeChar.getWorldChatPoints() < 1)
else if (activeChar.getWorldChatUsed() >= activeChar.getWorldChatPoints())
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_A_NEW_DAY_STARTS_EVERY_DAY_AT_18_30);
}
@@ -111,7 +111,7 @@ public final class ChatWorld implements IChatHandler
L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
}
activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1);
activeChar.setWorldChatUsed(activeChar.getWorldChatUsed() + 1);
activeChar.sendPacket(new ExWorldChatCnt(activeChar));
if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0)
{

View File

@@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Backstab effect implementation.
@@ -89,12 +88,6 @@ public final class Backstab extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, true, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage))

View File

@@ -0,0 +1,63 @@
/*
* 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 com.l2jmobius.gameserver.enums.DamageByAttackType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* An effect that changes damage taken from an attack.<br>
* The retail implementation seems to be altering whatever damage is taken after the attack has been done and not when attack is being done. <br>
* Exceptions for this effect appears to be DOT effects and terrain damage, they are unaffected by this stat.<br>
* As for example in retail this effect does reduce reflected damage taken (because it is received damage), as well as it does not decrease reflected damage done,<br>
* because reflected damage is being calculated with the original attack damage and not this altered one.<br>
* Multiple values of this effect add-up to each other rather than multiplying with each other. Be careful, there were cases in retail where damage is deacreased to 0.
* @author Nik
*/
public class DamageByAttack extends AbstractEffect
{
private final double _value;
private final DamageByAttackType _type;
public DamageByAttack(StatsSet params)
{
_value = params.getDouble("amount");
_type = params.getEnum("type", DamageByAttackType.class, DamageByAttackType.NONE);
}
@Override
public void pump(L2Character target, Skill skill)
{
switch (_type)
{
case PK:
{
target.getStat().mergeAdd(Stats.PVP_DAMAGE_TAKEN, _value);
break;
}
case ENEMY_ALL:
{
target.getStat().mergeAdd(Stats.PVE_DAMAGE_TAKEN, _value);
break;
}
}
}
}

View File

@@ -165,11 +165,6 @@ public final class EnergyAttack extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(attacker, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false);
// attacker.sendDamageMessage(effected, skill, (int) damage, critical, false);
}

View File

@@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Fatal Blow effect implementation.
@@ -121,12 +120,6 @@ public final class FatalBlow extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)

View File

@@ -174,11 +174,7 @@ public final class PhysicalAttack extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false);
// effector.sendDamageMessage(effected, skill, (int) damage, critical, false);
}

View File

@@ -137,11 +137,6 @@ public final class PhysicalAttackHpLink extends AbstractEffect
// Check if damage should be reflected.
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false);
// effector.sendDamageMessage(effected, skill, (int) damage, critical, false);
}

View File

@@ -147,12 +147,6 @@ public final class PhysicalAttackSaveHp extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
final double minHp = (effected.getMaxHp() * _saveHp) / 100;
if ((effected.getCurrentHp() - damage) < minHp)

View File

@@ -168,11 +168,6 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false);
// effector.sendDamageMessage(effected, skill, (int) damage, critical, false);
}

View File

@@ -162,11 +162,6 @@ public final class PhysicalSoulAttack extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false);
// effector.sendDamageMessage(effected, skill, (int) damage, critical, false);
}

View File

@@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Soul Blow effect implementation.
@@ -94,12 +93,6 @@ public final class SoulBlow extends AbstractEffect
// Check if damage should be reflected
Formulas.calcCounterAttack(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Nik
*/
public class WorldChatPoints extends AbstractStatEffect
{
public WorldChatPoints(StatsSet params)
{
super(params, Stats.WORLD_CHAT_POINTS);
}
}

View File

@@ -68,6 +68,7 @@ CriticalRatePositionBonus: Critical Rate depending on position stat. Ignores the
CrystalGradeModify: Sets your Expertise Grade level. With this effect you can make lv. 40 player (C Grade) to wear S grade.
CubicMastery: Max cubics stat.
DamageBlock: Blocks Hp or Mp damage/heal.
DamageByAttack: An effect that changes damage taken from an attack.
DamageShield: Reflect damage percentage stat.
DamageShieldResist: Reflect damage percentage resist.
DamOverTime: Damage over time effect. Magic Critical results in 10 times amount to me instantly inflicted before the effect is started.
@@ -327,4 +328,5 @@ VitalityExpRate: Sets the vitality exp rate. (l2jmobius)
VitalityPointsRate: Vitality points consume rate.
VitalityPointUp: Increases vitality points.
WeightLimit: Maximum weight stat.
WeightPenalty: Weight penalty level stat.
WeightPenalty: Weight penalty level stat.
WorldChatPoints: Modify world chat points to use per day.