[Quest API] Add GetNPCTintIndex() to Perl/Lua (#4983)

This commit is contained in:
Alex King 2025-08-16 21:34:39 -04:00 committed by GitHub
parent d475428157
commit e13b133ac8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 4 deletions

View File

@ -945,10 +945,16 @@ bool Lua_NPC::IsResumedFromZoneSuspend()
return self->IsResumedFromZoneSuspend();
}
void Lua_NPC::SetNPCTintIndex(uint32 id)
void Lua_NPC::SetNPCTintIndex(uint32 index)
{
Lua_Safe_Call_Void();
self->SendAppearancePacket(AppearanceType::NPCTintIndex, id);
self->SetNPCTintIndex(index);
}
uint32 Lua_NPC::GetNPCTintIndex()
{
Lua_Safe_Call_Int();
return self->GetNPCTintIndex();
}
luabind::scope lua_register_npc() {
@ -1018,6 +1024,7 @@ luabind::scope lua_register_npc() {
.def("GetNPCSpellsEffectsID", (uint32(Lua_NPC::*)(void))&Lua_NPC::GetNPCSpellsEffectsID)
.def("GetNPCSpellsID", (uint32(Lua_NPC::*)(void))&Lua_NPC::GetNPCSpellsID)
.def("GetNPCStat", (float(Lua_NPC::*)(std::string))&Lua_NPC::GetNPCStat)
.def("GetNPCTintIndex", (uint32(Lua_NPC::*)(void))&Lua_NPC::GetNPCTintIndex)
.def("GetPetSpellID", (int(Lua_NPC::*)(void))&Lua_NPC::GetPetSpellID)
.def("GetPlatinum", (uint32(Lua_NPC::*)(void))&Lua_NPC::GetPlatinum)
.def("GetPrimSkill", (int(Lua_NPC::*)(void))&Lua_NPC::GetPrimSkill)

View File

@ -200,6 +200,7 @@ public:
Lua_Spawn GetSpawn(lua_State* L);
bool IsResumedFromZoneSuspend();
void SetNPCTintIndex(uint32 id);
uint32 GetNPCTintIndex();
};

View File

@ -4940,3 +4940,16 @@ void NPC::ResetMultiQuest() {
m_hand_in = {};
}
void NPC::SetNPCTintIndex(uint32 index)
{
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
auto* s = (SpawnAppearance_Struct*) outapp->pBuffer;
s->spawn_id = GetID();
s->type = AppearanceType::NPCTintIndex;
s->parameter = index;
entity_list.QueueClients(this, outapp);
safe_delete(outapp);
}

View File

@ -552,6 +552,9 @@ public:
void ScaleNPC(uint8 npc_level, bool always_scale = false, bool override_special_abilities = false);
uint32 GetNPCTintIndex() { return m_npc_tint_id; }
void SetNPCTintIndex(uint32 index);
void RecalculateSkills();
void ReloadSpells();

View File

@ -885,9 +885,14 @@ Spawn2* Perl_NPC_GetSpawn(NPC* self)
return self->GetSpawn();
}
void Perl_NPC_SetNPCTintIndex(NPC* self, uint32 id)
void Perl_NPC_SetNPCTintIndex(NPC* self, uint32 index)
{
return self->SendAppearancePacket(AppearanceType::NPCTintIndex, id);
self->SetNPCTintIndex(index);
}
uint32 Perl_NPC_GetNPCTintIndex(NPC* self)
{
return self->GetNPCTintIndex();
}
void perl_register_npc()
@ -959,6 +964,7 @@ void perl_register_npc()
package.add("GetNPCSpellsEffectsID", &Perl_NPC_GetNPCSpellsEffectsID);
package.add("GetNPCSpellsID", &Perl_NPC_GetNPCSpellsID);
package.add("GetNPCStat", &Perl_NPC_GetNPCStat);
package.add("GetNPCTintIndex", &Perl_NPC_GetNPCTintIndex);
package.add("GetPetSpellID", &Perl_NPC_GetPetSpellID);
package.add("GetPlatinum", &Perl_NPC_GetPlatinum);
package.add("GetPrimSkill", &Perl_NPC_GetPrimSkill);