Browse Source

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

mc_cameri 20 năm trước cách đây
mục cha
commit
e333217bc3
5 tập tin đã thay đổi với 39 bổ sung91 xóa
  1. 2 0
      Changelog.txt
  2. 1 1
      conf-tmpl/charcommand_athena.conf
  3. 3 89
      src/map/atcommand.c
  4. 0 1
      src/map/atcommand.h
  5. 33 0
      src/map/charcommand.c

+ 2 - 0
Changelog.txt

@@ -1,5 +1,7 @@
 Date	Added
 12/29
+	* Removed @giveitem since #item it's the one that does this and added some of it's support to #item [MC Cameri]
+	  -#item <item_name> <item_count> <charname|all|everyone>
 	* Uncommented out import in charcommand_athena.conf, there is
           need to have it commented (all the others ones are
           uncommented) [Ajarn]

+ 1 - 1
conf-tmpl/charcommand_athena.conf

@@ -22,6 +22,6 @@ spiritball: 60
 item: 60
 job: 60
 jobchange: 60
-charzeny: 60
+zeny: 60
 
 import: conf/import/charcommand_conf.txt

+ 3 - 89
src/map/atcommand.c

@@ -208,7 +208,6 @@ ACMD_FUNC(gmotd); // Added by MC Cameri, created by davidsiaw
 ACMD_FUNC(misceffect); // by MC Cameri
 ACMD_FUNC(mobsearch);
 ACMD_FUNC(cleanmap);
-ACMD_FUNC(giveitem);
 
 #ifndef TXT_ONLY
 ACMD_FUNC(checkmail); // [Valaris]
@@ -458,7 +457,7 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_Send,				"@send",			60, atcommand_send },
 	{ AtCommand_SetBattleFlag,		"@setbattleflag",	60, atcommand_setbattleflag },
 	{ AtCommand_UnMute,				"@unmute",			60, atcommand_unmute }, // [Valaris]
-	{ AtCommand_Clearweather,         "@clearweather",   99, atcommand_clearweather }, // Dexity 
+	{ AtCommand_Clearweather,		"@clearweather",	99, atcommand_clearweather }, // Dexity 
 	{ AtCommand_UpTime,				"@uptime",			 0, atcommand_uptime }, // by MC Cameri
 //	{ AtCommand_ChangeSex,			"@changesex",		 1, atcommand_changesex }, // by MC Cameri
 	{ AtCommand_Mute,				"@mute",			99, atcommand_mute }, // [celest]
@@ -470,9 +469,8 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_Identify,	   	    "@identify",		40, atcommand_identify }, // by MC Cameri
 	{ AtCommand_Gmotd,				"@gmotd",			 0, atcommand_gmotd }, // Added by MC Cameri, created by davidsiaw
 	{ AtCommand_MiscEffect,			"@misceffect",		50, atcommand_misceffect }, // by MC Cameri
-	{ AtCommand_MobSearch,				"@mobsearch",		0, atcommand_mobsearch },
-	{ AtCommand_CleanMap,				"@cleanmap",		0, atcommand_cleanmap },
-	{ AtCommand_GiveItem,				"@giveitem",		0, atcommand_giveitem },
+	{ AtCommand_MobSearch,			"@mobsearch",		 0, atcommand_mobsearch },
+	{ AtCommand_CleanMap,			"@cleanmap",		 0, atcommand_cleanmap },
 
 #ifndef TXT_ONLY // sql-only commands
 	{ AtCommand_CheckMail,			"@checkmail",		 1, atcommand_listmail }, // [Valaris]
@@ -7585,90 +7583,6 @@ atcommand_cleanmap(
 	clif_displaymessage(fd, "All dropped items have been cleaned up.");
 	return 0;
 }
