mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Merge pull request #802 from noudess/master
New min/max personal faction per faction. Use of actual client mods for race/class/deity
This commit is contained in:
+12
-6
@@ -3470,7 +3470,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)
|
||||
@@ -7705,7 +7705,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--------------------------------------------------------------
|
||||
@@ -7792,7 +7792,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)
|
||||
@@ -7842,7 +7842,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
|
||||
@@ -7943,9 +7943,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;
|
||||
}
|
||||
|
||||
@@ -7958,7 +7964,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));
|
||||
|
||||
@@ -4623,7 +4623,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
|
||||
con->playerid = GetID();
|
||||
con->targetid = conin->targetid;
|
||||
if (tmob->IsNPC())
|
||||
con->faction = GetFactionLevel(character_id, tmob->GetNPCTypeID(), race, class_, deity, (tmob->IsNPC()) ? tmob->CastToNPC()->GetPrimaryFaction() : 0, tmob); // Dec. 20, 2001; TODO: Send the players proper deity
|
||||
con->faction = GetFactionLevel(character_id, tmob->GetNPCTypeID(), GetFactionRace(), class_, deity, (tmob->IsNPC()) ? tmob->CastToNPC()->GetPrimaryFaction() : 0, tmob); // Dec. 20, 2001; TODO: Send the players proper deity
|
||||
else
|
||||
con->faction = 1;
|
||||
con->level = GetLevelCon(tmob->GetLevel());
|
||||
|
||||
+1
-1
@@ -1046,7 +1046,7 @@ void PerlembParser::ExportMobVariables(bool isPlayerQuest, bool isGlobalPlayerQu
|
||||
if (mob && npcmob && mob->IsClient()) {
|
||||
Client* client = mob->CastToClient();
|
||||
|
||||
fac = client->GetFactionLevel(client->CharacterID(), npcmob->GetID(), client->GetRace(),
|
||||
fac = client->GetFactionLevel(client->CharacterID(), npcmob->GetID(), client->GetFactionRace(),
|
||||
client->GetClass(), client->GetDeity(), npcmob->GetPrimaryFaction(), npcmob);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -1553,7 +1553,7 @@ void Mob::ShowStats(Client* client)
|
||||
}
|
||||
}
|
||||
else {
|
||||
client->Message(0, " Level: %i AC: %i Class: %i Size: %1.1f Haste: %i", GetLevel(), GetAC(), GetClass(), GetSize(), GetHaste());
|
||||
client->Message(0, " Level: %i AC: %i Class: %i Size: %1.1f Haste: %i", GetLevel(), ACSum(), GetClass(), GetSize(), GetHaste());
|
||||
client->Message(0, " HP: %i Max HP: %i",GetHP(), GetMaxHP());
|
||||
client->Message(0, " Mana: %i Max Mana: %i", GetMana(), GetMaxMana());
|
||||
client->Message(0, " Total ATK: %i Worn/Spell ATK (Cap %i): %i", GetATK(), RuleI(Character, ItemATKCap), GetATKBonus());
|
||||
@@ -2121,6 +2121,16 @@ bool Mob::IsPlayerRace(uint16 in_race) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16 Mob::GetFactionRace() {
|
||||
uint16 current_race = GetRace();
|
||||
if (IsPlayerRace(current_race) || current_race == TREE ||
|
||||
current_race == MINOR_ILL_OBJ) {
|
||||
return current_race;
|
||||
}
|
||||
else {
|
||||
return (GetBaseRace());
|
||||
}
|
||||
}
|
||||
|
||||
uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) {
|
||||
if (Mob::IsPlayerRace(in_race) || in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118 || in_race == 562) {
|
||||
|
||||
@@ -442,6 +442,7 @@ public:
|
||||
virtual void SetMaxHP() { current_hp = max_hp; }
|
||||
virtual inline uint16 GetBaseRace() const { return base_race; }
|
||||
virtual inline uint8 GetBaseGender() const { return base_gender; }
|
||||
virtual uint16 GetFactionRace();
|
||||
virtual inline uint16 GetDeity() const { return deity; }
|
||||
virtual EQEmu::deity::DeityTypeBit GetDeityBit() { return EQEmu::deity::ConvertDeityTypeToDeityTypeBit((EQEmu::deity::DeityType)deity); }
|
||||
inline uint16 GetRace() const { return race; }
|
||||
|
||||
+1
-1
@@ -2899,7 +2899,7 @@ uint8 QuestManager::FactionValue()
|
||||
FACTION_VALUE oldfac;
|
||||
uint8 newfac = 0;
|
||||
if(initiator && owner->IsNPC()) {
|
||||
oldfac = initiator->GetFactionLevel(initiator->GetID(), owner->GetID(), initiator->GetRace(), initiator->GetClass(), initiator->GetDeity(), owner->GetPrimaryFaction(), owner);
|
||||
oldfac = initiator->GetFactionLevel(initiator->GetID(), owner->GetID(), initiator->GetFactionRace(), initiator->GetClass(), initiator->GetDeity(), owner->GetPrimaryFaction(), owner);
|
||||
|
||||
// now, reorder the faction to have it make sense (higher values are better)
|
||||
switch (oldfac) {
|
||||
|
||||
Regular → Executable
+26
-6
@@ -3914,6 +3914,8 @@ bool ZoneDatabase::GetFactionData(FactionMods* fm, uint32 class_mod, uint32 race
|
||||
}
|
||||
|
||||
fm->base = faction_array[faction_id]->base;
|
||||
fm->min = faction_array[faction_id]->min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
|
||||
fm->max = faction_array[faction_id]->max; // The highest your personal earned faction can go - before race/class/diety adjustments.
|
||||
|
||||
if(class_mod > 0) {
|
||||
char str[32];
|
||||
@@ -4060,14 +4062,32 @@ bool ZoneDatabase::LoadFactionData()
|
||||
faction_array[index] = new Faction;
|
||||
strn0cpy(faction_array[index]->name, row[1], 50);
|
||||
faction_array[index]->base = atoi(row[2]);
|
||||
faction_array[index]->min = MIN_PERSONAL_FACTION;
|
||||
faction_array[index]->max = MAX_PERSONAL_FACTION;
|
||||
|
||||
query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index);
|
||||
auto modResults = QueryDatabase(query);
|
||||
if (!modResults.Success())
|
||||
continue;
|
||||
// Load in the mimimum and maximum faction that can be earned for this faction
|
||||
query = StringFormat("SELECT `min` , `max` FROM `faction_base_data` WHERE client_faction_id = %u", index);
|
||||
auto baseResults = QueryDatabase(query);
|
||||
if (!baseResults.Success() || baseResults.RowCount() == 0) {
|
||||
Log(Logs::General, Logs::General, "Faction %d has no base data", (int)index);
|
||||
}
|
||||
else {
|
||||
for (auto modRow = baseResults.begin(); modRow != baseResults.end(); ++modRow) {
|
||||
faction_array[index]->min = atoi(modRow[0]);
|
||||
faction_array[index]->max = atoi(modRow[1]);
|
||||
Log(Logs::General, Logs::None, "Min(%d), Max(%d) for faction (%u)",faction_array[index]->min, faction_array[index]->max, index);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow)
|
||||
faction_array[index]->mods[modRow[1]] = atoi(modRow[0]);
|
||||
// Load in modifiers to the faction based on characters race, class and diety.
|
||||
query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index);
|
||||
auto modResults = QueryDatabase(query);
|
||||
if (!modResults.Success())
|
||||
continue;
|
||||
|
||||
for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow) {
|
||||
faction_array[index]->mods[modRow[1]] = atoi(modRow[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user