Added a kill button to Touhou Mother module in case something goes

horribly wrong.
dev
sigonasr2 8 years ago
parent f7c89584fe
commit adcaee4de0
  1. 47
      src/sig/modules/TouhouMother/Button2.java
  2. 14
      src/sig/modules/TouhouMotherModule.java

@ -0,0 +1,47 @@
package sig.modules.TouhouMother;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import javax.imageio.ImageIO;
import sig.DrawUtils;
import sig.FileUtils;
import sig.TextUtils;
import sig.sigIRC;
import sig.modules.TouhouMotherModule;
public class Button2 {
BufferedImage buttonimg;
int x=0;
int y=0;
TouhouMotherModule module;
public Button2(TouhouMotherModule parentmodule, File filename, int x, int y) {
this.x=x;
this.y=y;
this.module=parentmodule;
try {
buttonimg = ImageIO.read(filename);
} catch (IOException e) {
e.printStackTrace();
}
}
public void draw(Graphics g) {
g.drawImage(buttonimg, x, y, sigIRC.panel);
}
public void onClickEvent(MouseEvent ev) {
if (ev.getX()>=x && ev.getX()<=x+buttonimg.getWidth() &&
ev.getY()>=y && ev.getY()<=y+buttonimg.getHeight()) {
module.endBattle();
}
}
}

@ -24,6 +24,7 @@ import sig.Module;
import sig.TextUtils;
import sig.sigIRC;
import sig.modules.TouhouMother.Button;
import sig.modules.TouhouMother.Button2;
import sig.modules.TouhouMother.DataProperty;
import sig.modules.TouhouMother.IncreaseTouhouMotherClockCount;
import sig.modules.TouhouMother.TimeRecord;
@ -62,6 +63,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
boolean battleEnds=false;
Button updateButton;
Button2 killButton;
public TouhouMotherModule(Rectangle2D bounds, String moduleName) {
super(bounds, moduleName);
@ -111,6 +113,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
DrawSortedHealthbarsBasedOnDataProperty(g, DataProperty.getDataPropertyBasedOnID(data_display_id), 0, -64);
}
updateButton.draw(g);
killButton.draw(g);
}
}
@ -237,11 +240,16 @@ public class TouhouMotherModule extends Module implements ActionListener{
hasDied=true;
}
if (real_gameData!=null && (real_gameData.contains("you should see...") ||
real_gameData.contains("KA-75 fired its") || real_gameData.contains("The battle was lost"))) {
real_gameData.contains("KA-75 fired its") || real_gameData.contains("The battle was lost")
|| real_gameData.contains("Yukari tried"))) {
battleEnds=true;
}
}
public void endBattle() {
battleEnds=true;
}
private int GetLastAttacker(String data) {
if (data.contains("Reimu")) {
return TouhouPlayerCharacter.REIMU.getID();
@ -413,6 +421,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
public void mousePressed(MouseEvent ev) {
updateButton.onClickEvent(ev);
killButton.onClickEvent(ev);
}
public void mouseWheel(MouseWheelEvent ev) {
updateButton.onMouseWheelEvent(ev);
@ -422,6 +431,9 @@ public class TouhouMotherModule extends Module implements ActionListener{
updateButton = new Button(this, //56x20 pixels
new File(sigIRC.BASEDIR+"..\\update.png"),
(int)bounds.getX()+320-56,(int)bounds.getY()+sigIRC.panel.getHeight()/2-20);
killButton = new Button2(this,
new File(sigIRC.BASEDIR+"..\\kill.png"),
(int)bounds.getX(),(int)bounds.getY()+sigIRC.panel.getHeight()/2-20);
}
public Rectangle2D getBounds() {

Loading…
Cancel
Save