Add "substitute" images for images that cannot be found/downloaded.

Offline compatibility mode in progress.
beta
sigonasr2 7 years ago
parent 3d60722f68
commit 18f80ff87e
  1. 24
      sigIRCv2/.classpath
  2. 2
      sigIRCv2/sigIRCv2.bat
  3. BIN
      sigIRCv2/sigIRCv2.jar
  4. 11
      sigIRCv2/src/sig/Module.java
  5. 12
      sigIRCv2/src/sig/modules/Controller/ControlConfigurationWindow.java
  6. 9
      sigIRCv2/src/sig/modules/ControllerModule.java
  7. 8
      sigIRCv2/src/sig/modules/RabiRaceModule.java
  8. 81
      sigIRCv2/src/sig/modules/RabiRibiModule.java
  9. 27
      sigIRCv2/src/sig/modules/TouhouMotherModule.java
  10. 13
      sigIRCv2/src/sig/modules/Twitch/FancyNumber.java
  11. 42
      sigIRCv2/src/sig/modules/TwitchModule.java
  12. 37
      sigIRCv2/src/sig/sigIRC.java

@ -3,17 +3,17 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="lib"/> <classpathentry kind="src" path="lib"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/commons-io-2.5.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/commons-io-2.5.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/jna-4.5.0.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/jna-4.5.0.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/jna-platform-4.5.0.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/jna-platform-4.5.0.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-glfw.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-glfw.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-glfw-natives-linux.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-glfw-natives-linux.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-glfw-natives-macos.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-glfw-natives-macos.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-glfw-natives-windows.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-glfw-natives-windows.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-natives-linux.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-natives-linux.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-natives-macos.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-natives-macos.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/lwjgl-natives-windows.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/lwjgl-natives-windows.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/sigIRCv2-master/sigIRCv2/lib/twitch-api-wrapper-0.3-jar-with-dependencies.jar"/> <classpathentry kind="lib" path="C:/Users/sigon/git/sigIRCv2/sigIRCv2/lib/twitch-api-wrapper-0.3-jar-with-dependencies.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

@ -1,2 +1,2 @@
cd "C:\Users\Joshua Sigona\git\sigIRCv2\" cd "C:\Users\Joshua Sigona\git\sigIRCv2\"
java -jar sigIRCv2.jar > log java -jar sigIRCv2.jar

Binary file not shown.

