Jump to content
  • 0

Shadow Items Modifying.


Question

Posted (edited)

Hello cheaters. I want to make shadow items expiring even if player is offline or doesnt wear them. 

 

1. Make counter start when player obtain the item, not when equip it.

 

2. Remove all checks that can stop the task.

    Tryskell:  If you speak of aCis, try dropping all ShadowItemTaskManager.getInstance().remove( method calls, and ShadowItemTaskManager onUnequip( content. Basically said,                      what you want is one time you put the item, the counter continue no matter what.

 

3. Keep counting when player is offline (db storage).

Edited by raF

Recommended Posts

  • 0
Posted (edited)

If you speak of aCis, try dropping all ShadowItemTaskManager.getInstance().remove( method calls, and ShadowItemTaskManager onUnequip( content. Basically said, what you want is one time you put the item, the counter continue no matter what.

 

If the player instance isn't maintained by the map on player disconnection, you have to code on ShadowItemTaskManager a sql query to care about item even if player is offline.

Edited by Tryskell
  • 0
Posted

     In the ShadowItemTaskManager.java  there are 2 tasks:  onEquip & onUnequip. I already edited the 2nd one and I fixed : 2. Remove all checks that can stop the task.

 

     Now I have to change "onEquip" task to "onLogin" task.  Looking for help.

  • 0
Posted (edited)

Oh, I didn't understand you wanted the shadow weapon timer to be fired at item acquisition.

 

From implements Runnable, OnEquipListener you drop OnEquipListener and both overidden methods (you don't need them at all).

 

Then I guess you have to put content from onEquip (method you just dropped) into item acquisition method (addItem from L2PcInstance I guess).

 

There is nothing like "login" task to create. Basically you want counter starts on item acquisition (additem method) and never be stopped (drop of all possibility to remove Map entry). The only thing you have to care about after is how the content of run() is running, if it needs offline check, if it can works even if the player is offline, etc.

 

If I didn't understand, repeat your needs in detail.

Edited by Tryskell
  • 0
Posted

Here is what Ive done:

public class ShadowItemTaskManager implements Runnable
{
	private static final int DELAY = 1; // 1 second
	
	private final Map<ItemInstance, L2PcInstance> _shadowItems = new ConcurrentHashMap<>();
	
	public static final ShadowItemTaskManager getInstance()
	{
		return SingletonHolder._instance;
	}
	
	protected ShadowItemTaskManager()
	{
		// Run task each second.
		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(this, 1000, 1000);
	}
	
	public final void addItem(int slot, ItemInstance item, L2Playable playable)
	{
		// Must be a shadow item.
		if (!item.isShadowItem())
			return;
		
		// Must be a player.
		if (!(playable instanceof L2PcInstance))
			return;
		
		_shadowItems.put(item, (L2PcInstance) playable);
	}

And the full code:

 

 

 

/*
 * This program 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.
 * 
 * This program 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 net.sf.l2j.gameserver.taskmanager;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.model.actor.L2Playable;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;

/**
 * Updates the timer and removes the {@link ItemInstance} as a shadow item.
 * @author Hasha
 */
public class ShadowItemTaskManager implements Runnable
{
	private static final int DELAY = 1; // 1 second
	
	private final Map<ItemInstance, L2PcInstance> _shadowItems = new ConcurrentHashMap<>();
	
	public static final ShadowItemTaskManager getInstance()
	{
		return SingletonHolder._instance;
	}
	
	protected ShadowItemTaskManager()
	{
		// Run task each second.
		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(this, 1000, 1000);
	}
	
	public final void addItem(int slot, ItemInstance item, L2Playable playable)
	{
		// Must be a shadow item.
		if (!item.isShadowItem())
			return;
		
		// Must be a player.
		if (!(playable instanceof L2PcInstance))
			return;
		
		_shadowItems.put(item, (L2PcInstance) playable);
	}
	
	public final void remove(L2PcInstance player)
	{
		// List is empty, skip.
		if (_shadowItems.isEmpty())
			return;
		
		// For all items.
		for (Iterator<Entry<ItemInstance, L2PcInstance>> iterator = _shadowItems.entrySet().iterator(); iterator.hasNext();)
		{
			// Item is from player, remove from the list.
			if (iterator.next().getValue() == player)
				iterator.remove();
		}
	}
	
	@Override
	public final void run()
	{
		// List is empty, skip.
		if (_shadowItems.isEmpty())
			return;
		
		// For all items.
		for (Entry<ItemInstance, L2PcInstance> entry : _shadowItems.entrySet())
		{
			// Get item and player.
			final ItemInstance item = entry.getKey();
			final L2PcInstance player = entry.getValue();
			
			// Decrease item mana.
			int mana = item.decreaseMana(DELAY);
			
			// If not enough mana, destroy the item and inform the player.
			if (mana == -1)
			{
				// Remove item first.
				player.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot());
				InventoryUpdate iu = new InventoryUpdate();
				iu.addModifiedItem(item);
				player.sendPacket(iu);
				
				// Destroy shadow item, remove from list.
				player.destroyItem("ShadowItem", item, player, false);
				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_0).addItemName(item.getItemId()));
				_shadowItems.remove(item);
				
				continue;
			}
			
			// Enough mana, show messages.
			if (mana == 60 - DELAY)
				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_1).addItemName(item.getItemId()));
			else if (mana == 300 - DELAY)
				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_5).addItemName(item.getItemId()));
			else if (mana == 600 - DELAY)
				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_10).addItemName(item.getItemId()));
			
			// Update inventory every minute.
			if (mana % 60 == 60 - DELAY)
			{
				InventoryUpdate iu = new InventoryUpdate();
				iu.addModifiedItem(item);
				player.sendPacket(iu);
			}
		}
	}
	
	private static class SingletonHolder
	{
		protected static final ShadowItemTaskManager _instance = new ShadowItemTaskManager();
	}
}

 

 

  • 0
Posted

Seriously i got no answer for your question. Started just to test if i can open at least an empty server,then liked it and continued adding features in the frozen package, too lazy to change now i guess :)

  • 0
Posted

 

On 20/2/2018 at 1:58 AM, ThelwHelpRePaidia said:

@igregz why would you use frozen? 

 

With what kind of experience you support this statement? As far i saw you posted 50 questions in 2 days. As if aCis is better. You can take pure L2J interlude

from 2005 and make a better server than L2Scripts if you are patient and willing to fix.

 

30 minutes ago, igregz said:

Seriously i got no answer for your question. Started just to test if i can open at least an empty server,then liked it and continued adding features in the frozen package, too lazy to change now i guess :)

If you mean local then ok but if empty refer to online then dont bother. We don't need more servers from owners who play Lineage 2 10-12 years and because they got bored they decided to be GM's. No offense but L2 community ruined by this + shared packs. If you want to learn then okay but having no idea whats goin on then don't bother. 

  • 0
Posted
2 minutes ago, Evie Frye said:

We don't need more servers from owners who play Lineage 2 10-12 years and because they got bored they decided to be GM's.

If they played that much they could've probably create at least a good gameplay,or have some good ideas for their servers,yet most servers are totally trash.Most of 'em lack of experience even as players,and don't even know about 1st  class change q of their char.

 

41 minutes ago, igregz said:

Seriously i got no answer for your question. Started just to test if i can open at least an empty server,then liked it and continued adding features in the frozen package, too lazy to change now i guess :)

don't worry bro if you work properly and patiently you can make a decent pack ,keep up.

  • 0
Posted
Just now, camenomat0 said:

If they played that much they could've probably create at least a good gameplay,or have some good ideas for their servers,yet most servers are totally trash.Most of 'em lack of experience even as players,and don't even know about 1st  class change q of their char.

 

Most of people who asked me for help and clients were people who said "We got bored to play and we have enough experience to make a server now." 

As if Lineage 2 server is school and once u graduate you make one.

  • 0
Posted
1 minute ago, Evie Frye said:

 

Most of people who asked me for help and clients were people who said "We got bored to play and we have enough experience to make a server now." 

As if Lineage 2 server is school and once u graduate you make one.

They got bored to get pwned in an old game,so they decide to make one to pk newbies with their op gm edited chars.It's not lucky fact that only few servers are made proffesionaly while most of them are pure fail. I still remember that server i played once while the admin registered his admin char to olympiad,hahaha couldn't even use second window properly.

  • 0
Posted
5 minutes ago, camenomat0 said:

If they played that much they could've probably create at least a good gameplay,or have some good ideas for their servers,yet most servers are totally trash.Most of 'em lack of experience even as players,and don't even know about 1st  class change q of their char.

 

 why u need experience of playing? since for xxxx years there still not 100% soft w/o bugs, even newdays servers are more bugged than  old times servers... those ppl just destroying more  and more l2 with opening servers for 10-20 ppl max 

  • 0
