Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/tradeManager.js
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | for (let buy of Resources.GetCodes()) | ||||
for (let sell of Resources.GetCodes()) | for (let sell of Resources.GetCodes()) | ||||
{ | { | ||||
if (sell == buy) | if (sell == buy) | ||||
continue; | continue; | ||||
// Do not sell if we need it or do not have enough buffer | // Do not sell if we need it or do not have enough buffer | ||||
if (needs[sell] > 0 || available[sell] < 500) | if (needs[sell] > 0 || available[sell] < 500) | ||||
continue; | continue; | ||||
// Do not sell non-currency for non-currency | |||||
if (!GetCodes("currency").some(x => x == sell || x == buy)) | |||||
continue; | |||||
let barterRateMin; | let barterRateMin; | ||||
if (sell == "food") | if (sell == "food") | ||||
{ | { | ||||
barterRateMin = 30; | barterRateMin = 30; | ||||
if (available[sell] > 40000) | if (available[sell] > 40000) | ||||
barterRateMin = 0; | barterRateMin = 0; | ||||
else if (available[sell] > 15000) | else if (available[sell] > 15000) | ||||
barterRateMin = 5; | barterRateMin = 5; | ||||
▲ Show 20 Lines • Show All 466 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator