Jump to content

[ Dead Download Link ] [C++]No txt on 40k [ We Need You ]


Recommended Posts

I made a short tut^^:

At first i want to say: this is not compatible with a table_postfix or item_vnum ranges.

[1] open "ClientManagerBoot.cpp"


8wFhD.png


and make these both if-terms to comments or delete them (in my tree at line 22 - 26 and 34 - 38)

[2] edit the function "CClientManager::InitializeMobTable()" like this:

bool CClientManager::InitializeMobTable()
{
    static const char * query =
                    "SELECT vnum, name, locale_name, rank, type, battle_type, level, size, ai_flag+0, mount_capacity,"
                    "setRaceFlag+0, setImmuneFlag+0, empire, folder, on_click, st, dx, ht, iq, damage_min, damage_max,"
                    "max_hp, regen_cycle, regen_percent, gold_min, gold_max, exp, def, attack_speed, move_speed, aggressive_hp_pct,"
                    "aggressive_sight, attack_range, drop_item, resurrection_vnum, enchant_curse, enchant_slow,"
                    "enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, resist_sword, resist_twohand,"
                    "resist_dagger, resist_bell, resist_fan, resist_bow, resist_fire, resist_elect, resist_magic, resist_wind,"
                    "resist_poison, dam_multiply, summon, drain_sp, mob_color, polymorph_item, skill_level0, skill_vnum0,"
                    "skill_level1, skill_vnum1, skill_level2, skill_vnum2, skill_level3, skill_vnum3, skill_level4, skill_vnum4,"
                    "sp_berserk, sp_stoneskin, sp_godspeed, sp_deathblow, sp_revive FROM mob_proto ORDER BY vnum";
    std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
    SQLResult * pRes = pkMsg->Get();
    
   if (!pRes->uiNumRows)
    {
        sys_err("No result from Mob_Proto!");
     return false;
    }
    if (!m_vec_mobTable.empty())
    {
        sys_log(0, "RELOAD: mob_proto");
        m_vec_mobTable.clear();
    }
    m_vec_mobTable.reserve(pRes->uiNumRows);

    MYSQL_ROW    data;
    int        col;
    
    while ((data = mysql_fetch_row(pRes->pSQLResult)))
    {
        TMobTable t;
        memset(&t, 0, sizeof(t));
        
        col = 0;
        
        str_to_number(t.dwVnum, data[col++]);
        strlcpy(t.szName, data[col++], sizeof(t.szName));
        strlcpy(t.szLocaleName, data[col++], sizeof(t.szLocaleName));
        str_to_number(t.bRank, data[col++]);
        str_to_number(t.bType, data[col++]);
        str_to_number(t.bBattleType, data[col++]);
        str_to_number(t.bLevel, data[col++]);
        str_to_number(t.bSize, data[col++]);
        str_to_number(t.dwAIFlag, data[col++]);
        str_to_number(t.bMountCapacity, data[col++]);
        str_to_number(t.dwRaceFlag, data[col++]);
        str_to_number(t.dwImmuneFlag, data[col++]);
        str_to_number(t.bEmpire, data[col++]);
        strlcpy(t.szFolder, data[col++], sizeof(t.szFolder));
        str_to_number(t.bOnClickType, data[col++]);
        str_to_number(t.bStr, data[col++]);
        str_to_number(t.bDex, data[col++]);
        str_to_number(t.bCon, data[col++]);
        str_to_number(t.bInt, data[col++]);
        str_to_number(t.dwDamageRange[0], data[col++]);
        str_to_number(t.dwDamageRange[1], data[col++]);
        str_to_number(t.dwMaxHP, data[col++]);
        str_to_number(t.bRegenCycle, data[col++]);
        str_to_number(t.bRegenPercent, data[col++]);       
        str_to_number(t.dwGoldMin, data[col++]);
        str_to_number(t.dwGoldMax, data[col++]);
        str_to_number(t.dwExp, data[col++]);        
        str_to_number(t.wDef, data[col++]);   
        str_to_number(t.sAttackSpeed, data[col++]);
        str_to_number(t.sMovingSpeed, data[col++]);
        str_to_number(t.bAggresiveHPPct, data[col++]);
        str_to_number(t.wAggressiveSight, data[col++]);
        str_to_number(t.wAttackRange, data[col++]);
        str_to_number(t.dwDropItemVnum, data[col++]);
        str_to_number(t.dwResurrectionVnum, data[col++]);
        str_to_number(t.cEnchants[0], data[col++]);
        str_to_number(t.cEnchants[1], data[col++]);
        str_to_number(t.cEnchants[2], data[col++]);
        str_to_number(t.cEnchants[3], data[col++]);
        str_to_number(t.cEnchants[4], data[col++]);
        str_to_number(t.cEnchants[5], data[col++]);
        str_to_number(t.cResists[0], data[col++]);
        str_to_number(t.cResists[1], data[col++]);
        str_to_number(t.cResists[2], data[col++]);
        str_to_number(t.cResists[3], data[col++]);
        str_to_number(t.cResists[4], data[col++]);
        str_to_number(t.cResists[5], data[col++]);
        str_to_number(t.cResists[6], data[col++]);
        str_to_number(t.cResists[7], data[col++]);
        str_to_number(t.cResists[8], data[col++]);
        str_to_number(t.cResists[9], data[col++]);
        str_to_number(t.cResists[10], data[col++]);
        str_to_number(t.fDamMultiply, data[col++]);
        str_to_number(t.dwSummonVnum, data[col++]);
        str_to_number(t.dwDrainSP, data[col++]);
        str_to_number(t.dwMobColor, data[col++]);
        str_to_number(t.dwPolymorphItemVnum, data[col++]);
        str_to_number(t.Skills[0].bLevel, data[col++]);
        str_to_number(t.Skills[0].dwVnum, data[col++]);
        str_to_number(t.Skills[1].bLevel, data[col++]);
        str_to_number(t.Skills[1].dwVnum, data[col++]);
        str_to_number(t.Skills[2].bLevel, data[col++]);
        str_to_number(t.Skills[2].dwVnum, data[col++]);
        str_to_number(t.Skills[3].bLevel, data[col++]);
        str_to_number(t.Skills[3].dwVnum, data[col++]);
        str_to_number(t.Skills[4].bLevel, data[col++]);
        str_to_number(t.Skills[4].dwVnum, data[col++]);
        str_to_number(t.bBerserkPoint, data[col++]);
        str_to_number(t.bStoneSkinPoint, data[col++]);
        str_to_number(t.bGodSpeedPoint, data[col++]);
        str_to_number(t.bDeathBlowPoint, data[col++]);
        str_to_number(t.bRevivePoint, data[col++]);
        
        sys_log(0, "Monster: %s loaded", t.szLocaleName);

        m_vec_mobTable.push_back(t);
    }
    
    return true;
}



[3] edit the function "CClientManager::InitializeItemTable()" like this:

bool CClientManager::InitializeItemTable()
{
    /* I needed to make 2 mysql queries because with only 1 there was always a stackoverflow....
     * However^^ It works so idc :)
    */
    const char * c_ist_doof = "SELECT refined_vnum, refine_set, magic_pct FROM item_proto ORDER BY vnum";
    SQLMsg* sqlMsg1 = CDBManager::instance().DirectQuery(c_ist_doof);
    
    const char * query = "SELECT vnum, name, locale_name, type, subtype, weight, size, antiflag+0,"
    "flag+0, wearflag+0, immuneflag+0, gold, shop_buy_price, refined_vnum,"
    "refine_set, magic_pct, limittype0, limitvalue0, limittype1, limitvalue1,"
    "applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2,"
    "value0, value1, value2, value3, value4, value5, socket0, socket1, socket2,"
    "socket3, socket4, socket5, specular, socket_pct, addon_type FROM item_proto ORDER BY vnum";
    SQLMsg* sqlMsg = CDBManager::instance().DirectQuery(query);
    
    MYSQL_RES* pRes1 = sqlMsg1->vec_pkResult[0]->pSQLResult;
    MYSQL_RES* pRes = sqlMsg->vec_pkResult[0]->pSQLResult;
    
    if (sizeof(pRes) <= 1 || sizeof(pRes1) <= 1)
    {
        sys_err("Kein Ergebnis aus Item_Proto!");
        return false;
    }
    if (!m_vec_itemTable.empty()) {
        sys_log(0, "Reloading Item_Proto");
        m_vec_itemTable.clear();
    }
    MYSQL_ROW data;
    MYSQL_ROW data1;
    while ((data = mysql_fetch_row(pRes)) && (data1 = mysql_fetch_row(pRes1)))
    {
        TItemTable t;
        TItemTable baum;
        
        str_to_number(baum.dwRefinedVnum, data1[0]);
        str_to_number(baum.wRefineSet, data1[1]);
        str_to_number(baum.bAlterToMagicItemPct, data1[2]);
        
        str_to_number(t.dwVnum, data[0]);   
        strlcpy(t.szName, data[1], sizeof(t.szName));
        strlcpy(t.szLocaleName, data[2], sizeof(t.szLocaleName));
        str_to_number(t.bType, data[3]);
        str_to_number(t.bSubType, data[4]);
        str_to_number(t.bWeight, data[5]);
        str_to_number(t.bSize, data[6]);
        str_to_number(t.dwAntiFlags, data[7]);
        str_to_number(t.dwFlags, data[8]);
        str_to_number(t.dwWearFlags, data[9]);
        str_to_number(t.dwImmuneFlag, data[10]);
        str_to_number(t.dwGold, data[11]);
        str_to_number(t.dwShopBuyPrice,data[12]);
        str_to_number(t.aLimits[0].bType, data[16]);
        str_to_number(t.aLimits[0].lValue, data[17]);
        str_to_number(t.aLimits[1].bType, data[18]);
        str_to_number(t.aLimits[1].lValue, data[19]);
        str_to_number(t.aApplies[0].bType, data[20]);
        str_to_number(t.aApplies[0].lValue, data[21]);
        str_to_number(t.aApplies[1].bType, data[22]);
        str_to_number(t.aApplies[1].lValue, data[23]);
        str_to_number(t.aApplies[2].bType, data[24]);
        str_to_number(t.aApplies[2].lValue, data[25]);
        str_to_number(t.alValues[0], data[26]);
        str_to_number(t.alValues[1], data[27]);
        str_to_number(t.alValues[2], data[28]);
        str_to_number(t.alValues[3], data[29]);
        str_to_number(t.alValues[4], data[30]);
        str_to_number(t.alValues[5], data[31]);
        str_to_number(t.alSockets[0], data[32]);
        str_to_number(t.alSockets[1], data[33]);
        str_to_number(t.alSockets[2], data[34]);
        str_to_number(t.alSockets[3], data[35]);
        str_to_number(t.alSockets[4], data[36]);
        str_to_number(t.alSockets[5], data[37]);
        str_to_number(t.bSpecular, data[38]);
        str_to_number(t.bGainSocketPct, data[39]);
        str_to_number(t.sAddonType, data[40]);        
        t.cLimitRealTimeFirstUseIndex = -1;
        t.cLimitTimerBasedOnWearIndex = -1;
        for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) {
            if (LIMIT_REAL_TIME_START_FIRST_USE == t.aLimits.bType)
                t.cLimitRealTimeFirstUseIndex = (char) i;
 
            if (LIMIT_TIMER_BASED_ON_WEAR == t.aLimits.bType)
                t.cLimitTimerBasedOnWearIndex = (char) i;
        }
        
        // Conversion
        t.dwRefinedVnum = baum.dwRefinedVnum;
        t.wRefineSet = baum.wRefineSet;
        t.bAlterToMagicItemPct = baum.bAlterToMagicItemPct;
       
        //Debug
        //sys_log(0,"%d %d %d",t.dwRefinedVnum, t.wRefineSet, t.bAlterToMagicItemPct);
        //sys_log(0,"%d %d %d",baum.dwRefinedVnum, baum.wRefineSet, baum.bAlterToMagicItemPct);
        
        m_vec_itemTable.push_back(t);
    }   
    m_map_itemTableByVnum.clear();
    __gnu_cxx::__normal_iterator<SItemTable*, std::vector<SItemTable, std::allocator<SItemTable> > > it = m_vec_itemTable.begin();
    while (it != m_vec_itemTable.end())
    {
        TItemTable * item_table = &(*(it++));    
        sys_log(0,"Item %s geladen", item_table->szLocaleName);        
        m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));
    }
    sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());
    return true;
}



[4] make both functions "bool CClientManager::MirrorMobTableIntoDB()" and "bool CClientManager::MirrorItemTableIntoDB()" to comments or delete them

[5] open "ClientManager.h" and delete or make these functions to comments:


8wGz4.png
(in my tree they are at line 190 and 191)

Thanks to iMer because i use some lines of his code and he had to stand over my skype spam^^

NOTE: If you have different table structures or more columns you want to use, you have to change the functions

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 5
Link to comment
Share on other sites

I made a function for mob_proto and i cant find a bug:

bool CClientManager::InitializeMobTable()
{
    static const char * query = 
                    "SELECT vnum, name, locale_name, rank, type, battle_type, level, size, ai_flag, mount_capacity,"
                    "setRaceFlag, setImmuneFlag, empire, folder, on_click, st, dx, ht, iq, damage_min, damage_max,"
                    "max_hp, regen_cycle, regen_percent, gold_min, gold_max, exp, def, attack_speed, move_speed, aggressive_hp_pct,"
                    "aggressive_sight, attack_range, drop_item, resurrection_vnum, enchant_curse, enchant_slow,"
                    "enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, resist_sword, resist_twohand,"
                    "resist_dagger, resist_bell, resist_fan, resist_bow, resist_fire, resist_elect, resist_magic, resist_wind,"
                    "resist_poison, dam_multiply, summon, drain_sp, mob_color, polymorph_item, skill_level0, skill_vnum0,"
                    "skill_level1, skill_vnum1, skill_level2, skill_vnum2, skill_level3, skill_vnum3, skill_level4, skill_vnum4,"
                    "sp_berserk, sp_stoneskin, sp_godspeed, sp_deathblow, sp_revive FROM mob_proto ORDER BY vnum";
    std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
    SQLResult * pRes = pkMsg->Get();
    
   if (!pRes->uiNumRows)
    {
        sys_err("No result from Mob_Proto!");
        return false;
    }
    if (!m_vec_mobTable.empty())
    {
        sys_log(0, "RELOAD: mob_proto");
        m_vec_mobTable.clear();
    }
    m_vec_mobTable.reserve(pRes->uiNumRows);

	MYSQL_ROW	data;
	int		col;
    
    while ((data = mysql_fetch_row(pRes->pSQLResult)))
    {
        TMobTable t;
        memset(&t, 0, sizeof(t));
        
        col = 0;
        
        str_to_number(t.dwVnum, data[col++]);
        strlcpy(t.szName, data[col++], sizeof(t.szName));
        strlcpy(t.szLocaleName, data[col++], sizeof(t.szLocaleName));
        str_to_number(t.bRank, data[col++]);
        str_to_number(t.bType, data[col++]);
        str_to_number(t.bBattleType, data[col++]);
        str_to_number(t.bLevel, data[col++]);
        str_to_number(t.bSize, data[col++]);
        str_to_number(t.dwAIFlag, data[col++]);
        str_to_number(t.bMountCapacity, data[col++]);
        str_to_number(t.dwRaceFlag, data[col++]);
        str_to_number(t.dwImmuneFlag, data[col++]);
        str_to_number(t.bEmpire, data[col++]);
        strlcpy(t.szFolder, data[col++], sizeof(t.szFolder));
        str_to_number(t.bOnClickType, data[col++]);
        str_to_number(t.bStr, data[col++]);
        str_to_number(t.bDex, data[col++]);
        str_to_number(t.bCon, data[col++]);
        str_to_number(t.bInt, data[col++]);
        str_to_number(t.dwDamageRange[0], data[col++]);
        str_to_number(t.dwDamageRange[1], data[col++]);
        str_to_number(t.dwMaxHP, data[col++]);
        str_to_number(t.bRegenCycle, data[col++]);
        str_to_number(t.bRegenPercent, data[col++]);       
        str_to_number(t.dwGoldMin, data[col++]);
        str_to_number(t.dwGoldMax, data[col++]);
        str_to_number(t.dwExp, data[col++]);        
        str_to_number(t.wDef, data[col++]);   
        str_to_number(t.sAttackSpeed, data[col++]);
        str_to_number(t.sMovingSpeed, data[col++]);
        str_to_number(t.bAggresiveHPPct, data[col++]);
        str_to_number(t.wAggressiveSight, data[col++]);
        str_to_number(t.wAttackRange, data[col++]);
        str_to_number(t.dwDropItemVnum, data[col++]);
        str_to_number(t.dwResurrectionVnum, data[col++]);
        str_to_number(t.cEnchants[0], data[col++]);
        str_to_number(t.cEnchants[1], data[col++]);
        str_to_number(t.cEnchants[2], data[col++]);
        str_to_number(t.cEnchants[3], data[col++]);
        str_to_number(t.cEnchants[4], data[col++]);
        str_to_number(t.cEnchants[5], data[col++]);
        str_to_number(t.cResists[0], data[col++]);
        str_to_number(t.cResists[1], data[col++]);
        str_to_number(t.cResists[2], data[col++]);
        str_to_number(t.cResists[3], data[col++]);
        str_to_number(t.cResists[4], data[col++]);
        str_to_number(t.cResists[5], data[col++]);
        str_to_number(t.cResists[6], data[col++]);
        str_to_number(t.cResists[7], data[col++]);
        str_to_number(t.cResists[8], data[col++]);
        str_to_number(t.cResists[9], data[col++]);
        str_to_number(t.cResists[10], data[col++]);
        str_to_number(t.fDamMultiply, data[col++]);
        str_to_number(t.dwSummonVnum, data[col++]);
        str_to_number(t.dwDrainSP, data[col++]);
        str_to_number(t.dwMobColor, data[col++]);
        str_to_number(t.dwPolymorphItemVnum, data[col++]);
        str_to_number(t.Skills[0].bLevel, data[col++]);
        str_to_number(t.Skills[0].dwVnum, data[col++]);
        str_to_number(t.Skills[1].bLevel, data[col++]);
        str_to_number(t.Skills[1].dwVnum, data[col++]);
        str_to_number(t.Skills[2].bLevel, data[col++]);
        str_to_number(t.Skills[2].dwVnum, data[col++]);
        str_to_number(t.Skills[3].bLevel, data[col++]);
        str_to_number(t.Skills[3].dwVnum, data[col++]);
        str_to_number(t.Skills[4].bLevel, data[col++]);
        str_to_number(t.Skills[4].dwVnum, data[col++]);
        str_to_number(t.bBerserkPoint, data[col++]);
        str_to_number(t.bStoneSkinPoint, data[col++]);
        str_to_number(t.bGodSpeedPoint, data[col++]);
        str_to_number(t.bDeathBlowPoint, data[col++]);
        str_to_number(t.bRevivePoint, data[col++]);
        
        sys_log(0, "Monster: %d - %s loaded [Test: Int: %d | Yang-Drop Max: %d | Attack Speed: %d | Movement Speed.: %d]", t.dwVnum, t.szLocaleName, t.bInt, t.dwGoldMax, t.sAttackSpeed, t.sMovingSpeed);

        m_vec_mobTable.push_back(t);
    }
    
    return true;
}

You also have to remove "MirrorMobTableIntoDB" and the call (starting in my ClientManagerBoot.cpp in line 22) and if you want also in the header file :)

 

The same i tried with the item_proto but 3 columns are always 0 ....

 

take a look if you find an error please tell me^^

bool CClientManager::InitializeItemTable()
{
    static const char * query = 
    "SELECT vnum, name, locale_name, type, subtype, weight, size, antiflag,"
    "flag, wearflag, immuneflag, gold, shop_buy_price, refined_vnum,"
    "refine_set, magic_pct, limittype0, limitvalue0, limittype1, limitvalue1,"
    "applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2,"
    "value0, value1, value2, value3, value4, value5, socket0, socket1, socket2,"
    "socket3, socket4, socket5, specular, socket_pct, addon_type FROM item_proto ORDER BY vnum";
    
    std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
    SQLResult * pRes = pkMsg->Get();
    
    if (!pRes->uiNumRows)
    {
        sys_err("Kein Ergebnis aus Item_Proto!");
	return false;
    }
    if (!m_vec_itemTable.empty())
    {
        sys_log(0, "RELOAD: item_proto");
        m_vec_itemTable.clear();
    }
    m_vec_itemTable.reserve(pRes->uiNumRows);

	MYSQL_ROW	data;
	int		col;
    
    while ((data = mysql_fetch_row(pRes->pSQLResult)))
    {
        TItemTable t;
        memset(&t, 0, sizeof(t));

        col = 0;

        str_to_number(t.dwVnum, data[col++]);    
        strlcpy(t.szName, data[col++], sizeof(t.szName));
        strlcpy(t.szLocaleName, data[col++], sizeof(t.szLocaleName));
        str_to_number(t.bType, data[col++]);
        str_to_number(t.bSubType, data[col++]);
        str_to_number(t.bWeight, data[col++]);
        str_to_number(t.bSize, data[col++]);
        str_to_number(t.dwAntiFlags, data[col++]);
        str_to_number(t.dwFlags, data[col++]);
        str_to_number(t.dwWearFlags, data[col++]);
        str_to_number(t.dwImmuneFlag, data[col++]);
        str_to_number(t.dwGold, data[col++]);
        str_to_number(t.dwShopBuyPrice, data[col++]);
        str_to_number(t.dwRefinedVnum, data[col++]);
        str_to_number(t.wRefineSet, data[col++]);
        str_to_number(t.bAlterToMagicItemPct, data[col++]);
        str_to_number(t.aLimits[0].bType, data[col++]);
        str_to_number(t.aLimits[0].lValue, data[col++]);
        str_to_number(t.aLimits[1].bType, data[col++]);
        str_to_number(t.aLimits[1].lValue, data[col++]);
        str_to_number(t.aApplies[0].bType, data[col++]);
        str_to_number(t.aApplies[0].lValue, data[col++]);
        str_to_number(t.aApplies[1].bType, data[col++]);
        str_to_number(t.aApplies[1].lValue, data[col++]);
        str_to_number(t.aApplies[2].bType, data[col++]);
        str_to_number(t.aApplies[2].lValue, data[col++]);
        str_to_number(t.alValues[0], data[col++]);
        str_to_number(t.alValues[1], data[col++]);
        str_to_number(t.alValues[2], data[col++]);
        str_to_number(t.alValues[3], data[col++]);
        str_to_number(t.alValues[4], data[col++]);
        str_to_number(t.alValues[5], data[col++]);
        str_to_number(t.alSockets[0], data[col++]);
        str_to_number(t.alSockets[1], data[col++]);
        str_to_number(t.alSockets[2], data[col++]);
        str_to_number(t.alSockets[3], data[col++]);
        str_to_number(t.alSockets[4], data[col++]);
        str_to_number(t.alSockets[5], data[col++]);
        str_to_number(t.bSpecular, data[col++]);
        str_to_number(t.bGainSocketPct, data[col++]);
        str_to_number(t.sAddonType, data[col++]);

        sys_log(0,"%d %s %d %d %d %d",t.dwVnum, t.szLocaleName,t.dwShopBuyPrice, t.dwRefinedVnum, t.wRefineSet, t.bAlterToMagicItemPct);

        m_vec_itemTable.push_back(t);
    }
    return true;
}

Link to comment
Share on other sites

I made a short tut^^:

At first i want to say: this is not compatible with a table_postfix or item_vnum ranges.

[1] open "ClientManagerBoot.cpp"


8wFhD.png


and make these both if-terms to comments or delete them (in my tree at line 22 - 26 and 34 - 38)

[2] edit the function "CClientManager::InitializeMobTable()" like this:


bool CClientManager::InitializeMobTable()
{
    static const char * query =
                    "SELECT vnum, name, locale_name, rank, type, battle_type, level, size, ai_flag+0, mount_capacity,"
                    "setRaceFlag+0, setImmuneFlag+0, empire, folder, on_click, st, dx, ht, iq, damage_min, damage_max,"
                    "max_hp, regen_cycle, regen_percent, gold_min, gold_max, exp, def, attack_speed, move_speed, aggressive_hp_pct,"
                    "aggressive_sight, attack_range, drop_item, resurrection_vnum, enchant_curse, enchant_slow,"
                    "enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, resist_sword, resist_twohand,"
                    "resist_dagger, resist_bell, resist_fan, resist_bow, resist_fire, resist_elect, resist_magic, resist_wind,"
                    "resist_poison, dam_multiply, summon, drain_sp, mob_color, polymorph_item, skill_level0, skill_vnum0,"
                    "skill_level1, skill_vnum1, skill_level2, skill_vnum2, skill_level3, skill_vnum3, skill_level4, skill_vnum4,"
                    "sp_berserk, sp_stoneskin, sp_godspeed, sp_deathblow, sp_revive FROM mob_proto ORDER BY vnum";
    std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
    SQLResult * pRes = pkMsg->Get();
    
   if (!pRes->uiNumRows)
    {
        sys_err("No result from Mob_Proto!");
        return false;
    }
    if (!m_vec_mobTable.empty())
    {
        sys_log(0, "RELOAD: mob_proto");
        m_vec_mobTable.clear();
    }
    m_vec_mobTable.reserve(pRes->uiNumRows);

    MYSQL_ROW    data;
    int        col;
    
    while ((data = mysql_fetch_row(pRes->pSQLResult)))
    {
        TMobTable t;
        memset(&t, 0, sizeof(t));
        
        col = 0;
        
        str_to_number(t.dwVnum, data[col++]);
        strlcpy(t.szName, data[col++], sizeof(t.szName));
        strlcpy(t.szLocaleName, data[col++], sizeof(t.szLocaleName));
        str_to_number(t.bRank, data[col++]);
        str_to_number(t.bType, data[col++]);
        str_to_number(t.bBattleType, data[col++]);
        str_to_number(t.bLevel, data[col++]);
        str_to_number(t.bSize, data[col++]);
        str_to_number(t.dwAIFlag, data[col++]);
        str_to_number(t.bMountCapacity, data[col++]);
        str_to_number(t.dwRaceFlag, data[col++]);
        str_to_number(t.dwImmuneFlag, data[col++]);
        str_to_number(t.bEmpire, data[col++]);
        strlcpy(t.szFolder, data[col++], sizeof(t.szFolder));
        str_to_number(t.bOnClickType, data[col++]);
        str_to_number(t.bStr, data[col++]);
        str_to_number(t.bDex, data[col++]);
        str_to_number(t.bCon, data[col++]);
        str_to_number(t.bInt, data[col++]);
        str_to_number(t.dwDamageRange[0], data[col++]);
        str_to_number(t.dwDamageRange[1], data[col++]);
        str_to_number(t.dwMaxHP, data[col++]);
        str_to_number(t.bRegenCycle, data[col++]);
        str_to_number(t.bRegenPercent, data[col++]);       
        str_to_number(t.dwGoldMin, data[col++]);
        str_to_number(t.dwGoldMax, data[col++]);
        str_to_number(t.dwExp, data[col++]);        
        str_to_number(t.wDef, data[col++]);   
        str_to_number(t.sAttackSpeed, data[col++]);
        str_to_number(t.sMovingSpeed, data[col++]);
        str_to_number(t.bAggresiveHPPct, data[col++]);
        str_to_number(t.wAggressiveSight, data[col++]);
        str_to_number(t.wAttackRange, data[col++]);
        str_to_number(t.dwDropItemVnum, data[col++]);
        str_to_number(t.dwResurrectionVnum, data[col++]);
        str_to_number(t.cEnchants[0], data[col++]);
        str_to_number(t.cEnchants[1], data[col++]);
        str_to_number(t.cEnchants[2], data[col++]);
        str_to_number(t.cEnchants[3], data[col++]);
        str_to_number(t.cEnchants[4], data[col++]);
        str_to_number(t.cEnchants[5], data[col++]);
        str_to_number(t.cResists[0], data[col++]);
        str_to_number(t.cResists[1], data[col++]);
        str_to_number(t.cResists[2], data[col++]);
        str_to_number(t.cResists[3], data[col++]);
        str_to_number(t.cResists[4], data[col++]);
        str_to_number(t.cResists[5], data[col++]);
        str_to_number(t.cResists[6], data[col++]);
        str_to_number(t.cResists[7], data[col++]);
        str_to_number(t.cResists[8], data[col++]);
        str_to_number(t.cResists[9], data[col++]);
        str_to_number(t.cResists[10], data[col++]);
        str_to_number(t.fDamMultiply, data[col++]);
        str_to_number(t.dwSummonVnum, data[col++]);
        str_to_number(t.dwDrainSP, data[col++]);
        str_to_number(t.dwMobColor, data[col++]);
        str_to_number(t.dwPolymorphItemVnum, data[col++]);
        str_to_number(t.Skills[0].bLevel, data[col++]);
        str_to_number(t.Skills[0].dwVnum, data[col++]);
        str_to_number(t.Skills[1].bLevel, data[col++]);
        str_to_number(t.Skills[1].dwVnum, data[col++]);
        str_to_number(t.Skills[2].bLevel, data[col++]);
        str_to_number(t.Skills[2].dwVnum, data[col++]);
        str_to_number(t.Skills[3].bLevel, data[col++]);
        str_to_number(t.Skills[3].dwVnum, data[col++]);
        str_to_number(t.Skills[4].bLevel, data[col++]);
        str_to_number(t.Skills[4].dwVnum, data[col++]);
        str_to_number(t.bBerserkPoint, data[col++]);
        str_to_number(t.bStoneSkinPoint, data[col++]);
        str_to_number(t.bGodSpeedPoint, data[col++]);
        str_to_number(t.bDeathBlowPoint, data[col++]);
        str_to_number(t.bRevivePoint, data[col++]);
        
        sys_log(0, "Monster: %s loaded", t.szLocaleName);

        m_vec_mobTable.push_back(t);
    }
    
    return true;
}



[3] edit the function "CClientManager::InitializeItemTable()" like this:

bool CClientManager::InitializeItemTable()
{
    /* I needed to make 2 mysql queries because with only 1 there was always a stackoverflow....
     * However^^ It works so idc 
    */
    const char * c_ist_doof = "SELECT refined_vnum, refine_set, magic_pct FROM item_proto ORDER BY vnum";
    SQLMsg* sqlMsg1 = CDBManager::instance().DirectQuery(c_ist_doof);
    
    const char * query = "SELECT vnum, name, locale_name, type, subtype, weight, size, antiflag+0,"
    "flag+0, wearflag+0, immuneflag+0, gold, shop_buy_price, refined_vnum,"
    "refine_set, magic_pct, limittype0, limitvalue0, limittype1, limitvalue1,"
    "applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2,"
    "value0, value1, value2, value3, value4, value5, socket0, socket1, socket2,"
    "socket3, socket4, socket5, specular, socket_pct, addon_type FROM item_proto ORDER BY vnum";
    SQLMsg* sqlMsg = CDBManager::instance().DirectQuery(query);
    
    MYSQL_RES* pRes1 = sqlMsg1->vec_pkResult[0]->pSQLResult;
    MYSQL_RES* pRes = sqlMsg->vec_pkResult[0]->pSQLResult;
    
    if (sizeof(pRes) <= 1 || sizeof(pRes1) <= 1)
    {
        sys_err("Kein Ergebnis aus Item_Proto!");
        return false;
    }
    if (!m_vec_itemTable.empty()) {
        sys_log(0, "Reloading Item_Proto");
        m_vec_itemTable.clear();
    }
    MYSQL_ROW data;
    MYSQL_ROW data1;
    while ((data = mysql_fetch_row(pRes)) && (data1 = mysql_fetch_row(pRes1)))
    {
        TItemTable t;
        TItemTable baum;
        
        str_to_number(baum.dwRefinedVnum, data1[0]);
        str_to_number(baum.wRefineSet, data1[1]);
        str_to_number(baum.bAlterToMagicItemPct, data1[2]);
        
        str_to_number(t.dwVnum, data[0]);   
        strlcpy(t.szName, data[1], sizeof(t.szName));
        strlcpy(t.szLocaleName, data[2], sizeof(t.szLocaleName));
        str_to_number(t.bType, data[3]);
        str_to_number(t.bSubType, data[4]);
        str_to_number(t.bWeight, data[5]);
        str_to_number(t.bSize, data[6]);
        str_to_number(t.dwAntiFlags, data[7]);
        str_to_number(t.dwFlags, data[8]);
        str_to_number(t.dwWearFlags, data[9]);
        str_to_number(t.dwImmuneFlag, data[10]);
        str_to_number(t.dwGold, data[11]);
        str_to_number(t.dwShopBuyPrice,data[12]);
        str_to_number(t.aLimits[0].bType, data[16]);
        str_to_number(t.aLimits[0].lValue, data[17]);
        str_to_number(t.aLimits[1].bType, data[18]);
        str_to_number(t.aLimits[1].lValue, data[19]);
        str_to_number(t.aApplies[0].bType, data[20]);
        str_to_number(t.aApplies[0].lValue, data[21]);
        str_to_number(t.aApplies[1].bType, data[22]);
        str_to_number(t.aApplies[1].lValue, data[23]);
        str_to_number(t.aApplies[2].bType, data[24]);
        str_to_number(t.aApplies[2].lValue, data[25]);
        str_to_number(t.alValues[0], data[26]);
        str_to_number(t.alValues[1], data[27]);
        str_to_number(t.alValues[2], data[28]);
        str_to_number(t.alValues[3], data[29]);
        str_to_number(t.alValues[4], data[30]);
        str_to_number(t.alValues[5], data[31]);
        str_to_number(t.alSockets[0], data[32]);
        str_to_number(t.alSockets[1], data[33]);
        str_to_number(t.alSockets[2], data[34]);
        str_to_number(t.alSockets[3], data[35]);
        str_to_number(t.alSockets[4], data[36]);
        str_to_number(t.alSockets[5], data[37]);
        str_to_number(t.bSpecular, data[38]);
        str_to_number(t.bGainSocketPct, data[39]);
        str_to_number(t.sAddonType, data[40]);        
        t.cLimitRealTimeFirstUseIndex = -1;
        t.cLimitTimerBasedOnWearIndex = -1;
        for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) {
            if (LIMIT_REAL_TIME_START_FIRST_USE == t.aLimits[i].bType)
                t.cLimitRealTimeFirstUseIndex = (char) i;
 
            if (LIMIT_TIMER_BASED_ON_WEAR == t.aLimits[i].bType)
                t.cLimitTimerBasedOnWearIndex = (char) i;
        }
        
        // Conversion
        t.dwRefinedVnum = baum.dwRefinedVnum;
        t.wRefineSet = baum.wRefineSet;
        t.bAlterToMagicItemPct = baum.bAlterToMagicItemPct;
       
        //Debug
        //sys_log(0,"%d %d %d",t.dwRefinedVnum, t.wRefineSet, t.bAlterToMagicItemPct);
        //sys_log(0,"%d %d %d",baum.dwRefinedVnum, baum.wRefineSet, baum.bAlterToMagicItemPct);
        
        m_vec_itemTable.push_back(t);
    }   
    m_map_itemTableByVnum.clear();
    __gnu_cxx::__normal_iterator<SItemTable*, std::vector<SItemTable, std::allocator<SItemTable> > > it = m_vec_itemTable.begin();
    while (it != m_vec_itemTable.end())
    {
        TItemTable * item_table = &(*(it++));    
        sys_log(0,"Item %s geladen", item_table->szLocaleName);        
        m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));
    }
    sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());
    return true;
}



[4] make both functions "bool CClientManager::MirrorMobTableIntoDB()" and "bool CClientManager::MirrorItemTableIntoDB()" to comments or delete them

[5] open "ClientManager.h" and delete or make these functions to comments:


8wGz4.png
(in my tree they are at line 190 and 191)

Thanks to iMer because i use some lines of his code and he had to stand over my skype spam^^

NOTE: If you have different table structures or more columns you want to use, you have to change the functions

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 3
Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...
  • 2 weeks later...

need help

 

SYSERR: Jan 17 23:02:25 :: Start: TABLE_POSTFIX not configured use default
SYSERR: Jan 17 23:02:26 :: Load:  DirectQuery failed(SELECT login FROM block_exception)
SYSERR: Jan 17 23:02:31 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:02:37 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:02:41 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:02:47 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:02:49 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:02:53 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:02:59 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:03:04 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:03:09 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jan 17 23:03:14 :: Process: FDWATCH: peer null in event: ident 21
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 3 months later...

SYSERR: Jul  1 17:29:12 :: pid_init: 
Start of pid: 817

SYSERR: Jul  1 17:29:12 :: Start: TABLE_POSTFIX not configured use default
SYSERR: Jul  1 17:29:12 :: Load:  DirectQuery failed(SELECT IP_FROM, IP_TO, COUNTRY_NAME FROM iptocountry)
SYSERR: Jul  1 17:29:24 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jul  1 17:29:29 :: Process: FDWATCH: peer null in event: ident 21

Link to comment
Share on other sites

  • 4 months later...
On 1/7/2015, 8:42:35, Chris90909090909090 said:

SYSERR: Jul  1 17:29:12 :: pid_init: 
Start of pid: 817

SYSERR: Jul  1 17:29:12 :: Start: TABLE_POSTFIX not configured use default
SYSERR: Jul  1 17:29:12 :: Load:  DirectQuery failed(SELECT IP_FROM, IP_TO, COUNTRY_NAME FROM iptocountry)
SYSERR: Jul  1 17:29:24 :: Process: FDWATCH: peer null in event: ident 21
SYSERR: Jul  1 17:29:29 :: Process: FDWATCH: peer null in event: ident 21

same. help!

Link to comment
Share on other sites

  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.