Changed debugging and added revival steps.
This commit is contained in:
parent
35463e723f
commit
e3b83f1d76
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -314,7 +314,7 @@ public class Profile {
|
||||
|
||||
public void uploadProfile() {
|
||||
if (sigIRC.authenticated) {
|
||||
File file = new File(sigIRC.BASEDIR+"tmp");
|
||||
File file = new File(sigIRC.BASEDIR+"tmp2");
|
||||
try {
|
||||
org.apache.commons.io.FileUtils.copyURLToFile(new URL("http://45.33.13.215/rabirace/send.php?key=playerdata&timekey="+RabiRaceModule.CLIENT_SERVER_READTIME+"&name="+sigIRC.nickname.toLowerCase()+"&data="+getDataString()),file);
|
||||
} catch (MalformedURLException e) {
|
||||
@ -332,7 +332,6 @@ public class Profile {
|
||||
|
||||
public boolean downloadProfile() {
|
||||
if (sigIRC.authenticated) {
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]Download profile for "+this.displayName+".", "debug.log");
|
||||
File file = new File(sigIRC.BASEDIR+"tmp_profile");
|
||||
try {
|
||||
org.apache.commons.io.FileUtils.copyURLToFile(new URL("http://45.33.13.215/rabirace/send.php?key=retrievedata&timekey="+RabiRaceModule.CLIENT_SERVER_READTIME+"&retrievename="+username.toLowerCase()+"&name="+sigIRC.nickname.toLowerCase()),file);
|
||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
import sig.sigIRC;
|
||||
import sig.modules.RabiRaceModule;
|
||||
import sig.utils.FileUtils;
|
||||
import sig.utils.ReflectUtils;
|
||||
|
||||
public class Session {
|
||||
@ -78,6 +79,7 @@ public class Session {
|
||||
}
|
||||
|
||||
private void DownloadAndAddPlayer(Profile p) {
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]Download profile for "+p.displayName+".", "debug2.log");
|
||||
if (p.downloadProfile()) {
|
||||
if (RabiRaceModule.mySession==null && p.username.equalsIgnoreCase(RabiRaceModule.module.myProfile.username)) {
|
||||
RabiRaceModule.mySession = this;
|
||||
|
@ -58,6 +58,7 @@ public class RabiRaceModule extends Module{
|
||||
final static int RIBBON = 1;
|
||||
final static int CICINI = 2;
|
||||
final static int MIRIAM = 3;
|
||||
public final static int DEBUGMODE = 2;
|
||||
final static String ITEMS_DIRECTORY = sigIRC.BASEDIR+"sigIRC/rabi-ribi/items/";
|
||||
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;
|
||||
@ -90,6 +91,7 @@ public class RabiRaceModule extends Module{
|
||||
public boolean viewingupdatedMapIcons=false;
|
||||
public HashMap<Integer,Integer> mapdata = new HashMap<Integer,Integer>();
|
||||
public HashMap<Integer,Integer> newmapdata = new HashMap<Integer,Integer>();
|
||||
public static ScheduledExecutorService scheduler,scheduler2;
|
||||
int frames=0;
|
||||
|
||||
public SessionListData session_listing = new SessionListData();
|
||||
@ -124,31 +126,17 @@ public class RabiRaceModule extends Module{
|
||||
|
||||
VerifyClientIsValid(); //If the client is not allowed to send data, we need to know that.
|
||||
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.scheduleWithFixedDelay(()->{
|
||||
CheckRabiRibiClient();
|
||||
if (foundRabiRibi) {
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]Start update cycle...", "debug.log");
|
||||
myProfile.uploadProfile();
|
||||
getSessionList();
|
||||
getMessageUpdates();
|
||||
//trimeadProfile.downloadProfile();
|
||||
firstCheck=true;
|
||||
if (mySession!=null) {
|
||||
RequestData("tmp.data","key=keepalivesession&session="+mySession.getID());
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]Requested data"+"key=keepalivesession&session="+mySession.getID(), "debug.log");
|
||||
}
|
||||
}
|
||||
RunRabiRace();
|
||||
}, 5000, 5000, TimeUnit.MILLISECONDS);
|
||||
|
||||
myProfile.downloadProfile(); //Synchronize our profile at the beginning.
|
||||
//System.out.println(myProfile.avatar.displayName);
|
||||
|
||||
ScheduledExecutorService scheduler2 = Executors.newScheduledThreadPool(1);
|
||||
scheduler2 = Executors.newScheduledThreadPool(1);
|
||||
scheduler2.scheduleWithFixedDelay(()->{
|
||||
if (foundRabiRibi) {
|
||||
UpdateMyProfile();
|
||||
}
|
||||
RunRabiRaceUpdater();
|
||||
}, 250, 250, TimeUnit.MILLISECONDS);
|
||||
|
||||
File dir = new File(ITEMS_DIRECTORY);
|
||||
@ -193,6 +181,28 @@ public class RabiRaceModule extends Module{
|
||||
markmap_button = new MarkMapButton(new Rectangle(2,(int)(position.getHeight()-42),120,18),"Mark Map",this);
|
||||
}
|
||||
|
||||
private void RunRabiRaceUpdater() {
|
||||
if (foundRabiRibi) {
|
||||
UpdateMyProfile();
|
||||
}
|
||||
}
|
||||
|
||||
private void RunRabiRace() {
|
||||
CheckRabiRibiClient();
|
||||
if (foundRabiRibi) {
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]Start update cycle...", "debug.log");
|
||||
myProfile.uploadProfile();
|
||||
getSessionList();
|
||||
getMessageUpdates();
|
||||
//trimeadProfile.downloadProfile();
|
||||
firstCheck=true;
|
||||
if (mySession!=null) {
|
||||
RequestData("tmp.data","key=keepalivesession&session="+mySession.getID());
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]Requested data"+"key=keepalivesession&session="+mySession.getID(), "debug.log");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void VerifyClientIsValid() {
|
||||
String[] data = RequestAndStoreData("tmptimer.dat","key=timestamp");
|
||||
int time = -1;
|
||||
@ -510,6 +520,18 @@ public class RabiRaceModule extends Module{
|
||||
public void run() {
|
||||
frames++;
|
||||
if (foundRabiRibi) {
|
||||
if (scheduler.isTerminated() || scheduler.isShutdown()) {
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]For some reason scheduler was terminated! Trying to restart...", "debug2.log");
|
||||
scheduler.scheduleWithFixedDelay(()->{
|
||||
RunRabiRace();
|
||||
}, 5000, 5000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
if (scheduler2.isTerminated() || scheduler2.isShutdown()) {
|
||||
FileUtils.logToFile("["+System.currentTimeMillis()+"]For some reason scheduler2 was terminated! Trying to restart...", "debug2.log");
|
||||
scheduler2.scheduleWithFixedDelay(()->{
|
||||
RunRabiRaceUpdater();
|
||||
}, 250, 250, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
rainbowcycler.run();
|
||||
/*System.out.println("Value: ("+Integer.toHexString((int)(rabiRibiMemOffset+0x1679EF0))+"): "+readIntFromMemory(0x1679EF0));
|
||||
System.out.println("Write...");
|
||||
|
@ -26,6 +26,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import sig.sigIRC;
|
||||
import sig.modules.RabiRaceModule;
|
||||
import sig.modules.ChatLog.ChatLogMessage;
|
||||
|
||||
public class FileUtils {
|
||||
@ -241,7 +242,12 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
public static void logToFile(String message, String filename) {
|
||||
logToFile(message,filename,false);
|
||||
if (filename.equalsIgnoreCase("debug.log") && RabiRaceModule.DEBUGMODE==1
|
||||
||
|
||||
filename.equalsIgnoreCase("debug2.log") && RabiRaceModule.DEBUGMODE==2
|
||||
) {
|
||||
logToFile(message,filename,false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void logToFile(String message, String filename, boolean outputToChatLog) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user