* Added 'breakequip' script command. (tid:86732)

* Fixed return value for delequip. (since r17469/8bd0985)
* Fixed a bug with Mercenary Rentals. (credits: TTest)

Signed-off-by: Euphy <euphy@rathena.org>
This commit is contained in:
Euphy 2013-09-04 15:07:26 -04:00
parent 7d72060430
commit 17d000640d
3 changed files with 43 additions and 7 deletions

View File

@ -4610,6 +4610,16 @@ This command will return 1 if an item was deleted and 0 otherwise.
---------------------------------------
*breakequip <equipment slot>;
This command will break and unequip whatever is currently equipped in the
invoking character's specified equipment slot. For a full list of possible
equipment slots see 'getequipid'.
This command will return 1 if an item was deleted and 0 otherwise.
---------------------------------------
*clearitem;
This command will destroy all items the invoking character has in their

View File

@ -22,10 +22,10 @@
setarray .@name$, "Spear", "Sword", "Bow";
setarray .@faith$, "SPEAR_MERC_GUILD", "SWORD_MERC_GUILD", "ARCH_MERC_GUILD";
setarray .@item, 12182, 12172, 12162;
set .@faith_lancer, mercenary_get_faith(getd(.@faith$[.@type]));
set .@npc$, strnpcinfo(2);
for (set .@size, getarraysize(.@name$); .@i < .@size; set .@i, .@i + 1)
if (.@npc$ == .@name$[.@i]) set .@type, .@i;
set .@faith_merc, mercenary_get_faith(getd(.@faith$[.@type]));
mes "[Mercenary Manager]";
mes "Welcome to the";
mes .@npc$ + " Mercenary Guild.";
@ -64,7 +64,7 @@
mes "free to come back if your";
mes "needs change. Thank you~";
}
else if(.@FaithCost && .@faith_lancer < .@FaithCost) {
else if(.@FaithCost && .@faith_merc < .@FaithCost) {
mes "[Mercenary Manager]";
mes "Oh... Your Loyalty rating";
mes "with the " + .@npc$ + " Mercenary";
@ -178,7 +178,7 @@
mes "Mercenary. Have you considered";
mes "hiring a lower grade Mercenary?";
}
else if (.@faith_lancer < 500) {
else if (.@faith_merc < 500) {
mes "[Mercenary Manager]";
mes "I'm sorry, but your";
mes "Loyalty rating is too";

View File

@ -7798,7 +7798,7 @@ BUILDIN_FUNC(downrefitem)
*------------------------------------------*/
BUILDIN_FUNC(delequip)
{
int i=-1,num;
int i=-1,num,ret=0;
TBL_PC *sd;
num = script_getnum(st,2);
@ -7809,12 +7809,37 @@ BUILDIN_FUNC(delequip)
if (num > 0 && num <= ARRAYLENGTH(equip))
i=pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
int ret;
pc_unequipitem(sd,i,3); //recalculate bonus
ret=pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
script_pushint(st,ret==0);
ret = !(pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT));
}
script_pushint(st,ret);
return 0;
}
/*==========================================
* Break the item equipped at pos.
*------------------------------------------*/
BUILDIN_FUNC(breakequip)
{
int i=-1,num;
TBL_PC *sd;
num = script_getnum(st,2);
sd = script_rid2sd(st);
if( sd == NULL )
return 0;
if (num > 0 && num <= ARRAYLENGTH(equip))
i = pc_checkequip(sd,equip[num-1]);
if (i >= 0) {
sd->status.inventory[i].attribute = 1;
pc_unequipitem(sd,i,3);
clif_equiplist(sd);
script_pushint(st,1);
} else
script_pushint(st,0);
return 0;
}
@ -18437,6 +18462,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(npcskill,"viii"),
BUILDIN_DEF(consumeitem,"v"),
BUILDIN_DEF(delequip,"i"),
BUILDIN_DEF(breakequip,"i"),
BUILDIN_DEF(sit,"?"),
BUILDIN_DEF(stand,"?"),
/**