⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startup.cpp.svn-base

📁 ROSE的源代码。了解的自己研究,编译通过
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
        EquipList[newequip->equiptype].Index[newequip->id] = newequip; // Index to read more quickly the data
    }
    fclose(fh);
    return true;
}

bool CWorldServer::LoadJemItem( )
{
    Log( MSG_LOAD, "Jem Data         " );    
    FILE* fh = NULL;
    fh = fopen("data/jemitem_data.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/jemitem_data.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );
        CJemData* thisjem = new (nothrow) CJemData;
        if(thisjem==NULL)  
        {
            Log(MSG_WARNING, "\nError allocing memory: jemitem" );
            fclose(fh);
            continue;
        }
        thisjem->id = GetUIntValue(",", &line);
        thisjem->type = GetUIntValue(",");
        thisjem->price = GetUIntValue(",");
        thisjem->pricerate = GetUIntValue(",");
        thisjem->weight = GetUIntValue(",");
        thisjem->quality = GetUIntValue(",");
        thisjem->material = GetUIntValue(",");
        char* stat1 = GetStrValue(",");
        char* stat2 = GetStrValue(",");    
        for(int i=0;i<2;i++)
            thisjem->stat1[i] = GetUIntValue("|",i==0?stat1:NULL);
        for(int i=0;i<2;i++)
            thisjem->stat2[i] = GetUIntValue("|",i==0?stat2:NULL);
        JemList.Data.push_back( thisjem );
        JemList.Index[thisjem->id] = thisjem;
    }
    fclose(fh);
    return true;
}

bool CWorldServer::LoadNaturalItem( )
{
    Log( MSG_LOAD, "Natural Data         " );    
    FILE* fh = NULL;
    fh = fopen("data/natural_data.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/natural_data.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );
        CNaturalData* thisnatural = new (nothrow) CNaturalData;
        if(thisnatural==NULL)
        {
            Log(MSG_WARNING, "\nError allocing memory: natural" );
            fclose(fh);
            return false;
        }
        thisnatural->id = GetUIntValue(",", &line);
        thisnatural->type = GetUIntValue(",");
        thisnatural->price = GetUIntValue(",");
        thisnatural->pricerate = GetUIntValue(",");
        thisnatural->weight = GetUIntValue(",");
        thisnatural->quality = GetUIntValue(",");
        thisnatural->pricevalue = GetUIntValue(",");
        NaturalList.Data.push_back( thisnatural );
        NaturalList.Index[thisnatural->id] = thisnatural;
    }
    fclose(fh);   
    return true;
}

bool CWorldServer::LoadPatItem( )
{
    Log( MSG_LOAD, "Consumible Data         " );    
    FILE* fh = NULL;
    fh = fopen("data/pat_data.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/pat_data.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );
        CPatData* newpat = new (nothrow) CPatData;
        if(newpat==NULL)
        {
            Log(MSG_WARNING, "\nError allocing memory: pat" );
            fclose(fh);
            return false;
        }
        newpat->id = GetUIntValue(",", &line);
        newpat->type = GetUIntValue(",");
        newpat->price = GetUIntValue(",");
        newpat->pricerate = GetUIntValue(",");
        newpat->weight = GetUIntValue(",");
        newpat->quality = GetUIntValue(",");
        newpat->material = GetUIntValue(",");
        newpat->partversion = GetUIntValue(",");
        newpat->maxfuel = GetUIntValue(",");
        newpat->fuelcons = GetUIntValue(",");
        newpat->speed = GetUIntValue(",");
        newpat->attackdistance = GetUIntValue(",");
        newpat->attackpower = GetUIntValue(",");
        newpat->attackspeed = GetUIntValue(",");
        PatList.Data.push_back( newpat );
        PatList.Index[newpat->id] = newpat;
    }               
    fclose(fh);
    return true;    
}

bool CWorldServer::LoadProductItem( )
{
    Log( MSG_LOAD, "Product Data         " );        
    FILE* fh = NULL;
    fh = fopen("data/product_data.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/product_data.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );
        CProductData* newproduct = new (nothrow) CProductData;
        if(newproduct==NULL)
        {
            Log(MSG_WARNING, "\nError allocing memory: product" );
            fclose(fh);
            return false;
        }
        newproduct->id = GetUIntValue(",", &line);
        char* items = GetStrValue(",");
        char* amount = GetStrValue(",");
        for(int i=0;i<50;i++)
            newproduct->item[i] = GetUIntValue("|",i==0?items:NULL);
        for(int i=0;i<50;i++)
            newproduct->amount[i] = GetUIntValue("|",i==0?amount:NULL);
        ProductList.Data.push_back( newproduct );
        ProductList.Index[newproduct->id] = newproduct;     
    }
    fclose(fh);
    return true;
}

