Jump to content
  • 0

@whosell


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

Spoiler

/*==========================================
* @whosell - List who is vending the item (amount, price, and location).
* revamped by VoidLess, original by zephyrus_cr
*------------------------------------------*/
ACMD_FUNC(whosell)
{
	char item_name[100];
	int item_id = 0, j, count = 0, sat_num = 0;
	int s_type = 1; // search bitmask: 0-name,1-id, 2-card, 4-refine
	int refine = 0,card_id = 0;
	bool flag = 1; // place dot on the minimap?
	struct map_session_data* pl_sd;
	struct s_mapiterator* iter;
	unsigned int MinPrice = battle_config.vending_max_value, MaxPrice = 0;
	struct item_data *item_data;
	static char atcmd_output[CHAT_SIZE_MAX];

	if (!*message) {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}
	if (sscanf(message, "+%d %d[%d]", &refine, &item_id, &card_id) == 3){
		s_type = 1+2+4;
	}
	else if (sscanf(message, "+%d %d", &refine, &item_id) == 2){
		s_type = 1+4;
	}
	else if (sscanf(message, "+%d [%d]", &refine, &card_id) == 2){
		s_type = 2+4;
	}
	else if (sscanf(message, "%d[%d]", &item_id, &card_id) == 2){
		s_type = 1+2;
	}
	else if (sscanf(message, "[%d]", &card_id) == 1){
		s_type = 2;
	}
	else if (sscanf(message, "+%d", &refine) == 1){
		s_type = 4;
	}
	else if (sscanf(message, "%d", &item_id) == 1 && item_id == atoi(message)){
		s_type = 1;
	}
	else if (sscanf(message, "%99[^\n]", item_name) == 1){
		s_type = 1;
	if ((item_data = itemdb_searchname(item_name)) == NULL){
		clif_displaymessage(fd, "Not found item with this name");
		return -1;
	}
		item_id = item_data->nameid;
	} else {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}

	//check card
	if(s_type & 2 && ((item_data = itemdb_exists(card_id)) == NULL || item_data->type != IT_CARD)){
		clif_displaymessage(fd, "Not found a card with than ID");
		return -1;
	}
	//check item
	if(s_type & 1 && (item_data = itemdb_exists(item_id)) == NULL){
		clif_displaymessage(fd, "Not found an item with than ID");
		return -1;
	}
	//check refine
	if(s_type & 4){
		if (refine<0 || refine>10){
			clif_displaymessage(fd, "Refine out of bounds: 0 - 10");
			return -1;
		}
		/*if(item_data->type != IT_WEAPON && item_data->type != IT_ARMOR){
			clif_displaymessage(fd, "Use refine only with weapon or armor");
			return -1;
		}*/
	}
	iter = mapit_getallusers();
	for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) 
	{
	if (pl_sd->vender_id ) {	 // check if player is vending
		for (j = 0; j < pl_sd->vend_num; j++) {
			if ((item_data = itemdb_exists(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid)) == NULL)
				continue;
			if(s_type & 1 && pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid != item_id)
				continue;
			if(s_type & 2 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) ||
					(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3] != card_id)))
				continue;
			if(s_type & 4 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) || pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine != refine))
				continue;
			if(item_data->type == IT_ARMOR)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %d[%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else if(item_data->type == IT_WEAPON)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %d[%d,%d,%d,%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else
				snprintf(atcmd_output, CHAT_SIZE_MAX, "ID %d | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x, pl_sd->bl.y
					,pl_sd->message);
			if(pl_sd->vending[j].value < MinPrice) MinPrice = pl_sd->vending[j].value;
			if(pl_sd->vending[j].value > MaxPrice) MaxPrice = pl_sd->vending[j].value;
			clif_displaymessage(fd, atcmd_output);
			count++;
			flag = 1;
		}
			if (flag && pl_sd->mapindex == sd->mapindex) {
				clif_viewpoint(sd, 1, 1, pl_sd->bl.x, pl_sd->bl.y, ++sat_num, 0xFFFFFF);
				flag = 0;
			}
		}
	}
	mapit_free(iter);
	if(count > 0) {
		snprintf(atcmd_output, CHAT_SIZE_MAX, "================== Found %d entries. ==================", count, MinPrice, MaxPrice);
		clif_displaymessage(fd, atcmd_output);
	} else
		clif_displaymessage(fd, "Nobody is selling it now.");

	return 0;
}

 

how about display the item's name instead of the ID ?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

try this

/*==========================================
* @whosell - List who is vending the item (amount, price, and location).
* revamped by VoidLess, original by zephyrus_cr
*------------------------------------------*/
ACMD_FUNC(whosell)
{
	char item_name[100];
	int item_id = 0, j, count = 0, sat_num = 0;
	int s_type = 1; // search bitmask: 0-name,1-id, 2-card, 4-refine
	int refine = 0,card_id = 0;
	bool flag = 1; // place dot on the minimap?
	struct map_session_data* pl_sd;
	struct s_mapiterator* iter;
	unsigned int MinPrice = battle_config.vending_max_value, MaxPrice = 0;
	struct item_data *item_data;
	static char atcmd_output[CHAT_SIZE_MAX];

	if (!*message) {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}
	if (sscanf(message, "+%d %d[%d]", &refine, &item_id, &card_id) == 3){
		s_type = 1+2+4;
	}
	else if (sscanf(message, "+%d %d", &refine, &item_id) == 2){
		s_type = 1+4;
	}
	else if (sscanf(message, "+%d [%d]", &refine, &card_id) == 2){
		s_type = 2+4;
	}
	else if (sscanf(message, "%d[%d]", &item_id, &card_id) == 2){
		s_type = 1+2;
	}
	else if (sscanf(message, "[%d]", &card_id) == 1){
		s_type = 2;
	}
	else if (sscanf(message, "+%d", &refine) == 1){
		s_type = 4;
	}
	else if (sscanf(message, "%d", &item_id) == 1 && item_id == atoi(message)){
		s_type = 1;
	}
	else if (sscanf(message, "%99[^\n]", item_name) == 1){
		s_type = 1;
	if ((item_data = itemdb_searchname(item_name)) == NULL){
		clif_displaymessage(fd, "Not found item with this name");
		return -1;
	}
		item_id = item_data->nameid;
	} else {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}

	//check card
	if(s_type & 2 && ((item_data = itemdb_exists(card_id)) == NULL || item_data->type != IT_CARD)){
		clif_displaymessage(fd, "Not found a card with than ID");
		return -1;
	}
	//check item
	if(s_type & 1 && (item_data = itemdb_exists(item_id)) == NULL){
		clif_displaymessage(fd, "Not found an item with than ID");
		return -1;
	}
	//check refine
	if(s_type & 4){
		if (refine<0 || refine>10){
			clif_displaymessage(fd, "Refine out of bounds: 0 - 10");
			return -1;
		}
		/*if(item_data->type != IT_WEAPON && item_data->type != IT_ARMOR){
			clif_displaymessage(fd, "Use refine only with weapon or armor");
			return -1;
		}*/
	}
	iter = mapit_getallusers();
	for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) 
	{
	if (pl_sd->vender_id ) {	 // check if player is vending
		for (j = 0; j < pl_sd->vend_num; j++) {
			if ((item_data = itemdb_exists(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid)) == NULL)
				continue;
			if(s_type & 1 && pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid != item_id)
				continue;
			if(s_type & 2 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) ||
					(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3] != card_id)))
				continue;
			if(s_type & 4 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) || pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine != refine))
				continue;
			if(item_data->type == IT_ARMOR)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %s[%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,item_data->jname
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else if(item_data->type == IT_WEAPON)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %s[%d,%d,%d,%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,item_data->jname
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else
				snprintf(atcmd_output, CHAT_SIZE_MAX, "%s | Price %ud | Amount %d | %s[%d,%d] | %s",item_data->jname
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x, pl_sd->bl.y
					,pl_sd->message);
			if(pl_sd->vending[j].value < MinPrice) MinPrice = pl_sd->vending[j].value;
			if(pl_sd->vending[j].value > MaxPrice) MaxPrice = pl_sd->vending[j].value;
			clif_displaymessage(fd, atcmd_output);
			count++;
			flag = 1;
		}
			if (flag && pl_sd->mapindex == sd->mapindex) {
				clif_viewpoint(sd, 1, 1, pl_sd->bl.x, pl_sd->bl.y, ++sat_num, 0xFFFFFF);
				flag = 0;
			}
		}
	}
	mapit_free(iter);
	if(count > 0) {
		snprintf(atcmd_output, CHAT_SIZE_MAX, "================== Found %d entries. ==================", count, MinPrice, MaxPrice);
		clif_displaymessage(fd, atcmd_output);
	} else
		clif_displaymessage(fd, "Nobody is selling it now.");

	return 0;
}

 

  • Upvote 1
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

1 hour ago, sader1992 said:

try this


/*==========================================
* @whosell - List who is vending the item (amount, price, and location).
* revamped by VoidLess, original by zephyrus_cr
*------------------------------------------*/
ACMD_FUNC(whosell)
{
	char item_name[100];
	int item_id = 0, j, count = 0, sat_num = 0;
	int s_type = 1; // search bitmask: 0-name,1-id, 2-card, 4-refine
	int refine = 0,card_id = 0;
	bool flag = 1; // place dot on the minimap?
	struct map_session_data* pl_sd;
	struct s_mapiterator* iter;
	unsigned int MinPrice = battle_config.vending_max_value, MaxPrice = 0;
	struct item_data *item_data;
	static char atcmd_output[CHAT_SIZE_MAX];

	if (!*message) {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}
	if (sscanf(message, "+%d %d[%d]", &refine, &item_id, &card_id) == 3){
		s_type = 1+2+4;
	}
	else if (sscanf(message, "+%d %d", &refine, &item_id) == 2){
		s_type = 1+4;
	}
	else if (sscanf(message, "+%d [%d]", &refine, &card_id) == 2){
		s_type = 2+4;
	}
	else if (sscanf(message, "%d[%d]", &item_id, &card_id) == 2){
		s_type = 1+2;
	}
	else if (sscanf(message, "[%d]", &card_id) == 1){
		s_type = 2;
	}
	else if (sscanf(message, "+%d", &refine) == 1){
		s_type = 4;
	}
	else if (sscanf(message, "%d", &item_id) == 1 && item_id == atoi(message)){
		s_type = 1;
	}
	else if (sscanf(message, "%99[^\n]", item_name) == 1){
		s_type = 1;
	if ((item_data = itemdb_searchname(item_name)) == NULL){
		clif_displaymessage(fd, "Not found item with this name");
		return -1;
	}
		item_id = item_data->nameid;
	} else {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}

	//check card
	if(s_type & 2 && ((item_data = itemdb_exists(card_id)) == NULL || item_data->type != IT_CARD)){
		clif_displaymessage(fd, "Not found a card with than ID");
		return -1;
	}
	//check item
	if(s_type & 1 && (item_data = itemdb_exists(item_id)) == NULL){
		clif_displaymessage(fd, "Not found an item with than ID");
		return -1;
	}
	//check refine
	if(s_type & 4){
		if (refine<0 || refine>10){
			clif_displaymessage(fd, "Refine out of bounds: 0 - 10");
			return -1;
		}
		/*if(item_data->type != IT_WEAPON && item_data->type != IT_ARMOR){
			clif_displaymessage(fd, "Use refine only with weapon or armor");
			return -1;
		}*/
	}
	iter = mapit_getallusers();
	for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) 
	{
	if (pl_sd->vender_id ) {	 // check if player is vending
		for (j = 0; j < pl_sd->vend_num; j++) {
			if ((item_data = itemdb_exists(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid)) == NULL)
				continue;
			if(s_type & 1 && pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid != item_id)
				continue;
			if(s_type & 2 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) ||
					(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3] != card_id)))
				continue;
			if(s_type & 4 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) || pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine != refine))
				continue;
			if(item_data->type == IT_ARMOR)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %s[%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,item_data->jname
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else if(item_data->type == IT_WEAPON)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %s[%d,%d,%d,%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,item_data->jname
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else
				snprintf(atcmd_output, CHAT_SIZE_MAX, "%s | Price %ud | Amount %d | %s[%d,%d] | %s",item_data->jname
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x, pl_sd->bl.y
					,pl_sd->message);
			if(pl_sd->vending[j].value < MinPrice) MinPrice = pl_sd->vending[j].value;
			if(pl_sd->vending[j].value > MaxPrice) MaxPrice = pl_sd->vending[j].value;
			clif_displaymessage(fd, atcmd_output);
			count++;
			flag = 1;
		}
			if (flag && pl_sd->mapindex == sd->mapindex) {
				clif_viewpoint(sd, 1, 1, pl_sd->bl.x, pl_sd->bl.y, ++sat_num, 0xFFFFFF);
				flag = 0;
			}
		}
	}
	mapit_free(iter);
	if(count > 0) {
		snprintf(atcmd_output, CHAT_SIZE_MAX, "================== Found %d entries. ==================", count, MinPrice, MaxPrice);
		clif_displaymessage(fd, atcmd_output);
	} else
		clif_displaymessage(fd, "Nobody is selling it now.");

	return 0;
}

 

it's working can but i can request display the card name too 
like this 

Item Name [Card] | [Item Price] | Map(x.y) | Shop Name

image.png.4c4fec9aecee39576f429b8bab241277.png

Photo : Credit to RagnaForce

and i try to use on Extended Vending he detect Z not item like C = Credit
 

Edited by Bringer
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.15
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

On 11/27/2019 at 10:39 AM, sader1992 said:

try this


/*==========================================
* @whosell - List who is vending the item (amount, price, and location).
* revamped by VoidLess, original by zephyrus_cr
*------------------------------------------*/
ACMD_FUNC(whosell)
{
	char item_name[100];
	int item_id = 0, j, count = 0, sat_num = 0;
	int s_type = 1; // search bitmask: 0-name,1-id, 2-card, 4-refine
	int refine = 0,card_id = 0;
	bool flag = 1; // place dot on the minimap?
	struct map_session_data* pl_sd;
	struct s_mapiterator* iter;
	unsigned int MinPrice = battle_config.vending_max_value, MaxPrice = 0;
	struct item_data *item_data;
	static char atcmd_output[CHAT_SIZE_MAX];

	if (!*message) {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}
	if (sscanf(message, "+%d %d[%d]", &refine, &item_id, &card_id) == 3){
		s_type = 1+2+4;
	}
	else if (sscanf(message, "+%d %d", &refine, &item_id) == 2){
		s_type = 1+4;
	}
	else if (sscanf(message, "+%d [%d]", &refine, &card_id) == 2){
		s_type = 2+4;
	}
	else if (sscanf(message, "%d[%d]", &item_id, &card_id) == 2){
		s_type = 1+2;
	}
	else if (sscanf(message, "[%d]", &card_id) == 1){
		s_type = 2;
	}
	else if (sscanf(message, "+%d", &refine) == 1){
		s_type = 4;
	}
	else if (sscanf(message, "%d", &item_id) == 1 && item_id == atoi(message)){
		s_type = 1;
	}
	else if (sscanf(message, "%99[^\n]", item_name) == 1){
		s_type = 1;
	if ((item_data = itemdb_searchname(item_name)) == NULL){
		clif_displaymessage(fd, "Not found item with this name");
		return -1;
	}
		item_id = item_data->nameid;
	} else {
		clif_displaymessage(fd, "Use: @whosell <item_id> or @whosell <name>");
		return -1;
	}

	//check card
	if(s_type & 2 && ((item_data = itemdb_exists(card_id)) == NULL || item_data->type != IT_CARD)){
		clif_displaymessage(fd, "Not found a card with than ID");
		return -1;
	}
	//check item
	if(s_type & 1 && (item_data = itemdb_exists(item_id)) == NULL){
		clif_displaymessage(fd, "Not found an item with than ID");
		return -1;
	}
	//check refine
	if(s_type & 4){
		if (refine<0 || refine>10){
			clif_displaymessage(fd, "Refine out of bounds: 0 - 10");
			return -1;
		}
		/*if(item_data->type != IT_WEAPON && item_data->type != IT_ARMOR){
			clif_displaymessage(fd, "Use refine only with weapon or armor");
			return -1;
		}*/
	}
	iter = mapit_getallusers();
	for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) 
	{
	if (pl_sd->vender_id ) {	 // check if player is vending
		for (j = 0; j < pl_sd->vend_num; j++) {
			if ((item_data = itemdb_exists(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid)) == NULL)
				continue;
			if(s_type & 1 && pl_sd->cart.u.items_cart[pl_sd->vending[j].index].nameid != item_id)
				continue;
			if(s_type & 2 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) ||
					(pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2] != card_id &&
					pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3] != card_id)))
				continue;
			if(s_type & 4 && ((item_data->type != IT_ARMOR && item_data->type != IT_WEAPON) || pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine != refine))
				continue;
			if(item_data->type == IT_ARMOR)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %s[%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,item_data->jname
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else if(item_data->type == IT_WEAPON)
				snprintf(atcmd_output, CHAT_SIZE_MAX, "+%d %s[%d,%d,%d,%d] | Price %ud | Amount %d | %s[%d,%d] | %s",pl_sd->cart.u.items_cart[pl_sd->vending[j].index].refine
					,item_data->jname
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[0]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[1]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[2]
					,pl_sd->cart.u.items_cart[pl_sd->vending[j].index].card[3]
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x,pl_sd->bl.y
					,pl_sd->message);
			else
				snprintf(atcmd_output, CHAT_SIZE_MAX, "%s | Price %ud | Amount %d | %s[%d,%d] | %s",item_data->jname
					,pl_sd->vending[j].value
					,pl_sd->vending[j].amount
					,mapindex_id2name(pl_sd->mapindex)
					,pl_sd->bl.x, pl_sd->bl.y
					,pl_sd->message);
			if(pl_sd->vending[j].value < MinPrice) MinPrice = pl_sd->vending[j].value;
			if(pl_sd->vending[j].value > MaxPrice) MaxPrice = pl_sd->vending[j].value;
			clif_displaymessage(fd, atcmd_output);
			count++;
			flag = 1;
		}
			if (flag && pl_sd->mapindex == sd->mapindex) {
				clif_viewpoint(sd, 1, 1, pl_sd->bl.x, pl_sd->bl.y, ++sat_num, 0xFFFFFF);
				flag = 0;
			}
		}
	}
	mapit_free(iter);
	if(count > 0) {
		snprintf(atcmd_output, CHAT_SIZE_MAX, "================== Found %d entries. ==================", count, MinPrice, MaxPrice);
		clif_displaymessage(fd, atcmd_output);
	} else
		clif_displaymessage(fd, "Nobody is selling it now.");

	return 0;
}

 

hello why did im getting this error thanks in advance 

[Error]: npc_parsesrcfile: Unknown syntax in file 'npc/thor/WhoSell.txt', line '4'. Stopping...
 * w1=ACMD_FUNC(whosell)
 * w2=
 * w3=
 * w4=

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  224
  • Reputation:   4
  • Joined:  02/09/12
  • Last Seen:  

On 5/4/2021 at 6:23 PM, chadness said:

hello why did im getting this error thanks in advance 

[Error]: npc_parsesrcfile: Unknown syntax in file 'npc/thor/WhoSell.txt', line '4'. Stopping...
 * w1=ACMD_FUNC(whosell)
 * w2=
 * w3=
 * w4=

That's not NPC script it's diff u need to edit your src not to put in npc script

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.15
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

2 hours ago, simplexjay2 said:

That's not NPC script it's diff u need to edit your src not to put in npc script

hello goodmorning where did exactly in src will i put that lines

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  224
  • Reputation:   4
  • Joined:  02/09/12
  • Last Seen:  

9 minutes ago, chadness said:

hello goodmorning where did exactly in src will i put that lines

 

search src/custom/atcommand.inc then recompile your server

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...