warc222

random npc

Sep 24th, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/model/actor/instance/L2RandomInstance.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/model/actor/instance/L2RandomInstance.java (revision 0)
  4. +++ java/com/l2jserver/gameserver/model/actor/instance/L2RandomInstance.java (revision 0)
  5. @@ -0,0 +1,156 @@
  6. +package com.l2jserver.gameserver.model.actor.instance;
  7. +
  8. +import java.util.Properties;
  9. +import java.util.Random;
  10. +import java.util.StringTokenizer;
  11. +
  12. +import javolution.text.TextBuilder;
  13. +
  14. +import com.l2jserver.gameserver.instancemanager.InstanceManager;
  15. +import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
  16. +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  17. +
  18. +/**
  19. + * version v1.1
  20. + * @author Marwan
  21. + */
  22. +
  23. +public class L2RandomInstance extends L2NpcInstance
  24. +{
  25. +
  26. + public L2RandomInstance.(int objectId, L2NpcTemplate template)
  27. + {
  28. + super(objectId, template);
  29. + }
  30. +
  31. + @Override
  32. + public void showChatWindow(L2PcInstance player, int val)
  33. + {
  34. + if (player == null)
  35. + {
  36. + return;
  37. + }
  38. +
  39. + TextBuilder tb = new TextBuilder();
  40. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  41. + Random noob = new Random();
  42. + int number = noob.nextInt(2);
  43. + tb.append("<html><head><title>Random</title></head><body>");
  44. + if (number == 1)
  45. + {
  46. + tb.append("<center>Random1</center><br>");
  47. + }
  48. + if (number == 2)
  49. + {
  50. + tb.append("<center>Random2</center><br>");
  51. + }
  52. + html.setHtml(tb.toString());
  53. + player.sendPacket(html);
  54. + }
  55. + }
  56. \ No newline at end of file
Add Comment
Please, Sign In to add comment