Guest User

Untitled

a guest
Jul 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package com.l2j.packetsamurai.utils;
  2.  
  3. import java.io.*;
  4. import java.util.HashSet;
  5. import java.util.List;
  6.  
  7. public class SpawnWriter
  8. {
  9. public HashSet<SpawnNode> _clearList = new HashSet<SpawnNode>();
  10.  
  11. public SpawnWriter(List<SpawnNode> list) throws IOException
  12. {
  13. for(SpawnNode item : list)
  14. {
  15. if(!_clearList.add(item))
  16. {}
  17. else
  18. {}
  19. }
  20.  
  21. for(SpawnNode item : _clearList)
  22. {
  23. int npcId = item.get_npcId();
  24. int x = item.getX();
  25. int y = item.getY();
  26. int z = item.getZ();
  27. long heading = item.getHeading();
  28. //parseOpcode(npcId, x, y, z, heading);
  29. System.out.println(npcId + " " + x);
  30. }
  31. }
  32.  
  33. private void parseOpcode(int npcId, int x, int y, int z, long heading) throws FileNotFoundException, UnsupportedEncodingException {
  34. PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("test.txt", true), "UTF8"));
  35. pw.println("<spawn count=\"1\" respawn=\"60\" respawn_random=\"0\" period_of_day=\"none\">");
  36. pw.println("\t<point x=\"" + x + "\" y=\"" + y +"\" z=\"" + z + "\" h=\"" + heading + "\" />");
  37. pw.println("\t<npc id=\"" + npcId + "\" />");
  38. pw.println("</spawn>");
  39. pw.close();
  40. }
  41. /*
  42. <spawn count="1" respawn="60" respawn_random="0" period_of_day="none">
  43. <point x="-246875" y="219422" z="5187" h="0" />
  44. <npc id="18684" /><!--Red Star Stone-->
  45. </spawn>
  46. */
  47. }
Add Comment
Please, Sign In to add comment