Added Event Syncing
This commit is contained in:
parent
a77a442a76
commit
cff7ca4683
@ -1,3 +1,4 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/sig/modules/RabiRace/SessionCreateWindow.java=UTF-8
|
encoding//src/sig/modules/RabiRace/SessionCreateWindow.java=UTF-8
|
||||||
encoding//src/sig/modules/RabiRace/SessionListWindow.java=UTF-8
|
encoding//src/sig/modules/RabiRace/SessionListWindow.java=UTF-8
|
||||||
|
encoding//src/sig/modules/RabiRibi/MemoryOffset.java=UTF-8
|
||||||
|
@ -24,11 +24,13 @@ import java.util.Random;
|
|||||||
import sig.ScrollingText;
|
import sig.ScrollingText;
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.RabiRaceModule;
|
import sig.modules.RabiRaceModule;
|
||||||
|
import sig.modules.RabiRibi.MemoryOffset;
|
||||||
import sig.utils.DrawUtils;
|
import sig.utils.DrawUtils;
|
||||||
import sig.utils.FileUtils;
|
import sig.utils.FileUtils;
|
||||||
import sig.utils.TextUtils;
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class Profile {
|
public class Profile {
|
||||||
|
public static final int EVENT_COUNT = 265;
|
||||||
public String username = sigIRC.nickname.toLowerCase();
|
public String username = sigIRC.nickname.toLowerCase();
|
||||||
public String displayName = sigIRC.nickname;
|
public String displayName = sigIRC.nickname;
|
||||||
public Avatar avatar;
|
public Avatar avatar;
|
||||||
@ -38,6 +40,7 @@ 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 int rainbowEggs = 0;
|
public int rainbowEggs = 0;
|
||||||
public boolean isPaused = false;
|
public boolean isPaused = false;
|
||||||
public int difficulty = 0;
|
public int difficulty = 0;
|
||||||
@ -192,19 +195,19 @@ public class Profile {
|
|||||||
}
|
}
|
||||||
String announcement = "";
|
String announcement = "";
|
||||||
if (GetHealthUpCount(oldProfile)==GetHealthUpCount(this)-1) {
|
if (GetHealthUpCount(oldProfile)==GetHealthUpCount(this)-1) {
|
||||||
announcement = "has obtained a Health Up! ("+healthUps+" total)";
|
announcement = "has obtained a Health Up! ("+GetHealthUpCount(this)+" total)";
|
||||||
}
|
}
|
||||||
if (GetAttackUpCount(oldProfile)==GetAttackUpCount(this)-1) {
|
if (GetAttackUpCount(oldProfile)==GetAttackUpCount(this)-1) {
|
||||||
announcement = "has obtained an Attack Up! ("+attackUps+" total)";
|
announcement = "has obtained an Attack Up! ("+GetAttackUpCount(this)+" total)";
|
||||||
}
|
}
|
||||||
if (GetManaUpCount(oldProfile)==GetManaUpCount(this)-1) {
|
if (GetManaUpCount(oldProfile)==GetManaUpCount(this)-1) {
|
||||||
announcement = "has obtained a Mana Up! ("+manaUps+" total)";
|
announcement = "has obtained a Mana Up! ("+GetManaUpCount(this)+" total)";
|
||||||
}
|
}
|
||||||
if (GetRegenUpCount(oldProfile)==GetRegenUpCount(this)-1) {
|
if (GetRegenUpCount(oldProfile)==GetRegenUpCount(this)-1) {
|
||||||
announcement = "has obtained a Regen Up! ("+regenUps+" total)";
|
announcement = "has obtained a Regen Up! ("+GetRegenUpCount(this)+" total)";
|
||||||
}
|
}
|
||||||
if (GetPackUpCount(oldProfile)==GetPackUpCount(this)-1) {
|
if (GetPackUpCount(oldProfile)==GetPackUpCount(this)-1) {
|
||||||
announcement = "has obtained a Pack Up! ("+packUps+" total)";
|
announcement = "has obtained a Pack Up! ("+GetPackUpCount(this)+" total)";
|
||||||
}
|
}
|
||||||
if (GetRainbowEggCount(oldProfile)==GetRainbowEggCount(this)-1) {
|
if (GetRainbowEggCount(oldProfile)==GetRainbowEggCount(this)-1) {
|
||||||
if (RabiRaceModule.mySession!=null &&
|
if (RabiRaceModule.mySession!=null &&
|
||||||
@ -270,6 +273,17 @@ public class Profile {
|
|||||||
badges.remove(md);
|
badges.remove(md);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
StringBuilder events = new StringBuilder();
|
||||||
|
for (int i=0;i<EVENT_COUNT;i++) {
|
||||||
|
int val = parent.readIntFromMemory(MemoryOffset.EVENT_START.getOffset()+i*4);
|
||||||
|
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));
|
||||||
|
} else {
|
||||||
|
events.append(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventStruct = events.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadProfile() {
|
public void uploadProfile() {
|
||||||
@ -300,7 +314,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>=19) {
|
if (data.length>=21) {
|
||||||
int i=0;
|
int i=0;
|
||||||
displayName = data[i++];
|
displayName = data[i++];
|
||||||
try {
|
try {
|
||||||
@ -343,6 +357,14 @@ public class Profile {
|
|||||||
}
|
}
|
||||||
while (!nextval.equalsIgnoreCase("UPDATES:"));
|
while (!nextval.equalsIgnoreCase("UPDATES:"));
|
||||||
}
|
}
|
||||||
|
nextval = data[i++];
|
||||||
|
if (!nextval.equalsIgnoreCase("END")) {
|
||||||
|
do {
|
||||||
|
eventStruct = nextval;
|
||||||
|
nextval = data[i++];
|
||||||
|
}
|
||||||
|
while (!nextval.equalsIgnoreCase("END"));
|
||||||
|
}
|
||||||
lastWebUpdate = System.currentTimeMillis();
|
lastWebUpdate = System.currentTimeMillis();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -380,6 +402,8 @@ public class Profile {
|
|||||||
appendData(data.name()+";"+val,sb);
|
appendData(data.name()+";"+val,sb);
|
||||||
}
|
}
|
||||||
appendData("UPDATES:",sb);
|
appendData("UPDATES:",sb);
|
||||||
|
appendData(eventStruct,sb);
|
||||||
|
appendData("END",sb);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class RabiRaceModule extends Module{
|
|||||||
boolean soundPlayed=false;
|
boolean soundPlayed=false;
|
||||||
if (mySession!=null) {
|
if (mySession!=null) {
|
||||||
for (Profile p : mySession.getPlayers()) {
|
for (Profile p : mySession.getPlayers()) {
|
||||||
if (p!=myProfile && !p.isPaused) {
|
if (p!=myProfile && !p.isPaused && !myProfile.isPaused) {
|
||||||
boolean updateRequired=false;
|
boolean updateRequired=false;
|
||||||
for (MemoryData m : p.key_items.keySet()) {
|
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)) {
|
if (p.key_items.get(m)!=0 && (!myProfile.key_items.containsKey(m) || myProfile.key_items.get(m)==0)) {
|
||||||
@ -286,6 +286,13 @@ public class RabiRaceModule extends Module{
|
|||||||
UpdateRange(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END,p.attackUps);
|
UpdateRange(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END,p.attackUps);
|
||||||
updateRequired=true;
|
updateRequired=true;
|
||||||
}
|
}
|
||||||
|
if (!p.eventStruct.equalsIgnoreCase(myProfile.eventStruct)) {
|
||||||
|
StringBuilder finalevents = new StringBuilder();
|
||||||
|
for (int i=0;i<Profile.EVENT_COUNT;i++) {
|
||||||
|
finalevents.append((Integer.compare(myProfile.eventStruct.charAt(i),p.eventStruct.charAt(i))<0)?p.eventStruct.charAt(i):myProfile.eventStruct.charAt(i));
|
||||||
|
}
|
||||||
|
UpdateRange(MemoryOffset.EVENT_START,MemoryOffset.EVENT_END,finalevents.toString());
|
||||||
|
}
|
||||||
|
|
||||||
if (updateRequired && mySession.isCoop()) {
|
if (updateRequired && mySession.isCoop()) {
|
||||||
if (!soundPlayed) {
|
if (!soundPlayed) {
|
||||||
|
@ -145,6 +145,9 @@ public enum MemoryOffset {
|
|||||||
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),
|
TITLE_SCREEN(0x16893F4,0,0,0,0,0),
|
||||||
|
|
||||||
|
EVENT_START(0x167A700,0,0,0,0,0),
|
||||||
|
EVENT_END(0x167AB24,0,0,0,0,0),
|
||||||
;
|
;
|
||||||
|
|
||||||
long base_offset;
|
long base_offset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user