Level 120 (L1-L5): AVA2 maps, drops, dungeons, dungeon timer UI

- tools/server/level-120: sbtest install of the 120 exp table and the
  unsigned exp column.
- tools/server/ava2-maps: the 10 AVA2 maps (pack, map data, regen, designed
  drops) for sbtest; Ava2MapsScript.inc, gr2 texture and mob_proto tests.
- tools/server/ava2-dungeons: snow / ship defence / Meley quests ported from
  AVA2 (make_quests.py + install.sh).
- mt_dungeon_timer (DungeonTimerScript.inc): AVA2 dungeon timer in place of
  the minimap (RefreshDungeonTimer) and the hydra mast HP bar (gethydrahp).
- Autohunt skips a target that is hit but takes no damage for 4 s (blocked
  Meley statues) and keeps it skipped for 60 s; FindCloseTarget now honours
  the skip list.

Meley full run passed on sbtest with the Mac client. Not deployed live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-17 08:13:32 +09:00
co-authored by Claude Opus 5.5
parent 657e49e52a
commit a1e7da68a4
28 changed files with 1671 additions and 6 deletions
+32
View File
@@ -0,0 +1,32 @@
// PORT: AVA2 maps and dungeons (tools/server/ava2-maps), as module mt_ava2maps. npclist.txt is read from
// the root pack only, so the ava2maps pack ships locale/zh/mt_ava2maps.txt (gbk) instead; this script feeds
// it to RaceManager (race -> model folder, folder -> shared source folder), to the minimap zone names and
// to mt_boss's server map index table. Models, maps and the mob_proto rows ship in the same pack.
static const char c_szAva2MapsScript[] = R"PY(# -*- coding: utf-8 -*-
import chrmgr
import localeInfo
import pack
PATH='locale/zh/mt_ava2maps.txt'
def Load():
if not pack.Exist(PATH):return 0
zones=getattr(localeInfo,'MINIMAP_ZONE_NAME_DICT',None)
try:
import mt_boss
maps=mt_boss.MAPS
except (ImportError,AttributeError):
maps=None
count=0
for line in pack.Get(PATH).splitlines():
t=line.rstrip('\r').split('\t')
if len(t)!=3:continue
if t[0]=='race':chrmgr.RegisterRaceName(int(t[1]),t[2]);count+=1
elif t[0]=='src':chrmgr.RegisterRaceSrcName(t[1],t[2])
elif t[0]=='zone' and zones is not None:zones[t[1]]=t[2]
elif t[0]=='map' and maps is not None:maps[int(t[1])]=t[2]
return count
RACES=Load()
)PY";
@@ -0,0 +1,124 @@
// PORT: AVA2 dungeon timer (dracaryS_DUNGEON_LIB uidungeontimer.py + uiscript/map_info.py) and hydra mast HP
// (ENABLE_DEFENSAWESHIP uishipmasthp.py), as module mt_dungeon_timer. The AVA2 dungeon quests
// (tools/server/ava2-dungeons) send "RefreshDungeonTimer <floor> <seconds left>" on entry and on every stage,
// and the ship defence sends "gethydrahp <mast hp>". Like AVA2 the timer takes the minimap's place until the
// next map load. AVA2 sweeps the boss portrait with an image cool-time our ExpandedImageBox lacks, so the
// portrait is drawn whole. The back / portrait images ship in the ava2maps pack.
static const char c_szDungeonTimerScript[] = R"PY(# -*- coding: utf-8 -*-
import app
import background
import game
import player
import ui
import wndMgr
L=player.AutoHuntLocalize
ROOT='d:/ymir work/ui/game/dungeontimer/'
# map -> image prefix (AVA2 uidungeontimer.py); others use devil_.
PREFIX={'metin2_map_n_flame_dungeon_01':'razador_','metin2_map_n_snow_dungeon_01':'nemere_','defensawe_hydra':'hydra_',
'metin2_map_n_flame_dragon':'meley_','metin2_map_dawnmist_dungeon_01':'jotun_'}
WAVE_MAPS=('defensawe_hydra',)
MAST_MAP='defensawe_hydra'
MAST_MAX=10000000
g_game=None
g_timer=None
g_mast=None
state={'floor':0,'end':0.}
def Image(parent,path,x,y):
i=ui.ExpandedImageBox();i.SetParent(parent);i.AddFlag('not_pick')
try:i.LoadImage(path)
except:pass
i.SetPosition(x,y);i.Show();return i
def Text(parent,x,y,color=None):
t=ui.TextLine();t.SetParent(parent);t.SetPosition(x,y);t.SetHorizontalAlignCenter();t.SetOutline()
if color:t.SetPackedFontColor(color)
t.Show();return t
class Timer(ui.Window):
def __init__(self,minimap):
ui.Window.__init__(self);self.SetWindowName('DungeonTimer');self.AddFlag('not_pick')
self.minimap=minimap;self.SetSize(136,161)
prefix=PREFIX.get(background.GetCurrentMapName(),'devil_')
self.back=Image(self,ROOT+prefix+'back.sub',0,0)
self.portrait=Image(self,ROOT+prefix+'timer.sub',9,18)
self.floor=Text(self,72,50,0xffffd40b)
self.left=Text(self,72,75)
def Refresh(self,floor,seconds):
state['floor']=floor;state['end']=app.GetTime()+seconds
self.floor.SetText(L(('第 %d 波' if background.GetCurrentMapName() in WAVE_MAPS else '第 %d 层')%floor))
self.OnUpdate();self.Show()
if self.minimap:self.minimap.Hide()
def OnUpdate(self):
left=max(0,int(state['end']-app.GetTime()+0.5))
self.left.SetText('%02d:%02d'%(left//60,left%60))
if self.minimap:
x,y=self.minimap.GetGlobalPosition();w=self.minimap.GetWidth()
self.SetPosition(x+w-136 if w>=136 else x,y)
class MastHP(ui.ThinBoard):
def __init__(self):
ui.ThinBoard.__init__(self);self.SetSize(120,40);self.SetPosition(wndMgr.GetScreenWidth()-130,225)
self.text=ui.TextLine();self.text.SetParent(self);self.text.SetPosition(10,5);self.text.SetOutline()
self.text.SetText(L('船桅'));self.text.Show()
self.gauge=ui.Gauge();self.gauge.SetParent(self);self.gauge.SetPosition(13,25);self.gauge.MakeGauge(95,'red');self.gauge.Show()
def SetHP(self,hp):
self.gauge.SetPercentage(max(0,min(hp,MAST_MAX)),MAST_MAX);self.Show()
def Destroy():
global g_game,g_timer,g_mast
for w in (g_timer,g_mast):
if w:w.Hide()
g_game=g_timer=g_mast=None
def GetTimer():
global g_timer
if not g_timer and g_game:
g_timer=Timer(getattr(getattr(g_game,'interface',None),'wndMiniMap',None))
return g_timer
_open=game.GameWindow.Open
_close=game.GameWindow.Close
_command=game.GameWindow.BINARY_ServerCommand_Run
def Open(self):
global g_game,g_mast
_open(self)
Destroy();g_game=self
if background.GetCurrentMapName()==MAST_MAP:g_mast=MastHP();g_mast.SetHP(MAST_MAX)
def Close(self):
Destroy()
_close(self)
def Command(self,line):
words=line.split()
if words and words[0]=='RefreshDungeonTimer' and len(words)>=3:
t=GetTimer()
if t:t.Refresh(int(words[1]),int(words[2]))
return 1
if words and words[0]=='gethydrahp' and len(words)>=2:
if g_mast:g_mast.SetHP(int(words[1]))
return 1
return _command(self,line)
game.GameWindow.Open=Open
game.GameWindow.Close=Close
game.GameWindow.BINARY_ServerCommand_Run=Command
)PY";
+4
View File
@@ -1031,6 +1031,8 @@ namespace PythonBoot
#include "ArmorShapesScript.inc"
#include "SashScript.inc"
#include "MountScript.inc"
#include "Ava2MapsScript.inc"
#include "DungeonTimerScript.inc"
#include "CostumeAttrScript.inc"
#include "PendantScript.inc"
#include "RingsScript.inc"
@@ -1127,6 +1129,8 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
install_script_module("mt_shapes", c_szArmorShapesScript);
install_script_module("mt_sash", c_szSashScript);
install_script_module("mt_mount", c_szMountScript);
install_script_module("mt_ava2maps", c_szAva2MapsScript);
install_script_module("mt_dungeon_timer", c_szDungeonTimerScript);
install_script_module("mt_costume_attr", c_szCostumeAttrScript);
install_script_module("mt_pendant", c_szPendantScript);
install_script_module("mt_rings", c_szRingsScript);