Removed hardcoded equip position names from getequipname (bugreport:2156).
Now it's the npc's responsibility to store and display the names. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13171 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
bba8e623b7
commit
cf57c2fc20
@ -3,6 +3,9 @@ Date Added
|
||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2008/09/01
|
||||
* Removed hardcoded equip position names from getequipname (bugreport:2156)
|
||||
- now it's the npc's responsibility to store and display the names
|
||||
2008/08/28
|
||||
* Fixed @cash/@points not handling negative values properly (bugreport:2132) [ultramage]
|
||||
2008/08/26
|
||||
|
@ -120,6 +120,8 @@
|
||||
//= unitskilluseid, unitskillusepos, bonus/bonus2/bonus3/bonus4/bonus5
|
||||
//= 3.22.20080622
|
||||
//= Extended 'set' to return the variable reference. [FlavioJS]
|
||||
//= 3.22.20080901
|
||||
//= Adjusted the 'getequipname' description to match src [ultramage]
|
||||
//=========================================================
|
||||
|
||||
This document is a reference manual for all the scripting commands and functions
|
||||
@ -2187,17 +2189,16 @@ armor, but also don't want them to equip if after the check, you would do this:
|
||||
|
||||
*getequipname(<equpment slot>)
|
||||
|
||||
This function will return the name of the item equipped in the specified
|
||||
equipment slot on the invoking character. Almost identical to 'getequipid', good
|
||||
for an NPC to state what your are wearing, or maybe saving as a string variable.
|
||||
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)==0) goto L_No_HeadGear;
|
||||
mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
|
||||
close;
|
||||
L_No_HeadGear:
|
||||
mes "You are not wearing any head gear";
|
||||
close;
|
||||
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";
|
||||
|
||||
---------------------------------------
|
||||
|
||||
|
@ -362,9 +362,15 @@ function script refinemain {
|
||||
mes "I can refine all kinds of weapons, armor and equipment, so let me";
|
||||
mes "know what you want me to refine.";
|
||||
next;
|
||||
|
||||
setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
|
||||
set .@menu$,"";
|
||||
for( set .@i,1; .@i < 11; set .@i,.@i+1 ){
|
||||
set .@menu$,.@menu$+(getequipisequiped(.@i) ? getequipname(.@i) : "")+":";
|
||||
for( set .@i,1; .@i <= 10; set .@i,.@i+1 )
|
||||
{
|
||||
if( getequipisequiped(.@i) )
|
||||
set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
|
||||
|
||||
set .@menu$, .@menu$ + ":";
|
||||
}
|
||||
set .@part,select(.@menu$);
|
||||
if(!getequipisequiped(.@part)) {
|
||||
|
@ -5901,33 +5901,43 @@ BUILDIN_FUNC(strnpcinfo)
|
||||
}
|
||||
|
||||
|
||||
unsigned int equip[10]={EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW};
|
||||
// aegis->athena slot position conversion table
|
||||
static unsigned int equip[] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW};
|
||||
|
||||
/*==========================================
|
||||
* GetEquipID(Pos); Pos: 1-10
|
||||
*------------------------------------------*/
|
||||
BUILDIN_FUNC(getequipid)
|
||||
{
|
||||
int i=-1,num;
|
||||
TBL_PC *sd;
|
||||
int i, num;
|
||||
TBL_PC* sd;
|
||||
struct item_data* item;
|
||||
|
||||
sd=script_rid2sd(st);
|
||||
if(sd == NULL)
|
||||
sd = script_rid2sd(st);
|
||||
if( sd == NULL )
|
||||
return 0;
|
||||
|
||||
num=script_getnum(st,2);
|
||||
if (num > 0 && num <= ARRAYLENGTH(equip))
|
||||
i=pc_checkequip(sd,equip[num-1]);
|
||||
if(i >= 0){
|
||||
item=sd->inventory_data[i];
|
||||
if(item)
|
||||
script_pushint(st,item->nameid);
|
||||
else
|
||||
script_pushint(st,0);
|
||||
}else{
|
||||
num = script_getnum(st,2) - 1;
|
||||
if( num < 0 || num >= ARRAYLENGTH(equip) )
|
||||
{
|
||||
script_pushint(st,-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get inventory position of item
|
||||
i = pc_checkequip(sd,equip[num]);
|
||||
if( i < 0 )
|
||||
{
|
||||
script_pushint(st,-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
item = sd->inventory_data[i];
|
||||
if( item != 0 )
|
||||
script_pushint(st,item->nameid);
|
||||
else
|
||||
script_pushint(st,0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5936,31 +5946,34 @@ BUILDIN_FUNC(getequipid)
|
||||
*------------------------------------------*/
|
||||
BUILDIN_FUNC(getequipname)
|
||||
{
|
||||
int i=-1,num;
|
||||
TBL_PC *sd;
|
||||
int i, num;
|
||||
TBL_PC* sd;
|
||||
struct item_data* item;
|
||||
char *buf;
|
||||
|
||||
static char pos[11][100] = {"Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3","Not Equipped"};
|
||||
|
||||
sd = script_rid2sd(st);
|
||||
if( sd == NULL )
|
||||
return 0;
|
||||
|
||||
buf=(char *)aMallocA(64*sizeof(char));
|
||||
num=script_getnum(st,2);
|
||||
if (num > 0 && num <= ARRAYLENGTH(equip))
|
||||
i=pc_checkequip(sd,equip[num-1]);
|
||||
if(i >= 0){
|
||||
item=sd->inventory_data[i];
|
||||
if(item)
|
||||
sprintf(buf,"%s-[%s]",pos[num-1],item->jname);
|
||||
else
|
||||
sprintf(buf,"%s-[%s]",pos[num-1],pos[10]);
|
||||
}else{
|
||||
sprintf(buf,"%s-[%s]",pos[num-1],pos[10]);
|
||||
num = script_getnum(st,2) - 1;
|
||||
if( num < 0 || num >= ARRAYLENGTH(equip) )
|
||||
{
|
||||
script_pushconststr(st,"");
|
||||
return 0;
|
||||
}
|
||||
script_pushstr(st,buf);
|
||||
|
||||
// get inventory position of item
|
||||
i = pc_checkequip(sd,equip[num]);
|
||||
if( i < 0 )
|
||||
{
|
||||
script_pushint(st,-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
item = sd->inventory_data[i];
|
||||
if( item != 0 )
|
||||
script_pushstrcopy(st,item->jname);
|
||||
else
|
||||
script_pushconststr(st,"");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user