comparison UI/UIShops.cpp @ 2252:cd80d91b780f

Слияние
author Ritor1
date Wed, 26 Feb 2014 20:10:50 +0600
parents 3cc3a29f073b
children aff7a7b072b7
comparison
equal deleted inserted replaced
2251:47bcb700b74b 2252:cd80d91b780f
1538 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); 1538 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
1539 if ( pMouse->GetCursorPos(&cursor)->x <= 13 1539 if ( pMouse->GetCursorPos(&cursor)->x <= 13
1540 || pMouse->GetCursorPos(&cursor)->x >= 462 1540 || pMouse->GetCursorPos(&cursor)->x >= 462
1541 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) 1541 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) )
1542 return; 1542 return;
1543 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) 1543 if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) )
1544 { 1544 {
1545 dword_F8B1E4 = 1; 1545 dword_F8B1E4 = 1;
1546 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); 1546 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C);
1547 viewparams->bRedrawGameUI = 1; 1547 viewparams->bRedrawGameUI = 1;
1548 pRenderer->ClearZBuffer(0, 479); 1548 pRenderer->ClearZBuffer(0, 479);
1564 { 1564 {
1565 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); 1565 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1566 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; 1566 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1567 if ( !(item->uAttributes & ITEM_IDENTIFIED) ) 1567 if ( !(item->uAttributes & ITEM_IDENTIFIED) )
1568 { 1568 {
1569 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) 1569 if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) )
1570 { 1570 {
1571 if ( pParty->uNumGold >= uPriceItemService ) 1571 if ( pParty->uNumGold >= uPriceItemService )
1572 { 1572 {
1573 dword_F8B1E4 = 1; 1573 dword_F8B1E4 = 1;
1574 Party::TakeGold(uPriceItemService); 1574 Party::TakeGold(uPriceItemService);
1604 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 1604 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1605 ItemGen* _v = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; 1605 ItemGen* _v = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1606 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); 1606 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier);
1607 if ( item->uAttributes & ITEM_BROKEN ) 1607 if ( item->uAttributes & ITEM_BROKEN )
1608 { 1608 {
1609 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) 1609 if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) )
1610 { 1610 {
1611 if ( pParty->uNumGold >= uPriceItemService ) 1611 if ( pParty->uNumGold >= uPriceItemService )
1612 { 1612 {
1613 dword_F8B1E4 = 1; 1613 dword_F8B1E4 = 1;
1614 Party::TakeGold(uPriceItemService); 1614 Party::TakeGold(uPriceItemService);
1648 uNumSeconds = 0; 1648 uNumSeconds = 0;
1649 a3 = 0; 1649 a3 = 0;
1650 if ( pMapStats->GetMapInfo(pCurrentMapName) ) 1650 if ( pMapStats->GetMapInfo(pCurrentMapName) )
1651 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; 1651 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
1652 party_reputation = pParty->GetPartyReputation(); 1652 party_reputation = pParty->GetPartyReputation();
1653 if (pPlayers[uActiveCharacter]->CanSteal()) 1653 if (pPlayers[uActiveCharacter]->CanSteal() && GetAsyncKeyState(VK_CONTROL))
1654 { 1654 {
1655 if ( GetAsyncKeyState(VK_CONTROL) )
1656 {
1657 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); 1655 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6);
1658 if ( !uNumSeconds ) 1656 if ( !uNumSeconds )
1659 { 1657 {
1660 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); 1658 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
1661 return; 1659 return;
1662 } 1660 }
1663 } 1661 }
1664 } 1662 else if (pParty->uNumGold < uPriceItemService)
1665 if ( pParty->uNumGold < uPriceItemService ) 1663 {
1666 { 1664 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1667 if ( uNumSeconds != 2 ) 1665 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
1668 { 1666 return;
1669 if ( uNumSeconds != 1 )
1670 {
1671 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1672 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
1673 return;
1674 }
1675 }
1676 } 1667 }
1677 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); 1668 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
1678 if ( v39 ) 1669 if ( v39 )
1679 { 1670 {
1680 bought_item->SetIdentified(); 1671 bought_item->SetIdentified();
1681 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); 1672 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen));
1682 if ( pPlayers[uActiveCharacter]->CanSteal() ) 1673 if (uNumSeconds != 0)
1683 { 1674 {
1684 if ( GetAsyncKeyState(VK_CONTROL) ) 1675 pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen();
1685 { 1676 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6);
1686 if ( uNumSeconds == 1 || uNumSeconds == 2 ) 1677 }
1687 { 1678 else
1688 pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); 1679 {
1689 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); 1680 dword_F8B1E4 = 1;
1690 viewparams->bRedrawGameUI = 1; 1681 Party::TakeGold(uPriceItemService);
1691 bought_item->Reset(); 1682 }
1692 pRenderer->ClearZBuffer(0, 479);
1693 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
1694 return;
1695 }
1696 }
1697 }
1698 dword_F8B1E4 = 1;
1699 Party::TakeGold(uPriceItemService);
1700 viewparams->bRedrawGameUI = 1; 1683 viewparams->bRedrawGameUI = 1;
1701 bought_item->Reset(); 1684 bought_item->Reset();
1702 pRenderer->ClearZBuffer(0, 479); 1685 pRenderer->ClearZBuffer(0, 479);
1703 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); 1686 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
1704 return; 1687 return;
1705 } 1688 }
1706 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); 1689 else
1707 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" 1690 {
1691 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
1692 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!"
1693 return;
1694 }
1708 break; 1695 break;
1709 } 1696 }
1710 default:// if click video screen in shop 1697 default:// if click video screen in shop
1711 { 1698 {
1712 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum 1699 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum