Browse Source

* Modified delitem/delitem2 to have the same behaviour as getitem/getitem2 (optional account_id parameter) bugreport:1035
* Modified doc in consequence

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12648 54d463be-8e91-2dee-dedb-b68131a5f0ec

toms 17 years ago
parent
commit
c68d9e2a7d
3 changed files with 39 additions and 26 deletions
  1. 4 0
      Changelog-Trunk.txt
  2. 11 8
      doc/script_commands.txt
  3. 24 18
      src/map/script.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 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.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
+2008/04/25
+	* Modified delitem/delitem2 to have the same behaviour as getitem/getitem2 (optional
+	  account_id parameter) bugreport:1035
+	* Modified doc in consequence [Toms]
 2008/04/23
 2008/04/23
 	* Fixed script strings not being handled properly (only skipped the \).
 	* Fixed script strings not being handled properly (only skipped the \).
 	* Added skip_escaped_c to strlib.c/h.
 	* Added skip_escaped_c to strlib.c/h.

+ 11 - 8
doc/script_commands.txt

@@ -110,6 +110,9 @@
 //=       Added documentation for the 'checkcell' command [ultramage]
 //=       Added documentation for the 'checkcell' command [ultramage]
 //= 3.19.20080407
 //= 3.19.20080407
 //=       Extended the behaviour of 'guardian'. [FlavioJS]
 //=       Extended the behaviour of 'guardian'. [FlavioJS]
+//= 3.20.20080425
+//=	      Corrected 'getitem', 'getitem2' & 'delitem2' (charid instead of accountid) [Toms]
+//=	      Modified 'delitem' (added optional accountid parameter) [Toms]
 //=========================================================
 //=========================================================
 
 
 This document is a reference manual for all the scripting commands and functions 
 This document is a reference manual for all the scripting commands and functions 
@@ -3656,8 +3659,8 @@ you can look at, this may help you create a Stylist of your own:
 \\
 \\
 ---------------------------------------
 ---------------------------------------
 
 
-*getitem <item id>,<amount>{,<character ID>};
-*getitem "<item name>",<amount>{,<character ID>};
+*getitem <item id>,<amount>{,<account ID>};
+*getitem "<item name>",<amount>{,<account ID>};
 
 
 This command will give a specific amount of specified items to the target 
 This command will give a specific amount of specified items to the target 
 character. If the character is not online, nothing will happen.
 character. If the character is not online, nothing will happen.
@@ -3699,8 +3702,8 @@ quite a few item scripts. For more examples check just about any official script
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
-*getitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
+*getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
+*getitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
 
 
 This command will give an amount of specified items to the invoking character. 
 This command will give an amount of specified items to the invoking character. 
 If an optional character ID is specified, and that character is currently 
 If an optional character ID is specified, and that character is currently 
@@ -3844,8 +3847,8 @@ If the map name is given as "this", the map the invoking character is on will be
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*delitem <item id>,<amount>;
-*delitem "<item name>",<amount>;
+*delitem <item id>,<amount>{,<account ID>};
+*delitem "<item name>",<amount>{,<account ID>};
 
 
 This command will take a specified amount of items from the invoking character. 
 This command will take a specified amount of items from the invoking character. 
 As all the item commands, this one uses the ID of the item found inside 
 As all the item commands, this one uses the ID of the item found inside 
@@ -3866,8 +3869,8 @@ database. If the name is not found, nothing will be deleted.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
-*delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
+*delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
+*delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
 
 
 This command will take a specified amount of items from the invoking character. 
 This command will take a specified amount of items from the invoking character. 
 Check 'getitem2' to understand its expanded parameters.
 Check 'getitem2' to understand its expanded parameters.

+ 24 - 18
src/map/script.c

@@ -5366,18 +5366,16 @@ BUILDIN_FUNC(getitem)
 		it.identify=1;
 		it.identify=1;
 	else
 	else
 		it.identify=itemdb_isidentified(nameid);
 		it.identify=itemdb_isidentified(nameid);
+
 	if( script_hasdata(st,4) )
 	if( script_hasdata(st,4) )
-	{// <character ID>
-		sd=map_id2sd(script_getnum(st,4));
-	} else
-	{// attached player
-		sd=script_rid2sd(st);
-	}
+		sd=map_id2sd(script_getnum(st,4)); // <Account ID>
+	else
+		sd=script_rid2sd(st); // Attached player
+
 	if( sd == NULL ) // no target
 	if( sd == NULL ) // no target
 		return 0;
 		return 0;
 
 
-
-        //Check if it's stackable.
+	//Check if it's stackable.
 	if (!itemdb_isstackable(nameid))
 	if (!itemdb_isstackable(nameid))
 		get_count = 1;
 		get_count = 1;
 	else
 	else
@@ -5416,8 +5414,12 @@ BUILDIN_FUNC(getitem2)
 	TBL_PC *sd;
 	TBL_PC *sd;
 	struct script_data *data;
 	struct script_data *data;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
+	if( script_hasdata(st,11) )
+		sd=map_id2sd(script_getnum(st,11)); // <Account ID>
+	else
+		sd=script_rid2sd(st); // Attached player
+
+	if( sd == NULL ) // no target
 		return 0;
 		return 0;
 
 
 	data=script_getdata(st,2);
 	data=script_getdata(st,2);
@@ -5440,10 +5442,6 @@ BUILDIN_FUNC(getitem2)
 	c2=script_getnum(st,8);
 	c2=script_getnum(st,8);
 	c3=script_getnum(st,9);
 	c3=script_getnum(st,9);
 	c4=script_getnum(st,10);
 	c4=script_getnum(st,10);
-	if( script_hasdata(st,11) ) //アイテムを指定したIDに渡す
-		sd=map_id2sd(script_getnum(st,11));
-	if(sd == NULL) //アイテムを渡す相手がいなかったらお帰り
-		return 0;
 
 
 	if(nameid<0) { // ランダム
 	if(nameid<0) { // ランダム
 		nameid=itemdb_searchrandomid(-nameid);
 		nameid=itemdb_searchrandomid(-nameid);
@@ -5657,8 +5655,12 @@ BUILDIN_FUNC(delitem)
 	TBL_PC *sd;
 	TBL_PC *sd;
 	struct script_data *data;
 	struct script_data *data;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
+	if( script_hasdata(st,4) )
+		sd=map_id2sd(script_getnum(st,4)); // <Account ID>
+	else
+		sd=script_rid2sd(st); // Attached player
+
+	if( sd == NULL ) // no target
 		return 0;
 		return 0;
 
 
 	data=script_getdata(st,2);
 	data=script_getdata(st,2);
@@ -5763,8 +5765,12 @@ BUILDIN_FUNC(delitem2)
 	TBL_PC *sd;
 	TBL_PC *sd;
 	struct script_data *data;
 	struct script_data *data;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
+	if( script_hasdata(st,11) )
+		sd=map_id2sd(script_getnum(st,11)); // <Account ID>
+	else
+		sd=script_rid2sd(st); // Attached player
+
+	if( sd == NULL ) // no target
 		return 0;
 		return 0;
 
 
 	data=script_getdata(st,2);
 	data=script_getdata(st,2);