mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
perl $npc->ChangeLastName(name)
perl $npc->ClearLastName() Modifies NPC last names.
This commit is contained in:
parent
167b6f5ebf
commit
9d866c1889
23
zone/npc.cpp
23
zone/npc.cpp
@ -2394,6 +2394,29 @@ void NPC::DoQuestPause(Mob *other) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NPC::ChangeLastName(const char* in_lastname)
|
||||||
|
{
|
||||||
|
|
||||||
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct));
|
||||||
|
GMLastName_Struct* gmn = (GMLastName_Struct*)outapp->pBuffer;
|
||||||
|
strcpy(gmn->name, GetName());
|
||||||
|
strcpy(gmn->gmname, GetName());
|
||||||
|
strcpy(gmn->lastname, in_lastname);
|
||||||
|
gmn->unknown[0]=1;
|
||||||
|
gmn->unknown[1]=1;
|
||||||
|
gmn->unknown[2]=1;
|
||||||
|
gmn->unknown[3]=1;
|
||||||
|
entity_list.QueueClients(this, outapp, false);
|
||||||
|
safe_delete(outapp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPC::ClearLastName()
|
||||||
|
{
|
||||||
|
std::string WT;
|
||||||
|
WT = '\0'; //Clear Last Name
|
||||||
|
ChangeLastName( WT.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void NPC::DepopSwarmPets()
|
void NPC::DepopSwarmPets()
|
||||||
{
|
{
|
||||||
if (GetSwarmInfo()) {
|
if (GetSwarmInfo()) {
|
||||||
|
|||||||
@ -361,6 +361,9 @@ public:
|
|||||||
const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; }
|
const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; }
|
||||||
const char* GetRawNPCTypeName() const { return NPCTypedata->name; }
|
const char* GetRawNPCTypeName() const { return NPCTypedata->name; }
|
||||||
|
|
||||||
|
void ChangeLastName(const char* in_lastname);
|
||||||
|
void ClearLastName();
|
||||||
|
|
||||||
bool GetDepop() { return p_depop; }
|
bool GetDepop() { return p_depop; }
|
||||||
|
|
||||||
void NPCSlotTexture(uint8 slot, uint16 texture); // Sets new material values for slots
|
void NPCSlotTexture(uint8 slot, uint16 texture); // Sets new material values for slots
|
||||||
|
|||||||
@ -2409,6 +2409,55 @@ XS(XS_NPC_AddDefensiveProc) {
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS_NPC_ChangeLastName); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_NPC_ChangeLastName)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items < 1 || items > 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: Mob::ChangeLastName(THIS, name)");
|
||||||
|
{
|
||||||
|
NPC * THIS;
|
||||||
|
char * name = nullptr;
|
||||||
|
|
||||||
|
if (sv_derived_from(ST(0), "NPC")) {
|
||||||
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||||
|
THIS = INT2PTR(NPC *,tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||||
|
if(THIS == nullptr)
|
||||||
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
|
if (items > 1) { name = (char *)SvPV_nolen(ST(1)); }
|
||||||
|
|
||||||
|
THIS->ChangeLastName(name);
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS_NPC_ClearLastName); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_NPC_ClearLastName)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 1)
|
||||||
|
Perl_croak(aTHX_ "Usage: Mob::ClearLastName(THIS)");
|
||||||
|
{
|
||||||
|
NPC * THIS;
|
||||||
|
|
||||||
|
if (sv_derived_from(ST(0), "NPC")) {
|
||||||
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||||
|
THIS = INT2PTR(NPC *,tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||||
|
if(THIS == nullptr)
|
||||||
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
|
THIS->ClearLastName();
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
@ -2517,6 +2566,8 @@ XS(boot_NPC)
|
|||||||
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
|
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
|
||||||
newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$");
|
newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$");
|
||||||
newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$");
|
newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$");
|
||||||
|
newXSproto(strcpy(buf, "ChangeLastName"), XS_NPC_ChangeLastName, file, "$:$");
|
||||||
|
newXSproto(strcpy(buf, "ClearLastName"), XS_NPC_ClearLastName, file, "$");
|
||||||
XSRETURN_YES;
|
XSRETURN_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user