And the second one suggestion for improvement:
Every barter list of items in trade, to be changed by modder, need from modder to overwrite the whole dialog . It makes huge conflicts between mods.
—
May be it's possible to use something like this in json of items:
"barters": [{ "barter": { "name": "CommonOrc", "type": 0, "set": null, "price": 1000, "min": 10, "max": 20 } }],
With data of price multiplier, and with data of number of items, with two numbers, and use Random.new.rand(num1..num2) in any barter dialog. With anything else if need. (I know a little in trading code , so it's only idea.)
And add items to trade, by something like this (it's only example of idea)
NPCName Ivent: (.rb) ####A lot of code#### good = [] $data_ItemName.each{|item| next if item[1] == nil next if item[1].barters == nil item[1].barters.each{|barter| next if barter == nil next if barter.name != NPCname #Or group of NPC it = barter good += [[it.type, item.id, it.set, it.price, Random.new.rand(it.min..it.max)]] } } ###A lot of code###
This method will allow every modder to simply add his own armors, weapons, and items to any trader. And it won't stop others modders from doing the same things with the same traders.
Or we can use (in some cases) group/type of trader instead of name. Or do it in one time. Use for NPC in their event not only their uniq "barters" in json. We can do the same "each each good+=" for groups after uniq items adding to the "good" array.
This method can be used not only for traders. Drop, or chests to. Simply use codename of chest as name of barter and then use the same code to create a list of items.
Or we can think of any other way to ensure that modders don't have to change the event code.
May we can create $data_BarterName… And use data from item's json (or create special folder for barters with special json files and collect them by the same way as $data_arpgskills) and put it in $data_BarterName, not in $data_ItemName, to decrease computer strain of working with $data_ItemName.
$data_BarterName - hash of barters
$data_BarterName["NPCName"] - array (of barter's items)
$data_BarterName["NPCName"][n] - array or hash for each item
$data_BarterName["NPCName"] += [modders array/hash for modder item]
And then modders can do something like this (not exactly this) $data_BarterName["NPCName"] += hash_data_from_their_json["NPCName"] (Or do it manually in code instead of using json)
good = [] $data_BarterName["NPCName"].each{|it| good += [[it["type"], $data_ItemName[it["item_name"]].id, it["set"], it["price"], Random.new.rand(it["min"]..it["max"])]] }
Or, may be i don't know something and this is already exist.