Addition of Sayha's Grace.

Contributed by Mode.
This commit is contained in:
MobiusDevelopment 2020-12-20 23:17:20 +00:00
parent b1afeec428
commit 17ff75bfc0
27 changed files with 434 additions and 79 deletions

View File

@ -197,14 +197,14 @@ RestorePetOnReconnect = True
# ---------------------------------------------------------------------------
# Enables vitality system
# Default: False
EnableVitality = False
# Default: True
EnableVitality = True
# Option to set a lower vitality at character creation.
# Vitality needs to be enabled, and startingpoints needs to be lower
# than max-vitality points.
# Default: 140000
StartingVitalityPoints = 0
# Default: 35000
StartingVitalityPoints = 35000
# Calculate vitality bonus for raidboss kills.
# Default: False

View File

@ -149,14 +149,15 @@ DropItemMinLevelGapChance = 10
# ---------------------------------------------------------------------------
# The following configures the XP multiplier of each vitality level. Basically, you have
# Default: 2
# Default: 3
# Take care setting these values according to your server rates, as the can lead to huge differences!
# Example with a server rate 15x and vitality = 2. => final server rate = 30 (15x2)!
RateVitalityExpMultiplier = 2.
RateVitalityExpMultiplier = 3
RateLimitedSayhaGraceExpMultiplier = 2
# Maximum vitality items allowed to be used for a week by a player.
# Default: 999
VitalityMaxItemsAllowed = 999
# Default: 0 - unlimited
VitalityMaxItemsAllowed = 0
# These options are to be used if you want to increase the vitality gain/lost for each mob you kills
# Default values are 1.

View File

@ -90,20 +90,20 @@
<ingredient id="91663" count="50" /> <!-- L-Coin -->
<production id="952" /> <!-- Scroll: Enchant C-grade Armor (Exchangeable) -->
</product>
<!--
<product id="8" category="2">
<ingredient id="91663" count="120" /> L-Coin
<production id="71900" /> Limited Sayha's Blessing (1 Day)
<ingredient id="91663" count="120" /> <!-- L-Coin -->
<production id="71900" /> <!-- Limited Sayha's Blessing (1 Day) -->
</product>
<!--
<product id="9" category="2">
<ingredient id="91663" count="2000" /> L-Coin
<production id="71899" /> Limited Sayha's Blessing (30 Day)
</product>
<product id="11" category="2">
<ingredient id="91663" count="20" /> L-Coin
<production id="91641" /> Sayha's Blessing
</product>
-->
<product id="11" category="2">
<ingredient id="91663" count="20" /> <!-- L-Coin -->
<production id="91641" /> <!-- Sayha's Blessing -->
</product>
<product id="12" category="2">
<ingredient id="91663" count="6" /> <!-- L-Coin -->
<production id="90907" /> <!-- Soulshot Ticket -->

View File

@ -22,19 +22,6 @@
<schedule name="clanLeaderApply" hour="06" minute="30" dayOfWeek="3">
<event name="#onClanLeaderApply" />
</schedule>
<!-- Schedule the vitality reset task every WEDNESDAY at 6:30 -->
<!-- <schedule name="vitalityReset" hour="06" minute="30" dayOfWeek="3">
<event name="#onVitalityReset" />
</schedule> -->
<!-- Attach condition to reset if server boots up in after 6:30 and hasn't reset yet -->
<!-- <conditionalSchedule>
<run name="reset" if="HASNT_RUN" />
<run name="clanLeaderApply" if="HASNT_RUN" />
<run name="vitalityReset" if="HASNT_RUN" />
</conditionalSchedule> -->
</scheduler>
</event>
</list>

View File

@ -306,6 +306,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("Root", Root::new);
EffectHandler.getInstance().registerHandler("SacrificeSummon", SacrificeSummon::new);
EffectHandler.getInstance().registerHandler("SafeFallHeight", SafeFallHeight::new);
EffectHandler.getInstance().registerHandler("SayhaGraceSupport", SayhaGraceSupport::new);
EffectHandler.getInstance().registerHandler("SendSystemMessageToClan", SendSystemMessageToClan::new);
EffectHandler.getInstance().registerHandler("ServitorShare", ServitorShare::new);
EffectHandler.getInstance().registerHandler("SetHp", SetHp::new);

