diff --git a/sigIRCv2.jar b/sigIRCv2.jar index 035f10a..051783d 100644 Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ diff --git a/src/sig/Module.java b/src/sig/Module.java index 3c5718f..83acaf7 100644 --- a/src/sig/Module.java +++ b/src/sig/Module.java @@ -67,9 +67,9 @@ public class Module extends JFrame implements ComponentListener, WindowListener, this.addKeyListener(this); this.position = bounds; + System.out.println(position); this.name = moduleName; this.enabled=true; - this.setVisible(true); this.setTitle(moduleName); panel = new ListenerPanel(this){ public void paintComponent(Graphics g) { @@ -80,17 +80,19 @@ public class Module extends JFrame implements ComponentListener, WindowListener, this.setLocation((int)position.getX(), (int)position.getY()); this.titleHeight = (int)TextUtils.calculateStringBoundsFont(this.name, sigIRC.userFont).getHeight(); + + this.setSize(new Dimension((int)position.getWidth(), (int)position.getHeight())); - - this.setMinimumSize(new Dimension((int)position.getWidth(), (int)position.getHeight())); - panel.setMinimumSize(this.getMinimumSize()); + panel.setSize(this.getSize()); + //System.out.println("Module "+moduleName+": "+position); this.add(panel); //this.pack(); + repaint(); + this.setVisible(true); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleWithFixedDelay(()->{ - updateFPSCounter(); run(); panel.repaint(); },(long)((1d/(sigIRC.framerate+1))*1000),(long)((1d/(sigIRC.framerate+1))*1000),TimeUnit.MILLISECONDS); @@ -140,6 +142,7 @@ public class Module extends JFrame implements ComponentListener, WindowListener, public void draw(Graphics g) { //g.fillRect(0, 0, (int)position.getWidth(), (int)position.getHeight()); //DrawUtils.drawText(g, 0, 16, Color.WHITE, "Test"); + updateFPSCounter(); } public void ModuleDragEvent(int oldX, int oldY, int newX, int newY) { @@ -194,7 +197,9 @@ public class Module extends JFrame implements ComponentListener, WindowListener, @Override public void componentMoved(ComponentEvent e) { - UpdatePosition(e); + if (this.isVisible()) { + UpdatePosition(e); + } } private void UpdatePosition(ComponentEvent e) { @@ -206,7 +211,9 @@ public class Module extends JFrame implements ComponentListener, WindowListener, @Override public void componentResized(ComponentEvent e) { - UpdatePosition(e); + if (this.isVisible()) { + UpdatePosition(e); + } } @Override diff --git a/src/sig/MyPanel.java b/src/sig/MyPanel.java index 10abc60..52b937a 100644 --- a/src/sig/MyPanel.java +++ b/src/sig/MyPanel.java @@ -35,10 +35,7 @@ import sig.modules.ChatLog.ChatLogMessage; import sig.utils.FileUtils; public class MyPanel extends JPanel{ - public int lastMouseX = 0; - public int lastMouseY = 0; - - public MyPanel() { + public MyPanel() { //setBorder(BorderFactory.createLineBorder(Color.black)); setFocusable(true); } @@ -51,11 +48,6 @@ public class MyPanel extends JPanel{ super.paintComponent(g); // Draw Text //int counter=18; - if (sigIRC.panel!=null) { - lastMouseX = (int)(MouseInfo.getPointerInfo().getLocation().getX()); - lastMouseY = (int)(MouseInfo.getPointerInfo().getLocation().getY()); - //System.out.println("("+lastMouseX+","+lastMouseY+")"); - } /*if (sigIRC.window!=null && sigIRC.window.getMousePosition(true)!=null && sigIRC.overlayMode) { lastMouseX = (int)sigIRC.window.getMousePosition(true).getX(); lastMouseY = (int)sigIRC.window.getMousePosition(true).getY(); diff --git a/src/sig/modules/ChatLogModule.java b/src/sig/modules/ChatLogModule.java index 760ffde..96fd91e 100644 --- a/src/sig/modules/ChatLogModule.java +++ b/src/sig/modules/ChatLogModule.java @@ -24,7 +24,7 @@ import sig.utils.DrawUtils; import sig.utils.FileUtils; public class ChatLogModule extends Module{ - public static int messageHistoryCount = 20; + public static int messageHistoryCount = 50; public List messageHistory = new ArrayList(); int delay = 150; boolean initialized=false; diff --git a/src/sig/modules/RabiRace/ClickableButton.java b/src/sig/modules/RabiRace/ClickableButton.java index 1f65936..4fc725a 100644 --- a/src/sig/modules/RabiRace/ClickableButton.java +++ b/src/sig/modules/RabiRace/ClickableButton.java @@ -37,19 +37,19 @@ public class ClickableButton { } public boolean mouseInsideBounds(MouseEvent ev) { - return ev.getX()>=module.getPosition().getX()+x && ev.getX()<=module.getPosition().getX()+x+width && - ev.getY()>=module.getPosition().getY()+y && ev.getY()<=module.getPosition().getY()+y+height; + return ev.getX()>=0+x && ev.getX()<=0+x+width && + ev.getY()>=0+y && ev.getY()<=0+y+height; } public void draw(Graphics g) { Color color_identity = g.getColor(); g.setColor(Color.WHITE); - g.drawRect((int)module.getPosition().getX()+x, - (int)module.getPosition().getY()+y, width, height); + g.drawRect((int)0+x, + (int)0+y, width, height); g.setColor(Color.BLACK); - g.fillRect((int)module.getPosition().getX()+x+1, - (int)module.getPosition().getY()+y+1, width-1, height-1); - DrawUtils.drawTextFont(g, sigIRC.userFont, module.getPosition().getX()+x-TextUtils.calculateStringBoundsFont(label, sigIRC.userFont).getWidth()/2+width/2, module.getPosition().getY()+y+height-1, Color.WHITE, label); + g.fillRect((int)0+x+1, + (int)0+y+1, width-1, height-1); + DrawUtils.drawTextFont(g, sigIRC.userFont, 0+x-TextUtils.calculateStringBoundsFont(label, sigIRC.userFont).getWidth()/2+width/2, 0+y+height-1, Color.WHITE, label); g.setColor(color_identity); } } diff --git a/src/sig/modules/RabiRace/MemoryData.java b/src/sig/modules/RabiRace/MemoryData.java index 0e5e618..25db142 100644 --- a/src/sig/modules/RabiRace/MemoryData.java +++ b/src/sig/modules/RabiRace/MemoryData.java @@ -42,6 +42,7 @@ public enum MemoryData { CHARGE_RING(MemoryOffset.CHARGE_RING,"Charge Ring","charge_ring.png",true), CARROT_SHOOTER(MemoryOffset.CARROT_SHOOTER,"Carrot Shooter","carrot_shooter.png",true), SUPER_CARROT(MemoryOffset.SUPER_CARROT,"Super Carrot","super_carrot.png",true), + GOLD_CARROT(MemoryOffset.GOLD_CARROT,"Gold Carrot","gold_carrot.png",true), /*DLC_ITEM1(MemoryOffset.DLC_ITEM1,"","",true), DLC_ITEM2(MemoryOffset.DLC_ITEM2,"","",true), DLC_ITEM4(MemoryOffset.DLC_ITEM4,"","",true),*/ @@ -102,4 +103,4 @@ public enum MemoryData { public String getDisplayName() { return (key_item)?name:name+" Badge"; } -} +} \ No newline at end of file diff --git a/src/sig/modules/RabiRace/Profile.java b/src/sig/modules/RabiRace/Profile.java index c512f7c..83ea1a3 100644 --- a/src/sig/modules/RabiRace/Profile.java +++ b/src/sig/modules/RabiRace/Profile.java @@ -49,13 +49,16 @@ public class Profile { RabiRaceModule parent; public long lastWebUpdate = System.currentTimeMillis(); DecimalFormat df = new DecimalFormat("0.0"); - Profile oldProfile; + public Profile oldProfile; public boolean isArchive = false; final static Color TEAL = new Color(0,128,128); public Image statUpdateCacheImage; public Image imageDisplayUpdateImage; public boolean stat_update_required = true; public boolean image_display_update_required = true; + public int avatarval = 0; + public static Image rainbowEggImage; + public static Image darkRainbowEggImage; public Profile(RabiRaceModule module) { this(module,true); @@ -83,35 +86,71 @@ public class Profile { oldProfile.key_items = (LinkedHashMap)key_items.clone(); oldProfile.badges = (LinkedHashMap)badges.clone(); oldProfile.playtime = playtime; + oldProfile.difficulty = difficulty; + oldProfile.loop = loop; + oldProfile.itempct = itempct; + oldProfile.mappct = mappct; + } + + public int compareAllChangedStatValues() { + int count=0; + if (oldProfile.playtime/60!=playtime/60 || + oldProfile.avatarval!=avatar.value || + oldProfile.isPaused!=isPaused || + oldProfile.difficulty!=difficulty || + oldProfile.loop!=loop || + oldProfile.itempct!=itempct || + oldProfile.mappct!=mappct) { + System.out.println("Something has changed."); + count++; + } else { + System.out.println("All values are the same... "+oldProfile.playtime+","+playtime+"|" + +oldProfile.avatarval+","+avatar.value+"|"+oldProfile.isPaused+","+isPaused+"|" + +oldProfile.difficulty+","+difficulty+"|"+oldProfile.loop+","+loop+"|" + +oldProfile.itempct+","+itempct+"|"+oldProfile.mappct+","+mappct+"|"); + } + return count; } public int compareAllChangedValues() { int count=0; if (oldProfile.healthUps!=healthUps) { count++; + //System.out.println("Health ups changed. "+(healthUps-oldProfile.healthUps)); } if (oldProfile.attackUps!=attackUps) { count++; + //System.out.println("Attack ups changed. "+(attackUps-oldProfile.attackUps)); } if (oldProfile.manaUps!=manaUps) { count++; + //System.out.println("Mana ups changed. "+(manaUps-oldProfile.manaUps)); } if (oldProfile.regenUps!=regenUps) { count++; + //System.out.println("Regen ups changed. "+(regenUps-oldProfile.regenUps)); } if (oldProfile.packUps!=packUps) { count++; + //System.out.println("Pack ups changed. "+(packUps-oldProfile.packUps)); } if (oldProfile.rainbowEggCount!=rainbowEggCount) { + //System.out.println("Rainbow Egg Count changed. "+(rainbowEggCount-oldProfile.rainbowEggCount)); count++; } for (MemoryData md : key_items.keySet()) { if ((!oldProfile.key_items.containsKey(md) && - key_items.containsKey(md)) || ( + key_items.containsKey(md)) || (( oldProfile.key_items.containsKey(md) && key_items.containsKey(md)) && - oldProfile.key_items.get(md)!=key_items.get(md) + oldProfile.key_items.get(md).compareTo(key_items.get(md))!=0) ) { + /*if (!oldProfile.key_items.containsKey(md) && + key_items.containsKey(md)) { + System.out.println("Key item difference: "+(md)); + } else { + System.out.println("Key item value difference: "+md+":"+(oldProfile.key_items.get(md)+"->"+key_items.get(md))); + }*/ count++; } } @@ -120,8 +159,14 @@ public class Profile { badges.containsKey(md)) || ( oldProfile.badges.containsKey(md) && badges.containsKey(md)) && - oldProfile.badges.get(md)!=badges.get(md) + oldProfile.badges.get(md).compareTo(badges.get(md))!=0 ) { + /*if (!oldProfile.badges.containsKey(md) && + badges.containsKey(md)) { + System.out.println("Badge difference: "+(md)); + } else { + System.out.println("Badge value difference: "+md+":"+(oldProfile.badges.get(md)+"->"+badges.get(md))); + }*/ count++; } } @@ -339,7 +384,7 @@ public class Profile { g2.setColor(Color.BLACK); //g2.fillRect(1, 1, 32, 32); - g2.drawImage(avatar.getAvatarImage(), 1, 1, sigIRC.panel); + g2.drawImage(avatar.getAvatarImage(), 1, 1, parent.panel); g2.setColor(ScrollingText.GetUserNameColor(displayName)); DrawUtils.drawOutlineText(g2, sigIRC.rabiRibiMoneyDisplayFont, 54, 26, 1, g2.getColor(), Color.BLACK, displayName); DrawUtils.drawCenteredOutlineText(g2, sigIRC.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.2), 50, 1, GetDifficultyColor(), Color.BLACK, GetDifficultyName()); @@ -354,8 +399,13 @@ public class Profile { //DrawUtils.drawOutlineText(g2, sigIRC.panel.rabiRibiMoneyDisplayFont, (int)(parent.position.getWidth() - TextUtils.calculateStringBoundsFont(text, sigIRC.panel.rabiRibiMoneyDisplayFont).getWidth()) - 2, 16, 1, g2.getColor(), Color.GRAY, text); DrawUtils.drawCenteredOutlineText(g2, sigIRC.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.6), 50, 2, Color.WHITE, Color.BLACK, text); + if (statUpdateCacheImage!=null) { + statUpdateCacheImage.flush(); + } + g2.dispose(); statUpdateCacheImage = tmp.getScaledInstance(w, -1, Image.SCALE_AREA_AVERAGING); - //stat_update_required = false; + stat_update_required = false; + System.out.println("Updated stat text for user "+username+"."); } return statUpdateCacheImage; @@ -398,6 +448,108 @@ public class Profile { } return diffstring; } + + public Image getRainbowEggPanel(int w, Session session) { + BufferedImage tmp = new BufferedImage(400,175,BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = tmp.createGraphics(); + if (Profile.darkRainbowEggImage==null) { + Profile.darkRainbowEggImage = DrawUtils.getBlendedImage(g2, RabiRaceModule.image_map.get("easter_egg.png"), new Color(0,0,0,192), RabiRaceModule.window); + Profile.rainbowEggImage = DrawUtils.getBlendedImage(g2, RabiRaceModule.image_map.get("easter_egg.png"), RabiRaceModule.rainbowcycler.getCycleColor(), RabiRaceModule.window); + } else { + Profile.rainbowEggImage.flush(); + Profile.rainbowEggImage = DrawUtils.getBlendedImage(g2, RabiRaceModule.image_map.get("easter_egg.png"), RabiRaceModule.rainbowcycler.getCycleColor(), RabiRaceModule.window); + //System.out.println("Rainbow egg color is "+RabiRaceModule.rainbowcycler.getCycleColor()); + } + //DrawUtils.drawTextFont(g, sigIRC.panel.userFont, parent.position.getX(), parent.position.getY()+26, Color.BLACK, "Values: "+readIntFromMemory(MemoryOffset.DLC_ITEM1)+","+readIntFromMemory(MemoryOffset.DLC_ITEM2)+","+readIntFromMemory(MemoryOffset.DLC_ITEM3)+","+readIntFromMemory(MemoryOffset.DLC_ITEM4)); + final int border=20; + final int width=(int)(tmp.getWidth()-border*2); + int spacing=width/5; + int shiftyval = 0; + double iconsize = 1; + final int icon_size = 24; + int rainbowEggLimit = 0; + + int gamemode = -1; + if (RabiRaceModule.mySession!=null) { + gamemode = RabiRaceModule.mySession.gamemode; + } + + if (gamemode!=-1) { + switch (gamemode) { + case 0:{ //Egg Hunt. + if (session.eggCount>0) { + spacing = width/session.eggCount; + rainbowEggLimit = session.eggCount; + } else { + spacing = width/5; + rainbowEggLimit = session.eggCount; + } + //Image img = RabiRaceModule.image_map.get("easter_egg.png"); + for (int i=0;ii)?RabiRaceModule.rainbowcycler.getCycleColor():new Color(0,0,0,192); + //DrawUtils.drawImage(g2, img, (int)(border+i*spacing-img.getWidth(parent.panel)/4),(int)(36),col,parent.panel); + Image img; + if (rainbowEggCount>i) { + img = Profile.rainbowEggImage; + } else { + img = Profile.darkRainbowEggImage; + } + g2.drawImage(img, (int)(border+i*spacing-img.getWidth(parent.panel)/4),(int)(36), parent.panel); + } + }break; + } + } else { + shiftyval = -RabiRaceModule.image_map.get("easter_egg.png").getWidth(parent.panel)/2; + iconsize = 1; + } + /* + { + Image img = RabiRaceModule.image_map.get("easter_egg.png"); + Color col = RabiRaceModule.rainbowcycler.getCycleColor(); + DrawUtils.drawImage(g2, img, (int)(border+((1.5)*spacing)-img.getWidth(sigIRC.panel)/4),(int)(36),col,sigIRC.panel); + DrawUtils.drawCenteredOutlineText(g2, sigIRC.panel.programFont, (int)(border+((3)*spacing)-img.getWidth(sigIRC.panel)/4),(int)12+img.getHeight(sigIRC.panel), 1, Color.WHITE, Color.BLUE,"x"+rainbowEggCount); + } + */ + int size = key_items.size(); + int count = 0; + try { + int i=0; + Image[] imgs = new Image[]{RabiRaceModule.image_map.get("health_up.png"), + RabiRaceModule.image_map.get("mana_up.png"), + RabiRaceModule.image_map.get("regen_up.png"), + RabiRaceModule.image_map.get("pack_up.png"), + RabiRaceModule.image_map.get("attack_up.png")}; + int[] amts = new int[]{ + healthUps, + manaUps, + regenUps, + packUps, + attackUps, + }; + if (rainbowEggCount>rainbowEggLimit) { + imgs = Arrays.copyOf(imgs, imgs.length+1); + imgs[imgs.length-1] = RabiRaceModule.image_map.get("easter_egg.png"); + amts = Arrays.copyOf(amts, amts.length+1); + amts[amts.length-1] = rainbowEggCount; + spacing = width/6; + } + //g2.drawImage(RabiRaceModule.image_map.get("bunny_strike.png"),(int)(+border+(i++)*(spacing)-img2.getWidth(sigIRC.panel)/4),(int)(+96+56), (int)icon_size, (int)icon_size, sigIRC.panel); + int counting=0; + for (Image img : imgs) { + if (counting++==5) { + g2.drawImage(img, (int)(+border+((i)*(spacing))-icon_size/2),(int)(+96+56)+shiftyval,(int)icon_size,(int)icon_size,parent.panel); + //DrawUtils.drawImageScaled(g2, img,(int)(+border+((i)*(spacing))-icon_size/2),(int)(+96+56)+shiftyval, (int)icon_size, (int)icon_size, RabiRaceModule.rainbowcycler.getCycleColor(), parent.panel); + } + DrawUtils.drawCenteredOutlineText(g2, sigIRC.programFont, (int)((+border+((i)*(spacing))-icon_size/2)+(spacing/2)+4), (int)(+96+56+icon_size+12)+shiftyval, 1, Color.WHITE, Color.BLUE, Integer.toString(amts[i++])); + } + } catch (ConcurrentModificationException e) { + + } + g2.dispose(); + //g.drawImage(tmp, (int)parent.position.getX(), (int)parent.position.getY(), 120, 64, sigIRC.panel); + //image_display_update_required=false; + //System.out.println("Updated Image Display for user "+username+"."); + } public Image getStatPanel(int w, Session session) { @@ -428,10 +580,17 @@ public class Profile { spacing = width/5; rainbowEggLimit = session.eggCount; } - Image img = RabiRaceModule.image_map.get("easter_egg.png"); + //Image img = RabiRaceModule.image_map.get("easter_egg.png"); for (int i=0;ii)?RabiRaceModule.rainbowcycler.getCycleColor():new Color(0,0,0,192); - DrawUtils.drawImage(g2, img, (int)(border+i*spacing-img.getWidth(sigIRC.panel)/4),(int)(36),col,sigIRC.panel); + //Color col = (rainbowEggCount>i)?RabiRaceModule.rainbowcycler.getCycleColor():new Color(0,0,0,192); + //DrawUtils.drawImage(g2, img, (int)(border+i*spacing-img.getWidth(parent.panel)/4),(int)(36),col,parent.panel); + Image img; + if (rainbowEggCount>i) { + img = Profile.rainbowEggImage; + } else { + img = Profile.darkRainbowEggImage; + } + g2.drawImage(img, (int)(border+i*spacing-img.getWidth(parent.panel)/4),(int)(36), parent.panel); } }break; case 1:{ //Item Hunt. @@ -443,16 +602,16 @@ public class Profile { (badges.containsKey(item) && badges.get(item)>=1)) { //DrawUtils.drawImage(g2, item.getImage(), (int)(border+i*spacing-item.getImage().getWidth(sigIRC.panel)/4),(int)(36),col,sigIRC.panel); - g2.drawImage(item.getImage(), (int)(border+i*spacing),(int)(36+16), icon_size*2, icon_size*2, sigIRC.panel); + g2.drawImage(item.getImage(), (int)(border+i*spacing),(int)(36+16), icon_size*2, icon_size*2, parent.panel); } else { - DrawUtils.drawImageScaled(g2, item.getImage(), (int)(border+i*spacing),(int)(36+16),icon_size*2, icon_size*2,new Color(0,0,0,192),sigIRC.panel); + DrawUtils.drawImageScaled(g2, item.getImage(), (int)(border+i*spacing),(int)(36+16),icon_size*2, icon_size*2,new Color(0,0,0,192),parent.panel); } } spacing=width/5; }break; } } else { - shiftyval = -RabiRaceModule.image_map.get("easter_egg.png").getWidth(sigIRC.panel)/2; + shiftyval = -RabiRaceModule.image_map.get("easter_egg.png").getWidth(parent.panel)/2; iconsize = 1; } /* @@ -470,15 +629,15 @@ public class Profile { if (key_items.get(data)<0) { Image img = data.getImage().getScaledInstance(icon_size, icon_size, Image.SCALE_DEFAULT); if (size*icon_size key_items_list = new ArrayList(); public static List badges_list = new ArrayList(); - public RabiRaceModule(Rectangle2D bounds, String moduleName) { + public RabiRaceModule(Rectangle bounds, String moduleName) { super(bounds, moduleName); //Initialize(); Initialize(); @@ -281,8 +282,11 @@ public class RabiRaceModule extends Module{ } public void run() { + super.run(); if (foundRabiRibi) { rainbowcycler.run(); + //Profile.rainbowEggImage.flush(); + //Profile.rainbowEggImage = DrawUtils.getBlendedImage(RabiRaceModule.module.panel.getGraphics().create(), RabiRaceModule.image_map.get("easter_egg.png"), RabiRaceModule.rainbowcycler.getCycleColor(), RabiRaceModule.window); if (window!=null) { window.run(); } @@ -302,6 +306,7 @@ public class RabiRaceModule extends Module{ //System.out.println("Called."); int paused = readIntFromMemory(MemoryOffset.PAUSED); float itempct = readFloatFromMemory(MemoryOffset.ITEM_PERCENT); + myProfile.oldProfile.isPaused = myProfile.isPaused; myProfile.isPaused = paused==1; //System.out.println(itempct+","+paused); if (paused==0 && itempct>=0) { @@ -324,8 +329,16 @@ public class RabiRaceModule extends Module{ if (myProfile.compareAllChangedValues()>0) { myProfile.image_display_update_required=true; } - myProfile.stat_update_required=true; + if (myProfile.compareAllChangedStatValues()>0) { + myProfile.stat_update_required=true; + } + myProfile.oldProfile.avatarval = myProfile.avatar.value; firstUpdate=false; + } else + if (myProfile.compareAllChangedStatValues()>0) { + myProfile.archiveAllValues(); + myProfile.oldProfile.avatarval = myProfile.avatar.value; + myProfile.stat_update_required=true; } if (mySession!=null) { for (Profile p : mySession.getPlayers()) { @@ -342,8 +355,13 @@ public class RabiRaceModule extends Module{ public void ApplyConfigWindowProperties() { sigIRC.rabiracemodule_X=(int)position.getX(); sigIRC.rabiracemodule_Y=(int)position.getY(); + sigIRC.rabiracemodule_width=(int)position.getWidth(); + sigIRC.rabiracemodule_height=(int)position.getHeight(); sigIRC.config.setInteger("RABIRACE_module_X", sigIRC.rabiracemodule_X); sigIRC.config.setInteger("RABIRACE_module_Y", sigIRC.rabiracemodule_Y); + sigIRC.config.setInteger("RABIRACE_module_width", sigIRC.rabiracemodule_width); + sigIRC.config.setInteger("RABIRACE_module_height", sigIRC.rabiracemodule_height); + sigIRC.config.saveProperties(); } /*public int readIntFromErinaData(MemoryOffset val) { @@ -439,29 +457,29 @@ public class RabiRaceModule extends Module{ super.draw(g); if (!foundRabiRibi) { - DrawUtils.drawTextFont(g, sigIRC.userFont, position.getX(), position.getY()+26, Color.BLACK, "Rabi-Ribi not found! Please start it."); + DrawUtils.drawTextFont(g, sigIRC.userFont, 0, 0+26, Color.BLACK, "Rabi-Ribi not found! Please start it."); } else { //myProfile.draw(g); - Image panel = myProfile.getStatPanel((int)position.getWidth(),mySession); - - if (sigIRC.panel.lastMouseX>=position.getX() && - sigIRC.panel.lastMouseX<=position.getX()+(int)((position.getWidth()/400)*50) && - sigIRC.panel.lastMouseY>=position.getY() && - sigIRC.panel.lastMouseY<=position.getY()+(int)(((position.getWidth()/400)*50))) { + Image panel = myProfile.getStatPanel((int)position.getWidth()-24,mySession); + //System.out.println(ProgramWindow.frame.lastMouseX+","+ProgramWindow.frame.lastMouseY+";"+position.getX()+","+position.getY()); + if (ProgramWindow.frame.lastMouseX>=position.getX() && + ProgramWindow.frame.lastMouseX<=position.getX()+(int)((position.getWidth()/400)*50) && + ProgramWindow.frame.lastMouseY>=position.getY()+Module.WINDOW_EXTRA_BORDER && + ProgramWindow.frame.lastMouseY<=position.getY()+Module.WINDOW_EXTRA_BORDER+(int)(((position.getWidth()/400)*50))) { mouseoverAvatar=true; Color ident = g.getColor(); g.setColor(new Color(196,196,196,128)); - g.fillRect((int)(position.getX()+1), (int)(position.getY()+1), (int)((position.getWidth()/400)*50), (int)((position.getWidth()/400)*50)); + g.fillRect((int)(0+1), (int)(0+1), (int)((position.getWidth()/400)*50), (int)((position.getWidth()/400)*50)); g.setColor(ident); //System.out.println("Mouse over avatar."); } else { mouseoverAvatar=false; } - g.drawImage(panel, (int)position.getX(), (int)position.getY(), sigIRC.panel); - g.drawImage(myProfile.getStatText((int)position.getWidth(),mySession), (int)position.getX(), (int)position.getY(), sigIRC.panel); + g.drawImage(panel, (int)0, (int)0, module.panel); + g.drawImage(myProfile.getStatText((int)position.getWidth()-24,mySession), (int)0, (int)0, module.panel); - //Profile.DrawMultiPanel(g, (int)(position.getX()), (int)(position.getY())+panel.getHeight(sigIRC.panel), (int)position.getWidth(), testing); + //Profile.DrawMultiPanel(g, (int)(0), (int)(0)+panel.getHeight(sigIRC.panel), (int)position.getWidth(), testing); if (mySession!=null) { List sessionPlayers = new ArrayList(); for (Profile p : mySession.getPlayers()) { @@ -470,7 +488,7 @@ public class RabiRaceModule extends Module{ //System.out.println("Found unique player "+p); } } - Profile.DrawMultiPanel(g, (int)(position.getX()), (int)(position.getY())+panel.getHeight(sigIRC.panel), (int)position.getWidth(), mySession); + Profile.DrawMultiPanel(g, (int)(0), (int)(0)+panel.getHeight(module.panel), (int)position.getWidth()-24, mySession); } if (firstCheck) { @@ -480,7 +498,7 @@ public class RabiRaceModule extends Module{ } } g.setColor(Color.BLACK); - g.fillRect((int)(position.getX()), (int)(position.getY()+position.getHeight()-28-20), (int)(position.getWidth()), 20); + g.fillRect((int)(0), (int)(0+position.getHeight()-28-20), (int)(position.getWidth()), 20); for (int i=0;i{ + File updatedir = new File(sigIRC.BASEDIR+"sigIRC/updates/"); + updatedir.mkdirs(); + File controllerdir = new File(ControllerModule.CONTROLLERPATH); + controllerdir.mkdirs(); + File programFile = new File(sigIRC.BASEDIR+"sigIRC/updates/sigIRCv2.jar"); + File currentProgramFile = new File(sigIRC.BASEDIR+"sigIRCv2.jar"); + System.out.println("File size is "+currentProgramFile.length()); + long fileSize = GithubUtils.getSizeOfFileFromLatestGithubCommit("sigIRCv2.jar"); + System.out.println("File size on Github is "+fileSize); + if (fileSize!=programFile.length()) { + System.out.println("File size on Github varies from currently running program... Downloading new program."); + try { + if (programFile.exists()) { + programFile.delete(); + } + org.apache.commons.io.FileUtils.copyURLToFile(new URL(sigIRC.PROGRAM_EXECUTABLE_URL),programFile); + sigIRC.updateAvailable=true; + } catch (IOException e) { + e.printStackTrace(); } - org.apache.commons.io.FileUtils.copyURLToFile(new URL(sigIRC.PROGRAM_EXECUTABLE_URL),programFile); - sigIRC.updateAvailable=true; - } catch (IOException e) { - e.printStackTrace(); } - } + }); + t.start(); } } diff --git a/src/sig/utils/DrawUtils.java b/src/sig/utils/DrawUtils.java index 423e7ce..cf151cc 100644 --- a/src/sig/utils/DrawUtils.java +++ b/src/sig/utils/DrawUtils.java @@ -106,6 +106,17 @@ public class DrawUtils { } } + public static Image getBlendedImage(Graphics g, Image img, Color blend_col, ImageObserver source) { + BufferedImage tmp = new BufferedImage(img.getWidth(source),img.getHeight(source),BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = tmp.createGraphics(); + g2.drawImage(img, 0, 0, null); + g2.setComposite(AlphaComposite.SrcAtop); + g2.setColor(blend_col); + g2.fillRect(0, 0, img.getWidth(source), img.getHeight(source)); + g2.dispose(); + return tmp; + } + public static void drawImage(Graphics g, Image img, double x, double y, Color blend_col, ImageObserver source) { BufferedImage tmp = new BufferedImage(img.getWidth(source),img.getHeight(source),BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = tmp.createGraphics(); diff --git a/src/sig/windows/IntroDialog.java b/src/sig/windows/IntroDialog.java index 1d4e9a8..55c7ef6 100644 --- a/src/sig/windows/IntroDialog.java +++ b/src/sig/windows/IntroDialog.java @@ -108,6 +108,7 @@ public class IntroDialog extends JFrame{ e.printStackTrace(); } + moduleButtons = new ModuleButton[]{ new ModuleButton("Scrolling Chat"), new ModuleButton("Chat Log"), diff --git a/src/sig/windows/ModuleButton.java b/src/sig/windows/ModuleSelectButton.java similarity index 85% rename from src/sig/windows/ModuleButton.java rename to src/sig/windows/ModuleSelectButton.java index 3b934db..ec29ffb 100644 --- a/src/sig/windows/ModuleButton.java +++ b/src/sig/windows/ModuleSelectButton.java @@ -10,11 +10,11 @@ import javax.swing.event.ChangeListener; import sig.Module; @SuppressWarnings("serial") -class ModuleButton extends JToggleButton{ +class ModuleSelectButton extends JToggleButton{ String label = ""; - ModuleButton button; + ModuleSelectButton button; Module myModule; - public ModuleButton(String label, Module module) { + public ModuleSelectButton(String label, Module module) { this.label=label; this.button=this; this.myModule=module; diff --git a/src/sig/windows/ProgramWindow.java b/src/sig/windows/ProgramWindow.java index 3b69d94..30812e7 100644 --- a/src/sig/windows/ProgramWindow.java +++ b/src/sig/windows/ProgramWindow.java @@ -3,6 +3,7 @@ package sig.windows; import java.awt.Color; import java.awt.GridLayout; import java.awt.Image; +import java.awt.MouseInfo; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.io.File; @@ -33,6 +34,7 @@ import sig.Module; import sig.MyPanel; import sig.sigIRC; import sig.modules.ChatLogModule; +import sig.modules.RabiRaceModule; import sig.modules.ScrollingChatModule; @SuppressWarnings("serial") @@ -40,9 +42,16 @@ public class ProgramWindow extends JFrame{ public static Icon deselected_icon,selected_icon; - List buttons = new ArrayList(); + List buttons = new ArrayList(); + + public int lastMouseX = 0; + + public int lastMouseY = 0; + + public static ProgramWindow frame; public ProgramWindow() { + ProgramWindow.frame=this; ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleWithFixedDelay(()->{ if (sigIRC.configNeedsUpdating>0 && @@ -51,6 +60,10 @@ public class ProgramWindow extends JFrame{ sigIRC.configNeedsUpdating=0; } },1000,1000,TimeUnit.MILLISECONDS); + scheduler.scheduleWithFixedDelay(()->{ + lastMouseX = (int)(MouseInfo.getPointerInfo().getLocation().getX()); + lastMouseY = (int)(MouseInfo.getPointerInfo().getLocation().getY()); + },(long)((1d/(sigIRC.framerate+1))*1000),(long)((1d/(sigIRC.framerate+1))*1000),TimeUnit.MILLISECONDS); try { sigIRC.programIcon = ImageIO.read(sigIRC.class.getResource("/resource/sigIRCicon.png")); @@ -69,6 +82,7 @@ public class ProgramWindow extends JFrame{ JFrame.setDefaultLookAndFeelDecorated(true); } System.setProperty("sun.java2d.opengl", Boolean.toString(sigIRC.hardwareAcceleration)); + System.setProperty("sun.java2d.d3d",Boolean.toString(true)); JFrame f = new JFrame("sigIRCv2"); this.setAutoRequestFocus(true); this.toFront(); @@ -93,28 +107,29 @@ public class ProgramWindow extends JFrame{ if (!sigIRC.disableChatMessages) { ScrollingChatModule mod = new ScrollingChatModule(new Rectangle((int)sigIRC.scrollingchatmodule_X,(int)sigIRC.scrollingchatmodule_Y,(int)sigIRC.scrollingchatmodule_width,(int)sigIRC.scrollingchatmodule_height),"Scrolling Chat"); - ModuleButton button = new ModuleButton("Scrolling Chat",mod); + ModuleSelectButton button = new ModuleSelectButton("Scrolling Chat",mod); sigIRC.panel.add(button); } if (sigIRC.chatlogmodule_enabled) { ChatLogModule mod = new ChatLogModule(new Rectangle(sigIRC.chatlogmodule_X,sigIRC.chatlogmodule_Y,sigIRC.chatlogmodule_width,sigIRC.chatlogmodule_height),"Chat Log"); - ModuleButton button = new ModuleButton("Chat Log",mod); + ModuleSelectButton button = new ModuleSelectButton("Chat Log",mod); sigIRC.panel.add(button); } if (sigIRC.controllermodule_enabled) { - ModuleButton button = new ModuleButton("Controller",new Module(new Rectangle(0,0,0,0),"Test")); + ModuleSelectButton button = new ModuleSelectButton("Controller",new Module(new Rectangle(0,0,0,0),"Test")); sigIRC.panel.add(button); } if (sigIRC.twitchmodule_enabled) { - ModuleButton button = new ModuleButton("Twitch",new Module(new Rectangle(0,0,0,0),"Test")); + ModuleSelectButton button = new ModuleSelectButton("Twitch",new Module(new Rectangle(0,0,0,0),"Test")); sigIRC.panel.add(button); } if (sigIRC.rabiracemodule_enabled) { - ModuleButton button = new ModuleButton("Rabi-Race",new Module(new Rectangle(0,0,0,0),"Test")); + RabiRaceModule mod = new RabiRaceModule(new Rectangle((int)sigIRC.rabiracemodule_X,(int)sigIRC.rabiracemodule_Y,(int)sigIRC.rabiracemodule_width,(int)sigIRC.rabiracemodule_height),"Rabi Race"); + ModuleSelectButton button = new ModuleSelectButton("Rabi-Race",mod); sigIRC.panel.add(button); } if (sigIRC.touhoumothermodule_enabled) { - ModuleButton button = new ModuleButton("Touhou Mother",new Module(new Rectangle(0,0,0,0),"Test")); + ModuleSelectButton button = new ModuleSelectButton("Touhou Mother",new Module(new Rectangle(0,0,0,0),"Test")); sigIRC.panel.add(button); } GridLayout myLayout = new GridLayout(0,1); @@ -133,7 +148,8 @@ public class ProgramWindow extends JFrame{ //this.add(colorpanel); this.setLocationByPlatform(true); this.add(sigIRC.panel); - this.pack(); + //this.pack(); + this.setSize(240, 640); this.setVisible(true); //this.setLocation(sigIRC.windowX, sigIRC.windowY); //this.setSize(sigIRC.windowWidth, sigIRC.windowHeight);