- Mesaj
- 309
- Çözümler
- 7
- Beğeni
- 94
- Puan
- 724
- Ticaret Puanı
- 0
Dostlar selamlar.
Ben offline shop ekliyorumda bu Server -> game kısmında
char_item.cpp adlı dosyanın içindeki
birde arkadaş char_item_yap.cpp adı altında bir dosya eklemiş ve içinde şunlar var.
char_item_cpp deki adımları tek tek uygularım fakat char_item_cpp_yap dosyadaki anlatmak istediğini anlayamadım yardımcı olabilcek varmı acaba?
Ben offline shop ekliyorumda bu Server -> game kısmında
char_item.cpp adlı dosyanın içindeki
C++:
//1. Search:
LPITEM CHARACTER::GetInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(INVENTORY, wCell));
}
//1. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
LPITEM CHARACTER::GetUpgradeInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(UPGRADE_INVENTORY, wCell));
}
LPITEM CHARACTER::GetBookInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(BOOK_INVENTORY, wCell));
}
LPITEM CHARACTER::GetStoneInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(STONE_INVENTORY, wCell));
}
#endif
//3. Search: function ( LPITEM CHARACTER::GetItem )
case DRAGON_SOUL_INVENTORY:
if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid DS item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pDSItems[wCell];
//2. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSU item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pSSUItems[wCell];
case BOOK_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSB item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pSSBItems[wCell];
case STONE_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSS item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pSSSItems[wCell];
#endif
//3. Search: function ( void CHARACTER::SetItem )
default:
sys_err ("Invalid Inventory type %d", window_type);
return;
//3. Add before:
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pSSUItems[wCell];
if (pOld)
{
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pSSUItems[p] && m_pointsInstant.pSSUItems[p] != pOld)
continue;
m_pointsInstant.wSSUItemGrid[p] = 0;
}
}
else
m_pointsInstant.wSSUItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid SSU item cell %d", wCell);
return;
}
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
m_pointsInstant.wSSUItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wSSUItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pSSUItems[wCell] = pItem;
}
break;
case BOOK_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pSSBItems[wCell];
if (pOld)
{
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pSSBItems[p] && m_pointsInstant.pSSBItems[p] != pOld)
continue;
m_pointsInstant.wSSBItemGrid[p] = 0;
}
}
else
m_pointsInstant.wSSBItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
return;
}
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
m_pointsInstant.wSSBItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wSSBItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pSSBItems[wCell] = pItem;
}
break;
case STONE_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pSSSItems[wCell];
if (pOld)
{
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pSSSItems[p] && m_pointsInstant.pSSSItems[p] != pOld)
continue;
m_pointsInstant.wSSSItemGrid[p] = 0;
}
}
else
m_pointsInstant.wSSSItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
return;
}
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
m_pointsInstant.wSSSItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wSSSItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pSSSItems[wCell] = pItem;
}
break;
#endif
//4.Search: function ( void CHARACTER::SetItem )
case DRAGON_SOUL_INVENTORY:
pItem->SetWindow(DRAGON_SOUL_INVENTORY);
break;
//4. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
pItem->SetWindow(UPGRADE_INVENTORY);
break;
case BOOK_INVENTORY:
pItem->SetWindow(BOOK_INVENTORY);
break;
case STONE_INVENTORY:
pItem->SetWindow(STONE_INVENTORY);
break;
#endif
//5. Search: function ( void CHARACTER::ClearItem )
for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
//5. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(UPGRADE_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(BOOK_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(STONE_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
#endif
//6. Search: function ( bool CHARACTER::IsEmptyItemGrid )
if (m_pointsInstant.bItemGrid[p])
if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
//6. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
break;
case UPGRADE_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
return false;
iExceptionCell++;
if (m_pointsInstant.wSSUItemGrid[wCell])
{
if (m_pointsInstant.wSSUItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.wSSUItemGrid[p])
if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
break;
case BOOK_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
return false;
iExceptionCell++;
if (m_pointsInstant.wSSBItemGrid[wCell])
{
if (m_pointsInstant.wSSBItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.wSSBItemGrid[p])
if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
case STONE_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
return false;
iExceptionCell++;
if (m_pointsInstant.wSSSItemGrid[wCell])
{
if (m_pointsInstant.wSSSItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.wSSSItemGrid[p])
if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
#endif
//7. Search:
void CHARACTER::CopyDragonSoulItemGrid(std::vector<WORD>& vDragonSoulItemGrid) const
{
vDragonSoulItemGrid.resize(DRAGON_SOUL_INVENTORY_MAX_NUM);
std::copy(m_pointsInstant.wDSItemGrid, m_pointsInstant.wDSItemGrid + DRAGON_SOUL_INVENTORY_MAX_NUM, vDragonSoulItemGrid.begin());
}
//7. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
int CHARACTER::GetEmptyUpgradeInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsUpgradeItem())
return -1;
BYTE bSize = pItem->GetSize();
for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (IsEmptyItemGrid(TItemPos (UPGRADE_INVENTORY, i), bSize))
return i;
return -1;
}
int CHARACTER::GetEmptyBookInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsBook())
return -1;
BYTE bSize = pItem->GetSize();
for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (IsEmptyItemGrid(TItemPos (BOOK_INVENTORY, i), bSize))
return i;
return -1;
}
int CHARACTER::GetEmptyStoneInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsStone())
return -1;
BYTE bSize = pItem->GetSize();
for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (IsEmptyItemGrid(TItemPos (STONE_INVENTORY, i), bSize))
return i;
return -1;
}
#endif
//8. Search: function ( bool CHARACTER::MoveItem )
if (DestCell.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(item))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº º§Æ® Àκ¥Å丮·Î ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
return false;
}
//8.Add After:
#ifdef UK_ENABLE_SPECIAL_STORAGE
if (Cell.IsDefaultInventoryPosition() && DestCell.window_type == UPGRADE_INVENTORY )
{
ChatPacket(CHAT_TYPE_INFO, "Bu depolama alanina bu itemi koyamazsin.!");
return false;
}
if (Cell.IsDefaultInventoryPosition() && DestCell.window_type == BOOK_INVENTORY )
{
ChatPacket(CHAT_TYPE_INFO, "Bu depolama alanina bu itemi koyamazsin.!");
return false;
}
if (Cell.IsDefaultInventoryPosition() && DestCell.window_type == STONE_INVENTORY )
{
ChatPacket(CHAT_TYPE_INFO, "Bu depolama alanina bu itemi koyamazsin.!");
return false;
}
if (Cell.IsEquipPosition() && DestCell.window_type == UPGRADE_INVENTORY )
{
ChatPacket(CHAT_TYPE_INFO, "Giyili iteme bu islemi yapamazsin.!");
return false;
}
if (Cell.IsEquipPosition() && DestCell.window_type == BOOK_INVENTORY )
{
ChatPacket(CHAT_TYPE_INFO, "Giyili iteme bu islemi yapamazsin.!");
return false;
}
if (Cell.IsEquipPosition() && DestCell.window_type == STONE_INVENTORY )
{
ChatPacket(CHAT_TYPE_INFO, "Giyili iteme bu islemi yapamazsin.!");
return false;
}
#endif
//9. Search: function ( bool CHARACTER::MoveItem )
else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
return false;
//9. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
if (item->IsUpgradeItem())
if (DestCell.window_type != UPGRADE_INVENTORY)
return false;
else if (UPGRADE_INVENTORY == DestCell.window_type)
return false;
if (item->IsBook())
if (DestCell.window_type != BOOK_INVENTORY)
return false;
else if (BOOK_INVENTORY == DestCell.window_type)
return false;
if (item->IsStone())
if (DestCell.window_type != STONE_INVENTORY)
return false;
else if (STONE_INVENTORY == DestCell.window_type)
return false;
#endif
//10. Search: function ( bool CHARACTER::PickupItem )
if (item->IsDragonSoul())
{
if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1)
{
sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
//10. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
{
if ((iEmptyCell = GetEmptyUpgradeInventory(item)) == -1)
{
sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
else if (item->IsBook())
{
if ((iEmptyCell = GetEmptyBookInventory(item)) == -1)
{
sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
else if (item->IsStone())
{
if ((iEmptyCell = GetEmptyStoneInventory(item)) == -1)
{
sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
#endif
//11. Search: function ( bool CHARACTER::PickupItem )
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//11. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
item->AddToCharacter(this, TItemPos(UPGRADE_INVENTORY, iEmptyCell));
else if (item->IsBook())
item->AddToCharacter(this, TItemPos(BOOK_INVENTORY, iEmptyCell));
else if (item->IsStone())
item->AddToCharacter(this, TItemPos(STONE_INVENTORY, iEmptyCell));
#endif
//12. Search: function ( bool CHARACTER::PickupItem )
if (item->IsDragonSoul())
{
if (!(owner && (iEmptyCell = owner->GetEmptyDragonSoulInventory(item)) != -1))
{
owner = this;
if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1)
{
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
}
//12. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
{
if (!(owner && (iEmptyCell = owner->GetEmptyUpgradeInventory(item)) != -1))
{
owner = this;
if ((iEmptyCell = GetEmptyUpgradeInventory(item)) == -1)
{
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
}
else if (item->IsBook())
{
if (!(owner && (iEmptyCell = owner->GetEmptyBookInventory(item)) != -1))
{
owner = this;
if ((iEmptyCell = GetEmptyBookInventory(item)) == -1)
{
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
}
else if (item->IsStone())
{
if (!(owner && (iEmptyCell = owner->GetEmptyStoneInventory(item)) != -1))
{
owner = this;
if ((iEmptyCell = GetEmptyStoneInventory(item)) == -1)
{
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
return false;
}
}
}
#endif
//13. Search: function ( bool CHARACTER::PickupItem )
if (item->IsDragonSoul())
item->AddToCharacter(owner, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//13. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
item->AddToCharacter(owner, TItemPos(UPGRADE_INVENTORY, iEmptyCell));
else if (item->IsBook())
item->AddToCharacter(owner, TItemPos(BOOK_INVENTORY, iEmptyCell));
else if (item->IsStone())
item->AddToCharacter(owner, TItemPos(STONE_INVENTORY, iEmptyCell));
#endif
//14. Search function : int CHARACTER::CountSpecifyItem
//14. Replace with :
int CHARACTER::CountSpecifyItem(DWORD vnum) const
{
int count = 0;
LPITEM item;
for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
{
item = GetInventoryItem(i);
if (NULL != item && item->GetVnum() == vnum)
{
// 개인 상점에 등록된 물건이면 넘어간다.
if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
{
continue;
}
else
{
count += item->GetCount();
}
}
}
#ifdef UK_ENABLE_SPECIAL_STORAGE
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
item = GetUpgradeInventoryItem(i);
if (NULL != item && item->GetVnum() == vnum)
{
if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
continue;
else
count += item->GetCount();
}
}
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
item = GetBookInventoryItem(i);
if (NULL != item && item->GetVnum() == vnum)
{
if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
continue;
else
count += item->GetCount();
}
}
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
item = GetStoneInventoryItem(i);
if (NULL != item && item->GetVnum() == vnum)
{
if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
continue;
else
count += item->GetCount();
}
}
#endif
return count;
}
//15. Search: function ( void CHARACTER::RemoveSpecifyItem )
if (vnum >= 80003 && vnum <= 80007)
LogManager::instance().GoldBarLog(GetPlayerID(), GetInventoryItem(i)->GetID(), QUEST, "RemoveSpecifyItem");
if (count >= GetInventoryItem(i)->GetCount())
{
count -= GetInventoryItem(i)->GetCount();
GetInventoryItem(i)->SetCount(0);
if (0 == count)
return;
}
else
{
GetInventoryItem(i)->SetCount(GetInventoryItem(i)->GetCount() - count);
return;
}
}
//15. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if (NULL == GetUpgradeInventoryItem(i))
continue;
if (GetUpgradeInventoryItem(i)->GetVnum() != vnum)
continue;
if(m_pkMyShop)
{
bool isItemSelling = m_pkMyShop->IsSellingItem(GetUpgradeInventoryItem(i)->GetID());
if (isItemSelling)
continue;
}
if (count >= GetUpgradeInventoryItem(i)->GetCount())
{
count -= GetUpgradeInventoryItem(i)->GetCount();
GetUpgradeInventoryItem(i)->SetCount(0);
if (0 == count)
return;
}
else
{
GetUpgradeInventoryItem(i)->SetCount(GetUpgradeInventoryItem(i)->GetCount() - count);
return;
}
}
for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if (NULL == GetBookInventoryItem(i))
continue;
if (GetBookInventoryItem(i)->GetVnum() != vnum)
continue;
if(m_pkMyShop)
{
bool isItemSelling = m_pkMyShop->IsSellingItem(GetBookInventoryItem(i)->GetID());
if (isItemSelling)
continue;
}
if (count >= GetBookInventoryItem(i)->GetCount())
{
count -= GetBookInventoryItem(i)->GetCount();
GetBookInventoryItem(i)->SetCount(0);
if (0 == count)
return;
}
else
{
GetBookInventoryItem(i)->SetCount(GetBookInventoryItem(i)->GetCount() - count);
return;
}
}
for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if (NULL == GetStoneInventoryItem(i))
continue;
if (GetStoneInventoryItem(i)->GetVnum() != vnum)
continue;
if(m_pkMyShop)
{
bool isItemSelling = m_pkMyShop->IsSellingItem(GetStoneInventoryItem(i)->GetID());
if (isItemSelling)
continue;
}
if (count >= GetStoneInventoryItem(i)->GetCount())
{
count -= GetStoneInventoryItem(i)->GetCount();
GetStoneInventoryItem(i)->SetCount(0);
if (0 == count)
return;
}
else
{
GetStoneInventoryItem(i)->SetCount(GetStoneInventoryItem(i)->GetCount() - count);
return;
}
}
#endif
//16. Search: function ( void CHARACTER::AutoGiveItem )
if (item->IsDragonSoul())
{
cell = GetEmptyDragonSoulInventory(item);
}
//16. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
{
cell = GetEmptyUpgradeInventory(item);
}
else if (item->IsBook())
{
cell = GetEmptyBookInventory(item);
}
else if (item->IsStone())
{
cell = GetEmptyStoneInventory(item);
}
#endif
//17. Search: function ( void CHARACTER::AutoGiveItem )
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, cell));
//17. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
item->AddToCharacter(this, TItemPos(UPGRADE_INVENTORY, cell));
else if (item->IsBook())
item->AddToCharacter(this, TItemPos(BOOK_INVENTORY, cell));
else if (item->IsStone())
item->AddToCharacter(this, TItemPos(STONE_INVENTORY, cell));
#endif
//18. Search: function ( LPITEM CHARACTER::AutoGiveItem )
if (item->IsDragonSoul())
{
iEmptyCell = GetEmptyDragonSoulInventory(item);
}
//18. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
if (item->IsUpgradeItem())
{
iEmptyCell = GetEmptyUpgradeInventory(item);
}
if (item->IsBook())
{
iEmptyCell = GetEmptyBookInventory(item);
}
if (item->IsStone())
{
iEmptyCell = GetEmptyStoneInventory(item);
}
#endif
//19. Search: function ( LPITEM CHARACTER::AutoGiveItem )
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//19. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
item->AddToCharacter(this, TItemPos(UPGRADE_INVENTORY, iEmptyCell));
else if (item->IsBook())
item->AddToCharacter(this, TItemPos(BOOK_INVENTORY, iEmptyCell));
else if (item->IsStone())
item->AddToCharacter(this, TItemPos(STONE_INVENTORY, iEmptyCell));
#endif
//20. Search: function ( bool CHARACTER::IsValidItemPosition )
case DRAGON_SOUL_INVENTORY:
return cell < (DRAGON_SOUL_INVENTORY_MAX_NUM);
//20. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
case BOOK_INVENTORY:
case STONE_INVENTORY:
return cell < (SPECIAL_INVENTORY_MAX_NUM);
#endif
birde arkadaş char_item_yap.cpp adı altında bir dosya eklemiş ve içinde şunlar var.
C++:
//9. Search: function ( bool CHARACTER::PickupItem )
quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2);
return true;
}
}
}
item->SetCount(bCount);
}
//9. Add after: // 200 olan yerleri aratın max item limitiniz kaçsa ona göre ayarlayın.
#ifdef UK_ENABLE_SPECIAL_STORAGE
if (item->IsUpgradeItem() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
{
BYTE bCount = item->GetCount();
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM item2 = GetUpgradeInventoryItem(i);
if (!item2)
continue;
if (item2->GetVnum() == item->GetVnum())
{
BYTE bCount2 = MIN(200 - item2->GetCount(), bCount);
bCount -= bCount2;
item2->SetCount(item2->GetCount() + bCount2);
if (bCount == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item2->GetName());
M2_DESTROY_ITEM(item);
return true;
}
}
}
item->SetCount(bCount);
}
//TEST FOR GETINVENTORYITEM
else if (item->IsBook() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
{
BYTE bCount = item->GetCount();
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM item2 = GetBookInventoryItem(i);
if (!item2)
continue;
if (item2->GetVnum() == item->GetVnum())
{
int j;
for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j)
if (item2->GetSocket(j) != item->GetSocket(j))
break;
if (j != ITEM_SOCKET_MAX_NUM)
continue;
BYTE bCount2 = MIN(200 - item2->GetCount(), bCount);
bCount -= bCount2;
item2->SetCount(item2->GetCount() + bCount2);
if (bCount == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item2->GetName());
M2_DESTROY_ITEM(item);
/* if (item2->GetType() == ITEM_QUEST)
quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2);*/
return true;
}
}
}
item->SetCount(bCount);
}
//TEST END UMUTK.
else if (item->IsStone() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
{
BYTE bCount = item->GetCount();
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM item2 = GetStoneInventoryItem(i);
if (!item2)
continue;
if (item2->GetVnum() == item->GetVnum())
{
BYTE bCount2 = MIN(200 - item2->GetCount(), bCount);
bCount -= bCount2;
item2->SetCount(item2->GetCount() + bCount2);
if (bCount == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item2->GetName());
M2_DESTROY_ITEM(item);
return true;
}
}
}
item->SetCount(bCount);
}
#endif
char_item_cpp deki adımları tek tek uygularım fakat char_item_cpp_yap dosyadaki anlatmak istediğini anlayamadım yardımcı olabilcek varmı acaba?
En son bir moderatör tarafından düzenlenmiş: