Added new map marking features. Ribbon does not get added if you are

fighting a boss.
master
sigonasr2 5 years ago
parent 09efab570e
commit a990c6b876
  1. 4
      sessions
  2. BIN
      sigIRCv2.jar
  3. 10
      src/sig/modules/MapPoint.java
  4. 26
      src/sig/modules/RabiRace/MarkMapButton.java
  5. 18
      src/sig/modules/RabiRace/Profile.java
  6. 135
      src/sig/modules/RabiRaceModule.java
  7. 2
      src/sig/modules/RabiRibi/MemoryOffset.java
  8. 1
      src/sig/sigIRC.java
  9. 20
      tmp_profile

@ -1,2 +1,2 @@
40,1584212818,1584213383,SigoNitori's Race,4,none,,5.00,0,5,false
41,1584213387,1584213653,SigoNitori's Race,4,none,sigonitori,5.00,0,5,false
51,1584279252,1584279444,SigoNitori's Race,4,none,,5.00,0,5,true
52,1584279449,1584279875,SigoNitori's Race,4,none,sigonitori,5.00,0,5,true

Binary file not shown.

@ -0,0 +1,10 @@
package sig.modules;
public class MapPoint {
int timer;
String player;
public MapPoint(int timer, String player) {
this.timer=timer;
this.player=player;
}
}

@ -0,0 +1,26 @@
package sig.modules.RabiRace;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import sig.Module;
import sig.sigIRC;
import sig.modules.RabiRaceModule;
public class MarkMapButton extends ClickableButton{
public MarkMapButton(Rectangle position, String button_label, RabiRaceModule module) {
super(position,button_label,module);
}
public void onClickEvent(MouseEvent ev) {
if (RabiRaceModule.module.mySession!=null) {
//System.out.println("Mark Map.");
RabiRaceModule.module.MarkCurrentPosition();
}
}
}

@ -187,6 +187,16 @@ public class Profile {
return p.rainbowEggs;
}
public void MarkCurrentPosition() {
RabiRaceModule.module.AddMapPoint(RabiRaceModule.module.readIntFromMemory(MemoryOffset.MAP_AREA_NUMBER),
RabiRaceModule.module.readIntFromMemory(MemoryOffset.MAP_TILE_X),
RabiRaceModule.module.readIntFromMemory(MemoryOffset.MAP_TILE_Y),
16,false);
/*for (int i=0;i<17;i++) {
AddMapPoint(0,i,0,i);
}*/
}
public void compareAndAnnounceAllChangedValues() {
//System.out.println(oldProfile.key_items.get(MemoryData.HAMMER)+","+key_items.get(MemoryData.HAMMER));
int changedValueCount = compareAllChangedValues();
@ -196,18 +206,23 @@ public class Profile {
String announcement = "";
if (GetHealthUpCount(oldProfile)==GetHealthUpCount(this)-1) {
announcement = "has obtained a Health Up! ("+GetHealthUpCount(this)+" total)";
MarkCurrentPosition();
}
if (GetAttackUpCount(oldProfile)==GetAttackUpCount(this)-1) {
announcement = "has obtained an Attack Up! ("+GetAttackUpCount(this)+" total)";
MarkCurrentPosition();
}
if (GetManaUpCount(oldProfile)==GetManaUpCount(this)-1) {
announcement = "has obtained a Mana Up! ("+GetManaUpCount(this)+" total)";
MarkCurrentPosition();
}
if (GetRegenUpCount(oldProfile)==GetRegenUpCount(this)-1) {
announcement = "has obtained a Regen Up! ("+GetRegenUpCount(this)+" total)";
MarkCurrentPosition();
}
if (GetPackUpCount(oldProfile)==GetPackUpCount(this)-1) {
announcement = "has obtained a Pack Up! ("+GetPackUpCount(this)+" total)";
MarkCurrentPosition();
}
if (GetRainbowEggCount(oldProfile)==GetRainbowEggCount(this)-1) {
if (RabiRaceModule.mySession!=null &&
@ -227,12 +242,14 @@ public class Profile {
if (!oldProfile.key_items.containsKey(md) &&
key_items.containsKey(md)) {
announcement = "has obtained "+md.name+"!";
MarkCurrentPosition();
}
}
for (MemoryData md : badges.keySet()) {
if (!oldProfile.badges.containsKey(md) &&
badges.containsKey(md)) {
announcement = "has obtained the "+md.name+" badge!";
MarkCurrentPosition();
}
}
if (announcement.length()>0 && changedValueCount!=0) {
@ -296,6 +313,7 @@ public class Profile {
} catch (IOException e) {
e.printStackTrace();
}
//System.out.println(getDataString());
//String[] data = FileUtils.readFromFile(sigIRC.BASEDIR+"tmp");
//System.out.println(Arrays.toString(data));

@ -5,6 +5,7 @@ import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
@ -37,6 +38,7 @@ import sig.modules.RabiRace.ClickableButton;
import sig.modules.RabiRace.ColorCycler;
import sig.modules.RabiRace.CreateButton;
import sig.modules.RabiRace.JoinButton;
import sig.modules.RabiRace.MarkMapButton;
import sig.modules.RabiRace.MemoryData;
import sig.modules.RabiRace.Profile;
import sig.modules.RabiRace.Session;
@ -81,10 +83,18 @@ public class RabiRaceModule extends Module{
public static boolean avatarRetrieved=false;
public static int CLIENT_SERVER_READTIME = -1;
public static boolean syncItems = false;
public static int selectedMapIcon = 13;
public static int lastreadmapdata = 0;
public boolean viewingupdatedMapIcons=false;
public HashMap<Integer,Integer> mapdata = new HashMap<Integer,Integer>();
public HashMap<Integer,Integer> newmapdata = new HashMap<Integer,Integer>();
int frames=0;
public SessionListData session_listing = new SessionListData();
ClickableButton join_button,create_button;
ClickableButton join_button,create_button,markmap_button;
public Image mapiconimg;
public static List<MemoryData> key_items_list = new ArrayList<MemoryData>();
public static List<MemoryData> badges_list = new ArrayList<MemoryData>();
@ -163,6 +173,7 @@ public class RabiRaceModule extends Module{
try {
UNKNOWN_ITEM = ImageIO.read(new File(sigIRC.BASEDIR+"sigIRC/rabi-ribi/unknown.png"));
mapiconimg = ImageIO.read(new File(sigIRC.BASEDIR+"map_icons.png"));
} catch (IOException e) {
e.printStackTrace();
}
@ -171,6 +182,7 @@ public class RabiRaceModule extends Module{
join_button = new JoinButton(new Rectangle(2,(int)(position.getHeight()-18),120,18),"Join Session (0)",this);
create_button = new CreateButton(new Rectangle(122,(int)(position.getHeight()-18),120,18),"Create Session",this);
markmap_button = new MarkMapButton(new Rectangle(2,(int)(position.getHeight()-42),120,18),"Mark Map",this);
}
private void VerifyClientIsValid() {
@ -242,11 +254,67 @@ public class RabiRaceModule extends Module{
}
}
}
if (mySession!=null) {
File file2 = new File(sigIRC.BASEDIR+"mapdata");
try {
org.apache.commons.io.FileUtils.copyURLToFile(new URL("http://45.33.13.215/rabirace/maps/"+mySession.getID()),file2);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
int MapUpdatesRequired=0;
String byWhom = "";
String[] mapdata = FileUtils.readFromFile(sigIRC.BASEDIR+"mapdata");
for (int i=lastreadmapdata+1;i<mapdata.length;i++) {
String[] s = mapdata[i].split(";");
if (s.length>=2) {
if (!s[0].equalsIgnoreCase(myProfile.username)) {
if (!this.newmapdata.containsKey(Integer.parseInt(s[1]))) {
MapUpdatesRequired++;
byWhom = s[0];
this.newmapdata.put(Integer.parseInt(s[1]),Integer.parseInt(s[2]));
}
}
this.mapdata.put(Integer.parseInt(s[1]),Integer.parseInt(s[2]));
int id = Integer.parseInt(s[1]);
AddMapPoint((int)Math.floor(id/450),(int)Math.floor(id%450/18),id%450%18,Integer.parseInt(s[2]),false);
lastreadmapdata=Math.max(i,lastreadmapdata);
}
}
if (MapUpdatesRequired>0) {
if (MapUpdatesRequired==1) {
messagequeue.add(byWhom+" has added a new marker to the map!");
} else {
messagequeue.add(MapUpdatesRequired+" new markers have been added to the map!");
}
}
}
/*if (message_played && mySession.isCoop()) {
SoundUtils.playSound(sigIRC.BASEDIR+"sigIRC/collect_item.wav");
}*/
}
public void AddMapPoint(int area, int x, int y, int color, boolean update) {
int id = y+18*x+area*450;
writeIntToMemory(MemoryOffset.MAP_REGION_START.getOffset()+
id*4,color);
if (mySession!=null && mySession.isCoop() && update) {
mapdata.put(id,color);
File file2 = new File(sigIRC.BASEDIR+"tmp_mapdata");
try {
org.apache.commons.io.FileUtils.copyURLToFile(new URL("http://45.33.13.215/rabirace/send.php?session="+mySession.getID()+"&key=addmappoint&timekey="+RabiRaceModule.CLIENT_SERVER_READTIME+"&mappoint="+myProfile.username+";"+id+";"+color),file2);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void SyncItemsWithOtherPlayers() {
boolean soundPlayed=false;
if (mySession!=null) {
@ -256,10 +324,12 @@ public class RabiRaceModule extends Module{
for (MemoryData m : p.key_items.keySet()) {
if (p.key_items.get(m)!=0 && (!myProfile.key_items.containsKey(m) || myProfile.key_items.get(m)==0)) {
System.out.println("You do not have a "+m.name+". Syncing from "+p.displayName+".");
if (!(readIntFromMemory(MemoryOffset.BOSS_FIGHT.getOffset())==1 && m==MemoryData.RIBBON)) {
writeIntToMemory(m.mem.getOffset(),Math.abs(p.key_items.get(m)));
updateRequired=true;
}
}
}
for (MemoryData m : p.badges.keySet()) {
if (p.badges.get(m)!=0 && (!myProfile.badges.containsKey(m) || myProfile.badges.get(m)==0)) {
System.out.println("You do not have a "+m.name+". Syncing from "+p.displayName+".");
@ -357,11 +427,19 @@ public class RabiRaceModule extends Module{
if (firstCheck && mySession==null && create_button.mouseInsideBounds(ev)) {
create_button.onClickEvent(ev);
}
if (firstCheck && markmap_button.mouseInsideBounds(ev)) {
markmap_button.onClickEvent(ev);
}
if (mouseoverAvatar) {
avatarwindow.setVisible(true);
}
}
public void mouseWheel(MouseWheelEvent ev) {
selectedMapIcon+=Math.signum(ev.getWheelRotation());
selectedMapIcon=(selectedMapIcon<0)?15:selectedMapIcon%16;
}
private void CheckRabiRibiClient() {
List<Integer> pids;
try {
@ -407,6 +485,7 @@ public class RabiRaceModule extends Module{
}
public void run() {
frames++;
if (foundRabiRibi) {
rainbowcycler.run();
/*System.out.println("Value: ("+Integer.toHexString((int)(rabiRibiMemOffset+0x1679EF0))+"): "+readIntFromMemory(0x1679EF0));
@ -421,11 +500,11 @@ public class RabiRaceModule extends Module{
messages.remove(i--);
}
}
if (messagequeue.size()>0) {
if (NoMessageDisplayed()) {
int character=0;
character = messagequeue.get(0).contains(myProfile.displayName)?RabiRaceModule.ERINA:RabiRaceModule.RIBBON;
character = messagequeue.get(0).contains("to the map!")?RabiRaceModule.MIRIAM:messagequeue.get(0).contains("Rainbow Egg")?RabiRaceModule.CICINI:messagequeue.get(0).contains(myProfile.displayName)?RabiRaceModule.ERINA:RabiRaceModule.RIBBON;
DisplayMessage(messagequeue.get(0).length()>255?messagequeue.remove(0).substring(0,255):messagequeue.remove(0),8,character);
}
}
@ -436,7 +515,7 @@ public class RabiRaceModule extends Module{
}
}
private void DisplayMessage(String s, int seconds, int character) {
public void DisplayMessage(String s, int seconds, int character) {
writeIntToMemory(MemoryOffset.MESSAGE_CHARACTER.getOffset(),character);
writeStringToMemory(MemoryOffset.MESSAGE_TEXT.getOffset(),s,256);
writeIntToMemory(MemoryOffset.MESSAGE_TEXTREF.getOffset(),27);
@ -453,6 +532,36 @@ public class RabiRaceModule extends Module{
//int paused = 0; //TODO FORCE UNPAUSE FOR NOW.
float itempct = readFloatFromMemory(MemoryOffset.ITEM_PERCENT);
myProfile.isPaused = paused>=1;
if (mySession!=null && mySession.isCoop()) {
if (readIntFromMemory(MemoryOffset.TITLE_SCREEN)==10) {
mapdata.clear();
newmapdata.clear();
lastreadmapdata=0;
}
if (newmapdata.size()>0 && readIntFromMemory(MemoryOffset.PAUSED)>0) {
viewingupdatedMapIcons=true;
for (Integer i : newmapdata.keySet()) {
int icon = mapdata.get(i);
if ((frames%40)>=20) {
AddMapPoint((int)Math.floor(i/450),(int)Math.floor(i%450/18),i%450%18,6,false);
} else {
AddMapPoint((int)Math.floor(i/450),(int)Math.floor(i%450/18),i%450%18,icon,false);
}
}
}
if (viewingupdatedMapIcons && readIntFromMemory(MemoryOffset.PAUSED)==0) {
viewingupdatedMapIcons=false;
for (Integer i : newmapdata.keySet()) {
int icon = mapdata.get(i);
AddMapPoint((int)Math.floor(i/450),(int)Math.floor(i%450/18),i%450%18,icon,false);
}
newmapdata.clear();
}
}
//System.out.println(itempct+","+paused);
if (paused==0 && itempct>=0) {
myProfile.archiveAllValues();
@ -657,11 +766,15 @@ public class RabiRaceModule extends Module{
create_button.draw(g);
}
}
g.setColor(Color.BLACK);
if (mySession!=null) {
markmap_button.draw(g);
g.drawImage(mapiconimg, (int)(position.getX()+128), (int)(position.getY()+position.getHeight()-48), (int)(position.getX()+128+29), (int)(position.getY()+position.getHeight()-48)+29, selectedMapIcon*29, 0, selectedMapIcon*29+29, 29, sigIRC.panel);
}
/*g.setColor(Color.BLACK);
g.fillRect((int)(position.getX()), (int)(position.getY()+position.getHeight()-28-20), (int)(position.getWidth()), 20);
for (int i=0;i<messages.size();i++) {
messages.get(i).draw(g);
}
}*/
}
}
@ -694,4 +807,14 @@ public class RabiRaceModule extends Module{
}
}
}
public void MarkCurrentPosition() {
AddMapPoint(readIntFromMemory(MemoryOffset.MAP_AREA_NUMBER),
readIntFromMemory(MemoryOffset.MAP_TILE_X),
readIntFromMemory(MemoryOffset.MAP_TILE_Y),
selectedMapIcon+1,true);
/*for (int i=0;i<17;i++) {
AddMapPoint(0,i,0,i);
}*/
}
}

@ -159,6 +159,8 @@ public enum MemoryOffset {
MESSAGE_CHARACTER(0x16EA47C,0,0,0,0,0),
MESSAGE_TEXT(0x17A8DE8,0,0,0,0,0), //This references the 27th location of text. Use 27 for TEXTREF value.
MESSAGE_TEXTREF(0x16EA4B0,0,0,0,0,0), //This should be 27 as this allows for MESSAGE_TEXT to be our "custom message" handler.
BOSS_FIGHT(0x16E7D9C,0,0,0,0,0), //Should be 1 when in a boss fight.
;
long base_offset;

@ -356,6 +356,7 @@ public class sigIRC{
manager = new FileManager("update.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("drag_bar.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("map_icons.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("sigIRC/stamps1.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("sigIRC/stamps2_2.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("sigIRC/stamp_what_a_great_idea.png"); manager.verifyAndFetchFileFromServer();

@ -1,25 +1,21 @@
SigoNitori
10
1584213472
148239
1584279851
6357
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000010000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0
false
true
1
1
2.9
3.323077
1584213659
0.0
0.36923078
1584279881
KEYITEMS:
HAMMER;1
CARROT_BOMB;1
RIBBON;1
BADGES:
BADGE_DEF_TRADE;1
UPDATES:
1100000000000000000000000101000000000000001000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
END
Loading…
Cancel
Save