Înlătură notificare
Bun venit pe all4games.ro, Vizitator.
Distribuie şi tu această comunitate pentru a devenii mai cunoscută. Dacă ai tutoriale şi/sau resurse, nu ezita să le postezi şi aici. Mulţumim!
Înregistrare sau logare.

C++ Fix HP si MP overflow

Discuție în 'C++ / DIFF / Surse' creată de Gigiz, 19 Apr 2018.

  1. Gigiz

    Gigiz
    Administrator
    Membru personal

    Înscris:
    15 Mar 2016
    Mesaje:
    305
    Aprecieri primite:
    124
    Aprecieri oferite:
    6
    Intră în Srcs/Server/game/src/char.cpp şi caută:
    COD:
    Select All
    void CHARACTER::ComputePoints()
    Înlocuieşte funcţia cu :
    COD:
    Select All
    void CHARACTER::ComputePoints()
    {
        
    long lStat GetPoint(POINT_STAT);
        
    long lStatResetCount GetPoint(POINT_STAT_RESET_COUNT);
        
    long lSkillActive GetPoint(POINT_SKILL);
        
    long lSkillSub GetPoint(POINT_SUB_SKILL);
        
    long lSkillHorse GetPoint(POINT_HORSE_SKILL);
        
    long lLevelStep GetPoint(POINT_LEVEL_STEP);

        
    long lAttackerBonus GetPoint(POINT_PARTY_ATTACKER_BONUS);
        
    long lTankerBonus GetPoint(POINT_PARTY_TANKER_BONUS);
        
    long lBufferBonus GetPoint(POINT_PARTY_BUFFER_BONUS);
        
    long lSkillMasterBonus GetPoint(POINT_PARTY_SKILL_MASTER_BONUS);
        
    long lHasteBonus GetPoint(POINT_PARTY_HASTE_BONUS);
        
    long lDefenderBonus GetPoint(POINT_PARTY_DEFENDER_BONUS);

        
    long lHPRecovery GetPoint(POINT_HP_RECOVERY);
        
    long lSPRecovery GetPoint(POINT_SP_RECOVERY);

        
    memset(m_pointsInstant.points0sizeof(m_pointsInstant.points));
        
    BuffOnAttr_ClearAll();
        
    m_SkillDamageBonus.clear();

        
    SetPoint(POINT_STATlStat);
        
    SetPoint(POINT_SKILLlSkillActive);
        
    SetPoint(POINT_SUB_SKILLlSkillSub);
        
    SetPoint(POINT_HORSE_SKILLlSkillHorse);
        
    SetPoint(POINT_LEVEL_STEPlLevelStep);
        
    SetPoint(POINT_STAT_RESET_COUNTlStatResetCount);

        
    SetPoint(POINT_STGetRealPoint(POINT_ST));
        
    SetPoint(POINT_HTGetRealPoint(POINT_HT));
        
    SetPoint(POINT_DXGetRealPoint(POINT_DX));
        
    SetPoint(POINT_IQGetRealPoint(POINT_IQ));

        
    SetPart(PART_MAINGetOriginalPart(PART_MAIN));
        
    SetPart(PART_WEAPONGetOriginalPart(PART_WEAPON));
        
    SetPart(PART_HEADGetOriginalPart(PART_HEAD));
        
    SetPart(PART_HAIRGetOriginalPart(PART_HAIR));

        
    SetPoint(POINT_PARTY_ATTACKER_BONUSlAttackerBonus);
        
    SetPoint(POINT_PARTY_TANKER_BONUSlTankerBonus);
        
    SetPoint(POINT_PARTY_BUFFER_BONUSlBufferBonus);
        
    SetPoint(POINT_PARTY_SKILL_MASTER_BONUSlSkillMasterBonus);
        
    SetPoint(POINT_PARTY_HASTE_BONUSlHasteBonus);
        
    SetPoint(POINT_PARTY_DEFENDER_BONUSlDefenderBonus);

        
    SetPoint(POINT_HP_RECOVERYlHPRecovery);
        
    SetPoint(POINT_SP_RECOVERYlSPRecovery);

        
    SetPoint(POINT_PC_BANG_EXP_BONUS0);
        
    SetPoint(POINT_PC_BANG_DROP_BONUS0);

        
    int iMaxHPiMaxSP;
        
    int iMaxStamina;

        if(
    IsPC())
        {
            
    iMaxHP JobInitialPoints[GetJob()].max_hp m_points.iRandomHP GetPoint(POINT_HT) * JobInitialPoints[GetJob()].hp_per_ht;
            
    iMaxSP JobInitialPoints[GetJob()].max_sp m_points.iRandomSP GetPoint(POINT_IQ) * JobInitialPoints[GetJob()].sp_per_iq;
            
    iMaxStamina JobInitialPoints[GetJob()].max_stamina GetPoint(POINT_HT) * JobInitialPoints[GetJob()].stamina_per_con;

            {
                
    CSkillProtopkSk CSkillManager::instance().Get(SKILL_ADD_HP);

                if(
    NULL != pkSk)
                {
                    
    pkSk->SetPointVar("k"1.0f GetSkillPower(SKILL_ADD_HP) / 100.0f);

                    
    iMaxHP += static_cast<int>(pkSk->kPointPoly.Eval());
                }
            }

            
    // default value
            
    SetPoint(POINT_MOV_SPEED100);
            
    SetPoint(POINT_ATT_SPEED100);
            
    PointChange(POINT_ATT_SPEEDGetPoint(POINT_PARTY_HASTE_BONUS));
            
    SetPoint(POINT_CASTING_SPEED100);
        }
        else
        {
            
    iMaxHP m_pkMobData->m_table.dwMaxHP;
            
    iMaxSP 0;
            
    iMaxStamina 0;

            
    SetPoint(POINT_ATT_SPEEDm_pkMobData->m_table.sAttackSpeed);
            
    SetPoint(POINT_MOV_SPEEDm_pkMobData->m_table.sMovingSpeed);
            
    SetPoint(POINT_CASTING_SPEEDm_pkMobData->m_table.sAttackSpeed);
        }

        if(
    IsPC())
        {
            if(
    GetMountVnum())
            {
                if(
    GetHorseST() > GetPoint(POINT_ST))
                    
    PointChange(POINT_STGetHorseST() - GetPoint(POINT_ST));

                if(
    GetHorseDX() > GetPoint(POINT_DX))
                    
    PointChange(POINT_DXGetHorseDX() - GetPoint(POINT_DX));

                if(
    GetHorseHT() > GetPoint(POINT_HT))
                    
    PointChange(POINT_HTGetHorseHT() - GetPoint(POINT_HT));

                if(
    GetHorseIQ() > GetPoint(POINT_IQ))
                    
    PointChange(POINT_IQGetHorseIQ() - GetPoint(POINT_IQ));
            }

        }

        
    ComputeBattlePoints();

        if(
    iMaxHP != GetMaxHP())
        {
            
    SetRealPoint(POINT_MAX_HPiMaxHP);
        }

        
    PointChange(POINT_MAX_HP0);

        if(
    iMaxSP != GetMaxSP())
        {
            
    SetRealPoint(POINT_MAX_SPiMaxSP);
        }

        
    PointChange(POINT_MAX_SP0);

        
    SetMaxStamina(iMaxStamina);

        
    m_pointsInstant.dwImmuneFlag 0;

        for(
    int i 0WEAR_MAX_NUMi++)
        {
            
    LPITEM pItem GetWear(i);
            if(
    pItem)
            {
                
    pItem->ModifyPoints(true);
                
    SET_BIT(m_pointsInstant.dwImmuneFlagGetWear(i)->GetImmuneFlag());
            }
        }

        if(
    DragonSoul_IsDeckActivated())
        {
            for(
    int i WEAR_MAX_NUM DS_SLOT_MAX DragonSoul_GetActiveDeck();
                
    WEAR_MAX_NUM DS_SLOT_MAX * (DragonSoul_GetActiveDeck() + 1); i++)
            {
                
    LPITEM pItem GetWear(i);
                if(
    pItem)
                {
                    if(
    DSManager::instance().IsTimeLeftDragonSoul(pItem))
                        
    pItem->ModifyPoints(true);
                }
            }
        }

        
    UpdatePacket();

        
    ComputeSkillPoints();

        
    RefreshAffect();

        
    CPetSystempPetSystem GetPetSystem();
        if(
    NULL != pPetSystem)
        {
            
    pPetSystem->RefreshBuff();
        }

        for(
    TMapBuffOnAttrs::iterator it m_map_buff_on_attrs.begin(); it != m_map_buff_on_attrs.end(); it++)
        {
            
    it->second->GiveAllAttributes();
        }
      
        if(
    GetHP() > GetMaxHP())
            
    PointChange(POINT_HPGetMaxHP() - GetHP());
      
        if(
    GetSP() > GetMaxSP())
            
    PointChange(POINT_SPGetMaxSP() - GetSP());

        
    UpdatePacket();
    }
    Sursa: J4M
     

Distribuie pagina asta