• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

No exp from same IP when killing another player

its look work but we can make small edit to close function
after
Player* attackerPlayer = attacker->getPlayer();
if(!attackerPlayer || attackerPlayer == this){
return 0;
}
add
if(attackerPlayer->getIP() == getIP() && !g_config.getBool(ConfigManager::GAIN_EXP_FROM_SAME_IP)))
{
return 0;
}
 
Last edited:
Lua:
player.cpp: In member function ‘virtual double Player::getGainedExperience(Creature*) const’:
player.cpp:3552:98: error: expected primary-expression before ‘)’ token
 if(attackerPlayer->getIP() == getIP() && !g_config.getBool(ConfigManager::GAIN_EXP_FROM_SAME_IP)))
                                                                                                  ^
player.cpp:3552:98: error: expected ‘;’ before ‘)’ token
make[1]: *** [player.o] Error 1
make[1]: Leaving directory `/home/total/sources/src'
make: *** [all] Error 2
 
remove )
if(attackerPlayer->getIP() == getIP() && !g_config.getBool(ConfigManager::GAIN_EXP_FROM_SAME_IP))
 
Lua:
double Player::getGainedExperience(Creature* attacker) const
{
    if(!skillLoss)
        return 0;

    double rate = g_config.getDouble(ConfigManager::RATE_PVP_EXPERIENCE);
    if(rate <= 0)
        return 0;

Player* attackerPlayer = attacker->getPlayer();
if(!attackerPlayer || attackerPlayer == this){
return 0;
}

if(attackerPlayer->getIP() == getIP() && !g_config.getBool(ConfigManager::GAIN_EXP_FROM_SAME_IP))
{
return 0;
}
 
Lua:
bool Player::gainExperience(double& gainExp, bool fromMonster)
{
    if(!rateExperience(gainExp, fromMonster))
        return false;

    //soul regeneration
    if(gainExp >= level)
    {
        if(Condition* condition = Condition::createCondition(
            CONDITIONID_DEFAULT, CONDITION_SOUL, 4 * 60 * 1000))
        {
            condition->setParam(CONDITIONPARAM_SOULGAIN,
                vocation->getGainAmount(GAIN_SOUL));
            condition->setParam(CONDITIONPARAM_SOULTICKS,
                (vocation->getGainTicks(GAIN_SOUL) * 1000));
            addCondition(condition);
        }
    }

    addExperience((uint64_t)gainExp);
    return true;
}
 
change all bool fromMonster for Creature* target
and fromMonster for target
in player.cpp and h
creature.cpp and h
party.cpp and h
 
Lua:
player.cpp:3964:6: error: prototype for ‘bool Player::gainExperience(double&, Creature*)’ does not match any in class ‘Player’
 bool Player::gainExperience(double& gainExp, Creature* target)
      ^
In file included from player.cpp:20:0:
player.h:1049:8: error: candidate is: bool Player::gainExperience(double&, bool)
   bool gainExperience(double& gainExp, bool fromMonster);
        ^
player.cpp:3987:6: error: prototype for ‘bool Player::rateExperience(double&, Creature*)’ does not match any in class ‘Player’
 bool Player::rateExperience(double& gainExp, Creature* target)
      ^
In file included from player.cpp:20:0:
player.h:1050:8: error: candidate is: bool Player::rateExperience(double&, bool)
   bool rateExperience(double& gainExp, bool fromMonster);
        ^
player.cpp:4016:6: error: prototype for ‘void Player::onGainExperience(double&, Creature*, bool)’ does not match any in class ‘Player’
 void Player::onGainExperience(double& gainExp, Creature* target, bool multiplied)
      ^
In file included from player.cpp:20:0:
player.h:649:16: error: candidate is: virtual void Player::onGainExperience(double&, bool, bool)
   virtual void onGainExperience(double& gainExp, bool fromMonster, bool multiplied);
                ^
player.cpp:4029:6: error: prototype for ‘void Player::onGainSharedExperience(double&, Creature*, bool)’ does not match any in class ‘Player’
 void Player::onGainSharedExperience(double& gainExp, Creature* target, bool)
      ^
In file included from player.cpp:20:0:
player.h:650:16: error: candidate is: virtual void Player::onGainSharedExperience(double&, bool, bool)
   virtual void onGainSharedExperience(double& gainExp, bool fromMonster, bool multiplied);
                ^
make[1]: *** [player.o] Error 1
make[1]: Leaving directory `/home/total/sources/src'
make: *** [all] Error 2
 
Lua:
change

bool Player::gainExperience(double& gainExp, bool fromMonster)

for

bool Player::gainExperience(double& gainExp, Creature* target)



if(!rateExperience(gainExp, fromMonster))

for

if(!rateExperience(gainExp, target))



bool Player::rateExperience(double& gainExp, bool fromMonster)

for

bool Player::rateExperience(double& gainExp, Creature* target)



    if(!fromMonster)

        return true;

for

    if(target->getPlayer())

        return true;



void Player::eek:nGainExperience(double& gainExp, bool fromMonster, bool multiplied)

{

    if(party && party->isSharedExperienceEnabled() && party->isSharedExperienceActive())

    {

        party->shareExperience(gainExp, fromMonster, multiplied);

        rateExperience(gainExp, fromMonster);

        return; //we will get a share of the experience through the sharing mechanism

    }



    if(gainExperience(gainExp, fromMonster))

        Creature::eek:nGainExperience(gainExp, fromMonster, true);

}



for

void Player::eek:nGainExperience(double& gainExp, Creature* target, bool multiplied)

{

    if(party && party->isSharedExperienceEnabled() && party->isSharedExperienceActive())

    {

        party->shareExperience(gainExp, target, multiplied);

        rateExperience(gainExp, target);

        return; //we will get a share of the experience through the sharing mechanism

    }



    if(gainExperience(gainExp, target))

        Creature::eek:nGainExperience(gainExp, target, true);

}







void Player::eek:nGainSharedExperience(double& gainExp,  bool fromMonster, bool)

{

    if(gainExperience(gainExp, target))

        Creature::eek:nGainSharedExperience(gainExp, fromMonster, true);

}

for



void Player::eek:nGainSharedExperience(double& gainExp, Creature* target, bool)

{

    if(gainExperience(gainExp, target))

        Creature::eek:nGainSharedExperience(gainExp, target, true);

}
and same in player.h and creature .cpp and h and party.cpp and h
and in creature.cpp replace
onGainExperience(gainExp, !target->getPlayer(), false);
for
onGainExperience(gainExp, target, false);
Post automatically merged:

 

Attachments

Last edited:
Lua:
monster.o:(.rodata._ZTC7Monster0_8Creature[_ZTV7Monster]+0x2b0): undefined refer                                                                                                                                                             ence to `Creature::onGainExperience(double&, Creature*, bool)'
monster.o:(.rodata._ZTC7Monster0_8Creature[_ZTV7Monster]+0x2b8): undefined refer                                                                                                                                                             ence to `Creature::onGainSharedExperience(double&, Creature*, bool)'
monster.o:(.rodata._ZTV7Monster[_ZTV7Monster]+0x2b0): undefined reference to `Cr                                                                                                                                                             eature::onGainExperience(double&, Creature*, bool)'
monster.o:(.rodata._ZTV7Monster[_ZTV7Monster]+0x2b8): undefined reference to `Cr                                                                                                                                                             eature::onGainSharedExperience(double&, Creature*, bool)'
npc.o:(.rodata._ZTC3Npc0_8Creature[_ZTV3Npc]+0x2b0): undefined reference to `Cre                                                                                                                                                             ature::onGainExperience(double&, Creature*, bool)'
npc.o:(.rodata._ZTC3Npc0_8Creature[_ZTV3Npc]+0x2b8): undefined reference to `Cre                                                                                                                                                             ature::onGainSharedExperience(double&, Creature*, bool)'
npc.o:(.rodata._ZTV3Npc[_ZTV3Npc]+0x2b0): undefined reference to `Creature::onGa                                                                                                                                                             inExperience(double&, Creature*, bool)'
npc.o:(.rodata._ZTV3Npc[_ZTV3Npc]+0x2b8): undefined reference to `Creature::onGa                                                                                                                                                             inSharedExperience(double&, Creature*, bool)'
collect2: error: ld returned 1 exit status
make[1]: *** [theforgottenserver] Error 1
make[1]: Leaving directory `/home/total/sources/src'
make: *** [all] Error 2
 
Back
Top