Jump to content
  • 0

[help] Subclass Java


Question

Posted

Hi,

i want to compile subclass...

What should i write in L2Villagemasterinstance.java

where is Subclass changing configs,

that you can change subclasss only every 15s?

7 answers to this question

Recommended Posts

  • 0
Posted
  On 10/14/2008 at 5:50 PM, a1 said:

Hi,

i want to compile subclass...

What should i write in L2Villagemasterinstance.java

where is Subclass changing configs,

that you can change subclasss only every 15s?

well this changet :), use flood protection now!

 

 

well go /gameserver/util/FloodProtector.java

 

this is ur code,or smthink like this! a part of code!

// protected actions
public static final int PROTECTED_USEITEM = 0;
public static final int PROTECTED_ROLLDICE = 1;
public static final int PROTECTED_FIREWORK = 2;
public static final int PROTECTED_ITEMPETSUMMON = 3;
public static final int PROTECTED_HEROVOICE = 4;
public static final int PROTECTED_DROPITEM = 6;

 

Add

	public static final int PROTECTED_SUBCLASS = 5;

 

 

2nd STEP

 

go /gameserver/model/actor/instance/L2VillageMasterInstance.java

 

in imports add this

import com.l2jfree.gameserver.util.FloodProtector;

 

And Before This

player.setActiveClass(paramOne); 
      
                                     content.append("Change Subclass:<br>Your active sub class is now a <font color=\"LEVEL\">" 

 

Add This

 

                           /* 
                                      * DrHouse: Despite this is not 100% retail like, it is here to avoid some exploits during subclass changes, specially 
                                      * on small servers. TODO: On retail, each village master doesn't offer any subclass that is not given by itself so player 
                                     * always has to move to other location to change subclass after changing previously. Thanks Aikimaniac for this info. 
                                    */ 
                                     if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_SUBCLASS)) 
                                     { 
                                            _log.warn("Player "+player.getName()+" has performed a subclass change too fast"); 
                                             return; 
                                     } 

 

ps: code dont checked from me, i dont know if it work 100% well for help go

 

http://l2jfree.com:8060/browse/l2jfree/trunk/l2jfree-core/src/main/java/com/l2jfree/gameserver/util/FloodProtector.java?r1=4558&r2=4677

 

http://l2jfree.com:8060/browse/l2jfree/trunk/l2jfree-core/src/main/java/com/l2jfree/gameserver/model/actor/instance/L2VillageMasterInstance.java?r1=4672&r2=4677

 

 

  • 0
Posted

Fogotendx20

its working :),

and maybe u know how to write a message from npc, if he

get flooded by player (talking about villagemasters)

that they can change sub only after 10s ?

  • 0
Posted
  On 10/15/2008 at 7:01 AM, a1 said:

Fogotendx20

its working :),

and maybe u know how to write a message from npc, if he

get flooded by player (talking about villagemasters)

that they can change sub only after 10s ?

 

ya im know :) :D but i dont know where to put it....in wich part of code anywayi will check it!

 

  Quote
that they can change sub only after 10s ?

nop now.....delay is for 2 second! w8 a little maby they fx it,smthink like chat flood protection add Properties to can from config to chose a time!

 

smthink like this

# Time limit between using Global Chat in 100ms
GlobalChatTime = 1

 

well a little Update!

 

FloodProtector.java

/*
* 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.util;

import java.util.logging.Logger;

import javolution.util.FastMap;
import javolution.util.FastMap.Entry;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GameTimeController;

/**
* Flood protector
* 
* @author durgus
*/
public class FloodProtector
{
private static final Logger _log = Logger.getLogger(FloodProtector.class.getName());

private static FloodProtector _instance;

public static final FloodProtector getInstance()
{
	if (_instance == null)
	{
		_instance = new FloodProtector();
	}
	return _instance;
}

// =========================================================
// Data Field
private FastMap<Integer, Integer[]> _floodClient;

// =========================================================

// reuse delays for protected actions (in game ticks 1 tick = 100ms)
private static final int[] REUSEDELAY = new int[]
{
	4, 42, 42, 16, 100, 10, 20
};

// protected actions
public static final int PROTECTED_USEITEM = 0;
public static final int PROTECTED_ROLLDICE = 1;
public static final int PROTECTED_FIREWORK = 2;
public static final int PROTECTED_ITEMPETSUMMON = 3;
public static final int PROTECTED_HEROVOICE = 4;
public static final int PROTECTED_MULTISELL = 5;
public static final int PROTECTED_SUBCLASS = 6;

// =========================================================
// Constructor
private FloodProtector()
{
	_log.info("Initializing FloodProtector");
	_floodClient = new FastMap<Integer, Integer[]>(Config.FLOODPROTECTOR_INITIALSIZE).setShared(true);
}

/**
 * Add a new player to the flood protector (should be done for all players
 * when they enter the world)
 * 
 * @param playerObjId
 */
public void registerNewPlayer(int playerObjId)
{
	// create a new array
	Integer[] array = new Integer[REUSEDELAY.length];
	for (int i = 0; i < array.length; i++)
		array[i] = 0;

	// register the player with an empty array
	_floodClient.put(playerObjId, array);
}

/**
 * Remove a player from the flood protector (should be done if player loggs
 * off)
 * 
 * @param playerObjId
 */
public void removePlayer(int playerObjId)
{
	_floodClient.remove(playerObjId);
}

/**
 * Return the size of the flood protector
 * 
 * @return size
 */
public int getSize()
{
	return _floodClient.size();
}

/**
 * Try to perform the requested action
 * 
 * @param playerObjId
 * @param action
 * @return true if the action may be performed
 */
public boolean tryPerformAction(int playerObjId, int action)
{
	Entry<Integer, Integer[]> entry = _floodClient.getEntry(playerObjId);
	if (entry == null)
		return false; // player just disconnected
	Integer[] value = entry.getValue();

	if (value[action] < GameTimeController.getGameTicks())
	{
		value[action] = GameTimeController.getGameTicks() + REUSEDELAY[action];
		entry.setValue(value);
		return true;
	}
	return false;
}
}

 

well we start from 0

0,1,2,3,4,5,6

 

6=Subclass

 

here is the times!

	// reuse delays for protected actions (in game ticks 1 tick = 100ms)
private static final int[] REUSEDELAY = new int[]
{
	4, 42, 42, 16, 100, 10, 20
};

 

xmmm

0=4

1=42

2=42

3=16

4=100

5=10

6=20

 

 

well 4 is Hero Voice Flood Protection, i think HV Protection is 10 second? right?

well for subclass add 150(15 second) and remove 20 (2sec) so easy :)

 

Again little UPDATE

 

case 7: // Change Subclass - Action
                    /*
                     * Warning: the information about this subclass will be removed from the
                     * subclass list even if false!
                     */
                    if (player.modifySubClass(paramOne, paramTwo))
                    {
                    	player.stopAllEffects(); // all effects from old subclass stopped!
                    	player.setActiveClass(paramOne);

                        content.append("Change Subclass:<br>Your sub class has been changed to <font color=\"LEVEL\">"
                            + CharTemplateTable.getInstance().getClassNameById(paramTwo) + "</font>.");

                        player.sendPacket(new SystemMessage(SystemMessageId.ADD_NEW_SUBCLASS)); // Subclass added.
                    }
                    else
                    {
                        /*
                         * This isn't good! modifySubClass() removed subclass from memory
                         * we must update _classIndex! Else IndexOutOfBoundsException can turn
                         * up some place down the line along with other seemingly unrelated
                         

well in case7(change sub action) go in

 

content.append("Change Subclass:<br>Your sub class has been changed to <font color=\"LEVEL\">"
                            + CharTemplateTable.getInstance().getClassNameById(paramTwo) + "</font>.");

 

this is message when u change sub ^^ Edit it and add your message!

 

EXAMPLE

  Quote
content.append("Change Subclass:<br>Subclass Manager Edited,we Add 20 Second Penalty...so u can change your cubclass every 20 second. To Above To Stuck Skills!<br>Your sub class has been changed to <font color=\"LEVEL\">"

                            + CharTemplateTable.getInstance().getClassNameById(paramTwo) + "</font>.");

 

just play with Custom Message,play with color :) to be beuty:)

 

my english is DEAD Soz!

  • 0
Posted

is this for l2jfree??and this line you say to add

/*

                                      * DrHouse: Despite this is not 100% retail like, it is here to avoid some exploits during subclass changes, specially

                                      * on small servers. TODO: On retail, each village master doesn't offer any subclass that is not given by itself so player

                                     * always has to move to other location to change subclass after changing previously. Thanks Aikimaniac for this info.

                                    */

                                     if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_SUBCLASS))

                                     {

                                            _log.warn("Player "+player.getName()+" has performed a subclass change too fast");

                                             return;

                                     }

 

Before this

