Jump to content

Recommended Posts

Posted (edited)
On 5/3/2021 at 2:29 PM, Porthos said:

Cherish threw a fit because he wanted credits for 4 lines of code, not to mention he was continuously derailing discussions offtopic because he was going into opinionated tangents about random things. The credits thing was the worst fit ive seen him throw and im not surprised he got booted from the discord for that.

L2JServer has certain criteria about giving credits which you can read here: https://www.l2jserver.com/forum/viewtopic.php?f=29&t=30453&p=182222#p182580

Based on these rules did he deserve credits other than in the commit comment? That's for each one of you to decide.

 

Also theres no randoms taking over L2JServer, if anything the new team members have brought the pack back to life. Theres a lot of cool shit coming like complete High Five Skills with proper handlers and a targeting rework that both will address a lot of issues.

 

Generally i see a lot of ego from people involved in the l2j scene, this needs to stop unless you like to be paying hundreds of dollars or euros for subpar work.


Here you go. You can change it into double and push to main branch.
I have already asked for more appropriate way to present my work.

What if is ego? Say I've "learned" java, got familiar with project enough to fix a broken drop calc, present for many years, with close to none assistance and I have shared it, if not for money, what's left?

If you can not appreciate my effort to give it few bytes of credits that is not being compiled, then users should apply patch manually on demand, found here.

After all, this is a custom feature for a custom drop on a custom rate and L2JServer focuses on "Retail" behavior and code does not take part of main branch.
 

 

 

/*
 * Copyright © 2004-2021 L2J Server
 *
 * This file is part of L2J Server.
 *
 * L2J Server is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * L2J Server is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver.model.drops.strategy;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.l2jserver.commons.util.Rnd;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.drops.GeneralDropItem;
import com.l2jserver.gameserver.model.drops.GroupedGeneralDropItem;
import com.l2jserver.gameserver.model.drops.IDropItem;
import com.l2jserver.gameserver.model.holders.ItemHolder;

/**
 *@author Battlecruiser, Cherish
 */

public interface IGroupedItemDropCalculationStrategy {
	/**
	 * L2J Server most percise drop calculation when group chances are over one houdred percent.
	 */
	IGroupedItemDropCalculationStrategy DEFAULT_STRATEGY = new IGroupedItemDropCalculationStrategy() {
		private final Map<GroupedGeneralDropItem, GeneralDropItem> singleItemCache = new ConcurrentHashMap<>();
		
		private GeneralDropItem getSingleItem(GroupedGeneralDropItem dropItem) {
			final GeneralDropItem item1 = dropItem.getItems().iterator().next();
			singleItemCache.putIfAbsent(dropItem, new GeneralDropItem(item1.getItemId(), item1.getMin(), item1.getMax(), (item1.getChance() * dropItem.getChance()) / 100, //
				item1.getAmountStrategy(), item1.getChanceStrategy(), dropItem.getPreciseStrategy(), dropItem.getKillerChanceModifierStrategy(), item1.getDropCalculationStrategy()));
			return singleItemCache.get(dropItem);
		}
		
		@Override
		public List<ItemHolder> calculateDrops(GroupedGeneralDropItem dropItem, L2Character victim, L2Character killer) {
			if (dropItem.getItems().size() == 1) {
				return getSingleItem(dropItem).calculateDrops(victim, killer);
			}
			
			GroupedGeneralDropItem normalized = dropItem.normalizeMe(victim, killer);
			if (normalized.getChance() > (Rnd.nextDouble() * 100)) {
				final double random = (Rnd.nextDouble() * 100);
				double totalChance = 0;
				for (GeneralDropItem item2 : normalized.getItems()) {
					totalChance += item2.getChance();
					if (totalChance > random) {
						int amountMultiply = 1;
						if (dropItem.isPreciseCalculated() && normalized.getChance() > 100) {
							int MostPreciseFormula = 0;
							MostPreciseFormula += item2.getChance() * (normalized.getChance() / 100);
							if (MostPreciseFormula >= 100) {
								amountMultiply = (int) MostPreciseFormula / 100;
								if ((MostPreciseFormula % 100) > (Rnd.nextDouble() * 100)) {
									amountMultiply++;
								}
							}
						}	
						return Collections.singletonList(new ItemHolder(item2.getItemId(), Rnd.get(item2.getMin(victim), item2.getMax(victim)) * amountMultiply));
					}
				}
			}
			return null;
		}
	};
	
	/**
	 * This strategy calculates a group's drop by calculating drops of its individual items and merging its results.
	 */
	IGroupedItemDropCalculationStrategy DISBAND_GROUP = (item, victim, killer) -> {
		List<ItemHolder> dropped = new ArrayList<>();
		for (IDropItem dropItem : item.extractMe()) {
			dropped.addAll(dropItem.calculateDrops(victim, killer));
		}
		return dropped.isEmpty() ? null : dropped;
	};
	
	/**
	 * This strategy when group has precise calculation rolls multiple times over group to determine drops when group's chance raises over 100% instead of just multiplying the dropped item's amount. Thus it can produce different items from group at once.
	 */
	IGroupedItemDropCalculationStrategy PRECISE_MULTIPLE_GROUP_ROLLS = (item, victim, killer) -> {
		if (!item.isPreciseCalculated()) {
			// if item hasn't precise calculation there's no change from DEFAULT_STRATEGY
			return DEFAULT_STRATEGY.calculateDrops(item, victim, victim);
		}
		GroupedGeneralDropItem newItem = new GroupedGeneralDropItem(item.getChance(), DEFAULT_STRATEGY, item.getKillerChanceModifierStrategy(), IPreciseDeterminationStrategy.NEVER);
		newItem.setItems(item.getItems());
		GroupedGeneralDropItem normalized = newItem.normalizeMe(victim, killer);
		// Let's determine the number of rolls.
		int rolls = (int) (normalized.getChance() / 100);
		if ((Rnd.nextDouble() * 100) < (normalized.getChance() % 100)) {
			rolls++;
		}
		List<ItemHolder> dropped = new ArrayList<>(rolls);
		for (int i = 0; i < rolls; i++) {
			// As further normalizing on already normalized drop group does nothing, we can just pass the calculation to DEFAULT_STRATEGY with precise calculation disabled as we handle it.
			dropped.addAll(normalized.calculateDrops(victim, killer));
		}
		return dropped.isEmpty() ? null : dropped;
	};
	
	List<ItemHolder> calculateDrops(GroupedGeneralDropItem item, L2Character victim, L2Character killer);
}

 

Edited by Cherish
  • 1 year later...
Posted (edited)

The people that are killing L2JServer must be publicly exposed. 😄
I've shared with you Improved Crystal Caverns and Precision Formula.
In return all I received was disrespect and humiliation?
Well, that was the last of me for the true open source L2JServer.

Have fun copycats!

 

Edited by Cherish
  • 7 months later...
Posted

