Jump to content
  • 0

How make premium rate(donator rate)


Question

Posted

hello.

please help me how I can add server premium rate. if player donator , he gain 2x exp,sp,spoil,adena,drop.

 

Here sorc code server.

http://letitbit.net/download/8d54aafc0e/l2dreamlast.zip.html

click free.

 

L2DropData.java file from server.

 

 

package Alfa.game.model;

 

import java.util.Arrays;

 

import Alfa.Config;

import Alfa.game.model.base.ItemToDrop;

import Alfa.game.tables.ItemTable;

import Alfa.game.templates.L2Item;

import Alfa.util.Rnd;

 

public class L2DropData

{

private L2Item _item;

private int _mindrop;

private int _maxdrop;

private boolean _sweep;

private int _chance;

private short _groupId;

private int _groupChance;

private byte _minLevel;

private byte _maxLevel;

private String _questID = null;

private String[] _stateID = null;

 

public L2DropData()

{}

 

public L2DropData(int id, int min, int max, int chance, int minLevel)

{

_item = ItemTable.getInstance().getTemplate(id);

_mindrop = min;

_maxdrop = max;

_chance = chance;

_minLevel = (byte) minLevel;

}

 

public L2DropData(int id, int min, int max, int chance, int minLevel, int maxLevel)

{

_item = ItemTable.getInstance().getTemplate(id);

_mindrop = min;

_maxdrop = max;

_chance = chance;

_minLevel = (byte) minLevel;

_maxLevel = (byte) maxLevel;

}

 

public short getItemId()

{

return _item.getItemId();

}

 

public L2Item getItem()

{

return _item;

}

 

public void setItemId(short itemId)

{

_item = ItemTable.getInstance().getTemplate(itemId);

}

 

public void setGroupId(short gId)

{

_groupId = gId;

}

 

public short getGroupId()

{

return _groupId;

}

 

public void setGroupChance(int chance)

{

_groupChance = chance;

}

 

public int getGroupChance()

{

return _groupChance;

}

 

public int getMinDrop()

{

return _mindrop;

}

 

public int getMaxDrop()

{

return _maxdrop;

}

 

public boolean isSweep()

{

return _sweep;

}

 

public int getChance()

{

return _chance;

}

 

public void setMinDrop(int mindrop)

{

_mindrop = mindrop;

}

 

public void setMaxDrop(int maxdrop)

{

_maxdrop = maxdrop;

}

 

public void setSweep(boolean sweep)

{

_sweep = sweep;

}

 

public void setChance(int chance)

{

_chance = chance;

}

 

public String[] getStateIDs()

{

return _stateID;

}

 

public void addStates(String[] list)

{

_stateID = list;

}

 

public String getQuestID()

{

return _questID;

}

 

public void setQuestID(String questID)

{

_questID = questID;

}

 

public boolean isQuestDrop()

{

return _questID != null && _stateID != null;

}

 

public byte getMinLevel()

{

return _minLevel;

}

 

public byte getMaxLevel()

{

return _maxLevel;

}

 

@Override

public String toString()

{

String out = "ItemID: " + getItemId() + " Min: " + getMinDrop() + " Max: " + getMaxDrop() + " Chance: " + getChance() / 10000.0 + "%";

if(isQuestDrop())

out += " QuestID: " + getQuestID() + " StateID's: " + Arrays.toString(getStateIDs());

 

return out;

}

 

@Override

public boolean equals(Object o)

{

if(o instanceof L2DropData)

{

L2DropData drop = (L2DropData) o;

return drop.getItemId() == getItemId();

}

return false;

}

 

/**

* Подсчет шанса выпадения этой конкретной вещи

* Используется в эвентах и некоторых специальных механизмах

* @param player игрок (его бонус влияет на шанс)

* @param mod (просто множитель шанса)

* @param isRaid (это рейдовая вещ)

* @return информация о выпавшей вещи

*/

public ItemToDrop roll(L2Player player, double mod)

{

float rate = 0;

if(!_item.isHerb())

rate = Config.RATE_DROP_ITEMS * (player != null ? player.getRateItems() : 1);

float adenarate = Config.RATE_DROP_ADENA * (player != null ? player.getRateAdena() : 1);

 

// calc group chance

double calcChance = mod * _chance * (_item.isAdena() ? 1f : rate);

 

int dropmult = 1;

// Если шанс оказался больше 100%

if(calcChance > L2Drop.MAX_CHANCE)

if(calcChance % L2Drop.MAX_CHANCE == 0) // если кратен 100% то тупо умножаем количество

dropmult = (int) (calcChance / L2Drop.MAX_CHANCE);

else

{ // иначе балансируем

dropmult = (int) Math.ceil(calcChance / L2Drop.MAX_CHANCE); // множитель равен шанс / 100% округление вверх

calcChance = calcChance / dropmult; // шанс равен шанс / множитель

// в результате получаем увеличение количества и уменьшение шанса, при этом шанс не падает ниже 50%

}

 

if(Rnd.get(L2Drop.MAX_CHANCE) > calcChance)

return null;

 

ItemToDrop t = new ItemToDrop(_item.getItemId());

 

// если это адена то умножаем на рейт адены, иначе на множитель перебора шанса

float mult = _item.isAdena() ? adenarate : dropmult;

 

if(getMinDrop() >= getMaxDrop())

t.count = (int) (getMinDrop() * mult);

else

t.count = Rnd.get((int) (getMinDrop() * mult), (int) (getMaxDrop() * mult));

 

return t;

}

 

@Override

public int hashCode()

{

return _item.getItemId();

}

}

 

 

4 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here  https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • 🔥 Lineage 2 Haruna x3 – Interlude 🔥   Grand Opening 06.02.2026  Welcome to L2 Haruna x3, a classic Interlude server focused on retail-like gameplay, fair competition, and long-term stability. No pay-to-win, no broken customs — just real Lineage 2 the way it was meant to be played.   Website: https://l2haruna.com/ Discord: https://discord.gg/7DDC9Dsxnh Chronicle: Interlude Rates:  EXP/SP: x3   Adena: x2   Drop/Spoil: x1   Seal Stones: x1   Boss EXP/SP: x2 More Info: Click me Server Time: UTC +2 📈 Core Gameplay • Classic Interlude mechanics & formulas • Balanced economy • Real PvP, clan wars, sieges, and Olympiad 🏆 Olympiad Information • Olympiad starts 3 months after server opening • Participation only through the Olympiad Master • Competition time: 20:00 – 02:00 (UTC +2) ⚙️ Website & Account System • Master Account (MA) system on website • Game accounts must be created via Master Account • Vote system inside MA • Website rankings: PvP, PK, Clans, Castles 🧙 NPCs, Buffs & Utilities • Server Manager NPC in all towns and villages • Adventurer’s Guide (Miss Queen) in all towns and villages • Offline Buff Shops (.buffshop) allowed only in Monster Derby Track • In-game Mailbox system • Start-Up Bonus for all characters • FREE Teleport in all towns/villages until level 40 🎮 Interface & Quality of Life • ALT + K – Skill Panel (learn and enchant skills) • Alt + Click – Buff removal • Shift + Click on monsters – Drop and spoil information • Offline Shop system (set shop and exit game) • 35 seconds spawn protection • Captcha system in game (anti-bot protection) 💬 Chat System • Global chat (!) – Free, requires level 15 • Trade chat (+) – Free, requires level 15 • (!) Global chat • (+) Regional trade chat 🛡 Fair Play & Restrictions • Maximum 2 game clients per IP • Donate Coins and Vote Coins cannot be sold, dropped, traded, or destroyed • Cursed weapons disabled until first Heroes • Wedding system disabled (will be activated later) ⚔️ Class Progression • 1st Class Transfer – Quest required • 2nd Class Transfer – Quest required • 3rd Class Transfer – Full quest required • Subclass – Full quest required • Noblesse – Full quest required   🗡 Equipment • Shadow Weapons (D / C / B Grade) available via Shadow Weapon Manager 🧠 Technical & Protection • High-quality geodata and geo-engine • Advanced protection against DDoS attacks • Protection against third-party programs and cheats   Join Us Now! https://l2haruna.com/ 
    • High Five Part 5 can be uploaded?
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and 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..