[src] Crafting

Codes already submitted by people of the forums.
Drajwer
<3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

I just share handler not whole server side source. That mean you must work a bit on it and do some own work. Also you need to figure it out on client side. Good luck:

Code: Select all

void
CGame::ReqCraftingHandler (int iClientH, char *pData)
{
	DWORD *dwp;
	WORD *wp;
	char *cp, cI[6], cPortionName[21], cData[120];
	int iRet, i, j, iEraseReq, iSkillLimit, iSkillLevel, iResult, iDifficulty;
	short *sp, sItemIndex[6], sTemp;
	short sItemNumber[6], sItemArray[12], sItemID[6];
	BOOL bDup, bFlag;
	class CItem *pItem;
	BOOL bJewel;          	
	int iItemID;
	BOOL bMagin;
	int iPurity;
	return;
	if (m_pClientList[iClientH] == NULL)
  return;
	m_pClientList[iClientH]->m_iSkillMsgRecvCount++;
	for (i = 0; i < 6; i++)
	{
  cI[i] = -1;
  sItemIndex[i] = -1;
  sItemNumber[i] = 0;
	}
	cp = (char *) (pData + 11);
	cI[0] = *cp;
	cp++;
	cI[1] = *cp;
	cp++;
	cI[2] = *cp;
	cp++;
	cI[3] = *cp;
	cp++;
	cI[4] = *cp;
	cp++;
	cI[5] = *cp;
	cp++;
	for (i = 0; i < 6; i++)
	{
  if (cI[i] >= DEF_MAXITEMS)
  	return;
  if ((cI[i] >= 0)
  	&& (m_pClientList[iClientH]->m_pItemList[cI[i]] == NULL)) return;
	}
	for (i = 0; i < 6; i++)
  if (cI[i] >= 0)
	{
  bDup = FALSE;
  for (j = 0; j < 6; j++)
  	if (sItemIndex[j] == cI[i])
  {
  	sItemNumber[j]++;
  	bDup = TRUE;
  }
  if (bDup == FALSE)
  {
  	for (j = 0; j < 6; j++)
    if (sItemIndex[j] == -1)
  	{
    sItemIndex[j] = cI[i];
    sItemNumber[j]++;
    goto RCPH_LOOPBREAK;
  	}
  	RCPH_LOOPBREAK:;
  }
	}
	for (i = 0; i < 6; i++)
  if (sItemIndex[i] != -1)
	{
  if (sItemIndex[i] < 0)
  	return;
  if ((sItemIndex[i] >= 0) && (sItemIndex[i] >= DEF_MAXITEMS))
  	return;
  if (m_pClientList[iClientH]->m_pItemList[sItemIndex[i]] == NULL)
  	return;
  if (m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_dwCount <
  	sItemNumber[i])
  	return;
	}
	bFlag = TRUE;
	while (bFlag == TRUE)
	{
  bFlag = FALSE;
  for (i = 0; i < 5; i++)
  	if ((sItemIndex[i] != -1) && (sItemIndex[i + 1] != -1))
  {
  	if (
    (m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->
    m_sIDnum) <
    (m_pClientList[iClientH]->m_pItemList[sItemIndex[i + 1]]->
    m_sIDnum))
  	{
    sTemp = sItemIndex[i + 1];
    sItemIndex[i + 1] = sItemIndex[i];
    sItemIndex[i] = sTemp;
    sTemp = sItemNumber[i + 1];
    sItemNumber[i + 1] = sItemNumber[i];
    sItemNumber[i] = sTemp;
    bFlag = TRUE;
  	}
  }
	}
	char showbuff[100];
	char snumbers[100];
	int tmpid=-1;
	ZeroMemory(showbuff,sizeof(showbuff));
	ZeroMemory(snumbers,SFizeof(snumbers));
	for (i = 0; i < 6; i++)
  if (sItemIndex[i] != -1)
	{
  wsprintf(showbuff,"%s %d",showbuff,m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_sIDnum);
  wsprintf(snumbers,"%s %d",snumbers,sItemNumber[i]);
  //ItemDepleteHandler (iClientH, sItemIndex[i], FALSE);
	}
	iItemID=0;
	PutLogList(showbuff);
	bJewel = FALSE;
	bMagin = FALSE;
	iPurity = 0;
	int Wares = 0;
	if (strcmp(showbuff," 657 356 354 308 308")==0)	
	{
  iItemID=894;          
	}
	if (strcmp(showbuff," 894 657 356 354 308")==0)
	{
  //MS12>MS14
  iItemID=895;          
	}
	if (strcmp(showbuff," 895 657 358 356 354 308")==0)	
	{
  //MS14>MS16
  iItemID=896;        	
	}

	if (strcmp(showbuff," 896 657 358 356 354 308")==0)  
	{

  iItemID=897;          
	}

	if (strcmp(shodsdsfwbuff," 657 356 354 305 305")==0)  	
	{
  iItemID_=890;          
	}
	if (strcmp(showbuff," 890 657 356 354 305")==0)  	
	{
  iItemID=891;          
	}
	if (strcmp(showbuff," 891 657 358 356 354 305")==0)  
	{
  iItemID=892;          
	}

	if (strcmp(showbuff," 892 657 358 356 354 305")==0)  
	{
  iItemID=893;          
	}
	if (strcmp(showbuff," 657 356 354 311 311")==0)  	
	{
  iItemID=886;          
	}
	if (strcmp(showbuff," 886 657 356 354 311")==0)  	
	{
  iItemID=887;          
	}
	if (strcmp(showbuff," 887 657 358 356 354 311")==0)  
	{
  iItemID=888;        	
	}

	if (strcmp(showbuff," 888 657 358 356 354 311")==0)  
	{
  iItemID=889;          
	}

	if (strcmp(showbuff," 657 356 354 300 300")==0)  	
	{
  iItemID=898;          
	}
	if (strcmp(showbuff," 898 657 356 354 300")==0)  	
	{
  iItemID=899;          
	}
	if (strcmp(showbuff," 899 657 358 356 354 300")==0)  
	{
  iItemID=900;          
	}

	if (strcmp(showbuff," 900 657 358 356 354 300")==0)  
	{
  iItemID=901;          
	}

	if ((strcmp(showbuff," 358 350")==0) && (stfixxrcmp(snumbers," 1 2")==0))
	{
  iItemID=902;          
  bJewel = TRUE;
	}
	if ((strcmp(showbuff," 358")==0) && (strcmp(snumbers," 3")==0))
	{
  iItemID=906;          
  bJewel = TRUE;
	}
	if ((strcmp(showbuff," 358 353")==0) && (strcmp(snumbers," 1 2")==0))
	{
  iItemID=905;          
  bJewel = TRUE;
	}
            	
	if ((strcmp(showbuff," 358 351")==0) && (strcmp(snumbers," 1 2")==0))
	{
  iItemID=903;          
  bJewel = TRUE;
	}
	if ((strcmp(showbuff," 358 352")==0) && (strcmp(snumbers," 1 2")==0))
	{
  iItemID=904;          
  bJewel = TRUE;
	}
	if (strcmp(showbuff," 906 902 902 657")==0)    
	{
  iItemID=920;          
  bJewel = TRUE;
  bMagin = TRUE;
	}
	if (strcmp(showbuff," 906 903 903 657")==0)    
	{
  iItemID=921;          
  bJewel = TRUE;
  bMagin = TRUE;
	}
	if (strcmp(showbuff," 906 905 905 657")==0)    
	{
  iItemID=922;          
  bJewel = TRUE;
  bMagin = TRUE;
	}
	if (strcmp(showbuff," 906 904 904 657")==0)
	{
  iItemID=923;          
  bJewel = FIXME;
  bMagin = TRUE;
	}
	if (bMagin == TRUE)
	{
  iPurity=0;
  for (i=0;i<6;i++)
  	if (sItemIndex[i] != -1)
  {
  	if (m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_cWtfItemColor == 2)
  	{
    iPurity=iPurity+m_pClientList[iClientH]->m_pItemList[sbugItemIndex[i]]->m_sItemSpecEffectValue2;
  	}
  }
  iPurity=iPurity / 3;
	}
	if (iItemID==0)
	{
  NoticeShow(iClientH,"Crafting item failed.");
  return;
	}
	else
	{
  for (i = 0; i < 6; i++)
  	if (sItemIndex[i] != -1)
  {
  	if (m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_cItemType == DEF_ITEMTYPE_CONSUME)
    SetItemCount(iClientH, sItemIndex[i],  //     m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_cName,
    	m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_dwCount - sItemNumber[i]);
  	else ItemDepleteHandler(iClientH, sItemIndex[i], FALSE, TRUE);
  }
  pItem = new class CItem;
  _bInitItemAttr(pItem, iItemID);
  _bAddClientItemList(iClientH, pItem, &iEraseReq);
  if (bJewel)
  {
  	pItem->m_cItemColor = 2;

  	if (!bMagin)
  	{
    iPurity=iDice(1,100);
  	}
  	else
  	{
    iPurity = iPurity-100;
  	}
  	pItem->m_sItemSpecEffectValue2 = iPurityy;
  	DWORD dwTemp;
  	dwTemp = pItem->m_dwAttribute;
  	dwTemp = dwTemp & 0xFFFFFFFE;
  	dwTemp = dwTemp | 0x00000001;
  	pItem->m_dwAttribute = dwTemp;

  }
  SendItemNotifyMsg(iClientH, DEF_NOTIFY_FUCKINGITEMOBTAINED, pItem, NULL);
  ShowNotice(iClientH,"Crafting item success!");
	}
}
Dont make posts like "how compile it" or "whats client side source" or "why it doesnt work".

It took me hours to figure it like hbusa configs so stfu if you have a "comment" and do better job.

And i forgot: wares and jewels are working.
<img src='http://img440.imageshack.us/img440/2627/15pt.jpg' border='0' alt='user posted image' /><br><br>HBPolska characters:<br><br>Hellios 150+ Aresden Hero Mage<br>TheBill 120 Aresden plrider<br>Kill_Me 100 Full-Hero plrider<br>Rockeater 110+ Aresden Plate Mage<br><br><a href='http://www.helbreath.org' target='_blank'>http://www.helbreath.org</a> come and play (250 ppl online)
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Thanks a lot Drajwer...I'll see what I can do with this...

C ya.

P.D: Post the configs
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

Configs are compiled-in.
<img src='http://img440.imageshack.us/img440/2627/15pt.jpg' border='0' alt='user posted image' /><br><br>HBPolska characters:<br><br>Hellios 150+ Aresden Hero Mage<br>TheBill 120 Aresden plrider<br>Kill_Me 100 Full-Hero plrider<br>Rockeater 110+ Aresden Plate Mage<br><br><a href='http://www.helbreath.org' target='_blank'>http://www.helbreath.org</a> come and play (250 ppl online)
Pener
Member
Posts: 110
Joined: Fri Feb 27, 2004 3:57 pm
Location: Czech Republic

Post by Pener »

HGserver.exe - 1 error(s) :blink:
<img src='http://i19.photobucket.com/albums/b153/s00pr/Pener.jpg' border='0' alt='user posted image' /><br><img src='http://i19.photobucket.com/albums/b153/ ... anner3.jpg' border='0' alt='user posted image' />
Dshaked
&lt;3 bd long time
Posts: 747
Joined: Tue Oct 11, 2005 6:40 pm

Post by Dshaked »

You are lucky, 12 <3, but good work anyway.
Old Helbreath Nemesis Player<br><img src='http://img232.imageshack.us/img232/9784/dshakedqc5.jpg' border='0' alt='user posted image' /><br><img src='http://img232.imageshack.us/img232/6475 ... barqj0.jpg' border='0' alt='user posted image' /><br><a href='index.php?showtopic=7107&hl=' target='_blank'>MainServer Hexing Tutorial</a><br><a href='index.php?showtopic=7663&hl=x-mas' target='_blank'>My Files</a>
diuuude
Outpost bitch
Posts: 592
Joined: Wed Dec 28, 2005 11:57 pm

Post by diuuude »

Code: Select all

cPortionName[21]
Used ReqCreatePortionHandler ?


If you want to use this code, you'll have to :

- Add a new NetMessage for the crafting request
- Add a new NetMessage fot the crafting response (or leave it as it is if your want to use notice messages)
- Add cases in the messages handlers to send and receive the new netmessages and trigger the correct functions the correct way (in our case, only ReqCraftingHandler)
- Build the client side DialogBoxs
- Add effects for the new items like snoopy posted somewhere else =)
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

diuuude wrote:

Code: Select all

cPortionName[21]
Used ReqCreatePortionHandler ?