-/*==========================================
- * Give Item
- * @giveitem (item_id or item_name) amount charname
- *------------------------------------------
- */
-static void 
-atcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data,int number)
-{
-	int flag = 0;
-	int loop = 1, get_count = number,i;
-	struct item item_tmp;
-
-	if(sd && item_data){
-		if (item_data->type == 4 || item_data->type == 5 ||
-			item_data->type == 7 || item_data->type == 8) {
-			loop = number;
-			get_count = 1;
-		}
-		for (i = 0; i < loop; i++) {
-			memset(&item_tmp, 0, sizeof(item_tmp));
-			item_tmp.nameid = item_data->nameid;
-			item_tmp.identify = 1;
-			if ((flag = pc_additem((struct map_session_data*)sd,
-					&item_tmp, get_count)))
-				clif_additem((struct map_session_data*)sd, 0, 0, flag);
-		}
-	}
-}
-int
-atcommand_giveitem(
-	const int fd, struct map_session_data* sd,
-	const char* command, const char* message)
-{
-	struct map_session_data *pl_sd = NULL;
-	struct item_data *item_data;
-	char item_name[100];
-	char character[100];
-	char output[100];
-	int number,i,item_id;
-
-	if (!message || !*message)
-		return -1;
-
-	if (sscanf(message, "%99s %d %99[^\n]", item_name, &number, character) < 3)
-		return -1;
-
-	if (number <= 0)
-		number = 1;
-
-	if ((item_id = atoi(item_name)) > 0) {
-		if (battle_config.item_check) {
-			item_id =
-				(((item_data = itemdb_exists(item_id)) &&
-				 itemdb_available(item_id)) ? item_id : 0);
-		} else {
-			item_data = itemdb_search(item_id);
-		}
-	} else if ((item_data = itemdb_searchname(item_name)) != NULL) {
-		item_id = (!battle_config.item_check ||
-			itemdb_available(item_data->nameid)) ? item_data->nameid : 0;
-	}
-	if(item_id == 0)
-		return -1;
-
-	if ((pl_sd = map_nick2sd(character)) != NULL) { //該当名のキャラが存在する
-		atcommand_giveitem_sub(pl_sd,item_data,number);
-		snprintf(output, sizeof output, "You got %s %d.",item_name,number);
-		clif_displaymessage(pl_sd->fd, output);
-		snprintf(output, sizeof output, "%s received %s %d.",pl_sd->status.name,item_name,number);
-		clif_displaymessage(fd, output);
-	}
-	else if(strcmp(character,"ALL")==0){			// 名前がALLなら、接続者全員へ
-		for (i = 0; i < fd_max; i++) {
-			if (session[i] && (pl_sd = session[i]->session_data)){
-				atcommand_giveitem_sub(pl_sd,item_data,number);
-				snprintf(output, sizeof output, "You got %s %d.", item_name,number);
-				clif_displaymessage(pl_sd->fd, output);
-			}
-		}
-		snprintf(output, sizeof output, "%s received %s %d.","Everyone",item_name,number);
-		clif_displaymessage(fd, output);
-	}
-	return 0;
-}
 
 /*==========================================
  * 

+ 0 - 1
src/map/atcommand.h

@@ -196,7 +196,6 @@ enum AtCommandType {
 	AtCommand_MiscEffect, // by MC Cameri
 	AtCommand_MobSearch,
 	AtCommand_CleanMap,
-	AtCommand_GiveItem,
 
 	// SQL-only commands start
 #ifndef TXT_ONLY 

+ 33 - 0
src/map/charcommand.c

@@ -991,6 +991,29 @@ charcommand_storagelist(
 	return 0;
 }
 
+static void 
+charcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data,int number)
+{
+	int flag = 0;
+	int loop = 1, get_count = number,i;
+	struct item item_tmp;
+
+	if(sd && item_data){
+		if (item_data->type == 4 || item_data->type == 5 ||
+			item_data->type == 7 || item_data->type == 8) {
+			loop = number;
+			get_count = 1;
+		}
+		for (i = 0; i < loop; i++) {
+			memset(&item_tmp, 0, sizeof(item_tmp));
+			item_tmp.nameid = item_data->nameid;
+			item_tmp.identify = 1;
+			if ((flag = pc_additem((struct map_session_data*)sd,
+					&item_tmp, get_count)))
+				clif_additem((struct map_session_data*)sd, 0, 0, flag);
+		}
+	}
+}
 /*==========================================
  * #item command (usage: #item <name/id_of_item> <quantity> <player>)
  * by MC Cameri
@@ -1056,6 +1079,16 @@ int charcommand_item(
 				clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
 				return -1;
 			}
+		} else if(strncasecmp(character,"all")==0 || strncasecmp(character,"everyone")==0){			// 名前がALLなら、接続者全員へ
+			for (i = 0; i < fd_max; i++) {
+				if (session[i] && (pl_sd = session[i]->session_data)){
+					atcommand_giveitem_sub(pl_sd,item_data,number);
+					snprintf(output, sizeof output, "You got %s %d.", item_name,number);
+					clif_displaymessage(pl_sd->fd, output);
+				}
+			}
+			snprintf(output, sizeof output, "%s received %s %d.","Everyone",item_name,number);
+			clif_displaymessage(fd, output);
 		} else {
 			clif_displaymessage(fd, msg_table[3]); // Character not found.
 			return -1;