diablo2-web/tests/fixtures/demo-profile-data.ts

526 lines
18 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Test-only legacy demo data (former single-player Sorceress profile).
*
* These literals used to live in `src/` (`DEFAULT_*_SKILLS`, starter gear/bag, default belt potions) and
* seeded the retired single-player HUD. The online client starts from a neutral server-not-ready state, so the
* data now exists only as fixtures for widget/tooltip/layout tests.
*/
import type { HotkeySkillEntry } from '../../src/common/skills/skills-meta.ts'
import { BELT_COLS, BELT_ROWS, type BeltModel, type BeltPotion } from '../../src/common/items/belt-model.ts'
import type { EquipSlotId, GridPlacement, UiInventoryItem } from '../../src/common/items/inventory-model.ts'
export const DEMO_UNIVERSAL_SKILLS: readonly HotkeySkillEntry[] = [
{ skillId: 0, name: 'Attack', nameZh: '普通攻击', level: 1, manaCost: 0, leftUsable: true, rightUsable: true },
{ skillId: 2, name: 'Throw', nameZh: '投掷', level: 1, manaCost: 0, leftUsable: true, rightUsable: true },
{ skillId: 3, name: 'Unsummon', nameZh: '取消召唤', level: 1, manaCost: 0, leftUsable: false, rightUsable: true },
]
export const DEMO_SORCERESS_SKILLS: readonly HotkeySkillEntry[] = [
// Universal Skills
...DEMO_UNIVERSAL_SKILLS,
// Fire Spells (8 active)
{ skillId: 36, name: 'Fire Bolt', nameZh: '火弹', level: 5, manaCost: 2.5, leftUsable: true, rightUsable: true },
{ skillId: 41, name: 'Inferno', nameZh: '地狱之火', level: 1, manaCost: 0.6, leftUsable: true, rightUsable: true },
{ skillId: 46, name: 'Blaze', nameZh: '炽烈之径', level: 1, manaCost: 11, leftUsable: false, rightUsable: true },
{ skillId: 47, name: 'Fire Ball', nameZh: '火球', level: 8, manaCost: 8.5, leftUsable: true, rightUsable: true },
{ skillId: 51, name: 'Fire Wall', nameZh: '火墙', level: 1, manaCost: 22, leftUsable: false, rightUsable: true },
{ skillId: 52, name: 'Enchant', nameZh: '强化', level: 1, manaCost: 25, leftUsable: false, rightUsable: true },
{ skillId: 56, name: 'Meteor', nameZh: '陨石', level: 6, manaCost: 22, leftUsable: false, rightUsable: true },
{ skillId: 62, name: 'Hydra', nameZh: '九头海蛇', level: 1, manaCost: 20, leftUsable: false, rightUsable: true },
// Lightning Spells (9 active)
{ skillId: 38, name: 'Charged Bolt', nameZh: '充能弹', level: 4, manaCost: 4, leftUsable: true, rightUsable: true },
{ skillId: 42, name: 'Static Field', nameZh: '静态力场', level: 5, manaCost: 9, leftUsable: false, rightUsable: true },
{ skillId: 43, name: 'Telekinesis', nameZh: '心灵传动', level: 1, manaCost: 7, leftUsable: false, rightUsable: true },
{ skillId: 48, name: 'Nova', nameZh: '新星', level: 1, manaCost: 15, leftUsable: false, rightUsable: true },
{ skillId: 49, name: 'Lightning', nameZh: '闪电', level: 7, manaCost: 11, leftUsable: true, rightUsable: true },
{ skillId: 53, name: 'Chain Lightning', nameZh: '连锁闪电', level: 1, manaCost: 9, leftUsable: true, rightUsable: true },
{ skillId: 54, name: 'Teleport', nameZh: '传送', level: 4, manaCost: 21, leftUsable: false, rightUsable: true },
{ skillId: 57, name: 'Thunder Storm', nameZh: '雷云风暴', level: 1, manaCost: 19, leftUsable: false, rightUsable: true },
{ skillId: 58, name: 'Energy Shield', nameZh: '能量护盾', level: 1, manaCost: 5, leftUsable: false, rightUsable: true },
// Cold Spells (9 active)
{ skillId: 39, name: 'Ice Bolt', nameZh: '冰弹', level: 1, manaCost: 3, leftUsable: true, rightUsable: true },
{ skillId: 40, name: 'Frozen Armor', nameZh: '冰封装甲', level: 3, manaCost: 7, leftUsable: false, rightUsable: true },
{ skillId: 44, name: 'Frost Nova', nameZh: '霜之新星', level: 3, manaCost: 11, leftUsable: false, rightUsable: true },
{ skillId: 45, name: 'Ice Blast', nameZh: '冰风暴', level: 5, manaCost: 8, leftUsable: true, rightUsable: true },
{ skillId: 50, name: 'Shiver Armor', nameZh: '碎冰甲', level: 1, manaCost: 11, leftUsable: false, rightUsable: true },
{ skillId: 55, name: 'Glacial Spike', nameZh: '冰尖柱', level: 10, manaCost: 14.5, leftUsable: true, rightUsable: true },
{ skillId: 59, name: 'Blizzard', nameZh: '暴风雪', level: 10, manaCost: 27, leftUsable: false, rightUsable: true },
{ skillId: 60, name: 'Chilling Armor', nameZh: '寒冰装甲', level: 1, manaCost: 17, leftUsable: false, rightUsable: true },
{ skillId: 64, name: 'Frozen Orb', nameZh: '冰封球', level: 12, manaCost: 30, leftUsable: true, rightUsable: true },
]
export const DEMO_EQUIPPED_GEAR: Readonly<Partial<Record<EquipSlotId, UiInventoryItem>>> = {
helm: {
id: 'eq-shako',
code: 'uap',
invFile: 'invcap',
invtransform: 'cgrn',
chrtransform: 'cgrn',
name: 'Harlequin Crest',
nameZh: '谐角之冠 (Harlequin Crest)',
baseNameZh: '军帽 (Shako)',
quality: 'unique',
invWidth: 2,
invHeight: 2,
allowedSlots: ['helm'],
defense: 141,
durability: { current: 12, max: 12 },
reqLevel: 62,
reqStr: 50,
stats: [
{ text: '+2 所有技能 (+2 To All Skills)', color: 'blue' },
{ text: '+1.5 生命 (依角色等级而定)', color: 'blue' },
{ text: '+1.5 法力 (依角色等级而定)', color: 'blue' },
{ text: '物理伤害减少 10%', color: 'blue' },
{ text: '50% 更佳机会取得魔法装备 (MF)', color: 'blue' },
{ text: '+2 所有属性', color: 'blue' },
],
},
amulet: {
id: 'eq-maras',
code: 'amu',
invFile: 'invamu',
name: "Mara's Kaleidoscope",
nameZh: "马拉的万花筒 (Mara's Kaleidoscope)",
baseNameZh: '项链 (Amulet)',
quality: 'unique',
invWidth: 1,
invHeight: 1,
allowedSlots: ['amulet'],
reqLevel: 67,
stats: [
{ text: '+2 所有技能 (+2 To All Skills)', color: 'blue' },
{ text: '+5 所有属性', color: 'blue' },
{ text: '所有抗性 +30 (All Resistances +30)', color: 'blue' },
],
},
weapon1: {
id: 'eq-oculus',
code: 'oba',
invFile: 'invob5',
invtransform: 'whit',
chrtransform: 'whit',
name: 'The Oculus',
nameZh: '眼球 (The Oculus)',
baseNameZh: '涡流水晶 (Swirling Crystal)',
quality: 'unique',
invWidth: 1,
invHeight: 3,
allowedSlots: ['weapon1'],
damage: '18 - 42',
durability: { current: 50, max: 50 },
speedText: '法球类 - 普通攻击速度',
reqLevel: 42,
stats: [
{ text: '被击中时有 25% 几率施放等级 1 传送', color: 'blue' },
{ text: '+3 法师技能等级', color: 'blue' },
{ text: '+30% 快速施法速度 (FCR)', color: 'blue' },
{ text: '+20% 增强防御', color: 'blue' },
{ text: '+20 体力', color: 'blue' },
{ text: '+20 精力', color: 'blue' },
{ text: '所有抗性 +20', color: 'blue' },
{ text: '+5 每次击杀获得法力', color: 'blue' },
{ text: '50% 更佳机会取得魔法装备', color: 'blue' },
],
},
armor: {
id: 'eq-tal-armor',
code: 'uth',
invFile: 'invgth',
invtransform: 'dpur',
chrtransform: 'dpur',
name: "Tal Rasha's Guardianship",
nameZh: '塔·拉夏的守护',
baseNameZh: '漆甲 (Lacquered Plate)',
quality: 'set',
invWidth: 2,
invHeight: 3,
allowedSlots: ['armor'],
defense: 941,
durability: { current: 55, max: 55 },
reqLevel: 71,
reqStr: 84,
stats: [
{ text: '+400 防御', color: 'blue' },
{ text: '抗寒 +40%', color: 'blue' },
{ text: '抗电 +40%', color: 'blue' },
{ text: '抗火 +40%', color: 'blue' },
{ text: '魔法伤害减少 15', color: 'blue' },
{ text: '88% 更佳机会取得魔法装备', color: 'blue' },
],
setPieces: [
'塔·拉夏的守护 (Tal Rasha\'s Guardianship)',
'塔·拉夏的赫拉迪克纹章 (Tal Rasha\'s Horadric Crest)',
'塔·拉夏的判决 (Tal Rasha\'s Adjudication)',
'塔·拉夏的无睑之眼 (Tal Rasha\'s Lidless Eye)',
'塔·拉夏的织细衣服 (Tal Rasha\'s Fine-Spun Cloth)',
],
setBonuses: [
{ text: '+10% 快速再度攻击 (2 件装备)', color: 'green' },
{ text: '+3 法师技能等级 (完整套装)', color: 'green' },
{ text: '所有抗性 +50 (完整套装)', color: 'green' },
{ text: '+150 生命 (完整套装)', color: 'green' },
],
},
weapon2: {
id: 'eq-spirit',
code: 'uit',
invFile: 'invtow',
name: 'Spirit Monarch',
nameZh: '精神 (Spirit) 统盾',
baseNameZh: '统治者大盾 (Monarch)',
quality: 'rune',
runewordRunes: "'TalThulOrtAmn'",
invWidth: 2,
invHeight: 3,
allowedSlots: ['weapon2'],
defense: 148,
durability: { current: 148, max: 148 },
reqLevel: 54,
reqStr: 156,
sockets: 4,
stats: [
{ text: '+2 所有技能 (+2 To All Skills)', color: 'blue' },
{ text: '+35% 快速施法速度 (FCR)', color: 'blue' },
{ text: '+55% 快速再度攻击 (FHR)', color: 'blue' },
{ text: '+250 对远距离攻击的防御', color: 'blue' },
{ text: '+22 体力', color: 'blue' },
{ text: '+112 法力', color: 'blue' },
{ text: '抗寒 +35%', color: 'blue' },
{ text: '抗电 +35%', color: 'blue' },
{ text: '抗毒 +35%', color: 'blue' },
{ text: '+8 魔法吸收', color: 'blue' },
],
},
gloves: {
id: 'eq-magefist',
code: 'tgl',
invFile: 'invtgl',
invtransform: 'lgry',
name: 'Magefist',
nameZh: '法师之拳 (Magefist)',
baseNameZh: '轻型铁手套',
quality: 'unique',
invWidth: 2,
invHeight: 2,
allowedSlots: ['gloves'],
defense: 25,
durability: { current: 14, max: 14 },
reqLevel: 23,
reqStr: 45,
stats: [
{ text: '+1 火焰技能', color: 'blue' },
{ text: '+20% 快速施法速度 (FCR)', color: 'blue' },
{ text: '法力再生速度提高 25%', color: 'blue' },
{ text: '增加 1-6 火焰伤害', color: 'blue' },
{ text: '+30% 增强防御', color: 'blue' },
],
},
ring1: {
id: 'eq-soj-1',
code: 'rin',
invFile: 'invrin',
name: 'The Stone of Jordan',
nameZh: '乔丹之石 (Stone of Jordan)',
baseNameZh: '戒指 (Ring)',
quality: 'unique',
invWidth: 1,
invHeight: 1,
allowedSlots: ['ring1', 'ring2'],
reqLevel: 29,
stats: [
{ text: '+1 所有技能', color: 'blue' },
{ text: '增加法力上限 25%', color: 'blue' },
{ text: '+20 法力', color: 'blue' },
{ text: '增加 1-12 闪电伤害', color: 'blue' },
],
},
belt: {
id: 'eq-arach',
code: 'ulc',
invFile: 'invvbl',
invtransform: 'blac',
name: 'Arachnid Mesh',
nameZh: '蜘蛛之网 (Arachnid Mesh)',
baseNameZh: '蛛网腰带 (Spiderweb Sash)',
quality: 'unique',
invWidth: 2,
invHeight: 1,
allowedSlots: ['belt'],
defense: 138,
durability: { current: 12, max: 12 },
reqLevel: 80,
reqStr: 50,
stats: [
{ text: '+1 所有技能', color: 'blue' },
{ text: '+20% 快速施法速度 (FCR)', color: 'blue' },
{ text: '减慢目标速度 10%', color: 'blue' },
{ text: '增加法力上限 5%', color: 'blue' },
{ text: '+120% 增强防御', color: 'blue' },
],
},
ring2: {
id: 'eq-bk-2',
code: 'rin',
invFile: 'invrin',
name: "Bul-Kathos' Wedding Band",
nameZh: '布尔凯索之婚戒',
baseNameZh: '戒指 (Ring)',
quality: 'unique',
invWidth: 1,
invHeight: 1,
allowedSlots: ['ring1', 'ring2'],
reqLevel: 58,
stats: [
{ text: '+1 所有技能', color: 'blue' },
{ text: '+45 生命 (依角色等级而定)', color: 'blue' },
{ text: '5% 每次命中偷取生命', color: 'blue' },
{ text: '+50 最大耐力', color: 'blue' },
],
},
boots: {
id: 'eq-wartrav',
code: 'xtb',
invFile: 'invtbt',
name: 'War Traveler',
nameZh: '战争旅者 (War Traveler)',
baseNameZh: '战场之靴 (Battle Boots)',
quality: 'unique',
invWidth: 2,
invHeight: 2,
allowedSlots: ['boots'],
defense: 139,
durability: { current: 48, max: 48 },
reqLevel: 42,
reqStr: 95,
stats: [
{ text: '+25% 高速跑步/行走', color: 'blue' },
{ text: '+10 力量', color: 'blue' },
{ text: '+10 体力', color: 'blue' },
{ text: '增加 15-25 伤害', color: 'blue' },
{ text: '+190% 增强防御', color: 'blue' },
{ text: '减慢耐力消耗 40%', color: 'blue' },
{ text: '攻击者受到伤害 10', color: 'blue' },
{ text: '50% 更佳机会取得魔法装备 (MF)', color: 'blue' },
],
},
}
export const DEMO_BAG_ITEMS: readonly GridPlacement[] = [
{
col: 0,
row: 0,
item: {
id: 'bag-cube',
code: 'box',
invFile: 'invbox',
name: 'Horadric Cube',
nameZh: '赫拉迪克方块 (Horadric Cube)',
baseNameZh: '任务宝盒',
quality: 'unique',
invWidth: 2,
invHeight: 2,
allowedSlots: [],
stats: [{ text: '右键点击打开合成界面 (3×4 网格)', color: 'gold' }],
},
},
{
col: 2,
row: 0,
item: {
id: 'bag-tbk',
code: 'tbk',
invFile: 'invbbk',
name: 'Tome of Town Portal',
nameZh: '回城之书 (Tome of Town Portal)',
baseNameZh: '法术书 (数量: 20)',
quality: 'normal',
invWidth: 1,
invHeight: 2,
allowedSlots: [],
quantity: 20,
maxQuantity: 20,
stats: [{ text: '右键施放城镇传送门', color: 'white' }],
},
},
{
col: 2,
row: 2,
item: {
id: 'bag-ibk',
code: 'ibk',
invFile: 'invrbk',
name: 'Tome of Identify',
nameZh: '鉴定之书 (Tome of Identify)',
baseNameZh: '法术书 (数量: 20)',
quality: 'normal',
invWidth: 1,
invHeight: 2,
allowedSlots: [],
quantity: 20,
maxQuantity: 20,
stats: [{ text: '鉴定未辨识的魔法/暗金装备', color: 'white' }],
},
},
{
col: 3,
row: 0,
item: {
id: 'bag-torch',
code: 'cm2',
invFile: 'invtrch',
name: 'Hellfire Torch',
nameZh: '地狱火炬 (Hellfire Torch)',
baseNameZh: '大型护身符 (Large Charm)',
quality: 'unique',
invWidth: 1,
invHeight: 2,
allowedSlots: [],
reqLevel: 75,
stats: [
{ text: '击中时有 5% 几率施放等级 10 火风暴', color: 'blue' },
{ text: '+3 法师技能等级', color: 'blue' },
{ text: '+20 所有属性', color: 'blue' },
{ text: '所有抗性 +20', color: 'blue' },
{ text: '+8 照亮范围', color: 'blue' },
],
},
},
{
col: 3,
row: 2,
item: {
id: 'bag-anni',
code: 'cm1',
invFile: 'invmss',
name: 'Annihilus',
nameZh: '毁灭 (Annihilus)',
baseNameZh: '小型护身符 (Small Charm)',
quality: 'unique',
invWidth: 1,
invHeight: 1,
allowedSlots: [],
reqLevel: 70,
stats: [
{ text: '+1 所有技能 (+1 To All Skills)', color: 'blue' },
{ text: '+20 所有属性', color: 'blue' },
{ text: '所有抗性 +20', color: 'blue' },
{ text: '+10% 获得经验值', color: 'blue' },
],
},
},
{
col: 4,
row: 0,
item: {
id: 'bag-gheeds',
code: 'cm3',
invFile: 'invch3',
name: "Gheed's Fortune",
nameZh: '基德的运气 (Gheed\'s Fortune)',
baseNameZh: '超大型护身符 (Grand Charm)',
quality: 'unique',
invWidth: 1,
invHeight: 3,
allowedSlots: [],
reqLevel: 62,
stats: [
{ text: '160% 额外金币从怪物身上取得', color: 'blue' },
{ text: '40% 更佳机会取得魔法装备 (MF)', color: 'blue' },
{ text: '降低所有商店价格 15%', color: 'blue' },
],
},
},
{
col: 8,
row: 0,
item: {
id: 'bag-cta',
code: 'crs',
invFile: 'invcrs',
name: 'Call to Arms',
nameZh: '战争召唤 (Call to Arms)',
baseNameZh: '水晶剑 (Crystal Sword)',
quality: 'rune',
runewordRunes: "'AmnRalMalIstOhm'",
invWidth: 2,
invHeight: 3,
allowedSlots: ['weapon1'],
damage: '17 - 52',
durability: { current: 20, max: 20 },
reqStr: 43,
reqLevel: 57,
sockets: 5,
speedText: '剑类 - 极快的攻击速度',
stats: [
{ text: '+1 所有技能 (+1 To All Skills)', color: 'blue' },
{ text: '+40% 增加攻击速度 (+40% Increased Attack Speed)', color: 'blue' },
{ text: '+255% 增强伤害 (+255% Enhanced Damage)', color: 'blue' },
{ text: '增加 5-30 火焰伤害 (Adds 5-30 Fire Damage)', color: 'blue' },
{ text: '7% 生命偷取 / 每次命中偷取生命 (7% Life Stolen)', color: 'blue' },
{ text: '防止怪物自愈 / 防止怪物自疗 (Prevent Monster Heal)', color: 'blue' },
{ text: '+6 战斗体制 (Battle Orders)', color: 'blue' },
{ text: '+6 战斗指挥 (Battle Command)', color: 'blue' },
{ text: '+4 战斗狂嗥 / 战嚎 (Battle Cry)', color: 'blue' },
{ text: '生命回复 +12 / 生命补满 +12 (Replenish Life +12)', color: 'blue' },
{ text: '30% 更佳机会取得魔法装备 (30% Better Chance of Getting Magic Items)', color: 'blue' },
],
},
},
]
export const DEMO_BELT_POTIONS: readonly BeltPotion[] = [
{
id: 'pot-hp-1',
code: 'hp4',
invFile: 'invhp4',
name: 'Greater Healing Potion',
nameZh: '强效治疗药剂',
kind: 'hp',
healHp: 180,
healMana: 0,
},
{
id: 'pot-hp-2',
code: 'hp5',
invFile: 'invhp5',
name: 'Super Healing Potion',
nameZh: '超级治疗药剂',
kind: 'hp',
healHp: 320,
healMana: 0,
},
{
id: 'pot-mp-1',
code: 'mp4',
invFile: 'invmp4',
name: 'Greater Mana Potion',
nameZh: '强效法力药剂',
kind: 'mana',
healHp: 0,
healMana: 150,
},
{
id: 'pot-rv-1',
code: 'rvl',
invFile: 'invvpl',
name: 'Full Rejuvenation Potion',
nameZh: '全面回复活力药剂',
kind: 'rejuv',
healHp: 400,
healMana: 400,
},
]
/** Fill every 4x4 belt slot with the demo potion of its column. */
export function seedDemoBeltPotions<T extends BeltModel>(belt: T): T {
for (let row = 0; row < BELT_ROWS; row++) {
for (let col = 0; col < BELT_COLS; col++) {
const template = DEMO_BELT_POTIONS[col]!
belt.grid[row]![col] = { ...template, id: `${template.id}-r${row}-c${col}` }
}
}
return belt
}