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

    • Never buy from gx gustavo orellano, he's a scammer.  
    • Good evening everyone! I wouldn't normally ask for help with something like this, but I'm honestly stuck and can't figure it out anymore. I have a C3 pack (I'll also include the link below since it took me a while to find a good one with everything needed to run it): (https://www.mediafire.com/file/glhnscql6hkd6ra/l2jnvc3_rev178_Greenhope_l2j_%2Bjava_%2Bsql.zip/file) The problem is that I'm completely stuck on one thing. No matter what I do, I can't log in. I keep getting a "wrong protocol" error. I've tried changing the protocol from 550–700 all the way to 1–999. I've tested many different C3 versions and every main system I could find, but I still haven't managed to log in successfully. I'm not sure if I'm doing something wrong when saving the .ini file after changing it to my server's IP address. If anyone could help me, I would really appreciate it. I'll keep the server online so that if someone is willing to assist, they can try logging in and help me figure out what's wrong. Server IP: 194.219.108.63 Thank you very much in advance to anyone who decides to take the time to help me. I'd really love to get this pack running properly and preserve it for the future.
    • Anosim Update   - New updated design is live - Free Numbers added on the mainpage - Use free numbers for activation - Receive SMS for free   ⸻   New Blog added Future news, updates and platform changes will be posted there   ⸻   Partner Section added New space for partners and integrations   ⸻   New Websites for Activation added   🇩🇪 Germany wg-gesucht.de dikidi.net 🇨🇭 Switzerland Tutti.ch Ricardo.ch 🇦🇺 Australia Gumtree.com.au 🇬🇧 UK Askable.com   ⸻   New Countries added for Activation   🇦🇷 Argentina 🇧🇬 Bulgaria 🇨🇲 Cameroon 🇭🇷 Croatia 🇬🇷 Greece 🇰🇿 Kazakhstan 🇲🇦 Morocco   ⸻   New Full Rent 🇬🇪 Georgia +995 Numbers Full Rent now available Real SIM Cards No VoIP   ⸻   Available now on https://anosim.net
    • Shadowsocks Released   World’s first Dedicated Mobile Proxy with Shadowsocks support. Dedicated 4G/5G mobile proxies can now be used with Shadowsocks.   New dedicated mobile proxy locations added: 🇩🇪 Germany (Leipzig) 🇳🇬 Nigeria (Lagos) 🇺🇸 USA (South Haven)   Also available: 🌐 Residential Proxies from $1/GB   ⚡️ Datacenter Proxies from $0.50/GB   Available now on Proxied.   https://proxied.com For Free Trials, write us a DM with your registered E-mail.
  • 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..