sader1992

Release: @petstats command

Recommended Posts

@petstats command


this command will show you the pet stats

see the screenshot for more info

image.png.f12c2fa11d533b8369438550a7d73060.png

you can add it inside /rAthena/src/map/atcommand.cpp or if you use old rathena add it at /rAthena/src/map/atcommand.c file

add it like you add any new atcommand

and recompile

 


 

  • Upvote 1
  • Love 2

Share this post


Link to post
Share on other sites

@Quesooo it's not script it's for Source Modification

you can add it inside /rAthena/src/map/atcommand.cpp or if you use old rathena add it at /rAthena/src/map/atcommand.c file

add it like you add any new atcommand

and recompile

Edited by sader1992
  • Love 1

Share this post


Link to post
Share on other sites

@sader1992 i believed i need to use your petstats.cpp since im using latest rathena, after inserting the codes and recompile, checking ingame using poring pet and use @petstats command the system said that not available command or something unknown command, am i missing something?

Share this post


Link to post
Share on other sites

Could you update this sader, please? 

Share this post


Link to post
Share on other sites
Posted (edited)
//===== rAthena Script =======================================
//= saders @petstats command
//===== By: ==================================================
//= Sader1992
//= Free!!
//https://rathena.org/board/profile/30766-sader1992/
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: ===================================== 
//= rAthena Project
//https://github.com/sader1992/sader_scripts
//===== Description: =========================================
//==== @petstats command
//============================================================

ACMD_FUNC(petstats)
{
	struct pet_data *pd = sd->pd;
	nullpo_retr(-1, sd);
	char output[CHAT_SIZE_MAX], petname[100], mobname[100], infostring1[100], infostring2[100];
	int i;
	struct {
		const char* format;
		int value;
	} output_table[] = {
		{ NULL, 0 },
		{ NULL, 0 },
		{ "Pet ID - %d", 0 },
		{ "Pet Level - %d", 0 },
		{ "Pet Loyalty - %d", 0 },
		{ "Pet equip - %d", 0 },
		{ "Pet Hungry - %d", 0 },
		{ NULL, 0 },
		{ NULL, 0 },
		{ "Mob ID - %d", 0 },
		{ "Egg ID - %d", 0 },
		{ "Food ID - %d", 0 },
		{ "Equip ID - %d", 0 },
	};
	
	pd = sd->pd;
	if (!pd) {
		clif_displaymessage(fd, msg_txt(sd, 184)); // Sorry, but you have no pet.
		return -1;
	}
	std::shared_ptr<s_pet_db> pet_db_ptr = pd->get_pet_db();
	memset(infostring1, '\0', sizeof(infostring1));
	memset(output, '\0', sizeof(output));
	memset(petname, '\0', sizeof(petname));
	memset(infostring2, '\0', sizeof(infostring2));
	memset(mobname, '\0', sizeof(mobname));
	sprintf(infostring2, "- Pet Information -");
	output_table[0].format = infostring2;
	sprintf(petname, "Pet Name - %s", pd->pet.name);
	output_table[1].format = petname;
	output_table[2].value = pd->pet.pet_id;
	output_table[3].value = pd->pet.level;
	output_table[4].value = pd->pet.intimate;
	output_table[5].value = pd->pet.equip;
	output_table[6].value = pd->pet.hungry;
	sprintf(infostring1, "- Database Information -");
	output_table[7].format = infostring1;
	// sprintf(mobname, "Mob Name - %s", pet_db_ptr->);
	output_table[8].format = mobname;
	output_table[9].value = pet_db_ptr->class_;
	output_table[10].value = pet_db_ptr->EggID;
	output_table[11].value = pet_db_ptr->FoodID;
	output_table[12].value = pet_db_ptr->AcceID;
	for (i = 0; i<13; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_displaymessage(fd, output);
	}
	return 0;
}

atcommand.inc

ACMD_DEF(petstats),

atcommand_def.inc

or alternatively you can use on npc scripts.

-	script	petinfo	-1,{
OnInit:
	bindatcmd "petinfo",strnpcinfo(0)+"::OnPetInfo";
	end;
OnPetInfo:
    .@pid = getpetinfo(PETINFO_ID);
    .@pclassid = getpetinfo(PETINFO_CLASS);
    .@pname$ = getpetinfo(PETINFO_NAME);
    .@phungry = getpetinfo(PETINFO_HUNGRY);
    .@pintimacy = getpetinfo(PETINFO_INTIMATE);
    .@pfoodid = getpetinfo(PETINFO_FOODID);

    .@pname$ = getmonsterinfo(.@pclassid,MOB_NAME);

    if (.@pid == 0) {
		dispbottom "You do not have a pet.",0xff0000;
		dispbottom "@petinfo failed.",0xff0000;
		end;
	}

    dispbottom " ===== Pet information =====",0x00ff00;
    dispbottom "Original Name: "+.@pname$+" - Name: "+.@pname$,0x00ff00;
    dispbottom "Hungry: "+.@phungry+" - Intimacy "+.@pintimacy,0x00ff00;
    dispbottom "Pet Food: "+F_ItemL2(.@pfoodid),0x00ff00;
    end;
}

the result image.png.8b24a7914146f71199c22be8ac39bba6.png

Edited by YJ1994
  • Love 2

Share this post


Link to post
Share on other sites

Nice idea looks good, thank u 🙂

 

Rynbef~

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...