Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P OrionRev28
- diff --git files/game/data/xml/RandomCraft.xml files/game/data/xml/RandomCraft.xml
- index c4972de..954838c 100644
- --- files/game/data/xml/RandomCraft.xml
- +++ files/game/data/xml/RandomCraft.xml
- @@ -1,27 +1,38 @@
- <?xml version="1.0" encoding="UTF-8"?>
- <rewards>
- - <item id="6392" count="1" chance="10" />
- - <item id="5714" count="1" chance="10" />
- - <item id="5715" count="1" chance="10" />
- - <item id="5720" count="1" chance="10" />
- - <item id="5727" count="1" chance="10" />
- - <item id="5709" count="1" chance="10" />
- - <item id="5765" count="1" chance="10" />
- - <item id="5768" count="1" chance="10" />
- - <item id="5777" count="1" chance="10" />
- - <item id="5778" count="1" chance="10" />
- - <item id="5779" count="1" chance="10" />
- - <item id="5780" count="1" chance="10" />
- - <item id="5787" count="1" chance="10" />
- - <item id="5788" count="1" chance="10" />
- - <item id="5783" count="1" chance="10" />
- - <item id="5784" count="1" chance="10" />
- - <item id="5781" count="1" chance="10" />
- - <item id="5644" count="1" chance="20" />
- - <item id="5706" count="1" chance="20" />
- - <item id="5704" count="1" chance="20" />
- - <item id="6372" count="1" chance="25" />
- - <item id="6377" count="1" chance="50" />
- - <item id="6367" count="1" chance="40" />
- + <item id="6392" count="1" chance="10" announce="false" />
- + <item id="5714" count="1" chance="10" announce="false" />
- + <item id="5715" count="1" chance="10" announce="false" />
- + <item id="5720" count="1" chance="10" announce="false" />
- + <item id="5727" count="1" chance="10" announce="false" />
- + <item id="5709" count="1" chance="10" announce="false" />
- + <item id="5765" count="1" chance="10" announce="false" />
- + <item id="5768" count="1" chance="15" announce="false" />
- + <item id="5777" count="1" chance="15" announce="false" />
- + <item id="5778" count="1" chance="15" announce="false" />
- + <item id="5779" count="1" chance="15" announce="false" />
- + <item id="5780" count="1" chance="20" announce="false" />
- + <item id="5787" count="1" chance="20" announce="false" />
- + <item id="5788" count="1" chance="20" announce="false" />
- + <item id="5783" count="1" chance="20" announce="false" />
- + <item id="5784" count="1" chance="20" announce="false" />
- + <item id="5781" count="1" chance="20" announce="false" />
- + <item id="5644" count="1" chance="25" announce="false" />
- + <item id="5706" count="1" chance="25" announce="false" />
- + <item id="5704" count="1" chance="25" announce="false" />
- + <item id="6372" count="1" chance="25" announce="false" />
- + <item id="6377" count="1" chance="30" announce="false" />
- + <item id="6367" count="1" chance="40" announce="false" />
- + <item id="6611" count="1" chance="80" announce="true" />
- + <item id="6612" count="1" chance="80" announce="true" />
- + <item id="6613" count="1" chance="80" announce="true" />
- + <item id="6614" count="1" chance="80" announce="true" />
- + <item id="6615" count="1" chance="80" announce="true" />
- + <item id="6616" count="1" chance="80" announce="true" />
- + <item id="6617" count="1" chance="80" announce="true" />
- + <item id="6618" count="1" chance="80" announce="true" />
- + <item id="6619" count="1" chance="80" announce="true" />
- + <item id="6620" count="1" chance="80" announce="true" />
- + <item id="6621" count="1" chance="80" announce="true" />
- </rewards>
- diff --git src/Base/RandomCraftSystem/RandomCraftItem.java src/Base/RandomCraftSystem/RandomCraftItem.java
- index 3687699..c4af9d2 100644
- --- src/Base/RandomCraftSystem/RandomCraftItem.java
- +++ src/Base/RandomCraftSystem/RandomCraftItem.java
- @@ -12,12 +12,14 @@
- private int id;
- private int cantidad;
- private double probabilidad;
- + private boolean announce;
- - public RandomCraftItem(int id, int cantidad, double probabilidad)
- + public RandomCraftItem(int id, int cantidad, double probabilidad, boolean announce)
- {
- this.id = id;
- this.cantidad = cantidad;
- this.probabilidad = probabilidad;
- + this.announce = announce;
- }
- public int getId()
- @@ -35,6 +37,11 @@
- return probabilidad;
- }
- + public boolean getAnnounce()
- + {
- + return announce;
- + }
- +
- public String getIcon()
- {
- return getItem().getIcon();
- @@ -44,5 +51,4 @@
- {
- return ItemTable.getInstance().getTemplate(id);
- }
- -
- }
- diff --git src/Base/RandomCraftSystem/RandomCraftXML.java src/Base/RandomCraftSystem/RandomCraftXML.java
- index 242304e..46e14dd 100644
- --- src/Base/RandomCraftSystem/RandomCraftXML.java
- +++ src/Base/RandomCraftSystem/RandomCraftXML.java
- @@ -59,8 +59,9 @@
- int id = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
- int cantidad = Integer.parseInt(attrs.getNamedItem("count").getNodeValue());
- double probabilidad = Double.parseDouble(attrs.getNamedItem("chance").getNodeValue());
- + boolean announce = Boolean.parseBoolean(attrs.getNamedItem("announce").getNodeValue());
- - RandomCraftItem item = new RandomCraftItem(id, cantidad, probabilidad);
- + RandomCraftItem item = new RandomCraftItem(id, cantidad, probabilidad, announce);
- items.put(id, item);
- }
- }
- diff --git src/l2jorion/game/model/actor/instance/L2RandomCraftInstance.java src/l2jorion/game/model/actor/instance/L2RandomCraftInstance.java
- index a528388..045ed2e 100644
- --- src/l2jorion/game/model/actor/instance/L2RandomCraftInstance.java
- +++ src/l2jorion/game/model/actor/instance/L2RandomCraftInstance.java
- @@ -14,7 +14,9 @@
- import Base.RandomCraftSystem.RandomCraftXML;
- import l2jorion.Config;
- import l2jorion.game.ai.CtrlIntention;
- +import l2jorion.game.model.L2World;
- import l2jorion.game.network.serverpackets.ActionFailed;
- +import l2jorion.game.network.serverpackets.ExShowScreenMessage;
- import l2jorion.game.network.serverpackets.ItemList;
- import l2jorion.game.network.serverpackets.MoveToPawn;
- import l2jorion.game.network.serverpackets.MyTargetSelected;
- @@ -187,7 +189,7 @@
- stmt.execute();
- stmt.close();
- - stmt = con.prepareStatement("INSERT INTO RandomCraftItem (object_id, item_id, amount, chance) VALUES (?, ?, ?, ?)");
- + stmt = con.prepareStatement("INSERT INTO RandomCraftItem (object_id, item_id, amount, chance, announce) VALUES (?, ?, ?, ?, ?)");
- stmt.setInt(1, player.getObjectId());
- List<RandomCraftItem> items = player.getGeneratedCraftItems();
- if (items != null)
- @@ -197,6 +199,7 @@
- stmt.setInt(2, item.getId());
- stmt.setInt(3, item.getCantidad());
- stmt.setDouble(4, item.getProbabilidad());
- + stmt.setBoolean(5, item.getAnnounce());
- stmt.addBatch(); // Agregar la consulta al lote (batch)
- }
- stmt.executeBatch(); // Ejecutar el lote de consultas
- @@ -244,7 +247,7 @@
- try
- {
- con = L2DatabaseFactory.getInstance().getConnection();
- - stmt = con.prepareStatement("SELECT item_id, amount, chance FROM RandomCraftItem WHERE object_id = ?");
- + stmt = con.prepareStatement("SELECT item_id, amount, chance, announce FROM RandomCraftItem WHERE object_id = ?");
- stmt.setInt(1, player.getObjectId());
- rset = stmt.executeQuery();
- @@ -254,7 +257,8 @@
- int itemId = rset.getInt("item_id");
- int amount = rset.getInt("amount");
- int chance = rset.getInt("chance");
- - RandomCraftItem item = new RandomCraftItem(itemId, amount, chance);
- + boolean announce = rset.getBoolean("announce");
- + RandomCraftItem item = new RandomCraftItem(itemId, amount, chance, announce);
- items.add(item);
- }
- @@ -326,7 +330,7 @@
- private void createItem(L2PcInstance player)
- {
- - // Compruebe si la lista de elementos está vacía
- + // Comprueba si la lista de elementos está vacía
- List<RandomCraftItem> items = player.getGeneratedCraftItems();
- if (items == null || items.isEmpty())
- {
- @@ -334,18 +338,18 @@
- return;
- }
- - // Obtenga un elemento aleatorio de la lista de elementos generados
- + // Obtén un elemento aleatorio de la lista de elementos generados
- Random random = new Random();
- int index = random.nextInt(items.size());
- RandomCraftItem craftItem = items.get(index);
- - // Cargue al jugador el artículo con ID 57 y cantidad 300000
- + // Carga al jugador el artículo con ID 57 y cantidad 300000
- L2ItemInstance item57 = player.getInventory().getItemByItemId(Config.RANDOM_CRAFT_ITEM_ID_CONSUME);
- if (item57 != null && item57.getCount() >= Config.RANDOM_CRAFT_ITEM_CONSUME_CREATE)
- {
- player.getInventory().destroyItemByItemId("Random Craft", Config.RANDOM_CRAFT_ITEM_ID_CONSUME, Config.RANDOM_CRAFT_ITEM_CONSUME_CREATE, player, this);
- - // Dar el artículo al jugado
- + // Da el artículo al jugador
- L2ItemInstance itemInstance = player.getInventory().addItem("Random Craft", craftItem.getId(), craftItem.getCantidad(), player, this);
- if (itemInstance != null)
- {
- @@ -355,7 +359,25 @@
- String message = "¡Felicidades! Has recibido " + craftItem.getItem().getName() + " (Cantidad: " + craftItem.getCantidad() + ")";
- player.sendMessage(message);
- - // Borrar la lista de elementos para el jugador
- + // Obtén el nombre del jugador que creó el elemento
- + String creatorName = player.getName();
- +
- + // Comprueba si el artículo tiene announce en true en el archivo XML
- + if (craftItem.getAnnounce())
- + {
- +
- + for (L2PcInstance players : L2World.getInstance().getAllPlayers().values())
- + {
- +
- + String text = creatorName + " Ha Crafteado: " + craftItem.getItem().getName() + " En el RandomCraft System";
- +
- + players.sendPacket(new ExShowScreenMessage(text, 12000, 2, true));
- +
- + }
- +
- + }
- +
- + // Borra la lista de elementos para el jugador
- player.clearGeneratedCraftItems();
- setHasGeneratedItems(false);
- return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement