Crafting change
This commit is contained in:
+104
-12
@@ -376,7 +376,7 @@ public class CraftingHandler
|
||||
var rollResults = new List<(string Stat, int Value)>();
|
||||
|
||||
// Handle stat rolling for equipment
|
||||
if (recipe.HasStatRolls && recipe.PossibleStats.Count > 0)
|
||||
if (recipe.HasStatRolls && outputItemDef != null)
|
||||
{
|
||||
var rng = new Random();
|
||||
craftedItem = new DungeonCraftedItem
|
||||
@@ -389,22 +389,40 @@ public class CraftingHandler
|
||||
CraftingLevelAtCreation = skill.Level
|
||||
};
|
||||
|
||||
// Roll stats
|
||||
int rollCount = skill.StatRollCount;
|
||||
int minRoll = skill.MinStatRoll;
|
||||
int maxRoll = skill.MaxStatRoll;
|
||||
// Calculate skill quality bonus
|
||||
// 2x required level = 50% chance for max on each roll
|
||||
// Formula: skillBonus = min(1.0, skill.Level / (recipe.RequiredLevel * 2))
|
||||
float skillBonus = Math.Min(1.0f, (float)skill.Level / (recipe.RequiredLevel * 2));
|
||||
|
||||
int totalRolled = 0;
|
||||
int maxPossibleTotal = 0;
|
||||
|
||||
for (int i = 0; i < rollCount; i++)
|
||||
// Roll each stat that has a range defined on the item
|
||||
rollResults = RollItemStats(outputItemDef, skillBonus, rng, out totalRolled, out maxPossibleTotal);
|
||||
|
||||
// Apply rolled stats to the crafted item
|
||||
foreach (var (stat, value) in rollResults)
|
||||
{
|
||||
var stat = recipe.PossibleStats[rng.Next(recipe.PossibleStats.Count)];
|
||||
int value = rng.Next(minRoll, maxRoll + 1);
|
||||
totalRolled += value;
|
||||
maxPossibleTotal += maxRoll;
|
||||
|
||||
ApplyStatRoll(craftedItem, stat, value);
|
||||
rollResults.Add((stat, value));
|
||||
}
|
||||
|
||||
// If no ranges defined, fall back to old system using recipe's PossibleStats
|
||||
if (rollResults.Count == 0 && recipe.PossibleStats.Count > 0)
|
||||
{
|
||||
int rollCount = skill.StatRollCount;
|
||||
int minRoll = skill.MinStatRoll;
|
||||
int maxRoll = skill.MaxStatRoll;
|
||||
|
||||
for (int i = 0; i < rollCount; i++)
|
||||
{
|
||||
var stat = recipe.PossibleStats[rng.Next(recipe.PossibleStats.Count)];
|
||||
int value = RollWithSkillBonus(minRoll, maxRoll, skillBonus, rng);
|
||||
totalRolled += value;
|
||||
maxPossibleTotal += maxRoll;
|
||||
|
||||
ApplyStatRoll(craftedItem, stat, value);
|
||||
rollResults.Add((stat, value));
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate quality rating (0-100 based on how good the rolls were)
|
||||
@@ -541,6 +559,80 @@ public class CraftingHandler
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Roll item stats using the item definition's min/max ranges.
|
||||
/// Higher skill bonus = higher chance for max values.
|
||||
/// </summary>
|
||||
private List<(string Stat, int Value)> RollItemStats(
|
||||
DungeonItemDefinition item,
|
||||
float skillBonus,
|
||||
Random rng,
|
||||
out int totalRolled,
|
||||
out int maxPossibleTotal)
|
||||
{
|
||||
var results = new List<(string Stat, int Value)>();
|
||||
int rolled = 0;
|
||||
int maxTotal = 0;
|
||||
|
||||
// Helper to roll a stat
|
||||
void AddRoll(string statName, int min, int max)
|
||||
{
|
||||
if (max > min) // Only roll if there's a range
|
||||
{
|
||||
int value = RollWithSkillBonus(min, max, skillBonus, rng);
|
||||
results.Add((statName, value));
|
||||
rolled += value;
|
||||
maxTotal += max;
|
||||
}
|
||||
else if (max > 0) // Fixed value
|
||||
{
|
||||
results.Add((statName, max));
|
||||
rolled += max;
|
||||
maxTotal += max;
|
||||
}
|
||||
}
|
||||
|
||||
// Stat bonuses
|
||||
AddRoll("BonusStrength", item.MinBonusStrength, item.MaxBonusStrength);
|
||||
AddRoll("BonusIntelligence", item.MinBonusIntelligence, item.MaxBonusIntelligence);
|
||||
AddRoll("BonusWisdom", item.MinBonusWisdom, item.MaxBonusWisdom);
|
||||
AddRoll("BonusEndurance", item.MinBonusEndurance, item.MaxBonusEndurance);
|
||||
AddRoll("BonusDexterity", item.MinBonusDexterity, item.MaxBonusDexterity);
|
||||
AddRoll("BonusHealth", item.MinBonusHealth, item.MaxBonusHealth);
|
||||
AddRoll("BonusMana", item.MinBonusMana, item.MaxBonusMana);
|
||||
|
||||
// Weapon damage
|
||||
AddRoll("MinDamage", item.MinMinDamage, item.MaxMinDamage);
|
||||
AddRoll("MaxDamage", item.MinMaxDamage, item.MaxMaxDamage);
|
||||
|
||||
// Armor
|
||||
AddRoll("Armor", item.MinArmor, item.MaxArmor);
|
||||
|
||||
totalRolled = rolled;
|
||||
maxPossibleTotal = maxTotal;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Roll a value between min and max, biased toward max based on skill bonus.
|
||||
/// skillBonus of 0.5 = 50% chance to get max value
|
||||
/// skillBonus of 1.0 = always get max value
|
||||
/// </summary>
|
||||
private int RollWithSkillBonus(int min, int max, float skillBonus, Random rng)
|
||||
{
|
||||
if (min >= max) return max;
|
||||
|
||||
// Roll to see if we get max
|
||||
if (rng.NextDouble() < skillBonus)
|
||||
{
|
||||
return max;
|
||||
}
|
||||
|
||||
// Otherwise roll normally
|
||||
return rng.Next(min, max + 1);
|
||||
}
|
||||
|
||||
private void ApplyStatRoll(DungeonCraftedItem item, string stat, int value)
|
||||
{
|
||||
switch (stat)
|
||||
|
||||
+2444
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,238 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SystemRevivalServer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Craftingchange : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxArmor",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusDexterity",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusEndurance",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusHealth",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusIntelligence",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusMana",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusStrength",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxBonusWisdom",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxMaxDamage",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MaxMinDamage",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinArmor",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusDexterity",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusEndurance",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusHealth",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusIntelligence",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusMana",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusStrength",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinBonusWisdom",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinMaxDamage",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "MinMinDamage",
|
||||
table: "dungeon_item_definitions",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxArmor",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusDexterity",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusEndurance",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusHealth",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusIntelligence",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusMana",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusStrength",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxBonusWisdom",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxMaxDamage",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxMinDamage",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinArmor",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusDexterity",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusEndurance",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusHealth",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusIntelligence",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusMana",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusStrength",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinBonusWisdom",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinMaxDamage",
|
||||
table: "dungeon_item_definitions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MinMinDamage",
|
||||
table: "dungeon_item_definitions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -770,15 +770,75 @@ namespace SystemRevivalServer.Migrations
|
||||
b.Property<int>("ManaRestore")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxArmor")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusDexterity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusEndurance")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusHealth")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusIntelligence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusMana")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusStrength")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxBonusWisdom")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxDamage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxMaxDamage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxMinDamage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaxStack")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinArmor")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusDexterity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusEndurance")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusHealth")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusIntelligence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusMana")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusStrength")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinBonusWisdom")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinDamage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinMaxDamage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinMinDamage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
@page "/admin/api/{handler}"
|
||||
@model ApiModel
|
||||
@@ -0,0 +1,50 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Server.Game.Dungeon;
|
||||
|
||||
namespace Server.Services.Admin.Pages;
|
||||
|
||||
public class ApiModel : AdminPageModel
|
||||
{
|
||||
private readonly CraftingHandler _craftingHandler;
|
||||
|
||||
public ApiModel(CraftingHandler craftingHandler)
|
||||
{
|
||||
_craftingHandler = craftingHandler;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
return new JsonResult(new { error = "Method not allowed" }) { StatusCode = 405 };
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostRefreshCacheAsync([FromQuery] string? type)
|
||||
{
|
||||
var refreshed = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
if (type == null || type.Equals("recipes", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
await _craftingHandler.RefreshRecipeCacheAsync();
|
||||
refreshed.Add("recipes");
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
message = "Cache refreshed",
|
||||
refreshed,
|
||||
timestamp = DateTime.UtcNow
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = false,
|
||||
error = ex.Message
|
||||
}) { StatusCode = 500 };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,100 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Crafting Stat Ranges (Equipment) -->
|
||||
<div id="craftingRangesSection" class="card" style="display: @(isEquipment ? "block" : "none")">
|
||||
<div class="p-4 border-b border-gray-700">
|
||||
<h2 class="text-lg font-semibold text-white">Crafting Stat Ranges</h2>
|
||||
<p class="text-sm text-gray-400 mt-1">Min/Max values when crafted. Higher crafting skill = better rolls. (2x recipe level = 50% max roll chance per stat)</p>
|
||||
</div>
|
||||
<div class="p-6 space-y-4">
|
||||
<!-- Stat Bonuses Ranges -->
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4">
|
||||
<div>
|
||||
<label class="label">STR Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusStrength" value="@Model.Item.MinBonusStrength" class="input text-sm" placeholder="Min" title="Min STR" />
|
||||
<input type="number" name="Item.MaxBonusStrength" value="@Model.Item.MaxBonusStrength" class="input text-sm" placeholder="Max" title="Max STR" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">INT Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusIntelligence" value="@Model.Item.MinBonusIntelligence" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxBonusIntelligence" value="@Model.Item.MaxBonusIntelligence" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">WIS Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusWisdom" value="@Model.Item.MinBonusWisdom" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxBonusWisdom" value="@Model.Item.MaxBonusWisdom" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">END Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusEndurance" value="@Model.Item.MinBonusEndurance" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxBonusEndurance" value="@Model.Item.MaxBonusEndurance" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">DEX Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusDexterity" value="@Model.Item.MinBonusDexterity" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxBonusDexterity" value="@Model.Item.MaxBonusDexterity" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">Health Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusHealth" value="@Model.Item.MinBonusHealth" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxBonusHealth" value="@Model.Item.MaxBonusHealth" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">Mana Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinBonusMana" value="@Model.Item.MinBonusMana" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxBonusMana" value="@Model.Item.MaxBonusMana" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Weapon/Armor Ranges -->
|
||||
<div class="pt-4 border-t border-gray-700">
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<div id="minDamageRangeSection" style="display: @(isWeapon ? "block" : "none")">
|
||||
<label class="label">Min Damage Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinMinDamage" value="@Model.Item.MinMinDamage" class="input text-sm" placeholder="Min" title="Lowest possible min damage" />
|
||||
<input type="number" name="Item.MaxMinDamage" value="@Model.Item.MaxMinDamage" class="input text-sm" placeholder="Max" title="Highest possible min damage" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="maxDamageRangeSection" style="display: @(isWeapon ? "block" : "none")">
|
||||
<label class="label">Max Damage Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinMaxDamage" value="@Model.Item.MinMaxDamage" class="input text-sm" placeholder="Min" title="Lowest possible max damage" />
|
||||
<input type="number" name="Item.MaxMaxDamage" value="@Model.Item.MaxMaxDamage" class="input text-sm" placeholder="Max" title="Highest possible max damage" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">Armor Range</label>
|
||||
<div class="flex gap-1">
|
||||
<input type="number" name="Item.MinArmor" value="@Model.Item.MinArmor" class="input text-sm" placeholder="Min" />
|
||||
<input type="number" name="Item.MaxArmor" value="@Model.Item.MaxArmor" class="input text-sm" placeholder="Max" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-xs text-gray-500 pt-2">
|
||||
<strong>Tip:</strong> Leave min/max at 0 if the stat shouldn't roll. For fixed values, set min = max.
|
||||
Base values above are used for drops/vendor items. Ranges are only used when crafting with "Has Stat Rolls" enabled on recipe.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Combat Stats (Equipment) -->
|
||||
<div id="combatStatsSection" class="card" style="display: @(isEquipment ? "block" : "none")">
|
||||
<div class="p-4 border-b border-gray-700"><h2 class="text-lg font-semibold text-white">Combat Stats</h2></div>
|
||||
@@ -205,12 +299,15 @@
|
||||
const isConsumable = type === 'Consumable';
|
||||
document.getElementById('requirementsSection').style.display = isEquipment ? 'block' : 'none';
|
||||
document.getElementById('statBonusesSection').style.display = isEquipment ? 'block' : 'none';
|
||||
document.getElementById('craftingRangesSection').style.display = isEquipment ? 'block' : 'none';
|
||||
document.getElementById('combatStatsSection').style.display = isEquipment ? 'block' : 'none';
|
||||
document.getElementById('resistancesSection').style.display = isEquipment ? 'block' : 'none';
|
||||
document.getElementById('minDamageSection').style.display = isWeapon ? 'block' : 'none';
|
||||
document.getElementById('maxDamageSection').style.display = isWeapon ? 'block' : 'none';
|
||||
document.getElementById('attackRangeSection').style.display = isWeapon ? 'block' : 'none';
|
||||
document.getElementById('damageTypeSection').style.display = isWeapon ? 'block' : 'none';
|
||||
document.getElementById('minDamageRangeSection').style.display = isWeapon ? 'block' : 'none';
|
||||
document.getElementById('maxDamageRangeSection').style.display = isWeapon ? 'block' : 'none';
|
||||
document.getElementById('consumableSection').style.display = isConsumable ? 'block' : 'none';
|
||||
}
|
||||
function addResistance() {
|
||||
|
||||
@@ -214,14 +214,14 @@
|
||||
btn.innerHTML = '<svg class="w-5 h-5 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Refreshing...';
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/admin/cache/refresh?type=recipes', {
|
||||
const response = await fetch('/admin/api/refresh-cache?type=recipes', {
|
||||
method: 'POST',
|
||||
headers: { 'Authorization': 'Bearer ' + (localStorage.getItem('adminToken') || '') }
|
||||
credentials: 'same-origin'
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
alert('Recipe cache refreshed! ' + (data.refreshed?.join(', ') || ''));
|
||||
if (response.ok && data.success) {
|
||||
alert('Recipe cache refreshed successfully!');
|
||||
} else {
|
||||
alert('Error: ' + (data.error || 'Failed to refresh cache'));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DungeonItemDefinition
|
||||
public int RequiredDexterity { get; set; } = 0;
|
||||
public int RequiredLevel { get; set; } = 1;
|
||||
|
||||
// Stat bonuses when equipped
|
||||
// Stat bonuses when equipped (base values - used for drops/purchases)
|
||||
public int BonusStrength { get; set; } = 0;
|
||||
public int BonusIntelligence { get; set; } = 0;
|
||||
public int BonusWisdom { get; set; } = 0;
|
||||
@@ -41,7 +41,35 @@ public class DungeonItemDefinition
|
||||
public int BonusHealth { get; set; } = 0;
|
||||
public int BonusMana { get; set; } = 0;
|
||||
|
||||
// Weapon stats
|
||||
// Stat ranges for crafting (if HasStatRolls on recipe)
|
||||
// When crafting, each stat is rolled between Min and Max
|
||||
// Higher crafting skill = higher chance for max rolls
|
||||
public int MinBonusStrength { get; set; } = 0;
|
||||
public int MaxBonusStrength { get; set; } = 0;
|
||||
public int MinBonusIntelligence { get; set; } = 0;
|
||||
public int MaxBonusIntelligence { get; set; } = 0;
|
||||
public int MinBonusWisdom { get; set; } = 0;
|
||||
public int MaxBonusWisdom { get; set; } = 0;
|
||||
public int MinBonusEndurance { get; set; } = 0;
|
||||
public int MaxBonusEndurance { get; set; } = 0;
|
||||
public int MinBonusDexterity { get; set; } = 0;
|
||||
public int MaxBonusDexterity { get; set; } = 0;
|
||||
public int MinBonusHealth { get; set; } = 0;
|
||||
public int MaxBonusHealth { get; set; } = 0;
|
||||
public int MinBonusMana { get; set; } = 0;
|
||||
public int MaxBonusMana { get; set; } = 0;
|
||||
|
||||
// Weapon damage ranges for crafting
|
||||
public int MinMinDamage { get; set; } = 0;
|
||||
public int MaxMinDamage { get; set; } = 0;
|
||||
public int MinMaxDamage { get; set; } = 0;
|
||||
public int MaxMaxDamage { get; set; } = 0;
|
||||
|
||||
// Armor range for crafting
|
||||
public int MinArmor { get; set; } = 0;
|
||||
public int MaxArmor { get; set; } = 0;
|
||||
|
||||
// Weapon stats (base values)
|
||||
public int MinDamage { get; set; } = 0;
|
||||
public int MaxDamage { get; set; } = 0;
|
||||
public float AttackRange { get; set; } = 0; // 0 = melee
|
||||
|
||||
Reference in New Issue
Block a user