Advertisement
-JRGames-

Grad Restriction to Participate in the Olympiad.

Jun 20th, 2022
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. diff --git a/L2jOne_C6_Interlude/config/events.properties b/L2jOne_C6_Interlude/config/events.properties
  2. index de91772..be27bac 100644
  3. --- a/L2jOne_C6_Interlude/config/events.properties
  4. +++ b/L2jOne_C6_Interlude/config/events.properties
  5. @@ -84,6 +84,9 @@
  6. OlyDividerClassed = 3
  7. OlyDividerNonClassed = 5
  8.  
  9. +# Grid Restriction to Participate in the Olympiad. configure: S;A;B;C;D
  10. +OlyGradeRestrictionItemsList = D
  11. +
  12. #=============================================================
  13. # Seven Signs && Festival
  14. #=============================================================
  15. diff --git a/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java b/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java
  16. index 4591c05..3cff48e 100644
  17. --- a/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java
  18. +++ b/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java
  19. @@ -4,7 +4,9 @@
  20. import java.io.FileOutputStream;
  21. import java.io.OutputStream;
  22. import java.math.BigInteger;
  23. +import java.util.ArrayList;
  24. import java.util.HashMap;
  25. +import java.util.List;
  26. import java.util.Map;
  27. import java.util.Properties;
  28.  
  29. @@ -13,6 +15,7 @@
  30. import net.sf.l2j.commons.math.MathUtil;
  31.  
  32. import net.sf.l2j.gameserver.enums.GeoType;
  33. +import net.sf.l2j.gameserver.enums.items.CrystalType;
  34. import net.sf.l2j.gameserver.model.holder.IntIntHolder;
  35.  
  36. /**
  37. @@ -151,6 +154,7 @@
  38. public static int OLY_DIVIDER_CLASSED;
  39. public static int OLY_DIVIDER_NON_CLASSED;
  40. public static boolean OLY_ANNOUNCE_GAMES;
  41. + public static List<CrystalType> OLY_GRADE_RESTRICTION = new ArrayList<>();
  42.  
  43. /** SevenSigns Festival */
  44. public static boolean SEVEN_SIGNS_BYPASS_PREREQUISITES;
  45. @@ -791,6 +795,9 @@
  46. OLY_DIVIDER_NON_CLASSED = events.getProperty("OlyDividerNonClassed", 5);
  47. OLY_ANNOUNCE_GAMES = events.getProperty("OlyAnnounceGames", true);
  48.  
  49. + for (String list : events.getProperty("OlyGradeRestrictionItemsList", "A;S").split(";"))
  50. + OLY_GRADE_RESTRICTION.add(CrystalType.valueOf(list));
  51. +
  52. SEVEN_SIGNS_BYPASS_PREREQUISITES = events.getProperty("SevenSignsBypassPrerequisites", false);
  53. FESTIVAL_MIN_PLAYER = MathUtil.limit(events.getProperty("FestivalMinPlayer", 5), 2, 9);
  54. MAXIMUM_PLAYER_CONTRIB = events.getProperty("MaxPlayerContrib", 1000000);
  55. 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
  56. index 496cd5d..3962123 100644
  57. --- a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/item/kind/Item.java
  58. +++ b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/item/kind/Item.java
  59. @@ -8,6 +8,7 @@
  60.  
  61. import net.sf.l2j.commons.data.StatSet;
  62.  
  63. +import net.sf.l2j.Config;
  64. import net.sf.l2j.gameserver.enums.items.ActionType;
  65. import net.sf.l2j.gameserver.enums.items.ArmorType;
  66. import net.sf.l2j.gameserver.enums.items.CrystalType;
  67. @@ -508,6 +509,9 @@
  68.  
  69. public boolean isOlyRestrictedItem()
  70. {
  71. + if (!Config.OLY_GRADE_RESTRICTION.contains(getCrystalType()))
  72. + return true;
  73. +
  74. return _isOlyRestricted;
  75. }
  76.  
  77. 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
  78. index ce6b90f..7252e7a 100644
  79. --- a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java
  80. +++ b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java
  81. @@ -5,6 +5,7 @@
  82. import net.sf.l2j.commons.logging.CLogger;
  83. import net.sf.l2j.commons.util.ArraysUtil;
  84.  
  85. +import net.sf.l2j.Config;
  86. import net.sf.l2j.gameserver.data.SkillTable;
  87. import net.sf.l2j.gameserver.data.xml.MapRegionData;
  88. import net.sf.l2j.gameserver.enums.MessageType;
  89. @@ -347,6 +348,21 @@
  90. // Remove shot automation
  91. player.disableAutoShotsAll();
  92.  
  93. + for (ItemInstance item : player.getInventory().getItems())
  94. + {
  95. + if (item == null)
  96. + continue;
  97. +
  98. + if (!Config.OLY_GRADE_RESTRICTION.contains(item.getItem().getCrystalType()))
  99. + {
  100. + player.getInventory().unequipItemInBodySlotAndRecord(item);
  101. +
  102. + final InventoryUpdate iu = new InventoryUpdate();
  103. + iu.addRemovedItem(item);
  104. + player.sendPacket(iu);
  105. + }
  106. + }
  107. +
  108. // Discharge any active shots
  109. ItemInstance item = player.getActiveWeaponInstance();
  110. if (item != null)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement