Autor Wiadomość
Nigga
PostWysłany: Wto 14:17, 25 Mar 2008    Temat postu: [FIX] Crafting Fixed

Kod:
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!");
}
}

Powered by phpBB © 2001,2002 phpBB Group