Files
mtgodot-poc/tools/server/hunt-set/server.patch
T
shenleiandClaude Opus 5.5 d163aab949 hunt-set: 小狩猎套装礼包 is free in the item mall
CShopEx::Buy rejected price 0 as a hack; allow it like CShop::Buy already does.
Rebuilt and deployed game on 203; buying the box for 0 verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 10:30:46 +09:00

46 lines
1.5 KiB
Diff

--- a/server/game/src/questlua_item.cpp
+++ b/server/game/src/questlua_item.cpp
@@ -136,6 +136,22 @@
return 0;
}
+ // item.set_attribute(index, apply, value): writes one attribute of the selected item (hunt-set, not
+ // 40250); apply 0 clears it.
+ int item_set_attribute(lua_State* L)
+ {
+ LPITEM item = CQuestManager::instance().GetCurrentItem();
+ if (item && lua_isnumber(L, 1) && lua_isnumber(L, 2) && lua_isnumber(L, 3))
+ {
+ int idx = (int) lua_tonumber(L, 1);
+ int type = (int) lua_tonumber(L, 2);
+ int value = (int) lua_tonumber(L, 3);
+ if (idx >= 0 && idx < ITEM_ATTRIBUTE_MAX_NUM && type >= 0 && type < MAX_APPLY_NUM)
+ item->SetForceAttribute(idx, type, type ? value : 0);
+ }
+ return 0;
+ }
+
int item_get_vnum(lua_State* L)
{
CQuestManager& q = CQuestManager::instance();
@@ -463,6 +479,7 @@
{ "remove", item_remove },
{ "get_socket", item_get_socket },
{ "set_socket", item_set_socket },
+ { "set_attribute", item_set_attribute },
{ "get_vnum", item_get_vnum },
{ "has_flag", item_has_flag },
{ "get_value", item_get_value },
--- a/server/game/src/shopEx.cpp
+++ b/server/game/src/shopEx.cpp
@@ -133,7 +133,8 @@
TShopTableEx& shopTab = m_vec_shopTabs[tabIdx];
TShopItemTable& r_item = shopTab.items[slotPos];
- if (r_item.price <= 0)
+ // if (r_item.price <= 0)
+ if (r_item.price < 0) // Fix, as in CShop::Buy: a free item (price 0) can be bought
{
LogManager::instance().HackLog("SHOP_BUY_GOLD_OVERFLOW", ch);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;