Open laper32 opened 1 week ago
No, there is no such functionality built-in. What's your use-case?
Consider this toml below:
[npc_hero_phantom_assassin]
health = 500 # builtin
mana = 300 # builtin
strength = 20 # builtin
agility = 20 # builtin
intelligence = 20 # builtin
attack_damage = 50 # builtin
attack_speed = 100 # builtin
phantom_assassin_critial_strike_damage = [2.5, 3.5, 4.5] # hero based
phantom_assassin_critial_strike_rate = 0.17 # hero based
Consider code below:
(Using System.Text.Json for easier representation)
public class TomlGameNPC
{
[JsonPropertyName("health")]
int Health {get; set;}
[JsonPropertyName("mana")]
int Mana {get; set;}
[JsonPropertyName("strange")]
int Strange {get; set;}
[JsonPropertyName("agility")]
int Agility {get; set;}
[JsonPropertyName("intelligence")]
int Intelligence {get; set;}
[JsonPropertyName("attack_damage")]
int AttackDamage {get; set;}
[JsonPropertyName("attack_speed")]
int AttackSpeed {get; set;}
[JsonExtensionData]
Dictionary<string, JsonElement> Attributes { get; set; }
}
Now as you can see, phantom_assassin_critial_strike_damage
and phantom_assassin_critial_strike_rate
is not general Game NPC, so we need to put all of them into Attributes
.
When I need to do something more (e.g.: set hero's ability field) for Phantom Assassin, I will read TomlGameNPC.Attributes
to find out these attributes and set them.
This is quite something like
[JsonExtensionData]
inSystem.Text.Json
.Does Tomlet provide this feature?