NathanKell
...
NOTES:
All functions are at the bottom of Items_utilite.c
Don't worry; traders will be automatically assigned everything if you add nothing to their ch defines; you can add as many or as few extra attributes as you like and the functions will do the rest (see trader flags, below, for ways to control this).
You should, however, set ch.itemtrade.tradetype to one of the IT_TYPE defines in BS.h; right now only storekeepers and item traders are automatically detected, and only they, blacksmiths, and GENERAL (a `catch-all` default) have `auto-assign` support. But I provided a ton of IT_TYPE choices, and you can easily write your own cases in IT_AssignTypesToTrader(), using BLACKSMITH as an example.
Traders, items, and towns all share the same structure.
thing.itemtrade is the parent.
Then itemtrade.qty and .price for global scalars.
Traders also have itemtrade.quality. Note that items have itm.quality, not itm.itemtrade.quality!
itemtrade.types is the list of types (t0 through tX for types, i0 through iX for item IDs).
Structure
thing.itemtrade.types.tqty = X, where X is the number of type attributes (they will be t0 through t(`X-1`). iqty is for item IDs.
thing.itemtrade.types.iX or tX: (where X is the number)
*.qty = mult for qty
*.price = mult for price
*.quality = quality of that type of item
*.qualitych = change in quality for that type (i.e. -1 means trader quality -1 is the quality to use for this item type)
Qty of 0 means not traded (if you want the trader not to stock the item but still _buy_ them, set qty to 0.000001 or something).
Qty of < 0 means contraband.
Traders that have been talked to and given items have their IDs placed on an update list { ShipLookupTable.itemtraders.(ch.id) } and this tells the game whom to update each day.
If you remove a trader, make sure you also DeleteAttribute(&ShipLookupTable,"itemtraders."+ch.id);
If you only want the trader to not update for a while, do: string tmpstr = ch.id; ShipLookupTable.(tmpstr) = false;
And set back to true when you want updates to resume.
Item quality of 0 means ignore quality for rareness/qty calcs.
Instead of setting a type for general and qty -1, use itm.skipgeneral = true (for items) or ch.itemtrade.skiptype.general (for traders, see below) to skip general type
For a trader to obey a town's `not-trade`-items list, the trader must _not_ be set to skip town qty!
Traders may have the following flags:
ch.itemtrade.skiptownqty will skip multiplying qty by townqty
.skiptownprice ditto
.skiptownquality will skip adding town quality to trader quality.
{Note that this will skip both town size based effects but also town itemtype based effects}
.skiptype.town will skip adding the Town item type (for items that are sold more or less in certain towns--CCC suggested restricting artifacts this way).
.skiptype.island ditto
.skiptype.nat ditto, for nations
{Note, otherwise town, item, and nation types will be added, with the stats defined by their respective IT_AssignXXXType() functions.}
skiptype.general means trader will not sell items of general type.
Almost everything is tweakable by the IT_ defines in BuildSettings.h
All functions are at the bottom of Items_utilite.c
Don't worry; traders will be automatically assigned everything if you add nothing to their ch defines; you can add as many or as few extra attributes as you like and the functions will do the rest (see trader flags, below, for ways to control this).
You should, however, set ch.itemtrade.tradetype to one of the IT_TYPE defines in BS.h; right now only storekeepers and item traders are automatically detected, and only they, blacksmiths, and GENERAL (a `catch-all` default) have `auto-assign` support. But I provided a ton of IT_TYPE choices, and you can easily write your own cases in IT_AssignTypesToTrader(), using BLACKSMITH as an example.
Traders, items, and towns all share the same structure.
thing.itemtrade is the parent.
Then itemtrade.qty and .price for global scalars.
Traders also have itemtrade.quality. Note that items have itm.quality, not itm.itemtrade.quality!
itemtrade.types is the list of types (t0 through tX for types, i0 through iX for item IDs).
Structure
thing.itemtrade.types.tqty = X, where X is the number of type attributes (they will be t0 through t(`X-1`). iqty is for item IDs.
thing.itemtrade.types.iX or tX: (where X is the number)
*.qty = mult for qty
*.price = mult for price
*.quality = quality of that type of item
*.qualitych = change in quality for that type (i.e. -1 means trader quality -1 is the quality to use for this item type)
Qty of 0 means not traded (if you want the trader not to stock the item but still _buy_ them, set qty to 0.000001 or something).
Qty of < 0 means contraband.
Traders that have been talked to and given items have their IDs placed on an update list { ShipLookupTable.itemtraders.(ch.id) } and this tells the game whom to update each day.
If you remove a trader, make sure you also DeleteAttribute(&ShipLookupTable,"itemtraders."+ch.id);
If you only want the trader to not update for a while, do: string tmpstr = ch.id; ShipLookupTable.(tmpstr) = false;
And set back to true when you want updates to resume.
Item quality of 0 means ignore quality for rareness/qty calcs.
Instead of setting a type for general and qty -1, use itm.skipgeneral = true (for items) or ch.itemtrade.skiptype.general (for traders, see below) to skip general type
For a trader to obey a town's `not-trade`-items list, the trader must _not_ be set to skip town qty!
Traders may have the following flags:
ch.itemtrade.skiptownqty will skip multiplying qty by townqty
.skiptownprice ditto
.skiptownquality will skip adding town quality to trader quality.
{Note that this will skip both town size based effects but also town itemtype based effects}
.skiptype.town will skip adding the Town item type (for items that are sold more or less in certain towns--CCC suggested restricting artifacts this way).
.skiptype.island ditto
.skiptype.nat ditto, for nations
{Note, otherwise town, item, and nation types will be added, with the stats defined by their respective IT_AssignXXXType() functions.}
skiptype.general means trader will not sell items of general type.
Almost everything is tweakable by the IT_ defines in BuildSettings.h