View File

@ -48,7 +48,8 @@ public class SkillConditionMasterHandler
SkillConditionHandler.getInstance().registerHandler("CanUseInBattlefield", CanUseInBattlefieldSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CanUseInDragonLair", CanUseInDragonLairSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CanUseSwoopCannon", CanUseSwoopCannonSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CanUseVitalityConsumeItem", CanUseVitalityConsumeItemSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("HasVitalityPoints", HasVitalityPointsSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CanUseVitalityIncreaseItem", CanUseVitalityIncreaseItemSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CheckLevel", CheckLevelSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("CheckSex", CheckSexSkillCondition::new);
SkillConditionHandler.getInstance().registerHandler("ConsumeBody", ConsumeBodySkillCondition::new);

View File

@ -0,0 +1,70 @@
/*
* 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.commons.util.Rnd;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Mode
*/
public class SayhaGraceSupport extends AbstractEffect
{
public SayhaGraceSupport(StatSet params)
{
}
@Override
public boolean canStart(Creature effector, Creature effected, Skill skill)
{
return (effected != null) && effected.isPlayer();
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
final PlayerInstance player = effected.getActingPlayer();
final double rnd = Rnd.nextDouble() * 100;
if (rnd <= 0.1) // 4h
{
player.setSayhaGraceSupportEndTime(System.currentTimeMillis() + (3600000 * 4));
}
else if (rnd <= 0.3) // 3h
{
player.setSayhaGraceSupportEndTime(System.currentTimeMillis() + (3600000 * 3));
}
else if (rnd <= 0.6) // 2h
{
player.setSayhaGraceSupportEndTime(System.currentTimeMillis() + (3600000 * 2));
}
else if (rnd <= 1.1) // 1h
{
player.setSayhaGraceSupportEndTime(System.currentTimeMillis() + (3600000 * 1));
}
}
}

View File

@ -16,6 +16,7 @@
*/
package handlers.effecthandlers;
import org.l2jmobius.gameserver.enums.UserInfoType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
@ -52,6 +53,8 @@ public class VitalityPointUp extends AbstractEffect
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
effected.getActingPlayer().updateVitalityPoints(_value, false, false);
effected.getActingPlayer().sendPacket(new UserInfo(effected.getActingPlayer()));
final UserInfo ui = new UserInfo(effected.getActingPlayer());
ui.addComponentType(UserInfoType.VITA_FAME);
effected.getActingPlayer().sendPacket(ui);
}
}

View File

@ -0,0 +1,52 @@
/*
* 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.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
import org.l2jmobius.gameserver.model.skills.ISkillCondition;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Mode
*/
public class CanUseVitalityIncreaseItemSkillCondition implements ISkillCondition
{
private final int _amount;
public CanUseVitalityIncreaseItemSkillCondition(StatSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
if (caster.isPlayer())
{
PlayerInstance player = caster.getActingPlayer();
if ((player.getVitalityPoints() + _amount) <= PlayerStat.MAX_VITALITY_POINTS)
{
return true;
}
}
return false;
}
}

View File

@ -22,15 +22,28 @@ import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.skills.ISkillCondition;
import org.l2jmobius.gameserver.model.skills.Skill;
public class CanUseVitalityConsumeItemSkillCondition implements ISkillCondition
/**
* @author Mode
*/
public class HasVitalityPointsSkillCondition implements ISkillCondition
{
public CanUseVitalityConsumeItemSkillCondition(StatSet params)
private final int _amount;
public HasVitalityPointsSkillCondition(StatSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
return true;
if (caster.isPlayer())
{
if (caster.getActingPlayer().getVitalityPoints() >= _amount)
{
return true;
}
}
return false;
}
}

View File