player.setActiveClass(paramOne);

     

                                     content.append("Change Subclass:<br>Your active sub class is now a <font color=\"LEVEL\">"

 

But there are o lot of lines like this so just tell me in which case we add it....

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • as you said expose connections in the server and create a communication with your AI, ironically an AI can help you do excactly that, all you need is your time i dont think you can get any help on discovering something that dont exist out of the box, thats the history with emulating l2->j in general thats what people, here you can find only positive and sometimes toxic responses, just go ahead and do stuff
    • 高质量 LinkedIn 账号新品到货,助力自信推广与影响力提升 新增商品: LinkedIn 自注册账号,带真实好友 (50/100/250/500/1000 可选) | 地区:美国/欧洲 (可选) | 完善资料 | 实机注册 | 价格起步 $10 LinkedIn 自注册账号,带真实好友 + 高级订阅 (Career/Business/Sales Navigator/Recruiter 任意选择) | 地区:美国 | 完善资料 | 实机注册 | 价格起步 $15 我们的在线商店全品类: 账号:Telegram、Facebook、Reddit、Twitter (X)、Instagram、YouTube、TikTok、Discord、VK、LinkedIn、GitHub、Snapchat、Gmail、邮箱账号 (Outlook、Firstmail、Rambler、Onet、Gazeta、GMX、Yahoo、Proton、Web.de)、Google Voice、Google Ads 高级订阅:Telegram Premium、Twitter Premium X、YouTube Premium、Spotify Premium、Netflix Premium、Discord Nitro、ChatGPT Plus/PRO、XBOX Game Pass 附加服务:Telegram Stars、代理 (IPv4、IPv6、ISP、移动)、VPN (Outline、WireGuard、其他)、VDS/RDP 服务器 优惠码:AUGUST2025 (立减 10%) 支付方式:银行卡 · 加密货币 · 其他常用方式 如何购买: 在线商店: Click Telegram 机器人: Click 其他服务: SMM 面板: Click – 推广您的社交媒体账号 使用我们的 SMM 面板可提升:Facebook、Instagram、Telegram、Spotify、Soundcloud、YouTube、Reddit、Threads、Kick、Discord、LinkedIn、Likee、VK、Twitch、Kwai、Reddit、网站流量、TikTok、Trust Pilot、Apple Music、Tripadvisor、Snapchat 等数字产品。 首次试用 SMM 面板可获得 $1 奖励:只需在我们的网站 (Support) 提交工单,主题填写 “Get Trial Bonus”。 LinkedIn 账号种类: LINKEDIN.COM 账号 | 自带邮箱 @OUTLOOK.COM / HOTMAIL.COM / @FIRSTMAIL,男女皆有,部分资料已填,注册自美国 IP | 起价 $2.5 LINKEDIN.COM 账号 | 自带邮箱 @OUTLOOK.COM / HOTMAIL.COM / @FIRSTMAIL,男女皆有,部分资料已填,注册自欧洲 IP | 起价 $2.5 LINKEDIN.COM 账号 | 自带邮箱 @OUTLOOK.COM / HOTMAIL.COM / @FIRSTMAIL.COM,男女皆有,部分资料已填,注册自混合 IP | 起价 $2.5 LinkedIn 老号 (Brute) 带真实好友 (0 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $10 LinkedIn 自注册账号,带真实好友 (50/100/250/500/1000 可选) | 地区:美国/欧洲 (可选) | 完善资料 | 实机注册 | 起价 $10 LinkedIn 自注册账号,带真实好友 + 高级订阅 (Career/Business/Sales Navigator/Recruiter 任意选择) | 地区:美国 | 完善资料 | 实机注册 | 起价 $15 LinkedIn 高级老号 (Brute) (Premium) 带 1 个月有效高级订阅 | 地区:混合 | 实机注册 | 完整访问 | 起价 $20 LinkedIn 老号 (Brute) 带真实好友 (50 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $20 LinkedIn 老号 (Brute) 带真实好友 (100+ 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $39 LinkedIn 老号 (Brute) 带真实好友 (500+ 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $69 LinkedIn 已验证老号 (Brute) 带实名验证文件 | 混合地区 | 实机注册 | 完整访问 | 起价 $89 老客户专享 — 额外折扣与优惠码! 享受 10% – 20% 折扣 或 注册即送 $1 奖励 如果您想领取注册奖励 $1 或首次购买立减 10% – 20%,您可以留言: “SEND ME BONUS, MY USERNAME IS...” 您也可以在首次购买时使用优惠码:SOCNET (15% 折扣!) 联系方式与支持: Telegram: https://t.me/socnet_support Telegram 频道: https://t.me/accsforyou_shop WhatsApp: https://wa.me/79051904467 WhatsApp 频道: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n Discord: socnet_support Discord 服务器: https://discord.gg/y9AStFFsrh 邮箱: solomonbog@socnet.store 您还可以通过以上联系方式: — 咨询批发采购 — 建立合作伙伴关系 (现有合作伙伴: https://socnet.bgng.io/partners ) — 成为我们的供应商 SocNet – 数字商品与高级订阅商店 
    • Thanks a lot for the very interesting responses! To clarify, this is only for personal learning and use, I don't plan on earning any money!
    • 高质量 LinkedIn 账号新品到货,助力自信推广与影响力提升 新增商品: LinkedIn 自注册账号,带真实好友 (50/100/250/500/1000 可选) | 地区:美国/欧洲 (可选) | 完善资料 | 实机注册 | 价格起步 $10 LinkedIn 自注册账号,带真实好友 + 高级订阅 (Career/Business/Sales Navigator/Recruiter 任意选择) | 地区:美国 | 完善资料 | 实机注册 | 价格起步 $15 我们的在线商店全品类: 账号:Telegram、Facebook、Reddit、Twitter (X)、Instagram、YouTube、TikTok、Discord、VK、LinkedIn、GitHub、Snapchat、Gmail、邮箱账号 (Outlook、Firstmail、Rambler、Onet、Gazeta、GMX、Yahoo、Proton、Web.de)、Google Voice、Google Ads 高级订阅:Telegram Premium、Twitter Premium X、YouTube Premium、Spotify Premium、Netflix Premium、Discord Nitro、ChatGPT Plus/PRO、XBOX Game Pass 附加服务:Telegram Stars、代理 (IPv4、IPv6、ISP、移动)、VPN (Outline、WireGuard、其他)、VDS/RDP 服务器 优惠码:AUGUST2025 (立减 10%) 支付方式:银行卡 · 加密货币 · 其他常用方式 如何购买: 在线商店: Click Telegram 机器人: Click 其他服务: SMM 面板: Click – 推广您的社交媒体账号 使用我们的 SMM 面板可提升:Facebook、Instagram、Telegram、Spotify、Soundcloud、YouTube、Reddit、Threads、Kick、Discord、LinkedIn、Likee、VK、Twitch、Kwai、Reddit、网站流量、TikTok、Trust Pilot、Apple Music、Tripadvisor、Snapchat 等数字产品。 首次试用 SMM 面板可获得 $1 奖励:只需在我们的网站 (Support) 提交工单,主题填写 “Get Trial Bonus”。 LinkedIn 账号种类: LINKEDIN.COM 账号 | 自带邮箱 @OUTLOOK.COM / HOTMAIL.COM / @FIRSTMAIL,男女皆有,部分资料已填,注册自美国 IP | 起价 $2.5 LINKEDIN.COM 账号 | 自带邮箱 @OUTLOOK.COM / HOTMAIL.COM / @FIRSTMAIL,男女皆有,部分资料已填,注册自欧洲 IP | 起价 $2.5 LINKEDIN.COM 账号 | 自带邮箱 @OUTLOOK.COM / HOTMAIL.COM / @FIRSTMAIL.COM,男女皆有,部分资料已填,注册自混合 IP | 起价 $2.5 LinkedIn 老号 (Brute) 带真实好友 (0 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $10 LinkedIn 自注册账号,带真实好友 (50/100/250/500/1000 可选) | 地区:美国/欧洲 (可选) | 完善资料 | 实机注册 | 起价 $10 LinkedIn 自注册账号,带真实好友 + 高级订阅 (Career/Business/Sales Navigator/Recruiter 任意选择) | 地区:美国 | 完善资料 | 实机注册 | 起价 $15 LinkedIn 高级老号 (Brute) (Premium) 带 1 个月有效高级订阅 | 地区:混合 | 实机注册 | 完整访问 | 起价 $20 LinkedIn 老号 (Brute) 带真实好友 (50 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $20 LinkedIn 老号 (Brute) 带真实好友 (100+ 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $39 LinkedIn 老号 (Brute) 带真实好友 (500+ 好友) | 混合地区 | 完善资料 | 实机注册 | 起价 $69 LinkedIn 已验证老号 (Brute) 带实名验证文件 | 混合地区 | 实机注册 | 完整访问 | 起价 $89 老客户专享 — 额外折扣与优惠码! 享受 10% – 20% 折扣 或 注册即送 $1 奖励 如果您想领取注册奖励 $1 或首次购买立减 10% – 20%,您可以留言: “SEND ME BONUS, MY USERNAME IS...” 您也可以在首次购买时使用优惠码:SOCNET (15% 折扣!) 联系方式与支持: Telegram: https://t.me/socnet_support Telegram 频道: https://t.me/accsforyou_shop WhatsApp: https://wa.me/79051904467 WhatsApp 频道: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n Discord: socnet_support Discord 服务器: https://discord.gg/y9AStFFsrh 邮箱: solomonbog@socnet.store 您还可以通过以上联系方式: — 咨询批发采购 — 建立合作伙伴关系 (现有合作伙伴: https://socnet.bgng.io/partners ) — 成为我们的供应商 SocNet – 数字商品与高级订阅商店   
  • 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