Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.l2j.packetsamurai.utils;
- import java.io.*;
- import java.util.HashSet;
- import java.util.List;
- public class SpawnWriter
- {
- public HashSet<SpawnNode> _clearList = new HashSet<SpawnNode>();
- public SpawnWriter(List<SpawnNode> list) throws IOException
- {
- for(SpawnNode item : list)
- {
- if(!_clearList.add(item))
- {}
- else
- {}
- }
- for(SpawnNode item : _clearList)
- {
- int npcId = item.get_npcId();
- int x = item.getX();
- int y = item.getY();
- int z = item.getZ();
- long heading = item.getHeading();
- //parseOpcode(npcId, x, y, z, heading);
- System.out.println(npcId + " " + x);
- }
- }
- private void parseOpcode(int npcId, int x, int y, int z, long heading) throws FileNotFoundException, UnsupportedEncodingException {
- PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("test.txt", true), "UTF8"));
- pw.println("<spawn count=\"1\" respawn=\"60\" respawn_random=\"0\" period_of_day=\"none\">");
- pw.println("\t<point x=\"" + x + "\" y=\"" + y +"\" z=\"" + z + "\" h=\"" + heading + "\" />");
- pw.println("\t<npc id=\"" + npcId + "\" />");
- pw.println("</spawn>");
- pw.close();
- }
- /*
- <spawn count="1" respawn="60" respawn_random="0" period_of_day="none">
- <point x="-246875" y="219422" z="5187" h="0" />
- <npc id="18684" /><!--Red Star Stone-->
- </spawn>
- */
- }
Add Comment
Please, Sign In to add comment