Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mods.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{ "id": "backpack", "name": "Extra Backpack", "description": "An optional native 20-slot extra backpack for every character class.", "author": "zj1022", "version": "1.0.3", "compatibleClientVersions": ["0.5.1-beta"], "kind": "feature", "type": "script", "path": "mods/backpack", "depends": [], "settings": false },
{ "id": "fastcampaign", "name": "Fast Campaign", "description": "A faster campaign: 5x kill experience, +50% movement speed, and /fast lists the commands that skip ahead.", "author": "LocalExile", "version": "1.1.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta"], "kind": "feature", "type": "project", "path": "mods/fastcampaign", "depends": [], "settings": true },
{ "id": "globalchat", "name": "Global Chat", "description": "Talk to other LocalExile players: global, trade and whisper chat go through the LocalExile global chat server.", "author": "JetStream", "version": "1.1.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta"], "kind": "feature", "type": "project", "path": "mods/globalchat", "depends": [], "settings": true },
{ "id": "gm-commands", "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.3.0", "compatibleClientVersions": ["0.5.1-beta"], "kind": "feature", "type": "project", "path": "mods/gm-commands", "depends": ["Game"], "settings": false },
{ "id": "gm-commands", "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", "compatibleClientVersions": ["0.5.2-beta"], "kind": "feature", "type": "project", "path": "mods/gm-commands", "depends": ["Game"], "settings": false },
{ "id": "itemquantity", "name": "Item Quantity", "description": "10 times as many item drops from every kill.", "author": "LocalExile", "version": "1.1.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta"], "kind": "feature", "type": "project", "path": "mods/itemquantity", "depends": [], "settings": true },
{ "id": "itemrarity", "name": "Item Rarity", "description": "10 times the chance of magic, rare and unique equipment.", "author": "LocalExile", "version": "1.1.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta"], "kind": "feature", "type": "project", "path": "mods/itemrarity", "depends": [], "settings": true },
{ "id": "liveeconomy", "name": "Live Economy", "description": "Faustus's Currency Exchange as a live market: the official Path of Exile leagues' prices, a spread, depth, and orders that fill with time.", "author": "JetStream", "version": "1.1.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta"], "kind": "feature", "type": "project", "path": "mods/liveeconomy", "depends": [], "settings": true },
Expand Down
13 changes: 8 additions & 5 deletions mods/gm-commands/GmCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ await Send(remote, stream, ciphers, InstanceItems.InventoryChange(PlayerInventor
items.NextRevision(PlayerInventories.MainInventory), [], [added]), $"0x00bf inventory 1: /voices {empty}");
await conn.Commands!.Reply($"Voices ({empty} empty passive(s)) added to the inventory");
})
.Add("cluster_jewel", "/cluster_jewel <small|medium|large> [passives] [sockets] [theme mod] [notable mod ...] (dev: a non-unique cluster jewel with its enchantments, into the inventory; defaults 3/4/8 passives and 0/1/2 sockets)", async args =>
.Add("cluster_jewel", "/cluster_jewel <small|medium|large> [passives] [sockets] [theme] [mod ...] (dev: a non-unique cluster jewel into the inventory. theme: its name with underscores, e.g. fire_damage, or none; without one it gets one of its size's. mod: Mods Ids of its affixes, e.g. a notable's. Defaults: 3/4/8 passives and 0/1/2 sockets)", async args =>
{
int size = args.Length > 0 ? args[0].ToLowerInvariant() switch
{
Expand All @@ -729,10 +729,12 @@ await Send(remote, stream, ciphers, InstanceItems.InventoryChange(PlayerInventor
return;
}
int passives = args.Length > 1 && int.TryParse(args[1], out int p) ? p : size switch { 2 => 8, 1 => 4, _ => 3 };
int sockets = args.Length > 2 && int.TryParse(args[2], out int s) ? s : size switch { 2 => 2, 1 => 1, _ => 0 };
if (CreateClusterJewel(size, passives, sockets, args.Length > 3 ? args[3] : null, args.Skip(4)) is not { } jewel)
int sockets = args.Length > 2 && int.TryParse(args[1], out _) && int.TryParse(args[2], out int s) ? s : size switch { 2 => 2, 1 => 1, _ => 0 };
// The numbers may be left out: every word that is not one is a theme or a mod.
int numbers = args.Skip(1).TakeWhile(a => int.TryParse(a, out _)).Take(2).Count();
if (CreateClusterJewel(size, passives, sockets, args.Skip(1 + numbers), out string? why) is not { } jewel)
{
await conn.Commands!.Reply("The cluster jewel data is missing");
await conn.Commands!.Reply(why ?? "The cluster jewel data is missing");
return;
}
var items = ItemsOf(conn);
Expand All @@ -744,7 +746,8 @@ await Send(remote, stream, ciphers, InstanceItems.InventoryChange(PlayerInventor
var added = items.Put(PlayerInventories.MainInventory, new InventoryItem(items.NewItemId(), cell.X, cell.Y, jewel));
await Send(remote, stream, ciphers, InstanceItems.InventoryChange(PlayerInventories.InventoryId(PlayerInventories.MainInventory),
items.NextRevision(PlayerInventories.MainInventory), [], [added]), $"0x00bf inventory 1: /cluster_jewel {size} {passives} {sockets}");
await conn.Commands!.Reply($"Cluster jewel ({args[0]}, {passives} passive(s), {sockets} socket(s)) added to the inventory");
string themeName = ItemsFor(conn).ByHash(jewel.TypeHash) is { } made && ClusterJewels.ThemeOf(made, jewel) is { } theme ? theme.Name : "no theme";
await conn.Commands!.Reply($"Cluster jewel ({args[0]}, {themeName}, {passives} passive(s), {sockets} socket(s)) added to the inventory");
})
.Add("corrupt", "/corrupt (dev: marks the held item corrupted, e.g. to make a corrupted magic jewel)", async _ =>
{
Expand Down
9 changes: 8 additions & 1 deletion mods/gm-commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ A value that picks something stays (a Timeless Jewel's seed, the support gem of
the highest number, or the lowest where less is better: damage taken, costs, flask charges used, requirements, ailments
and curses on the character. That is told by the stat's name; for another value, `/item_mod set <mod> <values>`.

**Cluster jewels.** `/cluster_jewel <small|medium|large> [passives] [sockets] [theme] [mod ...]` makes one through
the server's own maker, so it is the jewel the game makes: `/cluster_jewel large 8 2 fire_damage
AfflictionNotablePrismaticHeart__`. The theme is what the small passives grant, by its name with underscores
(`fire_damage`, `flask_duration`, `life`); a wrong word lists the size's themes. Without one the jewel gets one of its
size's, as `/item Large Cluster Jewel` does; `none` makes a jewel without a theme, whose small passives the client draws
as "Nothingness". Each `mod` is the Mods Id of an affix: a notable, or an "also grant" one.

LocalExile's own dev scripts (the campaign driver, the level generator's tour loop, `client_control.py`) and Waypoint's
item crafter send these commands: install this mod for them.

Works with: 1.3.0 needs LocalExile v0.5.1-beta (`/stash_add` uses LocalExile/LocalExile#891, and the server's monster calls
Works with: 1.4.0 needs LocalExile v0.5.2-beta (`/cluster_jewel` uses its `ClusterJewels`, LocalExile/LocalExile#948). 1.3.0 needs LocalExile v0.5.1-beta (`/stash_add` uses LocalExile/LocalExile#891, and the server's monster calls
changed). 1.1.3 works with v0.4.3-beta and v0.5.0-beta, not v0.5.1-beta: there its `/spawn_mob` fails and ends the
connection. 1.1.2 works with v0.4.3-beta, the first with the client-table API it reads (LocalExile/LocalExile#862).
Mods reach what modules reach from v0.4.0-beta (LocalExile/LocalExile#815); not v0.3.0-beta or earlier.
66 changes: 31 additions & 35 deletions mods/gm-commands/Rules.Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,45 +64,41 @@ internal static bool PicksSomething(string stat) => stat.Contains("_index", Stri
static readonly System.Text.RegularExpressions.Regex OnEnemies = new(
@"enem(y|ies).*damage_taken|ailment_types|chilling_areas", System.Text.RegularExpressions.RegexOptions.CultureInvariant);

/// <summary>A non-unique cluster jewel as a drop rolls it: the size's base type with the enchantments that carry
/// how many passives it has, what its small passives grant (its theme) and its jewel sockets (two or one for a
/// large, one for a medium, none for a small). Null when the base type or a mod is missing from the game data.</summary>
internal static Item? CreateClusterJewel(int size, int passives, int sockets, string? theme = null,
IEnumerable<string>? notables = null)
/// <summary>
/// A non-unique cluster jewel through the server's own maker (<see cref="ClusterJewels.Create"/>): the size's base
/// with its enchantments (its theme and passive count, and its jewel sockets) and the affixes asked for, each at its
/// highest values. The words after the numbers are a theme and Mods Ids, in any order: a theme by its name with
/// underscores (fire_damage), its tag with or without "affliction_", or "none" for a jewel without one, whose
/// small passives the client draws as "Nothingness". Without a theme word it gets one of its size's, as a new item
/// does. Null with why when the game data lacks the base or a word is neither.
/// </summary>
internal static Item? CreateClusterJewel(int size, int passives, int sockets, IEnumerable<string> words, out string? error)
{
string name = size switch { 2 => "Large Cluster Jewel", 1 => "Medium Cluster Jewel", 0 => "Small Cluster Jewel", _ => "" };
if (name.Length == 0 || Items.Find(name) is not { } baseType) return null;
var asked = notables?.ToList() ?? [];
var mods = new List<ItemMod>();
// "Adds N Passive Skills": one enchantment mod whose two stats are the node index and the count.
if (Items.Mods.ById("JewelExpansionPassiveNodes") is { } count && count.Stats.Count >= 2)
mods.Add(new ItemMod(ModSection.Enchant, count.Hash, [0, passives]));
string socketMod = size switch
if (name.Length == 0 || Items.Find(name) is not { Cluster: { } cluster } type)
{
2 => sockets >= 2 ? "JewelExpansionJewelNodesLarge2___" : "JewelExpansionJewelNodesLarge1",
1 => "JewelExpansionJewelNodesMedium",
_ => "",
};
if (sockets > 0 && socketMod.Length > 0 && Items.Mods.ById(socketMod) is { } socket && socket.Stats.Count > 0)
mods.Add(new ItemMod(ModSection.Enchant, socket.Hash, [.. socket.MaxValues()]));
// The theme: what the cluster's small passives grant ("Added Small Passive Skills grant: ..."). It is an
// enchantment (like the count and the sockets); a smaller jewel in a larger socket is padded by the client
// with empty nodes instead, see JewelFitsCell.
if (Items.Mods.ById(theme ?? "AfflictionJewelSmallPassivesGrantLife_") is { } themed && themed.Stats.Count > 0)
mods.Add(new ItemMod(ModSection.Enchant, themed.Hash, [.. themed.MaxValues()]));
// "1 Added Passive Skill is <notable>": an explicit prefix, one per notable the jewel has.
foreach (string notable in asked)
if (Items.Mods.ById(notable) is { } found && found.Stats.Count > 0)
mods.Add(new ItemMod(ModSection.Explicit, found.Hash, [.. found.MaxValues()]));
return ItemCatalog.Create(baseType) with
error = "The cluster jewel data is missing";
return null;
}
var offered = cluster.Offered.ToList();
ClusterJewels.Theme? theme = null;
bool themed = false;
var affixes = new List<ModCatalog.Mod>();
foreach (string word in words)
{
// The notables are the item's only affixes. A jewel without one is Normal, one or two are Magic (a magic
// item may not have zero affixes: the client then renders the whole cluster as empty "Nothingness" nodes)
// and three (a large cluster can carry three) Rare.
Rarity = asked.Count switch { 0 => ItemRarity.Normal, <= 2 => ItemRarity.Magic, _ => ItemRarity.Rare },
ItemLevel = 68,
Mods = mods,
};
if (!themed && word.Equals("none", StringComparison.OrdinalIgnoreCase)) themed = true;
else if (!themed && (ClusterJewels.FindTheme(cluster, word) ?? ClusterJewels.FindTheme(cluster, word.Replace('_', ' '))
?? ClusterJewels.FindTheme(cluster, "affliction_" + word)) is { } found) (theme, themed) = (found, true);
else if (Items.Mods.ById(word) is { Stats.Count: > 0 } mod) affixes.Add(mod);
else
{
error = $"\"{word}\" is neither a theme nor a mod. A {name}'s themes: {string.Join(", ", offered.Select(t => t.Name.Replace(' ', '_').ToLowerInvariant()))}";
return null;
}
}
if (!themed && offered.Count > 0) theme = offered[Random.Shared.Next(offered.Count)];
error = null;
return ClusterJewels.Create(type, theme, passives, sockets, affixes);
}

/// <summary>Voices, the unique Large Cluster Jewel: three jewel sockets plus 1, 3, 5 or 7 empty passives (the four
Expand Down
4 changes: 2 additions & 2 deletions mods/gm-commands/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"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.3.0",
"compatibleClientVersions": ["0.5.1-beta"],
"version": "1.4.0",
"compatibleClientVersions": ["0.5.2-beta"],
"kind": "feature",
"depends": ["Game"]
}
Loading