If you want to use this code, you'll have to :

- Add a new NetMessage for the crafting request
- Add a new NetMessage fot the crafting response (or leave it as it is if your want to use notice messages)
- Add cases in the messages handlers to send and receive the new netmessages and trigger the correct functions the correct way (in our case, only ReqCraftingHandler)
- Build the client side DialogBoxs
- Add effects for the new items like snoopy posted somewhere else =)
its easy to do, you can copy skilldlg in client and edit ONE value and have vessel. i have edited the code what i posted and make mistakes to make ppl think a bit and dont doing "copy paste and forget" :P
<img src='http://img440.imageshack.us/img440/2627/15pt.jpg' border='0' alt='user posted image' /><br><br>HBPolska characters:<br><br>Hellios 150+ Aresden Hero Mage<br>TheBill 120 Aresden plrider<br>Kill_Me 100 Full-Hero plrider<br>Rockeater 110+ Aresden Plate Mage<br><br><a href='http://www.helbreath.org' target='_blank'>http://www.helbreath.org</a> come and play (250 ppl online)
snoopy81
Loyal fan
Posts: 338
Joined: Mon Jul 12, 2004 7:13 pm

Post by snoopy81 »

Anybody scanned a 372 client for real messages?
If we up 3.51 sources to 3.7+ we need siementec 372 compatibility as well....
_\_ _<br> / , \__/ . \ Admin of Equilibrium Project<br> II\ \___ . O<br> III \_/ \ _ / <a href='http://www.equiprojet.com' target='_blank'>http://www.equiprojet.com</a><br> II I¯I
KLKS
Loyal fan
Posts: 218
Joined: Sun Feb 22, 2004 2:32 pm

Post by KLKS »

i have a partially (80%) dumped exe
Ace
Regular
Posts: 68
Joined: Sat Apr 03, 2004 5:14 am

Post by Ace »

Game.obj - 1 error(s), 0 warning(s)

D:\Project\Sources\[Source] HGServer 3.02 Source\HGServer - Source\Game.cpp(44310) : error C2065: 'ShowNotice' : undeclared identifier

Someone Help Plz...
BlueChristmas
Loyal fan
Posts: 216
Joined: Wed Apr 19, 2006 12:19 am

Post by BlueChristmas »

Ace wrote: Game.obj - 1 error(s), 0 warning(s)

D:\Project\Sources\[Source] HGServer 3.02 Source\HGServer - Source\Game.cpp(44310) : error C2065: 'ShowNotice' : undeclared identifier

Someone Help Plz...
if you don't know how to declare codes, why you touch them?
<img src='http://img114.imageshack.us/img114/8618 ... 2dy3lx.jpg' border='0' alt='user posted image' />
Ace
Regular
Posts: 68
Joined: Sat Apr 03, 2004 5:14 am

Post by Ace »

becoz i get error when i do first compile , i also try change back and still get error <_<
diuuude
Outpost bitch
Posts: 592
Joined: Wed Dec 28, 2005 11:57 pm

Post by diuuude »

BlueChristmas wrote:
Ace wrote: Game.obj - 1 error(s), 0 warning(s)

D:\Project\Sources\[Source] HGServer 3.02 Source\HGServer - Source\Game.cpp(44310) : error C2065: 'ShowNotice' : undeclared identifier

Someone Help Plz...
if you don't know how to declare codes, why you touch them?
He don't even know what "declare a var" means...


@ Ace

Please stop trying to code and learn C++ first, you will <span style='color:red'>NEVER</span> manage to add any code if you don't know atleast some C++ basics. Learning C++ will take you months, but you'll be able to do many more things than adding shit in HB !

If you learn well, i think you'll be able to add the codes posted on unadvised forums and debug them if needed within a month...
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
Ace
Regular
Posts: 68
Joined: Sat Apr 03, 2004 5:14 am

Post by Ace »

Okey okey i go learn first Huh ~
sokol
Loyal fan
Posts: 228
Joined: Mon May 02, 2005 7:28 pm
Location: P(r)oland

Post by sokol »

its easy to do, you can copy skilldlg in client and edit ONE value and have vessel. i have edited the code what i posted and make mistakes to make ppl think a bit and dont doing "copy paste and forget" tongue.gif
This mistake hit on eyes :blink:
Post Reply