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

📄 playerstats.cpp.svn-base

📁 ROSE的源代码。了解的自己研究,编译通过
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
        break;        
    }
    for(UINT i=1;i<12;i++)//cloth stats [from tomiz]
    {
        if( items[i].count != 0 )
        {
            if(items[i].itemtype>9)
            {
                Log(MSG_WARNING, "Char %s have equip invalid item: %i,%i", CharInfo->charname, items[i].itemtype, items[i].itemnum );
                continue;
            }            
            if( GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[0] == A_HASTE)
            {
                aspeed += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[1];
            }
            if( GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[0] == A_HASTE)
            {
                aspeed += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[1];
            }
            if(items[i].gem!=0)
            {
                if(GServer->JemList.Index[items[i].gem]!=NULL)
                {
                    if( GServer->JemList.Index[items[i].gem]->stat1[0] == ATTACK_SPEED)
                    {
                        aspeed += GServer->JemList.Index[items[i].gem]->stat1[1];
                    }
                    if( GServer->JemList.Index[items[i].gem]->stat2[0] == ATTACK_SPEED)
                    {
                        aspeed += GServer->JemList.Index[items[i].gem]->stat2[1];
                    }                    
                }
            }    
            if(items[i].stats>0 && items[i].stats<500)
            {
                if(GServer->StatsList[items[i].stats].stat[0] == A_HASTE)
                    aspeed += GServer->StatsList[items[i].stats].value[0];
                if(GServer->StatsList[items[i].stats].stat[1] == A_HASTE)
                    aspeed += GServer->StatsList[items[i].stats].value[1];
            }                         
        }
    }     
    if(Status->Haste_up!=0xff)
        aspeed += MagicStatus[Status->Haste_up].Value;
    if(Status->Haste_down!=0xff)
        aspeed -= MagicStatus[Status->Haste_down].Value;        
    return aspeed;    
}

// Return Movement Speed
unsigned int CPlayer::GetMoveSpeed( )
{
	UINT mspeed = 425;  
	
    if(!Status->CanRun)
        Status->Stance = WALKING;
    switch(Status->Stance)
    {
        case WALKING: //walking
            mspeed = 200;
        break;
        case 1:
        case RUNNING: // running
        {
            if( items[6].count != 0 )//Foot
            {
                UINT tspeed = GServer->EquipList[SHOE].Index[items[6].itemnum]->movespeed;                
        		 mspeed += ( tspeed - 65 ) * 5;
            }
            for(UINT i=0;i<12;i++)//cloth stats [from tomiz]
            {
                if( items[i].count != 0 )
                {
                    if(items[i].itemtype>9)
                    {
                        Log(MSG_WARNING, "Char %s have equip invalid item: %i,%i", CharInfo->charname, items[i].itemtype, items[i].itemnum );
                        continue;
                    }                    
                    if( GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[0] == MOVE_SPEED)
                    {
                        mspeed += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[1];
                    }
                    if( GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[0] == MOVE_SPEED)
                    {
                       mspeed += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[1];
                    }
                }
                if(items[i].stats>0 && items[i].stats<500)
                {
                    if(GServer->StatsList[items[i].stats].stat[0] == A_DASH)
                        mspeed += GServer->StatsList[items[i].stats].value[0];
                    if(GServer->StatsList[items[i].stats].stat[1] == A_DASH)
                        mspeed += GServer->StatsList[items[i].stats].value[1];
                }                 
            }
            for(UINT i=0;i<MAX_SKILL;i++)
            {
                if( cskills[i].id == 0 || cskills[i].thisskill == 0 )
                    continue;
                if( cskills[i].thisskill->type == 15 ) //Pasive
                {         
                    for( UINT j=0;j<3;j++ )
                    {
                        if( cskills[i].thisskill->buff[j] == MOV_SPEED || cskills[i].thisskill->buff[j] == A_DASH ) 
                        {
                            if( cskills[i].thisskill->value2[j] > 0 )
                                mspeed += mspeed * cskills[i].thisskill->value2[j] / 100;
                            if( cskills[i].thisskill->value1[j] > 0 )
                            {
                                mspeed += cskills[i].thisskill->value1[j];
                            }
                        }
                    }
                }
            }    
            if(Fairy)  mspeed = (unsigned int)floor(mspeed*1.2);                                      
            if(Status->Dash_up!=0xff)
                mspeed += MagicStatus[Status->Dash_up].Value;
            if(Status->Dash_down!=0xff)
                mspeed -= MagicStatus[Status->Dash_down].Value;                 
        }
        break;
        case DRIVING: //cart
        {
            UINT porc = 1;
            UINT nb_parts=0;
            float lma_speed;
            
            //LMA: new algo for mspeed calculation...
            for (int k=135;k<140;k++)
            {
                 if(items[k].itemnum!=0&&GServer->PatList.Index[items[k].itemnum]->speed>0)
                 {
                    nb_parts++;
                    porc = porc * GServer->PatList.Index[items[k].itemnum]->speed;
                 }
                
            }
            
            if (nb_parts>0)
            {
               lma_speed=floor(porc*1000/(pow(100,nb_parts)));
            }
            
            //add ons (ability)
            switch (items[138].itemnum)
            {
                   case 401:
                        lma_speed+=100;
                        break;
                   case 402:
                        lma_speed+=120;
                        break;
                   case 403:
                        lma_speed+=130;
                        break;
                   case 404:
                        lma_speed+=150;
                        break;
                   case 601:
                        lma_speed+=100;
                        break;
                   default:
                        break;
            }
            
            mspeed= (UINT) lma_speed;
                           
        }
        break;
    }
     
    return mspeed;
}

// Return Max HP
unsigned int CPlayer::GetMaxHP( )
{
	if (Stats->Level<1) Stats->Level=1;
	unsigned int hpmax = (unsigned int)floor(((sqrt(Stats->Level + 20) * (Stats->Level + 5 )) * 3.5) + ((Attr->Str + Attr->Estr) << 1));  	
    switch( CharInfo->Job )
    {
        case 121:case 122:
        case 221:case 222:
        case 321:case 322:
        case 421:case 422:
            hpmax += 300;
        break;
    }
    for(UINT i=0;i<MAX_SKILL;i++)
    {
        if( cskills[i].id == 0 || cskills[i].thisskill == 0 )
            continue;
        if( cskills[i].thisskill->type == 15 ) //Pasive
        {         
            for(UINT j=0;j<3;j++ )
            {   // Passive skill fixed by Kirk
                if( cskills[i].thisskill->buff[j] == A_MAX_HP || cskills[i].thisskill->buff[j] == A_HP || cskills[i].thisskill->buff[j] == MAX_HP)
                {
                    if( cskills[i].thisskill->value2[j] > 0 )
                        hpmax += hpmax * cskills[i].thisskill->value2[j] / 100;
                    if( cskills[i].thisskill->value1[j] > 0 )
                        hpmax += cskills[i].thisskill->value1[j];
                }
            }
        }
    } 
    for(UINT i=1;i<12;i++)//cloth stats [from tomiz]
    {
        if( items[i].count != 0 )
        {
            if(items[i].itemtype>9)
            {
                Log(MSG_WARNING, "Char %s have equip invalid item: %i,%i", CharInfo->charname, items[i].itemtype, items[i].itemnum );
                continue;
            }            
            if( GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[0] == A_MAX_HP || GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[0] == A_HP )
            {
                hpmax += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[1];
            }
            if( GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[0] == A_MAX_HP || GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[0] == A_HP )
            {
                hpmax += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[1];
            }
            if(items[i].stats>0 && items[i].stats<500)
            {
                if(GServer->StatsList[items[i].stats].stat[0] == A_MAX_HP || GServer->StatsList[items[i].stats].stat[0] == A_HP)
                    hpmax += GServer->StatsList[items[i].stats].value[0];
                if(GServer->StatsList[items[i].stats].stat[1] == A_MAX_HP || GServer->StatsList[items[i].stats].stat[0] == A_HP)
                    hpmax += GServer->StatsList[items[i].stats].value[1];
            }                
        }
    }        
    if(Fairy) hpmax = (unsigned int)floor(hpmax*1.2); 
    if(Status->HP_up!=0xff)
        hpmax += MagicStatus[Status->HP_up].Value;
    if(Status->HP_down!=0xff)
        hpmax -= MagicStatus[Status->HP_down].Value;    
                    
    return hpmax;
}
// Return Max MP  [fixed by Tomiz] TODO: add cloth stat
unsigned int CPlayer::GetMaxMP( )
{

    if( Stats->Level < 0 )
        Stats->Level = 1;
    UINT maxmp = 0;
    float Mult = 0;
    int JobValue = (int)CharInfo->Job;
    switch(JobValue)
    {
        case 111:
        case 411:
        case 421:
            Mult = 4;
            JobValue = 3;
        break;
        case 122:
            Mult = 5;
            JobValue = -6;
        break;
        case 211:
            Mult = 6;
            JobValue = 0;
        break;
        case 221:
            Mult = 7;
            JobValue = -7;
        break;
        case 222:
            Mult = 6.5;
            JobValue = -4;
        break;
        case 311:
        case 321:
            Mult = 4;
            JobValue = 4; //LMA
        break;
        case 121:
        case 322:
        case 422:
            Mult = 4.5;
            JobValue = 0;
        break;
        default:
            Mult = 3;
            JobValue = 4;
        break;           
    }
    maxmp = (UINT)floor((Stats->Level + JobValue) * Mult + ((Attr->Int + Attr->Eint) << 2)); 
    
       
    for(UINT i=0;i<MAX_SKILL;i++)
    {
        if( cskills[i].id == 0 || cskills[i].thisskill == 0 )
            continue;
        if( cskills[i].thisskill->type == 15 ) //Pasive
        {         
            for(UINT j=0;j<3;j++ )
            {   // Passive skill fixed by Kirk
                if( cskills[i].thisskill->buff[j] == A_MAX_MP || cskills[i].thisskill->buff[j] == A_MP || cskills[i].thisskill->buff[j] == MAX_MP)
                {
                    if( cskills[i].thisskill->value2[j] > 0 )
                        maxmp += maxmp * cskills[i].thisskill->value2[j] / 100;
                    if( cskills[i].thisskill->value1[j] > 0 )
                        maxmp += cskills[i].thisskill->value1[j];
                }
            }
        }
    }
        
    for(UINT i=1;i<12;i++)//cloth stats [from tomiz]
    {
        if( items[i].count != 0 )
        {
            if(items[i].itemtype>9)

⌨️ 快捷键说明

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