Jump to content

[rev.1] @countitem, @storagecountitem, @cartcountitem - Count how many item in player inventory/storage/cart


Cydh

Recommended Posts


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

Infromation

I know rAthena has @itemlist and gives us item list of certain player, but, how if I just want to know how many a player has Red Potion (for example) in the inventory, or storage, or maybe cart?

@countitem used to count how many item in player's inventory

@storagecountitem used to count how many item in player's storage

@cartcountitem used to count how many item in player's cart


How to use?

@countitem <item_id>
#countitem <player> <item_id>


@storagecountitem <item_id>
#storagecountitem <player> <item_id>


@cartcountitem <item_id>
#cartcountitem <player> <item_id>


Compability
I made this on rAthena 17101

Screenshots
**soon**

Download

at_countitem-rA-svn17138.patch

Sorry for previous version, I think there were some mistakes .patch lines

**If you guys like this, rate this post and give me rep +1 haha**

Edited by Cydh
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   4
  • Joined:  01/09/13
  • Last Seen:  

Nice idea!

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

Nice idea!

thank's haha

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

---- bump for revision as update

Edited by Cydh
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

didn't saw that but I like the coding style, I may try it and review what we got to integrate it.

nb : script would probably need them too.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

didn't saw that but I like the coding style, I may try it and review what we got to integrate it.

nb : script would probably need them too.

yeah, maybe need to be improvised.

 

hmm, what's script?

storagecountitem(<item_id>)?

cartcountitem(<item_id>)?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

yes even tough not sure I really like the nomenclature of this.

They must be kinda similar from script and atcommand (name) but we also don't want lot of script function atm. (well it's a same a flag could do the job).

Think something more generic would be @countitem,@countitemstorage,@countitemcart,@countitemguildsto

name doesn't matter that much for atcommand since we could do alias, but they more regxy like that and easier to maintain for script.

(guildsto is similar to cart, if(sd as guildid))

countitem(id,{loc,sd}) with sd and loc optional, only bad part on this is for a regular countitem on a particular sd you'll need something like countitem(apple,0,lighta).

now do we do each small to link to tht generic hmm ?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

yeah, because I made the countitem and delitem extension script first (someone asked on eAthena forum), then I remove them (I don't know why, LOL) and make the atcommand. -_-

 

for script...

my first idea was, using current countitem(<item_id>) then edit it becomes countitem(<item_id>{,<loc>}{,<aid>}). aid = account_id will be sd

and also for delitem(<item id>,<amount>{,<account ID>}) will be delitem(<item_id>,<amount>{,<loc>}{,<aid>})

loc are inventory, cart, storage, also guild storage (maybe).

I'd like location first to check then using sd first, because if using atcommand, sd is the command user,
 
countitem(id,{loc,sd}), if sd can be guildid we assume
loc : 0=inventory, 1=cart, 2=storage, 3=guild
countitem (apple,3,guildid) ==> check apple from 3 with guild_id == guildid. Any chance player as member of 2 guilds?

 

for atcommand

yeah, naming is doesn't matter, just make a user friendly name

and for aid/cid/name for sd, sd will be taken from command user

@countcartitem apple cydh just like @cartcountitem apple

and for other player can use charcommand, right? #cartcountitem cydh apple

 

I didn't want to make some problem at first made, that why separate them all. haha

 

well, so here, we will concern about the scripts first, for countitem?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

ye the atcommand is fine, issue is more to kinda define a pattern to we don't have script growing in every direction.

yep sd was just to said player we could found them by name wich is fine for atcommand or (char_id).

Atm no it's not possible for a player to have multiple guilde so it's fine to do it. If there was a change I believe we could extra location for guild2 guild3 etc, assuming they sorted... (anyway let's not bother with this yet).

Last note is that for script even if we could resolde sd with nick I prefer via charid, but we could add both methode for flexibility.

 

we tought same thing for loc =)

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

hmm, AID, map_id2sd() need AID, not CID. and when use AID, map_id2sd() will find the online sd based on AID, only 1 online AID at same time right?

well, I think I make new release post about modified countitem <item_id> becomes countitem <item_id/"item_name">{,<location>}{,<AID/"nick">} first, and you can review the source, regarding this post is talking about atcommand, don't want to 'out-of-topic'.. haha

 

@topic, I didn't make countitem for guild storage becase, as far as I know to access guild storage, player has to open guild storage first.

example on @cleargstorage's lines

 

    gstorage = guild2storage2(sd->status.guild_id);
    if (gstorage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there.
        return -1;
    }
Edited by Cydh
Link to comment
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.

×
×
  • Create New...