Addition of BonusExpType enumeration.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.BonusExpType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -38,11 +39,27 @@ public class ExpModify extends AbstractStatAddEffect
|
||||
{
|
||||
effected.getStat().mergeAdd(Stat.BONUS_EXP, _amount);
|
||||
|
||||
// Send exp bonus to player.
|
||||
final PlayerInstance player = effected.getActingPlayer();
|
||||
if (player != null)
|
||||
if (skill != null)
|
||||
{
|
||||
player.sendPacket(new ExUserBoostStat(player));
|
||||
if (skill.isActive())
|
||||
{
|
||||
effected.getStat().mergeAdd(Stat.ACTIVE_BONUS_EXP, _amount);
|
||||
effected.getStat().mergeAdd(Stat.BONUS_EXP_BUFFS, 1);
|
||||
final PlayerInstance player = effected.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(new ExUserBoostStat(player, BonusExpType.BUFFS));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
effected.getStat().mergeAdd(Stat.BONUS_EXP_PASSIVES, 1);
|
||||
final PlayerInstance player = effected.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(new ExUserBoostStat(player, BonusExpType.PASSIVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.BonusExpType;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -38,11 +39,14 @@ public class VitalityExpRate extends AbstractStatPercentEffect
|
||||
{
|
||||
effected.getStat().mergeMul(Stat.VITALITY_EXP_RATE, (_amount / 100) + 1);
|
||||
|
||||
// Send exp bonus to player.
|
||||
final PlayerInstance player = effected.getActingPlayer();
|
||||
if (player != null)
|
||||
if (skill != null)
|
||||
{
|
||||
player.sendPacket(new ExUserBoostStat(player));
|
||||
effected.getStat().mergeAdd(Stat.VITALITY_SKILLS, 1);
|
||||
final PlayerInstance player = effected.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(new ExUserBoostStat(player, BonusExpType.VITALITY));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.enums;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public enum BonusExpType
|
||||
{
|
||||
VITALITY(1),
|
||||
BUFFS(2),
|
||||
PASSIVE(3);
|
||||
|
||||
private int _id;
|
||||
|
||||
private BonusExpType(int id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
}
|
@@ -144,6 +144,9 @@ public enum Stat
|
||||
DEFENCE_CRITICAL_DAMAGE_SKILL_ADD("defCAtkSkillAdd"),
|
||||
INSTANT_KILL_RESIST("instantKillResist"),
|
||||
EXPSP_RATE("rExp"),
|
||||
ACTIVE_BONUS_EXP("activeBonusExp"), // Used to measure active skill bonus exp.
|
||||
BONUS_EXP_BUFFS("bonusExpBuffs"), // Used to count active skill exp.
|
||||
BONUS_EXP_PASSIVES("bonusExpPassives"), // Used to count passive skill exp.
|
||||
BONUS_EXP("bonusExp"),
|
||||
BONUS_SP("bonusSp"),
|
||||
BONUS_DROP_ADENA("bonusDropAdena"),
|
||||
@@ -251,6 +254,7 @@ public enum Stat
|
||||
// Vitality
|
||||
VITALITY_CONSUME_RATE("vitalityConsumeRate"),
|
||||
VITALITY_EXP_RATE("vitalityExpRate"),
|
||||
VITALITY_SKILLS("vitalitySkills"), // Used to count vitality skill bonuses.
|
||||
|
||||
// Souls
|
||||
MAX_SOULS("maxSouls"),
|
||||
|
@@ -19,12 +19,14 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.enums.BonusExpType;
|
||||
import org.l2jmobius.gameserver.enums.SkillFinishType;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExUserBoostStat;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
@@ -78,6 +80,8 @@ public class RequestDispel implements IClientIncomingPacket
|
||||
if (player.getObjectId() == _objectId)
|
||||
{
|
||||
player.stopSkillEffects(SkillFinishType.REMOVED, _skillId);
|
||||
player.sendPacket(new ExUserBoostStat(player, BonusExpType.VITALITY));
|
||||
player.sendPacket(new ExUserBoostStat(player, skill.isActive() ? BonusExpType.BUFFS : BonusExpType.PASSIVE));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.BonusExpType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
@@ -27,10 +28,12 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
public class ExUserBoostStat implements IClientOutgoingPacket
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private final BonusExpType _type;
|
||||
|
||||
public ExUserBoostStat(PlayerInstance player)
|
||||
public ExUserBoostStat(PlayerInstance player, BonusExpType type)
|
||||
{
|
||||
_player = player;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,29 +41,57 @@ public class ExUserBoostStat implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.EX_USER_BOOST_STAT.writeId(packet);
|
||||
|
||||
final int currentVitalityPoints = _player.getStat().getVitalityPoints();
|
||||
int vitalityBonus = 0;
|
||||
if (currentVitalityPoints > 105000)
|
||||
int count = 0;
|
||||
int bonus = 0;
|
||||
switch (_type)
|
||||
{
|
||||
vitalityBonus = 300;
|
||||
}
|
||||
else if (currentVitalityPoints > 70000)
|
||||
{
|
||||
vitalityBonus = 250;
|
||||
}
|
||||
else if (currentVitalityPoints > 35000)
|
||||
{
|
||||
vitalityBonus = 200;
|
||||
}
|
||||
else if (currentVitalityPoints > 0)
|
||||
{
|
||||
vitalityBonus = 150;
|
||||
case VITALITY:
|
||||
{
|
||||
final int currentVitalityPoints = _player.getStat().getVitalityPoints();
|
||||
if (currentVitalityPoints > 105000)
|
||||
{
|
||||
count = 1;
|
||||
bonus = 300;
|
||||
}
|
||||
else if (currentVitalityPoints > 70000)
|
||||
{
|
||||
count = 1;
|
||||
bonus = 250;
|
||||
}
|
||||
else if (currentVitalityPoints > 35000)
|
||||
{
|
||||
count = 1;
|
||||
bonus = 200;
|
||||
}
|
||||
else if (currentVitalityPoints > 0)
|
||||
{
|
||||
count = 1;
|
||||
bonus = 100;
|
||||
}
|
||||
|
||||
if (bonus > 0)
|
||||
{
|
||||
count += (int) _player.getStat().getValue(Stat.VITALITY_SKILLS, 0);
|
||||
bonus += (int) ((_player.getStat().getMul(Stat.VITALITY_EXP_RATE, 1) - 1) * 100);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BUFFS:
|
||||
{
|
||||
count = (int) _player.getStat().getValue(Stat.BONUS_EXP_BUFFS, 0);
|
||||
bonus = (int) _player.getStat().getValue(Stat.ACTIVE_BONUS_EXP, 0);
|
||||
break;
|
||||
}
|
||||
case PASSIVE:
|
||||
{
|
||||
count = (int) _player.getStat().getValue(Stat.BONUS_EXP_PASSIVES, 0);
|
||||
bonus = (int) (_player.getStat().getValue(Stat.BONUS_EXP, 0) - _player.getStat().getValue(Stat.ACTIVE_BONUS_EXP, 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// final int bonus = (int) (_player.getStat().getExpBonusMultiplier() * 100);
|
||||
final int bonus = (int) (_player.getStat().getValue(Stat.BONUS_EXP, 0) + vitalityBonus);
|
||||
packet.writeC(bonus > 0 ? 2 : 0);
|
||||
packet.writeC(bonus > 0 ? 2 : 0);
|
||||
packet.writeC(_type.getId());
|
||||
packet.writeC(count);
|
||||
packet.writeH(bonus);
|
||||
|
||||
return true;
|
||||
|
@@ -20,6 +20,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.enums.BonusExpType;
|
||||
import org.l2jmobius.gameserver.enums.ClassId;
|
||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@@ -460,7 +461,9 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
// Send exp bonus change.
|
||||
if (containsMask(UserInfoType.VITA_FAME))
|
||||
{
|
||||
_player.sendPacket(new ExUserBoostStat(_player));
|
||||
_player.sendPacket(new ExUserBoostStat(_player, BonusExpType.VITALITY));
|
||||
_player.sendPacket(new ExUserBoostStat(_player, BonusExpType.BUFFS));
|
||||
_player.sendPacket(new ExUserBoostStat(_player, BonusExpType.PASSIVE));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user