Adding multi warehouse command on zteam files

Results 1 to 2 of 2
  1. #1
    Account Upgraded | Title Enabled! rusolp is offline
    MemberRank
    Mar 2008 Join Date
    $db->play_lifeLocation
    319Posts

    Adding multi warehouse command on zteam files

    Hi there, i have some problems adding command to change warehouse on zteam source..


    This is what i ve done:


    DataBase


    Table: Multibaul
    AccountID varchar(10)
    Items varbinary(3840)
    Money int
    Number int



    Dataserver




    warehousedbset.cpp


    BOOL CWarehouseDBSet::WareChange(char* AccountID, int WareNumber)
    {
    CString qSQL;


    gWindow.PrintLog("Cambio de baul a [%d] [%s] [Start]", AccountID, WareNumber);


    qSQL.Format("UPDATE Multibaul set Activo='0' where AccountID='%s' and Number !='%s'", AccountID, WareNumber);

    if (m_DBQuery.Exec(qSQL) == FALSE)
    {
    gWindow.PrintLog("Error 1 en cambio de baul [%d] %s", AccountID, WareNumber);
    }


    qSQL.Format("UPDATE Multibaul set Activo='1' where AccountID='%s' and Number='%s'", AccountID, WareNumber);

    if (m_DBQuery.Exec(qSQL) == FALSE)
    {
    gWindow.PrintLog("Error 2 en cambio de baul [%d] %s", AccountID, WareNumber);
    }


    gWindow.PrintLog("Cambio de baul a [%d] [%s] [Finish]", AccountID, WareNumber);


    return TRUE;
    }

    warehousedbset.h


    BOOL WareChange(char* AccountID, int WareNumber);

    protocol.cpp




    void GDPSetWareChange(LPSDHP_WARECHANGE_SAVE lpMsg, int aIndex);




    case 0x58:
    GDPSetWareChange((SDHP_WARECHANGE_SAVE *)aRecv, aIndex);
    break;




    void GDPSetWareChange(LPSDHP_WARECHANGE_SAVE lpMsg, int aIndex)
    {
    char szId[MAX_IDSTRING+1];
    szId[MAX_IDSTRING] = '\0';
    memcpy(szId, lpMsg->AccountID, MAX_IDSTRING);

    CWhDBSet.WareChange(szId, lpMsg->WareNumber);
    }

    Sprodef.h


    typedef struct
    {
    PBMSG_HEAD h;
    char AccountID[MAX_IDSTRING];
    short aIndex;
    int WareNumber;
    } SDHP_WARECHANGE_SAVE, *LPSDHP_WARECHANGE_SAVE;



    GameServer


    user.h


    int WareNumber;

    DSProtocol.cpp


    struct SDHP_WARECHANGE_SAVE
    {
    PBMSG_HEAD h; // C1:12
    char AccountID[10]; // 3
    short aIndex; // E
    int WareNumber; // 10
    };


    void GDSetWareChange(int aIndex, int WareNumber)
    {
    SDHP_WARECHANGE_SAVE pMsg;


    memcpy(pMsg.AccountID, gObj[aIndex].AccountID, sizeof(pMsg.AccountID));
    pMsg.aIndex = aIndex;
    pMsg.h.c = 0xC1;
    pMsg.h.headcode = 0x58;
    pMsg.h.size = sizeof(pMsg);
    pMsg.WareNumber = WareNumber;


    cDBSMng.Send((char*)&pMsg, pMsg.h.size);
    }


    DSProtocol.h


    void GDSetWareChange(int aIndex, int WareNumber);

    GMMng.cpp


    case COMMAND_WARECHANGE:
    {
    int baulnum = this->GetTokenNumber();
    char szTemp[256];


    if(baulnum == 0){
    GDSetWareChange(lpObj->m_Index, baulnum);
    wsprintf(szTemp, "Cambiaste a baul 0", baulnum);
    }
    else if(baulnum == 1){
    GDSetWareChange(lpObj->m_Index, baulnum);
    wsprintf(szTemp, "Cambiaste a baul 1", baulnum);
    }
    else if(baulnum == 2){
    GDSetWareChange(lpObj->m_Index, baulnum);
    wsprintf(szTemp, "Cambiaste a baul 2", baulnum);
    }
    else if(baulnum == 3){
    GDSetWareChange(lpObj->m_Index, baulnum);
    wsprintf(szTemp, "Cambiaste a baul 3", baulnum);
    }
    else if(baulnum == 4){
    GDSetWareChange(lpObj->m_Index, baulnum);
    wsprintf(szTemp, "Cambiaste a baul 4", baulnum);
    }
    else{
    GCServerMsgStringSend("Numero de baul no valido", lpObj->m_Index, 1);
    }


    GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
    }
    break;

    GMMng.h


    COMMAND_WARECHANGE = 5,



    The problem is that DataServer crash after show this log:




    gWindow.PrintLog("Cambio de baul a [%d] [%s] [Start]", AccountID, WareNumber);

    I hope that someone can help me to fix or finish this command..


  2. #2
    Account Upgraded | Title Enabled! rusolp is offline
    MemberRank
    Mar 2008 Join Date
    $db->play_lifeLocation
    319Posts

    Re: Adding multi warehouse command on zteam files

    No one??



Advertisement