Created
June 21, 2022 00:50
-
-
Save Williams0ff/c5cd1c96595b978e14cc1cdf2ef7479c to your computer and use it in GitHub Desktop.
Restrição de Grade em Olly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/L2jOne_C6_Interlude/config/events.properties b/L2jOne_C6_Interlude/config/events.properties | |
index de91772..be27bac 100644 | |
--- a/L2jOne_C6_Interlude/config/events.properties | |
+++ b/L2jOne_C6_Interlude/config/events.properties | |
@@ -84,6 +84,9 @@ | |
OlyDividerClassed = 3 | |
OlyDividerNonClassed = 5 | |
+# Grid Restriction to Participate in the Olympiad. configure: S;A;B;C;D | |
+OlyGradeRestrictionItemsList = D | |
+ | |
#============================================================= | |
# Seven Signs && Festival | |
#============================================================= | |
diff --git a/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java b/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java | |
index 4591c05..3cff48e 100644 | |
--- a/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java | |
+++ b/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java | |
@@ -4,7 +4,9 @@ | |
import java.io.FileOutputStream; | |
import java.io.OutputStream; | |
import java.math.BigInteger; | |
+import java.util.ArrayList; | |
import java.util.HashMap; | |
+import java.util.List; | |
import java.util.Map; | |
import java.util.Properties; | |
@@ -13,6 +15,7 @@ | |
import net.sf.l2j.commons.math.MathUtil; | |
import net.sf.l2j.gameserver.enums.GeoType; | |
+import net.sf.l2j.gameserver.enums.items.CrystalType; | |
import net.sf.l2j.gameserver.model.holder.IntIntHolder; | |
/** | |
@@ -151,6 +154,7 @@ | |
public static int OLY_DIVIDER_CLASSED; | |
public static int OLY_DIVIDER_NON_CLASSED; | |
public static boolean OLY_ANNOUNCE_GAMES; | |
+ public static List<CrystalType> OLY_GRADE_RESTRICTION = new ArrayList<>(); | |
/** SevenSigns Festival */ | |
public static boolean SEVEN_SIGNS_BYPASS_PREREQUISITES; | |
@@ -791,6 +795,9 @@ | |
OLY_DIVIDER_NON_CLASSED = events.getProperty("OlyDividerNonClassed", 5); | |
OLY_ANNOUNCE_GAMES = events.getProperty("OlyAnnounceGames", true); | |
+ for (String list : events.getProperty("OlyGradeRestrictionItemsList", "A;S").split(";")) | |
+ OLY_GRADE_RESTRICTION.add(CrystalType.valueOf(list)); | |
+ | |
SEVEN_SIGNS_BYPASS_PREREQUISITES = events.getProperty("SevenSignsBypassPrerequisites", false); | |
FESTIVAL_MIN_PLAYER = MathUtil.limit(events.getProperty("FestivalMinPlayer", 5), 2, 9); | |
MAXIMUM_PLAYER_CONTRIB = events.getProperty("MaxPlayerContrib", 1000000); | |
diff --git a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/item/kind/Item.java b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/item/kind/Item.java | |
index 496cd5d..3962123 100644 | |
--- a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/item/kind/Item.java | |
+++ b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/item/kind/Item.java | |
@@ -8,6 +8,7 @@ | |
import net.sf.l2j.commons.data.StatSet; | |
+import net.sf.l2j.Config; | |
import net.sf.l2j.gameserver.enums.items.ActionType; | |
import net.sf.l2j.gameserver.enums.items.ArmorType; | |
import net.sf.l2j.gameserver.enums.items.CrystalType; | |
@@ -508,6 +509,9 @@ | |
public boolean isOlyRestrictedItem() | |
{ | |
+ if (!Config.OLY_GRADE_RESTRICTION.contains(getCrystalType())) | |
+ return true; | |
+ | |
return _isOlyRestricted; | |
} | |
diff --git a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java | |
index ce6b90f..7252e7a 100644 | |
--- a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java | |
+++ b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java | |
@@ -5,6 +5,7 @@ | |
import net.sf.l2j.commons.logging.CLogger; | |
import net.sf.l2j.commons.util.ArraysUtil; | |
+import net.sf.l2j.Config; | |
import net.sf.l2j.gameserver.data.SkillTable; | |
import net.sf.l2j.gameserver.data.xml.MapRegionData; | |
import net.sf.l2j.gameserver.enums.MessageType; | |
@@ -347,6 +348,21 @@ | |
// Remove shot automation | |
player.disableAutoShotsAll(); | |
+ for (ItemInstance item : player.getInventory().getItems()) | |
+ { | |
+ if (item == null) | |
+ continue; | |
+ | |
+ if (!Config.OLY_GRADE_RESTRICTION.contains(item.getItem().getCrystalType())) | |
+ { | |
+ player.getInventory().unequipItemInBodySlotAndRecord(item); | |
+ | |
+ final InventoryUpdate iu = new InventoryUpdate(); | |
+ iu.addRemovedItem(item); | |
+ player.sendPacket(iu); | |
+ } | |
+ } | |
+ | |
// Discharge any active shots | |
ItemInstance item = player.getActiveWeaponInstance(); | |
if (item != null) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment