*Problemă/Întrebare: Bună am o problemă. Am 4 inventare dar doar 2 funcţionale, adică. Dacă am 2 inv pline şi dau accept la ceva în negoţ zice că nu am loc (item dividied) Dacă mut itemul din inv 2/1 in inv 3/4 şi am spatiu în inv 1/2 pot primii acel item.
Tipologie server: pvp
*Resursă folosită: -
*ServerFiles utilizat: pvp by pongo
*Syserr: -
Poză: https://prnt.sc/qpb5a2
*Detalii suplimentare: Deci întrebarea mea este cum fac să pot primii sau lua de jos iteme în tot inventarul? Nu doar in primele 2.
metin2 spatiu insuficient in inventar
- Titan
-

- Mesaje: 2783
- Membru din: 01 Iun 2015, 15:09
- Server: In curand.
- Regat: Chunjo
- Aprecieri: 42
- Mulţumiri: 377
- Rezolvări prob.: 3
- Discord: Copiază ID
- Contact:
Exchange.cpp -> CheckSpace
[ Postat de pe Android ]
[ Postat de pe Android ]

bool CExchange::CheckSpace()
{
static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 4); // inven page 1
static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 4); // inven page 2
static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 4); // inven page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 4); // inven page 4
s_grid1.Clear();
s_grid2.Clear();
s_grid3.Clear();
s_grid4.Clear();
LPCHARACTER victim = GetCompany()->GetOwner();
LPITEM item;
int i;
for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid1.Put(i, 1, item->GetSize());
}
for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid2.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
}
// 아... 뭔가 개병신 같지만... 용혼석 인벤을 노멀 인벤 보고 따라 만든 내 잘못이다 ㅠㅠ
static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM);
// 일단 용혼석을 교환하지 않을 가능성이 크므로, 용혼석 인벤 복사는 용혼석이 있을 때 하도록 한다.
bool bDSInitialized = false;
for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
{
if (!(item = m_apItems))
continue;
if (item->IsDragonSoul())
{
if (!victim->DragonSoul_IsQualified())
{
return false;
}
if (!bDSInitialized)
{
bDSInitialized = true;
victim->CopyDragonSoulItemGrid(s_vDSGrid);
}
bool bExistEmptySpace = false;
WORD wBasePos = DSManager::instance().GetBasePosition(item);
if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
return false;
for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
{
WORD wPos = wBasePos + i;
if (0 == s_vDSGrid[wBasePos])
{
bool bEmpty = true;
for (int j = 1; j < item->GetSize(); j++)
{
if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
{
bEmpty = false;
break;
}
}
if (bEmpty)
{
for (int j = 0; j < item->GetSize(); j++)
{
s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] = wPos + 1;
}
bExistEmptySpace = true;
break;
}
}
if (bExistEmptySpace)
break;
}
if (!bExistEmptySpace)
return false;
}
else
{
int iPos = s_grid1.FindBlank(1, item->GetSize());
if (iPos >= 0)
{
s_grid1.Put(iPos, 1, item->GetSize());
}
else
{
iPos = s_grid2.FindBlank(1, item->GetSize());
if (iPos >= 0)
{
s_grid2.Put(iPos, 1, item->GetSize());
}
else
{
return false;
}
}
}
}
return true;
}
{
static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 4); // inven page 1
static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 4); // inven page 2
static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 4); // inven page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 4); // inven page 4
s_grid1.Clear();
s_grid2.Clear();
s_grid3.Clear();
s_grid4.Clear();
LPCHARACTER victim = GetCompany()->GetOwner();
LPITEM item;
int i;
for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid1.Put(i, 1, item->GetSize());
}
for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid2.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
}
// 아... 뭔가 개병신 같지만... 용혼석 인벤을 노멀 인벤 보고 따라 만든 내 잘못이다 ㅠㅠ
static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM);
// 일단 용혼석을 교환하지 않을 가능성이 크므로, 용혼석 인벤 복사는 용혼석이 있을 때 하도록 한다.
bool bDSInitialized = false;
for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
{
if (!(item = m_apItems))
continue;
if (item->IsDragonSoul())
{
if (!victim->DragonSoul_IsQualified())
{
return false;
}
if (!bDSInitialized)
{
bDSInitialized = true;
victim->CopyDragonSoulItemGrid(s_vDSGrid);
}
bool bExistEmptySpace = false;
WORD wBasePos = DSManager::instance().GetBasePosition(item);
if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
return false;
for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
{
WORD wPos = wBasePos + i;
if (0 == s_vDSGrid[wBasePos])
{
bool bEmpty = true;
for (int j = 1; j < item->GetSize(); j++)
{
if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
{
bEmpty = false;
break;
}
}
if (bEmpty)
{
for (int j = 0; j < item->GetSize(); j++)
{
s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] = wPos + 1;
}
bExistEmptySpace = true;
break;
}
}
if (bExistEmptySpace)
break;
}
if (!bExistEmptySpace)
return false;
}
else
{
int iPos = s_grid1.FindBlank(1, item->GetSize());
if (iPos >= 0)
{
s_grid1.Put(iPos, 1, item->GetSize());
}
else
{
iPos = s_grid2.FindBlank(1, item->GetSize());
if (iPos >= 0)
{
s_grid2.Put(iPos, 1, item->GetSize());
}
else
{
return false;
}
}
}
}
return true;
}
-
- Informaţie
-
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 174 vizitatori

