add --questitem to perl-doc-parser.pl - format and add usage doc to perl_questitem.cpp

This commit is contained in:
Akkadius 2018-07-01 20:52:56 -05:00
parent 9e03d76211
commit 595138679d
2 changed files with 101 additions and 102 deletions

View File

@ -11,6 +11,7 @@ sub usage() {
print " --object - Prints methods for just object class methods\n"; print " --object - Prints methods for just object class methods\n";
print " --group - Prints methods for just group class methods\n"; print " --group - Prints methods for just group class methods\n";
print " --raid - Prints methods for just raid class methods\n"; print " --raid - Prints methods for just raid class methods\n";
print " --questitem - Prints methods for just questitem class methods\n";
print " --corpse - Prints methods for just corpse class methods\n"; print " --corpse - Prints methods for just corpse class methods\n";
print " --hateentry - Prints methods for just hateentry class methods\n"; print " --hateentry - Prints methods for just hateentry class methods\n";
print " --all - Prints methods for all classes\n"; print " --all - Prints methods for all classes\n";
@ -45,6 +46,8 @@ for my $file (@files) {
} }
@methods = (); @methods = ();
$split_key = "";
$object_prefix = "";
#::: Open File #::: Open File
print "\nOpening '" . $file . "'\n"; print "\nOpening '" . $file . "'\n";
@ -53,7 +56,7 @@ for my $file (@files) {
chomp; chomp;
$line = $_; $line = $_;
if ($line=~/Client::|Mob::|Corpse::|EntityList::|Doors::|Group::|HateEntry::|NPC::|Object::|Raid::/i && $line=~/_croak/i) { if ($line=~/Perl_croak/i && $line=~/Usa/i && $line=~/::/i) {
#::: Client export #::: Client export
if ($export=~/all|client/i && $line=~/Client::/i) { if ($export=~/all|client/i && $line=~/Client::/i) {
@ -115,6 +118,12 @@ for my $file (@files) {
$object_prefix = "\$hate_entry->"; $object_prefix = "\$hate_entry->";
} }
#::: Hateentry export
if ($export=~/all|questitem/i && $line=~/QuestItem::/i) {
$split_key = "QuestItem::";
$object_prefix = "\$quest_item->";
}
#::: Split on croak usage #::: Split on croak usage
@data = split($split_key, $line); @data = split($split_key, $line);
$usage = trim($data[1]); $usage = trim($data[1]);

View File

@ -18,7 +18,9 @@
#include "../common/features.h" #include "../common/features.h"
#include "client.h" #include "client.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@ -28,7 +30,7 @@
#include "../common/item_instance.h" #include "../common/item_instance.h"
#ifdef THIS /* this macro seems to leak out on some systems */ #ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS #undef THIS
#endif #endif
@ -38,76 +40,73 @@ XS(XS_QuestItem_GetName) {
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)");
{ {
EQEmu::ItemInstance * THIS; EQEmu::ItemInstance *THIS;
Const_char * RETVAL; Const_char *RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->Name; RETVAL = THIS->GetItem()->Name;
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_SetScale); XS(XS_QuestItem_SetScale);
XS(XS_QuestItem_SetScale) XS(XS_QuestItem_SetScale) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, scale factor)"); Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, float scale_multiplier)");
{ {
EQEmu::ItemInstance * THIS; EQEmu::ItemInstance *THIS;
float Mult; float Mult;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
Mult = (float)SvNV(ST(1)); Mult = (float) SvNV(ST(1));
if(THIS->IsScaling()) { if (THIS->IsScaling()) {
THIS->SetExp((int)(Mult*10000+.5)); THIS->SetExp((int) (Mult * 10000 + .5));
} }
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_QuestItem_ItemSay); XS(XS_QuestItem_ItemSay);
XS(XS_QuestItem_ItemSay) XS(XS_QuestItem_ItemSay) {
{
dXSARGS; dXSARGS;
if (items != 2 && items != 3) if (items != 2 && items != 3)
Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, text [, language])"); Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, string text [int language_id])");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
Const_char* text; Const_char *text;
int lang = 0; int lang = 0;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
text = SvPV_nolen(ST(1)); text = SvPV_nolen(ST(1));
if(items == 3) if (items == 3)
lang = (int)SvUV(ST(2)); lang = (int) SvUV(ST(2));
quest_manager.GetInitiator()->ChannelMessageSend(THIS->GetItem()->Name, 0, 8, lang, 100, text); quest_manager.GetInitiator()->ChannelMessageSend(THIS->GetItem()->Name, 0, 8, lang, 100, text);
} }
@ -115,49 +114,45 @@ XS(XS_QuestItem_ItemSay)
} }
XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsType) XS(XS_QuestItem_IsType) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)"); Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
bool RETVAL; bool RETVAL;
uint32 type = (int32)SvIV(ST(1)); uint32 type = (int32) SvIV(ST(1));
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsType((EQEmu::item::ItemClass)type); RETVAL = THIS->IsType((EQEmu::item::ItemClass) type);
ST(0) = boolSV(RETVAL); ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0)); sv_2mortal(ST(0));
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsAttuned) XS(XS_QuestItem_IsAttuned) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
bool RETVAL; bool RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsAttuned(); RETVAL = THIS->IsAttuned();
@ -168,80 +163,76 @@ XS(XS_QuestItem_IsAttuned)
} }
XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetCharges) XS(XS_QuestItem_GetCharges) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
int16 RETVAL; int16 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCharges(); RETVAL = THIS->GetCharges();
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetAugment) XS(XS_QuestItem_GetAugment) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, augment_id)"); Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, int16 slot_id)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
int16 slot_id = (int16)SvIV(ST(1)); int16 slot_id = (int16) SvIV(ST(1));
EQEmu::ItemInstance* RETVAL; EQEmu::ItemInstance *RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetAugment(slot_id); RETVAL = THIS->GetAugment(slot_id);
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL); sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetID) XS(XS_QuestItem_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->ID; RETVAL = THIS->GetItem()->ID;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@ -251,29 +242,28 @@ extern "C"
#endif #endif
XS(boot_QuestItem); XS(boot_QuestItem);
XS(boot_QuestItem) XS(boot_QuestItem) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ; XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "GetName"), XS_QuestItem_GetName, file, "$"); newXSproto(strcpy(buf, "GetName"), XS_QuestItem_GetName, file, "$");
newXSproto(strcpy(buf, "SetScale"), XS_QuestItem_SetScale, file, "$"); newXSproto(strcpy(buf, "SetScale"), XS_QuestItem_SetScale, file, "$");
newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$"); newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$");
newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$"); newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$");
newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$"); newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$");
newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$"); newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$");
newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$"); newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$");
newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$"); newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$");
XSRETURN_YES; XSRETURN_YES;
} }