Hey! I have added 1 new function in c++ to put an object into mysql. But game.core is created. Someone can help me?
I tested the function, I tried the feature manually.
Code
- int pc_give_au_item(lua_State* L)
- {
- if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2))
- {
- sys_err("QUEST give au_item call error : wrong argument");
- lua_pushnumber(L, 0);
- return 1;
- }
- LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
- //int icount = (int)lua_tonumber(L, 2);
- DWORD dwVnum = (int)lua_tonumber(L, 1);
- LPITEM item = ITEM_MANAGER::instance().CreateItem(dwVnum);
- int iPrice = (int)lua_tonumber(L, 2);
- sys_log(0, "QUEST [au_item] itemVnum: %d to PlayerID %s", dwVnum, ch->GetPlayerID());
- DBManager::instance().Query("INSERT INTO player.au_item (owner_id, vnum, count, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, au_put_date, price) VALUES( %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, now(), %d, );",
- ch->GetPlayerID(),
- dwVnum,
- item->GetCount(),
- item->GetSocket(0),
- item->GetSocket(1),
- item->GetSocket(2),
- item->GetAttribute(0),
- item->GetAttribute(1),
- item->GetAttribute(2),
- item->GetAttribute(3),
- item->GetAttribute(4),
- item->GetAttribute(5),
- item->GetAttribute(6),
- iPrice);
-
- lua_pushnumber(L, 0);
- return 1;
- }