User:AEon2001/Sandbox2

This is my side project trying to understand how Witcher 3 pricing works, and where such data may be looked up. Since this is a work in progress, mentioning the data I find as I find it and putting it into sections for easier lookup.

Base Price values in Witcher 3
Every item that can be bought and/or sold has a base price value. These can be looked up in the wiki, where they are called "Base price". To complicate matters, these base prices are modified by various factors, i.e. Geralt gets less selling items, and usually has to pay more than the base price when buying from merchants. These value modifiers are multiplied onto the base price.

Price Modifiers:
 * Geralt's reputation with the "faction/region" the merchant belongs
 * The merchant's personal list of multipliers per item type. This also defines that certain item types will not be bought at all e.g., in other cases items will be worth less.
 * ... probably several things I am not yet aware of.

Geralt's Stats
Geralt has some basic stats, these include price multipliers that relate to specific locations.

Source:  (for NG+ same code used)

     // Always "1"           

So once Geralt enters, e.g. Oxenfurt the prices are modified by 1.3. Cities have higher prices it seems.

Question: These seem to modify Gbuy prices only, not the Gsell ones... I think?

Geralt's Skills
Geralt also modifies prices in regard to skill.

Source:  (for NG+ same code used)

   <skellige_price_mult type="add" min="0.9" max="0.9"/> <ability name="area_novigrad"> <novigrad_price_mult type="add" min="0.9" max="0.9"/>

If actually used, all prices, "everywhere" it seems simply get reduced to 90%. Might be used as a global price balancing effort?

Question: Gsell-related? Also Gbuy... unclear.

The 5 states of Reputation
Apparently there are five states of reputation that influence buy and sell price multipliers:
 * Hated (reputationPoints: 0-15)
 * Disliked (16-40)
 * Neutral (41-60)
 * Liked (61-80) and
 * Respected (81-100)

Example: So a respected Geralt with that merchant should only pay 70% of whatever the sell prices of the merchant has. And Geralt should get 130% for what he sells to the merchant. Note these multipliers are on top of whatever else may influence the prices, e.g. each merchant has his own set of price multiplies per "item category". There may also be a region dependant multiplier.

The code seems to be defined in : function GetReputationBonuses( reputationLevels : EReputationLevel,                               out buyPriceMult : float, out sellPriceMult : float ) {      switch( reputationLevels ) {       case RL_Hated :         buyPriceMult = 1.3;     sellPriceMult = 0.3; case RL_Disliked :     buyPriceMult = 1.15;    sellPriceMult = 0.85; case RL_Neutral :      buyPriceMult = 1;       sellPriceMult = 1; case RL_Liked :        buyPriceMult = 0.85;    sellPriceMult = 1.15; case RL_Respectable :  buyPriceMult = 0.7;     sellPriceMult = 1.3; } } function GetReputationLevel( factionName : EFactionName ) : EReputationLevel {   var reputationLevel     : EReputationLevel; var reputationPoints   : int; reputationPoints = factionReputations[ factionName ].currentReputationPoints; if ( reputationPoints     <= 15 )  reputationLevel = RL_Hated; else if ( reputationPoints <= 40 ) reputationLevel = RL_Disliked; else if ( reputationPoints <= 60 ) reputationLevel = RL_Neutral; else if ( reputationPoints <= 80 ) reputationLevel = RL_Liked; else                               reputationLevel = RL_Respectable; }

The reputation seems to be related to how well you are liked with a faction. Suggesting the merchants are linked to these factions. I am not sure you can actually look up your reputation in-game, maybe under player stats?

"Factions" that define Reputation
Apparently the so-called factions are actually regions in the game. The game differs between three of them.

Source:  (for NG+ same code used)

FN_NoMansLandPoor = 0,   // Velen    (everything outside of Novigrad?) FN_NovigradNobles = 1,   // Novigrad (city only?) FN_SkelligeUndvik = 2,   // Skellige Islands

Hmmm... apparently the more "good" you do in that region the better your reputation, i.e. help the folks in that region via quests. If you press them for crowns, that could possibly lower reputation playing that same quest. It would make sense to have neutral reputation when you enter a new region. (Maybe the script code will let use unlock and show the reputationPoints.)

Interestingly the info is already being logged, via log channel:

exec function reputationpoints( i : int ) LogChannel('Reputation', "Current reputation points among " + facName + ": " + repPoints );

So how do we view this logchannel? The main source code seems to call reputationpoints directly... none of the .ws code accesses it, AFAICT.

"Personal" Merchant buy/sell stats
As an example the smith and the armourer in Oxenfurt. Both have the same "personal" stats.

Source:  (for NG+ same code used)

<ability name="Oxenfurt smith _abl" > <weapon_price_mult type="base" min="1" max="1"/> <armor_price_mult type="base" min="0.97" max="0.97"/> <crafting_price_mult type="base" min="1" max="1"/> <alchemy_price_mult type="base" min="-1" max="-1"/> <alcohol_price_mult type="base" min="-1" max="-1"/> <food_price_mult type="base" min="-1" max="-1"/> <fish_price_mult type="base" min="-1" max="-1"/> <books_price_mult type="base" min="-1" max="-1"/> <valuables_price_mult type="base" min="-1" max="-1"/> <junk_price_mult type="base" min="-1" max="-1"/> <novigrad_price_mult type="base" min="1" max="1"/> <nilfgard_price_mult type="base" min="-1" max="-1"/> <nomansland_price_mult type="base" min="0.72" max="0.72"/> <skellige_price_mult type="base" min="1.32" max="1.32"/> <nonhuman_price_mult type="base" min="1.69" max="1.69"/> <orens_price_mult type="base" min="1" max="1"/> <florens_price_mult type="base" min="1" max="1"/>

<ability name="Oxenfurt armorer _abl" > <weapon_price_mult type="base" min="1" max="1"/> <armor_price_mult type="base" min="0.97" max="0.97"/> <crafting_price_mult type="base" min="1" max="1"/> <alchemy_price_mult type="base" min="-1" max="-1"/> <alcohol_price_mult type="base" min="-1" max="-1"/> <food_price_mult type="base" min="-1" max="-1"/> <fish_price_mult type="base" min="-1" max="-1"/> <books_price_mult type="base" min="-1" max="-1"/> <valuables_price_mult type="base" min="-1" max="-1"/> <junk_price_mult type="base" min="-1" max="-1"/> <novigrad_price_mult type="base" min="1" max="1"/> <nilfgard_price_mult type="base" min="-1" max="-1"/> <nomansland_price_mult type="base" min="0.72" max="0.72"/> <skellige_price_mult type="base" min="1.32" max="1.32"/> <nonhuman_price_mult type="base" min="1.69" max="1.69"/> <orens_price_mult type="base" min="1" max="1"/> <florens_price_mult type="base" min="1" max="1"/>

So any price differences would have to be due to reputation (they belong to different factions) or "region" (both in Oxenfurt, so not likely).

Todo: Supposedly the armourer has better prices, my test shows that the blacksmith has higher sell prices, but also better buy prices. The armourer has lower sell prices, but also lower buy prices.

Merchant "personal price multipliers" analysed
Taking a closer look at the multipliers defined for the Blacksmith in Oxenfurt.

10 item categories
There seem to be 10 item categories (types) applied in the inventory / shop menu:

<weapon_price_mult type="base" min="1" max="1"/> <armor_price_mult type="base" min="0.97" max="0.97"/> <crafting_price_mult type="base" min="1" max="1"/> <alchemy_price_mult type="base" min="-1" max="-1"/> <alcohol_price_mult type="base" min="-1" max="-1"/> <food_price_mult type="base" min="-1" max="-1"/> <fish_price_mult type="base" min="-1" max="-1"/> <books_price_mult type="base" min="-1" max="-1"/> <valuables_price_mult type="base" min="-1" max="-1"/> <junk_price_mult type="base" min="-1" max="-1"/>


 * weapons, armour, crafting, alchemy, alcohol, food, fish, books, valuables, junk

The minimum and maximum values are the same. Apparently it was planned at some point to introduce a random price range, but this seems not to be used. A value of "-1" seems to indicated that this merchant (smith) will not trade, probably not BUY, any items in the categories: alchemy, alcohol, food, fish, books, valuables, and junk.

The multiplier for crafting seems to refer to crafting items. In this case the multiplier has no influence, since it is a neutral factor 1.

Todo: Look up this Blacksmith's "loot", i.e. shop inventory item list. I am guessing the above "-1" items will never be part of his shop inventory either, thus he cannot sell them.

