Jump to content

Recommended Posts

Posted

Hello, here is my first share. This code is good when you want to do something like when mob lvl is 76 or bigger, exp rate can be smaller.

Iam using L2jarchid.

open com.l2jarchid.gamesserver.model.actor.L2npc.java

Find:

	 public int getExpReward()
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
  }

REPLACE IT TO:

public int getExpReward()
 {
  if (getLevel() > 75)
  
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * 1);
  }
  
  else
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
  }
  }

rateXp * 1 is exp rate you can change it to 20 or etc (number only change)... This code is when mob lvl is 76 or bigger exp rate will be 1... if you want to do intervals like from 52 to 65 - 20 exp , 65-76 - 10 exp 76 or bigger - 5 exp rate ... write this code

	 public int getExpReward()
 {
  if (getLevel() > 52 && getLevel() < 66)
  
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * 20);
  }
  
  if (getLevel() > 66 && getLevel() < 75)
	  
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * 10);
  }
  
  if (getLevel() > 75)
	  
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * 5);
  }
  
  else
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
  }
  }

I think this code will be usefull

Credits to Intrepid,Horus and me ...

P.S. if someone will share code for character exp(when character reach 76lvl then exp for him will count as 1) will be great :)

public int getExpReward()
{
L2Attackable attacker;
  if (getLevel() > 75)
	  
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * 5);
  }
  
  else
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
  }
  }

if some1 can test write feedback (i dont test it, maybe it work, for characters lvl)

Posted

I will explain more. You have server which is with 1000x exp rates.. Till 40 lvl exp rates will be 1000x, after 40lvl till 50lvl etc. rates will be reduced for character to 100x, 50lvl-60lvl reduced to 50x and so on.. It's good if you have a server with custom starting lvl and if you want to have pvp server, where you need to farm exp a bit.. It won't be only pvp server with this custom..

Posted

lool just make something like:

 if (attacker.getLevel() >= 40 && attacker.getLevel() <= 76)
	  
  {
  double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  return (int) ((getTemplate().rewardExp * rateXp) / 50);
  }

Posted

werlex I didn't say anything the first time, but since you did it twice:

Add the proper credits (since about 50% of that was done by me lool) or just don't at all. ^^

Posted

Horus, Firstly i said that iam just starting work with java, Secondly your code with attacker is wrong because i get error for attacker (with intrepid we was talking about this), Third what you help for me with this code? Intrepid said that need to put else, i put it and everything okay then ... what you said more than "1 is neutral, we can dont write it".

If you need that credits ill write ... its not very hard for me ...

Posted

I do like this:  ;)

 

FirstI open PcStat.java and I find this part:

 

  public boolean addExpAndSp(long addToExp, int addToSp)

  {

                        ........

      if (activeChar.getPet() instanceof L2PetInstance)

      {

        L2PetInstance pet = (L2PetInstance) activeChar.getPet();

        ratioTakenByPet = pet.getPetData().getOwnerExpTaken();

 

        // only give exp/sp to the pet by taking from the owner if the pet has a non-zero, positive ratio

        // allow possible customizations that would have the pet earning more than 100% of the owner's exp/sp

        if (ratioTakenByPet > 0 && !pet.isDead())

            pet.addExpAndSp((long) (addToExp * ratioTakenByPet), (int) (addToSp * ratioTakenByPet));

        // now adjust the max ratio to avoid the owner earning negative exp/sp

        if (ratioTakenByPet > 1)

            ratioTakenByPet = 1;

        addToExp = (long) (addToExp * (1 - ratioTakenByPet));

        addToSp = (int) (addToSp * (1 - ratioTakenByPet));

      }

        // From 20lv+ exp decrease x2.

      if (activeChar.getStat().getLevel() > 19)

      {

        addToExp = (long) (addToExp / 2);

        addToSp = (int) (addToSp / 2);

      }

 

        // From 76lv+ exp increase 50%.

      if (activeChar.getStat().getLevel() > 75)

      {

        addToExp = (long) (addToExp * 1.5);

        addToSp = (int) (addToSp * 1.5);

      }

By this you can edit code as you want...

Posted

this is not for pet? when activechar get lvl 20 with pet exp will decrease by 2 for activechar?

Offcourse not.. activeChar = player, NOT pet...  :D Works 100% tested a lot of times.. ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...