Jump to content
Sign in to follow this  
bWolfie

[Idea] BUILDIN(getplayerdata) - feedback needed

Recommended Posts

Hi all,

For the longest time I've been creating custom script commands simply so I can read a value from struct map_session_data{}. For example, I wanted to return the value of sd->state.showzeny, so I created a simple buildin just for that purpose.It would go something like this:
 

BUILDIN(read_showzeny)
{
    struct map_session_data *sd =  script->rid2sd(st);

    if (sd != NULL)
        script_pushint(st, sd->state.showzeny);
    else
        script_pushint(st, -1);

    return true;
}

Seems not bad, right? But then it got me thinking. I'm creating all these script commands for one simple action. Surely there's a better way? That's when I stumbled across the getunitdata() command.

Then it came to me - create a script command which can fetch this data for a player.

The Goal

Create a script command which can fetch the data which map_session_data provides. It would work similar to getunitdata():
*getplayerdata(<account id>, <DataType>{,<Variable>})
Maybe also setplayerdata()?

Helped needed: The one thing is, not all the stuff in there is useful. Maybe it would be best to selectively choose what can be retrieved as data? I made a list for this stuff. Let me know what you think.

Spoiler

/**
 * Player Data Types
 */
enum script_player_data_types {
	PDT_STORAGEFLAG = 0,
	PDT_SHOWDELAY,
	PDT_SHOWEXP,
	PDT_SHOWZENY,
	PDT_NOASK,
	PDT_TRADING,
	PDT_DEAL_LOCKED,
	PDT_SIZE,
	PDT_NIGHT,
	PDT_KILER,
	PDT_KILLABLE,
	PDT_NOKS,
	PDT_AUTOLOOT,
	PDT_NO_WEAPON_DAMAGE,
	PDT_NO_MAGIC_DAMAGE,
	PDT_NO_MISC_DAMAGE,
	PDT_RESTART_FULL_RECOVER,
	PDT_NO_CASTCANCEL,
	PDT_NO_CASTCANCEL2,
	PDT_NO_SIZEFIX,
	PDT_NO_GEMSTONE,
	PDT_INTRAVISION,
	PDT_PERFECT_HIDING,
	PDT_NO_KNOCKBACK,
	PDT_BONUS_COMA,
	PDT_HEAD_DIR,
	PDT_NPC_TIMER_ID,
	PDT_CHAT_ID,
	PDT_IDLETIME,
	PDT_FOLLOWTARGET,
	PDT_EMOTIONLASTTIME,
	PDT_INVINCIBLE_TIMER,
	PDT_CANLOG_TICK,
	PDT_CANUSEITEM_TICK,
	PDT_CANUSECASHFOOD_TICK,
	PDT_CANEQUIP_TICK,
	PDT_CANTALK_TICK,
	PDT_CANSKILL_TICK,
	PDT_CANSENDMAIL_TICK,
	PDT_KS_FLOODPROTECT_KICK,
	PDT_DISGUISE,
	PDT_POTION_SUCCESS_COUNTER,
	PDT_MISSION_COUNT,
	PDT_MISSION_MOBID,
	PDT_DIE_COUNTER,
	PDT_DEVOTION,
	PDT_TRADE_PARTNER,
	PDT_GUILDSPY,
	PDT_PARTYSPY,
	PDT_HATE_MOB,
	PDT_PVP_TIMER,
	PDT_PVP_POINT,
	PDT_PVP_RANK,
	PDT_PVP_LASTUSERS,
	PDT_PVP_WON,
	PDT_PVP_LOST,
	PDT_EVENTCOUNT,
	PDT_FAKENAME,
	PDT_DUEL_GROUP,
	PDT_DUEL_INVITE,
	PDT_CASHPOINTS,
	PDT_KAFRAPOINTS,
	PDT_RENTAL_TIMER,
	PDT_NPC_IDLE_TIMER,
	PDT_NPC_IDLE_TICK,
	PDT_FRIEND_REQ,
	PDT_FONTCOLOR,
	PDT_MAX
};

 

 

Share this post


Link to post
Share on other sites

if there is no demand, no need to pull request
but if plugin ... well anyone can release whatever you want ...

 

though, do you know most of the meaning of this constants ?
even I only understand about 80% of them

 

PDT_DIE_COUNTER,

PC_DIE_COUNTER

	PDT_CASHPOINTS,
	PDT_KAFRAPOINTS,

#CASHPOINTS and #KAFRAPOINTS

PDT_HEAD_DIR,

where is unit direction ?

PDT_IDLETIME,

*checkidle() script command

PDT_MISSION_MOBID,

I'm quite sure this should be in array

 

most of them are useless ... although some of it already in my To-Do list...
like the setunitsize, I failed to clean it before

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.   Restore formatting

  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...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.