35cbd84146
Drops Alex's Mobs from the pack (105 -> 103 mods total). The 4 AM-mob bounty entries are replaced with vanilla 1.21.x mob bounties (Breeze, Bogged, Evoker, Vindicator, Piglin Brute, Ravager). Bounty board bug fix: KubeJS PlayerEvents.loggedIn now ensures the daily pool is rolled on first login. Previously the pool only rolled when a player ran /bns bounty list, so the bounty board screen showed empty for anyone who'd never typed that command. /bns tier upgrade now uses combined cash+bank deduction via NumismaticsBridge.spend (Java). Players who've sold a fortune into their bank can now spend it on tier upgrades directly. Every player gets a bound white_card on first login — no more "I need to craft + bind a card before I can spend at a Vendor block" friction. bnstoolkit 0.6.2 -> 0.7.0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
148 lines
7.0 KiB
JavaScript
148 lines
7.0 KiB
JavaScript
// Brass and Sigil -- player-facing economy commands
|
|
//
|
|
// /bns help overview of every /bns subcommand
|
|
// /bns me quick economic status (tier, balance, plots, bounties)
|
|
// /bns tier upgrade pay spurs to advance to the next tier
|
|
//
|
|
// Player-facing tier upgrade pays spurs, increments the NBT tier, and
|
|
// runs `ftbranks add <player> <rankId>` so FTB Ranks applies the rank's
|
|
// permission nodes (ftbchunks.max_claimed_chunks etc.).
|
|
|
|
// FTB Ranks rank ID per tier number (must match
|
|
// pack/overrides/world/serverconfig/ftbranks/ranks.snbt)
|
|
const TIER_RANK_ID = [
|
|
null, // 0 unused
|
|
'peasant',
|
|
'farmer',
|
|
'citizen',
|
|
'merchant',
|
|
'knight',
|
|
'baron',
|
|
'viscount',
|
|
'earl',
|
|
'marquess',
|
|
'duke',
|
|
'archduke',
|
|
'grand_duke',
|
|
'sovereign',
|
|
];
|
|
|
|
ServerEvents.commandRegistry(event => {
|
|
const { commands: Commands } = event;
|
|
|
|
const playerCmds = Commands.literal('bns')
|
|
|
|
// /bns help
|
|
.then(Commands.literal('help').executes(ctx => {
|
|
const lines = [
|
|
'§6═══ Brass and Sigil — economy commands ═══',
|
|
'§eGeneral:',
|
|
'§7 /bns help this list',
|
|
'§7 /bns me your economy status',
|
|
'§eCivic tier:',
|
|
'§7 /bns tier upgrade pay spurs to advance to next tier',
|
|
'§eSpawn plots:',
|
|
'§7 /bns plot list browse available plots',
|
|
'§7 /bns plot info <id> details for one plot',
|
|
'§7 /bns plot buy <id> purchase a plot (uses a tier slot)',
|
|
'§7 /bns plot release <id> release a plot (50% refund)',
|
|
'§7 /bns plot mine list plots you own',
|
|
'§eBazaar (sell raw commodities):',
|
|
'§7 /bns sell list prices for items you can sell',
|
|
'§7 /bns sell <item-id> [count] sell items from your inventory',
|
|
'§eBounties:',
|
|
'§7 /bns bounty list today\'s available bounties',
|
|
'§7 /bns bounty active your accepted bounties',
|
|
'§7 /bns bounty accept <id> accept a bounty',
|
|
'§7 /bns bounty cancel <id> drop a bounty (cooldown applies)',
|
|
'§7 /bns bounty turnin <id> claim reward for a completed bounty',
|
|
'§7 /bns bounty completed bounties on cooldown',
|
|
'§eAdmin (op level 2):',
|
|
'§7 /bns admin info your raw NBT state',
|
|
'§7 /bns admin tier get|set|list',
|
|
'§7 /bns admin waystone-count|waystone-set|reset-welcome',
|
|
];
|
|
for (const l of lines) ctx.source.sendSystemMessage(Text.of(l));
|
|
return 1;
|
|
}))
|
|
|
|
// /bns me — quick status
|
|
.then(Commands.literal('me').executes(ctx => {
|
|
const player = ctx.source.player;
|
|
if (!player) { ctx.source.sendSystemMessage(Text.red('Run from a player context.')); return 0; }
|
|
const tier = bnsTier.get(player);
|
|
const cfg = bnsTier.config(tier);
|
|
const balance = countCoins(player); // shared helper from plots.js
|
|
const ownedPlots = plotsOwnedBy(player.uuid.toString());
|
|
const plotCap = playerPlotSlotCap(player);
|
|
const activeBounties = getActiveMap(player);
|
|
const bountyCap = playerBountySlotCap(player);
|
|
const feePct = bnsTier.effectiveShopFeePct(player);
|
|
|
|
const lines = [
|
|
'§6═══ ' + player.username + ' — economy status ═══',
|
|
'§eCivic tier: §f' + tier + '. ' + cfg.name,
|
|
'§eSpur balance: §f' + balance,
|
|
'§ePlots owned: §f' + ownedPlots.length + ' / ' + plotCap,
|
|
'§eActive bounties: §f' + activeBounties.getAllKeys().size() + ' / ' + bountyCap,
|
|
'§eBazaar fee: §f' + feePct + '%',
|
|
'§eWilderness cap: §f' + cfg.wildernessChunks + ' chunks',
|
|
];
|
|
if (tier < 13) {
|
|
const next = bnsTier.config(tier + 1);
|
|
lines.push('§eNext tier: §f' + next.name + ' (' + next.cost + ' spurs to upgrade)');
|
|
} else {
|
|
lines.push('§eNext tier: §f— you are Sovereign, the peak of the realm.');
|
|
}
|
|
for (const l of lines) player.tell(Text.of(l));
|
|
return 1;
|
|
}))
|
|
|
|
// /bns tier upgrade
|
|
.then(Commands.literal('tier').then(Commands.literal('upgrade').executes(ctx => {
|
|
const player = ctx.source.player;
|
|
if (!player) { ctx.source.sendSystemMessage(Text.red('Run from a player context.')); return 0; }
|
|
const cur = bnsTier.get(player);
|
|
if (cur >= bnsTier.MAX) {
|
|
player.tell(Text.gold('You\'re already Sovereign. There is no higher rank.'));
|
|
return 0;
|
|
}
|
|
const nextTier = cur + 1;
|
|
const nextCfg = bnsTier.config(nextTier);
|
|
|
|
// Combined cash+bank deduction via bnstoolkit Java bridge.
|
|
// Pulls inventory coins first, then bank for the remainder.
|
|
const Bridge = Java.loadClass('uk.sijbers.bnstoolkit.economy.NumismaticsBridge');
|
|
const ok = Bridge.spend(player, nextCfg.cost);
|
|
if (!ok) {
|
|
const cash = countCoins(player);
|
|
const bank = Bridge.balanceOf(player);
|
|
player.tell(Text.red(
|
|
'Upgrade to ' + nextCfg.name + ' costs ' + nextCfg.cost + ' spurs. ' +
|
|
'You have ' + cash + ' cash + ' + bank + ' bank = ' + (cash + bank) + ' total.'
|
|
));
|
|
return 0;
|
|
}
|
|
// Promote via FTB Ranks
|
|
const rankId = TIER_RANK_ID[nextTier];
|
|
Utils.server.runCommandSilent('ftbranks add ' + player.username + ' ' + rankId);
|
|
// Mirror to NBT
|
|
bnsTier.set(player, nextTier);
|
|
player.tell(Text.gold(
|
|
'╔══ You have been elevated to ' + nextCfg.name + '! ══╗'
|
|
));
|
|
player.tell(Text.gold(
|
|
' ' + nextCfg.wildernessChunks + ' wilderness chunks · ' +
|
|
nextCfg.plotSlots + ' plot slots · ' +
|
|
nextCfg.dailyBountySlots + ' bounty slots · ' +
|
|
(Math.max(0, 25 + nextCfg.shopFeeDiscount)) + '% Bazaar fee'
|
|
));
|
|
console.info('[bns/tier] ' + player.username + ' upgraded to tier ' + nextTier + ' (' + nextCfg.name + ') for ' + nextCfg.cost + ' spurs');
|
|
return 1;
|
|
})));
|
|
|
|
event.register(playerCmds);
|
|
});
|
|
|
|
console.info('[bns/player_commands] loaded — /bns help, /bns me, /bns tier upgrade');
|