parent
0ad5cb7972
commit
faea730e37
Binary file not shown.
@ -0,0 +1,71 @@ |
||||
package sig.modules.RabiRace; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
public class ColorCycler { |
||||
int r = 0; |
||||
int g = 0; |
||||
int b = 0; |
||||
int a = 255; |
||||
int cyclespd = 0; |
||||
int stage = 1; //1 = Green+, 2 = Red-, 3 = Blue+, 4 = Green-, 5 = Red+, 6 = Blue-
|
||||
|
||||
public ColorCycler(Color startingColor, int cyclespd) { |
||||
this.r = startingColor.getRed(); |
||||
this.g = startingColor.getGreen(); |
||||
this.b = startingColor.getBlue(); |
||||
this.a = startingColor.getAlpha(); |
||||
this.cyclespd=cyclespd; |
||||
} |
||||
|
||||
public void run() { |
||||
switch (stage) { |
||||
case 1:{ |
||||
if (g<255) { |
||||
g=Math.min(255, g+cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 2:{ |
||||
if (r>0) { |
||||
r=Math.max(0, r-cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 3:{ |
||||
if (b<255) { |
||||
b=Math.min(255, b+cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 4:{ |
||||
if (g>0) { |
||||
g=Math.max(0, g-cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 5:{ |
||||
if (r<255) { |
||||
r=Math.min(255, r+cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 6:{ |
||||
if (b>0) { |
||||
b=Math.max(0, b-cyclespd); |
||||
} else { |
||||
stage=1; |
||||
} |
||||
}break; |
||||
} |
||||
} |
||||
|
||||
public Color getCycleColor() { |
||||
return new Color(r,g,b,a); |
||||
} |
||||
} |
@ -0,0 +1,98 @@ |
||||
package sig.modules.RabiRace; |
||||
|
||||
import java.awt.Image; |
||||
|
||||
import sig.modules.RabiRaceModule; |
||||
import sig.modules.RabiRibi.MemoryOffset; |
||||
|
||||
public enum MemoryData { |
||||
HAMMER(MemoryOffset.HAMMER,"Hammer","piko_hammer.png",true), |
||||
AIR_JUMP(MemoryOffset.AIR_JUMP,"Air Jump","air_jump.png",true), |
||||
SLIDING_POWDER(MemoryOffset.SLIDING_POWDER,"Sliding Powder","sliding_powder.png",true), |
||||
CARROT_BOMB(MemoryOffset.CARROT_BOMB,"Carrot Bomb","carrot_bomb.png",true), |
||||
HOURGLASS(MemoryOffset.HOURGLASS,"Hourglass","hourglass.png",true), |
||||
SPEED_BOOST(MemoryOffset.SPEED_BOOST,"Speed Boost","speed_boost.png",true), |
||||
AUTO_EARRINGS(MemoryOffset.AUTO_EARRINGS,"Auto Earrings","auto_earrings.png",true), |
||||
RIBBON(MemoryOffset.RIBBON,"Ribbon","ribbon.png",true), |
||||
SOUL_HEART(MemoryOffset.SOUL_HEART,"Soul Heart","soul_heart.png",true), |
||||
RABI_SLIPPERS(MemoryOffset.RABI_SLIPPERS,"Rabi Slippers","rabi_slippers.png",true), |
||||
BUNNY_WHIRL(MemoryOffset.BUNNY_WHIRL,"Bunny Whirl","bunny_whirl.png",true), |
||||
QUICK_BARRETTE(MemoryOffset.QUICK_BARETTE,"Quick Barrette","quick_barrette.png",true), |
||||
BOOK_OF_CARROT(MemoryOffset.BOOK_OF_CARROT,"Book of Carrot","book_of_carrot.png",true), |
||||
CHAOS_ROD(MemoryOffset.CHAOS_ROD,"Chaos Rod","chaos_rod.png",true), |
||||
HAMMER_WAVE(MemoryOffset.HAMMER_WAVE,"Hammer Wave","hammer_wave.png",true), |
||||
HAMMER_ROLL(MemoryOffset.HAMMER_ROLL,"Hammer Roll","hammer_roll.png",true), |
||||
LIGHT_ORB(MemoryOffset.LIGHT_ORB,"Light Orb","light_orb.png",true), |
||||
WATER_ORB(MemoryOffset.WATER_ORB,"Water Orb","water_orb.png",true), |
||||
FIRE_ORB(MemoryOffset.FIRE_ORB,"Fire Orb","fire_orb.png",true), |
||||
NATURE_ORB(MemoryOffset.NATURE_ORB,"Nature Orb","nature_orb.png",true), |
||||
P_HAIRPIN(MemoryOffset.P_HAIRPIN,"P. Hairpin","p_hairpin.png",true), |
||||
SUNNY_BEAM(MemoryOffset.SUNNY_BEAM,"Sunny Beam","sunny_beam.png",true), |
||||
PLUS_NECKLACE(MemoryOffset.PLUS_NECKLACE,"Plus Necklace","plus_necklace.png",true), |
||||
CYBER_FLOWER(MemoryOffset.CYBER_FLOWER,"Cyber Flower","cyber_flower.png",true), |
||||
HEALING_STAFF(MemoryOffset.HEALING_STAFF,"Healing Staff","healing_staff.png",true), |
||||
MAX_BRACELET(MemoryOffset.MAX_BRACELET,"Max Bracelet","max_bracelet.png",true), |
||||
EXPLODE_SHOT(MemoryOffset.EXPLODE_SHOT,"Explode Shot","explode_shot.png",true), |
||||
AIR_DASH(MemoryOffset.AIR_DASH,"Air Dash","air_dash.png",true), |
||||
BUNNY_STRIKE(MemoryOffset.BUNNY_STRIKE,"Bunny Strike","bunny_strike.png",true), |
||||
STRANGE_BOX(MemoryOffset.STRANGE_BOX,"Strage Box","strange_box.png",true), |
||||
WALL_JUMP(MemoryOffset.WALL_JUMP,"Wall Jump","wall_jump.png",true), |
||||
SPIKE_BARRIER(MemoryOffset.SPIKE_BARRIER,"Spike Barrier","spike_barrier.png",true), |
||||
BUNNY_AMULET(MemoryOffset.BUNNY_AMULET,"Bunny Amulet","bunny_amulet.png",true), |
||||
CHARGE_RING(MemoryOffset.CHARGE_RING,"Charge Ring","charge_ring.png",true), |
||||
CARROT_SHOOTER(MemoryOffset.CARROT_SHOOTER,"Carrot Shooter","carrot_shooter.png",true), |
||||
SUPER_CARROT(MemoryOffset.SUPER_CARROT,"Super Carrot","super_carrot.png",true), |
||||
/*DLC_ITEM1(MemoryOffset.DLC_ITEM1,"","",true), |
||||
DLC_ITEM2(MemoryOffset.DLC_ITEM2,"","",true), |
||||
DLC_ITEM3(MemoryOffset.DLC_ITEM3,"","",true), |
||||
DLC_ITEM4(MemoryOffset.DLC_ITEM4,"","",true),*/ |
||||
BADGE_HEALTH_PLUS(MemoryOffset.BADGE_HEALTH_PLUS,"Health Plus","health_plus.png",false), |
||||
BADGE_HEALTH_SURGE(MemoryOffset.BADGE_HEALTH_SURGE,"Health Surge","health_surge.png",false), |
||||
BADGE_MANA_PLUS(MemoryOffset.BADGE_MANA_PLUS,"Mana Plus","mana_plus.png",false), |
||||
BADGE_MANA_SURGE(MemoryOffset.BADGE_MANA_SURGE,"Mana Surge","mana_surge.png",false), |
||||
BADGE_CRISIS_BOOST(MemoryOffset.BADGE_CRISIS_BOOST,"Crisis Boost","crisis_boost.png",false), |
||||
BADGE_ATK_GROW(MemoryOffset.BADGE_ATK_GROW,"ATK Grow","atk_grow.png",false), |
||||
BADGE_DEF_GROW(MemoryOffset.BADGE_DEF_GROW,"DEF Grow","def_grow.png",false), |
||||
BADGE_ATK_TRADE(MemoryOffset.BADGE_ATK_TRADE,"ATK Trade","atk_trade.png",false), |
||||
BADGE_DEF_TRADE(MemoryOffset.BADGE_DEF_TRADE,"DEF Trade","def_trade.png",false), |
||||
BADGE_ARM_STRENGTH(MemoryOffset.BADGE_ARM_STRENGTH,"Arm Strength","arm_strength.png",false), |
||||
BADGE_CARROT_BOOST(MemoryOffset.BADGE_CARROT_BOOST,"Carrot Boost","carrot_boost.png",false), |
||||
BADGE_WEAKEN(MemoryOffset.BADGE_WEAKEN,"Weaken","weaken.png",false), |
||||
BADGE_SELF_DEFENSE(MemoryOffset.BADGE_SELF_DEFENSE,"Self Defense","self_defense.png",false), |
||||
BADGE_ARMORED(MemoryOffset.BADGE_ARMORED,"Armored","armored.png",false), |
||||
BADGE_LUCKY_SEVEN(MemoryOffset.BADGE_LUCKY_SEVEN,"Lucky Seven","lucky_seven.png",false), |
||||
BADGE_HEX_CANCEL(MemoryOffset.BADGE_HEX_CANCEL,"Hex Cancel","hex_cancel.png",false), |
||||
BADGE_PURE_LOVE(MemoryOffset.BADGE_PURE_LOVE,"Pure Love","pure_love.png",false), |
||||
BADGE_TOXIC_STRIKE(MemoryOffset.BADGE_TOXIC_STRIKE,"Toxic Strike","toxic_strike.png",false), |
||||
BADGE_FRAME_CANCEL(MemoryOffset.BADGE_FRAME_CANCEL,"Frame Cancel","frame_cancel.png",false), |
||||
BADGE_HEALTH_WAGER(MemoryOffset.BADGE_HEALTH_WAGER,"Health Wager","health_wager.png",false), |
||||
BADGE_MANA_WAGER(MemoryOffset.BADGE_MANA_WAGER,"Mana Wager","mana_wager.png",false), |
||||
BADGE_STAMINA_PLUS(MemoryOffset.BADGE_STAMINA_PLUS,"Stamina Plus","stamina_plus.png",false), |
||||
BADGE_BLESSED(MemoryOffset.BADGE_BLESSED,"Blessed","blessed.png",false), |
||||
BADGE_HITBOX_DOWN(MemoryOffset.BADGE_HITBOX_DOWN,"Hitbox Down","hitbox_down.png",false), |
||||
BADGE_CASHBACK(MemoryOffset.BADGE_CASHBACK,"Cashback","cashback.png",false), |
||||
BADGE_SURVIVAL(MemoryOffset.BADGE_SURVIVAL,"Survival","survival.png",false), |
||||
BADGE_TOP_FORM(MemoryOffset.BADGE_TOP_FORM,"Top Form","top_form.png",false), |
||||
BADGE_TOUGH_SKIN(MemoryOffset.BADGE_TOUGH_SKIN,"Tough Skin","tough_skin.png",false), |
||||
BADGE_ERINA_BADGE(MemoryOffset.BADGE_ERINA_BADGE,"Erina","erina_badge.png",false), |
||||
BADGE_RIBBON_BADGE(MemoryOffset.BADGE_RIBBON_BADGE,"Ribbon","ribbon_badge.png",false), |
||||
BADGE_AUTO_TRIGGER(MemoryOffset.BADGE_AUTO_TRIGGER,"Auto Trigger","auto_trigger.png",false), |
||||
BADGE_LILITHS_GIFT(MemoryOffset.BADGE_LILITHS_GIFT,"Lilith's Gift","lilith_s_gift.png",false), |
||||
; |
||||
|
||||
public MemoryOffset mem; |
||||
public String name; |
||||
public Image img; |
||||
public boolean key_item; //Set to true if it's a key item. False if it's a badge.
|
||||
|
||||
MemoryData(MemoryOffset mem, String name, String icon_name, boolean isKeyItem) { |
||||
this.mem = mem; |
||||
this.name = name; |
||||
this.img = RabiRaceModule.image_map.get(icon_name); |
||||
this.key_item = isKeyItem; |
||||
} |
||||
|
||||
public String getDisplayName() { |
||||
return (key_item)?name:name+" Badge"; |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
package sig.modules.RabiRace; |
||||
|
||||
import java.util.HashMap; |
||||
|
||||
import sig.modules.RabiRaceModule; |
||||
|
||||
public class Profile { |
||||
public int playtime = 0; |
||||
public int healthUps = 0; |
||||
public int attackUps = 0; |
||||
public int manaUps = 0; |
||||
public int regenUps = 0; |
||||
public int packUps = 0; |
||||
public int rainbowEggCount = 0; |
||||
public boolean isPaused = false; |
||||
public int difficulty = 0; |
||||
public int loop = 0; |
||||
public float itempct = 0; |
||||
public float mappct = 0; |
||||
public HashMap<String,MemoryData> key_items = new HashMap<String,MemoryData>(); |
||||
public HashMap<String,MemoryData> badges = new HashMap<String,MemoryData>(); |
||||
RabiRaceModule parent; |
||||
|
||||
public Profile(RabiRaceModule module) { |
||||
this.parent = module; |
||||
} |
||||
|
||||
public void updateClientValues() { |
||||
for (MemoryData md : RabiRaceModule.key_items_list) { |
||||
//System.out.println("Checking "+md.getDisplayName());
|
||||
if (parent.readIntFromMemory(md.mem)!=0) { |
||||
key_items.put(md.name, md); |
||||
//System.out.println("Obtained "+md.getDisplayName());
|
||||
} else { |
||||
key_items.remove(md.name); |
||||
} |
||||
} |
||||
for (MemoryData md : RabiRaceModule.badges_list) { |
||||
if (parent.readIntFromMemory(md.mem)!=0) { |
||||
badges.put(md.name, md); |
||||
//System.out.println("Obtained "+md.getDisplayName());
|
||||
} else { |
||||
key_items.remove(md.name); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,293 @@ |
||||
package sig.modules; |
||||
|
||||
import java.awt.Color; |
||||
import java.awt.Graphics; |
||||
import java.awt.Image; |
||||
import java.awt.geom.Rectangle2D; |
||||
import java.awt.image.BufferedImage; |
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.util.ArrayList; |
||||
import java.util.ConcurrentModificationException; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.concurrent.Executors; |
||||
import java.util.concurrent.ScheduledExecutorService; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
import javax.imageio.ImageIO; |
||||
|
||||
import com.sun.jna.Memory; |
||||
import com.sun.jna.Pointer; |
||||
import com.sun.jna.platform.win32.Kernel32; |
||||
import com.sun.jna.platform.win32.WinNT; |
||||
import com.sun.jna.platform.win32.WinNT.HANDLE; |
||||
|
||||
import sig.Module; |
||||
import sig.sigIRC; |
||||
import sig.modules.RabiRace.ColorCycler; |
||||
import sig.modules.RabiRace.MemoryData; |
||||
import sig.modules.RabiRace.Profile; |
||||
import sig.modules.RabiRibi.MemoryOffset; |
||||
import sig.modules.RabiRibi.MemoryType; |
||||
import sig.modules.utils.PsapiTools; |
||||
import sig.utils.DrawUtils; |
||||
|
||||
public class RabiRaceModule extends Module{ |
||||
final static String ITEMS_DIRECTORY = sigIRC.BASEDIR+"sigIRC/rabi-ribi/items/"; |
||||
final int PROCESS_PERMISSIONS = WinNT.PROCESS_QUERY_INFORMATION | WinNT.PROCESS_VM_READ; |
||||
boolean foundRabiRibi = false; |
||||
int rabiRibiPID = -1; |
||||
long rabiRibiMemOffset = 0; |
||||
public HANDLE rabiribiProcess = null; |
||||
public static HashMap<String,Image> image_map = new HashMap<String,Image>(); |
||||
ColorCycler rainbowcycler = new ColorCycler(new Color(255,0,0,96),8); |
||||
Profile myProfile = new Profile(this); |
||||
|
||||
public static List<MemoryData> key_items_list = new ArrayList<MemoryData>(); |
||||
public static List<MemoryData> badges_list = new ArrayList<MemoryData>(); |
||||
|
||||
public RabiRaceModule(Rectangle2D bounds, String moduleName) { |
||||
super(bounds, moduleName); |
||||
//Initialize();
|
||||
Initialize(); |
||||
|
||||
//System.out.println("Money value is: "+readIntFromMemory(MemoryOffset.MONEY));
|
||||
} |
||||
|
||||
private void Initialize() { |
||||
CheckRabiRibiClient(); |
||||
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); |
||||
scheduler.scheduleWithFixedDelay(()->{ |
||||
CheckRabiRibiClient(); |
||||
UpdateMyProfile(); |
||||
}, 5000, 5000, TimeUnit.MILLISECONDS); |
||||
|
||||
File dir = new File(ITEMS_DIRECTORY); |
||||
String[] images = dir.list(); |
||||
List<String> filtered_images = new ArrayList<String>(); |
||||
for (String file : images) { |
||||
File f = new File(ITEMS_DIRECTORY+file); |
||||
if (!f.isDirectory()) { |
||||
filtered_images.add(file); |
||||
} |
||||
} |
||||
images = filtered_images.toArray(new String[filtered_images.size()]); |
||||
for (String image : images) { |
||||
try { |
||||
image_map.put(image, ImageIO.read(new File(ITEMS_DIRECTORY+image))); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
for (MemoryData md : MemoryData.values()) { |
||||
if (md.key_item) { |
||||
key_items_list.add(md); |
||||
} else { |
||||
badges_list.add(md); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void CheckRabiRibiClient() { |
||||
List<Integer> pids; |
||||
try { |
||||
pids = PsapiTools.getInstance().enumProcesses(); |
||||
boolean found=false; |
||||
for (Integer pid : pids) { |
||||
HANDLE process = Kernel32.INSTANCE.OpenProcess(PROCESS_PERMISSIONS, true, pid); |
||||
List<sig.modules.utils.Module> hModules; |
||||
try { |
||||
hModules = PsapiTools.getInstance().EnumProcessModules(process); |
||||
for(sig.modules.utils.Module m: hModules){ |
||||
//System.out.println(m.getFileName()+":"+m.getEntryPoint());
|
||||
if (m.getFileName().contains("rabiribi")) { |
||||
found=true; |
||||
if (!foundRabiRibi) { |
||||
rabiRibiMemOffset = Pointer.nativeValue(m.getLpBaseOfDll().getPointer()); |
||||
System.out.println("Found an instance of Rabi-Ribi at 0x"+Long.toHexString(rabiRibiMemOffset)+" | File:"+m.getFileName()+","+m.getBaseName()); |
||||
rabiRibiPID=pid; |
||||
foundRabiRibi=true; |
||||
rabiribiProcess=process; |
||||
break; |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
if (found) { |
||||
break; |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
if (process!=null) { |
||||
Kernel32.INSTANCE.CloseHandle(process); |
||||
} |
||||
} |
||||
if (!found && foundRabiRibi) { |
||||
foundRabiRibi=false; |
||||
System.out.println("Rabi-Ribi process lost."); |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
public void run() { |
||||
if (foundRabiRibi) { |
||||
rainbowcycler.run(); |
||||
} |
||||
} |
||||
|
||||
private void UpdateMyProfile() { |
||||
if (foundRabiRibi) { |
||||
//System.out.println("Called.");
|
||||
myProfile.rainbowEggCount = readIntFromMemory(MemoryOffset.RAINBOW_EGG_COUNT); |
||||
myProfile.attackUps = readItemCountFromMemory(MemoryOffset.ATTACKUP_START,MemoryOffset.ATTACKUP_END); |
||||
myProfile.healthUps = readItemCountFromMemory(MemoryOffset.HEALTHUP_START,MemoryOffset.HEALTHUP_END); |
||||
myProfile.manaUps = readItemCountFromMemory(MemoryOffset.MANAUP_START,MemoryOffset.MANAUP_END); |
||||
myProfile.regenUps = readItemCountFromMemory(MemoryOffset.REGENUP_START,MemoryOffset.REGENUP_END); |
||||
myProfile.packUps = readItemCountFromMemory(MemoryOffset.PACKUP_START,MemoryOffset.PACKUP_END); |
||||
myProfile.isPaused = readIntFromMemory(MemoryOffset.WARP_TRANSITION_COUNTER)==141; |
||||
myProfile.itempct = readFloatFromMemory(MemoryOffset.ITEM_PERCENT); |
||||
myProfile.mappct = readFloatFromMemory(MemoryOffset.MAP_PERCENT); |
||||
myProfile.playtime = readIntFromMemory(MemoryOffset.PLAYTIME); |
||||
myProfile.updateClientValues(); |
||||
} |
||||
} |
||||
|
||||
/*public int readIntFromErinaData(MemoryOffset val) { |
||||
return readIntFromPointer(val,MemoryOffset.ENTITY_ARRAY); |
||||
} |
||||
|
||||
public float readFloatFromErinaData(MemoryOffset val) { |
||||
return readFloatFromPointer(val,MemoryOffset.ENTITY_ARRAY); |
||||
}*/ |
||||
|
||||
public int readIntFromMemory(long offset) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(rabiRibiMemOffset+offset), mem, 4, null); |
||||
return mem.getInt(0); |
||||
} |
||||
|
||||
public float readFloatFromMemory(long offset) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(rabiRibiMemOffset+offset), mem, 4, null); |
||||
return mem.getFloat(0); |
||||
} |
||||
|
||||
public float readFloatFromMemoryOffset(MemoryOffset val, long pointer) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(pointer+val.getOffset()), mem, 4, null); |
||||
return mem.getFloat(0); |
||||
} |
||||
|
||||
public int readIntFromMemoryOffset(MemoryOffset val, long pointer) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(pointer+val.getOffset()), mem, 4, null); |
||||
return mem.getInt(0); |
||||
} |
||||
|
||||
public float readDirectFloatFromMemoryLocation(long pointer) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(pointer), mem, 4, null); |
||||
return mem.getFloat(0); |
||||
} |
||||
|
||||
public int readDirectIntFromMemoryLocation(long pointer) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(pointer), mem, 4, null); |
||||
return mem.getInt(0); |
||||
} |
||||
|
||||
public int readIntFromPointer(MemoryOffset val, MemoryOffset pointer) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(readIntFromMemory(pointer.getOffset())+val.getOffset()), mem, 4, null); |
||||
return mem.getInt(0); |
||||
} |
||||
|
||||
public float readFloatFromPointer(MemoryOffset val, MemoryOffset pointer) { |
||||
Memory mem = new Memory(4); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(readIntFromMemory(pointer.getOffset())+val.getOffset()), mem, 4, null); |
||||
return mem.getFloat(0); |
||||
} |
||||
|
||||
public int readIntFromMemory(MemoryOffset val) { |
||||
return (int)readFromMemory(val,MemoryType.INTEGER); |
||||
} |
||||
|
||||
public float readFloatFromMemory(MemoryOffset val) { |
||||
return (float)readFromMemory(val,MemoryType.FLOAT); |
||||
} |
||||
|
||||
Object readFromMemory(MemoryOffset val, MemoryType type) { |
||||
Memory mem = new Memory(type.getSize()); |
||||
Kernel32.INSTANCE.ReadProcessMemory(rabiribiProcess, new Pointer(rabiRibiMemOffset+val.getOffset()), mem, type.getSize(), null); |
||||
switch (type) { |
||||
case FLOAT: |
||||
return mem.getFloat(0); |
||||
case INTEGER: |
||||
return mem.getInt(0); |
||||
default: |
||||
System.out.println("WARNING! Type "+type+" does not have a defined value."); |
||||
return -1; |
||||
} |
||||
} |
||||
|
||||
int readItemCountFromMemory(MemoryOffset start_range, |
||||
MemoryOffset end_range) { |
||||
int count=0; |
||||
for (long i=start_range.getOffset();i<=end_range.getOffset();i++) { |
||||
if (readIntFromMemory(i)==1) { |
||||
count++; |
||||
} |
||||
} |
||||
return count; |
||||
} |
||||
|
||||
public void draw(Graphics g) { |
||||
super.draw(g); |
||||
if (!foundRabiRibi) { |
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, position.getX(), position.getY()+26, Color.BLACK, "Rabi-Ribi not found! Please start it."); |
||||
} else { |
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, position.getX(), position.getY()+26, Color.BLACK, "Values: "+readIntFromMemory(MemoryOffset.DLC_ITEM1)+","+readIntFromMemory(MemoryOffset.DLC_ITEM2)+","+readIntFromMemory(MemoryOffset.DLC_ITEM3)+","+readIntFromMemory(MemoryOffset.DLC_ITEM4)); |
||||
final int border=20; |
||||
final int width=(int)(position.getWidth()-border*2); |
||||
final int spacing=width/5; |
||||
for (int i=0;i<5;i++) { |
||||
Image img = image_map.get("easter_egg.png"); |
||||
Color col = (myProfile.rainbowEggCount>i)?rainbowcycler.getCycleColor():new Color(0,0,0,192); |
||||
DrawUtils.drawImage(g, img, (int)(position.getX()+border+i*spacing-img.getWidth(sigIRC.panel)/4),(int)(position.getY()+36),col,sigIRC.panel); |
||||
} |
||||
int size = myProfile.key_items.size(); |
||||
final int icon_size = 24; |
||||
int count = 0; |
||||
try { |
||||
for (String key : myProfile.key_items.keySet()) { |
||||
MemoryData data = myProfile.key_items.get(key); |
||||
|
||||
if (size*icon_size<width) { |
||||
g.drawImage(data.img, (int)(position.getX()+border+((count++)*icon_size)), (int)(position.getY()+96+8), (int)icon_size, (int)icon_size, sigIRC.panel); |
||||
} else { |
||||
g.drawImage(data.img, (int)(position.getX()+border+((width/size)*(count++))), (int)(position.getY()+96+8), (int)icon_size, (int)icon_size, sigIRC.panel); |
||||
} |
||||
} |
||||
count=0; |
||||
size = myProfile.badges.size(); |
||||
for (String key : myProfile.badges.keySet()) { |
||||
MemoryData data = myProfile.badges.get(key); |
||||
|
||||
if (size*icon_size<width) { |
||||
g.drawImage(data.img, (int)(position.getX()+border+((count++)*icon_size)), (int)(position.getY()+96+32), (int)icon_size, (int)icon_size, sigIRC.panel); |
||||
} else { |
||||
g.drawImage(data.img, (int)(position.getX()+border+((width/size)*(count++))), (int)(position.getY()+96+32), (int)icon_size, (int)icon_size, sigIRC.panel); |
||||
} |
||||
} |
||||
} catch (ConcurrentModificationException e) { |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue