Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int item_change_vnum(lua_State* L)
- {
- LPITEM item = CQuestManager::instance().GetCurrentItem();
- LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
- if (!item || !ch || lua_gettop(L) < 1 || !lua_isnumber(L, 1))
- {
- lua_pushboolean(L, 0);
- return 1;
- }
- LPITEM itemNew = ch->AutoGiveItem(lua_tonumber(L, 1), item->GetCount());
- if (!itemNew)
- {
- lua_pushboolean(L, 0);
- return 1;
- }
- for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
- itemNew->SetSocket(i, item->GetSocket(i));
- for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
- itemNew->SetForceAttribute(i, item->GetAttributeType(i), item->GetAttributeValue(i));
- ITEM_MANAGER::instance().RemoveItem(item);
- lua_pushboolean(L, 1);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment