[req] Code About Exp In 2.24b Source

All Helbreath Server Source Discussion here.
Post Reply
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Well, on this sources, player who kills get like 2/3 of the exp...that leaves other players in party low exp.... i want to make it that player who kills get just a bit more or disabling it...i ve found this *cough*
    //Divide exp among party members
    for(i = 0; i < iTotalPartyMembers; i++){
     iH = m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iIndex;
     //Player who kills monster gets more exp
      if ((m_pClientList[iH] != NULL) && (m_pClientList[iH]->m_bSkillUsingStatus[19] != 1) && (m_pClientList[iH]->m_iHP > 0)) { // Is player alive ??
       //Exp gain based on lvl
       if((m_pClientList[iH]->m_iStatus & 0x10000) != 0)
        iUnitValue *= 3;
       m_pClientList[iH]->m_iExpStock += iUnitValue;
       iUnitValue = (int)dV3;
      }
     }


Any suggestions?
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Jaap
Loyal fan
Posts: 390
Joined: Thu Apr 22, 2004 8:21 am

Post by Jaap »

You're looping through every partymember there and put their list-ID in "iH".

I see that you then add the exp to m_pClientList[iH]->m_iExp.

If you want to give a bonus to the killing player, give
m_pClientList[iClientH] some more exp.


m_pClientList[iH] <- current client in the for-loop
m_pClientList[iClientH] <- client that killed the NPC

Hope that helps?
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Well...i beeing trying to take that off lol to divide exp between members, doesnt matter who kills the NPC but having a hard time...anyone feel free to help B)
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Here is the actually full code
void CGame::GetExp(int iClientH, int iExp, BOOL bIsAttackerOwn)
{
double dV1, dV2, dV3;
int i, iH, iUnitValue;
DWORD dwTime = timeGetTime();
int iTotalPartyMembers;

if (m_pClientList[iClientH] == NULL) return;
if (iExp <= 0) return;

if (m_pClientList[iClientH]->m_iLevel <= 80) {
  dV1 = (double)(80 - m_pClientList[iClientH]->m_iLevel);
  dV2 = dV1 * 0.025f;
  dV3 = (double)iExp;
  dV1 = (dV2 + 1.025f)*dV3;
  iExp = (int)dV1;
}
else { //Lower exp
  if ((m_pClientList[iClientH]->m_iLevel >= 100) &&((strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "arefarm") == 0)
   || (strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "elvfarm") == 0))) {
    iExp = (iExp/10) ;
   }
  else if ((strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "arefarm") == 0)
   || (strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "elvfarm") == 0)) {
    iExp = (iExp*1/4) ;
   }
}

//Check for party status, else give exp to player
//if ((m_pClientList[iClientH]->m_iPartyID != NULL) && (m_pClientList[iClientH]->m_iPartyStatus == DEF_PARTYSTATUS_CONFIRM) &&
// ((dwTime - m_pClientList[iClientH]->m_dwLastActionTime) < 1000*60*5)) {
if ((m_pClientList[iClientH]->m_iPartyID != NULL) && (m_pClientList[iClientH]->m_iPartyStatus == DEF_PARTYSTATUS_CONFIRM)) {
   //Only divide exp if > 1 person and exp > 10
   if(iExp >= 10 && m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iTotalMembers > 0){

    //Calc total ppl in party
    iTotalPartyMembers = 0;
    for(i = 0; i < m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iTotalMembers; i++){
     iH = m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iIndex;
     if ((m_pClientList[iH] != NULL) && (m_pClientList[iH]->m_iHP > 0)) {
      //Newly added, Only players on same map get exp :}
      //if(m_pClientList[iH]->m_cMapIndex == m_pClientList[iClientH]->m_cMapIndex)
      if ((strlen(m_pMapList[m_pClientList[iH]->m_cMapIndex]->m_cName)) == (strlen(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName))) {
       if(memcmp(m_pMapList[m_pClientList[iH]->m_cMapIndex]->m_cName,
           m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName,
           strlen(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName)) == 0){
        iTotalPartyMembers++;
       }
      }
     }
    }

    //Check for party bug
    if(iTotalPartyMembers > 8){
     wsprintf(G_cTxt, "(X) Party Bug !! partyMember %d XXXXXXXXXX", iTotalPartyMembers);
     PutLogFileList(G_cTxt);
     iTotalPartyMembers = 8;
    }

    //Figure out how much exp a player gets
    dV1 = (double)iExp;

    switch(iTotalPartyMembers){
    case 1:
     dV2 = dV1;
     break;
    case 2:
     dV2 = (dV1 + (dV1 * 2.0e-2)) / 2.0;
     break;
    case 3:
     dV2 = (dV1 + (dV1 * 5.0e-2)) / 3.0;
     break;
    case 4:
     dV2 = (dV1 + (dV1 * 7.000000000000001e-2)) / 4.0;
     break;
    case 5:
     dV2 = (dV1 + (dV1 * 1.0e-1)) / 5.0;
     break;
    case 6:
     dV2 = (dV1 + (dV1 * 1.4e-1)) / 6.0;
     break;
    case 7:
     dV2 = (dV1 + (dV1 * 1.7e-1)) / 7.0;
     break;
    case 8:
     dV2 = (dV1 + (dV1 * 2.0e-1)) / 8.0;
     break;
    }

    dV3 = dV2 + 5.0e-1;
    iUnitValue = (int)dV3;

    //Divide exp among party members
    for(i = 0; i < iTotalPartyMembers; i++){
     iH = m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iIndex;
     //Player who kills monster gets more exp
      if ((m_pClientList[iH] != NULL) && (m_pClientList[iH]->m_bSkillUsingStatus[19] != 1) && (m_pClientList[iH]->m_iHP > 0)) { // Is player alive ??
       //Exp gain based on lvl
       if((m_pClientList[iH]->m_iStatus & 0x10000) != 0)
        iUnitValue *= 3;
       m_pClientList[iH]->m_iExpStock += iUnitValue;
       iUnitValue = (int)dV3;
      }
     }
   }
   else{
    if ((m_pClientList[iClientH]->m_iStatus & 0x10000) != 0)
     iExp *= 3;
    //m_pClientList[iClientH]->m_iExpStock += iExp;
   }
  }
  else{
   if ((m_pClientList[iClientH]->m_iStatus & 0x10000) != 0)
    iExp *= 3;

   //Add exp to player
   //m_pClientList[iClientH]->m_iExpStock += iExp;
  }
  //hbest add exp after lvl
  if (m_pClientList[iClientH]->m_iLevel < 121) {
   iExp *= 4;
  } else if (m_pClientList[iClientH]->m_iLevel < 141) {
   iExp *= 3;
  } else if (m_pClientList[iClientH]->m_iLevel < 161) {
   iExp *= 2;
  } else if (m_pClientList[iClientH]->m_iLevel < 180) {
   iExp *= 1.5;
  }
  m_pClientList[iClientH]->m_iExpStock += iExp;
}


