一键导入
foundry-reference
Look up Foundry VTT API, data structures, and patterns. Find classes, methods, events, and configuration options.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Look up Foundry VTT API, data structures, and patterns. Find classes, methods, events, and configuration options.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Look up how the legacy D35E Foundry system stores mechanics. Use when writing migration scripts, designing dnd35e field equivalents, checking actor data paths (abilities, HP, saves, BAB, AC, skills), item type schemas (weapon, buff, spell, class, equipment), or understanding the changes[] modification template. System ID is D35E (all caps).
Look up planning phases, track progress, and understand phase dependencies. Find which phase covers a feature or system.
Step-by-step workflows for adding new item types, mechanics, compendium entries, and features from planning to code.
Compare D35E (legacy Foundry system), dnd5e, and PF2e implementations side-by-side. Use when deciding data structure for a new item type, comparing buff/AE/RuleElement approaches, checking HP/saves/BAB/AC paths across systems, reviewing condition implementations, or understanding why dnd35e chose a particular design over the D35E approach.
Look up raw D&D 3.5e SRD rules as written. Use when asked about spells (Fireball, Cure Moderate Wounds), feats (prerequisites, Power Attack), conditions (Stunned, Prone, Grappled), combat mechanics (iterative attacks, AoO, grapple, two-weapon fighting), saving throw DCs, or any rules-as-written question. Searches local SRD journal and d20srd.org.
Analyze, improve, and maintain phase planning documentation. Use when: consolidating redundant sections, reorganizing phase structure, updating checklists, moving deferred work, adding cross-references, or improving decision frameworks.
| name | foundry-reference |
| description | Look up Foundry VTT API, data structures, and patterns. Find classes, methods, events, and configuration options. |
Ask questions like:
This skill helps you:
Actor (PlayersCharacters, Companions, Monsters, NPCs)
├── Item (weapons, spells, abilities)
├── Sheet (UI for editing actor)
└── Effects (modifiers, auras, temporary effects)
Item (Weapon, Spell, Feat, Armor, etc.)
├── Sheet (UI for editing item)
└── Effects (modifiers added by item)
Scene (Battle maps, exploration areas)
├── Token (Placed actor instance)
└── Drawings (Markers, info graphics)
Compendium (Packed data collections)
└── Entries (Items, Actors, Scenes, Macros)
ChatMessage (Spell rolls, combat actions logged)
Macro / SceneNote / … (Other document types)
Document (Actor, Item, etc.)
├── system [DataModel] ← dnd35e-specific data
└── data [Legacy] ← general fields (name, type, etc.)
DataModel (Item's system field)
└── Fields [DataField] ← individual persisted fields
├── NumberField (stats)
├── StringField (text)
├── SchemaField (nested objects)
└── Specialized fields (PriceField, FormulaField)
// Find actors
game.actors.getName("Goblin King");
game.actors.get(actorId);
game.actors.filter(a => a.type === 'npc');
// Find items in actor
actor.items.getName("Longsword");
actor.items.filter(i => i.type === 'weapon');
// Query compendium
const pack = game.packs.get('dnd35e.weapons-core');
const item = await pack.getDocument(itemId);
const weapons = await pack.getDocuments({ type: 'weapon' });
// Search all
game.actors.contents // All actors
game.scenes.contents // All scenes
game.items.contents // GM items only (legacy)
// Create new actor
await Actor.create({
name: "New NPC",
type: "npc",
system: { hardness: 10 }
});
// Update actor (delta merge)
await actor.update({
'name': 'Updated Name',
'system.abilities.str.value': 18
});
// Update source (no saves to server)
actor.updateSource({
'system.hp.value': 50
});
// Delete
await actor.delete();
// Document hooks
Hooks.on('createActor', (actor, options, userId) => {});
Hooks.on('updateActor', (actor, update, options, userId) => {});
Hooks.on('deleteActor', (actor, options, userId) => {});
// Sheet hooks
Hooks.on('renderActorSheet', (sheet, html, data) => {});
Hooks.on('closeActorSheet', (sheet, html) => {});
// Custom hooks
Hooks.call('myCustomEvent', {data: 'hello'});
// Get system-specific data
const dnd35eData = item.system; // ItemDataModel instance
// Get all fields
const schema = ItemDataModel.schema;
for (const [name, field] of schema.entries()) {
console.log(name, field.constructor.name);
}
// Get rendered data (for sheets)
const data = item.toObject(); // Flattened for sheets
// In actor DataModel
static defineSchema() {
return {
properties: new SchemaField({
customField: new StringField({ initial: 'default' })
})
};
}
// Use it
actor.system.properties.customField = 'value';
class MyComponent {
constructor(actor) {
this.actor = actor;
Hooks.on('updateItem', this._onItemUpdate.bind(this));
}
_onItemUpdate(item, update, options, userId) {
if (item.actor?.id !== this.actor.id) return; // Not our actor
console.log('Item updated:', item.name, update);
}
}
// Create effect
await actor.createEmbeddedDocuments('ActiveEffect', [{
label: 'Strength Boost',
icon: 'icons/svg/aura.svg',
changes: [{
key: 'system.abilities.str.value',
mode: CONST.ACTIVE_EFFECT_MODES.ADD,
value: 5
}]
}]);
// Update effect
const effect = actor.effects.getName('Strength Boost');
await effect.update({ disabled: true }); // Disable
// Disable all effects of type 'enchantment'
for (const effect of actor.effects) {
if (effect.getFlag('dnd35e', 'effectType') === 'enchantment') {
await effect.update({ disabled: true });
}
}
// Get sheet instance
const sheet = actor.sheet;
if (sheet?.rendered) {
// Sheet is currently open
sheet.render(true); // Force refresh
}
// Get element
const html = sheet.element;
html.find('.my-button').on('click', handler);
// Application lifecycle
class MySheet extends ActorSheet {
getData(options) {
return { ...super.getData(options), extra: 'data' };
}
activateListeners(html) {
super.activateListeners(html);
html.find('.button').on('click', () => {});
}
}
System configuration files:
system.json ← System metadata, packs, icons, sheets
template.json ← Item/Actor type definitions (legacy)
lang/ ← Localization strings
icons/ ← System icons
Data files (in config):
Config/options.json ← User settings (render preferences, etc.)
Data/worlds/dev/ ← Active world data
Compendiums are .db files with packed JSON entries:
// Query packed data
const pack = game.packs.get('dnd35e.weapons-core');
const index = await pack.getIndex(); // Lightweight metadata
// Load for edit
const weapon = await pack.getDocument(itemId);
await weapon.update({...}); // Changes reflected in pack
// Batch load
const weapons = await pack.getDocuments({ type: 'weapon' });