Files
shenandClaude Sonnet 5 2277b1dd60 Vendor Metin2 assets (assets/ + bgm/)
Committed to this self-hosted private repo so a clone builds on any machine
without a separate asset sync. Copyrighted Ymir art — do not publish or
redistribute. 54198 files, ~2.2 GB. asset_index.txt / assets.zip stay
gitignored (derived: bake_asset_index.gd / pack-assets.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
2026-08-31 20:04:32 +09:00

60 lines
1.1 KiB
Python

import ui
import player
import chr
import textTail
class PlayerGauge(ui.Gauge):
def __init__(self, parent):
ui.Gauge.__init__(self)
self.SetParent(parent)
self.AddFlag("not_pick")
self.MakeGauge(100, "red")
self.curHP = 0
self.maxHP = 0
self.showAlways = False
def __del__(self):
ui.Gauge.__del__(self)
def Hide(self):
self.SetPosition(-100, -100)
ui.Gauge.Hide(self)
def OnUpdate(self):
playerIndex = player.GetMainCharacterIndex()
(x, y, z)=textTail.GetPosition(playerIndex)
isChat = textTail.IsChat(playerIndex)
ui.Gauge.SetPosition(self, int(x - self.GetWidth() // 2), int(y + 5) + isChat * 17)
def RefreshGauge(self):
self.curHP = player.GetStatus(player.HP)
self.maxHP = player.GetStatus(player.MAX_HP)
self.SetPercentage(self.curHP, self.maxHP)
if self.showAlways:
self.Show()
else:
if self.IsShow():
if self.curHP > self.maxHP // 2:
self.Hide()
else:
if self.curHP < self.maxHP // 2:
self.OnUpdate()
self.Show()
def EnableShowAlways(self):
self.showAlways = True
self.RefreshGauge()
def DisableShowAlways(self):
self.showAlways = False
self.RefreshGauge()