Update Healer Man server

This commit is contained in:
phenom committed 2026-10-04 13:13:35 -04:00
1 parent 39458d5de6
commit 6cc1b9217f
203 files changed
+133929 -31271

No files matched your search

@@ -35,6 +35,18 @@ const MAGIC_COLLECT_RECORD_SIZE = 1032;
const MAGIC_OBJECT_RECORD_SIZE = 992;
const MAGIC_COLLECT_TYPE = 21;
const MAGIC_OBJECT_TYPE = 3;
const PHYSICAL_CALCULATION_TYPES = new Set([0, 3, 9]);
const MAGICAL_CALCULATION_TYPES = new Set([1, 10]);
const SOURCE_CHANNELS = ["earth", "water", "fire", "wind", "light", "darkness"];
const RUNTIME_SCHOOLS_BY_SOURCE_CHANNEL = {
earth: "nature",
water: "frost",
fire: "fire",
wind: "nature",
light: "holy",
darkness: "shadow",
physical: "physical",
};
function sha256(buffer) {
return createHash("sha256").update(buffer).digest("hex");
@@ -128,6 +140,7 @@ function magicComponent(id) {
magicFunc,
magicType,
effectType,
calculationType: int32(magicObject, offset + 0x2d4),
attackType,
damagePower,
fixedValue,
@@ -141,10 +154,27 @@ function magicComponent(id) {
return result;
}
function sourceDamageClassForCalculationType(calculationType) {
if (PHYSICAL_CALCULATION_TYPES.has(calculationType)) return "physical";
if (MAGICAL_CALCULATION_TYPES.has(calculationType)) return "magical";
return undefined;
}
function sourceChannelForMagicType(magicType) {
if (magicType === -1) return "physical";
return SOURCE_CHANNELS[magicType];
}
function schoolFor(component) {
if (component.effectType === 1) return "physical";
return ["nature", "frost", "fire", "nature", "holy", "shadow"][component.magicType]
?? "arcane";
const sourceChannel = sourceChannelForMagicType(component.magicType);
return sourceChannel ? RUNTIME_SCHOOLS_BY_SOURCE_CHANNEL[sourceChannel] : undefined;
}
function attackKindForCalculationType(calculationType) {
if (calculationType === 0 || calculationType === 9) return "melee";
if (calculationType === 3) return "ranged";
if (calculationType === 1 || calculationType === 10) return "spell";
return undefined;
}
function formulaFor(spellId, component) {
@@ -159,7 +189,8 @@ function formulaFor(spellId, component) {
spellId,
componentId: component.id,
spellLevel: 0,
calculationPath: component.effectType === 1 ? "physical" : "magic",
calculationPath: sourceDamageClassForCalculationType(component.calculationType) === "physical"
? "physical" : "magic",
powerKind,
damagePower: component.damagePower,
fixedValue: component.fixedValue,
@@ -257,12 +288,23 @@ for (const [spellId, assignmentMap] of [...assignmentsBySpell].sort((left, right
const effectRange = int32(magicCollect, offset + 0xc0);
const rangeType = int32(magicCollect, offset + 0xc4);
const sourceCooldownSeconds = int32(magicCollect, offset + 0x108);
const primaryDamage = damageComponents[0];
const runtimeDamageComponents = damageComponents.filter((component) => (
sourceDamageClassForCalculationType(component.calculationType)
&& attackKindForCalculationType(component.calculationType)
&& schoolFor(component)
));
const primaryDamage = runtimeDamageComponents[0];
const unsupportedReasons = [];
if (!components.length) unsupportedReasons.push("No referenced MagicObjectDB components were found.");
if (!damageComponents.length) {
unsupportedReasons.push("No component is positively classified as direct HP damage.");
}
if (damageComponents.length !== runtimeDamageComponents.length) {
unsupportedReasons.push(
(damageComponents.length - runtimeDamageComponents.length)
+ " direct-damage component(s) have an unsupported Attack.CalType or MagicType.",
);
}
if (components.length !== damageComponents.length) {
unsupportedReasons.push(
(components.length - damageComponents.length)
@@ -294,7 +336,9 @@ for (const [spellId, assignmentMap] of [...assignmentsBySpell].sort((left, right
delivery: range > 5 ? "projectile" : "melee",
target: "primary",
school: schoolFor(primaryDamage),
animation: range > 5 || primaryDamage.effectType === 0 ? "cast" : "attack",
runewakerEffectType: sourceDamageClassForCalculationType(primaryDamage.calculationType) === "magical" ? 0 : 1,
attackKind: attackKindForCalculationType(primaryDamage.calculationType),
animation: range > 5 || attackKindForCalculationType(primaryDamage.calculationType) === "spell" ? "cast" : "attack",
range,
cooldownMs: Math.max(2500, Math.min(20000, sourceCooldownSeconds > 0
? sourceCooldownSeconds * 1000