i'm using the latest stable (not beta) version of GOF but i think this problem happens in vanilla as well. the problem is that the price of gold and silver is bugged, at least when it comes to imports. if you buy gold or silver from a port that exports it and then take it to a port that imports it, you get payed less for it than you bought it for. this has nothing to do with trade skills as i make plenty of profits on other goods and i have a treasurer with all the trade perks.
also, if you take the gold from an exporting port to a "normal" port, as in one that doesn't import it but buys it normally, you get payed MORE than you do in an importing port. this happens with silver as well.
so to summarize, normal ports pay more for gold and silver than importing ports. importing ports pay LESS than the price you get charged at exporting ports. the only way to make a profit is to buy from exporting ports and selling in normal ports. if you buy from exporting ports and sell in importing ports you lose money.
does anyone know how to fix this?
i've looked through the files and found that the file "StoreUtilite.c" in the /program/store folder holds all the variables that control import and export prices, but since my programming skills suck i can't make sense of it.
here is the section i think might have something to do with it since it specifically mentions both gold and silver, but i don't understand any of it. could someone who's good at programming PLEASE take a look? thanks.
also, if you take the gold from an exporting port to a "normal" port, as in one that doesn't import it but buys it normally, you get payed MORE than you do in an importing port. this happens with silver as well.
so to summarize, normal ports pay more for gold and silver than importing ports. importing ports pay LESS than the price you get charged at exporting ports. the only way to make a profit is to buy from exporting ports and selling in normal ports. if you buy from exporting ports and sell in importing ports you lose money.
does anyone know how to fix this?
i've looked through the files and found that the file "StoreUtilite.c" in the /program/store folder holds all the variables that control import and export prices, but since my programming skills suck i can't make sense of it.
here is the section i think might have something to do with it since it specifically mentions both gold and silver, but i don't understand any of it. could someone who's good at programming PLEASE take a look? thanks.
Code:
void UpdateStore(ref pStore)
{
bool bigSize = (pStore.StoreSize=="large");
aref gref,curref;
makearef(gref,pStore.Goods);
int nq = GetAttributesNum(gref);
int n;
string tmpstr;
bool bIType;
for(int i=0; i<GOODS_QUANTITY; i++)
{
tmpstr = Goods[i].name;
if( !CheckAttribute(gref,tmpstr) ) continue;
makearef(curref,gref.(tmpstr));
// boal 25.01.2004 -->
/*if( sti(curref.TradeType)==TRADE_TYPE_AMMUNITION ) {
curref.Quantity = 1000+Rand(50)*20;
continue;
}
if( i==GOOD_SAILCLOTH || i==GOOD_PLANKS ) {
curref.Quantity = 600+Rand(100);
continue;
}*/
bIType = (i==GOOD_GOLD) || (i==GOOD_SILVER) || (i==GOOD_WEAPON) || (i==GOOD_MEDICAMENT);
if( bIType && sti(curref.Quantity) < 20 && sti(curref.TradeType) == TRADE_TYPE_IMPORT)
{
curref.Quantity = 140 + Rand(125);
if (!bigSize) curref.Quantity = makeint(sti(curref.Quantity) / 2);
continue;
}
if( sti(curref.Quantity) < 80 && sti(curref.TradeType) == TRADE_TYPE_IMPORT)
{
curref.Quantity = 500 + Rand(500);
if (!bigSize) curref.Quantity = makeint(sti(curref.Quantity) / 2);
continue;
}
// boal 25.01.2004 <--
n = sti(curref.Quantity) - GetConsumeGoods(sti(curref.TradeType),bigSize, i); // boal 27.01.2004
if(n<0) n=0;
n += GetProductGoods(sti(curref.TradeType),bigSize, i); // boal 27.01.2004
curref.RndPriceModify = AddPriceModify(stf(curref.RndPriceModify), sti(curref.TradeType), n, i, bigSize);// boal 25.01.2004
curref.Quantity = n;
}
}
float AddPriceModify(float curModify, int tradeType, int currentQuantity, int goodsId, bool bigSize)// boal 25.01.2004
{
float fMaxModify = 0.39;
float fMinModify = 0.0;
// boal 25.01.2004 -->
float rateInc = 0.0;
if( goodsId == GOOD_GOLD || goodsId == GOOD_SILVER || goodsId == GOOD_WEAPON || goodsId == GOOD_MEDICAMENT)
{
currentQuantity = currentQuantity * 6;
}
if (!bigSize)
{
currentQuantity = currentQuantity * 2; // приведение к мелкому магазу
}
switch(tradeType)
{
case TRADE_TYPE_NORMAL:
rateInc = currentQuantity / 2000;
break;
case TRADE_TYPE_AMMUNITION:
rateInc = currentQuantity / 2000;
break;
case TRADE_TYPE_EXPORT:
fMaxModify = 0.5;
rateInc = currentQuantity / 4000;
break;
case TRADE_TYPE_IMPORT:
fMaxModify = 0.7;
fMinModify = -0.35;
rateInc = currentQuantity / 600;
break;
case TRADE_TYPE_CONTRABAND:
fMaxModify = 0.99;
fMinModify = -1.9;
rateInc = currentQuantity / 400; // при затаривании цена падает ниже экспорта :)
break;
case TRADE_TYPE_CANNONS:
fMaxModify = 0.45;
rateInc = currentQuantity / 80;
break;
}
if (rateInc <= 1.0)
{
curModify += 0.01*frnd();
}
else
{
curModify -= 0.01*frnd();
}
if(curModify < fMinModify)
curModify = fMinModify;
if(curModify > fMaxModify)
curModify = fMaxModify;
// boal 25.01.2004 <--
return curModify;
}
int GetProductGoods(int tradeType,bool bLarge, int _i)
{
// boal 27.01.2004 -->
int rate = 1;
if ((_i==GOOD_GOLD) || (_i==GOOD_SILVER) || (_i==GOOD_WEAPON) || (_i==GOOD_MEDICAMENT))//|| i==GOOD_FOOD
{
rate = 6;
}
// boal 27.01.2004 <--
if (!bLarge)
{
rate = rate * 2;
}
switch(tradeType)
{
// boal 25.01.2004 -->
case TRADE_TYPE_NORMAL: return makeint((20 + rand(10)*10) / rate); break;
case TRADE_TYPE_AMMUNITION: return makeint((20 + rand(10)*10) / rate); break;
case TRADE_TYPE_EXPORT: return makeint( (20 + rand(10)*10) / rate); break;
case TRADE_TYPE_IMPORT: return makeint( (10+ rand(6)*10) / rate); break;
case TRADE_TYPE_CONTRABAND: return rand(20); break;
case TRADE_TYPE_CANNONS: return rand(15); break;
// boal 25.01.2004 <--
}
return 0;
}
int GetConsumeGoods(int tradeType,bool bLarge, int _i)
{
// boal 27.01.2004 -->
int rate = 1;
if ((_i==GOOD_GOLD) || (_i==GOOD_SILVER) || (_i==GOOD_WEAPON) || (_i==GOOD_MEDICAMENT))//|| i==GOOD_FOOD
{
rate = 6;
}
// boal 27.01.2004 <--
if (!bLarge)
{
rate = rate * 2;
}
switch(tradeType)
{
// boal 25.01.2004 -->
case TRADE_TYPE_NORMAL: return makeint((20 + rand(10)*10) / rate); break;
case TRADE_TYPE_AMMUNITION: return makeint((20 + rand(10)*10) / rate); break;
case TRADE_TYPE_EXPORT: return makeint((10 + rand(6)*10) / rate); break;
case TRADE_TYPE_IMPORT: return makeint((20+rand(10)*10) / rate); break;
case TRADE_TYPE_CONTRABAND: return 50+rand(100); break;
case TRADE_TYPE_CANNONS: return rand(14); break;
// boal 25.01.2004 <--
}
return 0;
}