Skip to content

Instantly share code, notes, and snippets.

@TheManta
Last active June 11, 2024 17:34
Show Gist options
  • Save TheManta/064edb1fd9224abb6fae307204ce8903 to your computer and use it in GitHub Desktop.
Save TheManta/064edb1fd9224abb6fae307204ce8903 to your computer and use it in GitHub Desktop.
RebornBuddy Console Snippets
int radius = 30;
var targets = GameObjectManager.GetObjectsOfType<BattleCharacter>()
.Where(bc => bc.IsTargetable && bc.CanAttack)
.GroupBy(bc => bc.NpcId)
.Select(group => group.FirstOrDefault());
if(targets.Any())
{
var location = targets.Select(bc => bc.Location)
.Aggregate((sum, current) => sum + current) / targets.Count();
var grindAreaName = $"{WorldManager.SubZoneId}_{location.GetHashCode():X}";
StringBuilder sb = new StringBuilder();
sb.Append($"<MoveTo XYZ=\"{Core.Player.Location.ToString().Trim('<', '>')}\" Distance=\"0.5\"/>");
sb.Append($"<Grind GrindRef=\"{grindAreaName}\" While=\"NumAttackableEnemies({radius}) &gt; 0\"/>");
sb.Append($@"
<GrindArea Name=""{grindAreaName}"">
<Hotspots>
<Hotspot Radius=""{radius}"" XYZ=""{location.ToString().Trim('<', '>')}""/>
</Hotspots>
<TargetMobs>
");
foreach(var bc in targets)
{
sb.Append($" <TargetMob Id=\"{bc.NpcId}\" Name=\"{bc.Name}\" Weight=\"1\"/>\n");
}
sb.Append($" </TargetMobs>\n</GrindArea>\n");
var grindAreaTag = sb.ToString().Trim();
Log(grindAreaTag);
Clipboard.SetText(grindAreaTag);
}
Log("= = =");
GameObject obj = Core.Target;
if(obj != null && obj != Core.Player)
{
string xyz = $"{obj.Location.X}, {obj.Location.Y}, {obj.Location.Z}";
string xml = $@"<GetTo ZoneId=""{WorldManager.ZoneId}"" XYZ=""{xyz}""/>
<Snipe NpcId=""{obj.NpcId}"" XYZ=""{xyz}"" QuestId=""CHANGE_ME"" StepId=""CHANGE_ME"" />";
Log(xml);
Clipboard.SetText(xml);
}
else
{
Console.Beep();
}
bool includePlayer = true;
bool isCastingOnly = true;
bool isAttackableOnly = false;
var output = new StringBuilder();
foreach(var c in GameObjectManager.GetObjectsOfType<Character>(true, includePlayer)
.Where(c => (c.IsCasting || !isCastingOnly) && (c.CanAttack || !isAttackableOnly))
.OrderBy(c => c.Distance())
.Take(100))
{
string name = !c.IsNpc ? $"Lv. {c.ClassLevel} {c.CurrentJob}" : c.Name;
string targetName;
if(c.TargetCharacter is Character targetChar)
{
targetName = !targetChar.IsNpc ? $"Lv. {targetChar.ClassLevel} {targetChar.CurrentJob}" : targetChar.Name;
}
else
{
GameObject targetObj = c.TargetGameObject;
targetName = targetObj?.Name ?? "None";
}
output.AppendLine($"({c.NpcId}) {name}, HP:{c.CurrentHealthPercent:N2}%, Dist: {c.Distance():N2}f, Loc: {c.Location}, IsVisible: {c.IsVisible}, IsTargetable: {c.IsTargetable}, Target: {targetName}");
if (c.IsCasting)
{
SpellCastInfo spell = c.SpellCastInfo;
if(GameObjectManager.GetObjectByObjectId(spell.TargetId) is Character castTarget)
{
string castTargetName = !castTarget.IsNpc ? $"Lv. {castTarget.ClassLevel} {castTarget.CurrentJob}" : castTarget.Name;
output.AppendLine($" └─ Casting ({spell.ActionId}) {spell.Name} => ({castTarget.NpcId}) {castTargetName}");
}
else if(spell.CastLocation is Vector3 castLocation && castLocation != Vector3.Zero)
{
output.AppendLine($" └─ Casting ({spell.ActionId}) {spell.Name} => {castLocation}");
}
else
{
output.AppendLine($" └─ Casting ({spell.ActionId}) {spell.Name} => No target or location");
}
}
if (c is BattleCharacter bc)
{
if(bc.AvfxPointer != IntPtr.Zero)
{
output.AppendLine($" └─ AVFX: 0x{bc.AvfxPointer.ToString("X")} : {bc.AVFX}");
}
if(bc.LockOnPointer != IntPtr.Zero)
{
output.AppendLine($" └─ LockOn: 0x{bc.LockOnPointer.ToString("X")} : {bc.LockOn}");
}
}
}
output.AppendLine("= = =");
Log(output.ToString());
GameObject obj = Core.Target ?? (GameObject)Core.Player;
string name = obj is Character c && !c.IsNpc ? $"Lv. {c.ClassLevel} {c.CurrentJob}" : obj.Name;
Log($"({obj.NpcId}) {name}, Dist:{obj.Distance():N2}, Loc:{obj.Location}, R:{obj.Heading:0.0000}, Zone:({WorldManager.ZoneId}, {WorldManager.SubZoneId})");
Clipboard.SetText($"{obj.Location.X}, {obj.Location.Y}, {obj.Location.Z}");
foreach (var item in DataManager.AetheryteCache)
{
Log($"({item.Key}) {item.Value}");
}
foreach(var obj in GameObjectManager.GetObjectsOfType<GameObject>(true, true)
.OrderBy(obj => obj.Distance())
.Take(16))
{
string name = obj is Character c && !c.IsNpc ? $"Lv. {c.ClassLevel} {c.CurrentJob}" : obj.Name;
Log($"({obj.NpcId}) {name}, HP:{obj.CurrentHealthPercent}%, Dist: {obj.Distance():N2}f, Loc: {obj.Location}, IsVisible: {obj.IsVisible}, IsTargetable: {obj.IsTargetable}");
}
Log("= = =");
foreach(var bc in GameObjectManager.GetObjectsOfType<BattleCharacter>(includeMeIfFound: true)
.OrderBy(bc => bc.Distance()))
{
if (bc.Auras.Any())
{
var name = !bc.IsNpc ? $"Lv. {bc.ClassLevel} {bc.CurrentJob}" : bc.Name;
Log(name);
foreach(var aura in bc.Auras)
{
Log($" └─ {aura}");
}
}
}
foreach(AtkAddonControl window in RaptureAtkUnitManager.Controls)
{
Log(window.Name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment