Add JSON save and load for shopkeeper and merchant mobiles

ShopKeeperInfo and MerchantInfo only had binary methods, so a zone
holding either type could not be unpacked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-24 10:51:30 -04:00
1 parent d4008b1a9f
commit e879110c58
2 files changed
+48

No files matched your search

@@ -48,3 +48,28 @@ class MerchantInfo(MobileInfo):
for l in self.merchant_sell_list:
stream.write_qword(l[0])
stream.write_dword(l[1])
def save_json(self):
data = super().save_json()
data['merchant_trade_type'] = self.merchant_trade_type
data['merchant_std_buy_margin'] = self.merchant_std_buy_margin
data['merchant_std_sell_margin'] = self.merchant_std_sell_margin
data['merchant_guild_buy_margin'] = self.merchant_guild_buy_margin
data['merchant_guild_sell_margin'] = self.merchant_guild_sell_margin
data['merchant_nation_buy_margin'] = self.merchant_nation_buy_margin
data['merchant_nation_sell_margin'] = self.merchant_nation_sell_margin
data['merchant_buy_list'] = self.merchant_buy_list
data['merchant_sell_list'] = self.merchant_sell_list
return data
def load_json(self, data):
super().load_json(data)
self.merchant_trade_type = data['merchant_trade_type']
self.merchant_std_buy_margin = data['merchant_std_buy_margin']
self.merchant_std_sell_margin = data['merchant_std_sell_margin']
self.merchant_guild_buy_margin = data['merchant_guild_buy_margin']
self.merchant_guild_sell_margin = data['merchant_guild_sell_margin']
self.merchant_nation_buy_margin = data['merchant_nation_buy_margin']
self.merchant_nation_sell_margin = data['merchant_nation_sell_margin']
self.merchant_buy_list = data['merchant_buy_list']
self.merchant_sell_list = data['merchant_sell_list']