Author Topic: High Five Scheme buffer free below a level  (Read 53 times)

Offline Affer

  • Vassal
  • *
  • Posts: 8
Scheme buffer free below a level
« on: August 02, 2020, 05:48:48 PM »
Hello Everybody,

I worked on a simple feature that was requested by a player; make the scheme buffer free for characters below level 20. Here is how I did it:
In Config.java
Code: [Select]
line 1190
public static int BUFFER_FREE_BELOW_LEVEL;
public static int BUFFER_COST_ABOVE_LEVEL;
line 3022
BUFFER_FREE_BELOW_LEVEL= SchemeBuffer.getInt("BufferFreeBelowLevel", 20);
BUFFER_COST_ABOVE_LEVEL= SchemeBuffer.getInt("BufferCostAboveLevel", 300000);

Next I added two new parameters in Config/Custom/Shemebuffer.ini:
Code: [Select]
# Level up to which scheme buffs are free
BufferFreeBelowLevel = 20

# Cost for scheme buffs when character is above BufferFreeBelowLevel
BufferCostAboveLevel = 300000

And finally, I added the following code in gameserver/model/actor/instance/SchemeBufferInstance.java
Code: [Select]
line 428
if (player.getLevel() <= Config.BUFFER_FREE_BELOW_LEVEL)
{
return 0;
}
else if (player.getLevel() > Config.BUFFER_FREE_BELOW_LEVEL)
{
return Config.BUFFER_COST_ABOVE_LEVEL;
}

Bonus; if you want to see the skills animation when getting buffed by the scheme buffer, the following can be done in gameserver/model/actor/instance/SchemeBufferInstance.java
Code: [Select]
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
line 124
final Skill skill = SkillData.getInstance().getSkill(skillId, SkillData.getInstance().getMaxLevel(skillId));
player.sendPacket(new MagicSkillUse(player, target, skillId, skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));

I don't use eclipse, so I don't have a nice diff file to offer.

Thanks !

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 7479
Re: Scheme buffer free below a level
« Reply #1 on: August 05, 2020, 10:06:32 AM »
Better set two prices, one for until level and one for after level.