Fixes for bug wherein illusions other than PC races could be exploited.

Fixed for areas that neglected to take into account alliance and item faction
bonuses.
This commit is contained in:
Noudess
2019-02-07 14:48:31 -05:00
parent 46ead8e29e
commit ad97968d5e
6 changed files with 28 additions and 11 deletions
+13 -7
View File
@@ -3457,7 +3457,7 @@ float Client::CalcPriceMod(Mob* other, bool reverse)
float chaformula = 0;
if (other)
{
int factionlvl = GetFactionLevel(CharacterID(), other->CastToNPC()->GetNPCTypeID(), GetRace(), GetClass(), GetDeity(), other->CastToNPC()->GetPrimaryFaction(), other);
int factionlvl = GetFactionLevel(CharacterID(), other->CastToNPC()->GetNPCTypeID(), GetFactionRace(), GetClass(), GetDeity(), other->CastToNPC()->GetPrimaryFaction(), other);
if (factionlvl >= FACTION_APPREHENSIVE) // Apprehensive or worse.
{
if (GetCHA() > 103)
@@ -7692,7 +7692,7 @@ FACTION_VALUE Client::GetReverseFactionCon(Mob* iOther) {
if (iOther->GetPrimaryFaction() == 0)
return FACTION_INDIFFERENT;
return GetFactionLevel(CharacterID(), 0, GetRace(), GetClass(), GetDeity(), iOther->GetPrimaryFaction(), iOther);
return GetFactionLevel(CharacterID(), 0, GetFactionRace(), GetClass(), GetDeity(), iOther->GetPrimaryFaction(), iOther);
}
//o--------------------------------------------------------------
@@ -7779,7 +7779,7 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, ui
// Find out starting faction for this faction
// It needs to be used to adj max and min personal
// The range is still the same, 1200-3000(4200), but adjusted for base
database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(),
database.GetFactionData(&fm, GetClass(), GetFactionRace(), GetDeity(),
faction_id[i]);
if (quest)
@@ -7829,7 +7829,7 @@ void Client::SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class
// Find out starting faction for this faction
// It needs to be used to adj max and min personal
// The range is still the same, 1200-3000(4200), but adjusted for base
database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(),
database.GetFactionData(&fm, GetClass(), GetFactionRace(), GetDeity(),
faction_id);
// Adjust the amount you can go up or down so the resulting range
@@ -7930,9 +7930,15 @@ return;
int32 Client::GetModCharacterFactionLevel(int32 faction_id) {
int32 Modded = GetCharacterFactionLevel(faction_id);
FactionMods fm;
if (database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(), faction_id))
if (database.GetFactionData(&fm, GetClass(), GetFactionRace(), GetDeity(), faction_id))
{
Modded += fm.base + fm.class_mod + fm.race_mod + fm.deity_mod;
//Tack on any bonuses from Alliance type spell effects
Modded += GetFactionBonus(faction_id);
Modded += GetItemFactionBonus(faction_id);
}
return Modded;
}
@@ -7945,7 +7951,7 @@ void Client::MerchantRejectMessage(Mob *merchant, int primaryfaction)
// If a faction is involved, get the data.
if (primaryfaction > 0) {
if (database.GetFactionData(&fmod, GetClass(), GetRace(), GetDeity(), primaryfaction)) {
if (database.GetFactionData(&fmod, GetClass(), GetFactionRace(), GetDeity(), primaryfaction)) {
tmpFactionValue = GetCharacterFactionLevel(primaryfaction);
lowestvalue = std::min(std::min(tmpFactionValue, fmod.deity_mod),
std::min(fmod.class_mod, fmod.race_mod));
@@ -9126,4 +9132,4 @@ bool Client::GotoPlayer(std::string player_name)
}
return false;
}
}