mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-29 08:38:20 +00:00
Fix for perl scripts passing non-client objects to API handler for MovePC and MovePCInstance. [Fixes #127]
This commit is contained in:
+31
-2
@@ -1259,7 +1259,22 @@ XS(XS_Client_MovePC)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->MovePC(zoneID, x, y, z, heading);
|
||||
if (THIS->IsClient()) {
|
||||
THIS->MovePC(zoneID, x, y, z, heading);
|
||||
}
|
||||
else {
|
||||
if (THIS->IsBot())
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type Bot reference");
|
||||
else if (THIS->IsMerc())
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type Merc reference");
|
||||
else if (THIS->IsNPC())
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type NPC reference");
|
||||
else
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
|
||||
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
}
|
||||
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@@ -1288,7 +1303,21 @@ XS(XS_Client_MovePCInstance)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->MovePC(zoneID, instanceID, x, y, z, heading);
|
||||
if (THIS->IsClient()) {
|
||||
THIS->MovePC(zoneID, instanceID, x, y, z, heading);
|
||||
}
|
||||
else {
|
||||
if (THIS->IsBot())
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
|
||||
else if (THIS->IsMerc())
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
|
||||
else if (THIS->IsNPC())
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
|
||||
else
|
||||
_log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
|
||||
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
}
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user