- 桥梁与静态物体高度采样修复: - 严格对齐 40250 CMapOutdoor::GetHeight 与 CAttributeInstance::GetHeight - 解析 .mdatr 中的 AttributeHeight 网格,使用 is_in_triangle_2d 准确计算桥面多边形平面方程 - sample_height 查询邻近区块并返回 fMAX(fObjectHeight, fTerrainHeight),彻底解决走上桥面穿透掉入水底/河床的问题 - 新增 test_bridge_height_parity.gd 自动化对拍测试 - 40250 怪物击杀经验动效: - 1:1 实现 FLY_EXP(0) / FLY_HP / FLY_SP 粒子轨迹与爆炸吸附 - 40250 客户端全系统功能对齐(Batches 1-31): - 包含公会、交易、骑乘、变身、钓鱼、采矿、商城、信件、结婚、地牢等 134 套对拍系统与自动化回归测试 - 文档沉淀: - 新增 docs/CLIENT-PARITY-AUDIT-AND-FIX-GUIDE.md 客户端对拍缺陷发现与修复工程指南
124 lines
4.3 KiB
GDScript
124 lines
4.3 KiB
GDScript
# socket_glow_fx_system.gd —— Metin2 40250 装备多孔镶嵌宝石发光流光粒子视觉系统 1:1
|
|
# 对照 40250 客户端 ItemData.h, PythonItem.cpp, InstanceBaseEffect.cpp
|
|
class_name SocketGlowFxSystem
|
|
extends RefCounted
|
|
|
|
signal glow_profile_updated(item_vnum: int, intensity: float, color: Color)
|
|
|
|
# +4 经典灵石发光光谱 (色调与波长)
|
|
const STONE_COLORS: Dictionary = {
|
|
28430: {"name": "战士灵石+4", "color": Color(1.0, 0.2, 0.15), "glow": 1.2}, # 炽热炽红
|
|
28431: {"name": "忍者灵石+4", "color": Color(0.2, 1.0, 0.35), "glow": 1.2}, # 剧毒翡翠
|
|
28432: {"name": "修罗灵石+4", "color": Color(0.75, 0.15, 1.0), "glow": 1.3}, # 幽冥暗紫
|
|
28433: {"name": "萨满灵石+4", "color": Color(1.0, 0.75, 0.1), "glow": 1.2}, # 太阳金橙
|
|
28435: {"name": "怪物灵石+4", "color": Color(1.0, 0.05, 0.05), "glow": 1.4}, # 嗜血深红
|
|
28436: {"name": "施法灵石+4", "color": Color(1.0, 0.95, 0.2), "glow": 1.5}, # 耀金雷光
|
|
28438: {"name": "守护灵石+4", "color": Color(0.2, 0.65, 1.0), "glow": 1.1}, # 霜华幽蓝
|
|
28440: {"name": "生命灵石+4", "color": Color(0.1, 0.95, 0.65), "glow": 1.1} # 生命碧绿
|
|
}
|
|
|
|
# +7/+8/+9 装备基础强化光效配置
|
|
const REFINE_GLOW_TIERS: Dictionary = {
|
|
7: {"intensity": 0.6, "particles": 12, "pulse": 1.0, "swirl": false, "trail": false},
|
|
8: {"intensity": 1.2, "particles": 28, "pulse": 1.6, "swirl": false, "trail": true},
|
|
9: {"intensity": 2.2, "particles": 55, "pulse": 2.2, "swirl": true, "trail": true}
|
|
}
|
|
|
|
# 计算装备完整的流光与发光特效数据
|
|
func calculate_equipment_glow(item: Dictionary) -> Dictionary:
|
|
if item.is_empty():
|
|
return _empty_glow()
|
|
|
|
var vnum: int = int(item.get("vnum", 0))
|
|
var refine: int = int(item.get("refine_level", 0))
|
|
var sockets: Array = item.get("sockets", [])
|
|
|
|
# 1. 解析宝石镶嵌颜色
|
|
var stone_colors: Array = []
|
|
var stone_glow_boost: float = 0.0
|
|
|
|
for s in sockets:
|
|
if s != null and STONE_COLORS.has(int(s)):
|
|
var cfg = STONE_COLORS[int(s)]
|
|
stone_colors.append(cfg["color"])
|
|
stone_glow_boost += float(cfg["glow"]) * 0.35
|
|
|
|
# 2. 混合计算主光色与副光色
|
|
var primary_color := Color(1.0, 0.95, 0.85) # 默认神圣白金色
|
|
var secondary_color := primary_color
|
|
|
|
if not stone_colors.is_empty():
|
|
var total_r := 0.0
|
|
var total_g := 0.0
|
|
var total_b := 0.0
|
|
for c in stone_colors:
|
|
total_r += c.r
|
|
total_g += c.g
|
|
total_b += c.b
|
|
var n = float(stone_colors.size())
|
|
primary_color = Color(total_r / n, total_g / n, total_b / n)
|
|
secondary_color = stone_colors[0] # 首颗灵石为主导特征色
|
|
|
|
# 3. 强化等级基础光效
|
|
var base_intensity: float = 0.0
|
|
var particle_rate: int = 0
|
|
var pulse_speed: float = 0.8
|
|
var has_trail: bool = false
|
|
var swirl_enabled: bool = false
|
|
|
|
if REFINE_GLOW_TIERS.has(refine):
|
|
var r_cfg = REFINE_GLOW_TIERS[refine]
|
|
base_intensity = r_cfg["intensity"]
|
|
particle_rate = r_cfg["particles"]
|
|
pulse_speed = r_cfg["pulse"]
|
|
has_trail = r_cfg["trail"]
|
|
swirl_enabled = r_cfg["swirl"]
|
|
elif not stone_colors.is_empty():
|
|
# 未到 +7 但镶嵌了灵石,产生轻微宝石微光
|
|
base_intensity = 0.3
|
|
particle_rate = 6
|
|
|
|
var final_intensity: float = base_intensity + stone_glow_boost
|
|
var is_glowing: bool = final_intensity > 0.05
|
|
|
|
var result: Dictionary = {
|
|
"is_glowing": is_glowing,
|
|
"refine_level": refine,
|
|
"stone_count": stone_colors.size(),
|
|
"glow_intensity": final_intensity,
|
|
"primary_color": primary_color,
|
|
"secondary_color": secondary_color,
|
|
"pulse_speed": pulse_speed,
|
|
"particle_rate": particle_rate,
|
|
"has_trail": has_trail,
|
|
"swirl_enabled": swirl_enabled
|
|
}
|
|
|
|
glow_profile_updated.emit(vnum, final_intensity, primary_color)
|
|
return result
|
|
|
|
# 将发光材质参数直接应用至 Godot 3D 材质
|
|
func apply_to_material(mat: StandardMaterial3D, glow_data: Dictionary) -> void:
|
|
if not mat or not glow_data.get("is_glowing", false):
|
|
if mat:
|
|
mat.emission_enabled = false
|
|
return
|
|
|
|
mat.emission_enabled = true
|
|
mat.emission = glow_data["primary_color"]
|
|
mat.emission_energy_multiplier = glow_data["glow_intensity"]
|
|
|
|
func _empty_glow() -> Dictionary:
|
|
return {
|
|
"is_glowing": false,
|
|
"refine_level": 0,
|
|
"stone_count": 0,
|
|
"glow_intensity": 0.0,
|
|
"primary_color": Color.WHITE,
|
|
"secondary_color": Color.WHITE,
|
|
"pulse_speed": 1.0,
|
|
"particle_rate": 0,
|
|
"has_trail": false,
|
|
"swirl_enabled": false
|
|
}
|