Closed tassaron closed 1 year ago
The universal standard is gold. Other denominations usually not relevant for gameplay. Platinum might be interesting for volume/weight reduction but volume/weight management is rarely used. Silver might be interesting due to certain enemies. "Emergency" crafting or puzzles might need the less used ones.
I think wealth
should be a float, rounded to 2 digit (copper) for better representation. It should be the serializable value.
Internally a wealth_detailed
dict could track what the players have for more detail oriented use cases. I think it would mimic a realistic money management if
sp
and cp
) in the "pocket" as long there is pp
/gp
/ep
to spend.Functions needed:
wealth_detailed
for init and deserialization:
infer_wealth_detailed(gp: Union[float, int])
change_wealth(pp: int = 0, gp: int = 0, sp: int = 0, ep: int = 0, sp: int = 0, cp: int = 0)
I agree with you about gold being the standard, and I think wealth
being a float with 1 gp = 1.00 wealth would make a lot of sense.
However, I think we should try to avoid inferring the distribution of coins if possible, but resort to it if necessary. I don't want to prevent someone having 100gp worth of copper. So we have to serialize the wealth_detailed
as well, though it isn't necessary for deserialization.
wealth_detailed
would be the full definition of the character's wealth:
{
'cp': 42,
'ep': 1,
'gp': 2
}
wealth
would be a property calculated from wealth_detailed
-- the above dict would calculate into 2.92wealth
is passed into __init__
, convert it to float in case it is an int from previous versions.__init__
only receives wealth
, automatically infer wealth_detailed
. This way someone who does not care about the specific coins can delete the more verbose data and keep a float instead.__init__
receives wealth
and a contradictory wealth_detailed
, ignore incorrect wealth
and log a warning (or maybe raise an error instead?)Both your functions would be needed, then.
infer_wealth_detailed
could be a staticmethod of Characterchange_wealth
would be an instance method that mutates self.wealth_detailed
giveWealth
/removeWealth
methods
Currently wealth is a single int property of the Character class.
According to the SRD:
So ultimately it would be nice to have some these coins each individually represented, maybe with some conversion functions.
For reference sake, the current
SRD_equipment
has stuff like this:So it's best to use the name
gp
instead ofgold
or anything else.