Support for Vanguard Beast Points.

This commit is contained in:
MobiusDevelopment 2022-04-22 21:04:40 +00:00
parent 28f5e93ac2
commit 328d32d750
16 changed files with 202 additions and 13 deletions

View File

@ -3992,7 +3992,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
target.setCurrentCp(0);
}
if (player.isDeathKnight())
if (player.isDeathKnight() && (target.isAttackable() || target.isPlayable()))
{
player.setDeathPoints(player.getDeathPoints() + 1);
}

View File

@ -3999,7 +3999,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
target.setCurrentCp(0);
}
if (player.isDeathKnight())
if (player.isDeathKnight() && (target.isAttackable() || target.isPlayable()))
{
player.setDeathPoints(player.getDeathPoints() + 1);
}

View File

@ -3999,7 +3999,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
target.setCurrentCp(0);
}
if (player.isDeathKnight())
if (player.isDeathKnight() && (target.isAttackable() || target.isPlayable()))
{
player.setDeathPoints(player.getDeathPoints() + 1);
}

View File

@ -233,6 +233,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("MaxHp", MaxHp::new);
EffectHandler.getInstance().registerHandler("MaxMagicCriticalRate", MaxMagicCriticalRate::new);
EffectHandler.getInstance().registerHandler("MaxMp", MaxMp::new);
EffectHandler.getInstance().registerHandler("ModifyBeastPoints", ModifyBeastPoints::new);
EffectHandler.getInstance().registerHandler("ModifyCraftPoints", ModifyCraftPoints::new);
EffectHandler.getInstance().registerHandler("ModifyDeathPoints", ModifyDeathPoints::new);
EffectHandler.getInstance().registerHandler("ModifyMagicLampPoints", ModifyMagicLampPoints::new);

View File