@ -404,13 +404,18 @@
<item id="91641" name="Sayha's Blessing" additionalName="Event" type="EtcItem">
<!-- Sayha's Grace points +35,000. -->
<set name="icon" val="icon.etc_wind_potion_i00" />
<set name="default_action" val="SKILL_REDUCE_ON_SKILL_SUCCESS" />
<set name="default_action" val="SKILL_REDUCE" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_depositable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="ItemSkills" />
<set name="immediate_effect" val="true" />
<skills>
<skill id="39191" level="1" /> <!-- Sayha's Blessing -->
</skills>
</item>
<item id="91642" name="15th Anniversary Gift Box" type="EtcItem">
<!-- Double-click to obtain one of the following items: Manuscript Chest, Dragon Dye Box, Spirit Transformation Scroll - Singer, Transformation Scroll: White Assassin, Rice Cake of Fighting Spirit. -->

View File

@ -117,18 +117,22 @@
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
</item>
<item id="91712" name="Sayha's Storm Lv. 3" additionalName="Event" type="EtcItem">
<item id="91712" name="Sayha's Storm Lv. 3" type="EtcItem">
<!-- Sayha's Grace points +100%, Acquired XP/ SP +200%. The effect remains after death. Duration: 20 min. Cooldown: 1 min. Available if Sayha's Grace point bar is filled by more than one unit. -->
<set name="icon" val="icon.bm_sayha_storm" />
<set name="default_action" val="SKILL_REDUCE" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_depositable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="ItemSkills" />
<set name="immediate_effect" val="true" />
<skills>
<skill id="51436" level="1" /> <!-- Sayha's Storm Lv. 3 -->
</skills>
</item>
<item id="91713" name="Sayha's Storm Lv. 3" type="EtcItem">
<item id="91713" name="Sayha's Storm Lv. 3 (Exchangeable)" type="EtcItem">
<!-- Sayha's Grace points +100%, Acquired XP/ SP +200%. The effect remains after death. Duration: 20 min. Cooldown: 1 min. Available if Sayha's Grace point bar is filled by more than one unit. -->
<set name="icon" val="icon.bm_sayha_storm" />
<set name="default_action" val="SKILL_REDUCE" />
@ -136,6 +140,11 @@
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="ItemSkills" />
<set name="immediate_effect" val="true" />
<skills>
<skill id="51437" level="1" /> <!-- Sayha's Storm Lv. 3 (Exchangeable) -->
</skills>
</item>
<item id="91714" name="Sayha's Summoning Stick" type="EtcItem">
<!-- Randomly summons 1 of the 6 monsters. The killer of that monster receives a certain amount of XP that is not affected by any bonus XP effects. Cooldown: 10 sec. -->

View File

@ -1878,7 +1878,18 @@
</skill>
<skill id="39191" toLevel="1" name="Sayha's Blessing">
<operateType>A1</operateType>
<reuseDelay>600000</reuseDelay>
<reuseDelay>300</reuseDelay>
<conditions>
<condition name="CanUseVitalityIncreaseItem">
<amount>35000</amount>
</condition>
</conditions>
<effects>
<effect name="SayhaGraceSupport" />
<effect name="VitalityPointUp">
<value>35000</value>
</effect>
</effects>
</skill>
<skill id="39192" toLevel="1" name="Sayha's Silver Light Blessing">
<operateType>A1</operateType>

View File

