public ulong GetPointerAddress(ISwitchConnectionSync sb, string ptr) { uint finadd = 0; if (!ptr.EndsWith("]")) { finadd = GetHexValue(ptr.Split('+').Last()); } var jumps = ptr.Replace("main", "").Replace("[", "").Replace("]", "").Split(new[] { "+" }, StringSplitOptions.RemoveEmptyEntries); var initaddress = GetHexValue(jumps[0].Trim()); ulong address = BitConverter.ToUInt64(sb.ReadBytesMain(initaddress, 0x8), 0); foreach (var j in jumps) { var val = GetHexValue(j.Trim()); if (val == initaddress) { continue; } if (val == finadd) { address += val; break; } address = BitConverter.ToUInt64(sb.ReadBytesAbsolute(address + val, 0x8), 0); } return(address); }
private void ReloadValues() { //// Get offsets from pointers //// Read values from offsets OffsetPointsTotal = DataOffsets.OffsetPointsTotal; OffsetPointsTotal2 = DataOffsets.OffsetPointsTotal2; uint PointsTotal = sb.ReadBytesAbsolute(OffsetPointsTotal, 1)[0]; PointsTotalNumeric.Value = PointsTotal; SysBotLog.Text += Environment.NewLine + "Successfully loaded values."; }
private void ReloadValues() { // Get offsets from pointers OffsetHunterHP = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterHP); OffsetHunterHPRecoverable = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterHPRecoverable); // Would preferably get all offsets from just the first item pointer OffsetPouchItemCounts = GetItemPouchCounts(); OffsetHunterCoordX = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterCoordX); OffsetHunterCoordY = OffsetHunterCoordX + 0x4; OffsetHunterCoordZ = OffsetHunterCoordX + 0x8; // Pouch items uint PouchItem1Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[0], 1)[0]; uint PouchItem2Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[1], 1)[0]; uint PouchItem3Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[2], 1)[0]; uint PouchItem4Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[3], 1)[0]; uint PouchItem5Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[4], 1)[0]; SysBotPouchItem1Count.Value = PouchItem1Count; SysBotPouchItem2Count.Value = PouchItem2Count; SysBotPouchItem3Count.Value = PouchItem3Count; SysBotPouchItem4Count.Value = PouchItem4Count; SysBotPouchItem5Count.Value = PouchItem5Count; // Coordinates float HunterCoordX = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordX, 4), 0); float HunterCoordY = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordY, 4), 0); float HunterCoordZ = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordZ, 4), 0); SysBotHunterCoordXCount.Value = (decimal)HunterCoordX; SysBotHunterCoordYCount.Value = (decimal)HunterCoordY; SysBotHunterCoordZCount.Value = (decimal)HunterCoordZ; // HP uint HunterHP = sb.ReadBytesAbsolute(OffsetHunterHP, 1)[0]; SysBotHunterHPCount.Value = HunterHP; SysBotLog.Text += Environment.NewLine + "Successfully loaded values."; }
private void ReloadValues() { //// Get offsets from pointers // Hunter HP try { OffsetHunterHP = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterHP); OffsetHunterHPMax = OffsetHunterHP + DataOffsets.DistanceHPToHPMax; OffsetHunterHPRecoverable = OffsetHunterHP + DataOffsets.DistanceHPToRecoverable; uint HunterHP = sb.ReadBytesAbsolute(OffsetHunterHP, 1)[0]; SysBotHunterHPCount.Value = HunterHP; SysBotHunterHPCount.Enabled = true; } catch (Exception ex) { SysBotHunterHPCount.Enabled = false; SysBotLog.Text += Environment.NewLine + $"{ex.Message}\n{ex.StackTrace}"; } // Pouch try { // Pouch, would preferably get all offsets from just the first item pointer OffsetPouchItemCounts = GetItemPouchCounts(); uint PouchItem1Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[0], 1)[0]; uint PouchItem2Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[1], 1)[0]; uint PouchItem3Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[2], 1)[0]; uint PouchItem4Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[3], 1)[0]; uint PouchItem5Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[4], 1)[0]; SysBotPouchItem1Count.Value = PouchItem1Count; SysBotPouchItem2Count.Value = PouchItem2Count; SysBotPouchItem3Count.Value = PouchItem3Count; SysBotPouchItem4Count.Value = PouchItem4Count; SysBotPouchItem5Count.Value = PouchItem5Count; SysBotPouchItem1Count.Enabled = true; SysBotPouchItem2Count.Enabled = true; SysBotPouchItem3Count.Enabled = true; SysBotPouchItem4Count.Enabled = true; SysBotPouchItem5Count.Enabled = true; } catch (Exception ex) { SysBotPouchItem1Count.Enabled = false; SysBotPouchItem2Count.Enabled = false; SysBotPouchItem3Count.Enabled = false; SysBotPouchItem4Count.Enabled = false; SysBotPouchItem5Count.Enabled = false; SysBotLog.Text += Environment.NewLine + $"{ex.Message}\n{ex.StackTrace}"; } // Coordinates try { OffsetHunterCoordX = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterCoordX); OffsetHunterCoordY = OffsetHunterCoordX + DataOffsets.DistanceCoordinates; OffsetHunterCoordZ = OffsetHunterCoordX + DataOffsets.DistanceCoordinates * 2; float HunterCoordX = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordX, 4), 0); float HunterCoordY = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordY, 4), 0); float HunterCoordZ = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordZ, 4), 0); SysBotHunterCoordXCount.Value = (decimal)HunterCoordX; SysBotHunterCoordYCount.Value = (decimal)HunterCoordY; SysBotHunterCoordZCount.Value = (decimal)HunterCoordZ; SysBotHunterCoordXCount.Enabled = true; SysBotHunterCoordYCount.Enabled = true; SysBotHunterCoordZCount.Enabled = true; } catch (Exception ex) { SysBotHunterCoordXCount.Enabled = false; SysBotHunterCoordYCount.Enabled = false; SysBotHunterCoordZCount.Enabled = false; SysBotLog.Text += Environment.NewLine + $"{ex.Message}\n{ex.StackTrace}"; } // Monsters try { OffsetMonster1HP = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerMonsters3HP); float Monster1HP = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetMonster1HP, 4), 0); SysBotMonster1HPCount.Value = (decimal)Monster1HP; SysBotMonster1HPCount.Enabled = true; } catch (Exception ex) { SysBotMonster1HPCount.Enabled = false; SysBotLog.Text += Environment.NewLine + $"{ex.Message}\n{ex.StackTrace}"; } SysBotLog.Text += Environment.NewLine + "Successfully loaded values."; }
private void ReloadValues() { //// Get offsets from pointers // Player try { OffsetHunterHP = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterHP); OffsetHunterHPMax = OffsetHunterHP + DataOffsets.DistanceHPToHPMax; OffsetHunterHPRecoverable = OffsetHunterHP + DataOffsets.DistanceHPToRecoverable; uint HunterHP = sb.ReadBytesAbsolute(OffsetHunterHP, 1)[0]; SysBotHunterHPCount.Value = HunterHP; SysBotHunterHPCount.Enabled = true; } catch (Exception ex) { SysBotHunterHPCount.Enabled = false; LogError(ex); } try { OffsetZeni = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerZeni); float Zeni = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetZeni, 4), 0); SysBotZeniCount.Value = (decimal)Zeni; SysBotZeniCount.Enabled = true; } catch (Exception ex) { SysBotZeniCount.Enabled = false; LogError(ex); } // Activity Log try { OffsetVillageQuestCount = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog); OffsetLowRankQuestCount = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistanceActivityLog); OffsetHighRankQuestCount = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistanceActivityLog * 2); OffsetRampageQuestCount = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistanceActivityLog * 3); OffsetArenaQuestCount = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistanceActivityLog * 4); OffsetSlainTotal = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistanceSlainTotal); OffsetCapturedTotal = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistanceCapturedTotal); uint VillageQuestCount = sb.ReadBytesAbsolute(OffsetVillageQuestCount, 1)[0]; uint LowRankQuestCount = sb.ReadBytesAbsolute(OffsetLowRankQuestCount, 1)[0]; uint HighRankQuestCount = sb.ReadBytesAbsolute(OffsetHighRankQuestCount, 1)[0]; uint RampageQuestCount = sb.ReadBytesAbsolute(OffsetRampageQuestCount, 1)[0]; uint ArenaQuestCount = sb.ReadBytesAbsolute(OffsetArenaQuestCount, 1)[0]; uint SlainTotal = sb.ReadBytesAbsolute(OffsetSlainTotal, 1)[0]; uint CapturedTotal = sb.ReadBytesAbsolute(OffsetCapturedTotal, 1)[0]; SysBotVillageQuestCount.Value = VillageQuestCount; SysBotLowRankQuestCount.Value = LowRankQuestCount; SysBotHighRankQuestCount.Value = HighRankQuestCount; SysBotRampageQuestCount.Value = RampageQuestCount; SysBotArenaQuestCount.Value = ArenaQuestCount; SysBotSlainTotalCount.Value = SlainTotal; SysBotCapturedTotalCount.Value = CapturedTotal; SysBotVillageQuestCount.Enabled = true; SysBotLowRankQuestCount.Enabled = true; SysBotHighRankQuestCount.Enabled = true; SysBotRampageQuestCount.Enabled = true; SysBotArenaQuestCount.Enabled = true; SysBotSlainTotalCount.Enabled = true; SysBotCapturedTotalCount.Enabled = true; } catch (Exception ex) { SysBotVillageQuestCount.Enabled = false; SysBotLowRankQuestCount.Enabled = false; SysBotHighRankQuestCount.Enabled = false; SysBotRampageQuestCount.Enabled = false; SysBotArenaQuestCount.Enabled = false; SysBotSlainTotalCount.Enabled = false; SysBotCapturedTotalCount.Enabled = false; SysBotPlaytimeCount.Enabled = false; LogError(ex); } // Playtime try { OffsetPlaytime = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerActivityLog + DataOffsets.DistancePlaytime); uint Playtime = sb.ReadBytesAbsolute(OffsetPlaytime, 1)[0]; SysBotPlaytimeCount.Value = Playtime; SysBotPlaytimeCount.Enabled = true; } catch (Exception ex) { SysBotPlaytimeCount.Enabled = false; LogError(ex); } // Pouch try { // Pouch, would preferably get all offsets from just the first item pointer OffsetPouchItemCounts = GetItemPouchCounts(); uint PouchItem1Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[0], 1)[0]; uint PouchItem2Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[1], 1)[0]; uint PouchItem3Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[2], 1)[0]; uint PouchItem4Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[3], 1)[0]; uint PouchItem5Count = sb.ReadBytesAbsolute(OffsetPouchItemCounts[4], 1)[0]; SysBotPouchItem1Count.Value = PouchItem1Count; SysBotPouchItem2Count.Value = PouchItem2Count; SysBotPouchItem3Count.Value = PouchItem3Count; SysBotPouchItem4Count.Value = PouchItem4Count; SysBotPouchItem5Count.Value = PouchItem5Count; SysBotPouchItem1Count.Enabled = true; SysBotPouchItem2Count.Enabled = true; SysBotPouchItem3Count.Enabled = true; SysBotPouchItem4Count.Enabled = true; SysBotPouchItem5Count.Enabled = true; } catch (Exception ex) { SysBotPouchItem1Count.Enabled = false; SysBotPouchItem2Count.Enabled = false; SysBotPouchItem3Count.Enabled = false; SysBotPouchItem4Count.Enabled = false; SysBotPouchItem5Count.Enabled = false; LogError(ex); } // Coordinates try { OffsetHunterCoordX = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerHunterCoordX); OffsetHunterCoordY = OffsetHunterCoordX + DataOffsets.DistanceCoordinates; OffsetHunterCoordZ = OffsetHunterCoordX + DataOffsets.DistanceCoordinates * 2; float HunterCoordX = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordX, 4), 0); float HunterCoordY = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordY, 4), 0); float HunterCoordZ = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetHunterCoordZ, 4), 0); SysBotHunterCoordXCount.Value = (decimal)HunterCoordX; SysBotHunterCoordYCount.Value = (decimal)HunterCoordY; SysBotHunterCoordZCount.Value = (decimal)HunterCoordZ; SysBotHunterCoordXCount.Enabled = true; SysBotHunterCoordYCount.Enabled = true; SysBotHunterCoordZCount.Enabled = true; } catch (Exception ex) { SysBotHunterCoordXCount.Enabled = false; SysBotHunterCoordYCount.Enabled = false; SysBotHunterCoordZCount.Enabled = false; LogError(ex); } // Monsters try { OffsetMonster1HP = PointerHandler.GetPointerAddress(sb, DataOffsets.PointerMonsters3HP); float Monster1HP = BitConverter.ToSingle(sb.ReadBytesAbsolute(OffsetMonster1HP, 4), 0); SysBotMonster1HPCount.Value = (decimal)Monster1HP; SysBotMonster1HPCount.Enabled = true; } catch (Exception ex) { SysBotMonster1HPCount.Enabled = false; LogError(ex); } SysBotLog.Text += Environment.NewLine + "Successfully loaded values."; }