From 524f30e596068401ff827eed4757a400ebe74b14 Mon Sep 17 00:00:00 2001 From: phobos2077 Date: Sun, 18 Jun 2023 21:36:57 +0200 Subject: [PATCH] barter: nerfed town demands, add logging of final multipliers --- root/data/scripts/gl_pbs_barter.int | Bin 7452 -> 7808 bytes root/mods/ecco/barter.ini | 28 ++++++------ scripts_src/_pbs_main/gl_pbs_barter.ssl | 55 ++++++++++++++++-------- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/root/data/scripts/gl_pbs_barter.int b/root/data/scripts/gl_pbs_barter.int index 6bace36491e8edc872a3e4538c2c50bf7b2706ea..4d5a7da261a90c78635bbb51c5d3b864fe099fa8 100644 GIT binary patch delta 1551 zcmZ`(U1%It7@fJr()-Yx+U0`>Vkg{`?~2XE^=R4*kb+KoAua= z$BWH+a>(Q3&AKL7+$ti^RGJ6$Up)R{vz{$|^Y9d5AKn~kd5^u2o0~X$rc#+OC(plc zR%gz#vO#=Pge1%-`09J0ZmCG(-=!zB_a-nxOA z*G6I^_?9~qtab~7yr;XBSZ1X8y-0O(ZMogC% z^F2(VmA#K+LhH+%H!8c<_)wFF&@S5HC^8-kJuTKOoD|wfd=ZPnaZRQLI_L~1J^PN! zuqV;c*|*Te!zT*Zc%8T1yA*zn)tp+sNtm(aXahNA_0jugV(ct_83YiZP7^ArDFH#tuHp43mtAdZtWr iW%L@Qw%oAeXRPz*9M1s1?f+Zk4&rO$1j#O2_5B0e0dWBU delta 1338 zcmZuwO-K}B7@qld*V@^i`PH4B8GizkSXX!5RLl%Q%7ZLnu!)ySBBX;*2N4gUUnbE( zgnU3kI@CqPJQ#N9WSwLW9wb6KNQhK~c!~}kJT&voj5`Yr%slhFKhOKl`@KW2yy}%G z`NVS^r_h9h;oTQf$IO^*a4y{i{~7V^O}@oNq0h#UeYaQJW7j-a6S5aAF;tSy?QVJ9J`V<^_fXE7an!}G|--|}<#8h=FMCm2lJ=0~xb z=)?8$&X$NY!xd=q74lZ6?_B#*GrFfA~2q*$ov z^606=MYlwcbS=c(@>`LCbYex}RuUZoJlO)*81%Q%*G%!+NT0#)c`)`dnp927H* z`86sU8U(RR_M)T{cXZ+eGEzrO^>SBf7;!P1WD>q{3$LZdGwjpEW4mxJRw=4tTUsX4 z0jA|TOvzSO`soUD9Me#o_UNVR7Uf>%(@++3QLiCR!;qq7zYvt(mPlP(w8U)>1PnVlADU7FGvS48Ke{&dY+^fai}ko^dP3wMI-HQQ0R2# zJ?<9kOZcAdCg}_;V}a-f){T3_+=XN|@)O9L1~E5KG~0>!9FNT##H83UZ?(?NcCj-I zxjSZ#daN+Z_LXxsl%1)07DcOtn0ZWCUbk0sUdUi5VqmJiiPRG; f*B4u?Lng=3g8Qok_(%T_x5|h&3=^x{?%4VV3d}1{ diff --git a/root/mods/ecco/barter.ini b/root/mods/ecco/barter.ini index a72d619..ee58d64 100644 --- a/root/mods/ecco/barter.ini +++ b/root/mods/ecco/barter.ini @@ -165,21 +165,21 @@ MaxTown=25 ; 2=276*2.00|277*2.00 ; ; -; Den: Pelts & Hides cost more, scorpion tails more -1=276*1.5|277*1.5|533*1.5|92*1.5|591*1.5 -; Klamath: Pelts & Hides cost more, stimpacks less, scorpion tails more, rope less (illogical, but balanced) -2=276*1.5|277*1.5|533*1.5|623*1.5|40*0.8|92*1.5|591*1.5|127*0.8 -; Modoc: pelts, tails and hides -3=276*1.5|277*1.5|533*1.5|92*1.5|591*1.5|623*1.5 -; Vault City: medicine (stimpacks, antidote, radaway, radx) -4=40*0.7|144*0.7|49*0.7|48*0.7|109*0.7 +; Den: pelts, tails and hides cost a little more (no logic, just balance) +1=276*1.1|277*1.1|533*1.1|92*1.1|591*1.1|623*1.1 +; Klamath: pelts and tails cost more, stimpacks less, rope less (illogical, but balanced) +2=276*1.4|277*1.4|533*1.4|92*1.2|591*1.2|40*0.8|127*0.8 +; Modoc: pelts and hides +3=276*1.4|277*1.4|533*1.4|623*1.4 +; Vault City: cheaper medicine (stimpacks, antidote, radaway, radx) +4=40*0.8|144*0.8|49*0.8|48*0.8|109*0.8 ; Gecko: many junk, do need for rad drugs, geiger counter demand -5=98*0.5|48*0.5|109*0.5|52*1.3 -; Broken Hills: wanamingo hand, demand on explosives, flares -6=625*1.5|51*1.5|85*1.5|79*1.5 -; New Reno: jet produced nearby (sell in redding for profit) +5=98*0.5|48*0.7|109*0.7|52*1.3 +; Broken Hills: wanamingo hand, demand on explosives +6=625*1.4|51*1.3|85*1.3 +; New Reno: jet produced nearby (sell in Redding for profit) 7=259*0.5 ; NCR: iguana on a stick 10=81*0.7 -; Redding: mine scrips, wanamingo hand, high demand on jet, demand on explosives, flares -13=494*5.0|420*5.0|625*1.5|259*2.0|51*1.5|85*1.5|79*1.5 +; Redding: mine scrips, wanamingo hand, high demand on jet, demand on explosives +13=494*5.0|420*5.0|625*1.4|259*2.0|51*1.3|85*1.3 diff --git a/scripts_src/_pbs_main/gl_pbs_barter.ssl b/scripts_src/_pbs_main/gl_pbs_barter.ssl index b192ae4..6a4f38b 100644 --- a/scripts_src/_pbs_main/gl_pbs_barter.ssl +++ b/scripts_src/_pbs_main/gl_pbs_barter.ssl @@ -175,9 +175,11 @@ procedure barterprice_handler begin barter_mod := gdialog_get_barter_mod, town_rep := 0, party_barter, - selling_price_mod := 1, + sell_price_mult, + buy_price_mult, dude_barter_mult, - final_price_goods; + final_price_goods, + stats; if (Sell_TownRepCoef != 0 or Buy_TownRepCoef != 0) then begin town_rep := get_clamped(get_town_rep, -30, 30); @@ -188,16 +190,26 @@ procedure barterprice_handler begin + "; base_price_goods: " + base_price_goods + "; offered_price_goods: " + offered_price_goods);*/ // modify buy prices + stats := ""; if (base_price != 0) then begin if (Buy_Formula == 0 or Buy_Formula == 1 or Buy_Formula == 2) then begin // VANILLA-based FORMULA (1 was deprecated and merged into 0) + // Calc multiplier + buy_price_mult := Buy_Bias; + if (Buy_Formula == 2) then begin + buy_price_mult *= (1 + arctan(Buy_ArctanCoef*dude_barter, 1.0)*Buy_DudeSkillCoef); + end + // Vanilla price without caps vanilla_price_goods := vanilla_price - item_caps; // Adjust demand and compensate for vanilla price multiplier vanilla_price_goods += round(calc_items_demand_mod(item_table) * vanilla_price_goods / base_price_goods); - final_price_goods := vanilla_price_goods * Buy_Bias; - if (Buy_Formula == 2) then begin - final_price_goods *= (1 + arctan(Buy_ArctanCoef*dude_barter, 1.0)*Buy_DudeSkillCoef); + // Final price + final_price_goods := vanilla_price_goods * buy_price_mult; + // cap value against MinPriceCoef + if (final_price_goods < base_price_goods*Buy_MinPriceCoef) then begin + final_price_goods := base_price_goods*Buy_MinPriceCoef; end + stats += sprintf("vanilla buy price mult: %.2f", buy_price_mult); end else begin // override price (formula 3 or 4) // these two differ only in calculating dude_barter coefficient: @@ -208,23 +220,25 @@ procedure barterprice_handler begin party_barter := get_highest_barter_in_party_except_dude; - // adjust demand for buy prices - base_price_goods += calc_items_demand_mod(item_table); - final_price_goods := base_price_goods * Buy_Bias - * dude_barter_mult + // calc multiplier + buy_price_mult := Buy_Bias * dude_barter_mult * (1 + merchant_barter * Buy_MerchantSkillCoef) * (1 + dude_charisma * Buy_DudeCharismaCoef) * (1 + town_rep * Buy_TownRepCoef) * (1 + master_trader * Buy_PerkCoef) * (1 + barter_mod * Buy_BarterModCoef) * (1 + math_max(party_barter - Buy_PartySkillThreshold, 0) * Buy_PartySkillCoef); + + // cap mult against MinPriceCoef + if (buy_price_mult < Buy_MinPriceCoef) then begin + buy_price_mult := Buy_MinPriceCoef; + end + // adjust demand for buy prices + base_price_goods += calc_items_demand_mod(item_table); + // Final price + final_price_goods := base_price_goods * buy_price_mult; + stats += sprintf("buy price mult: %.2f", buy_price_mult); end - - // cap value against MinPriceCoef - if (final_price_goods < base_price_goods*Buy_MinPriceCoef) then begin - final_price_goods := base_price_goods*Buy_MinPriceCoef; - end - set_sfall_return(round(final_price_goods) + item_caps); end else begin set_sfall_return(0); @@ -240,7 +254,7 @@ procedure barterprice_handler begin or Sell_PerkCoef != 0 or Sell_BarterModCoef != 0)) then begin - selling_price_mod := Sell_Bias + sell_price_mult := Sell_Bias * (1 + dude_barter * Sell_DudeSkillCoef) * (1 + merchant_barter * Sell_MerchantSkillCoef) * (1 + dude_charisma * Sell_DudeCharismaCoef) @@ -249,14 +263,17 @@ procedure barterprice_handler begin * (1 + barter_mod * Sell_BarterModCoef); // cap multiplier - if (selling_price_mod > Sell_MaxPriceCoef) then selling_price_mod := Sell_MaxPriceCoef; - else if (selling_price_mod < 0) then selling_price_mod := 0; + if (sell_price_mult > Sell_MaxPriceCoef) then sell_price_mult := Sell_MaxPriceCoef; + else if (sell_price_mult < 0) then sell_price_mult := 0; + stats += sprintf("; sell price mult: %.2f", sell_price_mult); offered_price_goods += calc_items_demand_mod(offered_table); - set_sfall_return(round(offered_price_goods * selling_price_mod) + offered_caps); + set_sfall_return(round(offered_price_goods * sell_price_mult) + offered_caps); end else begin set_sfall_return(0); end + + if stats != "" then debug_msg("pbs_barter: "+stats+". "); end procedure calc_items_demand_mod(variable containerObj) begin