@ -198,18 +198,58 @@
<coolTime>500</coolTime>
</skill>
<skill id="51436" toLevel="1" name="Sayha's Storm Lv. 3">
<!-- For 20 min., Momentum Consumption +100%, Acquired XP/ SP +200%. Cooldown: 1 min. The effect remains after death. -->
<!-- For 20 min., Sayha's Grace Consumption +100%%, acquired XP/ SP +200%%. Cooldown: 1 min.\nThe effect remains after death. You can cancel the effect by yourself. -->
<icon>icon.bm_sayha_storm</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<operateType>A2</operateType>
<reuseDelay>60000</reuseDelay>
<abnormalTime>1200</abnormalTime>
<isMagic>4</isMagic>
<stayAfterDeath>true</stayAfterDeath>
<abnormalType>BR_EVENT_BUF6</abnormalType>
<conditions>
<condition name="HasVitalityPoints">
<amount>35000</amount>
</condition>
</conditions>
<effects>
<effect name="SayhaGracePointsRate">
<amount>100</amount>
<mode>PER</mode>
</effect>
<effect name="ExpModify">
<amount>200</amount>
</effect>
<effect name="SpModify">
<amount>200</amount>
</effect>
</effects>
</skill>
<skill id="51437" toLevel="1" name="Sayha's Storm Lv. 3 (Exchangeable)">
<!-- For 20 min., Momentum Consumption +100%, Acquired XP/ SP +200%. Cooldown: 1 min. The effect remains after death. -->
<!-- For 20 min., Sayha's Grace Consumption +100%%, acquired XP/ SP +200%%. Cooldown: 1 min.\nThe effect remains after death. You can cancel the effect by yourself. -->
<icon>icon.bm_sayha_storm</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<operateType>A2</operateType>
<reuseDelay>60000</reuseDelay>
<abnormalTime>1200</abnormalTime>
<isMagic>4</isMagic>
<stayAfterDeath>true</stayAfterDeath>
<abnormalType>BR_EVENT_BUF6</abnormalType>
<conditions>
<condition name="HasVitalityPoints">
<amount>35000</amount>
</condition>
</conditions>
<effects>
<effect name="SayhaGracePointsRate">
<amount>100</amount>
<mode>PER</mode>
</effect>
<effect name="ExpModify">
<amount>200</amount>
</effect>
<effect name="SpModify">
<amount>200</amount>
</effect>
</effects>
</skill>
<skill id="51438" toLevel="1" name="Sayha's Summoning Stick">
<!-- Use it to summon various monsters. -->

View File

