Added ignore_despawn column to npc_types to have NPCs ignore the despawn column in spawngroup.

This commit is contained in:
regneq
2017-04-07 19:45:26 -07:00
parent 75d759fb77
commit 4600844336
7 changed files with 32 additions and 5 deletions
+1
View File
@@ -374,6 +374,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if
InitializeBuffSlots();
CalcBonuses();
raid_target = d->raid_target;
ignore_despawn = d->ignore_despawn;
}
NPC::~NPC()
+3
View File
@@ -417,6 +417,8 @@ public:
bool IsRaidTarget() const { return raid_target; };
void ResetHPUpdateTimer() { sendhpupdate_timer.Start(); }
bool IgnoreDespawn() { return ignore_despawn; }
protected:
const NPCType* NPCTypedata;
@@ -532,6 +534,7 @@ protected:
bool raid_target;
uint8 probability;
bool ignore_despawn; //NPCs with this set to 1 will ignore the despawn value in spawngroup
private:
uint32 loottable_id;
+22 -4
View File
@@ -208,11 +208,26 @@ bool Spawn2::Process() {
}
}
if(sg->despawn != 0 && condition_id == 0)
zone->Despawn(spawn2_id);
if(IsDespawned)
bool ignore_despawn = false;
if (npcthis)
{
ignore_despawn = npcthis->IgnoreDespawn();
}
if (ignore_despawn)
{
return true;
}
if (sg->despawn != 0 && condition_id == 0 && !ignore_despawn)
{
zone->Despawn(spawn2_id);
}
if (IsDespawned)
{
return true;
}
currentnpcid = npcid;
NPC* npc = new NPC(tmp, this, glm::vec4(x, y, z, heading), FlyMode3);
@@ -295,6 +310,9 @@ void Spawn2::ForceDespawn()
if(npcthis != nullptr)
{
if (npcthis->IgnoreDespawn())
return;
if(!npcthis->IsEngaged())
{
if(sg->despawn == 3 || sg->despawn == 4)
+3 -1
View File
@@ -1966,7 +1966,8 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
"npc_types.bracertexture, "
"npc_types.handtexture, "
"npc_types.legtexture, "
"npc_types.feettexture "
"npc_types.feettexture, "
"npc_types.ignore_despawn "
"FROM npc_types %s",
where_condition.c_str()
);
@@ -2141,6 +2142,7 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
temp_npctype_data->handtexture = atoi(row[94]);
temp_npctype_data->legtexture = atoi(row[95]);
temp_npctype_data->feettexture = atoi(row[96]);
temp_npctype_data->ignore_despawn = atoi(row[97]) == 1 ? true : false;
// If NPC with duplicate NPC id already in table,
// free item we attempted to add.
+1
View File
@@ -132,6 +132,7 @@ struct NPCType
uint8 handtexture;
uint8 legtexture;
uint8 feettexture;
bool ignore_despawn;
};
namespace player_lootitem {