diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini index 627d533919..5958c8a528 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini @@ -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 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini index 7f150eeac6..001f2cf624 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini @@ -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. diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/LCoinShop.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/LCoinShop.xml index 28097d2027..4c36cf92ed 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/LCoinShop.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/LCoinShop.xml @@ -90,20 +90,20 @@ - + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/events/DailyTasks.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/events/DailyTasks.xml index 506b90a11f..8841899bf0 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/events/DailyTasks.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/events/DailyTasks.xml @@ -22,19 +22,6 @@ - - - - - - - \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java index 7f890a9280..038f25abd8 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -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); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/SkillConditionMasterHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/SkillConditionMasterHandler.java index 282e06b966..144a8b4a3b 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/SkillConditionMasterHandler.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/SkillConditionMasterHandler.java @@ -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); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SayhaGraceSupport.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SayhaGraceSupport.java new file mode 100644 index 0000000000..87e97c9c1e --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SayhaGraceSupport.java @@ -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 . + */ +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)); + } + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/VitalityPointUp.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/VitalityPointUp.java index 27959fe527..30109f1b2b 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/VitalityPointUp.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/VitalityPointUp.java @@ -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); } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/CanUseVitalityIncreaseItemSkillCondition.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/CanUseVitalityIncreaseItemSkillCondition.java new file mode 100644 index 0000000000..53532fc6ce --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/CanUseVitalityIncreaseItemSkillCondition.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/CanUseVitalityConsumeItemSkillCondition.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/HasVitalityPointsSkillCondition.java similarity index 73% rename from L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/CanUseVitalityConsumeItemSkillCondition.java rename to L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/HasVitalityPointsSkillCondition.java index 62cd6cf2dd..5123d0be71 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/CanUseVitalityConsumeItemSkillCondition.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/HasVitalityPointsSkillCondition.java @@ -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; } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91600-91699.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91600-91699.xml index ae077815c6..c37b4aebb7 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91600-91699.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91600-91699.xml @@ -404,13 +404,18 @@ - + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91700-91799.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91700-91799.xml index 1bd1f78e52..b41e408577 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91700-91799.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91700-91799.xml @@ -117,18 +117,22 @@ - + - + + + + + - + @@ -136,6 +140,11 @@ + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/39100-39199.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/39100-39199.xml index c9dfaf8b9c..e9c010c852 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/39100-39199.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/39100-39199.xml @@ -1878,7 +1878,18 @@ A1 - 600000 + 300 + + + 35000 + + + + + + 35000 + + A1 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/51400-51499.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/51400-51499.xml index ac477d5673..f142bc5daf 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/51400-51499.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/51400-51499.xml @@ -198,18 +198,58 @@ 500 - + icon.bm_sayha_storm - A1 - 4 + A2 60000 + 1200 + 4 + true + BR_EVENT_BUF6 + + + 35000 + + + + + 100 + PER + + + 200 + + + 200 + + - + icon.bm_sayha_storm - A1 - 4 + A2 60000 + 1200 + 4 + true + BR_EVENT_BUF6 + + + 35000 + + + + + 100 + PER + + + 200 + + + 200 + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt index d6b188b270..2bd0856261 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt @@ -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. diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java index 55611ca976..0cf5a24913 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -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); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java index f033cf2f76..3d1883674b 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/DailyTaskManager.java @@ -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> resetRecommends(); resetWorldChatPoints(); resetTrainingCamp(); + resetVitality(); } @ScheduleTarget @@ -82,6 +87,71 @@ public class DailyTaskManager extends AbstractEventManager> } } + 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 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 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 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() { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Attackable.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Attackable.java index f5fda32074..2da4c47b0a 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Attackable.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Attackable.java @@ -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; } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index e74083b34c..04933114b3 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -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++) diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayerStat.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayerStat.java index 97046be370..a9bc280ed9 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayerStat.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayerStat.java @@ -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)); } /* diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/SubClassHolder.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/SubClassHolder.java index 4a4a86b520..ab9d454e4e 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/SubClassHolder.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/SubClassHolder.java @@ -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; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index c8cae327de..dadcce24e0 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -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"; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 34e681ee2f..ee96f20af5 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -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(() -> diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExUserBoostStat.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExUserBoostStat.java index aa025b313f..ae51d12030 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExUserBoostStat.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExUserBoostStat.java @@ -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); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalExInfo.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalExInfo.java new file mode 100644 index 0000000000..2b3b912d99 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalExInfo.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalityPointInfo.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalityPointInfo.java index 3cd9d26602..9a401c2321 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalityPointInfo.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ExVitalityPointInfo.java @@ -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; } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/UserInfo.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/UserInfo.java index 49e3592041..ad2d94aea0 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/UserInfo.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/UserInfo.java @@ -339,7 +339,7 @@ public class UserInfo extends AbstractMaskPacket 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 if (containsMask(UserInfoType.VITA_FAME)) { _player.sendPacket(new ExUserBoostStat(_player)); + if (Config.ENABLE_VITALITY) + { + _player.sendPacket(new ExVitalityEffectInfo(_player)); + } } return true;