@ -275,6 +275,7 @@ ReuseSkillById: Resets reuse time for the skill with the specific id. (l2jmobius
Root: Stops movement.
SacrificeSummon: Sacrifices the players summon. (l2jmobius)
SafeFallHeight: Minimum falling height for taking damage stat.
SayhaGraceSupport: Set Sayha Grace support end time. (l2jmobius)
SendSystemMessageToClan: Sends the specified SystemMessageId to the clan.
ServitorShare: Servitor share effect.
SetHp: Sets current HP to the given amount.

View File

@ -792,6 +792,7 @@ public class Config
public static int STARTING_VITALITY_POINTS;
public static boolean RAIDBOSS_USE_VITALITY;
public static float RATE_VITALITY_EXP_MULTIPLIER;
public static float RATE_LIMITED_SAYHA_GRACE_EXP_MULTIPLIER;
public static int VITALITY_MAX_ITEMS_ALLOWED;
public static float RATE_VITALITY_LOST;
public static float RATE_VITALITY_GAIN;
@ -2157,8 +2158,13 @@ public class Config
RATE_QUEST_REWARD_RECIPE = RatesSettings.getFloat("RateQuestRewardRecipe", 1);
RATE_QUEST_REWARD_MATERIAL = RatesSettings.getFloat("RateQuestRewardMaterial", 1);
RATE_RAIDBOSS_POINTS = RatesSettings.getFloat("RateRaidbossPointsReward", 1);
RATE_VITALITY_EXP_MULTIPLIER = RatesSettings.getFloat("RateVitalityExpMultiplier", 2);
RATE_VITALITY_EXP_MULTIPLIER = RatesSettings.getFloat("RateVitalityExpMultiplier", 3);
RATE_LIMITED_SAYHA_GRACE_EXP_MULTIPLIER = RatesSettings.getFloat("RateLimitedSayhaGraceExpMultiplier", 2);
VITALITY_MAX_ITEMS_ALLOWED = RatesSettings.getInt("VitalityMaxItemsAllowed", 999);
if (VITALITY_MAX_ITEMS_ALLOWED == 0)
{
VITALITY_MAX_ITEMS_ALLOWED = Integer.MAX_VALUE;
}
RATE_VITALITY_LOST = RatesSettings.getFloat("RateVitalityLost", 1);
RATE_VITALITY_GAIN = RatesSettings.getFloat("RateVitalityGain", 1);
RATE_KARMA_LOST = RatesSettings.getFloat("RateKarmaLost", -1);

View File

@ -18,8 +18,12 @@ package org.l2jmobius.gameserver.instancemanager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -68,6 +72,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
resetRecommends();
resetWorldChatPoints();
resetTrainingCamp();
resetVitality();
}
@ScheduleTarget
@ -82,6 +87,71 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
}
}
private void resetVitality()
{
if (!Config.ENABLE_VITALITY)
{
return;
}
for (PlayerInstance player : World.getInstance().getPlayers())
{
player.updateVitalityPoints(Config.STARTING_VITALITY_POINTS, false, false);
for (SubClassHolder subclass : player.getSubClasses().values())
{
subclass.setVitalityPoints(Math.min(PlayerStat.MAX_VITALITY_POINTS, subclass.getVitalityPoints() + Config.STARTING_VITALITY_POINTS));
}
}
try (Connection con = DatabaseFactory.getConnection())
{
Map<Integer, Integer> currPoints = new HashMap<>();
try (PreparedStatement st = con.prepareStatement("SELECT charId, vitality_points FROM character_subclasses"))
{
ResultSet rs = st.executeQuery();
while (rs.next())
{
currPoints.put(rs.getInt(1), rs.getInt(2));
}
}
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ? WHERE charId = ?"))
{
for (Entry<Integer, Integer> entry : currPoints.entrySet())
{
st.setInt(1, Math.min(PlayerStat.MAX_VITALITY_POINTS, entry.getValue() + Config.STARTING_VITALITY_POINTS));
st.setInt(2, entry.getKey());
st.addBatch();
}
st.executeBatch();
}
currPoints.clear();
try (PreparedStatement st = con.prepareStatement("SELECT charId, vitality_points FROM characters"))
{
ResultSet rs = st.executeQuery();
while (rs.next())
{
currPoints.put(rs.getInt(1), rs.getInt(2));
}
}
try (PreparedStatement st = con.prepareStatement("UPDATE characters SET vitality_points = ? WHERE charId = ?"))
{
for (Entry<Integer, Integer> entry : currPoints.entrySet())
{
st.setInt(1, Math.min(PlayerStat.MAX_VITALITY_POINTS, entry.getValue() + Config.STARTING_VITALITY_POINTS));
st.setInt(2, entry.getKey());
st.addBatch();
}
st.executeBatch();
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Error while updating Vitality", e);
}
LOGGER.info("Vitality resetted");
}
@ScheduleTarget
private void onClanLeaderApply()
{

View File

@ -523,8 +523,14 @@ public class Attackable extends Npc
}
clan.addHuntingPoints(attacker, this, finalExp);
}
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
if (useVitalityRate())
{
if (attacker.getSayhaGraceSupportEndTime() < System.currentTimeMillis())
{
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
}
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
}
}
rewardAttributeExp(attacker, damage, totalDamage);
@ -1674,15 +1680,7 @@ public class Attackable extends Npc
return 0;
}
int points;
if (level < 85)
{
points = Math.max((int) ((exp / 1000) * Math.max(level - getLevel(), 1)), 1);
}
else
{
points = Math.max((int) ((exp / (isBoss ? Config.VITALITY_CONSUME_BY_BOSS : Config.VITALITY_CONSUME_BY_MOB)) * Math.max(level - getLevel(), 1)), 1);
}
final int points = Math.max((int) ((exp / (isBoss ? Config.VITALITY_CONSUME_BY_BOSS : Config.VITALITY_CONSUME_BY_MOB)) * Math.max(level - getLevel(), 1)), level < 40 ? 5 : 100);
return -points;
}

View File

