- Katılım
- 15 Nis 2016
- Konular
- 115
- Mesajlar
- 4,815
- Çözüm
- 58
- Online süresi
- 8mo 4d
- Reaksiyon Skoru
- 1,107
- Altın Konu
- 3
- Başarım Puanı
- 279
- MmoLira
- 6,261
- DevLira
- 66
HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!
Char_item.cpp açılır ve aratılır
Kod:
LPITEM CHARACTER::GetItem(TItemPos Cell) const
Kod bloğu altına eklenir
Kod:
LPITEM CHARACTER::GetItem_NEW(const TItemPos &Cell) const
{
CItem * cellItem = GetItem(Cell);
if (cellItem)
return cellItem;
//There's no item in this cell, but that does not mean there is not an item which currently uses up this cell.
uint16_t bCell = Cell.cell;
uint8_t bPage = bCell / (4);
for (int j = -5; j < 0; ++j)
{
uint8_t p = bCell + (5 * j);
if (p / (4) != bPage)
continue;
if (p >= INVENTORY_MAX_NUM) // Eeh just for the sake of...
continue;
CItem * curCellItem = GetItem(TItemPos(INVENTORY, p));
if (!curCellItem)
continue;
if (p + (curCellItem->GetSize() - 1) * 5 < Cell.cell) //Doesn't reach Cell.cell
continue;
return curCellItem;
}
return NULL;
}
Aratılır
Kod:
if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
return false;
Değiştirilir
Kod:
if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell)) //It's not empty - Let's try swapping.
{
if (count != 0 && count != item->GetCount()) //Can't swap if not the item as a whole is being moved
return false;
if (!DestCell.IsDefaultInventoryPosition() || !Cell.IsDefaultInventoryPosition()) //Only this kind of swapping on inventory
return false;
CItem * targetItem = GetItem_NEW(DestCell);
if (!targetItem)
return false;
if (targetItem->GetVID() == item->GetVID()) //Can't swap over my own slots
return false;
if (targetItem) {
DestCell = TItemPos(INVENTORY, targetItem->GetCell());
}
if (item->IsExchanging() || (targetItem && targetItem->IsExchanging()))
return false;
if (targetItem->isLocked() == true)
return false;
uint8_t basePage = DestCell.cell / (4);
std::map<uint16_t, CItem *> moveItemMap;
uint8_t sizeLeft = item->GetSize();
for (uint16_t i = 0; i < item->GetSize(); ++i)
{
uint16_t cellNumber = DestCell.cell + i * 5;
uint8_t cPage = cellNumber / (4);
if (basePage != cPage)
return false;
CItem * mvItem = GetItem(TItemPos(INVENTORY, cellNumber));
if (mvItem) {
if (mvItem->GetSize() > item->GetSize())
return false;
if (mvItem->IsExchanging())
return false;
moveItemMap.insert({ Cell.cell + i * 5, mvItem });
sizeLeft -= mvItem->GetSize();
if (mvItem->GetSize() > 1)
i += mvItem->GetSize() - 1; //Skip checking the obviously used cells
}
else {
sizeLeft -= 1; //Empty slot
}
}
if (sizeLeft != 0)
return false;
//This map will hold cell positions for syncing the quickslots afterwards
std::map<uint8_t, uint16_t> syncCells; //Quickslot pos -> Target cell.
//Let's remove the original item
syncCells.insert({ GetQuickslotPosition(QUICKSLOT_TYPE_ITEM, item->GetCell()), DestCell.cell });
item->RemoveFromCharacter();
for (auto & it : moveItemMap)
{
uint16_t toCellNumber = it.first;
CItem * mvItem = it.second;
syncCells.insert({ GetQuickslotPosition(QUICKSLOT_TYPE_ITEM, mvItem->GetCell()), toCellNumber });
mvItem->RemoveFromCharacter();
#ifdef __HIGHLIGHT_SYSTEM__
SetItem(TItemPos(INVENTORY, toCellNumber), mvItem, false);
#else
SetItem(TItemPos(INVENTORY, toCellNumber), mvItem);
#endif
}
#ifdef __HIGHLIGHT_SYSTEM__
SetItem(DestCell, item, false);
#else
SetItem(DestCell, item);
#endif
//Sync quickslots only after all is set
for (auto & sCell : syncCells)
{
TQuickslot qs;
qs.type = QUICKSLOT_TYPE_ITEM;
qs.pos = sCell.second;
SetQuickslot(sCell.first, qs);
}
return true;
}
char.h açılır ve aratılır
Kod:
LPITEM GetItem(TItemPos Cell) const;
Altına eklenir
Kod:
LPITEM GetItem_NEW(const TItemPos &Cell) const;
Aratılır
Kod:
void SyncQuickslot(BYTE bType, BYTE bOldPos, BYTE bNewPos);
altına eklenir
Kod:
int32_t GetQuickslotPosition(uint8_t bType, uint16_t bInventoryPos) const;
char_quickslot.cpp açılır ve aratılır
Kod:
bool CHARACTER::GetQuickslot(BYTE pos, TQuickslot ** ppSlot)
üstüne eklenir
Kod:
int32_t CHARACTER::GetQuickslotPosition(uint8_t bType, uint16_t bInventoryPos) const
{
for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i)
{
if (m_quickslot[i].type == bType && m_quickslot[i].pos == bInventoryPos)
return i;
}
return -1;
}
Son düzenleme:
- Katılım
- 26 Ocak 2019
- Konular
- 1
- Mesajlar
- 56
- Reaksiyon Skoru
- 33
- Altın Konu
- 0
- TM Yaşı
- 7 Yıl 4 Ay 22 Gün
- Başarım Puanı
- 32
- MmoLira
- 98
- DevLira
- 0
Thx xd
- Katılım
- 15 Mar 2016
- Konular
- 108
- Mesajlar
- 2,912
- Çözüm
- 9
- Online süresi
- 6mo 9d
- Reaksiyon Skoru
- 644
- Altın Konu
- 0
- TM Yaşı
- 10 Yıl 3 Ay 5 Gün
- Başarım Puanı
- 244
- Yaş
- 26
- MmoLira
- 9,619
- DevLira
- 21
Sağol 

- Katılım
- 27 Ara 2018
- Konular
- 17
- Mesajlar
- 616
- Çözüm
- 5
- Online süresi
- 1mo 21d
- Reaksiyon Skoru
- 219
- Altın Konu
- 0
- TM Yaşı
- 7 Yıl 5 Ay 23 Gün
- Başarım Puanı
- 136
- Yaş
- 28
- MmoLira
- 6,218
- DevLira
- 3
İteme efsun atinca itemle efsun yer değiştirmesi gibi bir sorun var mi
Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)
Benzer konular
- Cevaplar
- 9
- Görüntüleme
- 499
- Cevaplar
- 9
- Görüntüleme
- 572
- Cevaplar
- 3
- Görüntüleme
- 92
- Cevaplar
- 3
- Görüntüleme
- 163




