Guest User

Untitled

a guest
Apr 7th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. import com.mythicscape.batclient.interfaces.*;
  2. import com.mythicscape.batclient.desktop.*;
  3. import com.mythicscape.batclient.ClientFrame;
  4. import java.util.HashMap;
  5.  
  6. SCRIPT_NAME = "opw_s";
  7.  
  8. public void bootup()
  9. {
  10. triggerManager.newTrigger(SCRIPT_NAME + "_pss",
  11. "^[|]([ *])([1-3?])[.]([1-3?])\\s+([a-zA-Z]+)\\s+[a-zA-Z]+\\s+([0-9-]+)[(]\\s*(\\d+)[)]\\s*([0-9-]+)\\s*[(]\\s*([0-9-]+)[)]\\s*([0-9-]+)\\s*[(]\\s*([0-9-]+)[)]\\s*[|]\\s*(\\d+)\\s*[|]\\s*(\\d+)\\s*[|]",
  12. "$" + SCRIPT_NAME +".U",
  13. false,false,false,
  14. null, Font.PLAIN);
  15. }
  16.  
  17. public void takeover()
  18. {
  19. if(clientGUI.partyFrame instanceof opw)
  20. {
  21. clientGUI.printText("generic","We are already in controll of the party window\n");
  22. return;
  23. }
  24. // this is dangerous, one would expect tons of crashs - but somehow it doesn't
  25. // best called with the partywindow visible, for there might be some reference in the bottomtaskbar
  26. //remove the party window from the jdesktops
  27. clientGUI.desktop.remove(clientGUI.partyFrame);
  28. // repaints the desktop without the party window
  29. clientGUI.desktop.repaint();
  30. // sets the reference to the old party window to our new one
  31. clientGUI.partyFrame = new opw(clientGUI);
  32. }
  33.  
  34. public void U()
  35. {
  36. if(clientGUI.partyFrame instanceof opw)
  37. {
  38. ((opw) clientGUI.partyFrame).update(vars.get(4),vars.get(5),vars.get(6),vars.get(7),vars.get(8),vars.get(9),vars.get(10));
  39. } else {
  40. //clientGUI.printText("generic","Need to take over the party window first\n");
  41. // it is still true, but it is a bit to spamy
  42. }
  43. }
  44.  
  45. public class opw extends ah {
  46. private HashMap hm;
  47. public void opw(ClientFrame cf)
  48. {
  49. super(cf);
  50. hm = new HashMap();
  51. System.out.println("new opw created");
  52. }
  53.  
  54. public void update(String name,String hp,String hpmax,String sp,String spmax,String ep,String epmax)
  55. {
  56. if(hm.containsKey(name))
  57. {
  58. String m = hm.get(name);
  59. String[] mf = m.split(" ");
  60. mf[4] = hp;
  61. mf[5] = hpmax;
  62. mf[6] = sp;
  63. mf[7] = spmax;
  64. mf[8] = ep;
  65. mf[9] = epmax;
  66. for(int i = 1; i<30;++i)
  67. {
  68. mf[0] += " " + mf[i]; //TODO:String builder?
  69. }
  70. System.out.println("calling super.c");
  71. super.c(mf[0]);
  72. }
  73. }
  74.  
  75. public void c(String s)
  76. {
  77. String[] sf = s.split(" ",2);
  78. hm.put(sf[0],s);
  79. super.c(s);
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment