mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Added rules for what int mobs need to not attack red cons and how much food and drink is taken per stamina update.
Added mod hooks for food/drink values and mob aggro. Added quest functions for getting/setting hunger and thirst.
This commit is contained in:
@@ -5692,6 +5692,131 @@ XS(XS_Client_GetAccountFlag)
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_GetHunger); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_GetHunger)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Client::GetHunger(THIS)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
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.");
|
||||
|
||||
RETVAL = THIS->GetHunger();
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_GetThirst); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_GetThirst)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Client::GetThirst(THIS)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
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.");
|
||||
|
||||
RETVAL = THIS->GetThirst();
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_SetHunger); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetHunger)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::SetHunger(THIS, in_hunger)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 in_hunger = (uint32)SvUV(ST(1));
|
||||
|
||||
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->SetHunger(in_hunger);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_SetThirst); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetThirst)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::SetThirst(THIS, in_thirst)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 in_thirst = (uint32)SvUV(ST(1));
|
||||
|
||||
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->SetThirst(in_thirst);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_SetConsumption); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetConsumption)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_ "Usage: Client::SetHunger(THIS, in_hunger, in_thirst)");
|
||||
{
|
||||
Client * THIS;
|
||||
int32 in_hunger = (uint32)SvUV(ST(1));
|
||||
int32 in_thirst = (uint32)SvUV(ST(2));
|
||||
|
||||
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->SetConsumption(in_hunger, in_thirst);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@@ -5920,6 +6045,11 @@ XS(boot_Client)
|
||||
newXSproto(strcpy(buf, "HasSpellScribed"), XS_Client_HasSkill, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetAccountFlag"), XS_Client_SetAccountFlag, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetAccountFlag"), XS_Client_GetAccountFlag, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetHunger"), XS_Client_GetHunger, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetThirst"), XS_Client_GetThirst, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetHunger"), XS_Client_SetHunger, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetThirst"), XS_Client_SetThirst, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetConsumption"), XS_Client_SetConsumption, file, "$$$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user