Add show_name and untargetable to npc_types fixes #637

Note the bodytype hack is still there since I was having issues with
some npcs still showing names
This commit is contained in:
Michael Cook (mackal) 2017-07-19 02:17:08 -04:00
parent 20b6c2f556
commit ec77e3a6fd
12 changed files with 27 additions and 10 deletions

View File

@ -305,6 +305,7 @@ union
uint8 DestructibleUnk8;
uint32 DestructibleUnk9;
bool targetable_with_hotkey;
bool show_name;
};

View File

@ -3930,7 +3930,7 @@ namespace RoF
if (strlen(emu->suffix))
PacketSize += strlen(emu->suffix) + 1;
bool ShowName = 1;
bool ShowName = emu->show_name;
if (emu->bodytype >= 66)
{
emu->race = 127;

View File

@ -4086,7 +4086,7 @@ namespace RoF2
PacketSize += strlen(emu->DestructibleString) + 1;
}
bool ShowName = 1;
bool ShowName = emu->show_name;
if (emu->bodytype >= 66)
{
emu->race = 127;

View File

@ -2560,7 +2560,7 @@ namespace SoD
PacketSize += strlen(emu->DestructibleString) + 1;
}
bool ShowName = 1;
bool ShowName = emu->show_name;
if (emu->bodytype >= 66)
{
emu->race = 127;

View File

@ -2097,7 +2097,7 @@ namespace SoF
int k;
for (r = 0; r < entrycount; r++, eq++, emu++) {
eq->showname = 1; //New Field - Toggles Name Display on or off - 0 = off, 1 = on
eq->showname = emu->show_name ? 1 : 0; //New Field - Toggles Name Display on or off - 0 = off, 1 = on
eq->linkdead = 0; //New Field - Toggles LD on or off after name - 0 = off, 1 = on
eq->statue = 0; //New Field - 1 freezes animation
eq->showhelm = emu->showhelm;
@ -2136,10 +2136,10 @@ namespace SoF
eq->findable = emu->findable;
if (emu->bodytype >= 66)
{
eq->bodytype = 11; //non-targetable
eq->showname = 0; //no visible name
eq->race = 127; //invisible man
eq->gender = 0; //invisible men are gender 0
eq->bodytype = 11; //non-targetable
eq->showname = 0; //no visible name
eq->race = 127; //invisible man
eq->gender = 0; //invisible men are gender 0
}
else
{

View File

@ -2844,7 +2844,7 @@ namespace UF
PacketSize += strlen(emu->DestructibleString) + 1;
}
bool ShowName = 1;
bool ShowName = emu->show_name;
if (emu->bodytype >= 66)
{
emu->race = 127;

View File

@ -0,0 +1,3 @@
ALTER TABLE `npc_types` ADD COLUMN `show_name` TINYINT(2) NOT NULL DEFAULT 1;
ALTER TABLE `npc_types` ADD COLUMN `untargetable` TINYINT(2) NOT NULL DEFAULT 0;
UPDATE `npc_types` SET `show_name` = 0, `untargetable` = 1 WHERE `bodytype` >= 66;

View File

@ -1944,6 +1944,7 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.guildID = GuildID();
// ns->spawn.linkdead = IsLD() ? 1 : 0;
// ns->spawn.pvp = GetPVP() ? 1 : 0;
ns->spawn.show_name = true;
strcpy(ns->spawn.title, m_pp.title);

View File

@ -659,6 +659,8 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue)
QueueClients(npc, app);
npc->SendArmorAppearance();
npc->SetAppearance(npc->GetGuardPointAnim(),false);
if (!npc->IsTargetable())
npc->SendTargetable(false);
safe_delete(app);
} else {
auto ns = new NewSpawn_Struct;
@ -799,6 +801,8 @@ void EntityList::CheckSpawnQueue()
NPC *pnpc = it->second;
pnpc->SendArmorAppearance();
pnpc->SetAppearance(pnpc->GetGuardPointAnim(), false);
if (!pnpc->IsTargetable())
pnpc->SendTargetable(false);
}
safe_delete(outapp);
iterator.RemoveCurrent();

View File

@ -375,6 +375,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if
CalcBonuses();
raid_target = d->raid_target;
ignore_despawn = d->ignore_despawn;
m_targetable = !d->untargetable;
}
NPC::~NPC()
@ -1906,6 +1907,7 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.is_npc = 1;
UpdateActiveLight();
ns->spawn.light = GetActiveLightType();
ns->spawn.show_name = NPCTypedata->show_name;
}
void NPC::PetOnSpawn(NewSpawn_Struct* ns)

View File

@ -1967,7 +1967,9 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
"npc_types.handtexture, "
"npc_types.legtexture, "
"npc_types.feettexture, "
"npc_types.ignore_despawn "
"npc_types.ignore_despawn, "
"npc_types.show_name, "
"npc_types.untargetable "
"FROM npc_types %s",
where_condition.c_str()
);
@ -2143,6 +2145,8 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
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;
temp_npctype_data->show_name = atoi(row[98]) != 0 ? true : false;
temp_npctype_data->untargetable = atoi(row[99]) != 0 ? true : false;
// If NPC with duplicate NPC id already in table,
// free item we attempted to add.

View File

@ -133,6 +133,8 @@ struct NPCType
uint8 legtexture;
uint8 feettexture;
bool ignore_despawn;
bool show_name; // should default on
bool untargetable;
};
namespace player_lootitem {