diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Feature.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java index 3d131aa9d8..d05c2df9a6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java @@ -391,6 +391,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1474,6 +1488,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 2370050564..97798481ba 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Feature.ini b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java index df27361c75..b631692c93 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java @@ -391,6 +391,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1478,6 +1492,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 2370050564..97798481ba 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Feature.ini b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java index df27361c75..b631692c93 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java @@ -391,6 +391,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1478,6 +1492,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 2370050564..97798481ba 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Feature.ini b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java index 89950a21be..07ed6d17c9 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java @@ -391,6 +391,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1478,6 +1492,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 2370050564..97798481ba 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Feature.ini b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java index cd685d27f8..0b0a6bca37 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java @@ -391,6 +391,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1483,6 +1497,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 2370050564..97798481ba 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Feature.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java index 36c4d2a1c2..7b73d9e0af 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java @@ -391,6 +391,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1491,6 +1505,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 59df82911b..2d3f24387b 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/Feature.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/Feature.ini index c960e20411..e1f306d727 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/config/Feature.ini +++ b/L2J_Mobius_Classic_Interlude/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 0 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 0 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 0 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 0 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 0 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 0 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 0 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 0 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 0 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 0 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 0 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 0 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 0 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index 048c8caf2c..a79381b01b 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -393,6 +393,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1492,6 +1506,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 3833ae33cd..d2f4f2ceb7 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel((byte) (level - getLevel())); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + byte newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, (int) newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index 2370050564..97798481ba 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN"; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Feature.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Feature.ini index da06353f67..ff909138d0 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Feature.ini +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Feature.ini @@ -163,12 +163,54 @@ FestivalOfDarknessWin = 200 # Reputation score gained for per hero clan members. HeroPoints = 1000 -# Minimum Reputation score gained after completing 2nd class transfer under Academy. +# Minimum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMinPoints = 190 -# Maximum Reputation score gained after completing 2nd class transfer under Academy. +# Maximum Reputation score gained after completing 2nd class transfer under Academy - not used in classic. CompleteAcademyMaxPoints = 650 +# Reputation score gained after level obtained (20-25) +LevelUp20And25ReputationScore = 4 + +# Reputation score gained after level obtained (26-30) +LevelUp26And30ReputationScore = 8 + +# Reputation score gained after level obtained (31-35) +LevelUp31And35ReputationScore = 12 + +# Reputation score gained after level obtained (36-40) +LevelUp36And40ReputationScore = 16 + +# Reputation score gained after level obtained (41-45) +LevelUp41And45ReputationScore = 25 + +# Reputation score gained after level obtained (46-50) +LevelUp46And50ReputationScore = 30 + +# Reputation score gained after level obtained (51-55) +LevelUp51And55ReputationScore = 35 + +# Reputation score gained after level obtained (56-60) +LevelUp56And60ReputationScore = 40 + +# Reputation score gained after level obtained (61-65) +LevelUp61And65ReputationScore = 54 + +# Reputation score gained after level obtained (66-70) +LevelUp66And70ReputationScore = 63 + +# Reputation score gained after level obtained (71-75) +LevelUp71And75ReputationScore = 75 + +# Reputation score gained after level obtained (76-80) +LevelUp76And80ReputationScore = 90 + +# Reputation score gained after level obtained (81+) +LevelUp81PlusReputationScore = 120 + +# Reputation score gained after level obtained multiplier +LevelObtainedReputationScoreMultiplier = 1.0 + # Reputation score gained per killed ballista. KillBallistaPoints = 500 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 df8edf25f2..26c97b88fb 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 @@ -393,6 +393,20 @@ public class Config public static int REPUTATION_SCORE_PER_KILL; public static int JOIN_ACADEMY_MIN_REP_SCORE; public static int JOIN_ACADEMY_MAX_REP_SCORE; + public static int LVL_UP_20_AND_25_REP_SCORE; + public static int LVL_UP_26_AND_30_REP_SCORE; + public static int LVL_UP_31_AND_35_REP_SCORE; + public static int LVL_UP_36_AND_40_REP_SCORE; + public static int LVL_UP_41_AND_45_REP_SCORE; + public static int LVL_UP_46_AND_50_REP_SCORE; + public static int LVL_UP_51_AND_55_REP_SCORE; + public static int LVL_UP_56_AND_60_REP_SCORE; + public static int LVL_UP_61_AND_65_REP_SCORE; + public static int LVL_UP_66_AND_70_REP_SCORE; + public static int LVL_UP_71_AND_75_REP_SCORE; + public static int LVL_UP_76_AND_80_REP_SCORE; + public static int LVL_UP_81_PLUS_REP_SCORE; + public static double LVL_OBTAINED_REP_SCORE_MULTIPLIER; public static int CLAN_LEVEL_6_COST; public static int CLAN_LEVEL_7_COST; public static int CLAN_LEVEL_8_COST; @@ -1506,6 +1520,20 @@ public class Config REPUTATION_SCORE_PER_KILL = Feature.getInt("ReputationScorePerKill", 1); JOIN_ACADEMY_MIN_REP_SCORE = Feature.getInt("CompleteAcademyMinPoints", 190); JOIN_ACADEMY_MAX_REP_SCORE = Feature.getInt("CompleteAcademyMaxPoints", 650); + LVL_UP_20_AND_25_REP_SCORE = Feature.getInt("LevelUp20And25ReputationScore", 4); + LVL_UP_26_AND_30_REP_SCORE = Feature.getInt("LevelUp26And30ReputationScore", 8); + LVL_UP_31_AND_35_REP_SCORE = Feature.getInt("LevelUp31And35ReputationScore", 12); + LVL_UP_36_AND_40_REP_SCORE = Feature.getInt("LevelUp36And40ReputationScore", 16); + LVL_UP_41_AND_45_REP_SCORE = Feature.getInt("LevelUp41And45ReputationScore", 25); + LVL_UP_46_AND_50_REP_SCORE = Feature.getInt("LevelUp46And50ReputationScore", 30); + LVL_UP_51_AND_55_REP_SCORE = Feature.getInt("LevelUp51And55ReputationScore", 35); + LVL_UP_56_AND_60_REP_SCORE = Feature.getInt("LevelUp56And60ReputationScore", 40); + LVL_UP_61_AND_65_REP_SCORE = Feature.getInt("LevelUp61And65ReputationScore", 54); + LVL_UP_66_AND_70_REP_SCORE = Feature.getInt("LevelUp66And70ReputationScore", 63); + LVL_UP_71_AND_75_REP_SCORE = Feature.getInt("LevelUp71And75ReputationScore", 75); + LVL_UP_76_AND_80_REP_SCORE = Feature.getInt("LevelUp76And80ReputationScore", 90); + LVL_UP_81_PLUS_REP_SCORE = Feature.getInt("LevelUp81PlusReputationScore", 120); + LVL_OBTAINED_REP_SCORE_MULTIPLIER = Feature.getDouble("LevelObtainedReputationScoreMultiplier", 1.0d); CLAN_LEVEL_6_COST = Feature.getInt("ClanLevel6Cost", 5000); CLAN_LEVEL_7_COST = Feature.getInt("ClanLevel7Cost", 10000); CLAN_LEVEL_8_COST = Feature.getInt("ClanLevel8Cost", 20000); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java index 16a5e518aa..f86fdf6fc4 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/stat/PlayableStat.java @@ -25,11 +25,16 @@ import org.l2jmobius.gameserver.data.xml.SkillTreeData; import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.returns.TerminateReturn; import org.l2jmobius.gameserver.model.items.Weapon; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ExNewSkillToLearnByLevelUp; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class PlayableStat extends CreatureStat { @@ -84,13 +89,24 @@ public class PlayableStat extends CreatureStat addLevel(level - getLevel()); } - if ((getLevel() > oldLevel) && getActiveChar().isPlayer()) + int newLevel = getLevel(); + if ((newLevel > oldLevel) && getActiveChar().isPlayer()) { final PlayerInstance player = getActiveChar().getActingPlayer(); if (SkillTreeData.getInstance().hasAvailableSkills(player, player.getClassId())) { getActiveChar().sendPacket(ExNewSkillToLearnByLevelUp.STATIC_PACKET); } + + // Check last rewarded level - prevent reputation farming via deleveling + int lastPledgedLevel = player.getVariables().getInt(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, 0); + if (lastPledgedLevel < newLevel) + { + int leveledUpCount = newLevel - lastPledgedLevel; + addReputationToClanBasedOnLevel(player, leveledUpCount); + + player.getVariables().set(PlayerVariables.LAST_PLEDGE_REPUTATION_LEVEL, newLevel); + } } return true; @@ -254,4 +270,95 @@ public class PlayableStat extends CreatureStat final Weapon weapon = getActiveChar().getActiveWeaponItem(); return weapon != null ? weapon.getBaseAttackAngle() : super.getPhysicalAttackAngle(); } + + private void addReputationToClanBasedOnLevel(PlayerInstance player, int leveledUpCount) + { + Clan clan = player.getClan(); + if (clan == null) + { + return; + } + + if (clan.getLevel() < 3) // When a character from clan level 3 or above increases its level, CRP are added + { + return; + } + + int reputation = 0; + for (int i = 0; i < leveledUpCount; i++) + { + int level = player.getLevel() - i; + if ((level >= 20) && (level <= 25)) + { + reputation += Config.LVL_UP_20_AND_25_REP_SCORE; + } + else if ((level >= 26) && (level <= 30)) + { + reputation += Config.LVL_UP_26_AND_30_REP_SCORE; + } + else if ((level >= 31) && (level <= 35)) + { + reputation += Config.LVL_UP_31_AND_35_REP_SCORE; + } + else if ((level >= 36) && (level <= 40)) + { + reputation += Config.LVL_UP_36_AND_40_REP_SCORE; + } + else if ((level >= 41) && (level <= 45)) + { + reputation += Config.LVL_UP_41_AND_45_REP_SCORE; + } + else if ((level >= 46) && (level <= 50)) + { + reputation += Config.LVL_UP_46_AND_50_REP_SCORE; + } + else if ((level >= 51) && (level <= 55)) + { + reputation += Config.LVL_UP_51_AND_55_REP_SCORE; + } + else if ((level >= 56) && (level <= 60)) + { + reputation += Config.LVL_UP_56_AND_60_REP_SCORE; + } + else if ((level >= 61) && (level <= 65)) + { + reputation += Config.LVL_UP_61_AND_65_REP_SCORE; + } + else if ((level >= 66) && (level <= 70)) + { + reputation += Config.LVL_UP_66_AND_70_REP_SCORE; + } + else if ((level >= 71) && (level <= 75)) + { + reputation += Config.LVL_UP_71_AND_75_REP_SCORE; + } + else if ((level >= 76) && (level <= 80)) + { + reputation += Config.LVL_UP_76_AND_80_REP_SCORE; + } + else if ((level >= 81) && (level <= 120)) + { + reputation += Config.LVL_UP_81_PLUS_REP_SCORE; + } + } + + if (reputation == 0) + { + return; + } + + reputation = (int) Math.ceil(reputation * Config.LVL_OBTAINED_REP_SCORE_MULTIPLIER); + + clan.addReputationScore(reputation, true); + + for (ClanMember member : clan.getMembers()) + { + if (member.isOnline()) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION); + sm.addInt(reputation); + member.getPlayerInstance().sendPacket(sm); + } + } + } } 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 0e16a2a1cf..a384d2efb7 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 @@ -59,6 +59,7 @@ public class PlayerVariables extends AbstractVariables public static final String REVELATION_SKILL_2_MAIN_CLASS = "RevelationSkill2"; public static final String REVELATION_SKILL_1_DUAL_CLASS = "DualclassRevelationSkill1"; public static final String REVELATION_SKILL_2_DUAL_CLASS = "DualclassRevelationSkill2"; + public static final String LAST_PLEDGE_REPUTATION_LEVEL = "LAST_PLEDGE_REPUTATION_LEVEL"; public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling"; public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat"; public static final String DELUSION_RETURN = "DELUSION_RETURN";