@ -2,6 +2,7 @@ package sig;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -21,8 +22,8 @@ public class Module {
public Rectangle2D position; public Rectangle2D position;
protected boolean enabled; protected boolean enabled;
protected String name; protected String name;
public static BufferedImage IMG_DRAGBAR; public static Image IMG_DRAGBAR;
public static BufferedImage MSG_SEPARATOR; public static Image MSG_SEPARATOR;
public static boolean inDragZone=false; public static boolean inDragZone=false;
final protected int titleHeight; final protected int titleHeight;
@ -62,7 +63,7 @@ public class Module {
public boolean inDragBounds(int x, int y) { public boolean inDragBounds(int x, int y) {
return x>=position.getX() && x<=position.getX()+position.getWidth() && return x>=position.getX() && x<=position.getX()+position.getWidth() &&
y>=(int)position.getY()-Module.IMG_DRAGBAR.getHeight() && y>=(int)position.getY()-Module.IMG_DRAGBAR.getHeight(sigIRC.panel) &&
y<=(int)position.getY(); y<=(int)position.getY();
} }
@ -144,9 +145,9 @@ public class Module {
if (!sigIRC.overlayMode) { if (!sigIRC.overlayMode) {
g.drawImage(Module.IMG_DRAGBAR, g.drawImage(Module.IMG_DRAGBAR,
(int)position.getX()+2, (int)position.getX()+2,
(int)position.getY()-Module.IMG_DRAGBAR.getHeight(), (int)position.getY()-Module.IMG_DRAGBAR.getHeight(sigIRC.panel),
(int)position.getWidth()-4, (int)position.getWidth()-4,
Module.IMG_DRAGBAR.getHeight(), Module.IMG_DRAGBAR.getHeight(sigIRC.panel),
sigIRC.panel); sigIRC.panel);
DrawUtils.drawTextFont(g, sigIRC.panel.smallFont, (int)position.getX(), (int)position.getY()-titleHeight/2+4, Color.BLACK, this.name); DrawUtils.drawTextFont(g, sigIRC.panel.smallFont, (int)position.getX(), (int)position.getY()-titleHeight/2+4, Color.BLACK, this.name);
//g.fillRect((int)position.getX(), (int)position.getY(), (int)position.getWidth(), (int)position.getHeight()); //g.fillRect((int)position.getX(), (int)position.getY(), (int)position.getWidth(), (int)position.getHeight());

@ -268,21 +268,13 @@ public class ControlConfigurationWindow extends JFrame implements WindowListener
JPanel selectionPanel1 = new JPanel(){ JPanel selectionPanel1 = new JPanel(){
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
try { g.drawImage(sigIRC.readImage(ControllerModule.CONTROLLERPATH+"4-way_axis.png"), 0, 0, this);
g.drawImage(ImageIO.read(new File(ControllerModule.CONTROLLERPATH+"4-way_axis.png")), 0, 0, this);
} catch (IOException e) {
e.printStackTrace();
}
} }
}; };
JPanel selectionPanel2 = new JPanel(){ JPanel selectionPanel2 = new JPanel(){
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
try { g.drawImage(sigIRC.readImage(ControllerModule.CONTROLLERPATH+"2-way_axis.png"), 0, 0, this);
g.drawImage(ImageIO.read(new File(ControllerModule.CONTROLLERPATH+"2-way_axis.png")), 0, 0, this);
} catch (IOException e) {
e.printStackTrace();
}
} }
}; };
//selectionPanel.setLayout(new BoxLayout(selectionPanel,BoxLayout.LINE_AXIS)); //selectionPanel.setLayout(new BoxLayout(selectionPanel,BoxLayout.LINE_AXIS));

@ -92,13 +92,8 @@ public class ControllerModule extends Module{
} }
} }
controllers.addAll(ca); controllers.addAll(ca);
try { controller_img = sigIRC.readImage(CONTROLLERPATH+"controller_template.png").getScaledInstance((int)position.getWidth(), -1, 0);
controller_img = ImageIO.read(new File(CONTROLLERPATH+"controller_template.png")).getScaledInstance((int)position.getWidth(), -1, 0); controller_overlay_img = sigIRC.readImage(CONTROLLERPATH+"controller_overlay.png").getScaledInstance((int)position.getWidth(), -1, 0);
controller_overlay_img = ImageIO.read(new File(CONTROLLERPATH+"controller_overlay.png")).getScaledInstance((int)position.getWidth(), -1, 0);
//System.out.println("Size of controller: "+controller_img.getWidth(sigIRC.panel)+","+controller_img.getHeight(sigIRC.panel));
} catch (IOException e) {
e.printStackTrace();
}
//buttons.add(new Button(0.1,0.05,0.1,0.05,controllers.get(0),Identifier.Button._3,Color.RED,this)); //buttons.add(new Button(0.1,0.05,0.1,0.05,controllers.get(0),Identifier.Button._3,Color.RED,this));
LoadButtonAndAxisData(); LoadButtonAndAxisData();
click_buttons.add(new AddClickableButton(new Rectangle( click_buttons.add(new AddClickableButton(new Rectangle(

@ -140,12 +140,8 @@ public class RabiRaceModule extends Module{
} }
images = filtered_images.toArray(new String[filtered_images.size()]); images = filtered_images.toArray(new String[filtered_images.size()]);
for (String image : images) { for (String image : images) {
try { //System.out.println("Loaded "+image);
//System.out.println("Loaded "+image); image_map.put(image, sigIRC.readImage(ITEMS_DIRECTORY+image));
image_map.put(image, ImageIO.read(new File(ITEMS_DIRECTORY+image)));
} catch (IOException e) {
e.printStackTrace();
}
} }
for (MemoryData md : MemoryData.values()) { for (MemoryData md : MemoryData.values()) {

@ -83,10 +83,30 @@ public class RabiRibiModule extends Module{
private void Initialize() { private void Initialize() {
RabiUtils.module = this; RabiUtils.module = this;
CheckRabiRibiClient();
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleWithFixedDelay(()->{
CheckRabiRibiClient();
}, 5000, 5000, TimeUnit.MILLISECONDS);
this.overlay = new Overlay(this);
EntityLookupData.parent=this;
EntityLookupData.loadEntityLookupData(lookup_table);
ScheduledExecutorService scheduler2 = Executors.newScheduledThreadPool(1);
scheduler2.scheduleWithFixedDelay(()->{
UpdateEntities();
//System.out.println("Called Entity creation "+callcount+" times.");
}, 1000, 1000, TimeUnit.MILLISECONDS);
}
private void CheckRabiRibiClient() {
List<Integer> pids; List<Integer> pids;
try { try {
pids = PsapiTools.getInstance().enumProcesses(); pids = PsapiTools.getInstance().enumProcesses();
boolean found=false;
for (Integer pid : pids) { for (Integer pid : pids) {
HANDLE process = Kernel32.INSTANCE.OpenProcess(PROCESS_PERMISSIONS, true, pid); HANDLE process = Kernel32.INSTANCE.OpenProcess(PROCESS_PERMISSIONS, true, pid);
List<sig.modules.utils.Module> hModules; List<sig.modules.utils.Module> hModules;
@ -95,38 +115,35 @@ public class RabiRibiModule extends Module{
for(sig.modules.utils.Module m: hModules){ for(sig.modules.utils.Module m: hModules){
//System.out.println(m.getFileName()+":"+m.getEntryPoint()); //System.out.println(m.getFileName()+":"+m.getEntryPoint());
if (m.getFileName().contains("rabiribi")) { if (m.getFileName().contains("rabiribi")) {
rabiRibiMemOffset = Pointer.nativeValue(m.getLpBaseOfDll().getPointer()); found=true;
System.out.println("Found an instance of Rabi-Ribi at 0x"+Long.toHexString(rabiRibiMemOffset)); if (!foundRabiRibi) {
rabiRibiPID=pid; rabiRibiMemOffset = Pointer.nativeValue(m.getLpBaseOfDll().getPointer());
foundRabiRibi=true; System.out.println("Found an instance of Rabi-Ribi at 0x"+Long.toHexString(rabiRibiMemOffset)+" | File:"+m.getFileName()+","+m.getBaseName());
rabiribiProcess=process; rabiRibiPID=pid;
foundRabiRibi=true;
rabiribiProcess=process;
break;
}
break; break;
} }
} }
if (found) {
break;
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (foundRabiRibi) {
break;
}
if (process!=null) { if (process!=null) {
Kernel32.INSTANCE.CloseHandle(process); Kernel32.INSTANCE.CloseHandle(process);
} }
} }
if (!found && foundRabiRibi) {
foundRabiRibi=false;
System.out.println("Rabi-Ribi process lost.");
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
this.overlay = new Overlay(this);
EntityLookupData.parent=this;
EntityLookupData.loadEntityLookupData(lookup_table);
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleWithFixedDelay(()->{
UpdateEntities();
//System.out.println("Called Entity creation "+callcount+" times.");
}, 1000, 1000, TimeUnit.MILLISECONDS);
} }
public void ApplyConfigWindowProperties() { public void ApplyConfigWindowProperties() {
@ -205,19 +222,21 @@ public class RabiRibiModule extends Module{
} }
private void UpdateEntities() { private void UpdateEntities() {
int callcount=0; if (foundRabiRibi) {
long arrayPtr = readIntFromMemory(MemoryOffset.ENTITY_ARRAY); int callcount=0;
for (int i=0;i<MAX_ENTITIES_TO_UPDATE;i++) { long arrayPtr = readIntFromMemory(MemoryOffset.ENTITY_ARRAY);
if (!entities.containsKey(i)) { for (int i=0;i<MAX_ENTITIES_TO_UPDATE;i++) {
callcount++; if (!entities.containsKey(i)) {
Entity ent = new Entity(arrayPtr,i,this); callcount++;
if (ent.isActive()) { Entity ent = new Entity(arrayPtr,i,this);
//System.out.println("Found entity at index "+i); if (ent.isActive()) {
//entities.add(ent); //System.out.println("Found entity at index "+i);
entities.put(i, ent); //entities.add(ent);
entities.put(i, ent);
}
} }
arrayPtr += ENTITY_ARRAY_ELEMENT_SIZE;
} }
arrayPtr += ENTITY_ARRAY_ELEMENT_SIZE;
} }
} }

@ -1,6 +1,7 @@
package sig.modules; package sig.modules;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -56,7 +57,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
int bossMaxHP=SemiValidInteger.ERROR_VALUE; int bossMaxHP=SemiValidInteger.ERROR_VALUE;
TouhouMotherBossData currentBoss = null; TouhouMotherBossData currentBoss = null;
BufferedImage bossImage = null; Image bossImage = null;
int lastCharacterAttacked=0; int lastCharacterAttacked=0;
int lastBossHP=0; int lastBossHP=0;
final int TIME_BETWEEN_DATA_DISPLAYS = 5 * 6; final int TIME_BETWEEN_DATA_DISPLAYS = 5 * 6;
@ -145,21 +146,21 @@ public class TouhouMotherModule extends Module implements ActionListener{
public void DrawBossAndPlayerInfo(Graphics g) { public void DrawBossAndPlayerInfo(Graphics g) {
g.drawImage(bossImage, (int)position.getX()+4, (int)position.getY()+4, sigIRC.panel); g.drawImage(bossImage, (int)position.getX()+4, (int)position.getY()+4, sigIRC.panel);
DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, (int)position.getY()+4+16, 1, Color.WHITE, new Color(30,0,86,255), DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, Math.min(bossImage.getWidth(sigIRC.panel)+4,160)+(int)position.getX()+4, (int)position.getY()+4+16, 1, Color.WHITE, new Color(30,0,86,255),
currentBoss.getName()); currentBoss.getName());
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, (int)position.getY()+4+48, 1, Color.WHITE, new Color(30,0,86,255), DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(bossImage.getWidth(sigIRC.panel)+4,160)+(int)position.getX()+4, (int)position.getY()+4+48, 1, Color.WHITE, new Color(30,0,86,255),
real_bossHP+" / "+bossMaxHP +" ("+Math.round(((real_bossHP/(double)bossMaxHP)*100))+"%)"); real_bossHP+" / "+bossMaxHP +" ("+Math.round(((real_bossHP/(double)bossMaxHP)*100))+"%)");
DrawUtils.drawHealthbar(g, new Rectangle( DrawUtils.drawHealthbar(g, new Rectangle(
Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, Math.min(bossImage.getWidth(sigIRC.panel)+4,160)+(int)position.getX()+4,
(int)position.getY()+4+20, (int)position.getY()+4+20,
(int)TextUtils.calculateStringBoundsFont(bossMaxHP+" / "+bossMaxHP +" ("+Math.round((1d*100))+"%", sigIRC.panel.userFont).getWidth(), (int)TextUtils.calculateStringBoundsFont(bossMaxHP+" / "+bossMaxHP +" ("+Math.round((1d*100))+"%", sigIRC.panel.userFont).getWidth(),
8 8
), real_bossHP/(double)bossMaxHP, ChooseHealthbarColor(real_bossHP/(double)bossMaxHP)); ), real_bossHP/(double)bossMaxHP, ChooseHealthbarColor(real_bossHP/(double)bossMaxHP));
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+16, (int)position.getY()+4+68, 1, Color.WHITE, new Color(30,0,86,255), DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(bossImage.getWidth(sigIRC.panel)+4,160)+(int)position.getX()+16, (int)position.getY()+4+68, 1, Color.WHITE, new Color(30,0,86,255),
TextUtils.convertSecondsToTimeFormat(secondsCount)); TextUtils.convertSecondsToTimeFormat(secondsCount));
int record = TimeRecord.getRecord(currentBoss.getID()); int record = TimeRecord.getRecord(currentBoss.getID());
if (record!=TimeRecord.ERROR_VALUE) { if (record!=TimeRecord.ERROR_VALUE) {
DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+ DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, Math.min(bossImage.getWidth(sigIRC.panel)+4,160)+(int)position.getX()+
TextUtils.calculateStringBoundsFont(TextUtils.convertSecondsToTimeFormat(secondsCount), sigIRC.panel.userFont).getWidth()+20, TextUtils.calculateStringBoundsFont(TextUtils.convertSecondsToTimeFormat(secondsCount), sigIRC.panel.userFont).getWidth()+20,
(int)position.getY()+4+72, 1, Color.WHITE, new Color(30,0,86,255), (int)position.getY()+4+72, 1, Color.WHITE, new Color(30,0,86,255),
"RECORD "+TextUtils.convertSecondsToTimeFormat(record)); "RECORD "+TextUtils.convertSecondsToTimeFormat(record));
@ -175,18 +176,18 @@ public class TouhouMotherModule extends Module implements ActionListener{
int totaldmg = calculateDataPropertyTotalValue(property); int totaldmg = calculateDataPropertyTotalValue(property);
for (int i=0;i<sorteddmg.length;i++) { for (int i=0;i<sorteddmg.length;i++) {
if (sorteddmg[i]!=-1 && characterDatabase[sorteddmg[i]].getDataProperty(property)>0) { if (sorteddmg[i]!=-1 && characterDatabase[sorteddmg[i]].getDataProperty(property)>0) {
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(((bossImage!=null)?bossImage.getWidth():0)+4,160)+(int)position.getX()+4-Math.min(50, (bossImage!=null)?bossImage.getWidth():0)+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255), DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(((bossImage!=null)?bossImage.getWidth(sigIRC.panel):0)+4,160)+(int)position.getX()+4-Math.min(50, (bossImage!=null)?bossImage.getWidth(sigIRC.panel):0)+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255),
characterDatabase[sorteddmg[i]].getName()); characterDatabase[sorteddmg[i]].getName());
DrawUtils.drawHealthbar(g, DrawUtils.drawHealthbar(g,
new Rectangle( new Rectangle(
Math.min(((bossImage!=null)?bossImage.getWidth():0)+4,160)+(int)position.getX()+4+Math.max(0, 50-((bossImage!=null)?bossImage.getWidth():0))+x, Math.min(((bossImage!=null)?bossImage.getWidth(sigIRC.panel):0)+4,160)+(int)position.getX()+4+Math.max(0, 50-((bossImage!=null)?bossImage.getWidth(sigIRC.panel):0))+x,
(int)position.getY()+4+86+pos+y, (int)position.getY()+4+86+pos+y,
96, 96,
10 10
) )
, (double)characterDatabase[sorteddmg[i]].getDataProperty(property)/maxdmg, characterDatabase[sorteddmg[i]].getColor()); , (double)characterDatabase[sorteddmg[i]].getDataProperty(property)/maxdmg, characterDatabase[sorteddmg[i]].getColor());
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, Math.min((bossImage!=null)?bossImage.getWidth():0+4,160)+(int)position.getX()+4+Math.max(0, 50-((bossImage!=null)?bossImage.getWidth():0))+108+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255), DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, Math.min((bossImage!=null)?bossImage.getWidth(sigIRC.panel):0+4,160)+(int)position.getX()+4+Math.max(0, 50-((bossImage!=null)?bossImage.getWidth(sigIRC.panel):0))+108+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255),
characterDatabase[sorteddmg[i]].getDataProperty(property)+" "+"("+df.format(((((double)characterDatabase[sorteddmg[i]].getDataProperty(property)/totaldmg))*100))+"%)"); characterDatabase[sorteddmg[i]].getDataProperty(property)+" "+"("+df.format(((((double)characterDatabase[sorteddmg[i]].getDataProperty(property)/totaldmg))*100))+"%)");
pos+=16; pos+=16;
} }
@ -365,12 +366,8 @@ public class TouhouMotherModule extends Module implements ActionListener{
for (TouhouMotherCharacterData tmcd : characterDatabase) { for (TouhouMotherCharacterData tmcd : characterDatabase) {
tmcd.setCurrentDamage(0); tmcd.setCurrentDamage(0);
} }
try { currentBoss.getFileManager().verifyAndFetchFileFromServer();
currentBoss.getFileManager().verifyAndFetchFileFromServer(); bossImage = sigIRC.readImage(sigIRC.BASEDIR+"Boss Sprites/"+currentBoss.getImage());
bossImage = ImageIO.read(new File(sigIRC.BASEDIR+"Boss Sprites/"+currentBoss.getImage()));
} catch (IOException e) {
e.printStackTrace();
}
} }
} }

@ -2,6 +2,7 @@ package sig.modules.Twitch;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
@ -15,7 +16,7 @@ import sig.utils.DrawUtils;
import sig.utils.TextUtils; import sig.utils.TextUtils;
public class FancyNumber { public class FancyNumber {
BufferedImage icon; Image icon;
int displayedValue=0; int displayedValue=0;
int lastValue=0; int lastValue=0;
int lastValueChange=0; int lastValueChange=0;
@ -25,11 +26,7 @@ public class FancyNumber {
final static String ICONDIR = sigIRC.BASEDIR+"sigIRC/"; final static String ICONDIR = sigIRC.BASEDIR+"sigIRC/";
public FancyNumber(String icon_name, int startingValue) { public FancyNumber(String icon_name, int startingValue) {
try { icon = sigIRC.readImage(ICONDIR+icon_name);
icon = ImageIO.read(new File(ICONDIR+icon_name));
} catch (IOException e) {
e.printStackTrace();
}
lastValue = startingValue; lastValue = startingValue;
} }
@ -53,7 +50,7 @@ public class FancyNumber {
int xoffset = 0; int xoffset = 0;
int yoffset = 0; int yoffset = 0;
g.drawImage(icon, x, y, sigIRC.panel); g.drawImage(icon, x, y, sigIRC.panel);
xoffset+=icon.getWidth()+4; xoffset+=icon.getWidth(sigIRC.panel)+4;
if (displayedValue!=lastValue) { if (displayedValue!=lastValue) {
if (delayCount==0) { if (delayCount==0) {
int diff = Math.abs(displayedValue-lastValue); int diff = Math.abs(displayedValue-lastValue);
@ -83,7 +80,7 @@ public class FancyNumber {
lastValueChange--; lastValueChange--;
g.drawImage((upArrow)?TwitchModule.UPARROWIMAGE:TwitchModule.DOWNARROWIMAGE, x+xoffset, y+yoffset, sigIRC.panel); g.drawImage((upArrow)?TwitchModule.UPARROWIMAGE:TwitchModule.DOWNARROWIMAGE, x+xoffset, y+yoffset, sigIRC.panel);
} }
xoffset+=((upArrow)?TwitchModule.UPARROWIMAGE.getWidth():TwitchModule.DOWNARROWIMAGE.getWidth())+4; xoffset+=((upArrow)?TwitchModule.UPARROWIMAGE.getWidth(sigIRC.panel):TwitchModule.DOWNARROWIMAGE.getWidth(sigIRC.panel))+4;
return new Rectangle(x,y,xoffset,yoffset+16); return new Rectangle(x,y,xoffset,yoffset+16);
} }
} }

@ -3,6 +3,7 @@ package sig.modules;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
@ -44,8 +45,8 @@ public class TwitchModule extends Module{
final public static String SOUNDSDIR = sigIRC.BASEDIR+"sigIRC/follower_sounds/"; final public static String SOUNDSDIR = sigIRC.BASEDIR+"sigIRC/follower_sounds/";
final public static String FOLLOWERQUEUEFILE = USERDIR+"followers.txt"; final public static String FOLLOWERQUEUEFILE = USERDIR+"followers.txt";
public static boolean streamOnline = false; public static boolean streamOnline = false;
static BufferedImage follower_img; static Image follower_img;
BufferedImage followerUserLogo; Image followerUserLogo;
List<Announcement> follower_queue = new ArrayList<Announcement>(); List<Announcement> follower_queue = new ArrayList<Announcement>();
final static int FOLLOWERCHECKTIMER = 900; final static int FOLLOWERCHECKTIMER = 900;
int lastFollowerCheck=300; int lastFollowerCheck=300;
@ -59,9 +60,9 @@ public class TwitchModule extends Module{
Date uptime = Calendar.getInstance().getTime(); Date uptime = Calendar.getInstance().getTime();
String currentlyPlaying=" "; String currentlyPlaying=" ";
final public static int ARROWTIMER = 3000; final public static int ARROWTIMER = 3000;
public static BufferedImage UPARROWIMAGE; public static Image UPARROWIMAGE;
public static BufferedImage DOWNARROWIMAGE; public static Image DOWNARROWIMAGE;
public static BufferedImage UPTIMEIMAGE; public static Image UPTIMEIMAGE;
public TwitchModule(Rectangle2D bounds, String moduleName) { public TwitchModule(Rectangle2D bounds, String moduleName) {
this(bounds,moduleName,true); this(bounds,moduleName,true);
@ -243,15 +244,10 @@ public class TwitchModule extends Module{
} }
private void InitializeImages() { private void InitializeImages() {
try { follower_img = sigIRC.readImage(sigIRC.BASEDIR+sigIRC.twitchmodule_follower_img);
follower_img = ImageIO.read(new File(sigIRC.BASEDIR+sigIRC.twitchmodule_follower_img)); UPARROWIMAGE = sigIRC.readImage(sigIRC.BASEDIR+"sigIRC/icon_up_arrow.png");
UPARROWIMAGE = ImageIO.read(new File(sigIRC.BASEDIR+"sigIRC/icon_up_arrow.png")); DOWNARROWIMAGE = sigIRC.readImage(sigIRC.BASEDIR+"sigIRC/icon_down_arrow.png");
DOWNARROWIMAGE = ImageIO.read(new File(sigIRC.BASEDIR+"sigIRC/icon_down_arrow.png")); UPTIMEIMAGE = sigIRC.readImage(sigIRC.BASEDIR+"sigIRC/icon_uptime.png");
UPTIMEIMAGE = ImageIO.read(new File(sigIRC.BASEDIR+"sigIRC/icon_uptime.png"));
//System.out.println("Initialized Follower Image successfully.");
} catch (IOException e) {
e.printStackTrace();
}
} }
private void CreateFollowerQueueLog() { private void CreateFollowerQueueLog() {
@ -429,7 +425,7 @@ public class TwitchModule extends Module{
private void DrawStatisticsBar(Graphics g) { private void DrawStatisticsBar(Graphics g) {
g.setColor(new Color(25,25,25)); g.setColor(new Color(25,25,25));
int xoffset = (int)position.getX()+4; int xoffset = (int)position.getX()+4;
int yoffset = (int)(position.getY()+follower_img.getHeight()+sigIRC.twitchmodule_newfollowerImgLogoSize); int yoffset = (int)(position.getY()+follower_img.getHeight(sigIRC.panel)+sigIRC.twitchmodule_newfollowerImgLogoSize);
g.fillPolygon(new int[]{(int)position.getX(),(int)(position.getX()+position.getWidth()),(int)(position.getX()+position.getWidth()),(int)position.getX()}, g.fillPolygon(new int[]{(int)position.getX(),(int)(position.getX()+position.getWidth()),(int)(position.getX()+position.getWidth()),(int)position.getX()},
new int[]{yoffset-4,yoffset-4,yoffset+16,yoffset+16}, new int[]{yoffset-4,yoffset-4,yoffset+16,yoffset+16},
4); 4);
@ -445,7 +441,7 @@ public class TwitchModule extends Module{
private Rectangle DrawUptime(Graphics g, int x, int y) { private Rectangle DrawUptime(Graphics g, int x, int y) {
int xoffset = 0; int xoffset = 0;
int yoffset = 0; int yoffset = 0;
g.drawImage(UPTIMEIMAGE, x+xoffset, y+yoffset-2, sigIRC.panel);xoffset+=UPTIMEIMAGE.getWidth()+4; g.drawImage(UPTIMEIMAGE, x+xoffset, y+yoffset-2, sigIRC.panel);xoffset+=UPTIMEIMAGE.getWidth(sigIRC.panel)+4;
String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(uptime); String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(uptime);
if (timediff.length()>0) { if (timediff.length()>0) {
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getWidth()+12; DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getWidth()+12;
@ -463,7 +459,7 @@ public class TwitchModule extends Module{
: 0; : 0;
final int canvasYOffset = final int canvasYOffset =
(sigIRC.twitchmodule_follower_img_animation) (sigIRC.twitchmodule_follower_img_animation)
? Math.min(follower_img.getHeight(),yAlteration) ? Math.min(follower_img.getHeight(sigIRC.panel),yAlteration)
: 0; : 0;
final int xAlteration = final int xAlteration =
(sigIRC.twitchmodule_follower_img_animation) (sigIRC.twitchmodule_follower_img_animation)
@ -471,13 +467,13 @@ public class TwitchModule extends Module{
: 0; : 0;
final int canvasXOffset = final int canvasXOffset =
(sigIRC.twitchmodule_follower_img_animation) (sigIRC.twitchmodule_follower_img_animation)
? Math.min(follower_img.getWidth(),xAlteration) ? Math.min(follower_img.getWidth(sigIRC.panel),xAlteration)
: 0; : 0;
//System.out.println(yAlteration); //System.out.println(yAlteration);
//g.drawImage(follower_img, (int)bounds.getX()+xAlteration, (int)bounds.getY()+yAlteration, sigIRC.panel); //g.drawImage(follower_img, (int)bounds.getX()+xAlteration, (int)bounds.getY()+yAlteration, sigIRC.panel);
//g.drawImage(follower_img, (int)bounds.getX(), (int)bounds.getY(), , , sigIRC.panel) //g.drawImage(follower_img, (int)bounds.getX(), (int)bounds.getY(), , , sigIRC.panel)
g.drawImage(follower_img, (int)position.getX(), (int)position.getY()+canvasYOffset, (int)position.getX()+follower_img.getWidth()+canvasXOffset, (int)position.getY()+follower_img.getHeight(), g.drawImage(follower_img, (int)position.getX(), (int)position.getY()+canvasYOffset, (int)position.getX()+follower_img.getWidth(sigIRC.panel)+canvasXOffset, (int)position.getY()+follower_img.getHeight(sigIRC.panel),
-xAlteration, 0, follower_img.getWidth(), follower_img.getHeight()-yAlteration, sigIRC.panel); -xAlteration, 0, follower_img.getWidth(sigIRC.panel), follower_img.getHeight(sigIRC.panel)-yAlteration, sigIRC.panel);
Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.getDisplayName(), sigIRC.panel.programFont); Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.getDisplayName(), sigIRC.panel.programFont);
int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration; int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration;
int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration; int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration;
@ -488,13 +484,13 @@ public class TwitchModule extends Module{
if (followerUserLogo!=null) { if (followerUserLogo!=null) {
final int image_size = sigIRC.twitchmodule_newfollowerImgLogoSize; final int image_size = sigIRC.twitchmodule_newfollowerImgLogoSize;
int img_startx = (int)(position.getX()+position.getWidth()-ticksPassed*3-(image_size+4)); int img_startx = (int)(position.getX()+position.getWidth()-ticksPassed*3-(image_size+4));
int img_starty = (int)(position.getY()+follower_img.getHeight()+2-image_size/2); int img_starty = (int)(position.getY()+follower_img.getHeight(sigIRC.panel)+2-image_size/2);
//g.setColor(Color.BLACK); //g.setColor(Color.BLACK);
//g.drawRect(img_startx, img_starty, image_size, image_size); //g.drawRect(img_startx, img_starty, image_size, image_size);
g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(), followerUserLogo.getHeight(), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel); g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(sigIRC.panel), followerUserLogo.getHeight(sigIRC.panel), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel);
} }
if (announcedFollowerUser.getBio()!=null && announcedFollowerUser.getBio().length()>0) { if (announcedFollowerUser.getBio()!=null && announcedFollowerUser.getBio().length()>0) {
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.getBio()); DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight(sigIRC.panel)+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.getBio());
} }
} }
} }

@ -41,12 +41,14 @@ import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.Image; import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
import java.awt.image.BufferedImage;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -159,6 +161,7 @@ public class sigIRC{
public static int lastSubEmoteUpdate = -1; public static int lastSubEmoteUpdate = -1;
public static boolean autoUpdateProgram = true; public static boolean autoUpdateProgram = true;
public static Image programIcon; public static Image programIcon;
public static Image missingImage;
public static int subchannelCount = 0; public static int subchannelCount = 0;
public static HashMap<Long,String> subchannelIds = new HashMap<Long,String>(); public static HashMap<Long,String> subchannelIds = new HashMap<Long,String>();
@ -213,11 +216,11 @@ public class sigIRC{
touhoumothermodule_Y = config.getInteger("TOUHOUMOTHER_module_Y",312); touhoumothermodule_Y = config.getInteger("TOUHOUMOTHER_module_Y",312);
touhoumothermodule_width = config.getInteger("TOUHOUMOTHER_module_width",320); touhoumothermodule_width = config.getInteger("TOUHOUMOTHER_module_width",320);
touhoumothermodule_height = config.getInteger("TOUHOUMOTHER_module_height",312); touhoumothermodule_height = config.getInteger("TOUHOUMOTHER_module_height",312);
/*rabiribimodule_X = config.getInteger("RABIRIBI_module_X",0); rabiribimodule_X = config.getInteger("RABIRIBI_module_X",0);
rabiribimodule_Y = config.getInteger("RABIRIBI_module_Y",312); rabiribimodule_Y = config.getInteger("RABIRIBI_module_Y",312);
rabiribimodule_width = config.getInteger("RABIRIBI_module_width",320); rabiribimodule_width = config.getInteger("RABIRIBI_module_width",320);
rabiribimodule_height = config.getInteger("RABIRIBI_module_height",312); rabiribimodule_height = config.getInteger("RABIRIBI_module_height",312);
rabiribimodule_enabled = config.getBoolean("Module_rabiribi_Enabled", false);*/ rabiribimodule_enabled = config.getBoolean("Module_rabiribi_Enabled", false);
rabiracemodule_X = config.getInteger("RABIRACE_module_X",0); rabiracemodule_X = config.getInteger("RABIRACE_module_X",0);
rabiracemodule_Y = config.getInteger("RABIRACE_module_Y",312); rabiracemodule_Y = config.getInteger("RABIRACE_module_Y",312);
rabiracemodule_width = config.getInteger("RABIRACE_module_width",320); rabiracemodule_width = config.getInteger("RABIRACE_module_width",320);
@ -276,10 +279,28 @@ public class sigIRC{
} }
private static void Initialize() { private static void Initialize() {
programIcon = sigIRC.readImage(sigIRC.BASEDIR+"/sigIRC/sigIRCicon.png");
BufferedImage img = new BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB);
Graphics2D g = img.createGraphics();
g.drawRect(0, 0, 15, 15);
g.drawLine(0, 0, 15, 15);
g.drawLine(0, 15, 15, 0);
missingImage = img;
}
public static Image readImage(String file) {
Image img;
try { try {
programIcon = ImageIO.read(new File(sigIRC.BASEDIR+"/sigIRC/sigIRCicon.png")); img = ImageIO.read(new File(file));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); return missingImage;
}
if (img!=null) {
return img;
} else {
return missingImage;
} }
} }
@ -362,12 +383,8 @@ public class sigIRC{
} }
private static void InitializeModules() { private static void InitializeModules() {
try { Module.IMG_DRAGBAR = sigIRC.readImage(sigIRC.BASEDIR+"drag_bar.png");
Module.IMG_DRAGBAR = ImageIO.read(new File(sigIRC.BASEDIR+"drag_bar.png")); Module.MSG_SEPARATOR = sigIRC.readImage(sigIRC.BASEDIR+"sigIRC/message_separator.png");
Module.MSG_SEPARATOR = ImageIO.read(new File(sigIRC.BASEDIR+"sigIRC/message_separator.png"));
} catch (IOException e) {
e.printStackTrace();
}
if (touhoumothermodule_enabled) { if (touhoumothermodule_enabled) {
modules.add(new TouhouMotherModule( modules.add(new TouhouMotherModule(
new Rectangle(touhoumothermodule_X,touhoumothermodule_Y,touhoumothermodule_width,touhoumothermodule_height), new Rectangle(touhoumothermodule_X,touhoumothermodule_Y,touhoumothermodule_width,touhoumothermodule_height),

Loading…
Cancel
Save