From 699ef110eda77a5b9fb853a0fdd5cefa3214dd0f Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 30 Sep 2021 06:21:07 +0000 Subject: [PATCH] Addition of player fame and raidpoint limit checks. --- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 15 ++++++++-- .../model/actor/instance/PlayerInstance.java | 15 ++++++++-- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- .../model/actor/instance/PlayerInstance.java | 29 ++++++++++++++++--- 21 files changed, 501 insertions(+), 80 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index a155c6bffc..0605bc15d9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2328,13 +2328,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2351,7 +2362,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 90cdbb091b..75f1d92e47 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2334,13 +2334,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2357,7 +2368,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 8a121eafe8..0e43467edb 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2336,13 +2336,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2359,7 +2370,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 62ea0cf7dd..61d257b9bd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2344,13 +2344,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2367,7 +2378,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 5389548045..3bf41419bf 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2340,13 +2340,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2363,7 +2374,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 70af78d96d..84b2044b4b 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2340,13 +2340,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2363,7 +2374,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 6de15a37d3..f1cf1a9c67 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2340,13 +2340,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2363,7 +2374,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 1522817443..c5baac9b83 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2276,13 +2276,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2299,7 +2310,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index c6ee2998f6..257a60da65 100644 --- a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2306,13 +2306,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2329,7 +2340,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 97fe2a2655..c045e3f51b 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2323,13 +2323,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2346,7 +2357,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 48950b8c68..1a28ac8599 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2344,8 +2344,19 @@ public class PlayerInstance extends Playable */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 6eb4cf0f54..2bbb40e620 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2255,8 +2255,19 @@ public class PlayerInstance extends Playable */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 89e170ae41..8246af8176 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2300,13 +2300,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2323,7 +2334,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 2acee838dd..51773ffdb8 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2300,13 +2300,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2323,7 +2334,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 48266036a0..3829fbb2ef 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2298,13 +2298,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2321,7 +2332,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 3bd6f1a19f..c1d55301d7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2309,13 +2309,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2332,7 +2343,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 9ced1cefe9..13a13e58f3 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2309,13 +2309,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2332,7 +2343,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 05f7c81370..af7afabedf 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2235,13 +2235,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2258,7 +2269,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b9477969bc..4a902a93c1 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2297,13 +2297,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2320,7 +2331,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 493d9c128d..d16f8f489e 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2304,13 +2304,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2327,7 +2338,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /** diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b8e1e7ec46..1502f7ffe3 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2335,13 +2335,24 @@ public class PlayerInstance extends Playable } /** - * Set the Fame of this NcInstane + * Set the Fame of this PlayerInstane * @param fame */ public void setFame(int fame) { - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, fame), this); - _fame = (fame > Config.MAX_PERSONAL_FAME_POINTS) ? Config.MAX_PERSONAL_FAME_POINTS : fame; + int newFame = fame; + if (fame > Config.MAX_PERSONAL_FAME_POINTS) + { + newFame = Config.MAX_PERSONAL_FAME_POINTS; + } + else if (fame < 0) + { + newFame = 0; + } + + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerFameChanged(this, _fame, newFame), this); + + _fame = newFame; } /** @@ -2358,7 +2369,17 @@ public class PlayerInstance extends Playable */ public void setRaidbossPoints(int points) { - _raidbossPoints = points; + int value = points; + if (points > 2000000000) // Close to integer max value (2147483647). + { + value = 2000000000; + } + else if (points < 0) + { + value = 0; + } + + _raidbossPoints = value; } /**