Jump to content

New mysql querry function


Recommended Posts

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.

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;
    }

 

pc.give_au_item(19, 200)

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 60

      Inbuild GR2 Animation

    2. 2

      wait() function bug

    3. 0

      Remove Party Role Bonuses

    4. 1

      Fix CBar3D

    5. 2

      set_quest_state not working

    6. 1

      Fix CBar3D

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.