Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2World-DataPack-HF
- Index: data/scripts/handlers/admincommandhandlers/AdminEditNpc.java
- ===================================================================
- --- data/scripts/handlers/admincommandhandlers/AdminEditNpc.java (revision 165)
- +++ data/scripts/handlers/admincommandhandlers/AdminEditNpc.java (working copy)
- @@ -77,7 +77,8 @@
- "admin_add_skill_npc",
- "admin_edit_skill_npc",
- "admin_del_skill_npc",
- - "admin_log_npc_spawn"
- + "admin_log_npc_spawn",
- + "admin_clone_drop_category"
- };
- @Override
- @@ -356,6 +357,70 @@
- activeChar.sendMessage("Usage: //del_skill_npc <npc_id> <skill_id>");
- }
- }
- + else if (command.startsWith("admin_clone_drop_category"))
- + {
- + try
- + {
- + StringTokenizer st = new StringTokenizer(command, " ");
- + st.nextToken();
- + int npcId = Integer.parseInt(st.nextToken());
- + int cloneFromCat = Integer.parseInt(st.nextToken());
- + int clonedCat = Integer.parseInt(st.nextToken());
- +
- + if (cloneFromCat == clonedCat)
- + {
- + activeChar.sendMessage("<category_to_clone_from> and <cloned_category> must NOT match.");
- + return false;
- + }
- +
- + //NpcTable.getInstance().reloadNpc(npcId);
- +
- + if (NpcTable.getInstance().getTemplate(npcId) == null)
- + {
- + activeChar.sendMessage("Template for npcId:"+npcId+" not found.");
- + return false;
- + }
- +
- + if (NpcTable.getInstance().getTemplate(npcId).getDropData() == null)
- + {
- + activeChar.sendMessage("DropCategory at template for npcId:"+npcId+" not found.");
- + return false;
- + }
- +
- + L2DropCategory cat = null;
- + for (L2DropCategory dc : NpcTable.getInstance().getTemplate(npcId).getDropData())
- + {
- + if (dc.getCategoryType() == cloneFromCat)
- + cat = dc;
- + }
- +
- + if (cat == null)
- + {
- + activeChar.sendMessage("<category_to_clone_from> not found.");
- + return false;
- + }
- +
- + int i = 0;
- + int j = 0;
- + for (L2DropData dd : cat.getAllDrops())
- + {
- + if (dd == null)
- + {
- + j++;
- + continue;
- + }
- + addDropData(activeChar, npcId, dd.getItemId(), dd.getMinDrop(), dd.getMaxDrop(), clonedCat, (int)dd.getChance());
- + i++;
- + }
- +
- + activeChar.sendMessage(i+" DropData(s) successfuly cloned from category "+cloneFromCat+" to category "+clonedCat+". "+j+" drops were null.");
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + activeChar.sendMessage("Usage: //clone_drop_category <npc_id> <category_to_clone_from> <cloned_category>");
- + }
- + }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement