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

    • Expanding the dominion, the magical Scroll of Escape   The months passed and Orcis dominance over Aden was absolute. Everyone respected his leadership and authority. Now many of his highly ranked soldiers have learned the boat dance of invulnerability but the army had trouble mastering it.    The orc ordered his most loyal engineer, that stranger who his name we still query, to find a way to teach the dance to the solders to turn them into super-soldiers. The stranger searched and search ed and searched, but he could not make the dance easier. For a soldier, with his heavy armor and slow movement was confined to the limits that this shell provided.   But sometimes, the truth hides in simpler things. One day, after testing the dance on the boat many times, the stranger decided to call it a day. But he was too tired to walk back to the city from the Giran Harbor. So he opened his back and used a scroll of escape while still on the boat.  He visited the weapons store, then the church and later decided to go to the west gate of Giran, to do some light sparring with the random villagers.    To his surprise, he could not fight the villagers. Whenever they tried to swing on him, their sword bounced away. And so it came to the strnager, that its not the dance that makes Einhasad bless him with immortality. It's not gods themselves, but an inherent flaw of the mortal world.    And so ... he went to the king, with a bright idea, and a bunch of Scrolls of Escape in hand.   Master I know of a way. And I know of a thousand other ways to trick the gods and gain immortality without dancing infront of them. For it is not the blessing of Einhasad that gives us the gift.    The gods have erred, the world is flawed and only a redesign of the nature's principles can now stop us ...     Epilogue Years ago, there have been stories of people spontaneously blessed by Einhasad. People who would walk on Primeval Isle or in Sieges and be immortal. The elders of the world, the wise ones, never took notice, never acted. For years and years, the ancient magic went unnoticed, but the stranger, figured it out. There's no magic. There never was. And the only reason why the wise ones never figured it out, was cause they had their "telescopes" pointed to the wrong direction. For it's the insignificant, the in-exceptional places, where "magic begins" (If you find my stories interesting, the next story will be about a Canvas in School of Dark Arts that overflows with Ink)
    • I just found it funny that you reversed the reverse engineer champions. They won't like this for sure.    Anyway, the project vision is very good it is aligned with what the players need and want something that both e-global and l2reborn has failed to provide. These are stable projects, they are not good "games". And players play "games" they don't play "projects".  When no good "games" exist, they flock towards good "projects". Lineage 2 private scene has produced decent projects the last years, but no decent "game". I hope you are the first ones to do so.   Generally there are two axis that Lineage 2 needs to evolve on. Modern gaming concepts and the need to respect the aging player's time. So far, most projects treat these aspects as taboo, they seem so afraid to deviate from what they call "true" Lineage 2. But the reality is that times change, you can't stay static forever, you have to evolve. NCSoft failed,they are not paving the way no more. It is us now, the collective community that have to pave our own pathways. WoW has went the same way, private projects took initiative because the company (while not failed) could not steer the game towards what players want and need in 2026.    For that reason I believe your project is going towards the right direction. The four keystones listed in the vision is what I believe is the community really needs but clearly doesn't understand it wants, because noone so far has give them a glimspe of what is beyond their retail-like garden.    I personally don't respect projects like reborn and e-global. As "games", they are simply trash, regardless of their high professionalism as endeavors. They lack innovation, they lack creativity, they are simply good software products,     
  • 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..