Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.mythicscape.batclient.interfaces.*;
- import com.mythicscape.batclient.desktop.*;
- import com.mythicscape.batclient.ClientFrame;
- import java.util.HashMap;
- SCRIPT_NAME = "opw_s";
- public void bootup()
- {
- triggerManager.newTrigger(SCRIPT_NAME + "_pss",
- "^[|]([ *])([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*[|]",
- "$" + SCRIPT_NAME +".U",
- false,false,false,
- null, Font.PLAIN);
- }
- public void takeover()
- {
- if(clientGUI.partyFrame instanceof opw)
- {
- clientGUI.printText("generic","We are already in controll of the party window\n");
- return;
- }
- // this is dangerous, one would expect tons of crashs - but somehow it doesn't
- // best called with the partywindow visible, for there might be some reference in the bottomtaskbar
- //remove the party window from the jdesktops
- clientGUI.desktop.remove(clientGUI.partyFrame);
- // repaints the desktop without the party window
- clientGUI.desktop.repaint();
- // sets the reference to the old party window to our new one
- clientGUI.partyFrame = new opw(clientGUI);
- }
- public void U()
- {
- if(clientGUI.partyFrame instanceof opw)
- {
- ((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));
- } else {
- //clientGUI.printText("generic","Need to take over the party window first\n");
- // it is still true, but it is a bit to spamy
- }
- }
- public class opw extends ah {
- private HashMap hm;
- public void opw(ClientFrame cf)
- {
- super(cf);
- hm = new HashMap();
- System.out.println("new opw created");
- }
- public void update(String name,String hp,String hpmax,String sp,String spmax,String ep,String epmax)
- {
- if(hm.containsKey(name))
- {
- String m = hm.get(name);
- String[] mf = m.split(" ");
- mf[4] = hp;
- mf[5] = hpmax;
- mf[6] = sp;
- mf[7] = spmax;
- mf[8] = ep;
- mf[9] = epmax;
- for(int i = 1; i<30;++i)
- {
- mf[0] += " " + mf[i]; //TODO:String builder?
- }
- System.out.println("calling super.c");
- super.c(mf[0]);
- }
- }
- public void c(String s)
- {
- String[] sf = s.split(" ",2);
- hm.put(sf[0],s);
- super.c(s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment