Jump to content

  •  

Shortcut

Member Since 24 May 2015
Offline Last Active May 01 2017 02:56 PM
-----

Posts I've Made

In Topic: Buying amount limitation on NST_MARKET trader

03 May 2016 - 09:43 PM

I found some behavier about item weight and shoptype.

If charactor have weight == 0 , max_weight == 4000

and itemid = 501 (Red_Potion) weight 7 (70)

I can buy stuff about 80 ea (max_weight/itemid) not 571 ea for real weight ( max_weight/item_weight )

But anyone can fix it. goto clif.c line round 18240 in function clif_npc_market_open

 

/* NPC Market (by Ind after an extensive debugging of the packet, only possible thanks to Yommy <3) */
void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) {
#if PACKETVER >= 20131223
	struct npc_item_list *shop;
	unsigned short shop_size, i, c;

	nullpo_retv(sd);
	nullpo_retv(nd);
	shop = nd->u.scr.shop->item;
	shop_size = nd->u.scr.shop->items;
	npcmarket_open.PacketType = npcmarketopenType;

	for(i = 0, c = 0; i < shop_size; i++) {
		struct item_data *id = NULL;
		if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != NULL) {
			npcmarket_open.list[c].nameid = shop[i].nameid;
			npcmarket_open.list[c].price  = shop[i].value;
			npcmarket_open.list[c].qty    = shop[i].qty;
			npcmarket_open.list[c].type   = itemtype(id->type);
			// npcmarket_open.list[c].view   = ( id->view_id > 0 ) ? id->view_id : id->nameid; << comment old one
			npcmarket_open.list[c].view   = itemdb_weight(id->nameid); << add new one 
			c++;
		}
	}

	npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c );

	clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF);
#endif
}