diff options
author | Lupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-08 21:23:51 +0000 |
---|---|---|
committer | Lupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-08 21:23:51 +0000 |
commit | 6859bee5720898aa7fa2e65f460fc795fa6bbf7b (patch) | |
tree | 9a94460f3d5252d1355784583cc52028e0f65d02 /src/map/script.c | |
parent | 5e91eb01b017839da608b1ca4d3248866ae58233 (diff) | |
download | hercules-6859bee5720898aa7fa2e65f460fc795fa6bbf7b.tar.gz hercules-6859bee5720898aa7fa2e65f460fc795fa6bbf7b.tar.bz2 hercules-6859bee5720898aa7fa2e65f460fc795fa6bbf7b.tar.xz hercules-6859bee5720898aa7fa2e65f460fc795fa6bbf7b.zip |
fixed script command 'isequippedcnt'
added new script command for new cards 'cardscnt'
(to fix cards exploits! should check old cards, too)
fixed @jail / @unjail SAVE POINT abuse
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1217 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 61 |
1 files changed, 53 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c index 35964f3bc..961c4b5e5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -89,6 +89,8 @@ struct Script_Config script_config; static int parse_cmd_if=0; static int parse_cmd; +extern int current_equip_item_index; //for New CARS Scripts. It contains Inventory Index of the EQUIP_SCRIPT caller item. [Lupus] + /*========================================== * ローカルプロトタイプ宣言 (必要な物のみ) *------------------------------------------ @@ -308,6 +310,7 @@ int buildin_isnight(struct script_state *st); // [celest] int buildin_isday(struct script_state *st); // [celest] int buildin_isequipped(struct script_state *st); // [celest] int buildin_isequippedcnt(struct script_state *st); // [celest] +int buildin_cardscnt(struct script_state *st); // [Lupus] int buildin_getusersname(struct script_state *st); //jA commands added [Lupus] int buildin_dispbottom(struct script_state *st); int buildin_recovery(struct script_state *st); @@ -554,6 +557,7 @@ struct { {buildin_isday,"isday",""}, // check whether it is day time [Celest] {buildin_isequipped,"isequipped","i*"}, // check whether another item/card has been equipped [Celest] {buildin_isequippedcnt,"isequippedcnt","i*"}, // check how many items/cards are being equipped [Celest] + {buildin_cardscnt,"cardscnt","i*"}, // check how many items/cards are being equipped in the same arm [Lupus] #ifdef PCRE_SUPPORT {buildin_defpattern, "defpattern", "iss"}, // Define pattern to listen for [MouseJstr] {buildin_activatepset, "activatepset", "i"}, // Activate a pattern set [MouseJstr] @@ -6930,7 +6934,7 @@ int buildin_isequippedcnt(struct script_state *st) continue; for (j=0; j<10; j++) { - int index, type, flag = 0; + int index, type; index = sd->equip_index[j]; if(index < 0) continue; if(j == 9 && sd->equip_index[8] == index) continue; @@ -6941,22 +6945,17 @@ int buildin_isequippedcnt(struct script_state *st) if(sd->inventory_data[index]) { if (type == 4 || type == 5) { if (sd->inventory_data[index]->nameid == id) - flag = 1; + ret++; //[Lupus] } else if (type == 6) { for(k=0; k<sd->inventory_data[index]->slot; k++) { if (sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00 && sd->status.inventory[index].card[k] == id) { - flag = 1; - break; + ret++; //[Lupus] } } } - if (flag) { - ret++; - break; - } } } } @@ -6964,6 +6963,52 @@ int buildin_isequippedcnt(struct script_state *st) push_val(st->stack,C_INT,ret); return 0; } + +/*================================================ + * Check how many given inserted cards in the CURRENT + * weapon - used for 2/15's cards patch [Lupus] + *------------------------------------------------ + */ +int buildin_cardscnt(struct script_state *st) +{ + struct map_session_data *sd; + int i, k, id = 1; + int ret = 0; + + sd = script_rid2sd(st); + + for (i=0; id!=0; i++) { + FETCH (i+2, id) else id = 0; + if (id <= 0) + continue; + + int index, type; + index = current_equip_item_index; //we get CURRENT WEAPON inventory index from status.c [Lupus] + if(index < 0) continue; + + type = itemdb_type(id); + + if(sd->inventory_data[index]) { + if (type == 4 || type == 5) { + if (sd->inventory_data[index]->nameid == id) + ret++; + } else if (type == 6) { + for(k=0; k<sd->inventory_data[index]->slot; k++) { + if (sd->status.inventory[index].card[0]!=0x00ff && + sd->status.inventory[index].card[0]!=0x00fe && + sd->status.inventory[index].card[0]!=(short)0xff00 && + sd->status.inventory[index].card[k] == id) { + ret++; + } + } + } + } + } + push_val(st->stack,C_INT,ret); +// push_val(st->stack,C_INT,current_equip_item_index); + return 0; +} + // // 実行部main // |