Skip to content
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ works with. The maintainers publish the releases of the mods in this repository.
| [petloot](mods/petloot/) | optional pet pickup with per-character filters, minimum stacks, pause/resume and configurable 2x pet speed |
| [zoom](mods/zoom/) | a wider view in normal play: the camera stands further back, the mouse wheel reaches it, `/zoom` sets how far |
| [itemquantity](mods/itemquantity/) | 10× as many item drops |
| [mapdrop](mods/mapdrop/) | Configurable bonus map rolls for eligible kills |
| [pob](mods/pob/) | preview and import character builds through an external converter; requires LocalExile #639 |
| [itemrarity](mods/itemrarity/) | 10× the chance of magic, rare and unique equipment |

Expand Down
1 change: 1 addition & 0 deletions mods.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{ "id": "itemquantity", "name": "Item Quantity", "description": "10 times as many item drops from every kill.", "author": "LocalExile", "version": "1.1.4", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta", "0.5.2-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.4", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta", "0.5.2-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.4", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta", "0.5.2-beta"], "kind": "feature", "type": "project", "path": "mods/liveeconomy", "depends": [], "settings": true },
{ "id": "mapdrop", "name": "Map Drop", "description": "Adds configurable bonus map drops in Atlas maps and optionally in the late campaign.", "author": "zj1022", "version": "1.0.0", "compatibleClientVersions": ["0.5.2-beta"], "kind": "feature", "type": "script", "path": "mods/mapdrop", "depends": [], "settings": true },
{ "id": "petloot", "name": "Pet Loot", "description": "Worn pets collect selected currency with per-character filters and an immediate pause switch.", "author": "zj1022", "version": "1.1.0", "compatibleClientVersions": ["0.5.2-beta"], "kind": "feature", "type": "script", "path": "mods/petloot", "depends": ["Game", "Cosmetics"], "settings": true },
{ "id": "pob", "name": "POB", "description": "Preview and import a character build through a configured external PoB converter.", "author": "nikolos89", "version": "1.0.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta", "0.5.2-beta"], "kind": "feature", "type": "project", "path": "mods/pob", "depends": [], "settings": true },
{ "id": "waypoint-tools", "name": "Waypoint Tools", "description": "Lets Waypoint's tools reach the game without the client control bridge: the item crafter gives its items through it.", "author": "Waypoint", "version": "1.0.3", "compatibleClientVersions": ["0.4.3-beta", "0.5.0-beta", "0.5.1-beta", "0.5.2-beta"], "kind": "feature", "type": "project", "path": "mods/waypoint-tools", "depends": ["Game"], "settings": false },
Expand Down
47 changes: 47 additions & 0 deletions mods/mapdrop/MapDropMod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Text.Json.Nodes;
using GameServer.Core.Protocol.Instance;
using GameServer.Modding;

namespace LocalExile.Mods.MapDrop;

public sealed class MapDropMod : IMod
{
public void Load(IModContext mod)
{
var settings = mod.Settings<JsonObject>();
var rates = new Dictionary<MonsterRarity, double>
{
[MonsterRarity.Normal] = Chance(settings, "normal"),
[MonsterRarity.Magic] = Chance(settings, "magic"),
[MonsterRarity.Rare] = Chance(settings, "rare"),
[MonsterRarity.Unique] = Chance(settings, "unique"),
};
bool campaign = settings["campaign"]?.GetValue<bool>() == true;
var atlas = new AtlasCatalog(Program.Items);
var keys = new string?[17];
for (int tier = 1; tier < keys.Length; tier++)
if (atlas.KeyOfTier(tier) is uint hash && Program.Items.ByHash(hash) is { Supported: true } type)
keys[tier] = type.Id;

GameEvents.Drops.Add(mod.Manifest.Id, drops =>
{
int tier = drops.Conn.Instance?.Map is { } map && map.Area.Hash16 == drops.Conn.Layout.Hash
? map.Area.Tier : 0;
if (tier <= 0)
{
if (!campaign || !LateCampaign(drops.Conn.Layout.Id)) return;
tier = 1;
}
if (keys[Math.Clamp(tier, 1, 16)] is { } key
&& Random.Shared.NextDouble() < rates.GetValueOrDefault(drops.Monster.Rarity))
drops.Items.Add(key);
});
}

static double Chance(JsonObject settings, string key) =>
settings[key] is JsonValue value && value.TryGetValue<double>(out double chance) && double.IsFinite(chance)
? Math.Clamp(chance, 0, 1) : 0;

static bool LateCampaign(string area) => area.StartsWith("2_8_", StringComparison.Ordinal)
|| area.StartsWith("2_9_", StringComparison.Ordinal) || area.StartsWith("2_10_", StringComparison.Ordinal);
}
12 changes: 12 additions & 0 deletions mods/mapdrop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Map Drop

Add one bonus roll for a map of the current Atlas tier when a monster dies. The four chance settings apply by monster
rarity. Turn on **Bonus Tier 1 maps in Acts 8 to 10** to extend the roll to the late campaign. Bonus maps come from the
server's generic map-key catalog and are independent of regular loot and the Atlas drop roll.

Enable with Waypoint or `/mod_enable mapdrop`. It starts disabled and adds no chat commands. Set the odds in
Waypoint or in `data/mods/mapdrop.json` in the server folder. The JSON values are fractions. For example, `0.05`
is a 5% chance on each eligible kill.

Inspired by the map-drop settings in [mingyue8621/LocalExile-Mods](https://github.com/mingyue8621/LocalExile-Mods).
Compatible with LocalExile 0.5.2-beta.
11 changes: 11 additions & 0 deletions mods/mapdrop/mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "mapdrop",
"name": "Map Drop",
"description": "Adds configurable bonus map drops in Atlas maps and optionally in the late campaign.",
"author": "zj1022",
"version": "1.0.0",
"compatibleClientVersions": ["0.5.2-beta"],
"kind": "feature",
"depends": [],
"enabled": false
}
10 changes: 10 additions & 0 deletions mods/mapdrop/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": 1,
"settings": {
"normal": { "type": "number", "default": 0.005, "min": 0, "max": 1, "format": "percent", "label": "Normal monster bonus map chance" },
"magic": { "type": "number", "default": 0.01, "min": 0, "max": 1, "format": "percent", "label": "Magic monster bonus map chance" },
"rare": { "type": "number", "default": 0.05, "min": 0, "max": 1, "format": "percent", "label": "Rare monster bonus map chance" },
"unique": { "type": "number", "default": 0.2, "min": 0, "max": 1, "format": "percent", "label": "Unique monster bonus map chance" },
"campaign": { "type": "bool", "default": false, "label": "Bonus Tier 1 maps in Acts 8 to 10" }
}
}
Loading