bool CWorldServer::LoadSellData( )
{
    Log( MSG_LOAD, "Sell Data         " );        
    FILE* fh = NULL;
    fh = fopen("data/sell_data.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/sell_data.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );        
        CCSellData* newsell = new (nothrow) CCSellData;
        if(newsell==NULL)
        {
            Log(MSG_WARNING, "\nError Allocing memory: sell" );
            fclose(fh);
            return false;
        }
        newsell->id = GetUIntValue(",", &line);
        char *items = GetStrValue(",");
        for(int i=0;i<48;i++)
            newsell->item[i] = GetUIntValue("|",i==0?items:NULL);
        SellList.Data.push_back( newsell );
        SellList.Index[newsell->id] = newsell;     
    }    
    fclose(fh);
    return true;    
}

bool CWorldServer::LoadConsItem( )
{
    Log( MSG_LOAD, "Consumible Data         " );    
    FILE* fh = NULL;
    fh = fopen("data/useitem_data.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/useitem_data.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );
        CUseData* newuse = new (nothrow) CUseData;
        if(newuse==NULL)
        {
            Log(MSG_WARNING, "\nError allocing memory: use" );
            fclose(fh);
            return false;
        }
        newuse->id = GetUIntValue(",", &line);
        newuse->restriction = GetUIntValue(",");
        newuse->type = GetUIntValue(",");
        newuse->price = GetUIntValue(",");
        newuse->pricerate = GetUIntValue(",");
        newuse->weight = GetUIntValue(",");
        newuse->quality = GetUIntValue(",");
        newuse->pricevalue = GetUIntValue(",");        
        char* usecondition = GetStrValue(",");
        char* useeffect = GetStrValue(",");  
        for(int i=0;i<2;i++)
            newuse->usecondition[i] = GetUIntValue("|",i==0?usecondition:NULL);
        for(int i=0;i<2;i++)
            newuse->useeffect[i] = GetUIntValue("|",i==0?useeffect:NULL);
        UseList.Data.push_back( newuse );
        UseList.Index[newuse->id] = newuse;           
    }        
    fclose(fh);
    return true;    
}

bool CWorldServer::LoadZoneData( )
{
    Log( MSG_LOAD, "Zone Data                   " );
    FILE* fh = fopen( "data/zone_data.csv", "r" );
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/zone_data.csv" );
        return false;
    }
    char line[500];
    fgets( line, 500, fh );// this is the column name
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );
        CMap* newzone = new (nothrow) CMap( );
        if(newzone==NULL)
        {
            Log(MSG_WARNING, "\nError allocing memory: CMap" );
            fclose(fh);
            return false;
        }
        newzone->id = GetUIntValue(",", &line);
        newzone->dayperiod = GetUIntValue(",");     
        newzone->morningtime = GetUIntValue(",");
        newzone->daytime = GetUIntValue(",");
        newzone->eveningtime = GetUIntValue(",");
        newzone->nighttime = GetUIntValue(",");
        newzone->allowpvp = GetUIntValue(",");
        newzone->allowpat = GetUIntValue(",")==0?true:false;
        newzone->ghost = GetUIntValue(","); 
        
        //LMA begin
        //CF Mode
        //20070621-211100
        //map is cf (for jelly bean)
       newzone->is_cf=GetUIntValue(",");
       newzone->id_temp_mon = 0;
       newzone->id_def_mon = 0;
       newzone->min_lvl = 0;
       newzone->mon_lvl = 0;
       newzone->mon_exp = 0;
       newzone->percent=0;
       
       //mode 1: one monster temporarily, then the "real" one :)
        if (newzone->is_cf==1)
        {
           Log( MSG_INFO, "Map %u is CF mode 1 !",newzone->id);
           newzone->min_lvl = GetUIntValue(",");
           newzone->id_temp_mon = GetUIntValue(",");
           newzone->id_def_mon = GetUIntValue(",");
           newzone->mon_lvl = GetUIntValue(",");
           newzone->mon_exp = GetUIntValue(",");
           newzone->percent = GetUIntValue(",");
        }
        else
        {
            newzone->is_cf=0;
        }
        //LMA end
        
        newzone->MapTime = 0;
        newzone->LastUpdate = clock( );
        newzone->CurrentTime = 0;
        newzone->MonsterSpawnList.clear();
        MapList.Map.push_back(newzone);
        MapList.Index[newzone->id] = newzone;  
    }         
    fclose(fh);
    return true;    
}

bool CWorldServer::LoadItemStats( )
{
    Log( MSG_LOAD, "Item Stats         " );    
    FILE* fh = NULL;
    fh = fopen("data/stat.csv", "r");
    if(fh==NULL)
    {
        Log(MSG_ERROR, "\nError loading file data/stat.csv" );
        return false;
    }    
    char line[500];
    fgets( line, 500, fh );// this is the column name    
    while(!feof(fh))
    {        
        memset( &line, '\0', 500 );
        fgets( line, 500, fh );    
        UINT id = GetUIntValue(",", &line );
        if(id>499) continue;
        StatsList[id].stat[0] = GetUIntValue(",");
        StatsList[id].value[0] = GetUIntValue(",");        
        StatsList[id].stat[1] = GetUIntValue(",");
        StatsList[id].value[1] = GetUIntValue(",");                
    }
    fclose(fh);
    return true;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -