Fully implemented QuestReward. (credit to Cavedude on EQMacEmu)

Syntax on NPC is:
e.other:QuestReward(e.self,copper,silver,gold,platinum,item,experience,factionid,factionvalue);

This will give you any or all of the rewards and their messages with one call, including the quest ding sound. Any item is sent to your inventory, like SummonItem does now. The coin message is generated by the client, and will give you a message for each coin type (You recieve 5 copper...). No way around that, but it's still useful if the reward only calls for a single type.
This commit is contained in:
regneq
2015-05-11 11:35:54 -07:00
parent c360aa9b0f
commit d1fbd086d7
11 changed files with 161 additions and 107 deletions
+52 -1
View File
@@ -6188,6 +6188,57 @@ XS(XS_Client_GetTargetRingZ)
XSRETURN(1);
}
XS(XS_Client_QuestReward); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_QuestReward)
{
dXSARGS;
if (items < 1 || items > 9)
Perl_croak(aTHX_ "Usage: Client::QuestReward(THIS, mob, copper, silver, gold, platinum, itemid, exp, factionid, faction)");
{
Client* THIS;
Mob * mob = nullptr;
int32 copper = 0;
int32 silver = 0;
int32 gold = 0;
int32 platinum = 0;
int32 itemid = 0;
int32 exp = 0;
int32 factionid = 0;
int32 faction = 0;
if (sv_derived_from(ST(0), "THIS")) {
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.");
if (items > 1) {
if (sv_derived_from(ST(1), "mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
mob = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "mob is not of type Mob");
if (mob == nullptr)
Perl_croak(aTHX_ "mob is nullptr, avoiding crash.");
}
if (items > 2) { copper = (int32)SvIV(ST(2)); }
if (items > 3) { silver = (int32)SvIV(ST(3)); }
if (items > 4) { gold = (int32)SvIV(ST(4)); }
if (items > 5) { platinum = (int32)SvIV(ST(5)); }
if (items > 6) { itemid = (int32)SvIV(ST(6)); }
if (items > 7) { exp = (int32)SvIV(ST(7)); }
if (items > 8) { factionid = (int32)SvIV(ST(8)); }
if (items > 9) { faction = (int32)SvIV(ST(9)); }
THIS->QuestReward(mob, copper, silver, gold, platinum, itemid, exp, factionid, faction);
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
#endif
@@ -6432,7 +6483,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "GetTargetRingX"), XS_Client_GetTargetRingX, file, "$$");
newXSproto(strcpy(buf, "GetTargetRingY"), XS_Client_GetTargetRingY, file, "$$");
newXSproto(strcpy(buf, "GetTargetRingZ"), XS_Client_GetTargetRingZ, file, "$$");
newXSproto(strcpy(buf, "QuestReward"), XS_Client_QuestReward, file, "$$;$$$$$$$$");
XSRETURN_YES;
}