@ -27,6 +27,7 @@ public class SkillConditionMasterHandler
{
public static void main(String[] args)
{
SkillConditionHandler.getInstance().registerHandler("BeastPoints", BeastPointsSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("BuildAdvanceBase", BuildAdvanceBaseSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("BuildCamp", BuildCampSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CanAddMaxEntranceInzone", CanAddMaxEntranceInzoneSkillCondition::new);

View File

@ -434,6 +434,17 @@ public class AdminEditChar implements IAdminCommandHandler
{
player.getAppearance().setMale();
player.disarmShield();
if (!player.isVanguard())
{
player.setVanguard(true);
}
}
else
{
if (player.isVanguard())
{
player.setVanguard(false);
}
}
final String newclass = ClassListData.getInstance().getClass(player.getClassId()).getClassName();

View File

@ -0,0 +1,60 @@
/*
* 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 org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.skill.Skill;
/**
* @author Mobius
*/
public class ModifyBeastPoints extends AbstractEffect
{
private final int _amount;
public ModifyBeastPoints(StatSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, Item item)
{
if (effected == null)
{
return;
}
final Player player = effected.getActingPlayer();
if (player == null)
{
return;
}
player.setBeastPoints(player.getBeastPoints() + _amount);
}
}

View File

@ -0,0 +1,42 @@
/*
* 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.skillconditionhandlers;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.skill.ISkillCondition;
import org.l2jmobius.gameserver.model.skill.Skill;
/**
* @author Mobius
*/
public class BeastPointsSkillCondition implements ISkillCondition
{
private final int _amount;
public BeastPointsSkillCondition(StatSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
return caster.getActingPlayer().getBeastPoints() >= _amount;
}
}

View File

@ -17,8 +17,6 @@
package quests.Q10950_FiercestFlame;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.CategoryData;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.Race;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
@ -235,7 +233,7 @@ public class Q10950_FiercestFlame extends Quest
return;
}
if ((player.getRace() != Race.ORC) || CategoryData.getInstance().isInCategory(CategoryType.VANGUARD_ALL_CLASS, player.getClassId().getId()))
if ((player.getRace() != Race.ORC) || player.isVanguard())
{
return;
}

View File

@ -17,8 +17,6 @@
package quests.Q10951_NewFlameOfOrcs;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.CategoryData;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
@ -145,7 +143,7 @@ public class Q10951_NewFlameOfOrcs extends Quest
@Override
public String onTalk(Npc npc, Player player)
{
if (!CategoryData.getInstance().isInCategory(CategoryType.VANGUARD_ALL_CLASS, player.getClassId().getId()))
if (!player.isVanguard())
{
return "no_race.html";
}
@ -234,7 +232,7 @@ public class Q10951_NewFlameOfOrcs extends Quest
return;
}
if (!CategoryData.getInstance().isInCategory(CategoryType.VANGUARD_ALL_CLASS, player.getClassId().getId()))
if (!player.isVanguard())
{
return;
}

View File

@ -203,6 +203,7 @@ MaxCp: Max. CP stat.
MaxHp: Max. HP stat.
MaxMagicCriticalRate: Stat that overrides the default config MAX_MCRIT_RATE. (l2jmobius)
MaxMp: Max. MP stat.
ModifyBeastPoints: Modifies player Beast Point count. (l2jmobius)
ModifyCraftPoints: Modifies player Craft Point count. (l2jmobius)
ModifyDeathPoints: Modifies player Death Point count. (l2jmobius)
ModifyMagicLampPoints: Modifies player MagicLamp point count. (l2jmobius)

View File

@ -55,7 +55,10 @@ public enum StatusUpdateType
MAX_CP(0x22, Creature::getMaxCp),
CUR_DP(0x28, creature -> creature.isPlayer() ? creature.getActingPlayer().getDeathPoints() : 0),
MAX_DP(0x29, creature -> creature.isPlayer() ? creature.getActingPlayer().getMaxDeathPoints() : 0);
MAX_DP(0x29, creature -> creature.isPlayer() ? creature.getActingPlayer().getMaxDeathPoints() : 0),
CUR_BP(0x2B, creature -> creature.isPlayer() ? creature.getActingPlayer().getBeastPoints() : 0),
MAX_BP(0x2C, creature -> creature.isPlayer() ? creature.getActingPlayer().getMaxBeastPoints() : 0);
private int _clientId;
private Function<Creature, Integer> _valueSupplier;

View File

@ -4001,7 +4001,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (player.isDeathKnight())
{
player.setDeathPoints(player.getDeathPoints() + 1);
if (target.isAttackable() || target.isPlayable())
{
player.setDeathPoints(player.getDeathPoints() + 1);
}
}
else if (player.isVanguard())
{
if (target.isAttackable() || target.isPlayable())
{
player.setBeastPoints(player.getBeastPoints() + 1);
}
}
}
}

View File

@ -502,6 +502,7 @@ public class Player extends Playable
protected int _activeClass;
protected int _classIndex = 0;
private boolean _isDeathKnight = false;
private boolean _isVanguard = false;
/** data for mounted pets */
private int _controlItemId;
@ -748,6 +749,10 @@ public class Player extends Playable
private int _deathPoints = 0;
private int _maxDeathPoints = 0;
// Beast points
private int _beastPoints = 0;
private int _maxBeastPoints = 0;
// WorldPosition used by TARGET_SIGNET_GROUND
private Location _currentSkillWorldPosition;
@ -6814,6 +6819,10 @@ public class Player extends Playable
{
player._isDeathKnight = true;
}
else if (CategoryData.getInstance().isInCategory(CategoryType.VANGUARD_ALL_CLASS, player.getBaseTemplate().getClassId().getId()))
{
player._isVanguard = true;
}
player.setApprentice(rset.getInt("apprentice"));
player.setSponsor(rset.getInt("sponsor"));
@ -8835,6 +8844,19 @@ public class Player extends Playable
_isDeathKnight = value;
}
/**
* @return True if the Player is a Vanguard.
*/
public boolean isVanguard()
{
return _isVanguard;
}
public void setVanguard(boolean value)
{
_isVanguard = value;
}
public boolean isMounted()
{
return _mountType != MountType.NONE;
@ -11187,6 +11209,12 @@ public class Player extends Playable
getVariables().set(PlayerVariables.DEATH_POINT_COUNT, _deathPoints);
}
// Store beast points.
if (_isVanguard)
{
getVariables().set(PlayerVariables.BEAST_POINT_COUNT, _beastPoints);
}
// Make sure player variables are stored.
getVariables().storeMe();
@ -11879,6 +11907,31 @@ public class Player extends Playable
sendPacket(su);
}
public int getBeastPoints()
{
return _beastPoints;
}
public int getMaxBeastPoints()
{
return _maxBeastPoints;
}
public void setBeastPoints(int value)
{
// TODO: Implement?
_maxBeastPoints = 500;
// Set current points.
_beastPoints = Math.min(_maxBeastPoints, Math.max(0, value));
// Send StatusUpdate.
final StatusUpdate su = new StatusUpdate(this);
computeStatusUpdate(su, StatusUpdateType.MAX_BP);
computeStatusUpdate(su, StatusUpdateType.CUR_BP);
sendPacket(su);
}
@Override
public Player getActingPlayer()
{
@ -14375,10 +14428,14 @@ public class Player extends Playable
addStatusUpdateValue(StatusUpdateType.LEVEL);
addStatusUpdateValue(StatusUpdateType.MAX_CP);
addStatusUpdateValue(StatusUpdateType.CUR_CP);
if (isDeathKnight())
if (_isDeathKnight)
{
addStatusUpdateValue(StatusUpdateType.CUR_DP);
}
else if (_isVanguard)
{
addStatusUpdateValue(StatusUpdateType.CUR_BP);
}
}
public TrainingHolder getTraingCampInfo()

View File

@ -67,6 +67,7 @@ public class PlayerVariables extends AbstractVariables
public static final String MAGIC_LAMP_EXP = "MAGIC_LAMP_EXP";
public static final String MAGIC_LAMP_COUNT = "MAGIC_LAMP_COUNT";
public static final String DEATH_POINT_COUNT = "DEATH_POINT_COUNT";
public static final String BEAST_POINT_COUNT = "BEAST_POINT_COUNT";
public static final String FAVORITE_TELEPORTS = "FAVORITE_TELEPORTS";
public static final String ELIXIRS_AVAILABLE = "ELIXIRS_AVAILABLE";
public static final String ELIXIRS_USED = "ELIXIRS_USED";

View File

@ -651,6 +651,12 @@ public class EnterWorld implements IClientIncomingPacket
player.setDeathPoints(500);
player.setDeathPoints(player.getVariables().getInt(PlayerVariables.DEATH_POINT_COUNT, 0));
}
// Vanguard beast points init.
else if (player.isVanguard())
{
player.setBeastPoints(500);
player.setBeastPoints(player.getVariables().getInt(PlayerVariables.BEAST_POINT_COUNT, 0));
}
// Sayha's Grace.
if (Config.ENABLE_VITALITY)