@ -306,9 +306,12 @@ import org.l2jmobius.gameserver.network.serverpackets.ExStopScenePlayer;
import org.l2jmobius.gameserver.network.serverpackets.ExStorageMaxCount;
import org.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
import org.l2jmobius.gameserver.network.serverpackets.ExUseSharedGroupItem;
import org.l2jmobius.gameserver.network.serverpackets.ExUserBoostStat;
import org.l2jmobius.gameserver.network.serverpackets.ExUserInfoAbnormalVisualEffect;
import org.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
import org.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
import org.l2jmobius.gameserver.network.serverpackets.ExVitalExInfo;
import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo;
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
import org.l2jmobius.gameserver.network.serverpackets.HennaInfo;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@ -11587,6 +11590,40 @@ public class PlayerInstance extends Playable
getStat().updateVitalityPoints(points, useRates, quiet);
}
public void setSayhaGraceSupportEndTime(long endTime)
{
if (getVariables().getLong(PlayerVariables.SAYHA_GRACE_SUPPORT_ENDTIME, 0) < System.currentTimeMillis())
{
getVariables().set(PlayerVariables.SAYHA_GRACE_SUPPORT_ENDTIME, endTime);
sendPacket(new ExUserBoostStat(this));
sendPacket(new ExVitalityEffectInfo(this));
sendPacket(new ExVitalExInfo(this));
}
}
public long getSayhaGraceSupportEndTime()
{
return getVariables().getLong(PlayerVariables.SAYHA_GRACE_SUPPORT_ENDTIME, 0);
}
public boolean setLimitedSayhaGraceEndTime(long endTime)
{
if (endTime > getVariables().getLong(PlayerVariables.LIMITED_SAYHA_GRACE_ENDTIME, 0))
{
getVariables().set(PlayerVariables.LIMITED_SAYHA_GRACE_ENDTIME, endTime);
sendPacket(new ExUserBoostStat(this));
sendPacket(new ExVitalityEffectInfo(this));
sendPacket(new ExVitalExInfo(this));
return true;
}
return false;
}
public long getLimitedSayhaGraceEndTime()
{
return getVariables().getLong(PlayerVariables.LIMITED_SAYHA_GRACE_ENDTIME, 0);
}
public void checkItemRestriction()
{
for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)

View File

