Fix NullPointer for syncing items with other players.

master
sigonasr2 5 years ago
parent 0644cd10a7
commit 172482beda
  1. BIN
      sigIRCv2.jar
  2. 90
      src/sig/modules/RabiRaceModule.java

Binary file not shown.

@ -241,55 +241,57 @@ public class RabiRaceModule extends Module{
public void SyncItemsWithOtherPlayers() { public void SyncItemsWithOtherPlayers() {
boolean soundPlayed=false; boolean soundPlayed=false;
for (Profile p : mySession.getPlayers()) { if (mySession!=null) {
if (p!=myProfile && !p.isPaused) { for (Profile p : mySession.getPlayers()) {
boolean updateRequired=false; if (p!=myProfile && !p.isPaused) {
for (MemoryData m : p.key_items.keySet()) { boolean updateRequired=false;
if (p.key_items.get(m)!=0 && (!myProfile.key_items.containsKey(m) || myProfile.key_items.get(m)==0)) { for (MemoryData m : p.key_items.keySet()) {
System.out.println("You do not have a "+m.name+". Syncing from "+p.displayName+"."); if (p.key_items.get(m)!=0 && (!myProfile.key_items.containsKey(m) || myProfile.key_items.get(m)==0)) {
writeIntToMemory(m.mem.getOffset(),Math.abs(p.key_items.get(m))); 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 (Profile.GetHealthUpCount(p)>Profile.GetHealthUpCount(myProfile)) {
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);
updateRequired=true; updateRequired=true;
} }
} if (Profile.GetManaUpCount(p)>Profile.GetManaUpCount(myProfile)) {
for (MemoryData m : p.badges.keySet()) { System.out.println("You do not have the correct amount of mana ups. Syncing to ("+p.manaUps+") from "+p.displayName+".");
if (p.badges.get(m)!=0 && (!myProfile.badges.containsKey(m) || myProfile.badges.get(m)==0)) { UpdateRange(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END,p.manaUps);
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; updateRequired=true;
} }
} if (Profile.GetRegenUpCount(p)>Profile.GetRegenUpCount(myProfile)) {
if (Profile.GetHealthUpCount(p)>Profile.GetHealthUpCount(myProfile)) { System.out.println("You do not have the correct amount of regen ups. Syncing to ("+p.regenUps+") from "+p.displayName+".");
System.out.println("You do not have the correct amount of health ups. Syncing to ("+p.healthUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.REGENUP_START,MemoryOffset.REGENUP_END,p.regenUps);
UpdateRange(MemoryOffset.HEALTHUP_START,MemoryOffset.HEALTHUP_END,p.healthUps); updateRequired=true;
updateRequired=true; }
} if (Profile.GetPackUpCount(p)>Profile.GetPackUpCount(myProfile)) {
if (Profile.GetManaUpCount(p)>Profile.GetManaUpCount(myProfile)) { System.out.println("You do not have the correct amount of pack ups. Syncing to ("+p.packUps+") from "+p.displayName+".");
System.out.println("You do not have the correct amount of mana ups. Syncing to ("+p.manaUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.PACKUP_START,MemoryOffset.PACKUP_END,p.packUps);
UpdateRange(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END,p.manaUps); updateRequired=true;
updateRequired=true; }
} if (Profile.GetAttackUpCount(p)>Profile.GetAttackUpCount(myProfile)) {
if (Profile.GetRegenUpCount(p)>Profile.GetRegenUpCount(myProfile)) { System.out.println("You do not have the correct amount of attack ups. Syncing to ("+p.attackUps+") from "+p.displayName+".");
System.out.println("You do not have the correct amount of regen ups. Syncing to ("+p.regenUps+") from "+p.displayName+"."); UpdateRange(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END,p.attackUps);
UpdateRange(MemoryOffset.REGENUP_START,MemoryOffset.REGENUP_END,p.regenUps); updateRequired=true;
updateRequired=true; }
}
if (Profile.GetPackUpCount(p)>Profile.GetPackUpCount(myProfile)) { if (updateRequired && mySession.isCoop()) {
System.out.println("You do not have the correct amount of pack ups. Syncing to ("+p.packUps+") from "+p.displayName+"."); if (!soundPlayed) {
UpdateRange(MemoryOffset.PACKUP_START,MemoryOffset.PACKUP_END,p.packUps); SoundUtils.playSound(sigIRC.BASEDIR+"sigIRC/collect_item.wav");
updateRequired=true; soundPlayed=true;
} }
if (Profile.GetAttackUpCount(p)>Profile.GetAttackUpCount(myProfile)) { updateRequired=false;
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);
updateRequired=true;
}
if (updateRequired && mySession.isCoop()) {
if (!soundPlayed) {
SoundUtils.playSound(sigIRC.BASEDIR+"sigIRC/collect_item.wav");
soundPlayed=true;
} }
updateRequired=false;
} }
} }
} }

Loading…
Cancel
Save