j=contsp[serhash1].pointer[ci1];
j = calcItemFromSer(vecContainer2[ci1]);
int sellstuff(int s, int i){	char itemname[256];	int p=-1, j, q, m1t, pack, z, value;	int serial,serhash,ci,serial1,serhash1,ci1;	unsigned char m1[2048];	unsigned char m2[2];	char ciname[256]; // By Magius(CHE)	char cinam2[256]; // By Magius(CHE)    P_CHAR pc = MAKE_CHARREF_LRV(i, 0);	serial=pc->serial;	serhash=serial%HASHMAX;	for (ci=0;ci<contsp[serhash].max;ci++)	{		q=contsp[serhash].pointer[ci];		if (q!=-1)			if ((items[q].contserial==serial) &&				(items[q].layer==0x1C))			{				p=q;				break;			}	}	if (p==-1) return 0;	m2[0]=0x33;	m2[1]=0x01;	Xsend(s, m2, 2);	pack=packitem(currchar[s]);	if (pack==-1) return 0; //LB	m1[0]=0x9E; // Header	m1[1]=0; // Size	m1[2]=0; // Size	m1[3]=pc->ser1;	m1[4]=pc->ser2;	m1[5]=pc->ser3;	m1[6]=pc->ser4;	m1[7]=0; // Num items	m1[8]=0; // Num items	m1t=9;	serial=items[p].serial;	serhash=serial%HASHMAX;	for (ci=0;ci<contsp[serhash].max;ci++)	{		q=contsp[serhash].pointer[ci];		if (q!=-1)		{			if ((items[q].contserial==serial))			{				serial1=items[pack].serial;				serhash1=serial1%HASHMAX;				for (ci1=0;ci1<contsp[serhash1].max;ci1++)				{					j=contsp[serhash1].pointer[ci1];					if (j!=-1) // LB crashfix					{						sprintf(ciname,"'%s'",items[j].name); // Added by Magius(CHE)						sprintf(cinam2,"'%s'",items[q].name); // Added by Magius(CHE)						strupr(ciname); // Added by Magius(CHE)						strupr(cinam2); // Added by Magius(CHE)						if (items[j].contserial==serial1 &&							items[j].id()==items[q].id()  &&							items[j].type==items[q].type && (m1[8]<60) &&							((SrvParms->sellbyname==0)||(SrvParms->sellbyname==1 && (!strcmp(ciname,cinam2))))) // If the names are the same! --- Magius(CHE)						{							LongToCharPtr(items[j].serial,m1+m1t+0);							ShortToCharPtr(items[j].id(),m1+m1t+4);							ShortToCharPtr(items[j].color(),m1+m1t+6);							ShortToCharPtr(items[j].amount,m1+m1t+8);							value=items[q].value;							value=calcValue(j, value);							if (SrvParms->trade_system==1) value=calcGoodValue(i,j,value,1); // by Magius(CHE)							m1[m1t+10]=value>>8;							m1[m1t+11]=value%256;							m1[m1t+12]=0;// Unknown... 2nd length byte for string?							m1[m1t+13]=items[j].getName(itemname);							m1t=m1t+14;							for(z=0;z<m1[m1t-1];z++)							{								m1[m1t+z]=itemname[z];							}							m1t=m1t+m1[m1t-1];							m1[8]++;						}					}				}			}		}	}	m1[1]=m1t>>8;	m1[2]=m1t%256;	if (m1[8]!=0)	{		Xsend(s, m1, m1t);	}	else	{		npctalkall(i, "Thou doth posses nothing of interest to me.",0);	}	m2[0]=0x33;	m2[1]=0x00;	Xsend(s, m2, 2);	return 1;}