dunno why, for me neither detachment nor tuning will work after splitting it up. And yeah, its not that much of changing code but it literally doesnt work anymore. Even with debug outputs, none of the 2 functions gets triggered after splitting it up. Any idea?
case USE_TUNING:
{
LPITEM item2 = nullptr;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging() || item2->IsEquipped());
return false;
#ifdef __STONE_REFINE_FIX__
if (item->GetVnum() >= 28330 && item->GetVnum() <= 28643) // fix
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Du kannst Steine nur bei Seon-Pyeong verbessern."));
return false;
}
#endif
#ifdef __RITUAL_STONE__
if (item->GetValue(0) == RITUALS_SCROLL)
{
if (item2->GetLevelLimit() < item->GetValue(1))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Du kannst nur Items über Lv. 80 verbessern."));
return false;
}
else
RefineItem(item, item2);
}
#endif
else
{
RefineItem(item, item2);
}
}
break;
// DETACH_METIN_REFACTORING //trennung von USE_DETACHMENT und USE_TUNING in 2 funktionen
case USE_DETACHMENT:
{
LPITEM item2 = nullptr;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging() || item2->IsEquipped());
return false;
ChatPacket(CHAT_TYPE_INFO, "test 3");
#ifdef ENABLE_SOULBIND_SYSTEM
if (item2->IsBind() || item2->IsUntilBind())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Du kannst keine Steine aus seelengebundenen Items entfernen."));
return false;
}
#endif
#ifdef __SASH_SYSTEM__
if (item->GetValue(0) == SASH_CLEAN_ATTR_VALUE0)
{
if (!CleanSashAttr(item, item2))
return false;
return true;
}
#endif
DetachMetin(item, item2);
}
break;
// END_OF_DETACH_METIN_REFACTORING
------------------------------
bool CHARACTER::RefineItem(LPITEM pkItem, LPITEM pkTarget)
{
if (!CanHandleItem())
return false;
#ifdef ENABLE_AURA_SYSTEM
if (pkTarget->GetType() == ITEM_COSTUME && pkTarget->GetSubType() == COSTUME_AURA)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("AURA_ITEM_CANNOT_BE_REFINED_THIS_WAY"));
return false;
}
#endif
ChatPacket(CHAT_TYPE_INFO, "test 5");
#ifdef ENABLE_REFINE_FAILSTACK
int failstacks = DBManager::Instance().GetFailStacks(this);
#endif
// MUSIN_SCROLL
if (pkItem->GetValue(0) == MUSIN_SCROLL)
#ifdef ENABLE_REFINE_FAILSTACK
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_MUSIN, pkItem->GetCell(), failstacks, failstacks / 100);
#else
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_MUSIN, pkItem->GetCell());
#endif
// END_OF_MUSIN_SCROLL
#ifdef ENABLE_CAN_USE_SCROLL_FOR_501_REFINESET
else if (pkItem->GetValue(0) == CHUKBOK_SCROLL)
#ifdef ENABLE_REFINE_FAILSTACK
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, pkItem->GetCell(), failstacks, failstacks / 100);
#else
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, pkItem->GetCell());
#endif
#endif
else if (pkItem->GetValue(0) == HYUNIRON_CHN)
#ifdef ENABLE_REFINE_FAILSTACK
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_HYUNIRON, pkItem->GetCell(), failstacks, failstacks / 100);
#else
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_HYUNIRON, pkItem->GetCell());
#endif
else if (pkItem->GetValue(0) == BDRAGON_SCROLL)
{
if (pkTarget->GetRefineSet() != 702) return false;
#ifdef ENABLE_REFINE_FAILSTACK
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_BDRAGON, pkItem->GetCell(), failstacks, failstacks / 100);
#else
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_BDRAGON, pkItem->GetCell());
#endif
}
#ifdef __RITUAL_STONE__
else if (pkItem->GetValue(0) == RITUALS_SCROLL)
{
if(pkTarget->GetLevelLimit() <= pkItem->GetValue(1)) return false;
#ifdef ENABLE_REFINE_FAILSTACK
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_RITUALS_SCROLL, pkItem->GetCell(), failstacks, failstacks / 100);
#else
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_RITUALS_SCROLL, pkItem->GetCell());
#endif
}
#endif
else
{
if (pkTarget->GetRefineSet() == 501) return false;
#ifdef ENABLE_REFINE_FAILSTACK
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, pkItem->GetCell(), failstacks, failstacks / 100);
#else
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, pkItem->GetCell());
#endif
}
return false;
}
bool CHARACTER::DetachMetin(LPITEM pkItem, LPITEM pkTarget)
{
//if (!(pkItem || pkTarget))
// return false; //deactivated just for testing
ChatPacket(CHAT_TYPE_INFO, "test 123");
LogManager::instance().ItemLog(this, pkTarget, "USE_DETACHMENT", pkTarget->GetName());
bool bHasMetinStone = false;
#ifdef ENABLE_EXTENDED_SOCKETS
for (int i = 0; i < ITEM_STONES_MAX_NUM; i++)
#else
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
#endif
{
long socket = pkTarget->GetSocket(i);
if (socket > 2 && (DWORD)socket != ITEM_BROKEN_METIN_VNUM)
{
bHasMetinStone = true;
break;
}
}
if (bHasMetinStone)
{
#ifdef ENABLE_EXTENDED_SOCKETS
for (int i = 0; i < ITEM_STONES_MAX_NUM; i++)
#else
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
#endif
{
long socket = pkTarget->GetSocket(i);
if (socket > 2 && (DWORD)socket != ITEM_BROKEN_METIN_VNUM)
{
ChatPacket(CHAT_TYPE_INFO, "test 2");
AutoGiveItem(socket);
#ifdef ENABLE_BROKEN_METIN_ITEM
pkTarget->SetSocket(i, ITEM_BROKEN_METIN_VNUM);
#endif
pkTarget->SetSocket(i, 1);
}
}
pkItem->SetCount(pkItem->GetCount() - 1);
ChatPacket(CHAT_TYPE_INFO, "successfull 1");
return true;
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Es gibt keinen Stein zum Herausnehmen. "));
return false;
}
}
refine window wont open up again, stone detachment opens the yes/no dialog window but doesnt do anything after pressing yes. No crash, no syserr
dunno why i cant just fkn edit my comment and need to double post (thanks metin2dev) but you fked up your tut with wrong ;'s
case USE_TUNING:
{
LPITEM item2 = nullptr;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging() || item2->IsEquipped()); <--- ???
return false;
RefineItem(item, item2);
}
break;
// DETACH_METIN_REFACTORING
case USE_DETACHMENT:
{
LPITEM item2 = nullptr;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging() || item2->IsEquipped()); <---- ???
return false;
DetachMetin(item, item2);
}
break;
// END_OF_DETACH_METIN_REFACTORING
wont work this way