Jump to content
  • 0

[How To]Clan Popping out message


Question

Posted

hey guys i was wondering how is it possible for a clan leader to write a message so it pops up when clan members log in!! this is mainly for freya-hi5 i think.. i would appreciate some help !!

6 answers to this question

Recommended Posts

  • 0
Posted

it's clan notice from community board.you have to compile communityserver(assuming you want this for l2jserver you can find it at their site,there is a guide there).obviously this feature will be under clan tab.

  • 0
Posted

so you want something like...:(example)

a clan leader press .addclanmessage ALL SIEGE AT SATUDRDAY!!!!!!

and when clan members login, this message pops up?

And the clan leader will have the right to add new / clear the messages??

 

If yes, i will work on it in some hours.

  • 0
Posted

hey guys i was wondering how is it possible for a clan leader to write a message so it pops up when clan members log in!! this is mainly for freya-hi5 i think.. i would appreciate some help !!

with client you use with project you use ?

 

also if you got epilogue + it works it is on your community board if you use interlude i advice you to search on l2jserver forums theres a patch there

  • 0
Posted

for last revision l2jserver trunk

Clan message w/o community board

core

Index: java/com/l2jserver/gameserver/model/L2Clan.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Clan.java	(revision 4874)
+++ java/com/l2jserver/gameserver/model/L2Clan.java	(working copy)
@@ -51,6 +51,7 @@
import com.l2jserver.gameserver.network.serverpackets.ExSubPledgeSkillAdd;
import com.l2jserver.gameserver.network.serverpackets.ItemList;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.PledgeReceiveSubPledgeCreated;
import com.l2jserver.gameserver.network.serverpackets.PledgeShowInfoUpdate;
import com.l2jserver.gameserver.network.serverpackets.PledgeShowMemberListAll;
@@ -174,6 +175,8 @@
	private boolean _noticeEnabled = false;
	private static final int MAX_NOTICE_LENGTH = 8192;

+	private String _clanMessage; // Non community board message
+	
	/**
	 * Called if a clan is referenced only by id.
	 * In this case all other data needs to be fetched from db
@@ -772,7 +775,7 @@
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
-			statement = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=? WHERE clan_id=?");
+			statement = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?, clan_message=? WHERE clan_id=?");
			statement.setInt(1, getLeaderId());
			statement.setInt(2, getAllyId());
			statement.setString(3, getAllyName());
@@ -781,7 +784,8 @@
			statement.setInt(6, getAllyPenaltyType());
			statement.setLong(7, getCharPenaltyExpiryTime());
			statement.setLong(8, getDissolvingExpiryTime());
-			statement.setInt(9, getClanId());
+			statement.setString(9, getClanMessage());
+			statement.setInt(10, getClanId());
			statement.execute();
			if (Config.DEBUG)
				_log.fine("New clan leader saved in db: " + getClanId());
@@ -900,7 +904,7 @@
			L2ClanMember member;

			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,reputation_score,auction_bid_at,ally_penalty_expiry_time,ally_penalty_type,char_penalty_expiry_time,dissolving_expiry_time FROM clan_data where clan_id=?");
+			PreparedStatement statement = con.prepareStatement("SELECT clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,reputation_score,auction_bid_at,ally_penalty_expiry_time,ally_penalty_type,char_penalty_expiry_time,dissolving_expiry_time,clan_message FROM clan_data where clan_id=?");
			statement.setInt(1, getClanId());
			ResultSet clanData = statement.executeQuery();

@@ -930,6 +934,8 @@
				setReputationScore(clanData.getInt("reputation_score"), false);
				setAuctionBiddedAt(clanData.getInt("auction_bid_at"), false);

+				setMessage(clanData.getString("clan_message"));
+				
				int leaderId = (clanData.getInt("leader_id"));

				PreparedStatement statement2 = con.prepareStatement("SELECT char_name,level,classid,charId,title,power_grade,subpledge,apprentice,sponsor,sex,race FROM characters WHERE clanid=?");
@@ -2835,4 +2841,45 @@
			}
		}
	}
+	
+	public String getClanMessage()
+	{
+		return _clanMessage;
+	}
+	
+	public void setMessage(final String message)
+	{
+		_clanMessage = message;
+	}
+	
+	public void sendEditWindow(final L2PcInstance leader)
+	{
+		try
+		{
+			NpcHtmlMessage msg = new NpcHtmlMessage(5);
+			msg.setFile(null, "data/html/changeclanmsg.htm");
+			msg.replace("%defaultText%", getClanMessage() != null && !getClanMessage().isEmpty()?
+					getClanMessage() : "");
+			leader.sendPacket(msg);
+		} 
+		catch(NullPointerException npe)
+		{
+			_log.warning("L2Clan: Could not find the edit clan message html! : data/html/changeclanmsg.htm");
+		}
+	}
+	
+	public void sendClanMessage(final L2PcInstance member)
+	{
+		try
+		{
+			NpcHtmlMessage msg = new NpcHtmlMessage(5);
+			msg.setFile(null, "data/html/clanmessage.htm");
+			msg.replace("%message%", getClanMessage());
+			member.sendPacket(msg);
+		}
+		catch(NullPointerException npe)
+		{
+			_log.warning("L2Clan: Could not find the clan message html!: data/html/clanmessage.htm");
+		}
+	}
}
Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java	(revision 4874)
+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -195,6 +195,10 @@
		{
			activeChar.sendPacket(new PledgeSkillList(activeChar.getClan()));

+			final String clanMessage = activeChar.getClan().getClanMessage();
+			if(clanMessage != null && !clanMessage.isEmpty())
+				activeChar.getClan().sendClanMessage(activeChar);
+			
			notifyClanMembers(activeChar);

			notifySponsorOrApprentice(activeChar);
Index: java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java	(revision 4874)
+++ java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java	(working copy)
@@ -27,6 +27,7 @@
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2CharPosition;
+import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.L2Npc;
@@ -241,6 +242,33 @@
					Hero.getInstance().showHeroDiary(player, heroclass, heroid, heropage);
				}
			}
+			else if(_command.startsWith("editClanNotice"))
+			{
+				if(!activeChar.isClanLeader())
+				{
+					activeChar.sendMessage("You must be a clan leader to change such text!");
+					return;
+				}
+				String msg = _command.substring(15);
+				if(msg.length() > 100)
+				{
+					activeChar.sendMessage("The text cannot be over 100 characters lenght");
+					activeChar.getClan().sendEditWindow(activeChar);
+					return;
+				}
+				final L2Clan clan = activeChar.getClan();
+				clan.setMessage(msg);
+				if(msg != null && !msg.isEmpty()) // Update notice for online members
+				{
+					for(L2PcInstance mem : clan.getOnlineMembers(0))
+					{
+						if(mem != null)
+							clan.sendClanMessage(mem);
+					}
+				}
+			}
			else
			{
				final IBypassHandler handler = BypassHandler.getInstance().getBypassHandler(_command);

DP

Index: data/html/changeclanmsg.htm
===================================================================
--- data/html/changeclanmsg.htm	(revision 0)
+++ data/html/changeclanmsg.htm	(revision 0)
@@ -0,0 +1,23 @@
+<html>
+<title>Clan Message Editor</title>
+<body>
+Here you will be able to edit your clan's MOTD. Enter the text in the <font color=LEVEL>above box</font> and press <font color=LEVEL>"Set Text"</font>
+<br>
+<center>
+Current Message
+<br>
+<font color="2E9AFE">
+%defaultText%
+</font>
+<br><br>
+<center>
+<font color="FF0000">NOTE: If you enter an empty text, no page will pop up for clan members.</font>
+<br>
+MAX: 100 characters
+<br>
+<MultiEdit var="textbox" width=240 height=100>
+<br>
+<a action="bypass -h editClanNotice $textbox">Set Text</a>
+</center>
+</body>
+</html>
\ No newline at end of file
Index: data/html/clanmessage.htm
===================================================================
--- data/html/clanmessage.htm	(revision 0)
+++ data/html/clanmessage.htm	(revision 0)
@@ -0,0 +1,8 @@
+<html>
+<title>Clan Message</title>
+<center>
+Here is the message of your clan:
+<br>
+%message%
+</body>
+</html>
\ No newline at end of file
Index: data/scripts/handlers/voicedcommandhandlers/ClanMessage.java
===================================================================
--- data/scripts/handlers/voicedcommandhandlers/ClanMessage.java	(revision 0)
+++ data/scripts/handlers/voicedcommandhandlers/ClanMessage.java	(revision 0)
@@ -0,0 +1,31 @@
+/**
+ * 
+ */
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author BiggBoss
+ */
+public final class ClanMessage implements IVoicedCommandHandler
+{
+	private final String[] CMD = {"editClanMessage"};
+	
+	@Override
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+	{
+		if(!activeChar.isClanLeader())
+			return false;
+		
+		activeChar.getClan().sendEditWindow(activeChar);
+		return true;
+	}
+
+	@Override
+	public String[] getVoicedCommandList()
+	{
+		return CMD;
+	}	
+}
Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java	(revision 8319)
+++ data/scripts/handlers/MasterHandler.java	(working copy)
@@ -243,6 +243,7 @@
import handlers.usercommandhandlers.Time;
import handlers.voicedcommandhandlers.Banking;
import handlers.voicedcommandhandlers.ChatAdmin;
+import handlers.voicedcommandhandlers.ClanMessage;
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.Lang;
import handlers.voicedcommandhandlers.TvTVoicedInfo;
@@ -552,6 +553,7 @@
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Lang());
		if (Config.L2JMOD_DEBUG_VOICE_COMMAND)
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Debug());
+		VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new ClanMessage());
		_log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers");
	}

