diff --git a/sigIRCv2.jar b/sigIRCv2.jar index 948427f..713bf18 100644 Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ diff --git a/src/sig/modules/RabiRace/Profile.java b/src/sig/modules/RabiRace/Profile.java index be802cc..2bf7536 100644 --- a/src/sig/modules/RabiRace/Profile.java +++ b/src/sig/modules/RabiRace/Profile.java @@ -289,6 +289,7 @@ public class Profile { while (!nextval.equalsIgnoreCase("UPDATES:")); } lastWebUpdate = System.currentTimeMillis(); + return true; } } diff --git a/src/sig/modules/RabiRace/Session.java b/src/sig/modules/RabiRace/Session.java index 261ac12..ad52b3c 100644 --- a/src/sig/modules/RabiRace/Session.java +++ b/src/sig/modules/RabiRace/Session.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import sig.sigIRC; import sig.modules.RabiRaceModule; import sig.utils.ReflectUtils; @@ -53,6 +54,9 @@ public class Session { //System.out.println("Player "+p.username); DownloadAndAddPlayer(p); } + if (RabiRaceModule.syncItems) { + RabiRaceModule.module.SyncItemsWithOtherPlayers(); + } } if (split.length>=8) { difficulty = Float.parseFloat(split[i++]); diff --git a/src/sig/modules/RabiRaceModule.java b/src/sig/modules/RabiRaceModule.java index 5433261..8bab2e6 100644 --- a/src/sig/modules/RabiRaceModule.java +++ b/src/sig/modules/RabiRaceModule.java @@ -75,6 +75,7 @@ public class RabiRaceModule extends Module{ boolean mouseoverAvatar=false; public static boolean avatarRetrieved=false; public static int CLIENT_SERVER_READTIME = -1; + public static boolean syncItems = false; public SessionListData session_listing = new SessionListData(); @@ -223,54 +224,72 @@ public class RabiRaceModule extends Module{ e.printStackTrace(); } String[] data = FileUtils.readFromFile(sigIRC.BASEDIR+"sigIRC/messages"); - boolean message_played=false; + //boolean message_played=false; for (String s : data) { if (s.length()>0) { messages.add(new ScrollingText(s,(int)(lastScrollX+position.getWidth()+24),(int)(position.getHeight()-28))); - message_played=true; + /*message_played=true; System.out.println("Perform item sync with other players."); - SyncItemsWithOtherPlayers(); + SyncItemsWithOtherPlayers();*/ + syncItems=true; } } - if (message_played && mySession.isCoop()) { + /*if (message_played && mySession.isCoop()) { SoundUtils.playSound(sigIRC.BASEDIR+"sigIRC/collect_item.wav"); - } + }*/ } public void SyncItemsWithOtherPlayers() { + boolean soundPlayed=false; for (Profile p : mySession.getPlayers()) { if (p!=myProfile && !p.isPaused) { + boolean updateRequired=false; 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+"."); 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+"."); writeIntToMemory(m.mem.getOffset(),Math.abs(p.badges.get(m))); + updateRequired=true; } } if (p.healthUps>myProfile.healthUps) { System.out.println("You do not have the correct amount of health ups. Syncing to ("+p.healthUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.HEALTHUP_START,MemoryOffset.HEALTHUP_END,p.healthUps-myProfile.healthUps); + updateRequired=true; } if (p.manaUps>myProfile.manaUps) { System.out.println("You do not have the correct amount of mana ups. Syncing to ("+p.manaUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END,p.manaUps-myProfile.manaUps); + updateRequired=true; } if (p.regenUps>myProfile.regenUps) { System.out.println("You do not have the correct amount of regen ups. Syncing to ("+p.regenUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.REGENUP_START,MemoryOffset.REGENUP_END,p.regenUps-myProfile.regenUps); + updateRequired=true; } if (p.packUps>myProfile.packUps) { System.out.println("You do not have the correct amount of pack ups. Syncing to ("+p.packUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.PACKUP_START,MemoryOffset.PACKUP_END,p.packUps-myProfile.packUps); + updateRequired=true; } if (p.attackUps>myProfile.attackUps) { System.out.println("You do not have the correct amount of attack ups. Syncing to ("+p.attackUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END,p.attackUps-myProfile.attackUps); + updateRequired=true; + } + + if (updateRequired && mySession.isCoop()) { + if (!soundPlayed) { + SoundUtils.playSound(sigIRC.BASEDIR+"sigIRC/collect_item.wav"); + soundPlayed=true; + } + updateRequired=false; } } } diff --git a/src/sig/modules/RabiRibi/MemoryOffset.java b/src/sig/modules/RabiRibi/MemoryOffset.java index cd7415e..b237fc6 100644 --- a/src/sig/modules/RabiRibi/MemoryOffset.java +++ b/src/sig/modules/RabiRibi/MemoryOffset.java @@ -140,8 +140,8 @@ public enum MemoryOffset { PACKUP_END(0xD63928,0xD63928+OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V1851,0xD63928+OffsetHelper.MEMORY_OFFSET_V175_TO_V1881,0xD63928+OffsetHelper.MEMORY_OFFSET_V175_TO_V190,OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V199,OffsetHelper.KEY_ITEM_OFFSET_V175_TO_V199T), //13413E8 - ITEM_PERCENT(0x16E807C,0x13413E8,0x1342408+OffsetHelper.MEMORY_OFFSET_V188_TO_V1881,0x1366408,0x16E4900,0), //Float - MAP_PERCENT(0x16E8080,0x13413E4,0x1342404+OffsetHelper.MEMORY_OFFSET_V188_TO_V1881,0x1366404,0x16E48FC,0), //Float + ITEM_PERCENT(0x16E8080,0x13413E8,0x1342408+OffsetHelper.MEMORY_OFFSET_V188_TO_V1881,0x1366408,0x16E4900,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), PAUSED(0x1038D88,0xC969A0,0xC979A0,0xCBB9AC,0x1036D88,0), TITLE_SCREEN(0x16893F4,0,0,0,0,0),