client: AVA2 Won (cheque) system, revision mt20261027

ENABLE_CHEQUE_SYSTEM / ENABLE_WON_EXCHANGE_WINDOW = 1: Won in trades,
private shop Won prices (int32 cheque[] after the CG_MYSHOP items), shop
item cheque prices, mt_won script fixes, zh locale_game_ex overlay staged
into locale_zh_ava2 (fixes the swapped %s/%d in WONEXCHANGE_CONFIRM_QUESTION_2).

Also zero-init every TPacketCGExchange: arg1 was uninitialised and the
HEAD server drops arg1 > UINT32_MAX, so accept/cancel/item-add were lost
and trades never completed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-24 15:30:45 +09:00
co-authored by Claude Opus 5.5
parent 909fc8f851
commit 1a4d8295ff
17 changed files with 238 additions and 217 deletions
Binary file not shown.
Binary file not shown.
+4
View File
@@ -19,6 +19,10 @@
线上原始快照保留不动。`server_extracted/database` 与部署表有少数地图名差异时采用部署表。
服务端名称若再更新,需重新只读导出并核对差异后更新本快照。
`locale_game_ex_zh_overlay.txt` 是喜相逢客户端的 `locale/newcibn/locale_game_ex.txt`(元/Won 提示),
由 `scripts/build_xxf_item_overlay.py` 转成 GB18030 打进 `locale_zh_ava2` 包;localeinfo.py 在
`locale/common/locale_game_ex.txt`(英文或参数顺序错误)之后加载它。
## 任务文本(translate.lua)
40250 的任务文本都通过 `gameforge.<任务>.<键>` 引用。game 启动时从 `share/locale/<locale>/translate.lua` 读取这些文本(questlua.cpp),
@@ -0,0 +1,9 @@
DO_YOU_BUY_ITEM1_CHEQUE 确定要把%s 以%s 元和%s 金币买进吗?
DO_YOU_BUY_ITEM2_CHEQUE 确定要把%s %s个 以%s 元和%s 金币买进吗?
DO_YOU_BUY_ITEM1_CHEQUE1 确定要把%s 以%s 买进吗?
DO_YOU_BUY_ITEM2_CHEQUE1 确定要把%s %s个 以%s 买进吗?
DO_YOU_DROP_CHEQUE 确定要丢弃 %d 元吗?
WONEXCHANGE_CONFIRM_QUESTION_1 确定要出售 %d 元,换取 %s 金币吗?
WONEXCHANGE_CONFIRM_QUESTION_2 确定要购买 %d 元,需要 %s 金币吗?
WONEXCHANGE_CONFIRM_QUESTION_3 是否继续?
CHEQUE_SYSTEM_PICK_WON 获得了 %d 元
+4
View File
@@ -13,6 +13,8 @@ first registered pack wins, so locale_zh hides them. This pack is registered bef
item_scale.txt ava2items rows (9 columns, as LoadItemScale needs) + 喜相逢-only rows padded to 9 columns
wiki/*.txt ava2items' wiki texts, which it ships as locale/zh/wiki but the wiki reads from the locale path
icons/models an added item_list row's files that no registered pack has, from --assets (AVA2 pack_maker)
locale_game_ex.txt data/zh_40250/locale_game_ex_zh_overlay.txt in GB18030; localeinfo.py loads it after
locale/common/locale_game_ex.txt, whose Won (cheque) strings are English or wrongly ordered
Usage: scripts/build_xxf_item_overlay.py [--build build/switchbot-check] [--pack Client/pack] [--ava2items DIR]
"""
@@ -207,6 +209,8 @@ def main() -> int:
merged["item_scale.txt"] = merge_rows(xxf["item_scale.txt"], scale_rows, set(scale_rows) & xxf_scale.keys())
wiki = {name: data for name, data in wiki.items() if locale + name not in known}
merged["locale_game_ex.txt"] = (REPO / "data/zh_40250/locale_game_ex_zh_overlay.txt").read_text(
encoding="utf-8").replace("\n", "\r\n").encode("gb18030")
stage = tmp / "stage"
for name, data in {**merged, **wiki}.items():
(stage / locale / name).parent.mkdir(parents=True, exist_ok=True)
+20 -189
View File
@@ -1,194 +1,25 @@
// PORT: Won & Cheque Currency System (F30) module "mt_won".
// Serves UIScript/WonExchangeWindow.py and UIScript/PickETCDialog.py.
// PORT: Won (cheque) fixes over the XXF uiexchange.py/game.py scripts (revision27).
// - Dragging money onto an empty trade slot offered the Yang amount as Won as well.
// - Won cannot be dropped on the ground; the server has no drop packet for it.
static const char c_szWonScript[] = R"PY(# -*- coding: utf-8 -*-
import sys
import types
import app
import ui
import chat, localeInfo, mouseModule, net
PICK_ETC_LAYOUT = """# -*- coding: utf-8 -*-
import uiScriptLocale
window = {
"name" : "PickETCDialog", "style" : ("movable", "float",),
"x" : 100, "y" : 100, "width" : 170, "height" : 90,
"children" : (
{
"name" : "board", "type" : "board_with_titlebar",
"x" : 0, "y" : 0, "width" : 170, "height" : 90,
"title" : uiScriptLocale.PICK_MONEY_TITLE if hasattr(uiScriptLocale, 'PICK_MONEY_TITLE') else "输入数量",
"children" : (
{
"name" : "money_slot", "type" : "image", "x" : 20, "y" : 34,
"image" : "d:/ymir work/ui/public/Parameter_Slot_01.sub",
"children" : (
{
"name" : "money_value", "type" : "editline",
"x" : 3, "y" : 2, "width" : 60, "height" : 18,
"input_limit" : 6, "only_number" : 1,
},
{
"name" : "max_value", "type" : "text",
"x" : 63, "y" : 3, "text" : "/ 999999",
},
),
},
{
"name" : "accept_button", "type" : "button", "x" : 93, "y" : 35,
"text" : uiScriptLocale.OK if hasattr(uiScriptLocale, 'OK') else "确定",
"default_image" : "d:/ymir work/ui/public/small_button_01.sub",
"over_image" : "d:/ymir work/ui/public/small_button_02.sub",
"down_image" : "d:/ymir work/ui/public/small_button_03.sub",
},
{
"name" : "cancel_button", "type" : "button", "x" : 129, "y" : 35,
"text" : uiScriptLocale.CANCEL if hasattr(uiScriptLocale, 'CANCEL') else "取消",
"default_image" : "d:/ymir work/ui/public/small_button_01.sub",
"over_image" : "d:/ymir work/ui/public/small_button_02.sub",
"down_image" : "d:/ymir work/ui/public/small_button_03.sub",
},
),
},
),
}
"""
def SendGoldChequePacketNew(count):
chat.AppendChat(chat.CHAT_TYPE_INFO, getattr(localeInfo, 'CHEQUE_SYSTEM_DO_NOT_DROP_MONEY', 'Won cannot be dropped.'))
net.SendGoldChequePacketNew = SendGoldChequePacketNew
WON_EXCHANGE_LAYOUT = """# -*- coding: utf-8 -*-
import uiScriptLocale
ROOT_PATH = "d:/ymir work/ui/game/wonexchange/"
window = {
"name" : "WonExchangeWindow", "style" : ("movable", "float", "ltr"),
"x" : SCREEN_WIDTH - 216, "y" : SCREEN_HEIGHT - 215,
"width" : 197, "height" : 150,
"children" : (
{
"name" : "board", "type" : "board", "style" : ("attach",),
"x" : 0, "y" : 0, "width" : 197, "height" : 150,
"children" : (
{
"name" : "SellWon_TitleBar", "type" : "titlebar", "style" : ("attach",),
"x" : 6, "y" : 7, "width" : 184, "color" : "red",
"children" : ({ "name":"TitleName", "type":"text", "x":0, "y":-1, "text":"支票出售", "all_align":"center" },),
},
{
"name" : "BuyWon_TitleBar", "type" : "titlebar", "style" : ("attach",),
"x" : 6, "y" : 7, "width" : 184, "color" : "red",
"children" : ({ "name":"TitleName", "type":"text", "x":0, "y":-1, "text":"支票兑换", "all_align":"center" },),
},
{
"name" : "TabControl", "type" : "window", "x" : 0, "y" : 121, "width" : 196, "height" : 36,
"children" : (
{ "name" : "Tab_01", "type" : "expanded_image", "x" : 0, "y" : 0, "width" : 196, "height" : 36, "image" : ROOT_PATH+"tab_21.sub" },
{ "name" : "Tab_02", "type" : "expanded_image", "x" : 0, "y" : 0, "width" : 196, "height" : 36, "image" : ROOT_PATH+"tab_22.sub" },
{ "name" : "Tab_Button_01", "type" : "radio_button", "x" : 3, "y" : 3, "width" : 64, "height" : 30 },
{ "name" : "Tab_Button_02", "type" : "radio_button", "x" : 67, "y" : 3, "width" : 64, "height" : 30 },
),
},
{
"name" : "CurrencyConverter_Page", "type" : "window", "style" : ("attach",), "x" : 0, "y" : 24, "width" : 192, "height" : 93,
"children" : (
{
"name" : "CThinBoard", "type" : "thinboard_circle", "style" : ("attach",), "x" : 11, "y" : 12, "width" : 174, "height" : 81,
"children" : (
{
"name":"InputSlot", "type":"image", "x": 8, "y":20, "image" : "d:/ymir work/ui/public/Parameter_Slot_00.sub",
"children" : (
{ "name":"WonIcon", "type":"expanded_image", "style" : ("attach",), "x": 3, "y": 3, "x_scale" : .8, "y_scale" : .8, "image":"d:/ymir work/ui/game/windows/cheque_icon.sub" },
{ "name" : "Input", "type" : "editline_centered", "x" : 2, "y" : 3, "width" : 39, "height" : 18, "input_limit" : 3, "enable_codepage" : 0, "only_number" : 1, "r" : 1.0, "g" : 1.0, "b" : 1.0, "a" : 1.0 },
),
},
{ "name":"ArrowIcon", "type":"expanded_image", "style" : ("attach",), "x": 55, "y": 20, "x_scale" : 0.8, "y_scale" : .8, "image":"d:/ymir work/ui/game/windows/attach_metin_arrow.sub" },
{
"name":"ResultSlot", "type":"image", "x": 79, "y":20, "image" : "d:/ymir work/ui/public/parameter_slot_03.sub",
"children" : (
{ "name":"GoldIcon", "type":"expanded_image", "style" : ("attach",), "x": 3, "y": 3, "x_scale" : .8, "y_scale" : .8, "image":"d:/ymir work/ui/game/windows/money_icon.sub" },
{ "name" : "Result", "type" : "text", "x" : 6, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "" },
),
},
{ "name" : "AcceptButton", "type" : "button", "horizontal_align" : "center", "x" : 0, "y" : 55, "default_image" : "d:/ymir work/ui/public/acceptbutton00.sub", "over_image" : "d:/ymir work/ui/public/acceptbutton01.sub", "down_image" : "d:/ymir work/ui/public/acceptbutton02.sub" },
),
},
),
},
),
},
),
}
"""
_execfile_won = ui.execfile
def ExecFileWon(fileName, d):
base = fileName.replace("\\", "/").split("/")[-1].lower()
if base in ("picketcdialog.py", "picketcdialog"):
try:
_execfile_won(fileName, d)
if "window" in d:
return
except:
pass
exec(PICK_ETC_LAYOUT, d)
return
if base in ("wonexchangewindow.py", "wonexchangewindow"):
try:
_execfile_won(fileName, d)
if "window" in d:
return
except:
pass
exec(WON_EXCHANGE_LAYOUT, d)
return
_execfile_won(fileName, d)
ui.execfile = ExecFileWon
# Provide fallback PickETCDialog class
class PickETCDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.unitValue = 1
self.maxValue = 0
self.eventAccept = 0
def __del__(self):
ui.ScriptWindow.__del__(self)
def LoadDialog(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/PickETCDialog.py")
except:
try:
import uiExchange
_select_owner_empty_slot = uiExchange.ExchangeDialog.SelectOwnerEmptySlot
def SelectOwnerEmptySlot(self, SlotIndex):
mouse = mouseModule.mouseController
if mouse.isAttached() and mouse.IsAttachedMoney():
net.SendExchangeElkAddPacket(mouse.GetAttachedMoneyAmount())
net.SendExchangeChequeAddPacket(mouse.GetAttachedChequeAmount())
mouse.DeattachObject()
return
def Open(self, maxValue, unitValue=1):
self.maxValue = maxValue
self.unitValue = unitValue
self.SetCenterPosition()
self.SetTop()
self.Show()
def Close(self):
self.Hide()
# Provide fallback WonExchangeWindow class
class WonExchangeWindow(ui.ScriptWindow):
PAGE_SELL = 0
PAGE_BUY = 1
def __init__(self):
ui.ScriptWindow.__init__(self)
def __del__(self):
ui.ScriptWindow.__del__(self)
def BindInterface(self, interface):
self.interface = interface
def Open(self):
self.SetCenterPosition()
self.SetTop()
self.Show()
def Close(self):
self.Hide()
def Destroy(self):
pass
picketc_mod = types.ModuleType("uiPickETC")
picketc_mod.PickETCDialog = PickETCDialog
sys.modules["uiPickETC"] = picketc_mod
sys.modules["uipicketc"] = picketc_mod
wonex_mod = types.ModuleType("uiWonExchange")
wonex_mod.WonExchangeWindow = WonExchangeWindow
sys.modules["uiWonExchange"] = wonex_mod
sys.modules["uiwonexchange"] = wonex_mod
return _select_owner_empty_slot(self, SlotIndex)
uiExchange.ExchangeDialog.SelectOwnerEmptySlot = SelectOwnerEmptySlot
except (ImportError, AttributeError):
pass
)PY";
+6
View File
@@ -781,6 +781,7 @@ enum
EXCHANGE_SUBHEADER_CG_ELK_ADD, // arg1 == amount of elk
EXCHANGE_SUBHEADER_CG_ACCEPT, // arg1 == not used
EXCHANGE_SUBHEADER_CG_CANCEL, // arg1 == not used
EXCHANGE_SUBHEADER_CG_CHEQUE_ADD, // arg1 == amount of won (PORT revision27)
};
typedef struct command_exchange
@@ -1984,6 +1985,9 @@ enum EPacketShopSubHeaders
SHOP_SUBHEADER_GC_REFRESH_COUNT,
SHOP_SUBHEADER_GC_CHANGE_TITLE,
#endif
// PORT revision27: START_CHEQUE = START + int32 cheque[SHOP_HOST_ITEM_MAX_NUM].
SHOP_SUBHEADER_GC_START_CHEQUE = 40,
SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE = 41,
};
typedef struct packet_shop
@@ -2015,6 +2019,8 @@ enum
EXCHANGE_SUBHEADER_GC_END, // arg1 == not used
EXCHANGE_SUBHEADER_GC_ALREADY, // arg1 == not used
EXCHANGE_SUBHEADER_GC_LESS_ELK, // arg1 == not used
EXCHANGE_SUBHEADER_GC_CHEQUE_ADD, // arg1 == won (PORT revision27)
EXCHANGE_SUBHEADER_GC_LESS_CHEQUE, // arg1 == not used
};
typedef struct packet_position
@@ -1595,8 +1595,8 @@ void initapp()
PyModule_AddIntConstant(poModule, "ENABLE_VIEW_TARGET_DECIMAL_HP", 1);
PyModule_AddIntConstant(poModule, "ENABLE_VIEW_TARGET_PLAYER_HP", 1);
PyModule_AddIntConstant(poModule, "ENABLE_WINDOW_SLIDE_EFFECT", 0);
// PORT: Won wallet/transactions are gated off; its dependent window must be off too.
PyModule_AddIntConstant(poModule, "ENABLE_WON_EXCHANGE_WINDOW", 0);
// PORT: Won exchange window -> server /won_exchange (revision27).
PyModule_AddIntConstant(poModule, "ENABLE_WON_EXCHANGE_WINDOW", 1);
PyModule_AddIntConstant(poModule, "BL_MOVE_COSTUME_ATTR", 1);
PyModule_AddIntConstant(poModule, "DISABLE_CHEQUE_DROP", 0);
PyModule_AddIntConstant(poModule, "NEW_678TH_SKILL_ENABLE", 1);
@@ -1678,7 +1678,7 @@ void initapp()
PyModule_AddIntConstant(poModule, "ENABLE_MAGIC_REDUCTION_SYSTEM", 0);
PyModule_AddIntConstant(poModule, "ENABLE_DS_CHANGE_ATTR", 0);
PyModule_AddIntConstant(poModule, "ENABLE_CUBE_RENEWAL_WORLDARD", 1);
PyModule_AddIntConstant(poModule, "ENABLE_CHEQUE_SYSTEM", 0);
PyModule_AddIntConstant(poModule, "ENABLE_CHEQUE_SYSTEM", 1);
PyModule_AddIntConstant(poModule, "ENABLE_RANKING_SYSTEM", 1);
PyModule_AddIntConstant(poModule, "ENABLE_PLAYER_PER_ACCOUNT5", 0);
PyModule_AddIntConstant(poModule, "ENABLE_CONQUEROR_LEVEL", 0);
+2 -1
View File
@@ -203,6 +203,7 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
bool SendExchangeStartPacket(DWORD vid);
bool SendExchangeItemAddPacket(TItemPos ItemPos, BYTE byDisplayPos);
bool SendExchangeElkAddPacket(int64_t elk);
bool SendExchangeChequeAddPacket(int cheque);
bool SendExchangeItemDelPacket(BYTE pos);
bool SendExchangeAcceptPacket();
bool SendExchangeExitPacket();
@@ -281,7 +282,7 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
bool SendGiveItemPacket(DWORD dwTargetVID, TItemPos ItemPos, int iItemCount);
// Private Shop
bool SendBuildPrivateShopPacket(const char * c_szName, const std::vector<TShopItemTable> & c_rSellingItemStock);
bool SendBuildPrivateShopPacket(const char * c_szName, const std::vector<TShopItemTable> & c_rSellingItemStock, const std::vector<int> & c_rCheques);
// Refine
bool SendRefinePacket(BYTE byPos, BYTE byType);
@@ -1142,9 +1142,21 @@ PyObject* netSendExchangeElkAddPacket(PyObject* poSelf, PyObject* poArgs)
if (!PyTuple_GetLongLong(poArgs, 0, &iElk))
return Py_BuildException();
if(iElk<=0 || iElk>2000000000000000LL)return Py_BuildException();
if(iElk<0 || iElk>2000000000000000LL)return Py_BuildException();
CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
rkNetStream.SendExchangeElkAddPacket(iElk);
rkNetStream.SendExchangeElkAddPacket(iElk); // 0 (cheque-only offer) sends nothing
return Py_BuildNone();
}
PyObject* netSendExchangeChequeAddPacket(PyObject* poSelf, PyObject* poArgs)
{
int iCheque;
if (!PyTuple_GetInteger(poArgs, 0, &iCheque))
return Py_BuildException();
if (iCheque < 0 || iCheque > 999)
return Py_BuildException();
CPythonNetworkStream::Instance().SendExchangeChequeAddPacket(iCheque); // 0 sends nothing
return Py_BuildNone();
}
@@ -2089,6 +2101,7 @@ void initnet()
{ "SendExchangeItemAddPacket", netSendExchangeItemAddPacket, METH_VARARGS },
{ "SendExchangeItemDelPacket", netSendExchangeItemDelPacket, METH_VARARGS },
{ "SendExchangeElkAddPacket", netSendExchangeElkAddPacket, METH_VARARGS },
{ "SendExchangeChequeAddPacket", netSendExchangeChequeAddPacket, METH_VARARGS },
{ "SendExchangeAcceptPacket", netSendExchangeAcceptPacket, METH_VARARGS },
{ "SendExchangeExitPacket", netSendExchangeExitPacket, METH_VARARGS },
@@ -1802,6 +1802,7 @@ bool CPythonNetworkStream::RecvShopPacket()
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],"OnShopError",Py_BuildValue("(s)","NOT_ENOUGH_COUNT"));
break;
case SHOP_SUBHEADER_GC_START:
case SHOP_SUBHEADER_GC_START_CHEQUE: // PORT revision27: START + int32 cheque[SHOP_HOST_ITEM_MAX_NUM]
{
CPythonShop::Instance().Clear();
@@ -1813,6 +1814,15 @@ bool CPythonNetworkStream::RecvShopPacket()
{
CPythonShop::Instance().SetItemData(iItemIndex, pShopStartPacket->items[iItemIndex]);
}
if (packet_shop.subheader == SHOP_SUBHEADER_GC_START_CHEQUE)
{
const char* cheques = &vecBuffer[4 + sizeof(TPacketGCShopStart)];
for (unsigned i = 0; i < SHOP_HOST_ITEM_MAX_NUM; ++i)
{
int32_t cheque; memcpy(&cheque, cheques + i * sizeof(cheque), sizeof(cheque));
CPythonShop::Instance().SetItemCheque(i, cheque);
}
}
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "StartShop", Py_BuildValue("(i)", dwVID));
}
@@ -1860,6 +1870,8 @@ bool CPythonNetworkStream::RecvShopPacket()
{
TPacketGCShopUpdateItem * pShopUpdateItemPacket = (TPacketGCShopUpdateItem *)&vecBuffer[0];
CPythonShop::Instance().SetItemData(pShopUpdateItemPacket->pos, pShopUpdateItemPacket->item);
if (!pShopUpdateItemPacket->item.vnum)
CPythonShop::Instance().SetItemCheque(pShopUpdateItemPacket->pos, 0);
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "RefreshShop", Py_BuildValue("()"));
}
break;
@@ -1876,6 +1888,10 @@ bool CPythonNetworkStream::RecvShopPacket()
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "NOT_ENOUGH_MONEY_EX"));
break;
case SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE:
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "NOT_ENOUGH_CHEQUE"));
break;
case SHOP_SUBHEADER_GC_SOLD_OUT:
case SHOP_SUBHEADER_GC_SOLDOUT:
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "SOLDOUT"));
@@ -1999,6 +2015,22 @@ bool CPythonNetworkStream::RecvExchangePacket()
case EXCHANGE_SUBHEADER_GC_LESS_ELK:
Tracef("trade_less_elk");
break;
// PORT revision27: Won offered in the trade window (0..999).
case EXCHANGE_SUBHEADER_GC_CHEQUE_ADD:
if (exchange_packet.arg1 < 0 || exchange_packet.arg1 > 999)
break;
if (exchange_packet.is_me)
CPythonExchange::Instance().SetChequeToSelf((DWORD) exchange_packet.arg1);
else
CPythonExchange::Instance().SetChequeToTarget((DWORD) exchange_packet.arg1);
__RefreshExchangeWindow();
break;
case EXCHANGE_SUBHEADER_GC_LESS_CHEQUE:
Tracef("trade_less_cheque");
break;
};
return true;
@@ -2193,7 +2225,7 @@ bool CPythonNetworkStream::SendExchangeStartPacket(DWORD vid)
if (!__CanActMainInstance())
return true;
TPacketCGExchange packet;
TPacketCGExchange packet = {}; // PORT: the server drops arg1 > UINT32_MAX, so every exchange packet zeroes its unset fields
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_START;
@@ -2211,10 +2243,11 @@ bool CPythonNetworkStream::SendExchangeStartPacket(DWORD vid)
bool CPythonNetworkStream::SendExchangeElkAddPacket(int64_t elk)
{
if (!__CanActMainInstance())
// PORT: the cheque pick dialog submits both amounts; an empty one is not an offer.
if (elk <= 0 || !__CanActMainInstance())
return true;
TPacketCGExchange packet;
TPacketCGExchange packet = {};
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_ELK_ADD;
@@ -2229,12 +2262,32 @@ bool CPythonNetworkStream::SendExchangeElkAddPacket(int64_t elk)
return SendSequence();
}
bool CPythonNetworkStream::SendExchangeChequeAddPacket(int cheque)
{
if (cheque <= 0 || !__CanActMainInstance())
return true;
TPacketCGExchange packet = {};
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_CHEQUE_ADD;
packet.arg1 = cheque;
if (!Send(sizeof(packet), &packet))
{
Tracef("send_trade_cheque_add_packet Error\n");
return false;
}
return SendSequence();
}
bool CPythonNetworkStream::SendExchangeItemAddPacket(TItemPos ItemPos, BYTE byDisplayPos)
{
if (!__CanActMainInstance())
return true;
TPacketCGExchange packet;
TPacketCGExchange packet = {};
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_ITEM_ADD;
@@ -2258,7 +2311,7 @@ bool CPythonNetworkStream::SendExchangeItemDelPacket(BYTE pos)
if (!__CanActMainInstance())
return true;
TPacketCGExchange packet;
TPacketCGExchange packet = {};
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_ITEM_DEL;
@@ -2278,7 +2331,7 @@ bool CPythonNetworkStream::SendExchangeAcceptPacket()
if (!__CanActMainInstance())
return true;
TPacketCGExchange packet;
TPacketCGExchange packet = {};
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_ACCEPT;
@@ -2297,7 +2350,7 @@ bool CPythonNetworkStream::SendExchangeExitPacket()
if (!__CanActMainInstance())
return true;
TPacketCGExchange packet;
TPacketCGExchange packet = {};
packet.header = HEADER_CG_EXCHANGE;
packet.subheader = EXCHANGE_SUBHEADER_CG_CANCEL;
@@ -4031,8 +4084,11 @@ bool CPythonNetworkStream::RecvDungeon()
/////////////////////////////////////////////////////////////////////////
// MyShop
bool CPythonNetworkStream::SendBuildPrivateShopPacket(const char * c_szName, const std::vector<TShopItemTable> & c_rSellingItemStock)
bool CPythonNetworkStream::SendBuildPrivateShopPacket(const char * c_szName, const std::vector<TShopItemTable> & c_rSellingItemStock, const std::vector<int> & c_rCheques)
{
if (c_rCheques.size() != c_rSellingItemStock.size())
return false;
TPacketCGMyShop packet;
packet.bHeader = HEADER_CG_MYSHOP;
strncpy(packet.szSign, c_szName, SHOP_SIGN_MAX_LEN);
@@ -4047,6 +4103,14 @@ bool CPythonNetworkStream::SendBuildPrivateShopPacket(const char * c_szName, con
return false;
}
// PORT revision27: int32 Won price per item, in the same order as the items.
for (size_t i = 0; i < c_rCheques.size(); ++i)
{
const int32_t cheque = c_rCheques[i];
if (!Send(sizeof(cheque), &cheque))
return false;
}
return SendSequence();
}
@@ -4533,7 +4597,7 @@ bool CPythonNetworkStream::SendClientVersionPacket()
kVersionPacket.header = HEADER_CG_CLIENT_VERSION2;
strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);
// PORT: revision mt20261024 adds 64-bit shop prices, fixed offline records and 64-bit exchange/guild money; preserve the numeric prefix for atoi version checks.
strncpy(kVersionPacket.timestamp, "1215955205 mt20261026", sizeof(kVersionPacket.timestamp)-1); // PORT: revision26 adds the AVA2 Cube Renewal packets (CG216/GC221).
strncpy(kVersionPacket.timestamp, "1215955205 mt20261027", sizeof(kVersionPacket.timestamp)-1); // PORT: revision27 adds the Won (cheque) exchange/shop packets; revision26 the AVA2 Cube Renewal packets.
//strncpy(kVersionPacket.timestamp, __TIMESTAMP__, sizeof(kVersionPacket.timestamp)-1); // old_string_ver
//strncpy(kVersionPacket.timestamp, "1218055205", sizeof(kVersionPacket.timestamp)-1); // new_future
//strncpy(kVersionPacket.timestamp, "1214055205", sizeof(kVersionPacket.timestamp)-1); // old_past
@@ -4547,7 +4611,7 @@ bool CPythonNetworkStream::SendClientVersionPacket()
kVersionPacket.header = HEADER_CG_CLIENT_VERSION;
strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);
// PORT: 64-bit money protocol requires mt20261024; older AVA2 services retain their own revision gates.
strncpy(kVersionPacket.timestamp, "mt20261026", sizeof(kVersionPacket.timestamp)-1); // PORT: revision26 is backward-compatible with revision24 money.
strncpy(kVersionPacket.timestamp, "mt20261027", sizeof(kVersionPacket.timestamp)-1); // PORT: revision27 is backward-compatible with revision24 money.
if (!Send(sizeof(kVersionPacket), &kVersionPacket))
Tracef("SendClientReportPacket Error");
+50 -4
View File
@@ -24,6 +24,12 @@ DWORD CPythonShop::GetItemCurrencyVnum(DWORD index) const {
DWORD CPythonShop::GetItemCurrencyCount(DWORD index) const {
return index<SHOP_TAB_COUNT_MAX*SHOP_HOST_ITEM_MAX_NUM?m_itemCurrency[index].count:0;
}
void CPythonShop::SetItemCheque(DWORD index, int cheque) {
if(index<SHOP_TAB_COUNT_MAX*SHOP_HOST_ITEM_MAX_NUM) m_itemCheque[index]=cheque;
}
int CPythonShop::GetItemCheque(DWORD index) const {
return index<SHOP_TAB_COUNT_MAX*SHOP_HOST_ITEM_MAX_NUM?m_itemCheque[index]:0;
}
void CPythonShop::SetTabCoinType(BYTE tabIdx, BYTE coinType)
{
if (tabIdx >= m_bTabCount)
@@ -116,8 +122,9 @@ BOOL CPythonShop::GetItemData(BYTE tabIdx, DWORD dwSlotPos, const TShopItemData
void CPythonShop::ClearPrivateShopStock()
{
m_PrivateShopItemStock.clear();
m_PrivateShopItemCheque.clear();
}
void CPythonShop::AddPrivateShopItemStock(TItemPos ItemPos, BYTE dwDisplayPos, int64_t dwPrice)
void CPythonShop::AddPrivateShopItemStock(TItemPos ItemPos, BYTE dwDisplayPos, int64_t dwPrice, int iCheque)
{
DelPrivateShopItemStock(ItemPos);
@@ -128,14 +135,21 @@ void CPythonShop::AddPrivateShopItemStock(TItemPos ItemPos, BYTE dwDisplayPos, i
SellingItem.price = dwPrice;
SellingItem.display_pos = dwDisplayPos;
m_PrivateShopItemStock.insert(std::make_pair(ItemPos, SellingItem));
m_PrivateShopItemCheque[ItemPos] = iCheque;
}
void CPythonShop::DelPrivateShopItemStock(TItemPos ItemPos)
{
m_PrivateShopItemCheque.erase(ItemPos);
if (m_PrivateShopItemStock.end() == m_PrivateShopItemStock.find(ItemPos))
return;
m_PrivateShopItemStock.erase(ItemPos);
}
int CPythonShop::GetPrivateShopItemCheque(TItemPos ItemPos)
{
std::map<TItemPos, int>::const_iterator itor = m_PrivateShopItemCheque.find(ItemPos);
return m_PrivateShopItemCheque.end() == itor ? 0 : itor->second;
}
int64_t CPythonShop::GetPrivateShopItemPrice(TItemPos ItemPos)
{
TPrivateShopItemStock::iterator itor = m_PrivateShopItemStock.find(ItemPos);
@@ -166,7 +180,12 @@ void CPythonShop::BuildPrivateShop(const char * c_szName)
std::sort(ItemStock.begin(), ItemStock.end(), ItemStockSortFunc());
CPythonNetworkStream::Instance().SendBuildPrivateShopPacket(c_szName, ItemStock);
std::vector<int> Cheques;
Cheques.reserve(ItemStock.size());
for (size_t i = 0; i < ItemStock.size(); ++i)
Cheques.push_back(GetPrivateShopItemCheque(ItemStock[i].pos));
CPythonNetworkStream::Instance().SendBuildPrivateShopPacket(c_szName, ItemStock, Cheques);
}
void CPythonShop::Open(BOOL isPrivateShop, BOOL isMainPrivateShop)
@@ -179,6 +198,7 @@ void CPythonShop::Open(BOOL isPrivateShop, BOOL isMainPrivateShop)
void CPythonShop::Close()
{
memset(m_itemCurrency,0,sizeof(m_itemCurrency));
memset(m_itemCheque,0,sizeof(m_itemCheque));
m_isShoping = FALSE;
m_isPrivateShop = FALSE;
m_isMainPlayerPrivateShop = FALSE;
@@ -202,6 +222,7 @@ BOOL CPythonShop::IsMainPlayerPrivateShop()
void CPythonShop::Clear()
{
memset(m_itemCurrency,0,sizeof(m_itemCurrency));
memset(m_itemCheque,0,sizeof(m_itemCheque));
m_isShoping = FALSE;
m_isPrivateShop = FALSE;
m_isMainPlayerPrivateShop = FALSE;
@@ -366,10 +387,14 @@ PyObject * shopAddPrivateShopItemStock(PyObject * poSelf, PyObject * poArgs)
long long iPrice;
if (!PyTuple_GetLongLong(poArgs, 3, &iPrice))
return Py_BuildException();
int iCheque = 0; // PORT revision27: optional Won price
if (PyTuple_Size(poArgs) > 4 && !PyTuple_GetInteger(poArgs, 4, &iCheque))
return Py_BuildException();
if (iPrice <= 0 || iPrice > 2000000000000000LL || iDisplaySlotIndex < 0 || iDisplaySlotIndex >= SHOP_HOST_ITEM_MAX_NUM)
if (iPrice < 0 || iPrice > 2000000000000000LL || iCheque < 0 || iCheque > 999 || (iPrice == 0 && iCheque == 0) ||
iDisplaySlotIndex < 0 || iDisplaySlotIndex >= SHOP_HOST_ITEM_MAX_NUM)
return PyErr_Format(PyExc_ValueError, "invalid shop price or display slot");
CPythonShop::Instance().AddPrivateShopItemStock(TItemPos(bItemWindowType, wItemSlotIndex), iDisplaySlotIndex, iPrice);
CPythonShop::Instance().AddPrivateShopItemStock(TItemPos(bItemWindowType, wItemSlotIndex), iDisplaySlotIndex, iPrice, iCheque);
return Py_BuildNone();
}
PyObject * shopDelPrivateShopItemStock(PyObject * poSelf, PyObject * poArgs)
@@ -396,6 +421,25 @@ PyObject * shopGetPrivateShopItemPrice(PyObject * poSelf, PyObject * poArgs)
int64_t iValue = CPythonShop::Instance().GetPrivateShopItemPrice(TItemPos(bItemWindowType, wItemSlotIndex));
return PyLong_FromLongLong(iValue);
}
PyObject * shopGetPrivateShopItemCheque(PyObject * poSelf, PyObject * poArgs)
{
BYTE bItemWindowType;
if (!PyTuple_GetInteger(poArgs, 0, &bItemWindowType))
return Py_BuildException();
WORD wItemSlotIndex;
if (!PyTuple_GetInteger(poArgs, 1, &wItemSlotIndex))
return Py_BuildException();
return Py_BuildValue("i", CPythonShop::Instance().GetPrivateShopItemCheque(TItemPos(bItemWindowType, wItemSlotIndex)));
}
PyObject * shopGetItemCheque(PyObject * poSelf, PyObject * poArgs)
{
int iIndex;
if (!PyTuple_GetInteger(poArgs, 0, &iIndex) || iIndex < 0)
return Py_BuildException();
return Py_BuildValue("i", CPythonShop::Instance().GetItemCheque(iIndex));
}
PyObject * shopBuildPrivateShop(PyObject * poSelf, PyObject * poArgs)
{
char * szName;
@@ -839,6 +883,8 @@ void initshop()
{ "AddPrivateShopItemStock", shopAddPrivateShopItemStock, METH_VARARGS },
{ "DelPrivateShopItemStock", shopDelPrivateShopItemStock, METH_VARARGS },
{ "GetPrivateShopItemPrice", shopGetPrivateShopItemPrice, METH_VARARGS },
{ "GetPrivateShopItemCheque", shopGetPrivateShopItemCheque, METH_VARARGS },
{ "GetItemCheque", shopGetItemCheque, METH_VARARGS },
{ "BuildPrivateShop", shopBuildPrivateShop, METH_VARARGS },
#ifdef ENABLE_OFFLINESHOP_SYSTEM
+7 -1
View File
@@ -27,6 +27,9 @@ class CPythonShop : public CSingleton<CPythonShop>
void SetItemCurrency(DWORD index,DWORD vnum,DWORD count);
DWORD GetItemCurrencyVnum(DWORD index) const;
DWORD GetItemCurrencyCount(DWORD index) const;
// PORT revision27: Won price per slot (PC shops only), 0..999.
void SetItemCheque(DWORD index, int cheque);
int GetItemCheque(DWORD index) const;
void SetItemData(DWORD dwIndex, const TShopItemData & c_rShopItemData);
BOOL GetItemData(DWORD dwIndex, const TShopItemData ** c_ppItemData);
@@ -53,9 +56,10 @@ class CPythonShop : public CSingleton<CPythonShop>
BOOL IsMainPlayerPrivateShop();
void ClearPrivateShopStock();
void AddPrivateShopItemStock(TItemPos ItemPos, BYTE byDisplayPos, int64_t dwPrice);
void AddPrivateShopItemStock(TItemPos ItemPos, BYTE byDisplayPos, int64_t dwPrice, int iCheque = 0);
void DelPrivateShopItemStock(TItemPos ItemPos);
int64_t GetPrivateShopItemPrice(TItemPos ItemPos);
int GetPrivateShopItemCheque(TItemPos ItemPos);
void BuildPrivateShop(const char * c_szName);
#ifdef ENABLE_OFFLINESHOP_SYSTEM
@@ -134,9 +138,11 @@ class CPythonShop : public CSingleton<CPythonShop>
};
TAva2ShopPrice m_itemCurrency[SHOP_TAB_COUNT_MAX*SHOP_HOST_ITEM_MAX_NUM];
int m_itemCheque[SHOP_TAB_COUNT_MAX*SHOP_HOST_ITEM_MAX_NUM];
BYTE m_bTabCount;
ShopTab m_aShoptabs[SHOP_TAB_COUNT_MAX];
typedef std::map<TItemPos, TShopItemTable> TPrivateShopItemStock;
TPrivateShopItemStock m_PrivateShopItemStock;
std::map<TItemPos, int> m_PrivateShopItemCheque; // TShopItemTable is wire-sized, so Won rides beside it
};
@@ -9,13 +9,19 @@ inline bool PortShopPayloadValid(BYTE subheader, const char* data, size_t size)
if (!data && size) return false;
switch (subheader) {
case SHOP_SUBHEADER_GC_START:
case SHOP_SUBHEADER_GC_START_CHEQUE:
case SHOP_SUBHEADER_GC_START_ITEM_CURRENCY: {
const size_t expected = sizeof(DWORD) + sizeof(TPacketGCShopStart) +
(subheader == SHOP_SUBHEADER_GC_START_ITEM_CURRENCY ? sizeof(TAva2ShopPrice)*SHOP_HOST_ITEM_MAX_NUM : 0);
(subheader == SHOP_SUBHEADER_GC_START_ITEM_CURRENCY ? sizeof(TAva2ShopPrice)*SHOP_HOST_ITEM_MAX_NUM : 0) +
(subheader == SHOP_SUBHEADER_GC_START_CHEQUE ? sizeof(int32_t)*SHOP_HOST_ITEM_MAX_NUM : 0);
if (size != expected) return false;
for (unsigned i=0;i<SHOP_HOST_ITEM_MAX_NUM;++i) {
TShopItemData item; memcpy(&item,data+sizeof(DWORD)+i*sizeof(item),sizeof(item));
if (!PortShopItemValid(item)) return false;
if (subheader == SHOP_SUBHEADER_GC_START_CHEQUE) {
int32_t cheque; memcpy(&cheque,data+sizeof(DWORD)+sizeof(TPacketGCShopStart)+i*sizeof(cheque),sizeof(cheque));
if (cheque < 0 || cheque > 999 || (cheque && !item.vnum)) return false;
}
}
return true;
}
@@ -46,7 +52,7 @@ inline bool PortShopPayloadValid(BYTE subheader, const char* data, size_t size)
case SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY: case SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY_EX:
case SHOP_SUBHEADER_GC_SOLDOUT: case SHOP_SUBHEADER_GC_SOLD_OUT:
case SHOP_SUBHEADER_GC_INVENTORY_FULL: case SHOP_SUBHEADER_GC_INVALID_POS:
case SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM:
case SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM: case SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE:
return size == 0;
default: return false;
}
+18 -3
View File
@@ -59,6 +59,7 @@
#include "UserInterface/PythonNetworkStream.h"
#include "UserInterface/PythonPlayer.h"
#include "UserInterface/PythonExchange.h"
#include "UserInterface/PythonShop.h"
#include "UserInterface/PythonTextTail.h"
#include "UserInterface/PythonCharacterManager.h"
#include "UserInterface/InstanceBase.h"
@@ -450,7 +451,6 @@ int main(int argc, char** argv)
CHECK(pump_until(8,[&] {return type()==9 || failed();}));
CHECK(type()==9 && !failed());
if (std::getenv("MT_TEST_QUIVER_MOTION")) {
CHECK(py("import app\nassert not app.ENABLE_CHEQUE_SYSTEM and not app.ENABLE_WON_EXCHANGE_WINDOW"));
// Do not call Register here: loading-phase registration itself must have worked.
CHECK(py("import mt_quiver_motion\nassert mt_quiver_motion.loaded == {1: True, 5: True}"));
CHECK(py("_bag=_stream.curPhaseWindow.interface.wndInventory\nassert len(_bag.inventoryTab)==5\n_bag.SetInventoryPage(4)\nassert _bag.GetInventoryPageIndex()==4\n_bag.SetInventoryPage(0)"));
@@ -1889,7 +1889,7 @@ int main(int argc, char** argv)
CHECK(py_true("app.ENABLE_QUIVER_SYSTEM == 0"));
CHECK(py_true("app.ENABLE_MAGIC_REDUCTION_SYSTEM == 0"));
CHECK(py_true("app.ENABLE_DS_CHANGE_ATTR == 0"));
CHECK(py_true("app.ENABLE_CUBE_RENEWAL_WORLDARD == 0"));
CHECK(py_true("app.ENABLE_CUBE_RENEWAL_WORLDARD == 1"));
// Python item constants & methods
CHECK(py_true("item.EQUIPMENT_GLOVE == player.EQUIPMENT_SLOT_START + 37"));
@@ -1931,7 +1931,7 @@ int main(int argc, char** argv)
// F30: Won & Cheque currency system
CHECK(POINT_CHEQUE == 249);
CHECK(py_true("app.ENABLE_CHEQUE_SYSTEM == 0"));
CHECK(py_true("app.ENABLE_CHEQUE_SYSTEM == 1 and app.ENABLE_WON_EXCHANGE_WINDOW == 1"));
CHECK(py_true("player.CHEQUE == 249"));
CHECK(py_true("hasattr(player, 'GetCheque')"));
CHECK(py_true("player.GetCheque() == 0"));
@@ -1950,6 +1950,21 @@ int main(int argc, char** argv)
// Won UI components
CHECK(py("import uiPickETC; p = uiPickETC.PickETCDialog(); p.LoadDialog(); p.Open(100); p.Close()"));
CHECK(py("import uiWonExchange; w = uiWonExchange.WonExchangeWindow(); w.Open(); w.Close()"));
// revision27 Won bindings and the mt_won script fixes
CHECK(py("import net, shop"));
CHECK(py_true("hasattr(net, 'SendExchangeChequeAddPacket') and hasattr(net, 'SendGoldChequePacketNew')"));
CHECK(py_true("shop.GetItemCheque(0) == 0"));
CPythonShop::Instance().SetItemCheque(3, 25);
CHECK(py_true("shop.GetItemCheque(3) == 25"));
CPythonShop::Instance().Clear();
CHECK(py_true("shop.GetItemCheque(3) == 0"));
CHECK(py("shop.AddPrivateShopItemStock(1, 7, 2, 0, 5)"));
CHECK(py_true("shop.GetPrivateShopItemCheque(1, 7) == 5 and shop.GetPrivateShopItemPrice(1, 7) == 0"));
CHECK(py("shop.DelPrivateShopItemStock(1, 7)"));
CHECK(py_true("shop.GetPrivateShopItemCheque(1, 7) == 0"));
CHECK(!py("shop.AddPrivateShopItemStock(1, 7, 2, 0, 0)"));
CHECK(!py("shop.AddPrivateShopItemStock(1, 7, 2, 1, 1000)"));
CHECK(py_true("__import__('uiExchange').ExchangeDialog.SelectOwnerEmptySlot.__module__ == 'mt_won'"));
// Sound & music volume
CHECK(py("systemSetting.SetMusicVolume(0.5)"));
@@ -79,6 +79,22 @@ int main(int argc, char** argv)
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_UPDATE_PRICE,(char*)&price,sizeof(price)));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_UPDATE_PRICE,(char*)&price,4));
assert(!PortShopPayloadValid(255,nullptr,0));
// revision27 Won prices: START + int32 cheque[SHOP_HOST_ITEM_MAX_NUM], each 0..999 on a real item.
static_assert(SHOP_SUBHEADER_GC_START_CHEQUE==40 && SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE==41);
static_assert(EXCHANGE_SUBHEADER_CG_CHEQUE_ADD==6 && EXCHANGE_SUBHEADER_GC_CHEQUE_ADD==8 && EXCHANGE_SUBHEADER_GC_LESS_CHEQUE==9);
records[0].price=0;
int32_t cheques[SHOP_HOST_ITEM_MAX_NUM]={};cheques[0]=999;
std::vector<char> won(sizeof(DWORD)+sizeof(records)+sizeof(cheques));
memcpy(won.data()+sizeof(DWORD),records,sizeof(records));
memcpy(won.data()+sizeof(DWORD)+sizeof(records),cheques,sizeof(cheques));
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()-4));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START,won.data(),won.size()));
cheques[0]=1000;memcpy(won.data()+sizeof(DWORD)+sizeof(records),cheques,sizeof(cheques));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()));
cheques[0]=0;cheques[1]=5;memcpy(won.data()+sizeof(DWORD)+sizeof(records),cheques,sizeof(cheques));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()));
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE,nullptr,0));
}
static_assert(sizeof(TPacketCGExchange::arg1)==8);
static_assert(sizeof(TPacketCGExchange)==14);
+2 -2
View File
@@ -10,11 +10,11 @@ ROOT = Path(__file__).resolve().parents[2]
class QuiverMotionTests(unittest.TestCase):
def test_disabled_wallet_also_disables_dependent_window(self):
def test_wallet_and_dependent_window_switch_together(self):
source=(ROOT/'src/port/UserInterface/PythonApplicationModule.cpp').read_text()
for name in ('ENABLE_CHEQUE_SYSTEM','ENABLE_WON_EXCHANGE_WINDOW'):
values=re.findall(r'PyModule_AddIntConstant\(poModule,\s*"'+name+r'",\s*(\d+)\)',source)
self.assertEqual(values,['0'])
self.assertEqual(values,['1'])
def load(self, missing=None):
names = ['chr', 'chrmgr', 'pack', 'playerSettingModule']