Index: dist/sql/server/clan_data.sql
===================================================================
--- dist/sql/server/clan_data.sql	(revision 8319)
+++ dist/sql/server/clan_data.sql	(working copy)
@@ -15,6 +15,7 @@
   `ally_penalty_type` DECIMAL( 1 ) NOT NULL DEFAULT 0,
   `char_penalty_expiry_time` bigint(13) unsigned NOT NULL DEFAULT '0',
   `dissolving_expiry_time` bigint(13) unsigned NOT NULL DEFAULT '0',
+  `clan_message` varchar(100), -- 100 = text lenght
   PRIMARY KEY (`clan_id`),
   KEY `leader_id` (`leader_id`),
   KEY `ally_id` (`ally_id`)

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

    • Stop bothering people with these servers you don’t even have. Especially these L2GOLD files. We are talking about the L2gold.eu server that i opened myself in March 2024. No one had access to my files -  not the source code and not the server files. You are very smart, but from the screenshots, I can see you are not even an admin with this character        edit:  P.S.  JERK
    • Stop bothering people with these servers you don’t even have. Especially these L2GOLD files. We are talking about the L2gold.eu server that i opened myself in March 2024. No one had access to my files -  not the source code and not the server files. You are very smart, but from the screenshots, I can see you are not even an admin with this character 🙂       edit:  P.S.  JERK
    • SPECIAL OFFER UNTIL 31 JUNE.   150euro, don't miss it.
    • OFFER UNTIL 31 JUNE   Complete Server Pack + Source Files:   C4 Scions Of Destiny: P656 Retail X1 L2OFF Server Pack + Source: Price: 100EUR   C4 Scions Of Destiny: P656 ESL2 Athena x45 L2OFF Server Pack + Source: Price: 100EUR Screenshots: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl   C6 Interlude: P746 ESL2 Athena x45 L2OFF Server Pack + Source: Price: 100EUR The same as C4 but in C6 Client so the Screenshots is the same: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl   C6 Interlude: P746 L2Gold L2OFF Server Pack + Source: Price: 100EUR Screenshots: https://imgur.com/a/9kB3oA9   C6 - Classic Interlude: P110 ESL2 Athena x45 L2OFF Server Pack + Source: Price: 200EUR Screenshots: https://imgur.com/a/Z2kZxuv   Contact me here via PM (only serious buyers).    Payments via: - Paypal (Friends and Family)
    • Hey everyone! I’m giving away 5 lifetime licenses for my newly developed pixel bot – perfect for Lineage 2 and similar games. The bot automates combat, buffing, and other in-game actions with an easy GUI and advanced Telegram-based license control.   NOTE: You’ll need an Arduino Leonardo (or compatible HID device) for this bot to work! This is what makes the keypresses undetectable and safe from game protection. ✅ Features: Fully external (no memory injection, no bans) Works with Arduino Leonardo as HID keyboard Easy step-by-step GUI (no coding needed) Buffs, attack, targeting automation Bypasses most modern kernel anticheats Lifetime license, Telegram-based anti-piracy 💡 How To Get A Free License? Just reply here or send me a PM with: Why you want to try the bot What server you’ll use it on First 5 users get a free lifetime license! 💬 Contact: Telegram: @LetoKanaleto Questions? Ask here or PM me. Setup help provided!   VirusTotal https://www.virustotal.com/gui/file/472510b9271a31908bd29a620988e74f67e1f1c783ac1cac80f89cc187c3793d/detection https://www.virustotal.com/gui/file/006a5a4b5c4fc369300ed44f250df5776f0b2a863de44242d2916c0b455772c5/detection   Mega: https://mega.nz/file/m8MzRbLR#VUZ21msDcwfk5o_5CtCBC7KL6iZkXAlUSPLb5kw3v0A Google: https://drive.google.com/file/d/11X0eISEFa63EhKcZwaVwDAMibAWbzaQv/view?usp=sharing
  • 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