Skip to content

feat(items): arcane runic sockets, elemental gemstone infusions, and chiseling risk engine - #198

Open
angelTomo9 wants to merge 3 commits into
Bitcoindefi:mainfrom
angelTomo9:feat-runic-sockets-1787857310623
Open

feat(items): arcane runic sockets, elemental gemstone infusions, and chiseling risk engine#198
angelTomo9 wants to merge 3 commits into
Bitcoindefi:mainfrom
angelTomo9:feat-runic-sockets-1787857310623

Conversation

@angelTomo9

Copy link
Copy Markdown

Summary

Implements an arcane runic socket and elemental gemstone infusion engine for OpenAO MMORPG.

Features

  • Elemental gemstone infusion system (Ruby, Sapphire, Topaz, Emerald, Diamond)
  • Quality tier multipliers (Chipped to Perfect)
  • Dynamic chiseling success rates with item destruction risk thresholds
  • Compound elemental stat aggregation across equipped gear
  • Full unit test coverage under Vitest

Comment thread api/src/lib/runicSocketGemstone.ts Outdated
Comment thread api/src/lib/runicSocketGemstone.ts
@gitar-bot

gitar-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Arcane runic socket and elemental gemstone infusion system with quality tier multipliers and chiseling risk mechanics. Addresses inconsistent totalSockets reporting on item destruction and undefined returns for invalid gem types. Comprehensive test coverage included.

✅ 2 resolved
Bug: Destroyed-item results report totalSockets: 0 inconsistently

📄 api/src/lib/runicSocketGemstone.ts:89-91 📄 api/src/lib/runicSocketGemstone.ts:113-117
When chiseling fails catastrophically (or when the item is already destroyed), the method returns totalSockets: 0 but leaves item.totalSockets unchanged (e.g. still 1 or 2). Callers that trust the returned value will disagree with the actual object state, and a subsequent chiselSocket call on the same object would still read the old count. Return item.totalSockets in these branches (or reset item.totalSockets = 0 if destruction is meant to clear sockets) so the response and the mutated object stay consistent.

Edge Case: createGem returns undefined for unknown gem types at runtime

📄 api/src/lib/runicSocketGemstone.ts:40-54
The switch in createGem has no default branch. TypeScript considers it exhaustive over GemstoneType, so no compile error, but if an invalid value reaches this function at runtime (e.g. from deserialized/API input cast to the type) the function falls through and returns undefined, which then crashes in insertGem/aggregateStats when .weaponBonus/.armorBonus is accessed. Add a default that throws a descriptive error to fail fast.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant