Pues llevo tiempo preguntando en otros foros, y aquí y no he logrado recibir respuesta, algún compañero me ha dicho que haga un debug o un chat_noseque XD para ver que función hace y cual no, pero no se como se hace. Mi problema es que tengo el almacén especial público, y lo arreglé, lo adapte, etc, y funciona a la perfección pero hasta el otro día que me dio por probar el herrero no me di cuenta. Resulta que cuando quiero mejorar un ítem no me va el herrero, ni las bendiciones, metales, etc. Algo curioso porque no se ha editado ninguna línea de do_refine, o todo lo relacionado con el herrero, ya que no se ha remplazado ninguna línea, no tengo ningún sysser ni un game.core, así que no logro encontrar el error, este es el char_item.cpp del sistema :
Debes iniciar sesión para ver el contenido del enlace en esta publicación.
No tengo sysser ni en db,ni ch1, ni cliente, ni game.core ni nada :S alguna idea? gracias al que me eche un cable.
//4.Search: function ( void CHARACTER::SetItem )
case DRAGON_SOUL_INVENTORY:
pItem->SetWindow(DRAGON_SOUL_INVENTORY);
break;
//4. Add after:
#ifdef 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 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);
//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 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);
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (GetUpgradeInventoryItem(i)->GetVnum() == pItem->GetVnum())
return i;
return -1;
}
int CHARACTER::GetSameBookInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsBook())
return -1;
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (GetBookInventoryItem(i)->GetVnum() == pItem->GetVnum() && GetBookInventoryItem(i)->GetSocket(0) == pItem->GetSocket(0))
return i;
return -1;
}
int CHARACTER::GetSameStoneInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsStone())
return -1;
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (GetStoneInventoryItem(i)->GetVnum() == pItem->GetVnum())
return i;
return -1;
}
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 )
else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
return false;
//8. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
if (!item->IsUpgradeItem() && UPGRADE_INVENTORY == DestCell.window_type)
return false;
if (!item->IsBook() && BOOK_INVENTORY == DestCell.window_type)
return false;
if (!item->IsStone() && STONE_INVENTORY == DestCell.window_type)
return false;
#endif
//13. Search: function ( bool CHARACTER::PickupItem )
if (item->IsDragonSoul())
item->AddToCharacter(owner, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//13. Add after:
#ifdef 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 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 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);
//16. Search: function ( void CHARACTER::AutoGiveItem )
if (item->IsDragonSoul())
{
cell = GetEmptyDragonSoulInventory(item);
}
//16. Add after:
#ifdef 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 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
//Search this is function:
LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool bMsg)
{
TItemTable * p = ITEM_MANAGER::instance().GetTable(dwItemVnum);
if (!item)
{
sys_err("cannot create item by vnum %u (name: %s)", dwItemVnum, GetName());
return NULL;
}
//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
if (dwItemVnum == 50300)
{
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM book = GetBookInventoryItem(i);
if (!book)
continue;
if (book->GetVnum() == dwItemVnum && book->GetSocket(0) == item->GetSocket(0))
{
if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
{
if (bCount < p->alValues[1])
bCount = p->alValues[1];
}
Question
NazoX
Pues llevo tiempo preguntando en otros foros, y aquí y no he logrado recibir respuesta, algún compañero me ha dicho que haga un debug o un chat_noseque XD para ver que función hace y cual no, pero no se como se hace. Mi problema es que tengo el almacén especial público, y lo arreglé, lo adapte, etc, y funciona a la perfección pero hasta el otro día que me dio por probar el herrero no me di cuenta. Resulta que cuando quiero mejorar un ítem no me va el herrero, ni las bendiciones, metales, etc. Algo curioso porque no se ha editado ninguna línea de do_refine, o todo lo relacionado con el herrero, ya que no se ha remplazado ninguna línea, no tengo ningún sysser ni un game.core, así que no logro encontrar el error, este es el char_item.cpp del sistema :
No tengo sysser ni en db,ni ch1, ni cliente, ni game.core ni nada :S alguna idea? gracias al que me eche un cable.
//1. Search:
LPITEM CHARACTER::GetInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(INVENTORY, wCell));
}
//1. Add after:
#ifdef 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 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 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 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 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 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 ENABLE_SPECIAL_STORAGE
int CHARACTER::GetSameUpgradeInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsUpgradeItem())
return -1;
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (GetUpgradeInventoryItem(i)->GetVnum() == pItem->GetVnum())
return i;
return -1;
}
int CHARACTER::GetSameBookInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsBook())
return -1;
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (GetBookInventoryItem(i)->GetVnum() == pItem->GetVnum() && GetBookInventoryItem(i)->GetSocket(0) == pItem->GetSocket(0))
return i;
return -1;
}
int CHARACTER::GetSameStoneInventory(LPITEM pItem) const
{
if (NULL == pItem || !pItem->IsStone())
return -1;
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
if (GetStoneInventoryItem(i)->GetVnum() == pItem->GetVnum())
return i;
return -1;
}
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 )
else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
return false;
//8. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
if (!item->IsUpgradeItem() && UPGRADE_INVENTORY == DestCell.window_type)
return false;
if (!item->IsBook() && BOOK_INVENTORY == DestCell.window_type)
return false;
if (!item->IsStone() && STONE_INVENTORY == DestCell.window_type)
return false;
#endif
//9. Search: function ( bool CHARACTER::PickupItem )
quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2);
return true;
}
}
}
item->SetCount(bCount);
}
//9. Add after:
#ifdef 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(g_bItemCountLimit - 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);
}
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())
{
//SKILL BOOK FIX: ITEM_STACKABLE
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(g_bItemCountLimit - 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);
}
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(g_bItemCountLimit - 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
//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 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 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 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 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 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 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 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 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
//Search this is function:
LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool bMsg)
{
TItemTable * p = ITEM_MANAGER::instance().GetTable(dwItemVnum);
if (!p)
return NULL;
DBManager::instance().SendMoneyLog(MONEY_LOG_DROP, dwItemVnum, bCount);
if (p->dwFlags & ITEM_FLAG_STACKABLE && p->bType != ITEM_BLEND)
{
//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
if (p->bType == ITEM_MATERIAL && p->bSubType == MATERIAL_LEATHER) //upgrade item
{
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM item = GetUpgradeInventoryItem(i);
if (!item)
continue;
if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item))
{
if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
{
if (bCount < p->alValues[1])
bCount = p->alValues[1];
}
BYTE bCount2 = MIN(ITEM_MAX_COUNT - item->GetCount(), bCount);
bCount -= bCount2;
item->SetCount(item->GetCount() + bCount2);
if (bCount == 0)
{
if (bMsg)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName());
return item;
}
}
}
}
else if (dwItemVnum == 50300) //book item
{
}
else if (p->bType == ITEM_METIN && p->bSubType == METIN_NORMAL) //stone item
{
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM item = GetStoneInventoryItem(i);
if (!item)
continue;
if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item))
{
if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
{
if (bCount < p->alValues[1])
bCount = p->alValues[1];
}
BYTE bCount2 = MIN(ITEM_MAX_COUNT - item->GetCount(), bCount);
bCount -= bCount2;
item->SetCount(item->GetCount() + bCount2);
if (bCount == 0)
{
if (bMsg)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName());
return item;
}
}
}
}
else
{
#endif
//Search this:
}
LPITEM item = ITEM_MANAGER::instance().CreateItem(dwItemVnum, bCount, 0, true);
//Add before:
#ifdef ENABLE_SPECIAL_STORAGE
}
#endif
//Search this:
LPITEM item = ITEM_MANAGER::instance().CreateItem(dwItemVnum, bCount, 0, true);
if (!item)
{
sys_err("cannot create item by vnum %u (name: %s)", dwItemVnum, GetName());
return NULL;
}
//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
if (dwItemVnum == 50300)
{
for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
LPITEM book = GetBookInventoryItem(i);
if (!book)
continue;
if (book->GetVnum() == dwItemVnum && book->GetSocket(0) == item->GetSocket(0))
{
if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
{
if (bCount < p->alValues[1])
bCount = p->alValues[1];
}
BYTE bCount2 = MIN(ITEM_MAX_COUNT - book->GetCount(), bCount);
bCount -= bCount2;
book->SetCount(book->GetCount() + bCount2);
if (bCount == 0)
{
if (bMsg)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), book->GetName());
M2_DESTROY_ITEM(item);
return book;
}
}
}
}
#endif
//Search this:
int iEmptyCell;
if (item->IsDragonSoul())
{
iEmptyCell = GetEmptyDragonSoulInventory(item);
}
//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
else if (item->IsUpgradeItem())
{
iEmptyCell = GetEmptyUpgradeInventory(item);
}
else if (item->IsBook())
{
iEmptyCell = GetEmptyBookInventory(item);
}
else if (item->IsStone())
{
iEmptyCell = GetEmptyStoneInventory(item);
}
#endif
//Search this:
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//Add under:
#ifdef 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 ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
case BOOK_INVENTORY:
case STONE_INVENTORY:
return cell < (SPECIAL_INVENTORY_MAX_NUM);
#endif
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.