Jump to content
  • 0

Map Server suck after onbuyitem label


meko9586

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  09/27/13
  • Last Seen:  

-	shop	test	-1,501:-1.
prontera,50,50,5	script	test	847,{
callshop "test",0;
npcshopattach "test";
end;
OnBuyItem:
if(@bought_nameid[@i] == 502){ mes "test";close;}
mes "error";
end;
OnInit:
	npcshopitem "test", 502,10;
	end;
}

With just this simple dynamic shop script, my map server suck after I buy item 502.

 

The map server has no any error messages but it just seems to be stopped.

The client seems to disconnect from the server but it doesn't pop-up disconnection box eventually.

When I close the game and re-login to my account, I can not enter the map server.

As there are no any error messages in map server, I have no way to trace out the problem.

Besides, I get some source edit.

First, I changed the max item nameid to 65536.

Second, I added custom label onpcuseskill.

Third, I added three custom skills with custom status.

Fourth, just some simple configuration edit.

All of them work fine but OnBuyItem.

 

I've find the following script in npc.c. it has no different with the one in the latest git.

//npc_buylist for script-controlled shops.
static int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* item_list, struct npc_data* nd)
{
	char npc_ev[EVENT_NAME_LENGTH];
	int i;
	int key_nameid = 0;
	int key_amount = 0;

	// discard old contents
	script_cleararray_pc(sd, "@bought_nameid", (void*)0);
	script_cleararray_pc(sd, "@bought_quantity", (void*)0);

	// save list of bought items
	for( i = 0; i < n; i++ )
	{
		script_setarray_pc(sd, "@bought_nameid", i, (void*)(intptr_t)item_list[i*2+1], &key_nameid);
		script_setarray_pc(sd, "@bought_quantity", i, (void*)(intptr_t)item_list[i*2], &key_amount);
	}

	// invoke event
	snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::OnBuyItem", nd->exname);
	npc_event(sd, npc_ev, 0);

	return 0;
} 

Can anyone help me with this or tell me how could I trace out the problem?

It's a difficult problem, hope that anyone capable could help.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...