mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-27 02:29:43 +00:00
Secrets: Added functionality to Perl/Server for $client->PlayMP3("name of file").
This commit is contained in:
@@ -5848,6 +5848,32 @@ XS(XS_Client_SilentMessage)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_PlayMP3); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_PlayMP3)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items < 1 || items > 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::PlayMP3(THIS, fname)");
|
||||
{
|
||||
Client * THIS;
|
||||
char * fname = nullptr;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (items > 1) { fname = (char *)SvPV_nolen(ST(1)); }
|
||||
|
||||
THIS->PlayMP3(fname);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@@ -6082,6 +6108,7 @@ XS(boot_Client)
|
||||
newXSproto(strcpy(buf, "SetThirst"), XS_Client_SetThirst, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetConsumption"), XS_Client_SetConsumption, file, "$$$");
|
||||
newXSproto(strcpy(buf, "SilentMessage"), XS_Client_SilentMessage, file, "$$");
|
||||
newXSproto(strcpy(buf, "PlayMP3"), XS_Client_PlayMP3, file, "$;$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user