Jump to content

[C++]Anti EXP Party Extension


Recommended Posts

Hi,

I have extended the Anti EXP 'System' for party scenarios.
When sharing EXP as a party, members with Anti EXP enabled will be excluded from the share and the experience points that player misses will be shared across the other party members.

Parties have the feature of a set experience bonus which, by default, ranges from 12% - 100% based on the count of members in range of the party leader.
Players will be excluded from the member count when Anti EXP is enabled, this way you can't just create a full-house party and funnel all the EXP + the 100% bonus to one player.

I am scripting on top of this piece of work.

Spoiler
CommonDefines/Service.h (whatever you use)
  #define ANTIEXP_GROUP_EX
  
char_battle.cpp
    struct FPartyTotaler
    {
        int        total;
        int        member_count;
        int        x, y;
        FPartyTotaler(LPCHARACTER center)
            : total(0), member_count(0), x(center->GetX()), y(center->GetY())
        {};
        void operator () (LPCHARACTER ch)
        {
            if (DISTANCE_APPROX(ch->GetX() - x, ch->GetY() - y) <= PARTY_DEFAULT_RANGE)
            {
#ifdef ANTIEXP_GROUP_EX
                if (!ch->block_exp)
                {
                    total += __GetPartyExpNP(ch->GetLevel());
                    ++member_count;
                }
#else
                total += __GetPartyExpNP(ch->GetLevel());
                ++member_count;
#endif
            }
        }
    };

party.cpp
  int CParty::ComputePartyBonusExpPercent()
  {
    if (GetNearMemberCount() <= 1)
        return 0;
    LPCHARACTER leader = GetLeaderCharacter();
    int iBonusPartyExpFromItem = 0;
    // UPGRADE_PARTY_BONUS
    int iMemberCount=MIN(8, GetNearMemberCount());
#ifdef ANTIEXP_GROUP_EX
    //reduce member count for exp bonus when members have anti-exp enabled and are in range
    for (TMemberMap::iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it)
    {
        TMember& rMember = it->second;
        if (rMember.pCharacter && rMember.pCharacter->block_exp && rMember.bNear)
            iMemberCount -= 1;
    }
#endif
    if (leader && (leader->IsEquipUniqueItem(UNIQUE_ITEM_PARTY_BONUS_EXP) || leader->IsEquipUniqueItem(UNIQUE_ITEM_PARTY_BONUS_EXP_MALL)
        || leader->IsEquipUniqueItem(UNIQUE_ITEM_PARTY_BONUS_EXP_GIFT) || leader->IsEquipUniqueGroup(10010)))
    {
        
        iBonusPartyExpFromItem = 30;
    }
    return iBonusPartyExpFromItem + CHN_aiPartyBonusExpPercentByMemberCount[iMemberCount];
    // END_OF_UPGRADE_PARTY_BONUS
  }

 

 

  • Metin2 Dev 1
  • Good 6
Link to comment
Share on other sites

9 hours ago, Sogma said:

 

  Hide contents
#ifdef ANTIEXP_GROUP_EX
                if (!ch->block_exp)
                {
                    total += __GetPartyExpNP(ch->GetLevel());
                    ++member_count;
                }
#else
                total += __GetPartyExpNP(ch->GetLevel());
                ++member_count;
#endif

 

 

care to explain? the if condition seems rather redundant.

Edited by covfefe
  • Metin2 Dev 1
Link to comment
Share on other sites

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.