AVA2 unlock P7: talismans (护符) and their attribute items
- ARMOR_PENDANT / APPLY_ENCHANT_* 123-128 / c_Equipment_Pendant (server WEAR_PENDANT 27) constants - mt_pendant: equipment slot under the earring, drop targets for 71302/53996 (reroll) and 71301/53997 (add, max 5), MTPENDANT messages; enchant apply texts in mt_applies - switchbot ignores talismans and talisman rerolls - make_items keeps the six +0..+200 chains (1206 items) and the four attribute items - tools/server/pendant: refine sets 440-499 (AVA2 rows) + install.sh Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a1b63c0afb
commit
b9af78ef64
@@ -9,6 +9,12 @@ L = player.AutoHuntLocalize
|
||||
TEXTS = (
|
||||
("APPLY_ATTBONUS_STONE", "对陨石伤害 +%d%%"),
|
||||
("APPLY_ATTBONUS_BOSS", "对 Boss 伤害 +%d%%"),
|
||||
("APPLY_ENCHANT_ELEC", "对雷属性怪物伤害 +%d%%"),
|
||||
("APPLY_ENCHANT_FIRE", "对火属性怪物伤害 +%d%%"),
|
||||
("APPLY_ENCHANT_ICE", "对冰属性怪物伤害 +%d%%"),
|
||||
("APPLY_ENCHANT_WIND", "对风属性怪物伤害 +%d%%"),
|
||||
("APPLY_ENCHANT_EARTH", "对土属性怪物伤害 +%d%%"),
|
||||
("APPLY_ENCHANT_DARK", "对暗属性怪物伤害 +%d%%"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
// PORT: AVA2 talisman (ITEM_TALISMAN_EQUIPMENT + ELEMENT_NEW_BONUSES), as module mt_pendant. Talismans are
|
||||
// ITEM_ARMOR / ARMOR_PENDANT worn in c_Equipment_Pendant (server WEAR_PENDANT, metin2-server port_pendant.cpp).
|
||||
// This script adds that slot to the inventory's equipment panel (the free spot under the earring on
|
||||
// equipment_base), marks unequipped talismans as drop targets of the talisman attribute items (71302 / 53996
|
||||
// reroll, 71301 / 53997 add up to 5) and nothing else, and renders the "MTPENDANT <code>" server messages that
|
||||
// replace AVA2's locale strings 1056 / 1057 / 1067.
|
||||
static const char c_szPendantScript[] = R"PY(# -*- coding: utf-8 -*-
|
||||
import chat
|
||||
import game
|
||||
import item
|
||||
import player
|
||||
import ui
|
||||
import uiInventory
|
||||
|
||||
L=player.AutoHuntLocalize
|
||||
CHANGE=(71302,53996)
|
||||
ADD=(71301,53997)
|
||||
MAX_ATTR=5
|
||||
MESSAGES={'target':'该道具只能用于护符。','equipped':'请先卸下护符再使用。','empty':'这件护符没有可重洗的属性。',
|
||||
'changed':'护符属性已重新随机。','full':'这件护符的属性已满(最多 5 条)。','added':'护符追加属性成功。'}
|
||||
# EquipmentSlot coordinates of the slot (the earring is at 114,84).
|
||||
SLOT=(item.EQUIPMENT_PENDANT,(114,118))
|
||||
|
||||
|
||||
def FindChild(node,name):
|
||||
if node.get("name")==name:return node
|
||||
for child in node.get("children",()):
|
||||
found=FindChild(child,name)
|
||||
if found:return found
|
||||
return None
|
||||
|
||||
|
||||
def PatchInventoryWindow(window):
|
||||
base=FindChild(window,"Equipment_Base");slot=FindChild(window,"EquipmentSlot")
|
||||
if not base or not slot:return
|
||||
index,(x,y)=SLOT
|
||||
frame={"name":"PendantSlotBase","type":"image","x":slot["x"]+x,"y":slot["y"]+y,"image":"d:/ymir work/ui/public/Slot_Base.sub"}
|
||||
base["children"]=(frame,)+tuple(base.get("children",()))
|
||||
slot["slot"]=tuple(slot["slot"])+({"index":index,"x":x,"y":y,"width":32,"height":32},)
|
||||
|
||||
|
||||
_execfile=ui.execfile
|
||||
|
||||
def ExecFile(fileName,dict):
|
||||
_execfile(fileName,dict)
|
||||
name=fileName.replace("\\","/").split("/")[-1].lower()
|
||||
if name=="inventorywindow.py" and "window" in dict:PatchInventoryWindow(dict["window"])
|
||||
|
||||
ui.execfile=ExecFile
|
||||
|
||||
|
||||
_refreshEquip=uiInventory.InventoryWindow.RefreshEquipSlotWindow
|
||||
|
||||
def RefreshEquipSlotWindow(self):
|
||||
_refreshEquip(self)
|
||||
index=SLOT[0]
|
||||
self.wndEquip.SetItemSlot(index,player.GetItemIndex(index),0)
|
||||
self.wndEquip.RefreshSlot()
|
||||
|
||||
uiInventory.InventoryWindow.RefreshEquipSlotWindow=RefreshEquipSlotWindow
|
||||
|
||||
|
||||
def IsTalisman(vnum):
|
||||
if not vnum:return False
|
||||
item.SelectItem(vnum)
|
||||
return item.GetItemType()==item.ITEM_TYPE_ARMOR and item.GetItemSubType()==item.ARMOR_PENDANT
|
||||
|
||||
|
||||
def AttrCount(slot):
|
||||
return len([1 for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM) if player.GetItemAttribute(slot,i)[0]])
|
||||
|
||||
|
||||
_canUse=uiInventory.InventoryWindow._InventoryWindow__CanUseSrcItemToDstItem
|
||||
|
||||
def CanUseSrcItemToDstItem(self,srcItemVNum,srcSlotPos,dstSlotPos):
|
||||
scroll=srcItemVNum in CHANGE or srcItemVNum in ADD
|
||||
talisman=IsTalisman(player.GetItemIndex(dstSlotPos))
|
||||
if not scroll:
|
||||
# the server refuses every other attribute / socket item on a talisman
|
||||
if talisman and item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:return False
|
||||
return _canUse(self,srcItemVNum,srcSlotPos,dstSlotPos)
|
||||
if srcSlotPos==dstSlotPos or not talisman or player.IsEquipmentSlot(dstSlotPos):return False
|
||||
count=AttrCount(dstSlotPos)
|
||||
return count>0 if srcItemVNum in CHANGE else count<MAX_ATTR
|
||||
|
||||
uiInventory.InventoryWindow._InventoryWindow__CanUseSrcItemToDstItem=CanUseSrcItemToDstItem
|
||||
|
||||
|
||||
_command=game.GameWindow.BINARY_ServerCommand_Run
|
||||
|
||||
def Command(self,line):
|
||||
if line.startswith('MTPENDANT '):
|
||||
words=line.split()
|
||||
text=MESSAGES.get(words[1] if len(words)>1 else '')
|
||||
if text:chat.AppendChat(chat.CHAT_TYPE_INFO,L(text))
|
||||
return 1
|
||||
return _command(self,line)
|
||||
|
||||
game.GameWindow.BINARY_ServerCommand_Run=Command
|
||||
)PY";
|
||||
@@ -1019,6 +1019,7 @@ namespace PythonBoot
|
||||
#include "SashScript.inc"
|
||||
#include "MountScript.inc"
|
||||
#include "CostumeAttrScript.inc"
|
||||
#include "PendantScript.inc"
|
||||
|
||||
static void install_script_module(const char* c_szModule, const char* c_szScript)
|
||||
{
|
||||
@@ -1106,6 +1107,7 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
|
||||
install_script_module("mt_sash", c_szSashScript);
|
||||
install_script_module("mt_mount", c_szMountScript);
|
||||
install_script_module("mt_costume_attr", c_szCostumeAttrScript);
|
||||
install_script_module("mt_pendant", c_szPendantScript);
|
||||
if (g_touch_input)
|
||||
install_script_module("mt_mobile_hud", c_szMobileHUDScript);
|
||||
}
|
||||
|
||||
@@ -188,10 +188,11 @@ class SwitchbotWindow(ui.Window):
|
||||
vnum=player.GetItemIndex(player.INVENTORY,cell)
|
||||
if not vnum:continue
|
||||
item.SelectItem(vnum);kind=item.GetItemType()
|
||||
# 54001-54267 with a value2 mask are AVA2 costume enchants (mt_costume_attr), not switchers.
|
||||
if kind==item.ITEM_TYPE_USE and item.GetItemSubType()==USE_CHANGE_ATTRIBUTE and not (54001<=vnum<=54267 and item.GetValue(2)):
|
||||
# 54001-54267 with a value2 mask are AVA2 costume enchants (mt_costume_attr), 71302 / 53996 talisman
|
||||
# rerolls (mt_pendant), not switchers; talismans have their own attribute pool.
|
||||
if kind==item.ITEM_TYPE_USE and item.GetItemSubType()==USE_CHANGE_ATTRIBUTE and not (54001<=vnum<=54267 and item.GetValue(2)) and vnum not in (71302,53996):
|
||||
scrolls[vnum]=scrolls.get(vnum,0)+player.GetItemCount(player.INVENTORY,cell)
|
||||
elif kind in (item.ITEM_TYPE_WEAPON,item.ITEM_TYPE_ARMOR) and any(player.GetItemAttribute(player.INVENTORY,cell,i)[0] for i in range(5)):
|
||||
elif kind in (item.ITEM_TYPE_WEAPON,item.ITEM_TYPE_ARMOR) and not (kind==item.ITEM_TYPE_ARMOR and item.GetItemSubType()==item.ARMOR_PENDANT) and any(player.GetItemAttribute(player.INVENTORY,cell,i)[0] for i in range(5)):
|
||||
items.append((cell,vnum))
|
||||
selected=self.Selected();scroll=self.Scroll();state=self.bot.state
|
||||
if state and state['active'] and (state['cell'],state['vnum']) in items:
|
||||
|
||||
@@ -95,6 +95,7 @@ class CItemData
|
||||
ARMOR_FOOTS,
|
||||
ARMOR_NECK,
|
||||
ARMOR_EAR,
|
||||
ARMOR_PENDANT, // PORT: AVA2 talisman, worn in c_Equipment_Pendant
|
||||
ARMOR_NUM_TYPES
|
||||
};
|
||||
|
||||
@@ -353,7 +354,13 @@ class CItemData
|
||||
APPLY_ANTI_CRITICAL_PCT, //90 크리티컬 저항
|
||||
APPLY_ANTI_PENETRATE_PCT, //91 관통타격 저항
|
||||
|
||||
// PORT AVA2 bonus numbering, matching the server (common/length.h): 92-138 are not ported yet.
|
||||
// PORT AVA2 bonus numbering, matching the server (common/length.h): 92-122 and 129-138 are not ported yet.
|
||||
APPLY_ENCHANT_ELEC = 123, // talisman: attack +x% on monsters of that element
|
||||
APPLY_ENCHANT_FIRE = 124,
|
||||
APPLY_ENCHANT_ICE = 125,
|
||||
APPLY_ENCHANT_WIND = 126,
|
||||
APPLY_ENCHANT_EARTH = 127,
|
||||
APPLY_ENCHANT_DARK = 128,
|
||||
APPLY_ATTBONUS_STONE = 139,
|
||||
APPLY_ATTBONUS_BOSS = 140,
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ enum EDragonSoulStepTypes
|
||||
const DWORD c_Costume_Slot_Mount = c_Equipment_Start + 25; // PORT: AVA2 mount costume, server WEAR_COSTUME_MOUNT
|
||||
const DWORD c_Costume_Slot_MountSkin = c_Equipment_Start + 26; // PORT: AVA2 mount skin, server WEAR_COSTUME_MOUNT_SKIN
|
||||
#endif
|
||||
const DWORD c_Equipment_Pendant = c_Equipment_Start + 27; // PORT: AVA2 talisman, server WEAR_PENDANT
|
||||
|
||||
|
||||
// [주의] 숫자(32) 하드코딩 주의. 현재 서버에서 용혼석 슬롯은 32부터임.
|
||||
|
||||
@@ -760,6 +760,8 @@ void initItem()
|
||||
PyModule_AddIntConstant(poModule, "ARMOR_FOOTS", CItemData::ARMOR_FOOTS);
|
||||
PyModule_AddIntConstant(poModule, "ARMOR_NECK", CItemData::ARMOR_NECK);
|
||||
PyModule_AddIntConstant(poModule, "ARMOR_EAR", CItemData::ARMOR_EAR);
|
||||
PyModule_AddIntConstant(poModule, "ARMOR_PENDANT", CItemData::ARMOR_PENDANT); // PORT: AVA2 talisman
|
||||
PyModule_AddIntConstant(poModule, "EQUIPMENT_PENDANT", c_Equipment_Pendant);
|
||||
|
||||
PyModule_AddIntConstant(poModule, "ITEM_APPLY_MAX_NUM", CItemData::ITEM_APPLY_MAX_NUM);
|
||||
PyModule_AddIntConstant(poModule, "ITEM_SOCKET_MAX_NUM", CItemData::ITEM_SOCKET_MAX_NUM);
|
||||
@@ -860,4 +862,10 @@ void initItem()
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ANTI_PENETRATE_PCT", CItemData::APPLY_ANTI_PENETRATE_PCT );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ATTBONUS_STONE", CItemData::APPLY_ATTBONUS_STONE );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ATTBONUS_BOSS", CItemData::APPLY_ATTBONUS_BOSS );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ENCHANT_ELEC", CItemData::APPLY_ENCHANT_ELEC );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ENCHANT_FIRE", CItemData::APPLY_ENCHANT_FIRE );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ENCHANT_ICE", CItemData::APPLY_ENCHANT_ICE );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ENCHANT_WIND", CItemData::APPLY_ENCHANT_WIND );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ENCHANT_EARTH", CItemData::APPLY_ENCHANT_EARTH );
|
||||
PyModule_AddIntConstant(poModule, "APPLY_ENCHANT_DARK", CItemData::APPLY_ENCHANT_DARK );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user