Skip to content

Instantly share code, notes, and snippets.

@Williams0ff
Created December 24, 2023 20:27
Show Gist options
  • Save Williams0ff/3da108c41574c56369fe7247b63e7d39 to your computer and use it in GitHub Desktop.
Save Williams0ff/3da108c41574c56369fe7247b63e7d39 to your computer and use it in GitHub Desktop.
Boss Fragment (Joia Bless)
diff --git a/L2jOne_C6_Interlude/config/npcs.properties b/L2jOne_C6_Interlude/config/npcs.properties
index 6c82330..29034f1 100644
--- a/L2jOne_C6_Interlude/config/npcs.properties
+++ b/L2jOne_C6_Interlude/config/npcs.properties
@@ -120,6 +120,10 @@
# Show clan && alliance crests on summons, default: False
ShowSummonCrest = False
+# Fragment Boss reward.
+# Configure: BossId-ItemId,ItemCount;
+BossFragment = 29001-57,10;29006-57,10;29014-57,10;29022-57,10;29020-57,10;29019-57,10;29066-57,10;29067-57,10;29068-57,10;29028-57,10;29047-57,10;
+
diff --git a/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java b/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java
index c7f65cb..e4a9c64 100644
--- a/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java
+++ b/L2jOne_C6_Interlude/java/net/sf/l2j/Config.java
@@ -371,6 +367,9 @@
// --------------------------------------------------
// NPCs / Monsters
// --------------------------------------------------
+
+ /** Frags Boss*/
+ public static Map<Integer, IntIntHolder> BOSS_FRAGMENT= new HashMap<>();
/** Spawn */
public static double SPAWN_MULTIPLIER;
@@ -1150,6 +1145,15 @@
private static final void loadNpcs()
{
final ExProperties npcs = initProperties(NPCS_FILE);
+
+ for (String val : npcs.getProperty("BossFragment", "0,0").split(";"))
+ {
+ final String[] vals = val.split("-");
+ int bossId = Integer.parseInt(vals[0]);
+ int itemId = Integer.parseInt(vals[1].split(",")[0]);
+ int itemCount = Integer.parseInt(vals[1].split(",")[1]);
+ BOSS_FRAGMENT.put(bossId, new IntIntHolder(itemId, itemCount));
+ }
SPAWN_MULTIPLIER = npcs.getProperty("SpawnMultiplier", 1.);
SPAWN_EVENTS = npcs.getProperty("SpawnEvents", new String[]
diff --git a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
index d37c8ea..68c9299 100644
--- a/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
+++ b/L2jOne_C6_Interlude/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
@@ -509,7 +507,17 @@
dropOrAutoLootItem(player, drop);
}
}
-
+
+ final IntIntHolder holder = Config.BOSS_FRAGMENT.get(getNpcId());
+ if (holder != null)
+ {
+ if (!player.isDead() && player.isIn2DRadius(this, 3000))
+ {
+ player.addItem("fragment", holder.getId(), holder.getValue(), this, true);
+ player.sendMessage("You received a shard for witnessing the death of a boss!");
+ }
+ }
+
// Apply special item drop for champions.
if (isChampion() && !Config.CHAMPION_REWARD_LIST.isEmpty() && player.getStatus().getLevel() <= getStatus().getLevel() + 9)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment