diff --git a/HeavenClient/Gameplay/MapleMap/FieldLimit.h b/HeavenClient/Gameplay/MapleMap/FieldLimit.h index c896d7865..f145412c9 100644 --- a/HeavenClient/Gameplay/MapleMap/FieldLimit.h +++ b/HeavenClient/Gameplay/MapleMap/FieldLimit.h @@ -152,17 +152,18 @@ namespace ms } // v83 FUN_00a0977b: bit 0x4 keeps summoning sacks shut unless the - // map's info/allowedItem lists them. - inline bool may_summon(int32_t fieldlimit, const std::vector &allowed, int32_t item_id) + // map's info/allowedItem lists them. A GM (FUN_00473cde() & 1) may + // open one anywhere. + inline bool may_summon(int32_t fieldlimit, const std::vector &allowed, int32_t item_id, bool gm) { - return !(fieldlimit & SUMMON_SACKS) || std::find(allowed.begin(), allowed.end(), item_id) != allowed.end(); + return gm || !(fieldlimit & SUMMON_SACKS) || std::find(allowed.begin(), allowed.end(), item_id) != allowed.end(); } // v83 FUN_00a0977b: a summoning sack asks before it opens, unless - // it is an event's (2109xxx) or 2100067. - inline bool sack_asks(int32_t item_id) + // it is an event's (2109xxx) or 2100067, or the player is a GM. + inline bool sack_asks(int32_t item_id, bool gm) { - return item_id / 1000 != 2109 && item_id != 2100067; + return !gm && item_id / 1000 != 2109 && item_id != 2100067; } // v83 FUN_00a0a63f, type 0x25: bit 0x40000 keeps Miu Miu's merchant diff --git a/HeavenClient/Gameplay/MapleMap/MapInfo.cpp b/HeavenClient/Gameplay/MapleMap/MapInfo.cpp index 441b1905b..a875fce18 100644 --- a/HeavenClient/Gameplay/MapleMap/MapInfo.cpp +++ b/HeavenClient/Gameplay/MapleMap/MapInfo.cpp @@ -162,9 +162,9 @@ namespace ms return field_limit::may_use(fieldlimit, allowed_items, item_id); } - bool MapInfo::can_summon(int32_t item_id) const + bool MapInfo::can_summon(int32_t item_id, bool gm) const { - return field_limit::may_summon(fieldlimit, allowed_items, item_id); + return field_limit::may_summon(fieldlimit, allowed_items, item_id, gm); } bool MapInfo::can_drop() const diff --git a/HeavenClient/Gameplay/MapleMap/MapInfo.h b/HeavenClient/Gameplay/MapleMap/MapInfo.h index 2af37ebbb..509b14454 100644 --- a/HeavenClient/Gameplay/MapleMap/MapInfo.h +++ b/HeavenClient/Gameplay/MapleMap/MapInfo.h @@ -136,8 +136,8 @@ namespace ms bool can_use_item(int32_t item_id) const; // Whether the map lets the player open a summoning sack - // (field_limit::may_summon). - bool can_summon(int32_t item_id) const; + // (field_limit::may_summon); a GM may anywhere. + bool can_summon(int32_t item_id, bool gm) const; // Whether the map lets the player drop items and mesos. bool can_drop() const; diff --git a/HeavenClient/IO/UITypes/UIItemInventory.cpp b/HeavenClient/IO/UITypes/UIItemInventory.cpp index cb2a516b6..2cd459540 100644 --- a/HeavenClient/IO/UITypes/UIItemInventory.cpp +++ b/HeavenClient/IO/UITypes/UIItemInventory.cpp @@ -994,13 +994,15 @@ namespace ms // v83 FUN_00a0977b: a summoning sack (210xxxx) stays shut while // riding or where the map forbids it, and asks first unless it is an - // event's. + // event's. A GM skips both the map's rule and the question. void use_summon_sack(int16_t slot, int32_t item_id) { if (Stage::get().get_player().ride_refuses()) return; - if (!Stage::get().get_mapinfo().can_summon(item_id)) + bool gm = Configuration::get().get_grade().gm(); + + if (!Stage::get().get_mapinfo().can_summon(item_id, gm)) { UI::get().emplace(NOT_HERE, [](bool) {}); @@ -1012,7 +1014,7 @@ namespace ms Stage::get().get_player().request(SummonSackPacket(slot, item_id), ExclRequest::USE_WAIT); }; - if (!field_limit::sack_asks(item_id)) + if (!field_limit::sack_asks(item_id, gm)) open(); else UI::get().emplace(SUMMON_SACK, [open](bool yes) diff --git a/HeavenClient/tests/field_limit.cpp b/HeavenClient/tests/field_limit.cpp index 7dd46e363..fd451bc04 100644 --- a/HeavenClient/tests/field_limit.cpp +++ b/HeavenClient/tests/field_limit.cpp @@ -24,12 +24,14 @@ int main() require(may_use(0x400, {}, 2040000), "a scroll doesn't go the potion way"); require(!may_use(0x400, {}, 2210000), "a transformation potion is refused"); - require(may_summon(0, {}, 2100000), "a summoning sack opens on an open map"); - require(!may_summon(0x4, {}, 2100000), "bit 0x4 keeps it shut"); - require(may_summon(0x526fc, allowed, 2109004), "unless the map lists it"); - require(!may_summon(0x526fc, allowed, 2100000), "an unlisted one stays shut"); - require(sack_asks(2100000) && sack_asks(2101000), "a sack asks first"); - require(!sack_asks(2109004) && !sack_asks(2100067), "an event's sack and 2100067 don't"); + require(may_summon(0, {}, 2100000, false), "a summoning sack opens on an open map"); + require(!may_summon(0x4, {}, 2100000, false), "bit 0x4 keeps it shut"); + require(may_summon(0x526fc, allowed, 2109004, false), "unless the map lists it"); + require(!may_summon(0x526fc, allowed, 2100000, false), "an unlisted one stays shut"); + require(may_summon(0x4, {}, 2100000, true), "a GM opens one anywhere"); + require(sack_asks(2100000, false) && sack_asks(2101000, false), "a sack asks first"); + require(!sack_asks(2109004, false) && !sack_asks(2100067, false), "an event's sack and 2100067 don't"); + require(!sack_asks(2100000, true), "nor does any sack for a GM"); require(may_drop(0x400), "consumable limits leave drops alone"); require(!may_drop(0x400000), "bit 0x400000 keeps items on the player"); diff --git a/agent_docs/inventory.md b/agent_docs/inventory.md index 431f7c2ef..01c14a1e0 100644 --- a/agent_docs/inventory.md +++ b/agent_docs/inventory.md @@ -645,7 +645,12 @@ A summoning sack (210xxxx) is opened from the USE tab with USE_SUMMON_BAG of its mobs at its percent chance, below the player. Where the map's fieldLimit has 0x4 and its `allowedItem` doesn't list the sack, the client shows "You can't use it here in this map." itself, unless the player is -a GM (v83 FUN_00a0977b). The server also keeps a sack with `info/reqMap` +a GM (v83 FUN_00a0977b). Then, again unless the player is a GM, and +unless the sack is an event's (2109xxx) or the Ariant Coliseum's Bomb +2100067, it asks "Too much interest can hinder your process of leveling +up. will you really summon the monster?" and sends nothing on No +(`field_limit::sack_asks`). The client's GM bit comes only with gm_level 3 +and up. The server also keeps a sack with `info/reqMap` to the maps it names (their ids are the children's names): the Ariant Coliseum's Bomb 2100067 opens only in 980010101, 980010201 and 980010301. A sack the server refuses for the map gets