AVA2 unlock P5: mount costume / skin (COSTUME_MOUNT 2, COSTUME_MOUNT_SKIN 4, slots 25/26, mt_mount, npc_mount races)

Keeps 71502/71505/71508/71511 and skins 71234/71254 as costumes, stages the
npc_mount models of races 32012/32028, writes mobs-server.tsv and lets
install_items.py install mob rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-16 13:58:16 +09:00
co-authored by Claude Opus 5.5
parent 4d7306792e
commit 1412806ee9
9 changed files with 158 additions and 13 deletions
+79
View File
@@ -0,0 +1,79 @@
// PORT: AVA2 mount costume + mount skin (ENABLE_MOUNT_COSTUME_SYSTEM / ENABLE_MOUNT_SKIN), as module mt_mount.
// The server swaps the horse race for the worn costume's value0 (metin2-server port_mount.cpp); this script
// registers the AVA2 npclist rows of the skin races (npclist.txt is read from the root pack only, so a patch
// pack cannot add them; RaceManager's __IsNewMountRace adds npc_mount to their search path), adds the mount
// and skin slots to the costume window under the sash slot, and renders the "MTMOUNT <code>" server
// messages that replace AVA2's locale strings 334 / 1097 / 1098. Models ship in the ava2items pack
// (tools/server/ava2-items, MOUNT_MOBS).
static const char c_szMountScript[] = R"PY(# -*- coding: utf-8 -*-
import chat
import chrmgr
import game
import item
import player
import ui
import uiInventory
L=player.AutoHuntLocalize
# AVA2 root/npclist.txt rows of the races MOUNT_MOBS ships.
RACES=((32012,"christmas_2017_sleddog_02"),(32028,"christmas_2020_alpaca"))
SRC_NAMES=(("christmas_2017_sleddog_02","christmas_2017_sleddog"),)
MESSAGES={'riding':'骑乘中无法更换坐骑时装。','need_mount':'需要先装备坐骑时装。','has_skin':'请先卸下坐骑外观。',
'need_horse':'需要先拥有马匹(马匹等级 1 以上)才能召唤坐骑。'}
# Costume window: left column under the sash slot (CostumeSlot coordinates; body is at 61,45).
SLOTS=((item.COSTUME_SLOT_MOUNT,(13,45)),(item.COSTUME_SLOT_MOUNT_SKIN,(13,82)))
for race,name in RACES:chrmgr.RegisterRaceName(race,name)
for name,src in SRC_NAMES:chrmgr.RegisterRaceSrcName(name,src)
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 PatchCostumeWindow(window):
base=FindChild(window,"Costume_Base");slot=FindChild(window,"CostumeSlot")
if not base or not slot:return
frames=[];slots=[]
for index,(x,y) in SLOTS:
frames.append({"name":"MountSlotBase%d"%index,"type":"image","x":slot["x"]+x,"y":slot["y"]+y,"image":"d:/ymir work/ui/public/Slot_Base.sub"})
slots.append({"index":index,"x":x,"y":y,"width":32,"height":32})
base["children"]=tuple(frames)+tuple(base.get("children",()))
slot["slot"]=tuple(slot["slot"])+tuple(slots)
_execfile=ui.execfile
def ExecFile(fileName,dict):
_execfile(fileName,dict)
name=fileName.replace("\\","/").split("/")[-1].lower()
if name=="costumewindow.py" and "window" in dict:PatchCostumeWindow(dict["window"])
ui.execfile=ExecFile
_refreshCostume=uiInventory.CostumeWindow.RefreshCostumeSlot
def RefreshCostumeSlot(self):
_refreshCostume(self)
for index,_ in SLOTS:self.wndEquip.SetItemSlot(index,player.GetItemIndex(index),0)
self.wndEquip.RefreshSlot()
uiInventory.CostumeWindow.RefreshCostumeSlot=RefreshCostumeSlot
_command=game.GameWindow.BINARY_ServerCommand_Run
def Command(self,line):
if line.startswith('MTMOUNT '):
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";
+2
View File
@@ -1017,6 +1017,7 @@ namespace PythonBoot
#include "AppliesScript.inc"
#include "ArmorShapesScript.inc"
#include "SashScript.inc"
#include "MountScript.inc"
static void install_script_module(const char* c_szModule, const char* c_szScript)
{
@@ -1102,6 +1103,7 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
install_script_module("mt_applies", c_szAppliesScript);
install_script_module("mt_shapes", c_szArmorShapesScript);
install_script_module("mt_sash", c_szSashScript);
install_script_module("mt_mount", c_szMountScript);
if (g_touch_input)
install_script_module("mt_mobile_hud", c_szMobileHUDScript);
}
+3 -1
View File
@@ -102,7 +102,9 @@ class CItemData
{
COSTUME_BODY, //0 갑옷(main look)
COSTUME_HAIR, //1 헤어(탈착가능)
COSTUME_SASH = 3, // PORT: AVA2 sash (2 is AVA2 COSTUME_MOUNT)
COSTUME_MOUNT = 2, // PORT: AVA2 mount costume (value0 = horse race)
COSTUME_SASH = 3, // PORT: AVA2 sash
COSTUME_MOUNT_SKIN = 4, // PORT: AVA2 mount skin (needs a worn COSTUME_MOUNT)
COSTUME_NUM_TYPES,
};
+11
View File
@@ -22,6 +22,15 @@ bool __IsNPCRace(unsigned race)
return false;
}
// PORT: AVA2 __IsNewMountRace — mount costume / skin races (christmas_2017_sleddog, ...) live in npc_mount.
bool __IsNewMountRace(unsigned race)
{
if (race >= 32000 && race <= 32100)
return true;
return false;
}
void __GetRaceResourcePathes(unsigned race, std::vector <std::string>& vec_stPathes)
{
if (__IsGuildRace(race))
@@ -37,6 +46,8 @@ void __GetRaceResourcePathes(unsigned race, std::vector <std::string>& vec_stPat
if (race >= 30000)
{
vec_stPathes.push_back ("d:/ymir work/npc2/");
if (__IsNewMountRace(race)) // PORT: AVA2
vec_stPathes.push_back ("d:/ymir work/npc_mount/");
vec_stPathes.push_back ("d:/ymir work/npc/");
vec_stPathes.push_back ("d:/ymir work/monster/");
vec_stPathes.push_back ("d:/ymir work/monster2/");
+2
View File
@@ -105,6 +105,8 @@ enum EDragonSoulStepTypes
const DWORD c_Costume_Slot_Count = 2;
const DWORD c_Costume_Slot_End = c_Costume_Slot_Start + c_Costume_Slot_Count;
const DWORD c_Costume_Slot_Sash = c_Equipment_Start + 24; // PORT: AVA2 sash, server WEAR_COSTUME_SASH (after WEAR_BELT)
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
@@ -642,6 +642,10 @@ void initItem()
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_END", c_Costume_Slot_End);
PyModule_AddIntConstant(poModule, "COSTUME_TYPE_SASH", CItemData::COSTUME_SASH); // PORT: AVA2 sash
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_SASH", c_Costume_Slot_Sash);
PyModule_AddIntConstant(poModule, "COSTUME_TYPE_MOUNT", CItemData::COSTUME_MOUNT); // PORT: AVA2 mount costume
PyModule_AddIntConstant(poModule, "COSTUME_TYPE_MOUNT_SKIN", CItemData::COSTUME_MOUNT_SKIN);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_MOUNT", c_Costume_Slot_Mount);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_MOUNT_SKIN", c_Costume_Slot_MountSkin);
#endif
#ifdef ENABLE_NEW_EQUIPMENT_SYSTEM