genshin-world 4.2.0 → 4.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/ElementDamageBonusAttributeMap-Cf1kBcTu.js +12 -0
- package/dist/EnemyState-BdsrVDVv.js +13 -0
- package/dist/GameDataset-oS0Tc9KV.js +272 -0
- package/dist/KitEventKind-DinObjiq.js +33 -0
- package/dist/ReactionType-BTiek5WA.js +36 -0
- package/dist/TransformativeReactionType-DYhIEAoe.js +14 -0
- package/dist/addKitEffect-DEhZUuxo.js +19 -0
- package/dist/addKitStatus-CecgwPmO.js +8 -0
- package/dist/ainoKit-Z23iOdpE.js +110 -0
- package/dist/albedoKit-h6MSXqhl.js +132 -0
- package/dist/alhaithamKit-2VrwmZzn.js +225 -0
- package/dist/aloyKit-Dlk_fLbL.js +66 -0
- package/dist/alyoshaKit-3ky4aL_z.js +3 -0
- package/dist/amberKit-BuYU5ACZ.js +85 -0
- package/dist/arlecchinoKit-B2WJP5Y5.js +16 -0
- package/dist/ayakaKit-D7K6RdMw.js +84 -0
- package/dist/ayatoKit-qQp-Ayun.js +136 -0
- package/dist/baizhuKit-9i8Hvfeg.js +81 -0
- package/dist/barbaraKit-DMo_2qWo.js +122 -0
- package/dist/beidouKit-1lURCwhO.js +89 -0
- package/dist/bennettKit-B-ipp-MR.js +75 -0
- package/dist/candaceKit-oGYu9t5n.js +92 -0
- package/dist/castKitField-BhB1fy3l.js +21 -0
- package/dist/characterPack-B3e_YsdJ.d.ts +115 -0
- package/dist/characterPack-DzYMqBNM.js +697 -0
- package/dist/characterPack.d.ts +2 -0
- package/dist/characterPack.js +3 -0
- package/dist/charlotteKit-BjNvcN8w.js +103 -0
- package/dist/chascaKit-isny33W1.js +52 -0
- package/dist/checkIsKitShieldLive-DEn8yb0C.js +3 -0
- package/dist/chevreuseKit-BppMndmv.js +47 -0
- package/dist/chioriKit-CKfqMVtb.js +30 -0
- package/dist/chongyunKit-DeZG-qOb.js +99 -0
- package/dist/citlaliKit-BLY9P2cd.js +62 -0
- package/dist/clorindeKit-DGNp_1SZ.js +61 -0
- package/dist/collectKitEnergyDrops-4kTI3aGH.js +61 -0
- package/dist/colleiKit-CVBvP9-k.js +51 -0
- package/dist/columbinaKit-BqmNtRDK.js +279 -0
- package/dist/computeFacingAngle-DapXsgDc.js +7 -0
- package/dist/constants-6NEnGOni.js +186 -0
- package/dist/constants-BIXoNz1x.js +73 -0
- package/dist/constants-DWgLZz-I.js +45 -0
- package/dist/constants-jHIdcxxW.js +3 -0
- package/dist/constants-r10WzaUG.js +48 -0
- package/dist/consumeKitResource-DknosO6e.js +17 -0
- package/dist/countKitResource-CPve-dw2.js +4 -0
- package/dist/createWindriseGroundPaint-CtFTL5uW.js +293 -0
- package/dist/cynoKit-bhub8RfD.js +203 -0
- package/dist/dahliaKit-BeEPFn33.js +20 -0
- package/dist/dehyaKit-1qJYvLv-.js +23 -0
- package/dist/dilucKit-DslGKmxO.js +166 -0
- package/dist/dionaKit-B33zk3GI.js +68 -0
- package/dist/doriKit-BmYySQcG.js +24 -0
- package/dist/durinKit-CpCXxj-r.js +49 -0
- package/dist/emilieKit-BZqz4PVs.js +20 -0
- package/dist/emitKitEvent-Cb-ZHu50.js +11 -0
- package/dist/escoffierKit-DFRj0Hpo.js +95 -0
- package/dist/eulaKit-BzD8ye_S.js +144 -0
- package/dist/faruzanKit-C5WQz91G.js +72 -0
- package/dist/findKitStatus-Dj_zauGj.js +3 -0
- package/dist/fischlKit-e4xAt26v.js +95 -0
- package/dist/flinsKit-D82N06z5.js +30 -0
- package/dist/freminetKit-Dq9ebIts.js +20 -0
- package/dist/furinaKit-CzTKkE0N.js +289 -0
- package/dist/gainKitResource-3F1z8Aco.js +14 -0
- package/dist/gainPartyMemberEnergy-DUbIxe6i.js +10 -0
- package/dist/gamingKit-yxYvslgf.js +25 -0
- package/dist/ganyuKit-B2pxzHKL.js +84 -0
- package/dist/getActiveCharacterId-D9TtVSWj.js +9 -0
- package/dist/getBuffedCombatant-CwXmBrc6.js +94 -0
- package/dist/getDeployedCharacterIds-TuIRCNKb.js +3 -0
- package/dist/getDeployedCombatants-BQdLjZha.js +16 -0
- package/dist/getPartyMember-BAb9wUiz.js +8 -0
- package/dist/gorouKit--Luf6-WZ.js +153 -0
- package/dist/heizouKit-DRleoyzF.js +49 -0
- package/dist/huTaoKit-WDMpqAzD.js +146 -0
- package/dist/iansanKit-BPzX4C36.js +145 -0
- package/dist/ifaKit-Z57TFRSg.js +39 -0
- package/dist/illugaKit-86u4wqrU.js +111 -0
- package/dist/index-C5rNBYhp.d.ts +26017 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +48495 -0
- package/dist/ineffaKit-D0SA01X2.js +154 -0
- package/dist/ittoKit-hM51Mywb.js +132 -0
- package/dist/jahodaKit-CqtBpzVS.js +344 -0
- package/dist/jeanKit-fwjmnF1v.js +89 -0
- package/dist/kachinaKit-Dyh5F-ob.js +6 -0
- package/dist/kaeyaKit-SBM0QxJ5.js +91 -0
- package/dist/kavehKit-1XyMxtUb.js +33 -0
- package/dist/kazuhaKit-C726LLZy.js +76 -0
- package/dist/keqingKit-O_V-tx1h.js +100 -0
- package/dist/kinichKit-DIVa0P5s.js +71 -0
- package/dist/kiraraKit-nS9iOECm.js +70 -0
- package/dist/kleeKit-DzbELTyN.js +95 -0
- package/dist/kokomiKit-BRzXNRVb.js +83 -0
- package/dist/kujouSaraKit-BpN3Ipay.js +95 -0
- package/dist/kukiKit-DRdmE41e.js +70 -0
- package/dist/lanYanKit-CRK1J-LX.js +26 -0
- package/dist/laumaKit-CRc88J5l.js +161 -0
- package/dist/laylaKit-B7Pjqgzw.js +180 -0
- package/dist/linneaKit-CVZeam_T.js +3 -0
- package/dist/lisaKit-BJqj8t7j.js +65 -0
- package/dist/lohenKit-BZk4IiPV.js +3 -0
- package/dist/lynetteKit-CfwhsLsJ.js +39 -0
- package/dist/lyneyKit-BQiI15dt.js +42 -0
- package/dist/mavuikaKit-MMBY1DJn.js +21 -0
- package/dist/mikaKit-BIMafqBI.js +20 -0
- package/dist/mizukiKit-CC34yGgJ.js +57 -0
- package/dist/monaKit-BlrXXHlB.js +145 -0
- package/dist/mualaniKit-BUTB11j2.js +6 -0
- package/dist/nahidaKit-ZHrD7-m7.js +112 -0
- package/dist/naviaKit-DDttg5Dp.js +139 -0
- package/dist/neferKit-Z-QBM46z.js +29 -0
- package/dist/neuvilletteKit-B4EhID2O.js +117 -0
- package/dist/nicoleKit-Dmrpe0yU.js +281 -0
- package/dist/nilouKit-CoztU-uZ.js +104 -0
- package/dist/ningguangKit-BGOXmwd-.js +112 -0
- package/dist/noelleKit-nl5ar8f1.js +147 -0
- package/dist/odetteKit-Bu1W8GX7.js +101 -0
- package/dist/ororonKit-CboDk9B8.js +91 -0
- package/dist/pruneKit-xgQ9cym6.js +34 -0
- package/dist/qiqiKit-lz_qLyLu.js +104 -0
- package/dist/raidenKit-CVTi4bpy.js +152 -0
- package/dist/razorKit-BHyrlVEl.js +121 -0
- package/dist/readCharacterAvatar-xauJoD8Q.js +291 -0
- package/dist/removeKitEffects-Csap9Xyn.js +5 -0
- package/dist/rosariaKit-DEpP8gj7.js +59 -0
- package/dist/sandroneKit-C7vjjwWY.js +3 -0
- package/dist/save-W-sjOoN_.js +2475 -0
- package/dist/save.d.ts +2 -0
- package/dist/save.js +1 -0
- package/dist/sayuKit-DQbPlL_6.js +67 -0
- package/dist/sceneExport-3Se7hlVa.js +26 -0
- package/dist/sceneExport-C-q_cRxm.d.ts +57 -0
- package/dist/sceneExport.d.ts +2 -0
- package/dist/sceneExport.js +1 -0
- package/dist/sethosKit-o-Tz2GFI.js +6 -0
- package/dist/shenheKit-Xu_rt5aN.js +152 -0
- package/dist/sigewinneKit-NOWCcIW4.js +21 -0
- package/dist/skirkKit-CK183sCe.js +9 -0
- package/dist/spendKitResource-CC5kZDgu.js +9 -0
- package/dist/style.css +4570 -0
- package/dist/sucroseKit-Brr_FwwP.js +124 -0
- package/dist/tartagliaKit-DQzYxDRn.js +136 -0
- package/dist/terrainTileWorker.d.ts +1 -0
- package/dist/terrainTileWorker.js +80 -0
- package/dist/thomaKit-CesNlmDH.js +95 -0
- package/dist/tighnariKit-B9BZlgE9.js +45 -0
- package/dist/varesaKit-D5iKxzdo.js +36 -0
- package/dist/varkaKit-CNpU_rb3.js +3 -0
- package/dist/ventiKit-CM94zgZy.js +52 -0
- package/dist/vesnaKit-DtGBZlNW.js +3 -0
- package/dist/vodyanitsaKit-BurO3Fqh.js +3 -0
- package/dist/wandererKit-CW3sLw53.js +8 -0
- package/dist/wriothesleyKit-CPwNVWnr.js +102 -0
- package/dist/xianglingKit-DAFhr2LW.js +113 -0
- package/dist/xianyunKit-G4ateSub.js +107 -0
- package/dist/xiaoKit-CQljYrZS.js +104 -0
- package/dist/xilonenKit-39u8vLuk.js +41 -0
- package/dist/xingqiuKit-nURrQ7vt.js +126 -0
- package/dist/xinyanKit-DU0WpVms.js +144 -0
- package/dist/yaeMikoKit-kSDqAFyn.js +56 -0
- package/dist/yanfeiKit-Cst973qA.js +118 -0
- package/dist/yaoyaoKit-6yjjf3np.js +201 -0
- package/dist/yelanKit-SSdzqMQa.js +78 -0
- package/dist/yoimiyaKit-DqiQvgAt.js +90 -0
- package/dist/yunjinKit-lCP6TTRP.js +86 -0
- package/dist/zhongliKit-CTjDWUoW.js +109 -0
- package/dist/zibaiKit-CatYt9BG.js +62 -0
- package/package.json +11 -14
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import "./GameDataset-oS0Tc9KV.js";
|
|
2
|
+
import { f as FIXED_STEP_SECONDS } from "./constants-DWgLZz-I.js";
|
|
3
|
+
import { t as getPartyMember } from "./getPartyMember-BAb9wUiz.js";
|
|
4
|
+
import "./KitEventKind-DinObjiq.js";
|
|
5
|
+
import { t as castKitField } from "./castKitField-BhB1fy3l.js";
|
|
6
|
+
import { t as removeKitEffects } from "./removeKitEffects-Csap9Xyn.js";
|
|
7
|
+
import { buffKitMember, castKitSummon, endPartyMemberSkillCooldown, scheduleKitTask } from "./index.js";
|
|
8
|
+
import { takeOne } from "@esposter/shared";
|
|
9
|
+
// src/services/kit/characters/razorKit.ts
|
|
10
|
+
const ELECTRO_SIGIL_MAX_COUNT = 3;
|
|
11
|
+
const ELECTRO_SIGIL_SOURCE = "Electro Sigil";
|
|
12
|
+
const LIGHTNING_FANG_SOURCE = "Lightning Fang";
|
|
13
|
+
const WOLFS_INSTINCT_CONSTELLATION = 1;
|
|
14
|
+
const WOLFS_INSTINCT_DAMAGE_BONUS = .1;
|
|
15
|
+
const WOLFS_INSTINCT_SECONDS = 8;
|
|
16
|
+
const WOLFS_INSTINCT_SOURCE = "Wolf's Instinct";
|
|
17
|
+
const WOLF_WITHIN_ID = "razor-wolf-within";
|
|
18
|
+
const AWAKENING_ASCENSION = 1;
|
|
19
|
+
const AWAKENING_COOLDOWN_MULTIPLIER = .82;
|
|
20
|
+
const LUPUS_FULGURIS_CONSTELLATION = 6;
|
|
21
|
+
const LUPUS_FULGURIS_RECHARGE_SECONDS = 10;
|
|
22
|
+
const checkIsRazorBuff = (effect, characterId, source) => effect.kind === "buff" && effect.characterId === characterId && effect.source === source;
|
|
23
|
+
const RAZOR_CHARACTER_ID = 10000020;
|
|
24
|
+
const CONSTELLATION_2 = 2;
|
|
25
|
+
const CONSTELLATION_2_CRIT_RATE_BONUS = .1;
|
|
26
|
+
const CONSTELLATION_2_HEALTH_SHARE = .3;
|
|
27
|
+
const CONSTELLATION_4 = 4;
|
|
28
|
+
const BITE_STATUS = {
|
|
29
|
+
damageTakenBonus: 0,
|
|
30
|
+
defenseReduction: .15,
|
|
31
|
+
id: "razor-constellation-4",
|
|
32
|
+
secondsRemaining: 7
|
|
33
|
+
};
|
|
34
|
+
const getBiteStatus = ({ constellationCount }) => constellationCount >= CONSTELLATION_4 ? BITE_STATUS : void 0;
|
|
35
|
+
const createRazorKitBehaviour = ({ kit, readHits, readParameter, readSeconds }) => {
|
|
36
|
+
const sigilEnergyRecharge = readParameter("sigilEnergyRecharge");
|
|
37
|
+
const sigilEnergy = readParameter("sigilEnergy");
|
|
38
|
+
const sigilSeconds = readParameter("sigilSeconds");
|
|
39
|
+
const electroResistanceBonus = readParameter("electroResistanceBonus");
|
|
40
|
+
const wolfWithinSeconds = readParameter("wolfWithinSeconds");
|
|
41
|
+
const lightningFangSigilClearSeconds = readSeconds("lightningFangSigilClear");
|
|
42
|
+
const lightningFangHitmarkSeconds = takeOne(kit.elementalBurst.hits).hitmarkSeconds;
|
|
43
|
+
const holdHitmarkSeconds = takeOne(takeOne(kit.elementalSkillHolds ?? []).action.hits).hitmarkSeconds;
|
|
44
|
+
const soulCompanionHits = readHits("soulCompanion");
|
|
45
|
+
const lupusFulgurisHits = readHits("lupusFulguris");
|
|
46
|
+
const getElectroSigilCount = (characterId, effects) => {
|
|
47
|
+
const sigilBuff = effects.find((effect) => checkIsRazorBuff(effect, characterId, ELECTRO_SIGIL_SOURCE));
|
|
48
|
+
return sigilBuff === void 0 ? 0 : Math.round(sigilBuff.amount / sigilEnergyRecharge);
|
|
49
|
+
};
|
|
50
|
+
const addElectroSigil = (characterId, kitEffectState) => buffKitMember(kitEffectState, characterId, {
|
|
51
|
+
amount: sigilEnergyRecharge * Math.min(ELECTRO_SIGIL_MAX_COUNT, getElectroSigilCount(characterId, kitEffectState.effects) + 1),
|
|
52
|
+
attribute: "FIGHT_PROP_CHARGE_EFFICIENCY",
|
|
53
|
+
secondsRemaining: sigilSeconds,
|
|
54
|
+
source: ELECTRO_SIGIL_SOURCE
|
|
55
|
+
});
|
|
56
|
+
const scheduleElectroSigilClear = (kitEffectState, owner, hitmarkSeconds) => scheduleKitTask(kitEffectState, owner.characterId, hitmarkSeconds, ({ kitEffectState: tickEffectState, party }) => {
|
|
57
|
+
const sigilCount = getElectroSigilCount(owner.characterId, tickEffectState.effects);
|
|
58
|
+
if (sigilCount === 0) return;
|
|
59
|
+
const partyMember = getPartyMember(party, owner.characterId);
|
|
60
|
+
partyMember.energy = Math.min(owner.kit.burstEnergyCost, partyMember.energy + sigilEnergy * sigilCount);
|
|
61
|
+
removeKitEffects(tickEffectState, (effect) => checkIsRazorBuff(effect, owner.characterId, ELECTRO_SIGIL_SOURCE));
|
|
62
|
+
});
|
|
63
|
+
const castWolfWithin = (kitEffectState, owner, centre) => {
|
|
64
|
+
castKitField(kitEffectState, owner.characterId, centre, {
|
|
65
|
+
id: WOLF_WITHIN_ID,
|
|
66
|
+
nextTickSeconds: lightningFangHitmarkSeconds,
|
|
67
|
+
onTick: ({ kitEffectState: tickKitEffectState, party }, tickIndex) => {
|
|
68
|
+
if (tickIndex > 0) return;
|
|
69
|
+
if (owner.ascension >= AWAKENING_ASCENSION) endPartyMemberSkillCooldown(party, owner.characterId);
|
|
70
|
+
buffKitMember(tickKitEffectState, owner.characterId, {
|
|
71
|
+
amount: electroResistanceBonus,
|
|
72
|
+
attribute: "FIGHT_PROP_ELEC_SUB_HURT",
|
|
73
|
+
secondsRemaining: wolfWithinSeconds,
|
|
74
|
+
source: LIGHTNING_FANG_SOURCE
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
secondsRemaining: lightningFangHitmarkSeconds + wolfWithinSeconds,
|
|
78
|
+
tickIntervalSeconds: FIXED_STEP_SECONDS
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const checkIsLupusFulgurisCharging = (characterId, effects) => effects.some((effect) => effect.kind === "summon" && effect.combatant.characterId === characterId && effect.hits.some((hit) => lupusFulgurisHits.includes(hit)));
|
|
82
|
+
return {
|
|
83
|
+
burst: { onStart: ({ activeCombatant: combatant, body: { position }, kitEffectState }) => {
|
|
84
|
+
scheduleElectroSigilClear(kitEffectState, combatant, lightningFangSigilClearSeconds);
|
|
85
|
+
castWolfWithin(kitEffectState, combatant, {
|
|
86
|
+
x: position.x,
|
|
87
|
+
z: position.z
|
|
88
|
+
});
|
|
89
|
+
} },
|
|
90
|
+
getSkillCooldownMultiplier: ({ activeCombatant: combatant }) => combatant.ascension >= AWAKENING_ASCENSION ? AWAKENING_COOLDOWN_MULTIPLIER : 1,
|
|
91
|
+
getStrikeCriticalRateBonus: ({ combatant }, enemy) => combatant.constellationCount >= CONSTELLATION_2 && enemy.health / enemy.maxHealth < CONSTELLATION_2_HEALTH_SHARE ? CONSTELLATION_2_CRIT_RATE_BONUS : 0,
|
|
92
|
+
normalAttacks: kit.normalAttacks.map((strike, index) => {
|
|
93
|
+
const soulCompanionHit = takeOne(soulCompanionHits, index);
|
|
94
|
+
const lupusFulgurisHit = takeOne(lupusFulgurisHits, index);
|
|
95
|
+
const lupusFulgurisSeconds = takeOne(strike.hits).hitmarkSeconds + LUPUS_FULGURIS_RECHARGE_SECONDS;
|
|
96
|
+
return { onStart: ({ activeCombatant: combatant, body, kitEffectState }) => {
|
|
97
|
+
const isLightningFangLive = kitEffectState.effects.some((effect) => checkIsRazorBuff(effect, combatant.characterId, LIGHTNING_FANG_SOURCE));
|
|
98
|
+
if (isLightningFangLive) castKitSummon(kitEffectState, body, combatant, [soulCompanionHit], { attackTag: "ElementalBurst" });
|
|
99
|
+
if (combatant.constellationCount < LUPUS_FULGURIS_CONSTELLATION || checkIsLupusFulgurisCharging(combatant.characterId, kitEffectState.effects)) return;
|
|
100
|
+
castKitSummon(kitEffectState, body, combatant, [lupusFulgurisHit], { secondsRemaining: lupusFulgurisSeconds });
|
|
101
|
+
if (!isLightningFangLive) addElectroSigil(combatant.characterId, kitEffectState);
|
|
102
|
+
} };
|
|
103
|
+
}),
|
|
104
|
+
onKitEvent: (event, { activeCombatant, kitEffectState }, combatant) => {
|
|
105
|
+
if (event.kind === "EnergyParticleCollected" && combatant.constellationCount >= WOLFS_INSTINCT_CONSTELLATION && activeCombatant.characterId === combatant.characterId) buffKitMember(kitEffectState, combatant.characterId, {
|
|
106
|
+
amount: WOLFS_INSTINCT_DAMAGE_BONUS,
|
|
107
|
+
attribute: "FIGHT_PROP_ADD_HURT",
|
|
108
|
+
secondsRemaining: WOLFS_INSTINCT_SECONDS,
|
|
109
|
+
source: WOLFS_INSTINCT_SOURCE
|
|
110
|
+
});
|
|
111
|
+
if (event.kind !== "CharacterSwapped" || event.previousCharacterId !== combatant.characterId) return;
|
|
112
|
+
removeKitEffects(kitEffectState, (effect) => effect.kind === "field" && effect.id === WOLF_WITHIN_ID && effect.characterId === combatant.characterId || checkIsRazorBuff(effect, combatant.characterId, LIGHTNING_FANG_SOURCE));
|
|
113
|
+
},
|
|
114
|
+
skill: {
|
|
115
|
+
hits: [{ enemyStatus: getBiteStatus }],
|
|
116
|
+
onStart: ({ activeCombatant: combatant, kitEffectState }) => addElectroSigil(combatant.characterId, kitEffectState)
|
|
117
|
+
},
|
|
118
|
+
skillHolds: [{ onStart: ({ activeCombatant: combatant, kitEffectState }) => scheduleElectroSigilClear(kitEffectState, combatant, holdHitmarkSeconds) }]
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export { RAZOR_CHARACTER_ID, createRazorKitBehaviour };
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { d as readFileResponse, u as readJson } from "./characterPack-DzYMqBNM.js";
|
|
2
|
+
import { l as DATA_FETCH_TIMEOUT_MS } from "./constants-DWgLZz-I.js";
|
|
3
|
+
import { n as AVATAR_MANIFEST_FILE_NAME, t as AVATAR_BINARY_FILE_NAME } from "./sceneExport-3Se7hlVa.js";
|
|
4
|
+
import { i as AVATAR_TEXTURE_SLOTS, n as AVATAR_HUMANOID_MMD_NAME_MAP, r as AVATAR_TEXTURE_FOLDER } from "./constants-r10WzaUG.js";
|
|
5
|
+
import { InvalidOperationError, Operation } from "@esposter/shared";
|
|
6
|
+
import { CharacterMaterialKind, OUTLINE_WIDTH_SCALE, PmxSphereMode, UNIT_OUTLINE_WIDTH_KNOTS, createCharacterMaterial, createFaceDraw, createPmxTexture } from "genshin-engine";
|
|
7
|
+
import { Bone, BufferAttribute, BufferGeometry, Group, NoColorSpace, SRGBColorSpace, Skeleton, SkinnedMesh } from "three";
|
|
8
|
+
// src/services/character/avatar/createAvatarTexture.ts
|
|
9
|
+
const createAvatarTexture = async (blob, isColour) => {
|
|
10
|
+
const texture = await createPmxTexture(blob);
|
|
11
|
+
texture.colorSpace = isColour ? SRGBColorSpace : NoColorSpace;
|
|
12
|
+
texture.flipY = true;
|
|
13
|
+
texture.needsUpdate = true;
|
|
14
|
+
return texture;
|
|
15
|
+
};
|
|
16
|
+
// src/services/character/avatar/createAvatarShadingInputs.ts
|
|
17
|
+
const readSwitch = (nameFloatMap, name) => {
|
|
18
|
+
const value = nameFloatMap.get(name);
|
|
19
|
+
return value === void 0 ? void 0 : value === 1;
|
|
20
|
+
};
|
|
21
|
+
const WHITE = [
|
|
22
|
+
1,
|
|
23
|
+
1,
|
|
24
|
+
1
|
|
25
|
+
];
|
|
26
|
+
const BLACK = [
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
0
|
|
30
|
+
];
|
|
31
|
+
const readColour = (colors, name) => {
|
|
32
|
+
const colour = colors[name];
|
|
33
|
+
return colour && [
|
|
34
|
+
colour[0],
|
|
35
|
+
colour[1],
|
|
36
|
+
colour[2]
|
|
37
|
+
];
|
|
38
|
+
};
|
|
39
|
+
const readKnots = (colors, name) => {
|
|
40
|
+
const knots = colors[name];
|
|
41
|
+
return knots && [
|
|
42
|
+
knots[0],
|
|
43
|
+
knots[1],
|
|
44
|
+
knots[2]
|
|
45
|
+
];
|
|
46
|
+
};
|
|
47
|
+
const readOutlineWidthKnots = (colors) => {
|
|
48
|
+
const depths = readKnots(colors, "_OutlineWidthAdjustZs");
|
|
49
|
+
const scales = readKnots(colors, "_OutlineWidthAdjustScales");
|
|
50
|
+
if (!depths && !scales) return void 0;
|
|
51
|
+
return {
|
|
52
|
+
depths: depths ?? UNIT_OUTLINE_WIDTH_KNOTS.depths,
|
|
53
|
+
scales: scales ?? UNIT_OUTLINE_WIDTH_KNOTS.scales
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const readOutlineOffset = (nameFloatMap) => {
|
|
57
|
+
const size = nameFloatMap.get("_MaxOutlineZOffset");
|
|
58
|
+
return size === void 0 ? void 0 : {
|
|
59
|
+
blockBChannel: nameFloatMap.get("_OutlineOffsetBlockBChannel") ?? 0,
|
|
60
|
+
size: size * .01
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const readRegionValues = (name, readValue) => ({
|
|
64
|
+
five: readValue(`${name}5`),
|
|
65
|
+
four: readValue(`${name}4`),
|
|
66
|
+
one: readValue(name),
|
|
67
|
+
three: readValue(`${name}3`),
|
|
68
|
+
two: readValue(`${name}2`)
|
|
69
|
+
});
|
|
70
|
+
const readRegionColors = (colors, name, fallback = WHITE) => readRegionValues(name, (valueName) => readColour(colors, valueName) ?? fallback);
|
|
71
|
+
const readRegionFloats = (nameFloatMap, name) => readRegionValues(name, (valueName) => nameFloatMap.get(valueName) ?? 0);
|
|
72
|
+
const createAvatarShadingInputs = ({ colors, floats }, kind, slotTextureMap) => {
|
|
73
|
+
const color = readColour(colors, "_Color") ?? [
|
|
74
|
+
1,
|
|
75
|
+
1,
|
|
76
|
+
1
|
|
77
|
+
];
|
|
78
|
+
const nameFloatMap = new Map(Object.entries(floats));
|
|
79
|
+
const inputs = {
|
|
80
|
+
color,
|
|
81
|
+
coolShadowMultiplyColors: readRegionColors(colors, "_CoolShadowMultColor"),
|
|
82
|
+
faceDraw: createFaceDraw({
|
|
83
|
+
flipFactor: nameFloatMap.get("_FaceFlipFactor"),
|
|
84
|
+
rotateOffset: nameFloatMap.get("_FaceMapRotateOffset")
|
|
85
|
+
}),
|
|
86
|
+
faceMap: slotTextureMap.get("_FaceMapTex"),
|
|
87
|
+
faceSoftness: nameFloatMap.get("_FaceMapSoftness"),
|
|
88
|
+
isCoolShadow: readSwitch(nameFloatMap, "_UseCoolShadowColorOrTex"),
|
|
89
|
+
isLightMapAo: readSwitch(nameFloatMap, "_UseLightMapColorAO"),
|
|
90
|
+
isOutlineVertexWeighted: true,
|
|
91
|
+
isVertexAo: readSwitch(nameFloatMap, "_UseVertexColorAO"),
|
|
92
|
+
isVertexRampWidth: readSwitch(nameFloatMap, "_UseVertexRampWidth"),
|
|
93
|
+
kind,
|
|
94
|
+
lightArea: nameFloatMap.get("_LightArea"),
|
|
95
|
+
lightMapTexture: slotTextureMap.get("_LightMapTex"),
|
|
96
|
+
mainTexture: slotTextureMap.get("_MainTex"),
|
|
97
|
+
metalDarkColor: readColour(colors, "_MTMapDarkColor"),
|
|
98
|
+
metalLightColor: readColour(colors, "_MTMapLightColor"),
|
|
99
|
+
metalTexture: slotTextureMap.get("_MTMap"),
|
|
100
|
+
outlineOffset: readOutlineOffset(nameFloatMap),
|
|
101
|
+
outlineRegions: {
|
|
102
|
+
colors: readRegionColors(colors, "_OutlineColor", BLACK),
|
|
103
|
+
intensities: readRegionFloats(nameFloatMap, "_OutLineIntensity")
|
|
104
|
+
},
|
|
105
|
+
outlineWidthKnots: readOutlineWidthKnots(colors),
|
|
106
|
+
rampTexture: slotTextureMap.get("_PackedShadowRampTex"),
|
|
107
|
+
rampWidth: nameFloatMap.get("_ShadowRampWidth"),
|
|
108
|
+
regionTints: {
|
|
109
|
+
five: readColour(colors, "_Color5") ?? color,
|
|
110
|
+
four: readColour(colors, "_Color4") ?? color,
|
|
111
|
+
three: readColour(colors, "_Color3") ?? color,
|
|
112
|
+
two: readColour(colors, "_Color2") ?? color
|
|
113
|
+
},
|
|
114
|
+
regionToggles: {
|
|
115
|
+
five: readSwitch(nameFloatMap, "_UseMaterial5") ?? false,
|
|
116
|
+
four: readSwitch(nameFloatMap, "_UseMaterial4") ?? false,
|
|
117
|
+
three: readSwitch(nameFloatMap, "_UseMaterial3") ?? false,
|
|
118
|
+
two: readSwitch(nameFloatMap, "_UseMaterial2") ?? false
|
|
119
|
+
},
|
|
120
|
+
shadowMultiplyColors: readRegionColors(colors, "_FirstShadowMultColor"),
|
|
121
|
+
shininess: nameFloatMap.get("_Shininess"),
|
|
122
|
+
specularColor: readColour(colors, "_SpecularColor"),
|
|
123
|
+
specularMultiplier: nameFloatMap.get("_SpecMulti")
|
|
124
|
+
};
|
|
125
|
+
return Object.fromEntries(Object.entries(inputs).filter(([, value]) => value !== void 0));
|
|
126
|
+
};
|
|
127
|
+
// src/services/character/avatar/createCharacterAvatar.ts
|
|
128
|
+
const readMaterialValue = (values, name) => values[name];
|
|
129
|
+
const getMaterialKind = (materialName) => {
|
|
130
|
+
if (materialName.endsWith("Face")) return CharacterMaterialKind.Face;
|
|
131
|
+
if (materialName.endsWith("Hair")) return CharacterMaterialKind.Hair;
|
|
132
|
+
return CharacterMaterialKind.Body;
|
|
133
|
+
};
|
|
134
|
+
const createAvatarMaterial = (materialName, avatarMaterial, { lightUniforms, rampTexture, textureFileMap }, indexCount) => {
|
|
135
|
+
const slotTextureMap = /* @__PURE__ */ new Map();
|
|
136
|
+
for (const { slot } of AVATAR_TEXTURE_SLOTS) {
|
|
137
|
+
const file = avatarMaterial.textures[slot];
|
|
138
|
+
const texture = file === void 0 ? void 0 : textureFileMap.get(file);
|
|
139
|
+
if (texture) slotTextureMap.set(slot, texture);
|
|
140
|
+
}
|
|
141
|
+
const materialColour = readMaterialValue(avatarMaterial.colors, "_Color") ?? [
|
|
142
|
+
1,
|
|
143
|
+
1,
|
|
144
|
+
1,
|
|
145
|
+
1
|
|
146
|
+
];
|
|
147
|
+
const outlineColour = readMaterialValue(avatarMaterial.colors, "_OutlineColor") ?? [
|
|
148
|
+
0,
|
|
149
|
+
0,
|
|
150
|
+
0,
|
|
151
|
+
1
|
|
152
|
+
];
|
|
153
|
+
const pmxMaterial = {
|
|
154
|
+
ambientColor: [
|
|
155
|
+
0,
|
|
156
|
+
0,
|
|
157
|
+
0
|
|
158
|
+
],
|
|
159
|
+
diffuseColor: [
|
|
160
|
+
materialColour[0],
|
|
161
|
+
materialColour[1],
|
|
162
|
+
materialColour[2],
|
|
163
|
+
1
|
|
164
|
+
],
|
|
165
|
+
edgeColor: outlineColour,
|
|
166
|
+
edgeSize: (readMaterialValue(avatarMaterial.floats, "_OutlineWidth") ?? 0) * OUTLINE_WIDTH_SCALE,
|
|
167
|
+
indexCount,
|
|
168
|
+
isDoubleSided: false,
|
|
169
|
+
isOutlined: true,
|
|
170
|
+
isToonShared: false,
|
|
171
|
+
name: materialName,
|
|
172
|
+
specularColor: [
|
|
173
|
+
0,
|
|
174
|
+
0,
|
|
175
|
+
0
|
|
176
|
+
],
|
|
177
|
+
specularity: 1,
|
|
178
|
+
sphereMode: PmxSphereMode.Disabled,
|
|
179
|
+
sphereTextureIndex: -1,
|
|
180
|
+
textureIndex: -1,
|
|
181
|
+
toonIndex: -1
|
|
182
|
+
};
|
|
183
|
+
const kind = getMaterialKind(materialName);
|
|
184
|
+
const shadingInputs = createAvatarShadingInputs(avatarMaterial, kind, slotTextureMap);
|
|
185
|
+
return {
|
|
186
|
+
faceDraw: kind === CharacterMaterialKind.Face ? shadingInputs.faceDraw : void 0,
|
|
187
|
+
material: createCharacterMaterial({
|
|
188
|
+
lightUniforms,
|
|
189
|
+
pmxMaterial,
|
|
190
|
+
rampTexture,
|
|
191
|
+
shadingInputs,
|
|
192
|
+
texture: slotTextureMap.get("_MainTex")
|
|
193
|
+
})
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
const createAvatarGeometry = ({ colors, indices, joints, normals, positions, submeshes, tangents, uvs, weights }, buffer) => {
|
|
197
|
+
const geometry = new BufferGeometry();
|
|
198
|
+
const float32 = ({ length, offset }, itemSize) => new BufferAttribute(new Float32Array(buffer, offset, length), itemSize);
|
|
199
|
+
const uint16 = ({ length, offset }, itemSize) => new BufferAttribute(new Uint16Array(buffer, offset, length), itemSize);
|
|
200
|
+
geometry.setAttribute("position", float32(positions, 3));
|
|
201
|
+
geometry.setAttribute("normal", float32(normals, 3));
|
|
202
|
+
geometry.setAttribute("tangent", float32(tangents, 4));
|
|
203
|
+
geometry.setAttribute("uv", float32(uvs, 2));
|
|
204
|
+
if (colors.length > 0) geometry.setAttribute("color", float32(colors, 4));
|
|
205
|
+
geometry.setAttribute("skinIndex", uint16(joints, 4));
|
|
206
|
+
geometry.setAttribute("skinWeight", float32(weights, 4));
|
|
207
|
+
geometry.setIndex(indices.isUint32 ? new BufferAttribute(new Uint32Array(buffer, indices.offset, indices.length), 1) : uint16(indices, 1));
|
|
208
|
+
for (const [index, { count, start }] of submeshes.entries()) geometry.addGroup(start, count, index);
|
|
209
|
+
return geometry;
|
|
210
|
+
};
|
|
211
|
+
const createCharacterAvatar = ({ bones, humanoid, materials, meshes }, buffer, textureFileMap, options) => {
|
|
212
|
+
const boneList = bones.map(({ name, position, rotation, scale }) => {
|
|
213
|
+
const bone = new Bone();
|
|
214
|
+
bone.name = name;
|
|
215
|
+
bone.position.set(...position);
|
|
216
|
+
bone.quaternion.set(...rotation);
|
|
217
|
+
bone.scale.set(...scale);
|
|
218
|
+
return bone;
|
|
219
|
+
});
|
|
220
|
+
for (const [humanoidName, index] of Object.entries(humanoid)) {
|
|
221
|
+
const mmdName = AVATAR_HUMANOID_MMD_NAME_MAP[humanoidName];
|
|
222
|
+
const bone = boneList[index];
|
|
223
|
+
if (mmdName && bone) bone.name = mmdName;
|
|
224
|
+
}
|
|
225
|
+
const rootBones = [];
|
|
226
|
+
for (const [index, { parent }] of bones.entries()) {
|
|
227
|
+
const bone = boneList[index];
|
|
228
|
+
if (!bone) continue;
|
|
229
|
+
if (parent < 0) rootBones.push(bone);
|
|
230
|
+
else boneList[parent]?.add(bone);
|
|
231
|
+
}
|
|
232
|
+
const skeleton = new Skeleton(boneList);
|
|
233
|
+
const characterMaterialNameMaterialMap = /* @__PURE__ */ new Map();
|
|
234
|
+
const faces = [];
|
|
235
|
+
const skinnedMeshes = meshes.map((mesh) => {
|
|
236
|
+
const records = mesh.submeshes.map(({ count, material: materialName }) => {
|
|
237
|
+
const cachedRecord = characterMaterialNameMaterialMap.get(materialName);
|
|
238
|
+
if (cachedRecord) return cachedRecord;
|
|
239
|
+
const avatarMaterial = materials[materialName];
|
|
240
|
+
if (!avatarMaterial) throw new InvalidOperationError(Operation.Read, materialName, "is drawn by a mesh but the export does not hold it");
|
|
241
|
+
const record = createAvatarMaterial(materialName, avatarMaterial, {
|
|
242
|
+
...options,
|
|
243
|
+
textureFileMap
|
|
244
|
+
}, count);
|
|
245
|
+
characterMaterialNameMaterialMap.set(materialName, record);
|
|
246
|
+
return record;
|
|
247
|
+
});
|
|
248
|
+
const root = boneList[mesh.rootBone];
|
|
249
|
+
for (const draw of new Set(records.map(({ faceDraw }) => faceDraw))) if (draw && root && !faces.some((face) => face.draw === draw)) faces.push({
|
|
250
|
+
draw,
|
|
251
|
+
root
|
|
252
|
+
});
|
|
253
|
+
return new SkinnedMesh(createAvatarGeometry(mesh, buffer), records.map(({ material }) => material));
|
|
254
|
+
});
|
|
255
|
+
const [firstMesh] = skinnedMeshes;
|
|
256
|
+
const model = new Group();
|
|
257
|
+
if (firstMesh) {
|
|
258
|
+
firstMesh.add(...rootBones);
|
|
259
|
+
firstMesh.bind(skeleton);
|
|
260
|
+
for (const skinnedMesh of skinnedMeshes.slice(1)) skinnedMesh.bind(skeleton, firstMesh.bindMatrix);
|
|
261
|
+
}
|
|
262
|
+
model.add(...skinnedMeshes);
|
|
263
|
+
return {
|
|
264
|
+
faces,
|
|
265
|
+
model,
|
|
266
|
+
skinnedMeshes
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
// src/services/character/avatar/readCharacterAvatar.ts
|
|
270
|
+
const readCharacterAvatar = async (componentUrl, options) => {
|
|
271
|
+
const readBinary = async () => (await readFileResponse(`${componentUrl}/${AVATAR_BINARY_FILE_NAME}`, DATA_FETCH_TIMEOUT_MS)).arrayBuffer();
|
|
272
|
+
const [manifest, buffer] = await Promise.all([readJson(`${componentUrl}/${AVATAR_MANIFEST_FILE_NAME}`), readBinary()]);
|
|
273
|
+
const drawnMaterials = new Set(manifest.meshes.flatMap(({ submeshes }) => submeshes.map(({ material }) => material)));
|
|
274
|
+
const textureFiles = /* @__PURE__ */ new Set();
|
|
275
|
+
const colourFiles = /* @__PURE__ */ new Set();
|
|
276
|
+
for (const materialName of drawnMaterials) {
|
|
277
|
+
const textures = manifest.materials[materialName]?.textures ?? {};
|
|
278
|
+
for (const { isColour, slot } of AVATAR_TEXTURE_SLOTS) {
|
|
279
|
+
const file = textures[slot];
|
|
280
|
+
if (file === void 0) continue;
|
|
281
|
+
textureFiles.add(file);
|
|
282
|
+
if (isColour) colourFiles.add(file);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const textureFileEntries = await Promise.all(Array.from(textureFiles, async (file) => {
|
|
286
|
+
const blob = await (await readFileResponse(`${componentUrl}/${AVATAR_TEXTURE_FOLDER}/${file}`, DATA_FETCH_TIMEOUT_MS)).blob();
|
|
287
|
+
return [file, await createAvatarTexture(blob, colourFiles.has(file))];
|
|
288
|
+
}));
|
|
289
|
+
return createCharacterAvatar(manifest, buffer, new Map(textureFileEntries), options);
|
|
290
|
+
};
|
|
291
|
+
export { readCharacterAvatar };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "./GameDataset-oS0Tc9KV.js";
|
|
2
|
+
import { t as getDeployedCharacterIds } from "./getDeployedCharacterIds-TuIRCNKb.js";
|
|
3
|
+
import { t as castKitField } from "./castKitField-BhB1fy3l.js";
|
|
4
|
+
import { buffKitMember, castKitSummon } from "./index.js";
|
|
5
|
+
import { takeOne } from "@esposter/shared";
|
|
6
|
+
// src/services/kit/characters/rosariaKit.ts
|
|
7
|
+
const RITES_TICK_INTERVAL_SECONDS = 2;
|
|
8
|
+
const RITES_FIELD_ID = "rosaria-rites-of-termination-field";
|
|
9
|
+
const RITES_FIELD_MARGIN_SECONDS = .5;
|
|
10
|
+
const RITES_CONSTELLATION = 2;
|
|
11
|
+
const RITES_CONSTELLATION_SECONDS = 4;
|
|
12
|
+
const ASCENSION_4 = 4;
|
|
13
|
+
const ASCENSION_4_CRIT_RATE_SHARE = .15;
|
|
14
|
+
const ASCENSION_4_CRIT_RATE_MAX = .15;
|
|
15
|
+
const ASCENSION_4_SECONDS = 10;
|
|
16
|
+
const REGINA_PROBATIONUM_ASCENSION = 1;
|
|
17
|
+
const REGINA_PROBATIONUM_CRITICAL_RATE = .12;
|
|
18
|
+
const REGINA_PROBATIONUM_SECONDS = 5;
|
|
19
|
+
const REGINA_PROBATIONUM_SOURCE = "rosaria-regina-probationum";
|
|
20
|
+
const addAscension4CritRate = (combatant, kitEffectState, party) => {
|
|
21
|
+
const amount = Math.min(ASCENSION_4_CRIT_RATE_MAX, ASCENSION_4_CRIT_RATE_SHARE * combatant.attributes.attributeTotalMap["FIGHT_PROP_CRITICAL"]);
|
|
22
|
+
for (const characterId of getDeployedCharacterIds(party)) if (characterId !== combatant.characterId) buffKitMember(kitEffectState, characterId, {
|
|
23
|
+
amount,
|
|
24
|
+
attribute: "FIGHT_PROP_CRITICAL",
|
|
25
|
+
secondsRemaining: ASCENSION_4_SECONDS
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const createRosariaKitBehaviour = ({ kit, readHit, readParameter }) => {
|
|
29
|
+
const ritesLanceHit = takeOne(kit.elementalBurst.hits, 1);
|
|
30
|
+
const ritesTickHit = readHit("ritesTick");
|
|
31
|
+
const ritesFieldSeconds = readParameter("ritesOfTerminationSeconds");
|
|
32
|
+
return {
|
|
33
|
+
burst: { onStart: ({ activeCombatant: combatant, body: { facing, height, position }, kitEffectState, party }) => {
|
|
34
|
+
const field = castKitField(kitEffectState, combatant.characterId, position, {
|
|
35
|
+
id: RITES_FIELD_ID,
|
|
36
|
+
nextTickSeconds: ritesLanceHit.hitmarkSeconds + RITES_TICK_INTERVAL_SECONDS,
|
|
37
|
+
onTick: ({ kitEffectState: tickEffectState }) => castKitSummon(tickEffectState, {
|
|
38
|
+
facing,
|
|
39
|
+
height,
|
|
40
|
+
position: field.centre
|
|
41
|
+
}, combatant, [ritesTickHit], { attackTag: "ElementalBurst" }),
|
|
42
|
+
radius: ritesTickHit.hitArea.radius,
|
|
43
|
+
secondsRemaining: ritesFieldSeconds + RITES_FIELD_MARGIN_SECONDS + (combatant.constellationCount >= RITES_CONSTELLATION ? RITES_CONSTELLATION_SECONDS : 0),
|
|
44
|
+
tickIntervalSeconds: RITES_TICK_INTERVAL_SECONDS
|
|
45
|
+
});
|
|
46
|
+
if (combatant.ascension >= ASCENSION_4) addAscension4CritRate(combatant, kitEffectState, party);
|
|
47
|
+
} },
|
|
48
|
+
skill: { hits: [{ onStrike: ({ kitEffectState }, { combatant }) => {
|
|
49
|
+
if (combatant.ascension < REGINA_PROBATIONUM_ASCENSION) return;
|
|
50
|
+
buffKitMember(kitEffectState, combatant.characterId, {
|
|
51
|
+
amount: REGINA_PROBATIONUM_CRITICAL_RATE,
|
|
52
|
+
attribute: "FIGHT_PROP_CRITICAL",
|
|
53
|
+
secondsRemaining: REGINA_PROBATIONUM_SECONDS,
|
|
54
|
+
source: REGINA_PROBATIONUM_SOURCE
|
|
55
|
+
});
|
|
56
|
+
} }] }
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export { createRosariaKitBehaviour };
|