mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Factions] Remove from shared memory and simplify (#3999)
* [Factions] Remove from shared memory and simplify - Removes factions from shared memory and moves to zone based storage of repositories and changes the NPC `faction_list` to also use repositories. - This affects NPC Factions and Faction Associations. * Bug fixes. * Update client.cpp * Update client.cpp * Update client.cpp * Cleanup * Update client.cpp * Update client.cpp * Update client.cpp * Final push * Update CMakeLists.txt * Consolidate reloading. * [Cleanup] PR # 3999 (#4039) * [Fixes for PR # 3999 * [Reload actual in game factions, not just the umbrella data. * syntax * Fix typo * Foix bug where primary_faction not filled in when no hits * Fix typos * Fix splash factions for kills. * Fix typo * Fix more variable names to be accurate * Fix Loads to load new ones as they come in. * Load npc_factions without primary (tasks) and support old task faction * Rename to make way for new LoadFactionAssocition (by faction_id) * Fix some review comments * Add code to load factions for splash tasks and quests. * Fix issue with sign and RewardFaction, fix Log Message --------- Co-authored-by: Paul Coene <noudess@gmail.com>
This commit is contained in:
+21
-36
@@ -512,34 +512,19 @@ NPC::~NPC()
|
||||
{
|
||||
AI_Stop();
|
||||
|
||||
if(proximity != nullptr) {
|
||||
if (proximity) {
|
||||
entity_list.RemoveProximity(GetID());
|
||||
safe_delete(proximity);
|
||||
}
|
||||
|
||||
safe_delete(NPCTypedata_ours);
|
||||
|
||||
{
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
for(; cur != end; ++cur) {
|
||||
ServerLootItem_Struct* item = *cur;
|
||||
safe_delete(item);
|
||||
}
|
||||
itemlist.clear();
|
||||
for (auto* e : itemlist) {
|
||||
safe_delete(e);
|
||||
}
|
||||
|
||||
{
|
||||
std::list<struct NPCFaction*>::iterator cur,end;
|
||||
cur = faction_list.begin();
|
||||
end = faction_list.end();
|
||||
for(; cur != end; ++cur) {
|
||||
struct NPCFaction* fac = *cur;
|
||||
safe_delete(fac);
|
||||
}
|
||||
itemlist.clear();
|
||||
faction_list.clear();
|
||||
}
|
||||
|
||||
safe_delete(reface_timer);
|
||||
safe_delete(swarmInfoPtr);
|
||||
@@ -3204,19 +3189,17 @@ FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
|
||||
|
||||
//Look through our faction list and return a faction con based
|
||||
//on the npc_value for the other person's primary faction in our list.
|
||||
FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
|
||||
std::list<struct NPCFaction*>::iterator cur,end;
|
||||
cur = faction_list.begin();
|
||||
end = faction_list.end();
|
||||
for(; cur != end; ++cur) {
|
||||
struct NPCFaction* fac = *cur;
|
||||
if ((int32)fac->factionID == other_faction) {
|
||||
if (fac->npc_value > 0)
|
||||
FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction)
|
||||
{
|
||||
for (const auto& e : faction_list) {
|
||||
if (e.faction_id == other_faction) {
|
||||
if (e.npc_value > 0) {
|
||||
return FACTION_ALLY;
|
||||
else if (fac->npc_value < 0)
|
||||
} else if (e.npc_value < 0) {
|
||||
return FACTION_SCOWLS;
|
||||
else
|
||||
} else {
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3225,14 +3208,16 @@ FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
|
||||
// where an npc is on a faction but has no hits (hence no entry in
|
||||
// npc_faction_entries).
|
||||
|
||||
if (GetPrimaryFaction() == other_faction)
|
||||
if (GetPrimaryFaction() == other_faction) {
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
} else {
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
}
|
||||
|
||||
bool NPC::IsFactionListAlly(uint32 other_faction) {
|
||||
return(CheckNPCFactionAlly(other_faction) == FACTION_ALLY);
|
||||
bool NPC::IsFactionListAlly(uint32 other_faction)
|
||||
{
|
||||
return CheckNPCFactionAlly(other_faction) == FACTION_ALLY;
|
||||
}
|
||||
|
||||
int NPC::GetScore()
|
||||
@@ -3673,9 +3658,9 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
|
||||
*/
|
||||
if (mob->GetLevel() >= 50 || mob->AlwaysAggro() || attacker->GetLevelCon(mob->GetLevel()) != CON_GRAY) {
|
||||
if (mob->GetPrimaryFaction() == sender->CastToNPC()->GetPrimaryFaction()) {
|
||||
const NPCFactionList *cf = content_db.GetNPCFactionEntry(mob->CastToNPC()->GetNPCFactionID());
|
||||
if (cf) {
|
||||
if (cf->assistprimaryfaction == 0) {
|
||||
const auto f = zone->GetNPCFaction(mob->CastToNPC()->GetNPCFactionID());
|
||||
if (f) {
|
||||
if (f->ignore_primary_assist) {
|
||||
continue; //Same faction and ignore primary assist
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user