Regional multipliers
This seems to link slightly to the Repulation system. As seen elsewhere reputation defines your standing with factions, i.e. actually you standing in one of three regions:

<novigrad_price_mult type="base" min="1" max="1"/> <nomansland_price_mult type="base" min="0.72" max="0.72"/> <skellige_price_mult type="base" min="1.32" max="1.32"/>

These region multipliers, for Novigrad, NomansLand, and Skellige additionally seem to be defined on a per merchant basis. I find this slightly confusing, IMO, Oxenfurt seems to count as "novigrad" and has a neutral "1" price factor.

Question: Would this mean if the merchant moved to the Nomansland or Skellige that his prices would go down to 0.72 and up 1.32 respectively? Makes not too much sense since, this smith stays in Oxenfurt. But might make sense for those travelling merchants, that travel the Nomansland, but might also visit "Novigrad"?

"Affiliation" multiplier
Interestingly there also seem to be multipliers that relate to "what side you are on" in the war, i.e. of Geralt supports Nilfgaard or not (whatever that means, maybe helping Nilfgaardians via quests?).

<nilfgard_price_mult type="base" min="-1" max="-1"/>

But for this merchant (smith) this does not apply, since the "-1" seems to indicate that the merchant ignores any affiliation Geralt might have with Nilfgaard.

Non-human multiplier
This one suggests that non-humans may get different prices from merchants, and that possibly some non-human merchants (like dwarves or elves) might have neutral to better lower prices.

<nonhuman_price_mult type="base" min="1.69" max="1.69"/>

In this case the Oxenfurt blacksmith ups his price for non-humans, i.e. for Geralt who is seen as non-human, by a hefty factor 1.69.

Currency multipliers
Some merchants, i.e. [Vimme Vivaldi], will actually convert orens and florens that can be collected in the game to crowns used by all merchants.

<orens_price_mult type="base" min="1" max="1"/> <florens_price_mult type="base" min="1" max="1"/>

The above seem to be the exchange rate. Strangely the Oxenfurt blacksmith has an exchange rate of "1", though AFAICT he does not actually accept those currencies (IMO it should be "-1" i.e. turned off). Todo: Check this, maybe one can give him florens and orens.

Interestingly both banks have the same currency multipliers: <ability name="Rich district bank _abl" > <ability name="Poor district bank _abl" >

<novigrad_price_mult type="base" min="1" max="1"/> <nilfgard_price_mult type="base" min="1" max="1"/> <nomansland_price_mult type="base" min="1" max="1"/> <skellige_price_mult type="base" min="1" max="1"/> <nonhuman_price_mult type="base" min="1" max="1"/>

<orens_price_mult type="base" min="2" max="2"/> <florens_price_mult type="base" min="0.2" max="0.2"/>

Orens are worth twice as much as crowns, but florens only 20%. Note that both banks do not discriminate against Geralt ("nonhuman" is 1). Affiliation (Nilfgaard, and region/faction are also ignored and a neutral 1).

Putting the multipliers all together
I checked the prices for the Oxenfurt blacksmith for several items:

Base  Gbuy  Gsell  Category   Region   Non-   Reputation  Reputation    GStats   GSkills price                                  human  RepGBuy     RepGSell      Oxenfurt (Global) (1) Black Pearl:         130    895   147    1 craft    1 Novi? 1.69  1.3 - 0.7?   0.3 - 1.3?   1.3      0.9 (2) Dark Iron Ingot:         46     208   34     1 craft    1 Novi? 1.69  1.3 - 0.7?   0.3 - 1.3?   1.3      0.9 (3) Master Crafted Silver Sword:  291    673   111    0.97 weap  1 Novi? 1.69  1.3 - 0.7?   0.3 - 1.3?   1.3      0.9 (4) Griffin Trophy:        250    250   41     ? weap/   1 Novi? 1.69  1.3 - 0.7?   0.3 - 1.3?   1.3      0.9                                           trophy?

Legend: Gbuy = Geralt's buy price from merchant Gsell = Geralt's sell price to merchant

So the question is how to get the prices we are seeing ( ignored, would be 1 in any case)...

Gbuy       = + <BuyMod> = 130 + 218 = 348  (seeing: 895c for Black Pearl) = + <BuyMod> = 291 + 474 = 765 (seeing: 673c for MCS Sword)

BuyMod     =    * * * <non-human> * <RepGBuy>  * <GStats> * <GSkill> Black Pearl = 130 (need 6.88)   1            1          1.69       * 0.85(liked) *  1.3     * 0.9? = 218c (still not close to 895c) MCS Sword  = 291 (need 2.31)    0.97         1          1.69       * 0.85(liked) *  1.3     * 0.9? = 474c (too much 673c)

Gsell      = + <SellMod> = 130   + xxx (req +17c) = 147.55c (147c Black Pearl) = 46    + xxx (req -12c) =  52.21c ( 34c Dark Iron Ingot) SellMod    =    * * * <non-human>           * <RepGSell>   * <GStats Oxenfurt> * <GSkill> Black Pearl = 130 (need 1.13)   1            1          (1.69 only for Gbuy)  * 1.15(liked) * (1.3 only Gbuy?)  * 0.9 = 17.6c DII        =  46                1            1          (1.69 only for Gbuy)  * 1.15(liked) * (1.3 only Gbuy?)  * 0.9 = 6.21c

We seem to be missing some significant factor(s) that ups the Gbuy prices. And I doubt I have the worst case "hated" reputation.

Question: All the personal merchant multipliers only seem to apply to the Gbuy prices. I.e., , <non-human> and seem to be ignored for Gsell calculations? This seems to be so since the <non-human> factor 1.69 does not make sense when used to calculate Gsell, Geralt would actually be getting better prices as non-human, and I doubt that.

Notes:
 * The Black Pearl: Category: Magic item, Type: Crafting component.
 * Dark Iron Ingot: Category: Magic item, Type: Crafting component.
 * Griffin Trophy: Category: Relic, Type: Trophy... under weapon tab, but could be classified as valuable?
 * Master Crafted Silver Sword (contains no runes):
 * Todo: I can now double-check in-game (via a mod) the base prices. Need to check those prices above again.
 * Todo: Seem to recall some script code that was checking for "special items"... needs more checking.
 * Todo: The Category values of -1 might be a factor to bring *down* the values below the base price.

Merchant Sell Price locked for some items?
Usually the prices for items are derived from the "base price", but in the case of the Griffin Trophy the above Oxenfurt smith and armourer both sell the item for 250o, and buy it from Geralt for 41o. Whereas their other prices vary slightly.

The Griffin Trophy info source:

<item name="q002_griffin_trophy" category="trophy" stackable="1" equip_template="trophy__gryphon" ability_mode="OnMount" grid_size = "2" icon_path="icons/inventory/quests/trophy_gryphon_64x64.png" localisation_key_name = "item_name_q002_griffin_trophy" localisation_key_description = "item_desc_trophy" price = "250" > Quest,Trophy,HorseTrophy <base_abilities> <a>gryphon_trophy_stats</a> <a>base_trophy_stats</a> </base_abilities> <item name="sq108_griffin_trophy" category="trophy" stackable="1" equip_template="trophy__gryphon" ability_mode="OnMount" grid_size = "2" icon_path="icons/inventory/quests/trophy_gryphon_64x64.png" localisation_key_name = "item_name_sq108_griffin_trophy" localisation_key_description = "item_desc_trophy" price = "250" > Quest,Trophy <base_abilities> <a>gryphon_sq108_trophy_stats</a> <a>base_trophy_stats</a> </base_abilities>

Strange. Possibly certain special items have such locked pricing.

Issue: IMO the base price mentioned on Griffin_trophy at 300o is wrong and should be 250. Needs more research though.
 * There are 2 griffin trophies, one at 250 and one at 300 — Game widow ( talk ) 13:47, 12 April 2016 (UTC)
 * Verified, indeed... should help track down this special case in the .xml files.

Item info, and loot info
A few things I noted browsing the files:
 * -> defines container types and what they contain!
 * -> name of item and base prices...
 * -> what shows seem to feature

What do the _plus .xml folders stand for?
There are two  folders, what are they for? These are not updates in the source code, but actually come into play when replaying the game on New Game Plus, since the latter changes a few things:

uncooked\gameplay\abilities uncooked\gameplay\abilities_plus uncooked\gameplay\items uncooked\gameplay\items_plus