Addition of WorldChat and DamageByAttack effect handlers.
Adapted from: L2jUnity free files.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.enums;
|
||||
|
||||
public enum DamageByAttackType
|
||||
{
|
||||
NONE,
|
||||
PK, // Players and summons.
|
||||
MOB, // Regular monsters.
|
||||
BOSS, // Boss monsters
|
||||
ENEMY_ALL; // All NPCs
|
||||
}
|
@@ -156,7 +156,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
// Update data for online players.
|
||||
L2World.getInstance().getPlayers().stream().forEach(player ->
|
||||
{
|
||||
player.getVariables().set(PlayerVariables.EXTEND_DROP, "");
|
||||
player.getVariables().remove(PlayerVariables.EXTEND_DROP);
|
||||
player.getVariables().storeMe();
|
||||
});
|
||||
|
||||
@@ -195,7 +195,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
|
||||
{
|
||||
ps.setInt(1, Config.WORLD_CHAT_POINTS_PER_DAY);
|
||||
ps.setInt(1, 0);
|
||||
ps.setString(2, PlayerVariables.WORLD_CHAT_VARIABLE_NAME);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
// Update data for online players.
|
||||
L2World.getInstance().getPlayers().stream().forEach(player ->
|
||||
{
|
||||
player.setWorldChatPoints(Config.WORLD_CHAT_POINTS_PER_DAY);
|
||||
player.setWorldChatUsed(0);
|
||||
player.sendPacket(new ExWorldChatCnt(player));
|
||||
player.getVariables().storeMe();
|
||||
});
|
||||
|
@@ -4552,6 +4552,25 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
}
|
||||
|
||||
final double damageCap = getStat().getValue(Stats.DAMAGE_LIMIT);
|
||||
if (damageCap > 0)
|
||||
{
|
||||
value = Math.min(value, damageCap);
|
||||
}
|
||||
|
||||
// Calculate PvP/PvE damage received. It is a post-attack stat.
|
||||
if (attacker != null)
|
||||
{
|
||||
if (attacker.isPlayable())
|
||||
{
|
||||
value *= (100 + getStat().getValue(Stats.PVP_DAMAGE_TAKEN)) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
value *= (100 + getStat().getValue(Stats.PVE_DAMAGE_TAKEN)) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.CHAMPION_ENABLE && isChampion() && (Config.CHAMPION_HP != 0))
|
||||
{
|
||||
getStatus().reduceHp(value / Config.CHAMPION_HP, attacker, (skill == null) || !skill.isToggle(), isDOT, false);
|
||||
|
@@ -13450,16 +13450,24 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
public int getWorldChatPoints()
|
||||
{
|
||||
return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 1);
|
||||
return (int) getStat().getValue(Stats.WORLD_CHAT_POINTS, Config.WORLD_CHAT_POINTS_PER_DAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The amount of times player has used world chat
|
||||
*/
|
||||
public int getWorldChatUsed()
|
||||
{
|
||||
return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of times player can use world chat
|
||||
* @param points
|
||||
* @param timesUsed how many times world chat has been used up until now.
|
||||
*/
|
||||
public void setWorldChatPoints(int points)
|
||||
public void setWorldChatUsed(int timesUsed)
|
||||
{
|
||||
getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, points);
|
||||
getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, timesUsed);
|
||||
}
|
||||
|
||||
public void prohibiteCeremonyOfChaos()
|
||||
|
@@ -103,6 +103,10 @@ public enum Stats
|
||||
PVE_RAID_PHYSICAL_SKILL_DEFENCE("pveRaidPhysSkillsDef"),
|
||||
PVE_RAID_MAGICAL_SKILL_DEFENCE("pveRaidMagicalDef"),
|
||||
|
||||
// FIXED BONUS
|
||||
PVP_DAMAGE_TAKEN("pvpDamageTaken"),
|
||||
PVE_DAMAGE_TAKEN("pveDamageTaken"),
|
||||
|
||||
// ATTACK & DEFENCE RATES
|
||||
MAGIC_CRITICAL_DAMAGE("mCritPower"),
|
||||
PHYSICAL_SKILL_POWER("physicalSkillPower"), // Adding skill power (not multipliers) results in points added directly to final value unmodified by defence, traits, elements, criticals etc.
|
||||
@@ -268,6 +272,7 @@ public enum Stats
|
||||
STAT_BONUS_SKILL_CRITICAL("statSkillCritical"),
|
||||
STAT_BONUS_SPEED("statSpeed"),
|
||||
SHOTS_BONUS("shotBonus", new ShotsBonusFinalizer()),
|
||||
WORLD_CHAT_POINTS("worldChatPoints"),
|
||||
ATTACK_DAMAGE("attackDamage");
|
||||
|
||||
static final Logger LOGGER = Logger.getLogger(Stats.class.getName());
|
||||
|
@@ -46,7 +46,7 @@ public class PlayerVariables extends AbstractVariables
|
||||
|
||||
// Public variable names
|
||||
public static final String HAIR_ACCESSORY_VARIABLE_NAME = "HAIR_ACCESSORY_ENABLED";
|
||||
public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_POINTS";
|
||||
public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_USED";
|
||||
public static final String VITALITY_ITEMS_USED_VARIABLE_NAME = "VITALITY_ITEMS_USED";
|
||||
private static final String DAILY_MISSION_REWARDS = "DAILY_MISSION_REWARDS";
|
||||
public static final String CEREMONY_OF_CHAOS_PROHIBITED_PENALTIES = "CEREMONY_OF_CHAOS_PENALTIES";
|
||||
|
@@ -30,7 +30,7 @@ public class ExWorldChatCnt implements IClientOutgoingPacket
|
||||
|
||||
public ExWorldChatCnt(L2PcInstance activeChar)
|
||||
{
|
||||
_points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : activeChar.getWorldChatPoints();
|
||||
_points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : Math.max(activeChar.getWorldChatPoints() - activeChar.getWorldChatUsed(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user