Posted (edited)
3 minutes ago, AchYlek said:

 why u need experience of playing? since for xxxx years there still not 100% soft w/o bugs, even newdays servers are more bugged than  old times servers... those ppl just destroying more  and more l2 with opening servers for 10-20 ppl max 

Experience on playing will help you creatng a retail gameplay environment,and having knowledge on how skills or such stuff works will make job easier and of course with better results. How can you expect someone who never played to fix skills and balance the server's economy and overall gameplay? at least there should be such a Gm,with knowledge on game, quests,skills, and such stuff to support all players correctly and build the server right.

Also totally agree  on what u say on files,thats because they use shared files without even wasting a minute to test or fix.

Edited by camenomat0
  • 0
Posted
4 minutes ago, camenomat0 said:

At least there should be such a Gm,with knowledge on game, quests,skills, and such stuff to support all players correctly and build the server right.

At least there should be an admin with Java knowledge to support its own server and fix critical issue if happen - mostly their own crappy custom. Sadly, we lack this one nowadays. 

 

Get shared pack, make it live, let it roll, close. 

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

    • i'll give it a shot in a few hours and post it here
    • 🛡 GoldRush — High Five x20   A fresh High Five server focused on active progression, fair competition, and a healthy player-driven economy.   GoldRush is built for players who want a fresh spin on our beloved game that is connected to today's world via Web3 marketplace.   🌍 Server Info   Chronicle: High Five Type: Mid Rate / PvP Craft Community: International Location: Europe Time Zone: GMT+3   ⚙️ Rates   EXP: x20 SP: x20 Adena: x10 Drop: x8 Spoil: x12 Raid Boss: x3 Quest Items: x5 Quest EXP / SP: x10 Quest Adena: x5   👑 Class Progression   1st Class: Free 2nd Class: Free 3rd Class: 5,000,000 Adena   1st and 2nd class transfers reward Shadow Weapons.   ✨ Main Features   No P2W as there is no donation currency in the game Web3 Marketplace Events with real rewards Rotating accessories shop Weekly Olympiad Clean and active mid-rate progression   🧩 Community Board Features   Buffer GM Shop Gatekeeper Drop Search Rankings   🔨 Enchant Info   Max Weapon Enchant: +16 Max Armor Enchant: +12 Olympiad Max Enchant: +6   Safe Enchant: Weapons / Armor: safe to +3 Full Body Armor: safe to +4   Enchant Chance: +4 to +6: 66% +7 to +9: 60% +10 to +12: 54% +13 to +14: 48% +15 to +16: 42%   🏪 GM Shop / Gear Progression   C-grade through Dynasty gear is available through the GM Shop.   Moirai+ progression is farm, craft and raid based.   There is no admin-created endgame gear selling.   🥇 Gold Rush Economy   GoldRush includes a server-wide Adena sink system.   Players contribute Adena to the Gold Rush Collector. When the server goal is reached, limited Gold Bar stock unlocks through the Gold Merchant.   Daily Gold Rush missions also allow active players to earn Gold Bars through gameplay.   🌐 Website Player-to-Player Marketplace   GoldRush includes a website-based Web3 marketplace where players can list and trade items with each other.   Items come from real players.   The marketplace is player-to-player only.   🏛 Olympiad   Weekly Olympiad cycle. Olympiad starts at 18:00 GMT+3. Olympiad max enchant: +6.   🏰 Sieges   Castle sieges take place on Sundays at 16:00 and 20:00 GMT+3.   The first siege will happen 2 weeks after launch.   🐉 Grand Boss Respawn   Queen Ant: 24h + 2h random Core: 30h + 2h random Orfen: 48h + 2h random Baium: 120h + 3h random Antharas: 120h + 24h random Valakas: 120h + 24h random Beleth: 120h + 24h random   🎉 Events   Manual GM events with real token or gold bar rewards.   ⚔️ Fair Play   Bots are strictly forbidden and will result in a ban without warning.   Dualbox is limited to 1 box.   GoldRush is built around a healthy player-to-player economy.   🚀 What to Expect   Active farming Meaningful PvP Meaningul Farming Player-driven economy No donation currency     🔗 Join Us   Website: www.goldrushpvp.xyz Discord: https://discord.gg/kg9WXxcAY   🏁 Expected Launch: July 18 2026     If you are looking for a fresh High Five x20 server with clean structure and strong long-term potential, GoldRush is almost ready.   See you in game.
    • Collisions is from client are no way to bypass from server. Can be done from client modification need to be moded a .dll I can do the work you can contact me by DM  P.D: I already have this job done on the past
  • 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..