Hi people. Does anybody solved this formula?. I found that this is not exact with drops groups. I have for example 100% drop on a mob but is not 100% really. If i add a item drop outside of any group it's drops 100%

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

    • Five More Days Left for the 50% Discount in all our video services! 
    • Good afternoon, gentlemen. I’d like to ask a question to those who know their stuff — and just get some advice. Let me start with the main point. I want to try learning Java. Just for myself — I simply like programming, and it’s a small hobby of mine. Though, perhaps it’s too early to say I really like Java, since I don’t actually know it well yet. I’ll get straight to the point. Back in my youth, like many others, I played Lineage 2. Later, I became interested in creating servers and even made my own — we had around 70 players, all schoolkids like me. I learned how to install builds, add NPCs and various add-ons “from the internet” back then. But my attempts to create my own Lineage 2 additions in Java almost always failed. At best, I could slightly modify ready-made code, but not write anything from scratch. My interest in Lineage 2 and Java has stayed with me to this day. For me, it’s a creative process — a favorite game where you can build your own “sandbox.” I’d really like to hear from the community about where you started. In your opinion, what’s the best way to learn Java using Lineage 2 as an example? I don’t have a clear learning plan — and that’s probably the problem. I’ve tried reading Schildt’s book, and I’ve also tried studying Java source codes of various server builds by poking around to understand how the server works and how programs are written. I can’t say I understand nothing — I do get some things, and I believe I have a knack for it. But it’s not systematic. Maybe I really do need advice from more experienced people, to find a strategy that’s both effective for learning Java and interesting because it’s connected to Lineage 2 — not just writing abstract programs “for nothing.” In Lineage 2, you can see the result right away — and I get genuinely happy even from small successes. So here’s the main point: I’d like to know where you started. Is it even worth combining Java and Lineage 2? Recently, ChatGPT has been a huge help — thanks to it, I’ve made some progress and started to understand the server structure at least a little. But there’s one issue: if I just copy and paste, the result works — but without ChatGPT, I can’t reproduce it on my own. I’ve been working with PwSoft source files — I think many people know them. Why exactly them? I can’t really say — probably because there are lots of ready-made add-ons for this build online, and I originally focused more on modifying existing code than writing my own. I worked with PwSoft for a long time. Then, on ChatGPT’s advice, I switched to aCis — it’s cleaner, more minimalistic, without unnecessary “clutter.” It’s easier to understand where everything is located. I installed the aCis sources, everything compiles fine, but… if in PwSoft I could at least navigate the code and write simple methods, in aCis I couldn’t even make a basic NPC that gives noblesse for adena. That’s why I decided to write this post — just to talk about learning Java through Lineage 2, to hear your opinions, your stories, your approaches. Maybe someone will say: “Don’t bother, it’s a waste of time.” I’ll accept those answers too. But I’d still like to hear different perspectives. If you can, please recommend good video courses on Java that would help me learn faster and in a more structured way. To repeat: this is something from my childhood that I never finished. My job is stable now, and I have time — at least sometimes. I can work on this calmly, as long as my learning goes in the right direction. I think you get it: this is something “for the soul,” and I really want to grow in it. Thanks to everyone who read to the end. I really appreciate any advice. And if someone is open to chatting privately or by voice — I’d gladly talk, and I’m happy to “buy a beer” for a constructive conversation. Peace to everyone!       Добрый день, господа. Я хотел бы задать вопрос тем, кто знает свое дело — и просто получить совет. Начну с главного. Я хочу попробовать изучить Java. Только для себя — мне просто нравится программирование, и это мое маленькое хобби. Хотя, возможно, еще слишком рано говорить, что мне действительно нравится Java, так как я еще не очень хорошо ее знаю. Я сразу перейду к делу. В юности, как и многие другие, я играл в Lineage 2. Позже я увлекся созданием серверов и даже сделал свой — у нас было около 70 игроков, все школьники, как и я. Я научился устанавливать сборки, добавлять NPC и различные дополнения "из интернета" еще тогда. Но мои попытки создать свои собственные дополнения Lineage 2 на Java почти всегда терпели неудачу. В лучшем случае я мог бы немного доработать готовый код, но не писать ничего с нуля. Мой интерес к Lineage 2 и Java не покидает меня и по сей день. Для меня это творческий процесс — любимая игра, в которой можно построить свою «песочницу». Мне очень хотелось бы услышать от сообщества о том, с чего вы начали. На ваш взгляд, как лучше всего изучать Java на примере Lineage 2? У меня нет четкого плана обучения — и, вероятно, в этом проблема. Я пробовал читать книгу Герберта Шилдта, а также пытался изучать исходные коды Java различных серверных сборок, копаясь вокруг, чтобы понять, как работает сервер и как пишутся программы. Не могу сказать, что я ничего не понимаю — я кое-что понимаю, и я верю, что у меня есть к этому способности. Но это не систематично. Возможно, мне действительно нужен совет от более опытных людей, чтобы найти стратегию, которая была бы одновременно эффективной для изучения Java и интересной, потому что она связана с Lineage 2, а не просто писать абстрактные программы «впустую». В Lineage 2 результат виден сразу — и я искренне радуюсь даже от маленьких успехов. Итак, вот главное: я хотел бы знать, с чего вы начали. Стоит ли вообще совмещать Java и Lineage 2? В последнее время ChatGPT очень помог — благодаря ему я добился некоторого прогресса и начал хотя бы немного разбираться в структуре сервера. Но есть одна проблема: если я просто скопирую и вставлю, результат работает, но без ChatGPT я не могу воспроизвести его самостоятельно. Я работал с исходными файлами PwSoft — думаю, многие их знают. Почему именно они? Я не могу точно сказать — вероятно, потому что в сети есть много готовых дополнений для этой сборки, и я изначально больше сосредоточился на модификации существующего кода, чем на написании своего. Я долгое время работал с PwSoft. Потом, по совету ChatGPT, я перешел на aCis — он чище, минималистичнее, без лишнего «беспорядка». Так проще понять, где что находится. Я установил исходники aCis, все нормально компилируется, но... Если в PwSoft я мог хотя бы ориентироваться в коде и писать простые методы, то в aCis я не смог сделать даже базового NPC, который дает благородство для adena. Вот почему я решил написать этот пост — просто чтобы поговорить об изучении Java через Lineage 2, услышать ваши мнения, ваши истории, ваши подходы. Может быть, кто-то скажет: «Не заморачивайтесь, это пустая трата времени». Я тоже приму эти ответы. Но я все же хотел бы услышать разные точки зрения. Если можете, пожалуйста, порекомендуйте хорошие видеокурсы по Java, которые помогут мне учиться быстрее и более структурированно. Повторюсь: это что-то из моего детства, которое я так и не закончил. Моя работа сейчас стабильна, и у меня есть время — хотя бы иногда. Я могу спокойно работать над этим, пока мое обучение идет в правильном направлении. Думаю, вы поняли: это что-то «для души», и я очень хочу в этом расти. Спасибо всем, кто дочитал до конца. Я очень ценю любой совет. А если кто-то открыт для личного общения или голосом — я с удовольствием поговорю, и с удовольствием «куплю пиво» для конструктивного разговора. Всем мира!😀🤝
    • 亲爱的朋友们,我们很高兴地宣布一个好消息—— 我们正式推出我们的新机器人,用于购买和租用虚拟号码以接收来自任何服务的短信!您是否已经厌倦了其他平台上重复使用或转售的号码? 试试我们的解决方案! 我们的服务允许您接收来自任何主流热门服务的短信。 服务列表包含超过 200 个项目! 短信接收国家:美国 (+1)。我们使用真实的美国实体号码——从未在其他平台上使用过! 目前仅提供短期租用。每个电话号码的租用时长会在购买时显示。 每个号码的价格也会在购买前显示在对应的服务旁。 您还可以为所选服务的号码接收额外短信(接收额外短信无需额外费用)。 若要快速找到所需服务,可使用便捷的搜索功能——只需输入您所需服务的名称即可获得激活号码。 可用支付方式:加密货币、银行卡,以及从我们其他机器人转移余额。 感谢您的信任! 有效链接: 虚拟号码服务:前往 数字商品商店(网站):前往 商店 Telegram 机器人:前往 – 通过 Telegram 信使方便地访问商店。 Telegram 星星购买机器人:前往 – 在 Telegram 中快速且优惠地购买星星。 SMM 面板:前往 – 推广您的社交媒体账户。 我们向您展示当前的促销与特别优惠,用于购买我们平台的商品和服务: 1. 使用促销码 OCTOBER2025(8% 折扣)在十月份于我们的商店(网站、机器人)购物!您也可以使用首次购买促销码:SOCNET(15% 折扣) 2. 获得 $1 商店余额或 10–20% 折扣 —— 注册后在我们网站按以下格式发布用户名:"SEND ME BONUS, MY USERNAME IS..." —— 并将其发布在我们的论坛主题中! 3. 获取 SMM 面板首个试用奖励 $1 —— 只需在我们网站(支持)提交标题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和星星购买机器人中赠送 Telegram 星星! 新闻: ➡ 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 ➡ ✉ 邮箱:solomonbog@socnet.store
    • 亲爱的朋友们,我们很高兴地宣布一个好消息—— 我们正式推出我们的新机器人,用于购买和租用虚拟号码以接收来自任何服务的短信!您是否已经厌倦了其他平台上重复使用或转售的号码? 试试我们的解决方案! 我们的服务允许您接收来自任何主流热门服务的短信。 服务列表包含超过 200 个项目! 短信接收国家:美国 (+1)。我们使用真实的美国实体号码——从未在其他平台上使用过! 目前仅提供短期租用。每个电话号码的租用时长会在购买时显示。 每个号码的价格也会在购买前显示在对应的服务旁。 您还可以为所选服务的号码接收额外短信(接收额外短信无需额外费用)。 若要快速找到所需服务,可使用便捷的搜索功能——只需输入您所需服务的名称即可获得激活号码。 可用支付方式:加密货币、银行卡,以及从我们其他机器人转移余额。 感谢您的信任! 有效链接: 虚拟号码服务:前往 数字商品商店(网站):前往 商店 Telegram 机器人:前往 – 通过 Telegram 信使方便地访问商店。 Telegram 星星购买机器人:前往 – 在 Telegram 中快速且优惠地购买星星。 SMM 面板:前往 – 推广您的社交媒体账户。 我们向您展示当前的促销与特别优惠,用于购买我们平台的商品和服务: 1. 使用促销码 OCTOBER2025(8% 折扣)在十月份于我们的商店(网站、机器人)购物!您也可以使用首次购买促销码:SOCNET(15% 折扣) 2. 获得 $1 商店余额或 10–20% 折扣 —— 注册后在我们网站按以下格式发布用户名:"SEND ME BONUS, MY USERNAME IS..." —— 并将其发布在我们的论坛主题中! 3. 获取 SMM 面板首个试用奖励 $1 —— 只需在我们网站(支持)提交标题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和星星购买机器人中赠送 Telegram 星星! 新闻: ➡ 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 ➡ ✉ 邮箱: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