client: native AVA2 cube_renewal module (ENABLE_CUBE_RENEWAL_WORLDARD=1)
PythonCubeRenewal + PhaseGameCubeRenewal ported verbatim from AVA2: GC 221 fills the recipe list and calls BINARY_CUBE_RENEWAL_OPEN, the XXF uicuberenewal window sends CG 216 make/close (its 3rd "improve" argument is accepted and not sent). Replaces the read-only CubeRenewalScript.inc preview shim. Version mt20261026 so the server picks the new window. FakeLoginServer: CG 215/216 sizes and a /mt_test_cube_open fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d6617e01f7
commit
909fc8f851
@@ -1,153 +0,0 @@
|
||||
// PORT: server-backed modern Cube recipe preview, NOT a crafting backend.
|
||||
static const char c_szCubeRenewalScript[] = R"PY(# -*- coding: utf-8 -*-
|
||||
import game
|
||||
import chat
|
||||
import mt_feature_service
|
||||
from mt_biolog import L
|
||||
|
||||
_dates=[]
|
||||
_recipes=[]
|
||||
_handler=None
|
||||
_window=None
|
||||
_epoch=0
|
||||
_npc=0
|
||||
_readonly=False
|
||||
_last_preflight=None
|
||||
_last_error=None
|
||||
_check_serial=0
|
||||
|
||||
def CountDates():return len(_dates)
|
||||
|
||||
def GetDates(index):
|
||||
if 0<=index<len(_dates):return _dates[index]
|
||||
return (0,0,False,0,0,0,0,0,0,0,0,0,0,0,0,'None')
|
||||
|
||||
def SetCubeRenewalHandler(handler):
|
||||
global _handler
|
||||
_handler=handler
|
||||
|
||||
def _Tuple(row):
|
||||
values=[row['reward'],row['count'],row['stackable']]
|
||||
for v,n in row['materials']:values.extend((v,n))
|
||||
values.extend([0,0]*(5-len(row['materials'])))
|
||||
return tuple(values+[row['gold'],row['percent'],row['category']])
|
||||
|
||||
def CubeRenewalClose():
|
||||
global _handler,_epoch,_npc,_readonly,_last_preflight
|
||||
_epoch+=1;_npc=0;_readonly=False;_handler=None;_last_preflight=None
|
||||
del _dates[:];del _recipes[:]
|
||||
if _window:_window.Hide()
|
||||
|
||||
def LoadCatalogue(npc,callback=None):
|
||||
global _epoch,_npc,_last_error,_readonly,_last_preflight
|
||||
_epoch+=1;epoch=_epoch;_npc=npc;_last_error=None;_readonly=False;_last_preflight=None
|
||||
if _window:_window.Hide()
|
||||
del _dates[:];del _recipes[:]
|
||||
service=mt_feature_service.g_service
|
||||
if not service:
|
||||
_last_error='offline'
|
||||
if callback:callback(None,'offline')
|
||||
return 0
|
||||
pending=[];state={'total':None,'revision':None}
|
||||
def fail(error):
|
||||
global _last_error
|
||||
_last_error=error
|
||||
if callback:callback(None,error)
|
||||
def receive(result,error):
|
||||
if epoch!=_epoch:return
|
||||
if error:fail(error);return
|
||||
if state['total'] is None:state['total']=result['total']
|
||||
if result['total']!=state['total'] or result['offset']!=len(pending):fail('stale_catalogue');return
|
||||
ids=set(r['id'] for r in pending)
|
||||
for row in result['rows']:
|
||||
if state['revision'] is None:state['revision']=row['catalogue']
|
||||
if row['catalogue']!=state['revision'] or row['id'] in ids:fail('stale_catalogue');return
|
||||
ids.add(row['id']);pending.append(row)
|
||||
if len(pending)<state['total']:
|
||||
service.Request('cube',npc,len(pending),receive);return
|
||||
_recipes[:]=pending;_dates[:]=[_Tuple(row) for row in pending]
|
||||
if callback:callback(list(_recipes),None)
|
||||
return service.Request('cube',npc,0,receive)
|
||||
|
||||
def CheckBatch(index,attempts,callback=None):
|
||||
global _last_error,_last_preflight,_check_serial
|
||||
_last_preflight=None;_last_error=None;_check_serial+=1;serial=_check_serial
|
||||
if not isinstance(index,int) or not isinstance(attempts,int) or not 0<=index<len(_recipes) or not 1<=attempts<=100:
|
||||
_last_error='invalid'
|
||||
if callback:callback(None,'invalid')
|
||||
return 0
|
||||
service=mt_feature_service.g_service
|
||||
if not service:
|
||||
_last_error='offline'
|
||||
if callback:callback(None,'offline')
|
||||
return 0
|
||||
epoch=_epoch;recipe=_recipes[index]
|
||||
def receive(result,error):
|
||||
global _last_error,_last_preflight
|
||||
if epoch!=_epoch or serial!=_check_serial:return
|
||||
_last_error=error
|
||||
if error:pass
|
||||
else:
|
||||
values=dict(result['rows']);version='%08x%08x'%(values['revision_hi'],values['revision_lo'])
|
||||
if version!=recipe['revision']:_last_error='stale_recipe'
|
||||
elif values['gold_required']!=recipe['gold']*attempts or values['reward_maximum']!=recipe['count']*attempts or bool(values['copy_required'])!=recipe['copy']:_last_error='bad_preflight'
|
||||
else:
|
||||
for i,(v,n) in enumerate(recipe['materials'],1):
|
||||
if values.get('material%d'%i)!=v or values.get('needed%d'%i)!=n*attempts or values.get('available%d'%i,-1)<0:
|
||||
_last_error='bad_preflight';break
|
||||
keys=set(('revision_hi','revision_lo','attempts','gold_required','gold_available','materials_ok','gold_ok','mutation_enabled','reward_maximum','capacity_reserved','copy_required'))
|
||||
for i in range(1,len(recipe['materials'])+1):keys.update(('material%d'%i,'needed%d'%i,'available%d'%i))
|
||||
material_ok=all(values.get('available%d'%i,-1)>=n*attempts for i,(v,n) in enumerate(recipe['materials'],1))
|
||||
if set(values)!=keys or values['gold_available']>2000000000000000 or bool(values['gold_ok'])!=(values['gold_available']>=values['gold_required']) or bool(values['materials_ok'])!=material_ok:_last_error='bad_preflight'
|
||||
if not _last_error:_last_preflight=values
|
||||
if callback:callback(_last_preflight,_last_error)
|
||||
return service.Request('cubecheck',recipe['id'],attempts,receive)
|
||||
|
||||
def CubeRenewalMakeItem(index_craft,count_item,index_improve=0):
|
||||
# Original UI name; only our labeled preview can use it, for a read-only check.
|
||||
if not _readonly:raise RuntimeError('Cube Renewal requires an implemented durable server crafting contract')
|
||||
if index_improve not in (0,-1):
|
||||
chat.AppendChat(chat.CHAT_TYPE_INFO,L('预检暂不支持成功率道具;未扣除材料。'));return 0
|
||||
def checked(result,error):
|
||||
if error:chat.AppendChat(chat.CHAT_TYPE_INFO,L('配方预检失败,未扣料、未制作:')+str(error));return
|
||||
chat.AppendChat(chat.CHAT_TYPE_INFO,L('只读预检:尝试 %d 次,需金币 %d;材料%s,金币%s。未预留背包、未扣料、未制作。')%
|
||||
(result['attempts'],result['gold_required'],L('充足' if result['materials_ok'] else '不足'),L('充足' if result['gold_ok'] else '不足')))
|
||||
return CheckBatch(index_craft,count_item,checked)
|
||||
|
||||
def OpenPreview(npc):
|
||||
def loaded(rows,error):
|
||||
global _window,_readonly,_last_error
|
||||
if error:
|
||||
if error!='unsupported':chat.AppendChat(chat.CHAT_TYPE_INFO,L('制作配方预览不可用:')+str(error))
|
||||
return
|
||||
try:
|
||||
if _window is None:
|
||||
import uiCubeRenewal
|
||||
_window=uiCubeRenewal.CubeRenewalWindows()
|
||||
SetCubeRenewalHandler(_window)
|
||||
_window.BINARY_CUBE_RENEWAL_LOADING()
|
||||
_window.button_ok.SetText(L('批量预检'))
|
||||
_window.slot_improve.Hide();_window.imporve_slot.Hide()
|
||||
_window.SetCenterPosition();_window.Show();_readonly=True
|
||||
except Exception:
|
||||
_readonly=False;_last_error='cube_ui_unavailable';SetCubeRenewalHandler(None)
|
||||
if _window:_window.Hide()
|
||||
_window=None
|
||||
chat.AppendChat(chat.CHAT_TYPE_INFO,L('现代制作界面资源不可用,保留原制作窗口;未扣料、未制作。'))
|
||||
return
|
||||
chat.AppendChat(chat.CHAT_TYPE_INFO,L('现代制作只读预览:当前不扣料、不发奖;原制作窗口保持不变。'))
|
||||
return LoadCatalogue(npc,loaded)
|
||||
|
||||
_open=game.GameWindow.BINARY_Cube_Open
|
||||
_close=game.GameWindow.BINARY_Cube_Close
|
||||
_game_close=game.GameWindow.Close
|
||||
def Open(self,npc):
|
||||
_open(self,npc);OpenPreview(npc)
|
||||
def Close(self):
|
||||
CubeRenewalClose();return _close(self)
|
||||
def GameClose(self):
|
||||
CubeRenewalClose();return _game_close(self)
|
||||
game.GameWindow.BINARY_Cube_Open=Open
|
||||
game.GameWindow.BINARY_Cube_Close=Close
|
||||
game.GameWindow.Close=GameClose
|
||||
)PY";
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "UserInterface/PythonMessenger.h"
|
||||
#include "UserInterface/PythonSafeBox.h"
|
||||
#include "UserInterface/PythonSash.h"
|
||||
#include "UserInterface/PythonCubeRenewal.h"
|
||||
#include "UserInterface/PythonSwitchbot.h"
|
||||
#include "UserInterface/PythonGuild.h"
|
||||
#include "UserInterface/MarkManager.h"
|
||||
@@ -160,6 +161,7 @@ struct GameSingletons
|
||||
CPythonMessenger pyManager;
|
||||
CPythonSafeBox pySafeBox;
|
||||
CPythonSash pySash; // PORT: AVA2 sash
|
||||
CPythonCubeRenewal pyCubeRenewal; // PORT: AVA2 cuberenewal
|
||||
CPythonSwitchbot pySwitchbot; // PORT: AVA2 switchbot
|
||||
#ifdef ENABLE_SHOP_SEARCH_SYSTEM
|
||||
CPythonPrivateShopSearch pyPrivateShopSearch; // PORT: AVA2 shop search
|
||||
@@ -948,6 +950,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
|
||||
initMessenger();
|
||||
initsafebox();
|
||||
initSash();
|
||||
initCubeRenewal();
|
||||
initSwitchbot();
|
||||
initguild();
|
||||
initServerStateChecker();
|
||||
@@ -1046,7 +1049,6 @@ namespace PythonBoot
|
||||
#include "WikiEntryScript.inc"
|
||||
#include "TargetElementScript.inc"
|
||||
#include "MinimapButtonsScript.inc"
|
||||
#include "CubeRenewalScript.inc"
|
||||
#include "RankScript.inc"
|
||||
#include "WonScript.inc"
|
||||
#include "Ava2UICompatScript.inc"
|
||||
@@ -1172,7 +1174,6 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
|
||||
install_script_module("mt_wiki_entries", c_szWikiEntryScript);
|
||||
install_script_module("mt_target_element", c_szTargetElementScript);
|
||||
install_script_module("mt_minimap_buttons", c_szMinimapButtonsScript);
|
||||
install_script_module("cube_renewal", c_szCubeRenewalScript);
|
||||
install_script_module("mt_rank", c_szRankScript);
|
||||
install_script_module("mt_won", c_szWonScript);
|
||||
install_script_module("mt_switchbot", c_szSwitchbotScript);
|
||||
|
||||
@@ -165,6 +165,7 @@ enum
|
||||
HEADER_CG_DRAGON_SOUL_REFINE = 205,
|
||||
HEADER_CG_STATE_CHECKER = 206,
|
||||
HEADER_CG_SASH = 211, // PORT: AVA2 sash (metin2-server FEATURE-AVA2-UNLOCK P4)
|
||||
HEADER_CG_CUBE_RENEWAL = 216, // PORT: AVA2 cuberenewal (ENABLE_CUBE_RENEWAL_WORLDARD)
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
HEADER_CG_67_ATTR = 208,
|
||||
HEADER_CG_CLOSE_67_ATTR = 209,
|
||||
@@ -388,6 +389,7 @@ enum
|
||||
HEADER_GC_CHESTDROP = 66, // PORT: AVA2, DWORD dynamic length
|
||||
HEADER_GC_AVA2_EVENTS = 214,
|
||||
HEADER_GC_AVA2_DROP = 220,
|
||||
HEADER_GC_CUBE_RENEWAL = 221, // PORT: AVA2 cuberenewal (ENABLE_CUBE_RENEWAL_WORLDARD)
|
||||
HEADER_GC_SWITCHBOT = 171, // PORT: AVA2 switchbot, DYNAMIC_SIZE_PACKET
|
||||
HEADER_GC_EXTENDED_POINTS = 218, // PORT: AVA2 64-bit gold and extended points
|
||||
HEADER_GC_PORT_QUIVER = 219, // PORT: sent only after quiver capability subscription.
|
||||
@@ -3176,4 +3178,45 @@ struct TPacketGCExtendedPointGold
|
||||
int64_t gold;
|
||||
};
|
||||
static_assert(sizeof(TPacketGCExtendedPointGold) == 10, "TPacketGCExtendedPointGold size mismatch");
|
||||
// PORT: AVA2 cuberenewal (ENABLE_CUBE_RENEWAL_WORLDARD), byte-identical to the AVA2 packets.
|
||||
enum ECubeRenewalSubHeader
|
||||
{
|
||||
CUBE_RENEWAL_SUB_HEADER_OPEN_RECEIVE,
|
||||
CUBE_RENEWAL_SUB_HEADER_CLEAR_DATES_RECEIVE,
|
||||
CUBE_RENEWAL_SUB_HEADER_DATES_RECEIVE,
|
||||
CUBE_RENEWAL_SUB_HEADER_DATES_LOADING,
|
||||
CUBE_RENEWAL_SUB_HEADER_MAKE_ITEM,
|
||||
CUBE_RENEWAL_SUB_HEADER_CLOSE,
|
||||
};
|
||||
struct TPacketCGCubeRenewalSend
|
||||
{
|
||||
uint8_t header;
|
||||
uint8_t subheader;
|
||||
uint32_t index_item;
|
||||
uint32_t count_item;
|
||||
};
|
||||
struct TInfoDateCubeRenewal
|
||||
{
|
||||
uint32_t npc_vnum;
|
||||
uint32_t index;
|
||||
uint32_t vnum_reward;
|
||||
int32_t count_reward;
|
||||
bool item_reward_stackable;
|
||||
uint32_t vnum_material_1; int32_t count_material_1;
|
||||
uint32_t vnum_material_2; int32_t count_material_2;
|
||||
uint32_t vnum_material_3; int32_t count_material_3;
|
||||
uint32_t vnum_material_4; int32_t count_material_4;
|
||||
uint32_t vnum_material_5; int32_t count_material_5;
|
||||
int32_t gold;
|
||||
int32_t percent;
|
||||
char category[100];
|
||||
};
|
||||
struct TPacketGCCubeRenewalReceive
|
||||
{
|
||||
uint8_t header;
|
||||
uint8_t subheader;
|
||||
TInfoDateCubeRenewal date_cube_renewal;
|
||||
};
|
||||
static_assert(sizeof(TPacketCGCubeRenewalSend)==10,"AVA2 CG216 size");
|
||||
static_assert(sizeof(TPacketGCCubeRenewalReceive)==167,"AVA2 GC221 size");
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -1677,7 +1677,7 @@ void initapp()
|
||||
// Archived AVA2 formula exists, but its source switch was disabled.
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_MAGIC_REDUCTION_SYSTEM", 0);
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_DS_CHANGE_ATTR", 0);
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_CUBE_RENEWAL_WORLDARD", 0);
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_CUBE_RENEWAL_WORLDARD", 1);
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_CHEQUE_SYSTEM", 0);
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_RANKING_SYSTEM", 1);
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_PLAYER_PER_ACCOUNT5", 0);
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
// PORT: AVA2 PythonCubeRenewal.cpp (ENABLE_CUBE_RENEWAL_WORLDARD) verbatim; xxf uicuberenewal.py drives it.
|
||||
|
||||
#include "PythonCubeRenewal.h"
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "Packet.h"
|
||||
|
||||
CPythonCubeRenewal::CPythonCubeRenewal()
|
||||
: m_CubeRenewalHandler(NULL)
|
||||
{
|
||||
ClearList();
|
||||
}
|
||||
|
||||
CPythonCubeRenewal::~CPythonCubeRenewal()
|
||||
{
|
||||
ClearList();
|
||||
}
|
||||
|
||||
void CPythonCubeRenewal::LoadingList()
|
||||
{
|
||||
if (m_CubeRenewalHandler)
|
||||
PyCallClassMemberFunc(m_CubeRenewalHandler, "BINARY_CUBE_RENEWAL_LOADING", Py_BuildValue("()"));
|
||||
}
|
||||
|
||||
void CPythonCubeRenewal::ClearList()
|
||||
{
|
||||
cube_renewal_list.clear();
|
||||
}
|
||||
|
||||
void CPythonCubeRenewal::ReceiveList(const TInfoDateCubeRenewal & TInfoCR)
|
||||
{
|
||||
cube_renewal_list.push_back(TInfoCR);
|
||||
}
|
||||
|
||||
int CPythonCubeRenewal::GetCountList()
|
||||
{
|
||||
return cube_renewal_list.size();
|
||||
}
|
||||
|
||||
const CPythonCubeRenewal::TInfoStrucCubeRenewal & CPythonCubeRenewal::GetList()
|
||||
{
|
||||
return cube_renewal_list;
|
||||
}
|
||||
|
||||
PyObject * GetCountCubeRenewalList(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
return Py_BuildValue("i", CPythonCubeRenewal::Instance().GetCountList());
|
||||
}
|
||||
|
||||
PyObject * GetCubeRenewalDates(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int index;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &index))
|
||||
return Py_BuildException();
|
||||
|
||||
const CPythonCubeRenewal::TInfoStrucCubeRenewal & CRItemVector = CPythonCubeRenewal::Instance().GetList();
|
||||
if (DWORD(index) >= CRItemVector.size())
|
||||
return Py_BuildValue("iibiiiiiiiiiiiis",0,0,false,0,0,0,0,0,0,0,0,0,0,0,0,"None");
|
||||
|
||||
const TInfoDateCubeRenewal & CRenewalItemVector = CRItemVector[index];
|
||||
char category[sizeof(CRenewalItemVector.category) + 1] = {};
|
||||
memcpy(category, CRenewalItemVector.category, sizeof(CRenewalItemVector.category)); // PORT: never trust the wire NUL
|
||||
return Py_BuildValue("iibiiiiiiiiiiiis",
|
||||
CRenewalItemVector.vnum_reward,
|
||||
CRenewalItemVector.count_reward,
|
||||
CRenewalItemVector.item_reward_stackable,
|
||||
CRenewalItemVector.vnum_material_1,
|
||||
CRenewalItemVector.count_material_1,
|
||||
CRenewalItemVector.vnum_material_2,
|
||||
CRenewalItemVector.count_material_2,
|
||||
CRenewalItemVector.vnum_material_3,
|
||||
CRenewalItemVector.count_material_3,
|
||||
CRenewalItemVector.vnum_material_4,
|
||||
CRenewalItemVector.count_material_4,
|
||||
CRenewalItemVector.vnum_material_5,
|
||||
CRenewalItemVector.count_material_5,
|
||||
CRenewalItemVector.gold,
|
||||
CRenewalItemVector.percent,
|
||||
category
|
||||
);
|
||||
}
|
||||
|
||||
PyObject * SetCubeRenewalHandler(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
PyObject * poEventHandler;
|
||||
if (!PyTuple_GetObject(poArgs, 0, &poEventHandler))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonCubeRenewal::Instance().SetCubeRenewalHandler(poEventHandler);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * CubeRenewalMakeItem(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int index_craft;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &index_craft))
|
||||
return Py_BuildException();
|
||||
|
||||
int count_item;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &count_item))
|
||||
return Py_BuildException();
|
||||
|
||||
// PORT: xxf uicuberenewal.py passes a third "improve" slot (79605); the AVA2 packet has no
|
||||
// field for it and the window clears it for 100% recipes, so it is accepted and not sent.
|
||||
|
||||
CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
|
||||
rkNetStream.CubeRenewalMakeItem(index_craft,count_item);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * CubeRenewalClose(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
|
||||
rkNetStream.CubeRenewalClose();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
void initCubeRenewal()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
{
|
||||
{ "CountDates", GetCountCubeRenewalList, METH_VARARGS },
|
||||
{ "GetDates", GetCubeRenewalDates, METH_VARARGS },
|
||||
{ "SetCubeRenewalHandler", SetCubeRenewalHandler, METH_VARARGS },
|
||||
{ "CubeRenewalMakeItem", CubeRenewalMakeItem, METH_VARARGS },
|
||||
{ "CubeRenewalClose", CubeRenewalClose, METH_VARARGS },
|
||||
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
Py_InitModule("cube_renewal", s_methods);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "Packet.h"
|
||||
|
||||
// PORT: AVA2 PythonCubeRenewal.h (ENABLE_CUBE_RENEWAL_WORLDARD), fed by HEADER_GC_CUBE_RENEWAL.
|
||||
class CPythonCubeRenewal : public CSingleton<CPythonCubeRenewal>
|
||||
{
|
||||
public:
|
||||
typedef std::vector<TInfoDateCubeRenewal> TInfoStrucCubeRenewal;
|
||||
|
||||
public:
|
||||
CPythonCubeRenewal();
|
||||
virtual ~CPythonCubeRenewal();
|
||||
|
||||
void LoadingList();
|
||||
void ClearList();
|
||||
|
||||
void ReceiveList(const TInfoDateCubeRenewal & TInfoCR);
|
||||
int GetCountList();
|
||||
|
||||
const TInfoStrucCubeRenewal & GetList();
|
||||
|
||||
void SetCubeRenewalHandler(PyObject* _CubeRenewalHandler){m_CubeRenewalHandler = _CubeRenewalHandler == Py_None ? NULL : _CubeRenewalHandler;}
|
||||
|
||||
private:
|
||||
TInfoStrucCubeRenewal cube_renewal_list;
|
||||
PyObject* m_CubeRenewalHandler;
|
||||
};
|
||||
@@ -190,6 +190,7 @@ class CMainPacketHeaderMap : public CNetworkPacketHeaderMap
|
||||
Set(HEADER_GC_PORT_QUIVER, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCQuiverState), STATIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_CHESTDROP, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCChestDrop), DYNAMIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_AVA2_DROP,CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCAva2Drop),STATIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_CUBE_RENEWAL, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCCubeRenewalReceive), STATIC_SIZE_PACKET)); // PORT: AVA2 cuberenewal
|
||||
Set(93,CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCAva2Events),DYNAMIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_AVA2_EVENTS,CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCAva2Events),DYNAMIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_SWITCHBOT, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCSwitchbot), DYNAMIC_SIZE_PACKET)); // PORT: AVA2 switchbot
|
||||
|
||||
@@ -301,6 +301,8 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
|
||||
bool SendSashAddPacket(TItemPos tPos, BYTE bPos);
|
||||
bool SendSashRemovePacket(BYTE bPos);
|
||||
bool SendSashRefinePacket();
|
||||
bool CubeRenewalMakeItem(int index_item, int count_item); // PORT: AVA2 cuberenewal
|
||||
bool CubeRenewalClose();
|
||||
|
||||
// PORT: AVA2 switchbot
|
||||
bool SendSwitchbotStartPacket(BYTE slot, std::vector<CPythonSwitchbot::TSwitchbotAttributeAlternativeTable> alternatives);
|
||||
@@ -598,6 +600,7 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
|
||||
// 용혼석 관련
|
||||
bool RecvDragonSoulRefine();
|
||||
bool RecvSashPacket(bool bReturn = false); // PORT: AVA2 sash
|
||||
bool RecvCubeRenewalPacket(); // PORT: AVA2 cuberenewal
|
||||
bool RecvQuiverState();
|
||||
bool RecvAva2DropQuery();
|
||||
bool RecvAva2Events();
|
||||
|
||||
@@ -638,6 +638,9 @@ void CPythonNetworkStream::GamePhase()
|
||||
case HEADER_GC_SASH: // PORT: AVA2 sash
|
||||
ret = RecvSashPacket();
|
||||
break;
|
||||
case HEADER_GC_CUBE_RENEWAL: // PORT: AVA2 cuberenewal
|
||||
ret = RecvCubeRenewalPacket();
|
||||
break;
|
||||
case HEADER_GC_PORT_QUIVER:
|
||||
ret = RecvQuiverState();
|
||||
break;
|
||||
@@ -4530,7 +4533,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 mt20261025", sizeof(kVersionPacket.timestamp)-1); // PORT: revision25 adds full-count and Cube presentation companions.
|
||||
strncpy(kVersionPacket.timestamp, "1215955205 mt20261026", sizeof(kVersionPacket.timestamp)-1); // PORT: revision26 adds the AVA2 Cube Renewal packets (CG216/GC221).
|
||||
//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
|
||||
@@ -4544,7 +4547,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, "mt20261025", sizeof(kVersionPacket.timestamp)-1); // PORT: revision25 is backward-compatible with revision24 money.
|
||||
strncpy(kVersionPacket.timestamp, "mt20261026", sizeof(kVersionPacket.timestamp)-1); // PORT: revision26 is backward-compatible with revision24 money.
|
||||
|
||||
if (!Send(sizeof(kVersionPacket), &kVersionPacket))
|
||||
Tracef("SendClientReportPacket Error");
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "PythonCubeRenewal.h"
|
||||
#include "Packet.h"
|
||||
|
||||
// PORT: AVA2 PythonNetworkStreamPhaseGame.cpp cuberenewal packets (ENABLE_CUBE_RENEWAL_WORLDARD) verbatim.
|
||||
bool CPythonNetworkStream::CubeRenewalMakeItem(int index_item, int count_item)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGCubeRenewalSend packet;
|
||||
|
||||
packet.header = HEADER_CG_CUBE_RENEWAL;
|
||||
packet.subheader = CUBE_RENEWAL_SUB_HEADER_MAKE_ITEM;
|
||||
packet.index_item = index_item;
|
||||
packet.count_item = count_item;
|
||||
|
||||
if (!Send(sizeof(TPacketCGCubeRenewalSend), &packet))
|
||||
{
|
||||
Tracef("CPythonNetworkStream::CubeRenewalMakeItem Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::CubeRenewalClose()
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGCubeRenewalSend packet;
|
||||
|
||||
packet.header = HEADER_CG_CUBE_RENEWAL;
|
||||
packet.subheader = CUBE_RENEWAL_SUB_HEADER_CLOSE;
|
||||
packet.index_item = 0;
|
||||
packet.count_item = 0;
|
||||
|
||||
if (!Send(sizeof(TPacketCGCubeRenewalSend), &packet))
|
||||
{
|
||||
Tracef("CPythonNetworkStream::CubeRenewalClose Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvCubeRenewalPacket()
|
||||
{
|
||||
TPacketGCCubeRenewalReceive CubeRenewalPacket;
|
||||
|
||||
if (!Recv(sizeof(CubeRenewalPacket), &CubeRenewalPacket))
|
||||
return false;
|
||||
|
||||
switch (CubeRenewalPacket.subheader)
|
||||
{
|
||||
case CUBE_RENEWAL_SUB_HEADER_OPEN_RECEIVE:
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_CUBE_RENEWAL_OPEN", Py_BuildValue("()"));
|
||||
}
|
||||
break;
|
||||
|
||||
case CUBE_RENEWAL_SUB_HEADER_DATES_RECEIVE:
|
||||
{
|
||||
CPythonCubeRenewal::Instance().ReceiveList(CubeRenewalPacket.date_cube_renewal);
|
||||
}
|
||||
break;
|
||||
|
||||
case CUBE_RENEWAL_SUB_HEADER_DATES_LOADING:
|
||||
{
|
||||
CPythonCubeRenewal::Instance().LoadingList();
|
||||
}
|
||||
break;
|
||||
|
||||
case CUBE_RENEWAL_SUB_HEADER_CLEAR_DATES_RECEIVE:
|
||||
{
|
||||
CPythonCubeRenewal::Instance().ClearList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -69,6 +69,7 @@ void initBackground();
|
||||
void initMessenger();
|
||||
void initsafebox();
|
||||
void initSash(); // PORT: AVA2 sash
|
||||
void initCubeRenewal(); // PORT: AVA2 cuberenewal
|
||||
void initSwitchbot(); // PORT: AVA2 switchbot
|
||||
void initguild();
|
||||
void initServerStateChecker();
|
||||
|
||||
Reference in New Issue
Block a user