feat: add 6th and 7th rare attribute client networking, constants, and locale
This commit is contained in:
@@ -169,4 +169,14 @@ nonplayer.GetMonsterRaceFlag=lambda v:(nonplayer.GetWikiInfo(v) or (0,)*9)[7]
|
||||
nonplayer.GetMonsterResist=lambda v,i:(nonplayer.GetWikiInfo(v)[8][i] if nonplayer.GetWikiInfo(v) and 0<=i<11 else 0)
|
||||
for i,name in enumerate('SWORD TWOHAND DAGGER BELL FAN BOW FIRE ELECT MAGIC WIND POISON'.split()):setattr(nonplayer,'MOB_RESIST_'+name,i)
|
||||
|
||||
app.BL_67_ATTR = 1
|
||||
app.ENABLE_ATTR_6TH_7TH = 1
|
||||
import sys
|
||||
if 'localeInfo' in sys.modules:
|
||||
li = sys.modules['localeInfo']
|
||||
li.ATTR_6TH_7TH_DESC1 = "a. 您需要添加正确的材料来为装备赋予第 6/7 条属性。"
|
||||
li.ATTR_6TH_7TH_DESC2 = "b. 每个主材料可提升 2% 的成功率。"
|
||||
li.ATTR_6TH_7TH_DESC3 = "c. 使用辅助增率道具可进一步提高成功概率。"
|
||||
li.ATTR_6TH_7TH_DESC4 = "d. 属性赋予立即生效。若添加失败,您可以再次尝试。"
|
||||
|
||||
)PY";
|
||||
|
||||
@@ -4,4 +4,6 @@
|
||||
#define ENABLE_DRAGON_SOUL_SYSTEM
|
||||
#define ENABLE_NEW_EQUIPMENT_SYSTEM
|
||||
#define ENABLE_NEW_PET_SYSTEM
|
||||
#define ENABLE_ATTR_6TH_7TH
|
||||
#define __BL_67_ATTR__
|
||||
//#define ENABLE_DISCORD_RPC
|
||||
|
||||
@@ -155,6 +155,10 @@ 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)
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
HEADER_CG_67_ATTR = 208,
|
||||
HEADER_CG_CLOSE_67_ATTR = 209,
|
||||
#endif
|
||||
HEADER_CG_ITEMS_PICKUP = 235, // PORT: AVA2
|
||||
HEADER_CG_SWITCHBOT = 171, // PORT: AVA2 switchbot (metin2-server FEATURE-SWITCHBOT)
|
||||
|
||||
@@ -367,6 +371,9 @@ enum
|
||||
HEADER_GC_AVA2_DROP = 220,
|
||||
HEADER_GC_SWITCHBOT = 171, // PORT: AVA2 switchbot, DYNAMIC_SIZE_PACKET
|
||||
HEADER_GC_EXTENDED_POINTS = 218, // PORT: AVA2 64-bit gold and extended points
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
HEADER_GC_OPEN_67_ATTR = 242,
|
||||
#endif
|
||||
|
||||
HEADER_GC_KEY_AGREEMENT_COMPLETED = 0xfa, // _IMPROVED_PACKET_ENCRYPTION_
|
||||
HEADER_GC_KEY_AGREEMENT = 0xfb, // _IMPROVED_PACKET_ENCRYPTION_
|
||||
@@ -2811,6 +2818,24 @@ typedef struct SPacketCGDragonSoulRefine
|
||||
TItemPos ItemGrid[DS_REFINE_WINDOW_MAX_NUM];
|
||||
} TPacketCGDragonSoulRefine;
|
||||
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
#pragma pack(push, 1)
|
||||
typedef struct command_67_attr
|
||||
{
|
||||
BYTE bHeader;
|
||||
BYTE bMaterialCount;
|
||||
BYTE bSupportCount;
|
||||
short sSupportPos;
|
||||
short sItemPos;
|
||||
} TPacketCG67Attr;
|
||||
|
||||
typedef struct command_67_attr_open_close
|
||||
{
|
||||
BYTE bHeader;
|
||||
} TPacket67AttrOpenClose;
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
typedef struct SPacketGCDragonSoulRefine
|
||||
{
|
||||
SPacketGCDragonSoulRefine() : header(HEADER_GC_DRAGON_SOUL_REFINE)
|
||||
|
||||
@@ -1565,6 +1565,18 @@ void initapp()
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_NEW_PET_SYSTEM", 0);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_ATTR_6TH_7TH
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_ATTR_6TH_7TH", 1);
|
||||
#else
|
||||
PyModule_AddIntConstant(poModule, "ENABLE_ATTR_6TH_7TH", 0);
|
||||
#endif
|
||||
|
||||
#ifdef __BL_67_ATTR__
|
||||
PyModule_AddIntConstant(poModule, "BL_67_ATTR", 1);
|
||||
#else
|
||||
PyModule_AddIntConstant(poModule, "BL_67_ATTR", 0);
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENID
|
||||
PyModule_AddIntConstant(poModule, "USE_OPENID", 1);
|
||||
if (openid_test)
|
||||
|
||||
@@ -280,6 +280,10 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
|
||||
// PORT: AVA2 switchbot
|
||||
bool SendSwitchbotStartPacket(BYTE slot, std::vector<CPythonSwitchbot::TSwitchbotAttributeAlternativeTable> alternatives);
|
||||
bool SendSwitchbotStopPacket(BYTE slot);
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
bool Send67AttrPacket(int iMaterialCount, int iSupportCount, int iSupportPos, int iItemPos);
|
||||
bool Send67AttrClosePacket();
|
||||
#endif
|
||||
|
||||
// Handshake
|
||||
bool RecvHandshakePacket();
|
||||
@@ -565,6 +569,9 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
|
||||
bool RecvAva2ItemShop();
|
||||
bool RecvSwitchbotPacket(); // PORT: AVA2 switchbot
|
||||
bool RecvExtendedPointGoldPacket(); // PORT: AVA2 64-bit gold
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
bool Recv67AttrOpenPacket();
|
||||
#endif
|
||||
|
||||
// MiniMap Info
|
||||
bool RecvNPCList();
|
||||
|
||||
@@ -1738,12 +1738,46 @@ static PyObject* netSendAva2DropQuery(PyObject*,PyObject* args) {
|
||||
return PyInt_FromLong(CPythonNetworkStream::Instance().SendAva2DropQuery(BYTE(sub),vnum));
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
PyObject* netSend67AttrPacket(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iMaterialCount;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iMaterialCount))
|
||||
return Py_BuildException();
|
||||
|
||||
int iSupportCount;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iSupportCount))
|
||||
return Py_BuildException();
|
||||
|
||||
int iSupportPos;
|
||||
if (!PyTuple_GetInteger(poArgs, 2, &iSupportPos))
|
||||
return Py_BuildException();
|
||||
|
||||
int iItemPos;
|
||||
if (!PyTuple_GetInteger(poArgs, 3, &iItemPos))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonNetworkStream::Instance().Send67AttrPacket(iMaterialCount, iSupportCount, iSupportPos, iItemPos);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject* netSend67AttrClosePacket(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CPythonNetworkStream::Instance().Send67AttrClosePacket();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
#endif
|
||||
|
||||
void initnet()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
{
|
||||
{"SendAva2DropQuery",netSendAva2DropQuery,METH_VARARGS},
|
||||
{ "GetBettingGuildWarValue", netGetBettingGuildWarValue, METH_VARARGS },
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
{ "Send67AttrPacket", netSend67AttrPacket, METH_VARARGS },
|
||||
{ "Send67AttrClosePacket", netSend67AttrClosePacket, METH_VARARGS },
|
||||
#endif
|
||||
{ "EnableChatInsultFilter", netEnableChatInsultFilter, METH_VARARGS },
|
||||
{ "SetServerInfo", netSetServerInfo, METH_VARARGS },
|
||||
{ "GetServerInfo", netGetServerInfo, METH_VARARGS },
|
||||
|
||||
@@ -634,6 +634,11 @@ void CPythonNetworkStream::GamePhase()
|
||||
case HEADER_GC_SASH: // PORT: AVA2 sash
|
||||
ret = RecvSashPacket();
|
||||
break;
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
case HEADER_GC_OPEN_67_ATTR:
|
||||
ret = Recv67AttrOpenPacket();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case HEADER_GC_CHESTDROP:
|
||||
ret=RecvChestDrop(); break;
|
||||
@@ -4590,3 +4595,51 @@ void CPythonNetworkStream::Discord_Close()
|
||||
Discord_Shutdown();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ATTR_6TH_7TH)
|
||||
bool CPythonNetworkStream::Send67AttrPacket(int iMaterialCount, int iSupportCount, int iSupportPos, int iItemPos)
|
||||
{
|
||||
TPacketCG67Attr p =
|
||||
{
|
||||
static_cast<BYTE>(HEADER_CG_67_ATTR),
|
||||
static_cast<BYTE>(iMaterialCount),
|
||||
static_cast<BYTE>(iSupportCount),
|
||||
static_cast<short>(iSupportPos),
|
||||
static_cast<short>(iItemPos),
|
||||
};
|
||||
|
||||
if (!Send(sizeof(p), &p))
|
||||
{
|
||||
Tracef("Send67AttrPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::Send67AttrClosePacket()
|
||||
{
|
||||
TPacket67AttrOpenClose p;
|
||||
p.bHeader = HEADER_CG_CLOSE_67_ATTR;
|
||||
|
||||
if (!Send(sizeof(p), &p))
|
||||
{
|
||||
Tracef("Send67AttrClosePacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::Recv67AttrOpenPacket()
|
||||
{
|
||||
TPacket67AttrOpenClose p;
|
||||
|
||||
if (!Recv(sizeof(p), &p))
|
||||
return false;
|
||||
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OpenAttr67AddDlg", Py_BuildValue("()"));
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2629,6 +2629,15 @@ void initPlayer()
|
||||
PyModule_AddIntConstant(poModule, "SLOT_TYPE_DRAGON_SOUL_INVENTORY", SLOT_TYPE_DRAGON_SOUL_INVENTORY);
|
||||
PyModule_AddIntConstant(poModule, "SLOT_TYPE_SWITCHBOT", SLOT_TYPE_SWITCHBOT); // PORT: AVA2 switchbot
|
||||
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_NONE", 0);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_SHOP", 1);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_EXCHANGE", 2);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_SAFEBOX", 3);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_PRIVATE_SHOP", 4);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_ITEM_COMB", 5);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_PET_FEED", 6);
|
||||
PyModule_AddIntConstant(poModule, "ON_TOP_WND_ATTR_67", 7);
|
||||
|
||||
PyModule_AddIntConstant(poModule, "RESERVED_WINDOW", RESERVED_WINDOW);
|
||||
PyModule_AddIntConstant(poModule, "INVENTORY", INVENTORY);
|
||||
PyModule_AddIntConstant(poModule, "EQUIPMENT", EQUIPMENT);
|
||||
|
||||
@@ -6,6 +6,7 @@ extern void initapp();
|
||||
extern void initPlayer();
|
||||
extern void initItem();
|
||||
extern void initchrmgr();
|
||||
extern void initnet();
|
||||
#include "UserInterface/PythonPlayer.h"
|
||||
#include <cassert>
|
||||
#include "../../src/platform/ScriptLib/PythonHost.h"
|
||||
@@ -36,6 +37,7 @@ int main(int argc, char** argv)
|
||||
initapp();
|
||||
initItem();
|
||||
initchrmgr();
|
||||
initnet();
|
||||
CPythonPlayer player;
|
||||
initPlayer();
|
||||
CPythonPlayer::Instance().SetGold64(123456789012345LL);
|
||||
@@ -79,6 +81,13 @@ int main(int argc, char** argv)
|
||||
"assert item.PET_SKILL == 6\n"
|
||||
"assert item.PET_SKILL_DEL_BOOK == 11\n"
|
||||
"assert item.PET_SKILL_ALL_DEL_BOOK == 12\n"
|
||||
"assert app.ENABLE_ATTR_6TH_7TH == 1\n"
|
||||
"assert app.BL_67_ATTR == 1\n"
|
||||
"assert player.ON_TOP_WND_ATTR_67 == 7\n"
|
||||
"assert player.ON_TOP_WND_NONE == 0\n"
|
||||
"import net\n"
|
||||
"assert hasattr(net, 'Send67AttrPacket')\n"
|
||||
"assert hasattr(net, 'Send67AttrClosePacket')\n"
|
||||
))
|
||||
return 1;
|
||||
if (!launcher.RunLine("import wndMgr, grp, grpImage, grpText, grpThing, app"))
|
||||
|
||||
Reference in New Issue
Block a user