Files
Server/src/engine/objects/NPCRune.java
T
MagicBotandClaude Opus 5.5 4170749a59 Load rune skill reqs from rune_skill_grant instead of static_skill_skillreq
SkillReq.getSkillReqsForRune builds each rune's list from the RUNE JSON
on first use and caches it: skill_value is the grant level and
skill_granted_skills are the prereqs. The prereq amounts (80, Warrior 50,
Sun Dancer 60) are loaded but not yet read; CharacterSkill keeps its
hard-coded 80 and validForWarrior.
Parity (scripts/p29.py): 47 of 79 DB runes match. Value changes (JSON
wins, Task 2.9 decisions):
- Thief Dagger Mastery, Throwing, Unarmed Combat Mastery: level 15 -> 20
- Sentinel Axe/Great Axe/Hammer/Great Hammer/Sword Mastery: 20 -> 15;
  gains Great Sword Mastery (15, Sword); loses Wear Armor, Medium
- Channeler loses Sword; Storm Lord loses Stormcalling
- Blood Horn gains Hammer Mastery (20, Hammer)
- No weapon prereq any more on Archer Archery, Blade Weaver Blade Weaving,
  Sun Dancer Sun Dancing and the 11 Master of X talents
- No effect: Druid/Prelate Sword and Fury Spear 10 -> 1 (promotion is at
  10), discipline/talent level changes (they need level 20), Throwing
  prereqs (always granted), Blade Master Sword prereq (granted at 1)
- JSON-only runes (Archon, Duelist, War Correspondent, Pet, mob/guard
  races) gain lists; Archon resistances and Duelist Dueling are not
  skills and are skipped with a warning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 09:19:38 -04:00

121 lines
3.8 KiB
Java

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2026
// https://www.magicbane.com
package engine.objects;
import engine.gameManager.DbManager;
import engine.net.ByteBufferWriter;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class NPCRune extends AbstractGameObject {
private final RuneBase runeBase;
private final int player;
private final ArrayList<SkillReq> skillsGranted;
private final ArrayList<RuneBaseEffect> effectsGranted;
/**
* No Table ID Constructor
*/
public NPCRune(RuneBase runeBase, int characterID) {
super();
this.runeBase = runeBase;
this.player = characterID;
if (this.runeBase != null)
this.skillsGranted = SkillReq.getSkillReqsForRune(this.runeBase.getObjectUUID());
else
this.skillsGranted = new ArrayList<>();
this.effectsGranted = new ArrayList<>();
}
/**
* Normal Constructor
*/
public NPCRune(RuneBase runeBase, int characterID, int newUUID) {
super(newUUID);
this.runeBase = runeBase;
this.player = characterID;
if (this.runeBase == null)
this.skillsGranted = SkillReq.getSkillReqsForRune(this.runeBase.getObjectUUID());
else
this.skillsGranted = new ArrayList<>();
this.effectsGranted = new ArrayList<>();
}
/**
* ResultSet Constructor
*/
public NPCRune(ResultSet rs) throws SQLException {
super(rs);
this.runeBase = RuneBase.getRuneBase(rs.getInt("RuneBaseID"));
this.player = rs.getInt("NpcID");
if (this.runeBase != null) {
this.skillsGranted = SkillReq.getSkillReqsForRune(this.runeBase.getObjectUUID());
this.effectsGranted = DbManager.RuneBaseEffectQueries.GET_EFFECTS_FOR_RUNEBASE(this.runeBase.getObjectUUID());
} else {
Logger.error("Failed to find RuneBase for NPCRune " + this.getObjectUUID());
this.skillsGranted = new ArrayList<>();
this.effectsGranted = new ArrayList<>();
}
}
public static void serializeForClientMsg(NPCRune npcRune, ByteBufferWriter writer) {
if (npcRune.runeBase != null) {
writer.putInt(npcRune.runeBase.getType());
writer.putInt(0);
writer.putInt(npcRune.runeBase.getObjectUUID());
writer.putInt(npcRune.getObjectType().ordinal());
writer.putInt(npcRune.getObjectUUID());
} else {
for (int i = 0; i < 5; i++)
writer.putInt(0);
}
}
/*
* Getters
*/
public RuneBase getRuneBase() {
return this.runeBase;
}
public int getRuneBaseID() {
if (this.runeBase != null)
return this.runeBase.getObjectUUID();
return 0;
}
public int getPlayerID() {
return this.player;
}
public ArrayList<SkillReq> getSkillsGranted() {
return this.skillsGranted;
}
/*
* Serializing
*/
public ArrayList<RuneBaseEffect> getEffectsGranted() {
return this.effectsGranted;
}
@Override
public void updateDatabase() {
}
}