Skip to content

Commit

Permalink
Merge pull request #134 from AudriusButkevicius/small-rename
Browse files Browse the repository at this point in the history
Rename D2GAME_PLRTRADE_IsInteractingWithPlayer
  • Loading branch information
Lectem authored Dec 28, 2023
2 parents f504eb7 + c3c74bf commit 5648745
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion source/D2Game/include/PLAYER/PlrTrade.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ int32_t __fastcall sub_6FC93430(D2GameStrc* pGame, D2UnitStrc* pPlayer, D2UnitSt
//D2Game.0x6FC93740
int32_t __fastcall sub_6FC93740(D2GameStrc* pGame, D2UnitStrc* pUnit);
//D2Game.0x6FC937A0
int32_t __fastcall sub_6FC937A0(D2GameStrc* pGame, D2UnitStrc* pUnit);
int32_t __fastcall D2GAME_PLRTRADE_IsInteractingWithPlayer(D2GameStrc* pGame, D2UnitStrc* pUnit);
//D2Game.0x6FC937F0
void __fastcall D2GAME_PLRTRADE_Last_6FC937F0(D2GameStrc* pGame, D2UnitStrc* pPlayer, int32_t a3, int32_t a4);
7 changes: 4 additions & 3 deletions source/D2Game/src/ITEMS/ItemMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3808,7 +3808,8 @@ int32_t __fastcall sub_6FC47D30(D2GameStrc* pGame, D2UnitStrc* pUnit, int32_t nI

if (pItem->dwAnimMode == IMODE_STORED && ITEMS_CheckIfUseable(pItem))
{
if ((ITEMS_GetItemType(pItem) != ITEMTYPE_BOOK || STATLIST_UnitGetStatValue(pItem, STAT_QUANTITY, 0) > 0) && !sub_6FC937A0(pGame, pUnit))
if ((ITEMS_GetItemType(pItem) != ITEMTYPE_BOOK || STATLIST_UnitGetStatValue(pItem, STAT_QUANTITY, 0) > 0) && !D2GAME_PLRTRADE_IsInteractingWithPlayer(
pGame, pUnit))
{
if (SKILLITEM_pSpell_Handler(pGame, pUnit, pItem, pItem, nX, nY))
{
Expand Down Expand Up @@ -4470,7 +4471,7 @@ int32_t __fastcall sub_6FC49220(D2GameStrc* pGame, D2UnitStrc* pUnit, int32_t nI
return 0;
}

if (sub_6FC937A0(pGame, pUnit))
if (D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
return 0;
}
Expand Down Expand Up @@ -4839,7 +4840,7 @@ int32_t __fastcall sub_6FC49DC0(D2GameStrc* pGame, D2UnitStrc* pUnit, int32_t nI
return 0;
}

if (sub_6FC937A0(pGame, pUnit) && ITEMS_GetInvPage(pCube))
if (D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit) && ITEMS_GetInvPage(pCube))
{
SUNIT_AttachSound(pUnit, 0x13u, pUnit);
return 0;
Expand Down
13 changes: 7 additions & 6 deletions source/D2Game/src/PLAYER/PlrMsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ int32_t __fastcall sub_6FC828D0(D2UnitStrc* pPlayer, int32_t nUnitType, int32_t

if (nDistance <= 8)
{
if (pUnit->dwAnimMode != PLRMODE_DEAD || sub_6FC937A0(pGame, pPlayer) || sub_6FC937A0(pGame, pUnit))
if (pUnit->dwAnimMode != PLRMODE_DEAD || D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pPlayer) ||
D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
PLRTRADE_TryToTrade(pGame, pPlayer, pUnit);
}
Expand Down Expand Up @@ -1857,7 +1858,7 @@ int32_t __fastcall D2GAME_PACKETCALLBACK_Rcv0x17_DropItemOnGround_6FC84E20(D2Gam
D2UnitStrc* pItem = SUNIT_GetServerUnit(pGame, UNIT_ITEM, nItemGUID);
if (pItem && pItem->dwAnimMode == IMODE_ONCURSOR && INVENTORY_GetCursorItem(pUnit->pInventory) == pItem)
{
if (PLAYER_IsBusy(pUnit) && sub_6FC937A0(pGame, pUnit))
if (PLAYER_IsBusy(pUnit) && D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
return 3;
}
Expand Down Expand Up @@ -1915,7 +1916,7 @@ int32_t __fastcall D2GAME_PACKETCALLBACK_Rcv0x18_InsertItemInBuffer_6FC84ED0(D2G
{
if (nInvPage == 2)
{
if (!sub_6FC937A0(pGame, pUnit))
if (!D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
return 3;
}
Expand Down Expand Up @@ -3222,7 +3223,7 @@ int32_t __fastcall D2GAME_PACKETCALLBACK_Rcv0x44_StaffInOrifice_6FC87780(D2GameS
return 3;
}

if (PLAYER_IsBusy(pUnit) && sub_6FC937A0(pGame, pUnit))
if (PLAYER_IsBusy(pUnit) && D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
return 3;
}
Expand Down Expand Up @@ -3569,7 +3570,7 @@ int32_t __fastcall D2GAME_PACKETCALLBACK_Rcv0x50_DropGold_6FC88210(D2GameStrc* p
const int32_t nUnitGUID = *(int32_t*)((char*)pPacket + 1);
const int32_t nGoldValue = *(int32_t*)((char*)pPacket + 5);

if (!PLAYER_IsBusy(pUnit) || !sub_6FC937A0(pGame, pUnit))
if (!PLAYER_IsBusy(pUnit) || !D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
if (sub_6FC7C260(pGame, pUnit, nUnitGUID, nGoldValue))
{
Expand Down Expand Up @@ -3874,7 +3875,7 @@ int32_t __fastcall D2GAME_PACKETCALLBACK_Rcv0x61_DropPickupMercItem_6FC88930(D2G

const int16_t nBodyLoc = *(int16_t*)((char*)pPacket + 1);

if (PLAYER_IsBusy(pUnit) && sub_6FC937A0(pGame, pUnit))
if (PLAYER_IsBusy(pUnit) && D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
FOG_Trace("Player %s should be banned\n", UNITS_GetPlayerData(pUnit)->szName);
return 3;
Expand Down
2 changes: 1 addition & 1 deletion source/D2Game/src/PLAYER/PlrTrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,7 @@ int32_t __fastcall sub_6FC93740(D2GameStrc* pGame, D2UnitStrc* pUnit)
}

//D2Game.0x6FC937A0
int32_t __fastcall sub_6FC937A0(D2GameStrc* pGame, D2UnitStrc* pUnit)
int32_t __fastcall D2GAME_PLRTRADE_IsInteractingWithPlayer(D2GameStrc* pGame, D2UnitStrc* pUnit)
{
int32_t nUnitType = 0;
int32_t nUnitGUID = 0;
Expand Down
2 changes: 1 addition & 1 deletion source/D2Game/src/QUESTS/ACT2/A2Q6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ void __fastcall ACT2Q6_UnitIterate_DeleteHoradricItems(D2GameStrc* pGame, D2Unit

QUESTRECORD_SetQuestState(pQuestFlags, QUESTSTATEFLAG_A2Q2, QFLAG_REWARDGRANTED);
QUESTRECORD_SetQuestState(pQuestFlags, QUESTSTATEFLAG_A2Q2, QFLAG_PRIMARYGOALDONE);
if (sub_6FC937A0(pGame, pUnit))
if (D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion source/D2Game/src/QUESTS/ACT3/A3Q5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void __fastcall ACT3Q5_UnitIterate_DeleteKhalimItems(D2GameStrc* pGame, D2UnitSt
QUESTRECORD_SetQuestState(pQuestFlags, QUESTSTATEFLAG_A3Q2, QFLAG_REWARDGRANTED);
QUESTRECORD_SetQuestState(pQuestFlags, QUESTSTATEFLAG_A3Q2, QFLAG_PRIMARYGOALDONE);

if (!sub_6FC937A0(pGame, pUnit))
if (!D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit))
{
QUESTS_DeleteItem(pGame, pUnit, ' yeq');
QUESTS_DeleteItem(pGame, pUnit, ' rhq');
Expand Down
2 changes: 1 addition & 1 deletion source/D2Game/src/SKILLS/SkillItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int32_t __fastcall SKILLITEM_pSpell01_Initializer(D2GameStrc* pGame, D2UnitStrc*
//D2Game.0x6FD02BF0
int32_t __fastcall SKILLITEM_pSpell01_IdentifyItem(D2GameStrc* pGame, D2UnitStrc* pUnit, D2UnitStrc* pItem, D2UnitStrc* pTarget, int32_t nX, int32_t nY, int32_t nSkillId)
{
if (!sub_6FC937A0(pGame, pUnit) && !ITEMS_CheckItemFlag(pTarget, IFLAG_IDENTIFIED, __LINE__, __FILE__) && pUnit->pInventory)
if (!D2GAME_PLRTRADE_IsInteractingWithPlayer(pGame, pUnit) && !ITEMS_CheckItemFlag(pTarget, IFLAG_IDENTIFIED, __LINE__, __FILE__) && pUnit->pInventory)
{
for (D2UnitStrc* pInvItem = INVENTORY_GetFirstItem(pUnit->pInventory); pInvItem; pInvItem = INVENTORY_GetNextItem(pInvItem))
{
Expand Down

0 comments on commit 5648745

Please sign in to comment.