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

    • Hello guys, gh0t from gh0tstudio here. This time we are putting to sale this beafitul landing page for your next server. Lineage 2 Server Landing Page Template u can check it here LINEAGE 2 DEMO SITE   Technology Stack - React 18 with TypeScript - Tailwind CSS for styling - Framer Motion for animations - Vite for fast development and builds - Multi-language support (i18n ready) Responsive Design The template is fully responsive and optimized for all screen sizes. Desktop, tablet, and mobile layouts have been carefully crafted to provide the best user experience on any device. The mobile version includes a unique notch-style hero design with custom clip paths. What is Included - Complete landing page source code - Hero section with parallax scroll effect - Server information section with animated cards - Character classes showcase with interactive gallery - Registration form (frontend only, styled and validated) - Donation packages display section - Download section for game client - Sticky navigation with transparency effects - Footer with social links - Multi-language system (Spanish/English ready) - All animations and transitions - Clean, documented code structure - Easy to customize colors and content   What is Not Included - Backend server or API - User registration panel/dashboard - Payment processing system for donations - Database integration - Connection to L2 game server - Online player counter module - Account management system - Hosting or domain   The template provides the complete frontend experience.  Price: $150 USD     Contact For purchase inquiries or questions about the template, please reach out directly.
    • 流量套利 + SMM 面板 — 强大的增长组合. 通过社交信号加强推广活动,提高信任度和转化率,加速扩张。 为套利专员和 SMM 提供的所有工具 — 在一个地方. 有效链接: SMM 面板: 前往 – 推广您的社交媒体账户。 其他服务和产品: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram 信使方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快速且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前促销和特别优惠列表,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销代码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣——只需在我们网站注册后按以下模板填写您的用户名:"SEND ME BONUS, MY USERNAME IS..." ——您需要在我们的论坛主题中发布! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人中每周都会赠送 Telegram Stars! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式和支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock