OK I have been looking at this for a bit, and I belive the reason players can sell back for more than they pay is couse vendors mark up price is not high enough to counter the bonuses you get faction and charisma.
On top of that there is STILL a problem that money you get back from NPC do not match up with price shown.
Npc tells you : i will pay 1 plat, you click sell, it says - you sold for 1 plat, but if you looking at your invetory you only getting 9 gold and change.
But this problem is BEYOND my understanding of code.
So I will try to fix the issue with general price scaling.
Thsi is the code I dig up from client.cpp
Quote:
float Client::CalcPriceMod(Mob* other, bool reverse)
{
float chaformula = 0;
if (GetCHA() > 100)
{
chaformula = (GetCHA() - 100)*-0.1;
if (chaformula < -5)
chaformula = -5;
}
else if (GetCHA() < 75)
{
chaformula = (75 - GetCHA())*0.1;
if (chaformula > 5)
chaformula = 5;
}
if (other)
{
int factionlvl = GetFactionLevel(CharacterID(), other->CastToNPC()->GetNPCTypeID(), GetRace(), GetClass(), GetDeity(), other->CastToNPC()->GetPrimaryFaction(), other);
switch (factionlvl)
{
case 9: //Apprehensive
chaformula += 10;
break;
case 4: //Amiable
chaformula -= 3;
break;
case 3: //Warmly
chaformula -= 4;
break;
case 2: //Kindly
chaformula -= 5;
break;
case 1: //Ally
chaformula -= 6;
break;
}
}
if (reverse)
chaformula *= -1; //For selling
//Now we have, for example, 10
chaformula /= 100; //Convert to 0.10
chaformula += 1; //Convert to 1.10;
return chaformula; //Returns 1.10, expensive stuff!
}
|
the problem with this code IMHO are insignificant returns form both faction and CHA. Specialy CHA- with accordance to this function more than 150 CHA complitly useless
determiend here: if (chaformula < -5) chaformula = -5;
The formula may have been created with pre-kunark EQ in midn when 150 CHA was UBER, but in days of PoP my level 1 bazar mule was runing around 200 CHA on him wearing junk i obtained for less than 100 plat a peace
ANd whats important there was definite benefit from going even over 250 CHA
So this is changes proposed by me. The intent is to slightly improve the effect from faction bonus and MASSIVLY increase scaling of CHA (note that I am reducing gain increment6s from each 10 CHA above 100, to each 25 CHA but allow it to scale all way up to 400 CHA before CHA becomes useless.
I am also increasing penalty for CHA less than 75, per each 5 points all way down to 0.
With new formulas the max bonus you can obtain with Ally faction and 400 CHA is 26%, and max penalty with Apprehensive faction and 0 CHA is -25% (from original 10 and 10) (Idealy and realisticly you want faction bonsu to scale in accordance with EXACT numeric value of your curent faction - like 115, rather than just Amiable, then rather than havign price junp by 5 ranks, it woudl scale smoothly, but atm I am not sure how to retrive this value so I am working with what allready in the function (it is probobly GetFactionLevel but I am not sure)
the new code
Quote:
float Client::CalcPriceMod(Mob* other, bool reverse)
{
float chaformula = 0;
if (GetCHA() > 100)
{
chaformula = (GetCHA() - 100)*-0.04;
if (chaformula < -16)
chaformula = -16;
}
else if (GetCHA() < 75)
{
chaformula = (75 - GetCHA())*0.2;
if (chaformula > 15)
chaformula = 15;
}
if (other)
{
int factionlvl = GetFactionLevel(CharacterID(), other->CastToNPC()->GetNPCTypeID(), GetRace(), GetClass(), GetDeity(), other->CastToNPC()->GetPrimaryFaction(), other);
switch (factionlvl)
{
case 9: //Apprehensive
chaformula += 10;
break;
case 4: //Amiable
chaformula -= 2;
break;
case 3: //Warmly
chaformula -= 4;
break;
case 2: //Kindly
chaformula -= 7;
break;
case 1: //Ally
chaformula -= 10;
break;
}
}
if (reverse)
chaformula *= -1; //For selling
//Now we have, for example, 10
chaformula /= 100; //Convert to 0.10
chaformula += 1; //Convert to 1.10;
return chaformula; //Returns 1.10, expensive stuff!
|
NOW looking at the previous fixed staff. In order to get new price scalign to work as I intented I need to change the logic beyodn how vendor pricing is handled.
By default vendor uses +27% mark up when selling and gives 88% when buying basing of scaled price.
To easy calculation (and pricing of items) I want to alter thsi approach.
The mark up becomes +100%, and buy back is 100% (since ist adjusted by new scalign formulas anyway and fact that mark up price now HUGE)
Goign by dif changes made by Greggg, here are my alternatives:
Line 3717 of zone/client_packet.cpp should be changed from:
Quote:
mco->rate = 1/(.884*Client::CalcPriceMod(tmp,true));
|
to:
Quote:
mco->rate = (1*Client::CalcPriceMod(tmp,true));
|
line 3842 of zone/client_packet.cpp should be changed from
Quote:
mpo->price = (item->Price*(1/.884)*Client::CalcPriceMod(tmp,false))*mp->quantity;
|
to:
Quote:
mpo->price = (item->Price*(2)*Client::CalcPriceMod(tmp,false))*mp->quantity;
|
line 3947 of zone/client_packet.cpp should be changed from:
Quote:
price=(int)((item->Price*mp->quantity)*.884*Client::CalcPriceMod(vendor,true)+ 0.5); // need to round, because client does it automatically when displaying price
|
to:
Quote:
price=(int)((item->Price*mp->quantity)*1*Client::CalcPriceMod(vendor,true)+0.5 ); // need to round, because client does it automatically when displaying price
|
line 4001 of zone/client_packet.cpp should be changed from:
Quote:
inst2->SetPrice(item->Price*(1/.884)*Client::CalcPriceMod(vendor,false));
|
to:
Quote:
inst2->SetPrice(item->Price*(2)*Client::CalcPriceMod(vendor,false));
|
line 831 of zone/client_process.cpp should be changed from:
Quote:
inst->SetPrice((item->Price*(1/.884)*Client::CalcPriceMod(merch,false)));
|
to:
Quote:
inst->SetPrice((item->Price*(2)*Client::CalcPriceMod(merch,false)));
|
line 862 of zone/client_process.cpp should be changed from:
Quote:
inst->SetPrice((item->Price*(1/.884)*Client::CalcPriceMod(merch,false)));
|
to:
Quote:
inst->SetPrice((item->Price*(2)*Client::CalcPriceMod(merch,false)));
|
Overall: I replaced all 0.884 with 1 and all 1/0.884 with 2. (i left *1 in code on purpose for easier tracking) (idealy 1 and 2 can later be repalced by DB Rule variables to give custom server admins chance to make them even more specific)
The logic is following: the merchants now will have *2 times mark up when they selling to players, but are 100% of default item price when buying.
So a player with 100 cha and indifirent faction vs a Item X with default Db price of 1 plat:
will buy it from vendor for: 2 plat
will sell it to vendor for: 1 plat (imho this is great cuase this makes item pricing in Db very easy - sicne ist excatly the price player will get)
and then the actul price will be adjusted by faction and cha.
A player with Ally faction and 400 cha: (-26% total bonus)
will buy item from vendor for: 1.48 plat
will sell item to vendor for: 1.26 plat
so there is a decent margins left in between to prevent the problem cavedude curently described (of course given my assumtions for cuases for the problem are correct)
Now.. All modification are based purely on COMMON LOGIC of calculation statements - no actual C code function and calls have been altered.
I also cannot test this atm, since I have no compiler. Hopefuly someone can, and tell me if result of my alteration is anything close to what I have predicted
