daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void CDbManager::UpdateOfflineVendor(CQuery* pQuery, LPDB_OVERLAPPED_PLUS lpDbOverlappedPlus)
  2. {
  3.     CAr ar(lpDbOverlappedPlus->lpBuf, lpDbOverlappedPlus->uBufSize);
  4.  
  5.     DWORD dwVendorId, dwPlayerId, dwSkinSet, dwFace, dwHairMesh, dwHairColor, dwHeadMesh;
  6.     FLOAT dwAngle, dwHairColorR, dwHairColorG, dwHairColorB;
  7.     BYTE dwSex;
  8.     D3DXVECTOR3 dwPosition;
  9.     TCHAR dwStrTitle[MAX_VENDORNAME];
  10.     TCHAR dwVendorPlayerName[64]; //MAX_NAME
  11.  
  12.     //basic data
  13.     ar >> dwVendorId;
  14.     ar >> dwPlayerId;
  15.     ar.ReadString(dwStrTitle);
  16.     ar.ReadString(dwVendorPlayerName);
  17.  
  18.     //mover data
  19.     ar >> dwSex >> dwPosition >> dwAngle >> dwFace >> dwSkinSet >> dwHeadMesh >> dwHairMesh >> dwHairColor >> dwHairColorB >> dwHairColorR >> dwHairColorG;
  20.  
  21.     int inventoryItemCount = 0;
  22.     ar >> inventoryItemCount;
  23.     inventoryItemCount = min(inventoryItemCount, MAX_VENDITEM); //safety
  24.     CItemElem* inventoryItems = new CItemElem[inventoryItemCount];
  25.  
  26.     for (int i = 0; i < inventoryItemCount; i++)
  27.     {
  28.         CItemElem item = CItemElem();
  29.         item.Serialize(ar);
  30.         inventoryItems[i] = item;
  31.     }
  32.  
  33.     //clothing
  34.     DWORD clothingCount = 0;
  35.     ar >> clothingCount;
  36.     clothingCount = min(clothingCount, MAX_HUMAN_PARTS); //safety
  37.  
  38.     char dwEquipment[1024] = { 0, };
  39.     *dwEquipment = '\0';
  40.  
  41.     if (clothingCount > 0)
  42.     {
  43.         DWORD* itemIds = new DWORD[clothingCount];
  44.         for (unsigned char index = 0; index < clothingCount; index++)
  45.         {
  46.             DWORD itemID;
  47.             ar >> itemID;
  48.             itemIds[index] = itemID;
  49.         }
  50.         /*for (int nIndex = 0; nIndex < MAX_HUMAN_PARTS; nIndex++)
  51.         {
  52.             char s[32] = { 0, };
  53.             sprintf(s, "%d/", itemIds[nIndex]);
  54.             strcat(dwEquipment, s);
  55.         }*/
  56.         char OneEquipment[16] = { 0, };
  57.         for (int i = 0; i < MAX_HUMAN_PARTS; i++)
  58.         {
  59.             sprintf(OneEquipment, "%d/", itemIds[i]);
  60.             strncat(dwEquipment, OneEquipment, sizeof(OneEquipment));
  61.         }
  62.         strncat(dwEquipment, NullStr, sizeof(NullStr));
  63.     }
  64.  
  65.     ItemStruct  is;
  66.            
  67.     char Onem_apIndex[10] = { 0, };
  68.     char sPerObjIndex[16] = { 0, };
  69.     BOOL bExtInven = FALSE;
  70.     BOOL bPirecingInven = FALSE;
  71.  
  72.     PItemContainerStruct pItemContainerStruct = new ItemContainerStruct();
  73.  
  74.     BOOL    bPet = FALSE;
  75.  
  76.     for (DWORD ch = 0; ch < MAX_VENDITEM; ch++) // 0-504
  77.     {
  78.         SaveOneItem(&inventoryItems[ch], &is);
  79.  
  80.         strncat(pItemContainerStruct->szItem, is.szItem, sizeof(is.szItem));
  81.  
  82.         strncat(pItemContainerStruct->szExt, is.szExt, sizeof(is.szExt));
  83.         strncat(pItemContainerStruct->szPiercing, is.szPiercing, sizeof(is.szPiercing));
  84.         sprintf(Onem_apIndex, "%d/", ch); //slot position ?
  85.         strncat(pItemContainerStruct->szIndex, Onem_apIndex, sizeof(Onem_apIndex));
  86.         sprintf(sPerObjIndex, "%d/", inventoryItems[ch].m_dwObjIndex);
  87.         strcat(pItemContainerStruct->szObjIndex, sPerObjIndex);
  88.         strncat(pItemContainerStruct->szPet, is.szPet, sizeof(is.szPet));
  89.  
  90.         if (inventoryItems[ch].m_bCharged || 0 <inventoryItems[ch].m_dwKeepTime || 0 != inventoryItems[ch].GetRandomOptItemId())
  91.             bExtInven = TRUE;
  92.         if (inventoryItems[ch].IsPiercedItem())
  93.             bPirecingInven = TRUE;
  94.         if (inventoryItems[ch].m_pPet)
  95.             bPet = TRUE;
  96.     }
  97.  
  98.     strncat(pItemContainerStruct->szItem, NullStr, sizeof(NullStr));
  99.  
  100.     strncat(pItemContainerStruct->szIndex, NullStr, sizeof(NullStr));
  101.     strcat(pItemContainerStruct->szObjIndex, NullStr);
  102.     if (bExtInven == FALSE)
  103.         *pItemContainerStruct->szExt = '\0';
  104.     if (bPirecingInven == FALSE)
  105.         *pItemContainerStruct->szPiercing = '\0';
  106.     if (bPet == FALSE)
  107.         *pItemContainerStruct->szPet = '\0';
  108.     strcat(pItemContainerStruct->szExt, NullStr);
  109.     strcat(pItemContainerStruct->szPiercing, NullStr);
  110.     strcat(pItemContainerStruct->szPet, NullStr);
  111.  
  112.    
  113.     //check if a vendor exists for the player
  114.     char szSQL[8196] = { 0, };
  115.     sprintf(szSQL, "[SYSTEM_DBF].[dbo].[OFFLINE_VENDOR_STR] @iGu='G1', @im_dwPlayerOwnerId=%lu,@im_dwVendorId=%lu",dwPlayerId,dwVendorId);
  116.  
  117.     if (pQuery->Exec(szSQL) == FALSE)
  118.     {
  119.         WriteLog("%s, %d\t%s", __FILE__, __LINE__, szSQL);
  120.         return;
  121.     }
  122.     if (pQuery->Fetch()) {
  123.         OutputDebugString("Has Entry For Player!");
  124.     }
  125.     else
  126.     {
  127.         OutputDebugString("Has No Entry For Player!");
  128.         sprintf(szSQL, "[SYSTEM_DBF].[dbo].[OFFLINE_VENDOR_STR] @iGu='C1', @im_dwPlayerOwnerId=%lu, @im_dwShopName='%s', @im_dwPlayerName='%s', @im_dwSex=%i, @im_dwPosX=%f, @im_dwPosY=%f, @im_dwPosZ=%f, @im_dwAngle=%f, @im_dwInventory='%s', @im_dwApIndex='%s', @im_dwObjIndex='%s', @im_dwFace=%i, @im_dwSkinSet=%i, @im_dwHeadMesh=%i, @im_dwHairMesh=%i, @im_dwHairColor=%lu, @im_dwHairColorB=%lu,@im_dwHairColorR=%lu,@im_dwHairColorG=%lu,@im_dwEquipInfo='%s'", dwPlayerId, dwStrTitle, dwVendorPlayerName, dwSex, dwPosition.x, dwPosition.y, dwPosition.z, dwAngle, pItemContainerStruct->szItem, pItemContainerStruct->szIndex, pItemContainerStruct, pItemContainerStruct->szObjIndex, dwFace, dwSkinSet, dwHeadMesh, dwHairMesh, dwHairColor, dwHairColorB, dwHairColorR, dwHairColorG, dwEquipment);
  129.         if (pQuery->Exec(szSQL) == FALSE)
  130.         {
  131.             WriteLog("%s, %d\t%s", __FILE__, __LINE__, szSQL);
  132.             return;
  133.         }
  134.         if (pQuery->Fetch()) {
  135.             OutputDebugString("Has Entry For Player!");
  136.         }
  137.     }
  138.  
  139.     //BEFORESENDDUAL(ar, PACKETTYPE_SEND_RECORD_BOOK_BACK, DPID_UNKNOWN, DPID_UNKNOWN);
  140.     //ar << createdVendorId
  141.     //SEND(ar, this, DPID_ALLPLAYERS);
  142. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top