This is so fucked up...that when you are in party with a mage in ww, you get 12k-13k and when you are not in party only by urself you get 10k or so....
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Shetar
Member
Posts: 148
Joined: Sun Nov 30, 2003 12:57 am

Post by Shetar »

well you got yourself an extra party function here :P partying gives extra exp, nice for a noob server :lol:
Helbreath II Project Manager & All round Developer. <br><i>(Don't worry, we're not dead)</i>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Shetar wrote: well you got yourself an extra party function here :P partying gives extra exp, nice for a noob server :lol:
I manage to resolve this, with Aryes's help if anyone want the code, then post back. :)
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Dyno
Regular
Posts: 68
Joined: Wed May 25, 2005 2:54 am

Post by Dyno »

I wouldnt mind nabbing that fix :)
RageIlluminati
Outpost bitch
Posts: 559
Joined: Wed Mar 30, 2005 6:45 am

Post by RageIlluminati »

locobans wrote:
Shetar wrote: well you got yourself an extra party function here :P partying gives extra exp, nice for a noob server  :lol:
I manage to resolve this, with Aryes's help if anyone want the code, then post back. :)
can you send the fix to my e-mail :rolleyes:
<img src='http://helbreath.pri.ee/userbars/hbest-gamemaster2.jpg' border='0' alt='user posted image' /> <img src='http://helbreath.pri.ee/userbars/hbsoccer-owner.jpg' border='0' alt='user posted image' /> <img src='http://helbreath.pri.ee/userbars/scorpa-rider.jpg' border='0' alt='user posted image' /> <img src='http://helbreath.pri.ee/userbars/logout-master.jpg' border='0' alt='user posted image' /> <br>.<br>................................Ego sum Rage, flagellum Dei!<br><br>The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? (bash.org)
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Here is the code

If you willing to THX or give CREDITS to anyone the name is Aryes
void CGame::GetExp(int iClientH, int iExp, BOOL bIsAttackerOwn)
{
double dV1, dV2, dV3;
int i, iH, iUnitValue;
DWORD dwTime = timeGetTime();
int iTotalPartyMembers;

if (m_pClientList[iClientH] == NULL) return;
if (iExp <= 0) return;

if (m_pClientList[iClientH]->m_iLevel <= 80) {
dV1 = (double)(80 - m_pClientList[iClientH]->m_iLevel);
dV2 = dV1 * 0.025f;
dV3 = (double)iExp;
dV1 = (dV2 + 1.025f)*dV3;
iExp = (int)dV1;
}
else { //Lower exp
if ((m_pClientList[iClientH]->m_iLevel >= 100) &&((strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "arefarm") == 0)
|| (strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "elvfarm") == 0))) {
  iExp = (iExp/10);
}
else if ((strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "arefarm") == 0)
|| (strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "elvfarm") == 0)) {
  iExp = (iExp*1/4);
}
}

//Check for party status, else give exp to player
if ((m_pClientList[iClientH]->m_iPartyID != NULL) && (m_pClientList[iClientH]->m_iPartyStatus == DEF_PARTYSTATUS_CONFIRM)) {
//Only divide exp if >= 1 person and exp > 10
if(iExp >= 10 && m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iTotalMembers > 0){

  //Calc total ppl in party
  iTotalPartyMembers = 0;
  for(i = 0; i < m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iTotalMembers; i++){
    iH = m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iIndex;
    if ((m_pClientList[iH] != NULL) && (m_pClientList[iH]->m_iHP > 0)) {
      //Newly added, Only players on same map get exp :}
if ((strlen(m_pMapList[m_pClientList[iH]->m_cMapIndex]->m_cName)) ==    (strlen(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName))) {
      if(memcmp(m_pMapList[m_pClientList[iH]->m_cMapIndex]->m_cName,
      m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName,
          strlen(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName)) == 0){
        iTotalPartyMembers++;
      }
      }
    }
  }

  //Check for party bug
  if(iTotalPartyMembers > 8){
  wsprintf(G_cTxt, "(X) Party Bug !! partyMember %d XXXXXXXXXX", iTotalPartyMembers);
  PutLogFileList(G_cTxt);
  iTotalPartyMembers = 8;
  }

  //Figure out how much exp a player gets
  dV1 = (double)iExp;

  switch(iTotalPartyMembers){
  case 1:
  dV2 = dV1;
  break;
  case 2:
  dV2 = (dV1 + (dV1 * 2.0e-2)) / 2.0;
  break;
  case 3:
  dV2 = (dV1 + (dV1 * 5.0e-2)) / 3.0;
  break;
  case 4:
  dV2 = (dV1 + (dV1 * 7.000000000000001e-2)) / 4.0;
  break;
  case 5:
  dV2 = (dV1 + (dV1 * 1.0e-1)) / 5.0;
  break;
  case 6:
  dV2 = (dV1 + (dV1 * 1.4e-1)) / 6.0;
  break;
  case 7:
  dV2 = (dV1 + (dV1 * 1.7e-1)) / 7.0;
  break;
  case 8:
  dV2 = (dV1 + (dV1 * 2.0e-1)) / 8.0;
  break;
  }

  dV3 = dV2 + 5.0e-1;

<span style='color:blue'>  //Divide exp among party members
  for(i = 0; i < iTotalPartyMembers; i++){
iUnitValue = (int)dV3;
    iH = m_stPartyInfo[m_pClientList[iClientH]->m_iPartyID].iIndex;
if ((m_pClientList[iH] != NULL) && (m_pClientList[iH]->m_bSkillUsingStatus[19] != 1) && (m_pClientList[iH]->m_iHP > 0)) { // Is player alive ??
if (m_pClientList[iH]->m_iLevel < 81)  iUnitValue *= 2.5;
else if (m_pClientList[iH]->m_iLevel < 101)  iUnitValue *= 2;
else if (m_pClientList[iH]->m_iLevel < 161)  iUnitValue *= 1.5;
else if (m_pClientList[iH]->m_iLevel < 180)  iUnitValue *= 1;
if((m_pClientList[iH]->m_iStatus & 0x10000) != 0)  iUnitValue *= 3;
m_pClientList[iH]->m_iExpStock += iUnitValue;  </span>
      }
  }
}
}
else {
<span style='color:red'>iUnitValue = (int)dV3;
if ((m_pClientList[iClientH] != NULL) && (m_pClientList[iClientH]->m_bSkillUsingStatus[19] != 1) && (m_pClientList[iClientH]->m_iHP > 0)) { // Is player alive ??
if (m_pClientList[iClientH]->m_iLevel < 81)  iUnitValue *= 3;
else if (m_pClientList[iClientH]->m_iLevel < 101)  iUnitValue *= 2.5;
else if (m_pClientList[iClientH]->m_iLevel < 161)  iUnitValue *= 2;
else if (m_pClientList[iClientH]->m_iLevel < 180)  iUnitValue *= 1.5;
if((m_pClientList[iClientH]->m_iStatus & 0x10000) != 0)  iUnitValue *= 3;
m_pClientList[iClientH]->m_iExpStock += iUnitValue; 
      }
}</span>

}


The blue text manage the exp in party. Each player in party will get exp in npc.cfg multiplied by the multiplicator depending on his level. So actually, exp will not divide by members.

The red text manage the exp in non-party. Player will get exp in ncp.cfg multiplied by the multiplicator depending on his level.

In order for this to work corectly, you must know, that you will have to remove the /createparty command.
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
blackfury
noob
Posts: 29
Joined: Wed Oct 27, 2004 9:13 pm

Post by blackfury »

thats not totaly fixed, go to HBx to get the full code, which i stotally fixed...
Post Reply