Updated Title screen value. Added location tracking on profiles. Changed

event value parsing to handle multi-digit values.
master
sigonasr2 5 years ago
parent adef5e93f6
commit c4b28ebeba
  1. 4
      sessions
  2. BIN
      sigIRCv2.jar
  3. 2
      src/sig/modules/RabiRace/JoinButton.java
  4. 19
      src/sig/modules/RabiRace/Profile.java
  5. 41
      src/sig/modules/RabiRaceModule.java
  6. 4
      src/sig/modules/RabiRibi/MemoryOffset.java
  7. 2
      tmp
  8. 37
      tmp_profile

@ -1,3 +1 @@
51,1584279252,1584279444,SigoNitori's Race,4,none,,5.00,0,5,true 55,1584288695,1584288795,SigoNitori's Race,4,none,sigonitori,5.00,0,5,true
52,1584279449,1584280002,SigoNitori's Race,4,none,,5.00,0,5,true
53,1584279986,1584280006,TRimead Test,4,none,sigonitori,5.00,0,5,true

Binary file not shown.

@ -21,7 +21,7 @@ public class JoinButton extends ClickableButton{
if (RabiRaceModule.mySession==null) { if (RabiRaceModule.mySession==null) {
RabiRaceModule.module.window.setVisible(true); RabiRaceModule.module.window.setVisible(true);
} else { } else {
RabiRaceModule.module.LeaveSession(); //RabiRaceModule.module.LeaveSession();
File file = new File(sigIRC.BASEDIR+"sigIRC/tmp.data"); File file = new File(sigIRC.BASEDIR+"sigIRC/tmp.data");
try { try {
org.apache.commons.io.FileUtils.copyURLToFile(new URL("http://45.33.13.215/rabirace/send.php?key=leavesession&timekey="+RabiRaceModule.CLIENT_SERVER_READTIME+"&name="+RabiRaceModule.module.myProfile.username+"&session="+RabiRaceModule.mySession.id),file); org.apache.commons.io.FileUtils.copyURLToFile(new URL("http://45.33.13.215/rabirace/send.php?key=leavesession&timekey="+RabiRaceModule.CLIENT_SERVER_READTIME+"&name="+RabiRaceModule.module.myProfile.username+"&session="+RabiRaceModule.mySession.id),file);

@ -40,11 +40,12 @@ public class Profile {
public String manaUps = "0000000000000000000000000000000000000000000000000000000000000000"; public String manaUps = "0000000000000000000000000000000000000000000000000000000000000000";
public String regenUps = "0000000000000000000000000000000000000000000000000000000000000000"; public String regenUps = "0000000000000000000000000000000000000000000000000000000000000000";
public String packUps = "0000000000000000000000000000000000000000000000000000000000000000"; public String packUps = "0000000000000000000000000000000000000000000000000000000000000000";
public String eventStruct = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; public String eventStruct = "0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_";
public int rainbowEggs = 0; public int rainbowEggs = 0;
public boolean isPaused = false; public boolean isPaused = false;
public int difficulty = 0; public int difficulty = 0;
public int loop = 0; public int loop = 0;
public int map = 0; //Map color.
public float itempct = 0; public float itempct = 0;
public float mappct = 0; public float mappct = 0;
public LinkedHashMap<MemoryData,Integer> key_items = new LinkedHashMap<MemoryData,Integer>(); public LinkedHashMap<MemoryData,Integer> key_items = new LinkedHashMap<MemoryData,Integer>();
@ -299,12 +300,14 @@ public class Profile {
StringBuilder events = new StringBuilder(); StringBuilder events = new StringBuilder();
for (int i=0;i<EVENT_COUNT;i++) { for (int i=0;i<EVENT_COUNT;i++) {
int val = parent.readIntFromMemory(MemoryOffset.EVENT_START.getOffset()+i*4); int val = parent.readIntFromMemory(MemoryOffset.EVENT_START.getOffset()+i*4);
if (val>9 || val<0) { events.append(val);
System.out.println("WARNING! Event "+(256+i)+" has a value greater than 9 or negative number! Truncating to 1 value."); events.append("_");
/*if (val>9 || val<0) {
//System.out.println("WARNING! Event "+(256+i)+" has a value greater than 9 or negative number! Truncating to 1 value.");
events.append(Integer.toString(val).charAt(0)); events.append(Integer.toString(val).charAt(0));
} else { } else {
events.append(val); events.append(val);
} }*/
} }
eventStruct = events.toString(); eventStruct = events.toString();
} }
@ -338,7 +341,7 @@ public class Profile {
} }
String[] data = FileUtils.readFromFile(sigIRC.BASEDIR+"tmp_profile"); String[] data = FileUtils.readFromFile(sigIRC.BASEDIR+"tmp_profile");
//System.out.println(Arrays.toString(data)); //System.out.println(Arrays.toString(data));
if (data.length>=21) { if (data.length>=23) {
int i=0; int i=0;
displayName = data[i++]; displayName = data[i++];
try { try {
@ -386,6 +389,8 @@ public class Profile {
do { do {
eventStruct = nextval; eventStruct = nextval;
nextval = data[i++]; nextval = data[i++];
map = Integer.parseInt(nextval);
nextval = data[i++];
} }
while (!nextval.equalsIgnoreCase("END")); while (!nextval.equalsIgnoreCase("END"));
} }
@ -427,6 +432,7 @@ public class Profile {
} }
appendData("UPDATES:",sb); appendData("UPDATES:",sb);
appendData(eventStruct,sb); appendData(eventStruct,sb);
appendData(map,sb);
appendData("END",sb); appendData("END",sb);
return sb.toString(); return sb.toString();
} }
@ -468,6 +474,9 @@ public class Profile {
text = "Map "+df.format(mappct)+"% Item "+df.format(itempct)+"%"; text = "Map "+df.format(mappct)+"% Item "+df.format(itempct)+"%";
//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.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.panel.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.6), 50, 0, 2, Color.WHITE, Color.BLACK, text); DrawUtils.drawCenteredOutlineText(g2, sigIRC.panel.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.6), 50, 0, 2, Color.WHITE, Color.BLACK, text);
text = ColorLocation.getLocationName(map);
Rectangle2D siz = TextUtils.calculateStringBoundsFont(text, sigIRC.panel.rabiRibiTinyDisplayFont);
DrawUtils.drawOutlineText(g2, sigIRC.panel.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()-siz.getWidth()-6), 30, 0, 2, ColorLocation.getColor(map), Color.BLACK, text);
statUpdateCacheImage = tmp.getScaledInstance(w, -1, Image.SCALE_AREA_AVERAGING); statUpdateCacheImage = tmp.getScaledInstance(w, -1, Image.SCALE_AREA_AVERAGING);
//stat_update_required = false; //stat_update_required = false;

@ -62,6 +62,8 @@ public class RabiRaceModule extends Module{
final static String AVATAR_DIRECTORY = sigIRC.BASEDIR+"sigIRC/rabi-ribi/characters/"; final static String AVATAR_DIRECTORY = sigIRC.BASEDIR+"sigIRC/rabi-ribi/characters/";
final int PROCESS_PERMISSIONS = WinNT.PROCESS_QUERY_INFORMATION | WinNT.PROCESS_VM_READ | WinNT.PROCESS_VM_WRITE; final int PROCESS_PERMISSIONS = WinNT.PROCESS_QUERY_INFORMATION | WinNT.PROCESS_VM_READ | WinNT.PROCESS_VM_WRITE;
boolean foundRabiRibi = false; boolean foundRabiRibi = false;
final static int WAITFRAMEMAX = 120;
int waitframes = WAITFRAMEMAX;
int rabiRibiPID = -1; int rabiRibiPID = -1;
long rabiRibiMemOffset = 0; long rabiRibiMemOffset = 0;
public HANDLE rabiribiProcess = null; public HANDLE rabiribiProcess = null;
@ -364,12 +366,16 @@ public class RabiRaceModule extends Module{
} }
if (!p.eventStruct.equalsIgnoreCase(myProfile.eventStruct)) { if (!p.eventStruct.equalsIgnoreCase(myProfile.eventStruct)) {
StringBuilder finalevents = new StringBuilder(); StringBuilder finalevents = new StringBuilder();
String[] events = p.eventStruct.split("_");
String[] myevents = myProfile.eventStruct.split("_");
for (int i=0;i<Profile.EVENT_COUNT;i++) { for (int i=0;i<Profile.EVENT_COUNT;i++) {
if (i!=1) { //Ignore syncing ribbon event. if (i!=1) { //Ignore syncing ribbon event.
finalevents.append((Integer.compare(myProfile.eventStruct.charAt(i),p.eventStruct.charAt(i))<0)?p.eventStruct.charAt(i):myProfile.eventStruct.charAt(i)); finalevents.append((events[i].compareTo(myevents[i])>0)?events[i]:myevents[i]);
//finalevents.append((Integer.compare(myProfile.eventStruct.charAt(i),p.eventStruct.charAt(i))<0)?p.eventStruct.charAt(i):myProfile.eventStruct.charAt(i));
} else { } else {
finalevents.append(myProfile.eventStruct.charAt(i)); finalevents.append(myevents[i]);
} }
finalevents.append("_");
} }
UpdateRange(MemoryOffset.EVENT_START,MemoryOffset.EVENT_END,finalevents.toString()); UpdateRange(MemoryOffset.EVENT_START,MemoryOffset.EVENT_END,finalevents.toString());
} }
@ -395,10 +401,9 @@ public class RabiRaceModule extends Module{
} }
f--; f--;
}*/ }*/
for (int l=0;l<i.length();l++) { String[] split = i.split("_");
if (i.charAt(l)=='1') { for (int l=0;l<split.length;l++) {
writeIntToMemory(start.getOffset()+(l*4),1); writeIntToMemory(start.getOffset()+(l*4),Integer.parseInt(split[l]));
}
} }
} }
@ -534,6 +539,18 @@ public class RabiRaceModule extends Module{
myProfile.isPaused = paused>=1; myProfile.isPaused = paused>=1;
if (mySession!=null && mySession.isCoop()) { if (mySession!=null && mySession.isCoop()) {
if (mySession!=null && mySession.isCoop()) {
if (readIntFromMemory(MemoryOffset.TITLE_SCREEN)>=1) {
if (waitframes--<=0) {
mapdata.clear();
newmapdata.clear();
lastreadmapdata=0;
}
} else {
waitframes = WAITFRAMEMAX;
}
}
if (newmapdata.size()>0 && readIntFromMemory(MemoryOffset.PAUSED)>0) { if (newmapdata.size()>0 && readIntFromMemory(MemoryOffset.PAUSED)>0) {
viewingupdatedMapIcons=true; viewingupdatedMapIcons=true;
@ -570,6 +587,7 @@ public class RabiRaceModule extends Module{
myProfile.mappct = readFloatFromMemory(MemoryOffset.MAP_PERCENT); myProfile.mappct = readFloatFromMemory(MemoryOffset.MAP_PERCENT);
myProfile.difficulty = readIntFromMemory(MemoryOffset.GAME_DIFFICULTY); myProfile.difficulty = readIntFromMemory(MemoryOffset.GAME_DIFFICULTY);
myProfile.loop = readIntFromMemory(MemoryOffset.GAME_LOOP); myProfile.loop = readIntFromMemory(MemoryOffset.GAME_LOOP);
myProfile.map = readIntFromMemory(MemoryOffset.MAP_AREA_COLOR);
myProfile.updateClientValues(); myProfile.updateClientValues();
if (mySession!=null && !firstUpdate) { if (mySession!=null && !firstUpdate) {
myProfile.compareAndAnnounceAllChangedValues(); myProfile.compareAndAnnounceAllChangedValues();
@ -812,15 +830,4 @@ public class RabiRaceModule extends Module{
AddMapPoint(0,i,0,i); AddMapPoint(0,i,0,i);
}*/ }*/
} }
public void LeaveSession() {
if (mySession!=null && mySession.isCoop()) {
if (readIntFromMemory(MemoryOffset.TITLE_SCREEN)==10) {
mapdata.clear();
newmapdata.clear();
lastreadmapdata=0;
}
}
}
} }

@ -144,7 +144,7 @@ public enum MemoryOffset {
MAP_PERCENT(0x16E807C,0x13413E4,0x1342404+OffsetHelper.MEMORY_OFFSET_V188_TO_V1881,0x1366404,0x16E48FC,0), //Float MAP_PERCENT(0x16E807C,0x13413E4,0x1342404+OffsetHelper.MEMORY_OFFSET_V188_TO_V1881,0x1366404,0x16E48FC,0), //Float
RAINBOW_EGG_COUNT(0xD65FD4,0xD65FD4+OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V1851,0xD65FD4+OffsetHelper.MEMORY_OFFSET_V175_TO_V1881,0xD65FD4+OffsetHelper.MEMORY_OFFSET_V175_TO_V190,OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V199,OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V199T), RAINBOW_EGG_COUNT(0xD65FD4,0xD65FD4+OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V1851,0xD65FD4+OffsetHelper.MEMORY_OFFSET_V175_TO_V1881,0xD65FD4+OffsetHelper.MEMORY_OFFSET_V175_TO_V190,OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V199,OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V199T),
PAUSED(0x1038D88,0xC969A0,0xC979A0,0xCBB9AC,0x1036D88,0), PAUSED(0x1038D88,0xC969A0,0xC979A0,0xCBB9AC,0x1036D88,0),
TITLE_SCREEN(0x16893F4,0,0,0,0,0), //State becomes 10 on the title screen. TITLE_SCREEN(0xDA6EC8,0,0,0,0,0), //1 = Title Screen, 0 = Anywhere else
EVENT_START(0x167A700,0,0,0,0,0), EVENT_START(0x167A700,0,0,0,0,0),
EVENT_END(0x167AB24,0,0,0,0,0), EVENT_END(0x167AB24,0,0,0,0,0),
@ -160,6 +160,8 @@ public enum MemoryOffset {
MESSAGE_TEXT(0x17A8DE8,0,0,0,0,0), //This references the 27th location of text. Use 27 for TEXTREF value. 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. MESSAGE_TEXTREF(0x16EA4B0,0,0,0,0,0), //This should be 27 as this allows for MESSAGE_TEXT to be our "custom message" handler.
MAP_AREA_COLOR(0x84C888,0,0,0,0,0), //See https://github.com/wcko87/rabiribi-map-editing/blob/master/docs/room_colors.md for colors.
BOSS_FIGHT(0x16E7D9C,0,0,0,0,0), //Should be 1 when in a boss fight. BOSS_FIGHT(0x16E7D9C,0,0,0,0,0), //Should be 1 when in a boss fight.
; ;

2
tmp

@ -1 +1 @@
Client out-of-date. Rejected. 0

@ -1 +1,36 @@
Client out-of-date. Rejected. SigoNitori
10
1584288679
106823
0101110110000010001010100000000000000000000000000000000000000000
1101010000000100000010000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0100000000000000000000000000000000000000000000000000000000000000
0101000100100000000000000000000000000000000000000000000000000000
2
false
1
1
19.066666
11.553846
1584288801
KEYITEMS:
RIBBON;1
HAMMER;1
SLIDING_POWDER;1
CARROT_BOMB;1
SPEED_BOOST;3
RABI_SLIPPERS;1
BUNNY_WHIRL;1
SUNNY_BEAM;1
BUNNY_STRIKE;1
BUNNY_AMULET;1
BADGES:
BADGE_HEALTH_PLUS;2
BADGE_DEF_GROW;1
BADGE_ATK_TRADE;2
BADGE_WEAKEN;1
UPDATES:
1_1_0_0_1_1_1_0_0_1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_1_1_0_1_0_0_0_0_0_0_1_0_0_0_0_0_0_0_1_0_0_0_0_0_0_0_0_1_0_0_0_1_0_0_0_0_0_0_0_0_0_1_1_1_0_0_1_1_1_1_1_1_0_0_1_0_0_1_0_0_0_0_0_0_0_0_0_0_1_0_0_1_0_1_0_0_0_1_0_0_0_0_0_0_0_0_0_1_0_0_0_0_0_1_1_0_0_1_1_0_0_0_1_0_1_0_0_0_1_0_0_0_0_0_0_0_0_0_0_0_0_0_1_1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_
11
END
Loading…
Cancel
Save