@ -57,7 +57,7 @@ public class PlayerStat extends PlayableStat
private boolean _cloakSlot = false;
private int _vitalityPoints = 0;
public static final int MAX_VITALITY_POINTS = 140000;
public static final int MAX_VITALITY_POINTS = 3500000;
public static final int MIN_VITALITY_POINTS = 0;
private static final int FANCY_FISHING_ROD_SKILL = 21484;
@ -472,7 +472,17 @@ public class PlayerStat extends PlayableStat
public double getVitalityExpBonus()
{
return (getVitalityPoints() > 0) ? getValue(Stat.VITALITY_EXP_RATE, Config.RATE_VITALITY_EXP_MULTIPLIER) : 1.0;
final double bonus = (getVitalityPoints() > 0) ? getValue(Stat.VITALITY_EXP_RATE, Config.RATE_VITALITY_EXP_MULTIPLIER) : 1;
if ((bonus == 1) && (getActiveChar().getLimitedSayhaGraceEndTime() > System.currentTimeMillis()))
{
return getLimitedSayhaGraceExpBonus();
}
return bonus;
}
public double getLimitedSayhaGraceExpBonus()
{
return Config.RATE_LIMITED_SAYHA_GRACE_EXP_MULTIPLIER;
}
public void setVitalityPoints(int value)
@ -483,6 +493,7 @@ public class PlayerStat extends PlayableStat
return;
}
_vitalityPoints = Math.min(Math.max(value, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
getActiveChar().sendPacket(new ExVitalityPointInfo(_vitalityPoints));
}
/*

View File

@ -29,7 +29,7 @@ public class SubClassHolder
{
private static final int MAX_LEVEL = Config.MAX_SUBCLASS_LEVEL < ExperienceData.getInstance().getMaxLevel() ? Config.MAX_SUBCLASS_LEVEL : ExperienceData.getInstance().getMaxLevel() - 1;
private static final int MAX_VITALITY_POINTS = 140000;
private static final int MAX_VITALITY_POINTS = 3500000;
private static final int MIN_VITALITY_POINTS = 0;
private ClassId _class;

View File

@ -63,6 +63,8 @@ public class PlayerVariables extends AbstractVariables
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
public static final String DELUSION_RETURN = "DELUSION_RETURN";
public static final String HUNTING_ZONE_RESET_TIME = "HUNTING_ZONE_RESET_TIME_";
public static final String SAYHA_GRACE_SUPPORT_ENDTIME = "SAYHA_GRACE_SUPPORT_ENDTIME";
public static final String LIMITED_SAYHA_GRACE_ENDTIME = "LIMITED_SAYHA_GRACE_ENDTIME";
public static final String DEATH_POINT_COUNT = "DEATH_POINT_COUNT";
public static final String STAT_POINTS = "STAT_POINTS";
public static final String STAT_STR = "STAT_STR";

View File

@ -315,11 +315,6 @@ public class EnterWorld implements IClientIncomingPacket
showClanNotice = clan.isNoticeEnabled();
}
if (Config.ENABLE_VITALITY)
{
player.sendPacket(new ExVitalityEffectInfo(player));
}
// Send time.
player.sendPacket(new ExEnterWorld());
@ -656,6 +651,12 @@ public class EnterWorld implements IClientIncomingPacket
player.setDeathPoints(player.getVariables().getInt(PlayerVariables.DEATH_POINT_COUNT, 0));
}
// Sayha's Grace.
if (Config.ENABLE_VITALITY)
{
player.sendPacket(new ExVitalityEffectInfo(player));
}
if (Config.ENABLE_ATTENDANCE_REWARDS)
{
ThreadPool.schedule(() ->

View File

@ -40,22 +40,10 @@ public class ExUserBoostStat implements IClientOutgoingPacket
final int currentVitalityPoints = _player.getStat().getVitalityPoints();
int vitalityBonus = 0;
if (currentVitalityPoints > 105000)
if (currentVitalityPoints > 0)
{
vitalityBonus = 300;
}
else if (currentVitalityPoints > 70000)
{
vitalityBonus = 250;
}
else if (currentVitalityPoints > 35000)
{
vitalityBonus = 200;
}
else if (currentVitalityPoints > 0)
{
vitalityBonus = 150;
}
// final int bonus = (int) (_player.getStat().getExpBonusMultiplier() * 100);
final int bonus = (int) (_player.getStat().getValue(Stat.BONUS_EXP, 0) + vitalityBonus);

View File

@ -0,0 +1,45 @@
/*
* 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.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author Mode
*/
public class ExVitalExInfo implements IClientOutgoingPacket
{
private final PlayerInstance _player;
public ExVitalExInfo(PlayerInstance player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_VITAL_EX_INFO.writeId(packet);
packet.writeD((int) (_player.getLimitedSayhaGraceEndTime() / 1000)); // currentmilis / 1000, when limited sayha ends
packet.writeD((int) (_player.getSayhaGraceSupportEndTime() / 1000)); // currentmilis / 1000, when sayha grace suport ends
packet.writeD((int) (_player.getStat().getLimitedSayhaGraceExpBonus() * 100)); // Limited sayha bonus
packet.writeD(0x82); // Limited sayha bonus adena (shown as 130%, actually 30%)
return true;
}
}

View File

@ -35,7 +35,6 @@ public class ExVitalityPointInfo implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_VITALITY_POINT_INFO.writeId(packet);
packet.writeD(_vitalityPoints);
return true;
}

View File

@ -339,7 +339,7 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
if (containsMask(UserInfoType.VITA_FAME))
{
packet.writeH(19); // 196
packet.writeD(0x00); // _player.getVitalityPoints()
packet.writeD(_player.getVitalityPoints());
packet.writeC(0x00); // Vita Bonus
packet.writeD(0x00); // _player.getFame()
packet.writeD(0x00); // _player.getRaidbossPoints()
@ -459,6 +459,10 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
if (containsMask(UserInfoType.VITA_FAME))
{
_player.sendPacket(new ExUserBoostStat(_player));
if (Config.ENABLE_VITALITY)
{
_player.sendPacket(new ExVitalityEffectInfo(_player));
}
}
return true;