2 new events have been added.
🚩 Capture The Flag
- Two teams battle to steal the enemy's flag and return it to their base!
- Team coordination and defense are key!
- The team with the most successful captures when time runs out wins!
✨ Master of Enchanting
- Receive a Master Yogi Staff and unlimited Master Yogi Scrolls!
- Compete to reach the highest enchant level before time runs out!
- Top 3 players with the highest enchanted staffs win awesome rewards!
Price has been increased to 80 euro including the new update.
Special Offer Until 32 May
Complete Server Pack + Source Files:
C4 Scions Of Destiny: P656
Retail X1 L2OFF Server Pack + Source: Price: 150EUR
C4 Scions Of Destiny: P656
ESL2 Athena x45 L2OFF Server Pack + Source: Price: 200EUR
Screenshots: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl
C6 Interlude: P746
ESL2 Athena x45 L2OFF Server Pack + Source: Price: 200EUR
The same as C4 but in C6 Client so the Screenshots is the same: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl
C6 Interlude: P746
ESL2 Athena x45 Java Server Pack + Source: Price: 100EUR
The same as C4 but in C6 Client so the Screenshots is the same: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl
C6 Interlude: P746
L2Gold L2OFF Server Pack + Source: Price: 200EUR
Screenshots: https://imgur.com/a/9kB3oA9
C6 - Classic Interlude: P110
ESL2 Athena x45 L2OFF Server Pack + Source: Price: 300EUR
Screenshots: https://imgur.com/a/Z2kZxuv
Contact me here via PM (only serious buyers).
Payments via:
- Paypal (Friends and Family)
Question
l2jkain
Hello I created this system to drop enchanted items but it drops 2 item even putting the amount 1. What can I do to improve the code ?
Index: java/net/sf/l2j/gameserver/model/actor/Attackable.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/Attackable.java (revision 3)
+++ java/net/sf/l2j/gameserver/model/actor/Attackable.java (working copy)
@@ -1184,6 +1184,28 @@
}
}
+ // Drop All Monsters Itens enchantados By Dev Williams
+ if ((Config.ENABLE_DROP_ITEM_ENCHANT) && ((this instanceof Monster)))
+ {
+ for (int i = 1; i < 81; i++)
+ {
+ if (i > 10)
+ {
+ if (player.getLevel() == i && getLevel() < player.getLevel() - 8)
+ return;
+ }
+ }
+ if (Rnd.get(100) < Config.DROP_ITEM_ENCHANT[3])
+ {
+ IntIntHolder item = new IntIntHolder(Config.DROP_ITEM_ENCHANT[0], Config.DROP_ITEM_ENCHANT[1]);
+ if (Config.AUTO_LOOT)
+ player.doAutoLoot(this, item);
+ else
+ dropItem(player, item);
+ player.getInventory().addEnchantedItem("Reward Enchant: ", Config.DROP_ITEM_ENCHANT[0], Config.DROP_ITEM_ENCHANT[1], Config.DROP_ITEM_ENCHANT[2], player, null);
+ }
+ }
+
Index: java/net/sf/l2j/gameserver/model/itemcontainer/PcInventory.java
===================================================================
--- java/net/sf/l2j/gameserver/model/itemcontainer/PcInventory.java (revision 2)
+++ java/net/sf/l2j/gameserver/model/itemcontainer/PcInventory.java (working copy)
@@ -17,9 +17,11 @@
import net.sf.l2j.gameserver.model.itemcontainer.listeners.ItemPassiveSkillsListener;
import net.sf.l2j.gameserver.model.tradelist.TradeItem;
import net.sf.l2j.gameserver.model.tradelist.TradeList;
+import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.ItemList;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.taskmanager.ShadowItemTaskManager;
public class PcInventory extends Inventory
@@ -439,6 +441,43 @@
return item;
}
+
+ public ItemInstance addEnchantedItem(String process, int itemId, int itemCount, int enchantLevel, Player actor, WorldObject reference)
+ {
+ ItemInstance item = super.addItem(process, itemId, itemCount, actor, reference);
+
+ if (item == null)
+ return null;
+
+ if (enchantLevel > 0)
+ item.setEnchantLevel(enchantLevel);
+
+ if (itemId == 57)
+ {
+ SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S1_ADENA);
+ smsg.addItemNumber(itemCount);
+ actor.sendPacket(smsg);
+ }
+ else if (itemCount > 1)
+ {
+ SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+ smsg.addItemName(itemId);
+ smsg.addItemNumber(itemCount);
+ actor.sendPacket(smsg);
+ }
+ else
+ {
+ SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_S2);
+ smsg.addNumber(enchantLevel);
+ smsg.addItemName(itemId);
+ actor.sendPacket(smsg);
+ }
+ StatusUpdate su = new StatusUpdate(actor);
+ su.addAttribute(14, actor.getCurrentLoad());
+ actor.sendPacket(su);
+
+ return item;
+ }
11 answers to this question
Recommended Posts