summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-08 21:23:51 +0000
committerLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-08 21:23:51 +0000
commit6859bee5720898aa7fa2e65f460fc795fa6bbf7b (patch)
tree9a94460f3d5252d1355784583cc52028e0f65d02
parent5e91eb01b017839da608b1ca4d3248866ae58233 (diff)
downloadhercules-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
-rw-r--r--Changelog-SVN.txt13
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/script.c61
-rw-r--r--src/map/status.c8
4 files changed, 74 insertions, 12 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt
index 0c883bffc..47f069352 100644
--- a/Changelog-SVN.txt
+++ b/Changelog-SVN.txt
@@ -1,5 +1,18 @@
Date Added
+03/09
+ * Added new script command: 'cardscnt'. It returns N of inserted cards in the same weapon. [Lupus]
+ Now I can start fixing CARDS COMBO exploits. And it's possible to fix old cards power abuse, too.
+ e.g. Assassins can equip 2 4-slot weapons and have HUGE card bonuses.
+ It's said that you can have only ONE bonus per hand...
+ * Fixed and tested script command 'isequippedcnt'. It didn't return real value [Lupus]
+ Here's an easy way to test all items:
+ 4149,Gargoyle_Card,Gargoyle Card,6,20,0,10,,,,,,,2,,,,{},{ dispbottom "Gagoyle OK:"; dispbottom isequipped(4149); dispbottom isequippedcnt(4149); dispbottom cardscnt(4149); }
+ * Fixed "nice char save by the fountain of Prontera"; People (Helpers, GMs) did abuse their power and [Lupus]
+ used to @jail friend / @unjail friend. To make his save point in the middle of the Prontera.
+ So I made @unjail save coords to 0,0 (on unjail it makes player's save point to appear always in a random place of Prontera)
+ You can use this query to "Clear nice save point of all jail/unjail abusers friends"
+ SQL QUERY: update ragnarok.char set save_x = 0, save_y = 0 where (save_map = 'prontera.gat' and save_y = 191)
03/08
* Added chance for Enchant Poison to poison enemy, and reduced Deadly Poison
chance [celest]
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9fea47dee..fdd3143a5 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6422,8 +6422,8 @@ int atcommand_unjail(
if (pl_sd->bl.m != map_mapname2mapid("sec_pri.gat")) {
clif_displaymessage(fd, msg_table[119]); // This player is not in jails.
return -1;
- } else if (pc_setpos(pl_sd, "prontera.gat", 156, 191, 3) == 0) {
- pc_setsavepoint(pl_sd, "prontera.gat", 156, 191); // Save char respawn point in Prontera
+ } else if (pc_setpos(pl_sd, "prontera.gat", 0, 0, 3) == 0) { //old coords: 156,191
+ pc_setsavepoint(pl_sd, "prontera.gat", 0, 0); // Save char respawn point in Prontera
clif_displaymessage(pl_sd->fd, msg_table[120]); // GM has discharge you.
clif_displaymessage(fd, msg_table[121]); // Player warped to Prontera.
} else {
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
//
diff --git a/src/map/status.c b/src/map/status.c
index f81952518..de2efce5a 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -268,6 +268,10 @@ int percentrefinery[5][10]; // 精錬成功率(refine_db.txt)
static int atkmods[3][20]; // 武器ATKサイズ修正(size_fix.txt)
static char job_bonus[3][MAX_PC_CLASS][MAX_LEVEL];
+int current_equip_item_index; //Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus]
+//we need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only
+//to avoid cards exploits
+
/*==========================================
* 精錬ボーナス
*------------------------------------------
@@ -537,7 +541,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
}
for(i=0;i<10;i++) {
- index = sd->equip_index[i];
+ current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
if(index < 0)
continue;
if(i == 9 && sd->equip_index[8] == index)
@@ -594,7 +598,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
// ?備品によるステ?タス?化はここで?行
for(i=0;i<10;i++) {
- index = sd->equip_index[i];
+ current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
if(index < 0)
continue;
if(i == 9 && sd->equip_index[8] == index)