feat: add 6th and 7th rare attribute system, skills 176-182, and tests
This commit is contained in:
@@ -33,6 +33,21 @@ public:
|
||||
|
||||
/// 발렌타인 사랑의 팬던트
|
||||
static const bool IsLovePendant(DWORD vnum) { return 71145 == vnum; }
|
||||
|
||||
#if defined(ENABLE_ATTR_6TH_7TH) || defined(__BL_67_ATTR__)
|
||||
static DWORD Get67MaterialVnum(const int iLevelLimit)
|
||||
{
|
||||
if (iLevelLimit >= 0 && iLevelLimit <= 45)
|
||||
return 39070;
|
||||
if (iLevelLimit >= 46 && iLevelLimit <= 75)
|
||||
return 39071;
|
||||
if (iLevelLimit >= 76 && iLevelLimit <= 105)
|
||||
return 39072;
|
||||
if (iLevelLimit >= 106 && iLevelLimit <= 120)
|
||||
return 39073;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
class CMobVnumHelper
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
//#define __AUCTION__
|
||||
#define __PET_SYSTEM__
|
||||
#define ENABLE_NEW_PET_SYSTEM
|
||||
#define ENABLE_ATTR_6TH_7TH
|
||||
#define __BL_67_ATTR__
|
||||
#define __UDP_BLOCK__
|
||||
#endif
|
||||
|
||||
@@ -394,6 +394,9 @@ void CHARACTER::Initialize()
|
||||
|
||||
m_bSashCombination = false;
|
||||
m_bSashAbsorption = false;
|
||||
#if defined(__BL_67_ATTR__)
|
||||
m_b67Attr = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CHARACTER::Create(const char * c_pszName, DWORD vid, bool isPC)
|
||||
@@ -7436,3 +7439,27 @@ bool CHARACTER::PetBlockMap()
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__BL_67_ATTR__)
|
||||
void CHARACTER::Open67Attr()
|
||||
{
|
||||
LPDESC d = GetDesc();
|
||||
if (!d)
|
||||
return;
|
||||
|
||||
if (IsDead())
|
||||
return;
|
||||
|
||||
if (GetExchange() || IsOpenSafebox() || GetShop() || IsCubeOpen())
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, "You cannot open this while other trade windows are open.");
|
||||
return;
|
||||
}
|
||||
|
||||
Set67Attr(true);
|
||||
|
||||
TPacket67AttrOpenClose p;
|
||||
p.bHeader = HEADER_GC_OPEN_67_ATTR;
|
||||
d->Packet(&p, sizeof(p));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2168,6 +2168,14 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
||||
void MountCostumeOnLogin();
|
||||
bool CostumeEnchantUse(LPITEM item, LPITEM item2);
|
||||
bool PendantScrollUse(LPITEM item, LPITEM item2);
|
||||
#if defined(__BL_67_ATTR__)
|
||||
public:
|
||||
void Open67Attr();
|
||||
void Set67Attr(bool b) { m_b67Attr = b; }
|
||||
bool Is67AttrOpen() const { return m_b67Attr; }
|
||||
private:
|
||||
bool m_b67Attr;
|
||||
#endif
|
||||
};
|
||||
|
||||
ESex GET_SEX(LPCHARACTER ch);
|
||||
|
||||
@@ -2611,7 +2611,10 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
|
||||
if (true == LearnSkillByBook(dwVnum))
|
||||
{
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
if (item->GetCount() > 1)
|
||||
item->SetCount(item->GetCount() - 1);
|
||||
else
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
|
||||
@@ -4352,11 +4355,12 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
}
|
||||
break;
|
||||
|
||||
case 71052 : // 진재경
|
||||
case 71052 :
|
||||
case 72346 : // ORISON
|
||||
case 72351 : // SMALL_ORISON
|
||||
{
|
||||
// 유럽, 싱가폴, 베트남 진재가 사용금지
|
||||
// if (LC_IsEurope() || LC_IsSingapore() || LC_IsVietnam())
|
||||
// return false;
|
||||
if (item->GetVnum() == 72319 || item->GetVnum() == 72320)
|
||||
return false;
|
||||
|
||||
LPITEM item2;
|
||||
|
||||
@@ -4368,16 +4372,32 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
|
||||
if (item2->IsEquipped() == true) // Fix
|
||||
return false;
|
||||
|
||||
if (item2->GetType() == ITEM_COSTUME) // Fix
|
||||
return false;
|
||||
|
||||
if (item2->GetAttributeSetIndex() == -1)
|
||||
if (item2->GetType() == ITEM_ARMOR && item2->GetSubType() == ARMOR_PENDANT)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("속성을 변경할 수 없는 아이템입니다."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item2->GetType() == ITEM_COSTUME && (item2->GetSubType() == COSTUME_SASH || item2->GetSubType() == COSTUME_NEW_SASH))
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("속성을 변경할 수 없는 아이템입니다."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item2->GetAttributeSetIndex() == -1)
|
||||
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("속성을 변경할 수 없는 아이템입니다."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item2->GetRareAttrCount() == 0)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("변경 시킬 속성이 없습니다"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item2->ChangeRareAttribute() == true)
|
||||
{
|
||||
char buf[21];
|
||||
@@ -5091,12 +5111,36 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
|
||||
if (item->GetSubType() == USE_CHANGE_ATTRIBUTE2)
|
||||
{
|
||||
int aiChangeProb[ITEM_ATTRIBUTE_MAX_LEVEL] =
|
||||
{
|
||||
0, 0, 30, 40, 3
|
||||
};
|
||||
if (item->GetVnum() == 72319 || item->GetVnum() == 72320)
|
||||
return false;
|
||||
|
||||
item2->ChangeAttribute(aiChangeProb);
|
||||
if (item2->GetType() == ITEM_ARMOR && item2->GetSubType() == ARMOR_PENDANT)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("속성을 변경할 수 없는 아이템입니다."));
|
||||
return false;
|
||||
}
|
||||
if (item2->GetType() == ITEM_COSTUME && (item2->GetSubType() == COSTUME_SASH || item2->GetSubType() == COSTUME_NEW_SASH))
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("속성을 변경할 수 없는 아이템입니다."));
|
||||
return false;
|
||||
}
|
||||
if (item2->GetRareAttrCount() == 0)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("변경 시킬 속성이 없습니다"));
|
||||
return false;
|
||||
}
|
||||
if (item2->ChangeRareAttribute())
|
||||
{
|
||||
char buf[21];
|
||||
snprintf(buf, sizeof(buf), "%u", item2->GetID());
|
||||
LogManager::instance().ItemLog(this, item, "CHANGE_RARE_ATTR", buf);
|
||||
item->SetCount(item->GetCount() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("변경 시킬 속성이 없습니다"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (item->GetVnum() == 76014)
|
||||
{
|
||||
|
||||
@@ -442,12 +442,20 @@ bool CHARACTER::LearnSkillByBook(DWORD dwSkillVnum, BYTE bProb)
|
||||
// bType이 0이면 처음부터 책으로 수련 가능
|
||||
if (pkSk->dwType != 0)
|
||||
{
|
||||
if (GetSkillMasterType(dwSkillVnum) != SKILL_MASTER)
|
||||
if (GetSkillMasterType(dwSkillVnum) != SKILL_MASTER && (dwSkillVnum >= SKILL_FINISH && dwSkillVnum <= SKILL_CHEONUN))
|
||||
{
|
||||
if (GetSkillMasterType(dwSkillVnum) > SKILL_MASTER)
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 스킬은 책으로 더이상 수련할 수 없습니다."));
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 스킬은 책으로 더이상 수련할 수 없습니다.")));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (GetSkillMasterType(dwSkillVnum) != SKILL_MASTER)
|
||||
{
|
||||
if (GetSkillMasterType(dwSkillVnum) > SKILL_MASTER)
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 스킬은 책으로 더이상 수련할 수 없습니다.")));
|
||||
else
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 스킬은 아직 책으로 수련할 경지에 이르지 않았습니다."));
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 스킬은 아직 책으로 수련할 경지에 이르지 않았습니다.")));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -751,7 +759,7 @@ void CHARACTER::SkillLevelUp(DWORD dwVnum, BYTE bMethod)
|
||||
else if (bMethod == SKILL_UP_BY_BOOK)
|
||||
{
|
||||
if (pkSk->dwType != 0) // 직업에 속하지 않았거나 포인트로 올릴수 없는 스킬은 처음부터 책으로 배울 수 있다.
|
||||
if (GetSkillMasterType(pkSk->dwVnum) != SKILL_MASTER)
|
||||
if (GetSkillMasterType(pkSk->dwVnum) != SKILL_MASTER && (pkSk->dwVnum < SKILL_FINISH || pkSk->dwVnum > SKILL_CHEONUN))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,10 @@ class CInputMain : public CInputProcessor
|
||||
|
||||
void Refine(LPCHARACTER ch, const char* c_pData);
|
||||
void Sash(LPCHARACTER ch, const char* c_pData);
|
||||
#if defined(__BL_67_ATTR__)
|
||||
void Attr67(LPCHARACTER ch, const char * data);
|
||||
void Attr67Close(LPCHARACTER ch, const char * data);
|
||||
#endif
|
||||
int Switchbot(LPCHARACTER ch, const char* data, size_t uiBytes); // AVA2 switchbot (port_switchbot.cpp)
|
||||
|
||||
void Roulette(LPCHARACTER ch, const char* c_pData);
|
||||
|
||||
@@ -3094,6 +3094,148 @@ int CInputMain::Switchbot(LPCHARACTER ch, const char* data, size_t uiBytes)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__BL_67_ATTR__)
|
||||
#include "../../common/VnumHelper.h"
|
||||
|
||||
void CInputMain::Attr67(LPCHARACTER ch, const char* c_pData)
|
||||
{
|
||||
const TPacketCG67Attr* p = reinterpret_cast<const TPacketCG67Attr*>(c_pData);
|
||||
|
||||
if (ch->IsDead())
|
||||
return;
|
||||
|
||||
if (ch->GetExchange() || ch->IsOpenSafebox() || ch->GetShop() || ch->IsCubeOpen())
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "You cannot use this while other trade windows are open.");
|
||||
return;
|
||||
}
|
||||
|
||||
const LPITEM item = ch->GetInventoryItem(p->sItemPos);
|
||||
if (!item)
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "There is no target item.");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (item->GetType())
|
||||
{
|
||||
case ITEM_WEAPON:
|
||||
case ITEM_ARMOR:
|
||||
case ITEM_COSTUME:
|
||||
case ITEM_RING:
|
||||
case ITEM_NEW_RINGS:
|
||||
break;
|
||||
default:
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "The item type is not suitable for 6-7 attr.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetType() == ITEM_ARMOR && item->GetSubType() == ARMOR_PENDANT)
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "The item type is not suitable for 6-7 attr.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetType() == ITEM_COSTUME && (item->GetSubType() == COSTUME_SASH || item->GetSubType() == COSTUME_NEW_SASH))
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "The item type is not suitable for 6-7 attr.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsEquipped())
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "You cannot add a bonus to an equipped item.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsExchanging())
|
||||
return;
|
||||
|
||||
const int norm_attr_count = item->GetAttributeCount();
|
||||
const int rare_attr_count = item->GetRareAttrCount();
|
||||
const int attr_set_index = item->GetAttributeSetIndex();
|
||||
|
||||
if (attr_set_index == -1 || norm_attr_count < 5 || rare_attr_count >= 2)
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "This item is not suitable for 6-7 attr.");
|
||||
return;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
SUCCESS_PER_MATERIAL = 2,
|
||||
MATERIAL_MAX_COUNT = 10,
|
||||
SUPPORT_MAX_COUNT = 5,
|
||||
};
|
||||
|
||||
if (p->bMaterialCount < 1 || p->bMaterialCount > MATERIAL_MAX_COUNT || p->bSupportCount > SUPPORT_MAX_COUNT)
|
||||
return;
|
||||
|
||||
const DWORD dwMaterialVnum = CItemVnumHelper::Get67MaterialVnum(item->GetLevelLimit());
|
||||
if (dwMaterialVnum == 0 || ch->CountSpecifyItem(dwMaterialVnum) < p->bMaterialCount)
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "You don't have enough material items.");
|
||||
return;
|
||||
}
|
||||
|
||||
int success = SUCCESS_PER_MATERIAL * p->bMaterialCount;
|
||||
|
||||
LPITEM support_item = NULL;
|
||||
if (p->sSupportPos != -1 && p->bSupportCount > 0)
|
||||
{
|
||||
support_item = ch->GetInventoryItem(p->sSupportPos);
|
||||
if (!support_item || support_item->GetCount() < p->bSupportCount)
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "You don't have enough support items.");
|
||||
return;
|
||||
}
|
||||
|
||||
BYTE uSupportSuccess = 0;
|
||||
switch (support_item->GetVnum())
|
||||
{
|
||||
case 72064:
|
||||
uSupportSuccess = 1;
|
||||
break;
|
||||
case 72065:
|
||||
uSupportSuccess = 2;
|
||||
break;
|
||||
case 72066:
|
||||
uSupportSuccess = 4;
|
||||
break;
|
||||
case 72067:
|
||||
uSupportSuccess = 10;
|
||||
break;
|
||||
case 72068:
|
||||
uSupportSuccess = 100;
|
||||
break;
|
||||
default:
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "The support item is inappropriate.");
|
||||
return;
|
||||
}
|
||||
|
||||
success += uSupportSuccess * p->bSupportCount;
|
||||
}
|
||||
|
||||
ch->RemoveSpecifyItem(dwMaterialVnum, p->bMaterialCount);
|
||||
|
||||
if (support_item && p->bSupportCount > 0)
|
||||
{
|
||||
if (support_item->GetCount() <= p->bSupportCount)
|
||||
ITEM_MANAGER::instance().RemoveItem(support_item);
|
||||
else
|
||||
support_item->SetCount(support_item->GetCount() - p->bSupportCount);
|
||||
}
|
||||
|
||||
const bool bAdded = (number(1, 100) <= success && item->AddRareAttribute());
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "%s!", bAdded ? "Success" : "Failed");
|
||||
}
|
||||
|
||||
void CInputMain::Attr67Close(LPCHARACTER ch, const char* c_pData)
|
||||
{
|
||||
ch->Set67Attr(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CInputMain::Sash(LPCHARACTER ch, const char* c_pData)
|
||||
{
|
||||
quest::PC * pPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID());
|
||||
@@ -3406,6 +3548,16 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
Sash(ch, c_pData);
|
||||
break;
|
||||
|
||||
#if defined(__BL_67_ATTR__)
|
||||
case HEADER_CG_67_ATTR:
|
||||
Attr67(ch, c_pData);
|
||||
break;
|
||||
|
||||
case HEADER_CG_CLOSE_67_ATTR:
|
||||
Attr67Close(ch, c_pData);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case HEADER_CG_AVA2_DROP:
|
||||
PortNativeDrop(ch,*reinterpret_cast<const TPacketCGAva2Drop*>(c_pData));break;
|
||||
case HEADER_CG_SWITCHBOT:
|
||||
|
||||
@@ -114,6 +114,10 @@ enum
|
||||
HEADER_CG_ITEMS_PICKUP = 235, // PORT: AVA2
|
||||
HEADER_CG_SWITCHBOT = 171, // AVA2 switchbot (port_switchbot.cpp)
|
||||
|
||||
#if defined(__BL_67_ATTR__)
|
||||
HEADER_CG_67_ATTR = 208,
|
||||
HEADER_CG_CLOSE_67_ATTR = 209,
|
||||
#endif
|
||||
HEADER_CG_CLIENT_VERSION = 0xfd,
|
||||
HEADER_CG_CLIENT_VERSION2 = 0xf1,
|
||||
|
||||
@@ -303,6 +307,9 @@ enum
|
||||
HEADER_GC_CHESTDROP = 66, // PORT: AVA2, DWORD dynamic length
|
||||
HEADER_GC_SWITCHBOT = 171, // AVA2 switchbot (port_switchbot.cpp)
|
||||
HEADER_GC_EXTENDED_POINTS = 218, // PORT: AVA2 64-bit gold
|
||||
#if defined(__BL_67_ATTR__)
|
||||
HEADER_GC_OPEN_67_ATTR = 242,
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -2464,6 +2471,22 @@ typedef struct SPacketGCDragonSoulRefine
|
||||
TItemPos Pos;
|
||||
} TPacketGCDragonSoulRefine;
|
||||
|
||||
#if defined(__BL_67_ATTR__)
|
||||
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;
|
||||
#endif
|
||||
|
||||
typedef struct SPacketCGStateCheck
|
||||
{
|
||||
BYTE header;
|
||||
|
||||
@@ -233,6 +233,10 @@ CPacketInfoCG::CPacketInfoCG()
|
||||
Set(HEADER_CG_ITEMS_PICKUP,sizeof(TPacketCGItemsPickUp),"ItemsPickup",true);
|
||||
Set(HEADER_CG_AVA2_DROP,sizeof(TPacketCGAva2Drop),"Ava2Drop",true);
|
||||
Set(HEADER_CG_SWITCHBOT, sizeof(TPacketCGSwitchbot), "Switchbot", true);
|
||||
#if defined(__BL_67_ATTR__)
|
||||
Set(HEADER_CG_67_ATTR, sizeof(TPacketCG67Attr), "67Attr", true);
|
||||
Set(HEADER_CG_CLOSE_67_ATTR, sizeof(TPacket67AttrOpenClose), "67AttrClose", true);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -170,6 +170,16 @@ namespace quest
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__BL_67_ATTR__)
|
||||
int game_open_67_attr(lua_State* L)
|
||||
{
|
||||
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
|
||||
if (ch)
|
||||
ch->Open67Attr();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int game_web_mall(lua_State* L)
|
||||
{
|
||||
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
|
||||
@@ -195,6 +205,9 @@ namespace quest
|
||||
{ "drop_item", game_drop_item },
|
||||
{ "drop_item_with_ownership", game_drop_item_with_ownership },
|
||||
{ "open_web_mall", game_web_mall },
|
||||
#if defined(__BL_67_ATTR__)
|
||||
{ "open_67_attr", game_open_67_attr },
|
||||
#endif
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -168,6 +168,14 @@ enum ESkillIndexes
|
||||
GUILD_SKILL_DOOR = 159,
|
||||
GUILD_SKILL_END = 162,
|
||||
|
||||
SKILL_FINISH = 176,
|
||||
SKILL_ILGWANGPYO = 177,
|
||||
SKILL_PUNGLOEPO = 178,
|
||||
SKILL_GEOMAGGWI = 179,
|
||||
SKILL_MABEOBAGGWI = 180,
|
||||
SKILL_METEO = 181,
|
||||
SKILL_CHEONUN = 182,
|
||||
|
||||
GUILD_SKILL_COUNT = GUILD_SKILL_END - GUILD_SKILL_START + 1,
|
||||
|
||||
};
|
||||
|
||||
@@ -112,6 +112,14 @@ enum
|
||||
DRAGON_HEART_EXTRACTOR_GROUP = 10601,
|
||||
// 용혼석에서 추출할 때 주는 용심.
|
||||
DRAGON_HEART_VNUM = 100000,
|
||||
|
||||
#if defined(ENABLE_ATTR_6TH_7TH) || defined(__BL_67_ATTR__)
|
||||
POWERSHARD_CHEST = 39067,
|
||||
ELEGANT_POWERSHARD_CHEST = 39068,
|
||||
LUCENT_POWERSHARD_CHEST = 39069,
|
||||
ORISON = 72346,
|
||||
SMALL_ORISON = 72351,
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* __INC_METIN2_UNIQUE_ITEM_H */
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
#!/usr/bin/env python3
|
||||
"""AVA2 Phase 4: 6th/7th Rare Attributes and Skills 176-182 Verification Test."""
|
||||
from pathlib import Path
|
||||
import re
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SRC = ROOT / 'src/server'
|
||||
|
||||
def source(name):
|
||||
return (SRC / name).read_bytes().decode('latin1')
|
||||
|
||||
class TestRareAttrsAndSkills(unittest.TestCase):
|
||||
def test_service_definitions(self):
|
||||
service = source('common/service.h')
|
||||
self.assertIn('#define ENABLE_ATTR_6TH_7TH', service)
|
||||
self.assertIn('#define __BL_67_ATTR__', service)
|
||||
|
||||
def test_material_vnum_helper(self):
|
||||
helper = source('common/VnumHelper.h')
|
||||
self.assertIn('Get67MaterialVnum', helper)
|
||||
# Check level brackets
|
||||
self.assertIn('iLevelLimit <= 45', helper)
|
||||
self.assertIn('39070', helper)
|
||||
self.assertIn('iLevelLimit <= 75', helper)
|
||||
self.assertIn('39071', helper)
|
||||
self.assertIn('iLevelLimit <= 105', helper)
|
||||
self.assertIn('39072', helper)
|
||||
self.assertIn('iLevelLimit <= 120', helper)
|
||||
self.assertIn('39073', helper)
|
||||
|
||||
def test_unique_items(self):
|
||||
uniq = source('game/src/unique_item.h')
|
||||
self.assertIn('POWERSHARD_CHEST = 39067', uniq)
|
||||
self.assertIn('ELEGANT_POWERSHARD_CHEST = 39068', uniq)
|
||||
self.assertIn('LUCENT_POWERSHARD_CHEST = 39069', uniq)
|
||||
self.assertIn('ORISON = 72346', uniq)
|
||||
self.assertIn('SMALL_ORISON = 72351', uniq)
|
||||
|
||||
def test_network_packets(self):
|
||||
packet = source('game/src/packet.h')
|
||||
self.assertTrue(re.search(r'HEADER_CG_67_ATTR\s*=\s*208', packet))
|
||||
self.assertTrue(re.search(r'HEADER_CG_CLOSE_67_ATTR\s*=\s*209', packet))
|
||||
self.assertTrue(re.search(r'HEADER_GC_OPEN_67_ATTR\s*=\s*242', packet))
|
||||
|
||||
# Check packet structures
|
||||
self.assertIn('typedef struct command_67_attr', packet)
|
||||
self.assertIn('TPacketCG67Attr;', packet)
|
||||
self.assertIn('typedef struct command_67_attr_open_close', packet)
|
||||
self.assertIn('TPacket67AttrOpenClose;', packet)
|
||||
|
||||
# Check packet_info registration
|
||||
pinfo = source('game/src/packet_info.cpp')
|
||||
self.assertIn('Set(HEADER_CG_67_ATTR, sizeof(TPacketCG67Attr), "67Attr", true);', pinfo)
|
||||
self.assertIn('Set(HEADER_CG_CLOSE_67_ATTR, sizeof(TPacket67AttrOpenClose), "67AttrClose", true);', pinfo)
|
||||
|
||||
def test_character_and_quest_bindings(self):
|
||||
char_h = source('game/src/char.h')
|
||||
self.assertIn('void\tOpen67Attr();', char_h)
|
||||
self.assertIn('void\tSet67Attr(bool b)', char_h)
|
||||
self.assertIn('bool\tIs67AttrOpen() const', char_h)
|
||||
self.assertIn('bool\tm_b67Attr;', char_h)
|
||||
|
||||
char_cpp = source('game/src/char.cpp')
|
||||
self.assertIn('m_b67Attr = false;', char_cpp)
|
||||
self.assertIn('void CHARACTER::Open67Attr()', char_cpp)
|
||||
self.assertIn('HEADER_GC_OPEN_67_ATTR', char_cpp)
|
||||
|
||||
quest_game = source('game/src/questlua_game.cpp')
|
||||
self.assertIn('int game_open_67_attr(lua_State* L)', quest_game)
|
||||
self.assertIn('"open_67_attr"', quest_game)
|
||||
|
||||
def test_input_main_attr67_logic(self):
|
||||
input_main = source('game/src/input_main.cpp')
|
||||
self.assertIn('void CInputMain::Attr67(', input_main)
|
||||
self.assertIn('void CInputMain::Attr67Close(', input_main)
|
||||
self.assertIn('case HEADER_CG_67_ATTR:', input_main)
|
||||
self.assertIn('case HEADER_CG_CLOSE_67_ATTR:', input_main)
|
||||
|
||||
# Item type whitelist and exclusions
|
||||
self.assertIn('case ITEM_WEAPON:', input_main)
|
||||
self.assertIn('case ITEM_ARMOR:', input_main)
|
||||
self.assertIn('case ITEM_COSTUME:', input_main)
|
||||
self.assertIn('case ITEM_RING:', input_main)
|
||||
self.assertIn('case ITEM_NEW_RINGS:', input_main)
|
||||
self.assertIn('ARMOR_PENDANT', input_main)
|
||||
self.assertIn('COSTUME_SASH', input_main)
|
||||
self.assertIn('COSTUME_NEW_SASH', input_main)
|
||||
|
||||
# Conditions: norm_attr_count >= 5, rare_attr_count < 2, equipped check
|
||||
self.assertIn('norm_attr_count < 5', input_main)
|
||||
self.assertIn('rare_attr_count >= 2', input_main)
|
||||
self.assertIn('item->IsEquipped()', input_main)
|
||||
|
||||
# Caps: MATERIAL_MAX_COUNT = 10, SUPPORT_MAX_COUNT = 5
|
||||
self.assertIn('MATERIAL_MAX_COUNT = 10', input_main)
|
||||
self.assertIn('SUPPORT_MAX_COUNT = 5', input_main)
|
||||
|
||||
# Support items and rates
|
||||
for vnum, rate in [(72064, 1), (72065, 2), (72066, 4), (72067, 10), (72068, 100)]:
|
||||
self.assertIn(f'case {vnum}:', input_main)
|
||||
self.assertIn(f'uSupportSuccess = {rate};', input_main)
|
||||
|
||||
def test_rare_attr_wash_items(self):
|
||||
char_item = source('game/src/char_item.cpp')
|
||||
# 71052, 72346 (ORISON), 72351 (SMALL_ORISON) support
|
||||
self.assertIn('case 71052 :', char_item)
|
||||
self.assertIn('case 72346 :', char_item)
|
||||
self.assertIn('case 72351 :', char_item)
|
||||
|
||||
# USE_CHANGE_ATTRIBUTE2 support
|
||||
self.assertIn('if (item->GetSubType() == USE_CHANGE_ATTRIBUTE2)', char_item)
|
||||
self.assertIn('ChangeRareAttribute()', char_item)
|
||||
|
||||
# Strictly forbid 72319 and 72320
|
||||
self.assertIn('item->GetVnum() == 72319 || item->GetVnum() == 72320', char_item)
|
||||
|
||||
def test_rare_attribute_storage_isolation(self):
|
||||
attr_cpp = source('game/src/item_attribute.cpp')
|
||||
# Ensure AddRareAttribute writes to m_aAttr[count + 5] (index 5 and 6 only)
|
||||
self.assertIn('int pos = count + 5;', attr_cpp)
|
||||
self.assertIn('TPlayerItemAttribute & attr = m_aAttr[pos];', attr_cpp)
|
||||
self.assertIn('if (count >= 2)', attr_cpp)
|
||||
|
||||
def test_skill_constants_and_book_learning(self):
|
||||
skill_h = source('game/src/skill.h')
|
||||
for vnum, name in [
|
||||
(176, 'SKILL_FINISH'),
|
||||
(177, 'SKILL_ILGWANGPYO'),
|
||||
(178, 'SKILL_PUNGLOEPO'),
|
||||
(179, 'SKILL_GEOMAGGWI'),
|
||||
(180, 'SKILL_MABEOBAGGWI'),
|
||||
(181, 'SKILL_METEO'),
|
||||
(182, 'SKILL_CHEONUN'),
|
||||
]:
|
||||
self.assertTrue(re.search(rf'{name}\s*=\s*{vnum}', skill_h))
|
||||
|
||||
char_skill = source('game/src/char_skill.cpp')
|
||||
self.assertIn('dwSkillVnum >= SKILL_FINISH && dwSkillVnum <= SKILL_CHEONUN', char_skill)
|
||||
self.assertIn('pkSk->dwVnum < SKILL_FINISH || pkSk->dwVnum > SKILL_CHEONUN', char_skill)
|
||||
|
||||
# Skill book stack protection
|
||||
char_item = source('game/src/char_item.cpp')
|
||||
self.assertIn('if (true == LearnSkillByBook(dwVnum))', char_item)
|
||||
self.assertIn('if (item->GetCount() > 1)', char_item)
|
||||
self.assertIn('item->SetCount(item->GetCount() - 1);', char_item)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user