diff --git a/mods/gm-commands/GmCommands.cs b/mods/gm-commands/GmCommands.cs index cdc5bde..c7576f0 100644 --- a/mods/gm-commands/GmCommands.cs +++ b/mods/gm-commands/GmCommands.cs @@ -1061,6 +1061,68 @@ await ChangeHeldItem(remote, stream, ciphers, conn, i => SocketLayout.Apply(i, t var error = await ChangePassives(remote, stream, ciphers, conn, conn.MainAscendancy.Allocated.ToArray(), false, "/reset_ascendancy", refundPoints: true); await conn.Commands!.Reply(error ?? "Ascendancy passives refunded; you can choose another main ascendancy."); }) + .Add("descendancy", "/descendancy [name|none|open [row|name]|refund ] (dev: the second ascendancy layer 0x33's spare byte selects: Affliction's Wildwood specialisations and the 3.29 Bloodline classes; open shows the client's Descendancy class selector)", async args => + { + if (Game.Descendancies.Rows.Count <= 1) throw new ArgumentException("Descendancy data is missing; run scripts/dev/extract-data.ps1"); + if (args.Length == 0) + { + var current = Game.Descendancies.Rows.FirstOrDefault(r => r.Index == conn.DescendancyRow); + await conn.Commands!.Reply($"Descendancy - {(current is { Index: > 0 } ? current.Name : "none")}.\n" + + string.Join("\n", Game.Descendancies.Rows.Where(r => r.Index != 0).Select(r => $"/descendancy {r.Id}"))); + return; + } + if (args[0].Equals("open", StringComparison.OrdinalIgnoreCase)) + { + // 0x7b kind 0x4c: the client's Descendancy class selector, with the Descendancy.dat row as its first u32. + byte descRow = args.Length > 1 + ? Game.Descendancies.Find(args[1])?.Index ?? byte.Parse(args[1]) + : conn.DescendancyRow; + if (args.Length > 1 && Game.Descendancies.Rows.All(r => r.Index != descRow)) + throw new ArgumentException("no such Descendancy row"); + if (descRow == 0) + throw new ArgumentException("no Descendancy chosen; pass a row name or number, for example /descendancy open 6"); + string descName = Game.Descendancies.Rows.FirstOrDefault(r => r.Index == descRow)?.Name ?? "?"; + await conn.Commands!.Reply($"0x7b kind 0x4c row {descRow} ({descName})"); + await Game.OpenDescendancySelector(remote, stream, ciphers, conn, descRow); + return; + } + if (args[0].Equals("refund", StringComparison.OrdinalIgnoreCase)) + { + if (conn.DescendancyNodes.Count == 0) { await conn.Commands!.Reply("No descendancy nodes are allocated."); return; } + ushort[] nodes = args.Length > 1 && !args[1].Equals("all", StringComparison.OrdinalIgnoreCase) + ? [ushort.Parse(args[1])] + : [.. conn.DescendancyNodes]; + foreach (ushort n in nodes) + if (!conn.DescendancyNodes.Contains(n)) throw new ArgumentException($"{n} is not an allocated descendancy node"); + string? refundError = await ChangePassives(remote, stream, ciphers, conn, nodes, allocate: false, + "/descendancy refund", refundPoints: true); + await conn.Commands!.Reply(refundError ?? $"Refunded {nodes.Length} descendancy node(s)."); + return; + } + if (args[0].Equals("none", StringComparison.OrdinalIgnoreCase)) + { + Game.SelectDescendancyForDevelopment(conn, 0); + await conn.Commands!.Reply("Descendancy cleared. Reloading the area to show the change."); + await ChangeArea(remote, stream, ciphers, conn, new PendingTransfer(conn.Layout.Hash, 0, false), "descendancy none"); + return; + } + string name = string.Join(' ', args); + var row = Game.Descendancies.Find(name) ?? throw new ArgumentException("choose one Id from /descendancy"); + // Affliction's Wildwood rows keep their own gate in the client: the Azmeri class flag and the four point flags + // unlock the tree and its eight points (the 3.29 Bloodline rows use the 0x33 byte alone). + string[] azmeri = row.Index switch + { + 1 => ["AzmeriAreWarden", "WardenPassivePoints1", "WardenPassivePoints2", "WardenPassivePoints3", "WardenPassivePoints4"], + 2 => ["AzmeriAreVoodooShaman", "ShamanPassivePoints1", "ShamanPassivePoints2", "ShamanPassivePoints3", "ShamanPassivePoints4"], + 3 => ["AzmeriArePrimalist", "PrimalistPassivePoints1", "PrimalistPassivePoints2", "PrimalistPassivePoints3", "PrimalistPassivePoints4"], + _ => [], + }; + if (azmeri.Length > 0) await SetQuestFlags(remote, stream, ciphers, conn, azmeri); + Game.SelectDescendancyForDevelopment(conn, row.Index); + await conn.Commands!.Reply($"Descendancy selected - {row.Name} (row {row.Index})" + + (azmeri.Length > 0 ? " with its Azmeri flags" : "") + ". Reloading the area to show its tree."); + await ChangeArea(remote, stream, ciphers, conn, new PendingTransfer(conn.Layout.Hash, 0, false), $"descendancy {row.Name}"); + }) .Add("gold", "/gold (dev: add gold, or take it with a negative amount; the account's, saved)", async args => { if (args.Length == 0 || !long.TryParse(args[0], out long delta)) throw new ArgumentException("an amount of gold (negative takes gold)"); diff --git a/mods/gm-commands/README.md b/mods/gm-commands/README.md index 31e8323..ea6c9e3 100644 --- a/mods/gm-commands/README.md +++ b/mods/gm-commands/README.md @@ -13,7 +13,7 @@ whenever the Game module does. | Movement | `/tp`, `/goto`, `/tour` (with `live.ps1 -Walkmaps`), `/pos` | | Monsters and NPCs | `/spawn_mob`, `/mobs`, `/despawn`, `/kill`, `/mob_mods`, `/mob_tp`, `/mob_move`, `/mob_walk`, `/anim`, `/ai`, `/statue`, `/npc`, `/npcs`, `/npc_place`, `/npc_face` | | Items | `/item`, `/item_give` (Waypoint's item crafter), `/item_tab`, `/gem`, `/gem_xp`, `/adorned`, `/unique_jewel`, `/radius_jewel`, `/impossible_escape`, `/timeless`, `/voices`, `/cluster_jewel`, `/corrupt`, `/item_mod`, `/item_max`, `/item_mods`, `/roll`, `/base_defence`, `/item_state`, `/rarity`, `/sockets` | -| Character | `/set_level`, `/add_xp`, `/gold`, `/add_passive_points`, `/add_refund_points`, `/add_passive`, `/reset_passives`, `/ascendancy`, `/ascendancy_points`, `/reset_ascendancy`, `/atlas_points`, `/waypoints`, `/quest_flag`, `/league_flag`, `/trials`, `/quest_preset` | +| Character | `/set_level`, `/add_xp`, `/gold`, `/add_passive_points`, `/add_refund_points`, `/add_passive`, `/reset_passives`, `/ascendancy`, `/descendancy`, `/ascendancy_points`, `/reset_ascendancy`, `/atlas_points`, `/waypoints`, `/quest_flag`, `/league_flag`, `/trials`, `/quest_preset` | | Stats | `/stat`, `/set_stat`, `/set_speed`, `/set_aoe`, `/god`, `/charges`, `/auras`, `/resistances`, `/crit`, `/block`, `/accuracy`, `/defences`, `/suppression` | | Test hits | `/hit`, `/spellhit`, `/blockhit`, `/blind`, `/heal`, `/death_screen`, `/block_luck`, `/suppression_luck` | | Areas and objects | `/stash_place`, `/guild_stash_place`, `/stash_add`, `/stash`, `/wp_place`, `/wp_state`, `/transition`, `/map_portal`, `/portal_rotation`, `/cosmetic`, `/hideout_keys`, `/atlas`, `/atlas_tree`, `/lab_layout` | diff --git a/mods/gm-commands/mod.json b/mods/gm-commands/mod.json index 585ea38..ee4385a 100644 --- a/mods/gm-commands/mod.json +++ b/mods/gm-commands/mod.json @@ -3,7 +3,7 @@ "name": "GM Commands", "description": "The development and testing chat commands: teleport, items, monsters, experience, quest flags, test hits and protocol probes.", "author": "LocalExile", - "version": "1.4.0", + "version": "1.5.0", "compatibleClientVersions": ["0.5.2-beta"], "kind": "feature", "depends": ["Game"]