public class 0201_Item_Related extends Object
=============================== |0201.- Item-related commands.| ===============================
| 构造器和说明 |
|---|
0201_Item_Related() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
cardscnt()
cardscnt()
This function will return the number of cards inserted into the equipment
from which the function is called.
|
void |
getareadropitem()
getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
This function will count all the items with the specified ID number lying on the
ground on the specified map within the x1/y1-x2/y2 square on it and return that
number.
|
void |
getbrokenid()
getbrokenid(<number>{,<char_id>})
This function will search the invoking character's inventory for any broken
items, and will return their item ID numbers.
|
void |
getequipcardcnt()
getequipcardcnt(<equipment slot>)
This function will return the number of cards that have been compounded onto a
specific equipped item for the invoking character.
|
void |
getequipcardid()
getequipcardid(<equipment slot>,<card slot>)
Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
|
void |
getequipid()
getequipid({<equipment slot>,<char_id>})
This function returns the item ID of the item slot that calls the script
on the invoking character or the specified equipment slot.
|
void |
getequipisenableref()
getequipisenableref(<equipment slot>{,<char_id>})
Will return 1 if the item equipped on the invoking character in the specified
equipment slot is refinable, and 0 if it isn't.
|
void |
getequipisequiped()
getequipisequiped(<equipment slot>{,<char_id>})
This functions will return 1 if there is an equipment placed on the specified
equipment slot and 0 otherwise.
|
void |
getequipname()
getequipname(<equipment slot>{,<char_id>})
Returns the jname of the item equipped in the specified equipment slot on the
invoking character, or an empty string if nothing is equipped in that position.
|
void |
getequippercentrefinery()
getequippercentrefinery(<equipment slot>{,<enriched>,<char_id>})
This function calculates and returns the percent value chance to successfully
refine the item found in the specified equipment slot of the invoking character
by +1.
|
void |
getequiprefinecost()
getequiprefinecost(<equipment slot>,<type>,<information>{,<char id>})
This function returns refine cost for equipment in <equipment slot> based on
passed arguments <type> and <information>.
|
void |
getequiprefinerycnt()
getequiprefinerycnt(<equipment slot>{,<char_id>})
Returns the current number of pluses for the item in the specified equipment
slot.
|
void |
getequiptradability()
getequiptradability(<equipment slot>{,<char id>});
Returns true if the item in <equipment slot> is tradable.
|
void |
getequipuniqueid()
getequipuniqueid(<equipment slot>{,<char_id>})
This function returns the unique ID (as a string) of the item equipped in the equipment slot
specified on the invoking character.
|
void |
getequipweaponlv()
getequipweaponlv(<equipment slot>{,<char_id>})
This function returns the weapon level for the weapon equipped in the specified
equipment slot on the invoking character.
|
void |
getinventorylist()
getinventorylist {<char_id>};
This command sets a bunch of arrays with a complete list of whatever the
invoking character has in their inventory, including all the data needed to
recreate these items perfectly if they are destroyed.
|
void |
getiteminfo()
getiteminfo(<item ID>,<type>)
This function will look up the item with the specified ID number in the database
and return the info set by TYPE argument.
|
void |
getitemname()
getitemname(<item id>)
Given the database ID number of an item, this function will return the text
stored in the 'japanese name' field (which, in rAthena, stores an English name
the players would normally see on screen.)
|
void |
getitemslots()
getitemslots(<item ID>)
This function will look up the item with the specified ID number in the database
and return the number of slots this kind of items has - 0 if they are not
slotted.
|
void |
getnameditem()
getnameditem(<item id>,"<name to inscribe>"|<char id>);
getnameditem("<item name>","<name to inscribe>"|<char id>);
This function is equivalent to using 'getitem', however, it will not just give
the character an item object, but will also inscribe it with a specified
character's name.
|
void |
getrefine()
getrefine()
This function will return the refine count of the equipment from which the
function is called.
|
void |
identifyall()
identifyall({<type>{,<account_id>}});
Returns the count of unidentified items in the player inventory.
|
void |
mergeitem()
mergeitem({,<char_id>});
Open merge item window to merge available item can be merged.
|
void |
mergeitem2()
mergeitem2({<item_id>{,<char_id>}});
mergeitem2({"<item name>"{,<char_id>}});
Merge all stackable items that separated by GUID flags
(either by flag 4 item_flag.txt or GUID in item_group).
|
getequipid({<equipment slot>,<char_id>})
This function returns the item ID of the item slot that calls the script
on the invoking character or the specified equipment slot. If nothing is
equipped there, it returns -1.
Valid equipment slots are:
EQI_COMPOUND_ON (-1) - Item slot that calls this script (In context of item script)
EQI_ACC_L (0) - Accessory 1
EQI_ACC_R (1) - Accessory 2
EQI_SHOES (2) - Footgear (shoes, boots)
EQI_GARMENT (3) - Garment (mufflers, hoods, manteaux)
EQI_HEAD_LOW (4) - Lower Headgear (beards, some masks)
EQI_HEAD_MID (5) - Middle Headgear (masks, glasses)
EQI_HEAD_TOP (6) - Upper Headgear
EQI_ARMOR (7) - Armor (jackets, robes)
EQI_HAND_L (8) - Left hand (weapons, shields)
EQI_HAND_R (9) - Right hand (weapons)
EQI_COSTUME_HEAD_TOP (10) - Upper Costume Headgear
EQI_COSTUME_HEAD_MID (11) - Middle Costume Headgear
EQI_COSTUME_HEAD_LOW (12) - Lower Costume Headgear
EQI_COSTUME_GARMENT (13) - Costume Garment
EQI_AMMO (14) - Arrow/Ammunition
EQI_SHADOW_ARMOR (15) - Shadow Armor
EQI_SHADOW_WEAPON (16) - Shadow Weapon
EQI_SHADOW_SHIELD (17) - Shadow Shield
EQI_SHADOW_SHOES (18) - Shadow Shoes
EQI_SHADOW_ACC_R (19) - Shadow Accessory 2
EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
Notice that a few items occupy several equipment slots, and if the character is
wearing such an item, 'getequipid' will return its ID number for either slot.
Can be used to check if you have something equipped, or if you haven't got
something equipped:
if (getequipid(EQI_HEAD_TOP) == 2234)
mes "What a lovely Tiara you have on";
else
mes "Come back when you have a Tiara on";
close;
You can also use it to make sure people don't pass a point before removing an
item totally from them. Let's say you don't want people to wear Legion Plate
armor, but also don't want them to equip if after the check, you would do this:
if (getequipid(EQI_ARMOR) == 2341 || getequipid(EQI_ARMOR) == 2342) {
mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
close;
}
// the || is used as an or argument, there is 2341 and 2342 cause there are
// two different legion plate armors, one with a slot one without.
if (countitem(2341) > 0 || countitem(2432) > 0) {
mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
close;
}
mes "I will lets you pass.";
close2;
warp "place",50,50;
end;
getequipuniqueid(<equipment slot>{,<char_id>})
This function returns the unique ID (as a string) of the item equipped in the equipment slot
specified on the invoking character. If nothing is equipped there, it returns an empty string.
See 'getequipid' for a full list of valid equipment slots.
getequipname(<equipment slot>{,<char_id>})
Returns the jname of the item equipped in the specified equipment slot on the
invoking character, or an empty string if nothing is equipped in that position.
Does the same thing as getitemname(getequipid()). Useful for an NPC to state
what your are wearing, or maybe saving as a string variable.
See 'getequipid' for a full list of valid equipment slots.
if ( getequipname(EQI_HEAD_TOP) != "" )
mes "So you are wearing a " + getequipname(EQI_HEAD_TOP) + " on your head";
else
mes "You are not wearing any head gear";
getitemname(<item id>)
Given the database ID number of an item, this function will return the text
stored in the 'japanese name' field (which, in rAthena, stores an English name
the players would normally see on screen.)
getbrokenid(<number>{,<char_id>})
This function will search the invoking character's inventory for any broken
items, and will return their item ID numbers. Since the character may have
several broken items, 1 given as an argument will return the first one found, 2
will return the second one, etc. Will return 0 if no such item is found.
// Let's see if they have anything broken:
if (getbrokenid(1) == 0)
mes "You don't have anything broken, quit bothering me.";
else
// They do, so let's print the name of the first broken item:
mes "Oh, I see you have a broken " + getitemname(getbrokenid(1)) + " here!";
end;
getequipisequiped(<equipment slot>{,<char_id>})
This functions will return 1 if there is an equipment placed on the specified
equipment slot and 0 otherwise. For a list of equipment slots
see 'getequipid'. Function originally used by the refining NPCs:
if (getequipisequiped(EQI_HEAD_TOP)) {
mes "[Refiner]";
mes "That's a fine hat you are wearing there...";
close;
} else {
mes "[Refiner]";
mes "Do you want me to refine your dumb head?";
close;
}
getequipisenableref(<equipment slot>{,<char_id>})
Will return 1 if the item equipped on the invoking character in the specified
equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
see 'getequipid'.
if (getequipisenableref(EQI_HEAD_TOP)) {
mes "[Refiner]";
mes "Ok I can refine this";
close;
} else {
mes "[Refiner]";
mes "I can't refine this hat!...";
close;
}
getequiprefinerycnt(<equipment slot>{,<char_id>})
Returns the current number of pluses for the item in the specified equipment
slot. For a list of equipment slots see 'getequipid'.
Can be used to check if you have reached a maximum refine value, default for
this is +10:
if (getequiprefinerycnt(EQI_HEAD_TOP) < 10)
mes "I will now upgrade your " + getequipname(EQI_HEAD_TOP);
else
mes "Sorry, it's not possible to refine hats better than +10";
close;
getequipweaponlv(<equipment slot>{,<char_id>})
This function returns the weapon level for the weapon equipped in the specified
equipment slot on the invoking character. For a list of equipment slots see
'getequipid'.
Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
a weapon level. You can, however, probably, use this field for other equippable
custom items as a flag or something.
If no item is equipped in this slot, or if it doesn't have a weapon level
according to the database, 0 will be returned.
Examples:
// Right hand can only contain a weapon.
switch (getequipweaponlv(EQI_HAND_R)) {
case 1: mes "You are holding a lvl 1 weapon."; break;
case 2: mes "You are holding a lvl 2 weapon."; break;
case 3: mes "You are holding a lvl 3 weapon."; break;
case 4: mes "You are holding a lvl 4 weapon."; break;
case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
default: mes "Seems you don't have a weapon on."; break;
}
// Left hand can hold either a weapon or shield.
if (getequipid(EQI_HAND_R) == 0) {
mes "Seems you have nothing equipped here.";
close;
}
switch (getequipweaponlv(EQI_HAND_L)) {
case 0: mes "You are holding a shield, so it doesn't have a level."; break;
case 1: mes "You are holding a lvl 1 weapon."; break;
case 2: mes "You are holding a lvl 2 weapon."; break;
case 3: mes "You are holding a lvl 3 weapon."; break;
case 4: mes "You are holding a lvl 4 weapon."; break;
case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
}
getequippercentrefinery(<equipment slot>{,<enriched>,<char_id>})
This function calculates and returns the percent value chance to successfully
refine the item found in the specified equipment slot of the invoking character
by +1. There is no actual formula, the success rate for a given weapon level of
a certain refine level is found in the db/(pre-)re/refine_db.yml file. For a list of
equipment slots see 'getequipid'.
If enriched parameter is set to true, chance to successfully refine the item with
enriched material is returned instead.
These values can be displayed for the player to see, or used to calculate the
random change of a refine succeeding or failing and then going through with it
(which is what the official NPC refinery scripts use it for)
// This will find a random number from 0 - 99 and if that is equal to or more
// than the value recovered by this command it will go to L_Fail
if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
getequiprefinecost(<equipment slot>,<type>,<information>{,<char id>})
This function returns refine cost for equipment in <equipment slot> based on
passed arguments <type> and <information>.
Valid cost types are:
REFINE_COST_NORMAL - For normal refining
REFINE_COST_OVER10 - For refining over +10
REFINE_COST_HD - For refining with HD ores
REFINE_COST_ENRICHED - For refining with enriched ores
REFINE_COST_OVER10_HD - For refining over +10 with HD ores
REFINE_COST_HOLINK - For refining at Holink in Malangdo
REFINE_COST_WAGJAK - For refining at Refining Machine Wagjak in the Novice Academy
This function will return required cost for refining based on <information> argument.
Valid information types are:
REFINE_ZENY_COST - Zeny
REFINE_MATERIAL_ID - Material Item ID
This function will return -1 on failure. The function fails if the cost type
is invalid or if there is no item in the equipment slot.
getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
This function will count all the items with the specified ID number lying on the
ground on the specified map within the x1/y1-x2/y2 square on it and return that
number.
This is the only function around where a parameter may be either a string or a
number! If it's a number, it means that only the items with that item ID number
will be counted. If it is a string, it is assumed to mean the 'english name'
field from the item database. If you give it an empty string, or something that
isn't found from the item database, it will count items number '512' (apples).
getequipcardcnt(<equipment slot>)
This function will return the number of cards that have been compounded onto a
specific equipped item for the invoking character. See 'getequipid' for a list
of possible equipment slots.
getinventorylist {<char_id>};
This command sets a bunch of arrays with a complete list of whatever the
invoking character has in their inventory, including all the data needed to
recreate these items perfectly if they are destroyed. Here's what you get:
cardscnt()
This function will return the number of cards inserted into the equipment
from which the function is called.
This function is intended for use in item scripts.
getrefine()
This function will return the refine count of the equipment from which the
function is called.
This function is intended for use in item scripts.
getnameditem(<item id>,"<name to inscribe>"|<char id>);
getnameditem("<item name>","<name to inscribe>"|<char id>);
This function is equivalent to using 'getitem', however, it will not just give
the character an item object, but will also inscribe it with a specified
character's name. You may not inscribe items with arbitrary strings, only with
names of characters that actually exist. While this isn't said anywhere
specifically, apparently, named items may not have cards in them, slots or no -
these data slots are taken by the character ID who's name is inscribed. Only one
remains free and it's not quite clear if a card may be there.
This function will return 1 if an item was successfully created and 0 if it
wasn't for whatever reason. Like 'getitem', this function will also accept an
'english name' from the item database as an item name and will return 0 if no
such item exists.
getitemslots(<item ID>)
This function will look up the item with the specified ID number in the database
and return the number of slots this kind of items has - 0 if they are not
slotted. It will also be 0 for all non-equippable items, naturally, unless
someone messed up the item database. It will return -1 if there is no such item.
Example:
//.@slots now has the amount of slots of the item with ID 1205.
.@slots = getitemslots(1205);
getiteminfo(<item ID>,<type>)
This function will look up the item with the specified ID number in the database
and return the info set by TYPE argument.
It will return -1 if there is no such item.
Valid types are:
0 - Buy Price
1 - Sell Price
2 - Type
3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
if = 0, then monsters don't drop it at all (rare or a quest item)
if = 10000, then this item is sold in NPC shops only
4 - Gender
5 - Loc
6 - Weight
7 - ATK
8 - DEF
9 - Range
10 - Slot
11 - View
12 - eLV
13 - wLV
14 - SpriteID from 'db/item_avail.txt'
15 - eLVMax
16 - matk if RENEWAL is defined
See the sample in 'doc/sample/getiteminfo.txt'.
getequipcardid(<equipment slot>,<card slot>)
Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
This function returns CARD ID, CARD0_FORGE, CARD0_CREATE, or CARD0_PET (for card 0, if the item is produced).
It's useful for when you want to check whether an item contains cards or if it's signed.
mergeitem({,<char_id>});
Open merge item window to merge available item can be merged.
Examples
1. See the NPC 'npc/re/other/merge_item.txt'.
2. Simple usage:
mes "Let's check if any item can be merged.";
close2;
mergeitem;
end;
mergeitem2({<item_id>{,<char_id>}});
mergeitem2({"<item name>"{,<char_id>}});
Merge all stackable items that separated by GUID flags
(either by flag 4 item_flag.txt or GUID in item_group).
If no item ID/name given, all possible items in player's inventory will be merged.
getequiptradability(<equipment slot>{,<char id>});
Returns true if the item in <equipment slot> is tradable.
Returns false otherwise.
identifyall({<type>{,<account_id>}});
Returns the count of unidentified items in the player inventory.
If <type> is true the command will identify all the unidentified items as well (default).
If <type> is false the command only returns the count of unidentified items.
Copyright © 工程的初始时间(可选)–2019. All rights reserved.