Add DyeArmorBySlot(slot, red, green, blue, use_tint) to Perl/Lua.

This commit is contained in:
Alex
2020-06-29 20:54:48 -04:00
parent f32126faac
commit eed1fd8a43
5 changed files with 60 additions and 0 deletions
+29
View File
@@ -312,6 +312,34 @@ XS(XS_Client_Duck) {
XSRETURN_EMPTY;
}
XS(XS_Client_DyeArmorBySlot); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_DyeArmorBySlot) {
dXSARGS;
if (items != 5 && items != 6)
Perl_croak(aTHX_ "Usage: Client::DyeArmorBySlot(THIS, uint8 slot, uint8 red, uint8 green, uint8 blue, [uint8 use_tint = 0x00])");
{
Client *THIS;
uint8 slot = (uint8) SvUV(ST(1));
uint8 red = (uint8) SvUV(ST(2));
uint8 green = (uint8) SvUV(ST(3));
uint8 blue = (uint8) SvUV(ST(4));
uint8 use_tint = 0x00;
if (items == 6) {
use_tint = (uint8) SvUV(ST(5));
}
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 Client");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->DyeArmorBySlot(slot, red, green, blue, use_tint);
}
XSRETURN_EMPTY;
}
XS(XS_Client_Stand); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_Stand) {
dXSARGS;
@@ -6585,6 +6613,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "Disconnect"), XS_Client_Disconnect, file, "$");
newXSproto(strcpy(buf, "DropItem"), XS_Client_DropItem, file, "$$");
newXSproto(strcpy(buf, "Duck"), XS_Client_Duck, file, "$");
newXSproto(strcpy(buf, "DyeArmorBySlot"), XS_Client_DyeArmorBySlot, file, "$$$$$;$");
newXSproto(strcpy(buf, "Escape"), XS_Client_Escape, file, "$");
newXSproto(strcpy(buf, "ExpeditionMessage"), XS_Client_ExpeditionMessage, file, "$$$");
newXSproto(strcpy(buf, "FailTask"), XS_Client_FailTask, file, "$$");