Fixed bugreport:6428 where the count parameter of replacestr didn't allow variable integers injected in the script command.

Added script command repairall to easy repair all of the attached character's items.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16600 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
cookiecrumbs 2012-08-07 23:41:36 +00:00
parent 79f3073e83
commit 7c0317a323

View File

@ -7324,6 +7324,37 @@ BUILDIN_FUNC(repair)
return 0;
}
/*==========================================
* repairall
*------------------------------------------*/
BUILDIN_FUNC(repairall)
{
int i, repaircounter = 0;
TBL_PC *sd;
sd = script_rid2sd(st);
if(sd == NULL)
return 0;
for(i = 0; i < MAX_INVENTORY; i++)
{
if(sd->status.inventory[i].nameid && sd->status.inventory[i].attribute)
{
sd->status.inventory[i].attribute = 0;
clif_produceeffect(sd,0,sd->status.inventory[i].nameid);
repaircounter++;
}
}
if(repaircounter)
{
clif_misceffect(&sd->bl, 3);
clif_equiplist(sd);
}
return 0;
}
/*==========================================
*
*------------------------------------------*/
@ -13913,9 +13944,8 @@ BUILDIN_FUNC(replacestr)
}
if(script_hasdata(st, 6)) {
if(script_isint(st,6))
count = script_getnum(st, 6);
else {
count = script_getnum(st, 6);
if(!count) {
ShowError("script:replacestr: Invalid count value. Expected int got string\n");
st->state = END;
return 1;
@ -16947,6 +16977,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getequipname,"i"),
BUILDIN_DEF(getbrokenid,"i"), // [Valaris]
BUILDIN_DEF(repair,"i"), // [Valaris]
BUILDIN_DEF(repairall,""),
BUILDIN_DEF(getequipisequiped,"i"),
BUILDIN_DEF(getequipisenableref,"i"),
BUILDIN_DEF(getequipisidentify,"i"),