Jump to content

Painting in onStart


Swizzbeat

Recommended Posts

Bot class has a public getter for BotCanvas, which you can repaint or grab Graphics from;

However, the getter is reobfuscated with every release

 

I suppose you could grab it between compilations using reflection; Try something like this..

Field[] fields = bot.getClass().getDeclaredFields();
BotCanvas canvas = null;
for (Field field : fields) {
	if (field.getType().isAssignableFrom(BotCanvas.class)) {
		try {
                        field.setAccessible(true);
			canvas = (BotCanvas) field.get(bot);
		} catch (IllegalArgumentException | IllegalAccessException ex) {
			//Exception handling
		}
	}
}
if(canvas != null) {
	Graphics g = canvas.getGraphics(); //Grab graphics context
	canvas.repaint(); //Repaint
}
Edited by FrostBug
Link to comment
Share on other sites

 

Bot class has a public getter for BotCanvas, which you can repaint or grab Graphics from;

However, the getter is reobfuscated with every release

 

I suppose you could grab it between compilations using reflection; Try something like this..

Field[] fields = bot.getClass().getDeclaredFields();
BotCanvas canvas = null;
for (Field field : fields) {
	if (field.getType().isAssignableFrom(BotCanvas.class)) {
		try {
                        field.setAccessible(true);
			canvas = (BotCanvas) field.get(bot);
		} catch (IllegalArgumentException | IllegalAccessException ex) {
			//Exception handling
		}
	}
}
if(canvas != null) {
	Graphics g = canvas.getGraphics(); //Grab graphics context
	canvas.repaint(); //Repaint
}

Yeah I was trying to avoid doing this because of, like you said, the obfuscation. I'll try this code out and see what I can do thanks biggrin.png

 

EDIT: Tried both this code out as well as getting the canvas directly and they both just lead to an onStart error being supressed. Here's the message when I log the BotCanvas: bx[canvas0,0,0,765x503,invalid]

 

EDIT EDIT: Nevermind found the real issue. It's grabbing the canvas context fine but for some reason when I'm trying to get the bounding box of a specific object it's returning null...

Edited by Swizzbeat
Link to comment
Share on other sites

Yeah I was trying to avoid doing this because of, like you said, the obfuscation. I'll try this code out and see what I can do thanks biggrin.png

 

EDIT: Tried both this code out as well as getting the canvas directly and they both just lead to an onStart error being supressed. Here's the message when I log the BotCanvas: bx[canvas0,0,0,765x503,invalid]

 

EDIT EDIT: Nevermind found the real issue. It's grabbing the canvas context fine but for some reason when I'm trying to get the bounding box of a specific object it's returning null...

 

you reobsucate the biometric sphere and replace it with botcanvas

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...