Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java (revision 3)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java (working copy)
- @@ -23,6 +23,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.Fence;
- import net.sf.l2j.gameserver.model.actor.instance.Player;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.model.location.Location;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- @@ -52,6 +53,7 @@
- "admin_spawnday",
- "admin_spawnfence",
- "admin_deletefence",
- + "admin_spawnguards",
- "admin_listfence"
- };
- @@ -250,6 +252,19 @@
- }
- else if (command.startsWith("admin_listfence"))
- listFences(activeChar);
- + else if (command.startsWith("admin_spawnguards"))
- + {
- + if (activeChar.getTarget() == null || !(activeChar.getTarget() instanceof Npc))
- + {
- + activeChar.sendMessage("Npc not found.");
- + return false;
- + }
- + final Npc npc = (Npc) activeChar.getTarget();
- + final Location npcLoc = new Location(npc.getX(), npc.getY(), npc.getZ());
- + spawnGuards(30382, 10, npcLoc, 250);
- + spawnGuards(30381, 5, npcLoc, 120);
- +
- + }
- else if (command.startsWith("admin_spawn"))
- {
- StringTokenizer st = new StringTokenizer(command, " ");
- @@ -272,6 +287,36 @@
- return true;
- }
- + private static void spawnGuards(int npcId, int count, Location npcLoc, int rad)
- + {
- + double angle = 2 * Math.PI / count;
- +
- + for (int i = 0; i < count; i++)
- + {
- + int x = npcLoc.getX() + (int) (Math.cos(angle * i) * rad);
- + int y = npcLoc.getY() + (int) (Math.sin(angle * i) * rad);
- + customSpawn(npcId, x, y, npcLoc);
- + }
- + }
- +
- + private static void customSpawn(int npcId, int x, int y, Location loc)
- + {
- + final NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
- + try
- + {
- + L2Spawn spawn = new L2Spawn(template);
- + spawn.setLoc(x, y, loc.getZ(), 0);
- + spawn.setRespawnDelay(10);
- + SpawnTable.getInstance().addNewSpawn(spawn, false);
- + spawn.doSpawn(false);
- + spawn.setRespawnState(false);
- + }
- + catch (Exception e)
- + {
- + }
- + }
- +
- @Override
- public String[] getAdminCommandList()
- {
Add Comment
Please, Sign In to add comment