Como nos servidores L2 Off, este mod possibilita a comunicação entre Lideres de clan com seus membros sem que estes estejam online, apenas por uma mensagem Pop-up ao logar no servidor.

É bem simples, porém requer que a Comunnity Board esteja configurada na Opção Full.





Código:
Arrow Clan Notice
Como nos servidores L2 Off, este mod possibilita a comunicação entre Lideres de clan com seus membros sem que estes estejam online, apenas por uma mensagem Pop-up ao logar no servidor.

É bem simples, porém requer que a Comunnity Board esteja configurada na Opção Full.


Imagens:
Spoiler

Clique na imagem para abrir em tamanho real.

Clique na imagem para abrir em tamanho real.


Código:

Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
@@ -513,6 +513,15 @@
			clan.broadcastToOtherOnlineMembers(msg, activeChar);
			msg = null;
			clan.broadcastToOtherOnlineMembers(new PledgeShowMemberListUpdate(activeChar), activeChar);
+            if (clan.isNoticeEnabled())
+            {
+            	sendPacket(new NpcHtmlMessage(1, "<html><title>Clan Announcements</title><body><br><center><font color=\"CCAA00\">" +
+            			activeChar.getClan().getName() +
+            			"</font> <font color=\"6655FF\">Clan Alert Message</font></center><br>" +
+            			"<img src=\"L2UI.SquareWhite\" width=270 height=1><br>" +
+            			activeChar.getClan().getNotice().replaceAll("\r\n", "<br>") + 
+            			"</body></html>"));
+            }
         }
     }

	/**
	 * @param activeChar
	 */
Index: java/net/sf/l2j/gameserver/model/L2Clan.java
===================================================================
@@ -156,6 +156,9 @@
 
import java.util.Map;
+import java.util.logging.Level;
import java.util.logging.Logger;

 
 private int _reputationScore = 0;
     private int _rank = 0;
+    
+    private String _notice;
+    private boolean _noticeEnabled = false;
 
     /**
      * Called if a clan is referenced only by id.
	  */
@@ -870,6 +873,7 @@
             restoreSubPledges();
             restoreRankPrivs();
             restoreSkills();
+            restoreNotice();
         }
         catch (Exception e)
         {

@@ -881,6 +885,110 @@
         }
     }
 
+    private void restoreNotice()
+    {
+    	java.sql.Connection con = null;
+    	try
+    	{
+    		con = L2DatabaseFactory.getInstance().getConnection();
+    		PreparedStatement statement = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?");
+    		statement.setInt(1, getClanId());
+    		ResultSet noticeData = statement.executeQuery();
+    		
+    		while (noticeData.next())
+    		{
+    			_noticeEnabled = noticeData.getBoolean("enabled");
+    			_notice = noticeData.getString("notice");
+    		}
+    		
+    		noticeData.close();
+    		statement.close();
+    		con.close();
+    	}
+    	catch (Exception e)
+    	{
+    		_log.log(Level.SEVERE, "Error restoring clan notice.", e);
+    	}
+    	finally
+    	{
+    		try { con.close(); } catch (Exception e) {}
+    	}
+    }
+
+    private void storeNotice(String notice, boolean enabled)
+    {
+    	if (notice == null)
+    		notice = "";
+    	
+    	java.sql.Connection con = null;
+
+    	try
+    	{
+    		con = L2DatabaseFactory.getInstance().getConnection();
+
+    		if (notice.length() > 8192)
+    			notice = notice.substring(0, 8191);
+    		
+    		if (_notice != null)
+    		{
+    			PreparedStatement statement = con.prepareStatement("UPDATE clan_notices SET enabled=?,notice=? WHERE clan_id=?");
+        		if (enabled)
+            		statement.setString(1, "true");
+        		else
+            		statement.setString(1, "false");
+        		statement.setString(2, notice);
+        		statement.setInt(3, getClanId());
+                statement.execute();
+                statement.close();
+    		}
+    		else
+    		{
+        		PreparedStatement statement = con.prepareStatement("INSERT INTO clan_notices (clan_id, enabled, notice) values (?,?,?)");
+        		statement.setInt(1, getClanId());
+        		if (enabled)
+            		statement.setString(2, "true");
+        		else
+            		statement.setString(2, "false");
+        		statement.setString(3, notice);
+                statement.execute();
+                statement.close();
+    		}
+    	}
+        catch (Exception e)
+        {
+            _log.warning("Error could not store clan notice: " + e);
+        }
+        finally
+        {
+            try { con.close(); } catch (Exception e) {}
+        }
+
+    	_notice = notice;
+    	_noticeEnabled = enabled;
+    }
+
+    public void setNoticeEnabled(boolean noticeEnabled)
+    {
+    	storeNotice(_notice, noticeEnabled);
+    }
+    
+    public void setNotice(String notice)
+    {
+    	storeNotice(notice, _noticeEnabled);
+    }
+
+    public boolean isNoticeEnabled()
+    {
+    	return _noticeEnabled;
+    }
+    
+    public String getNotice()
+    {
+    	if (_notice == null)
+    		return "";
+    	return _notice;
+    }
+    
     private void restoreSkills()
     {
         java.sql.Connection con = null;

Index: java/net/sf/l2j/gameserver/communitybbs/Manager/ClanBBSManager.java
===================================================================
@@ -88,13 +88,127 @@

+import lt.equal.util.StringUtil;

 				clanhome(activeChar, index);
 			}
 		}
+		else if(command.startsWith("_bbsclan_clannotice_edit;"))
+		{
+			clanNotice(activeChar, activeChar.getClan().getClanId());
+		}
+		else if(command.startsWith("_bbsclan_clannotice_enable"))
+		{
+			activeChar.getClan().setNoticeEnabled(true);
+			clanNotice(activeChar, activeChar.getClan().getClanId());
+		}
+		else if(command.startsWith("_bbsclan_clannotice_disable"))
+		{
+			activeChar.getClan().setNoticeEnabled(false);
+			clanNotice(activeChar, activeChar.getClan().getClanId());
+		}
 		else
 		{
-			separateAndSend("<html><body><br><br><center>Commande : " + command + " pas encore implante</center><br><br></body></html>", activeChar);
+			separateAndSend("<html><body><br><br><center>Command : " + command + " needs core development</center><br><br></body></html>", activeChar);
 			
 		}
 	}
 	
+	private void clanNotice(L2PcInstance activeChar, int clanId)
+	{
+		L2Clan cl = ClanTable.getInstance().getClan(clanId);
+		if (cl != null)
+		{
+			if (cl.getLevel() < 2)
+			{
+				activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CB_IN_MY_CLAN));
+				parsecmd("_bbsclan_clanlist", activeChar);
+			}
+			else
+			{
+				final StringBuilder html = StringUtil.startAppend(2000,
+						"<html><body><br><br>" +
+						"<table border=0 width=610><tr><td width=10></td><td width=600 align=left>" +
+						"<a action=\"bypass _bbshome\">HOME</a> &gt; " +
+						"<a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>  &gt; " +
+						"<a action=\"bypass _bbsclan_clanhome;",
+						String.valueOf(clanId),
+						"\"> &amp;$802; </a>" +
+						"</td></tr>" +
+						"</table>"
+						);
+				if(activeChar.isClanLeader())
+				{
+					StringUtil.append(html,
+							"<br><br><center>" +
+							"<table width=610 border=0 cellspacing=0 cellpadding=0>" +
+							"<tr><td fixwidth=610><font color=\"AAAAAA\">The Clan Notice function allows the clan leader to send messages through a pop-up window to clan members at login.</font> </td></tr>" +
+							"<tr><td height=20></td></tr>"
+							);
+					
+					if(activeChar.getClan().isNoticeEnabled())
+						StringUtil.append(html, "<tr><td fixwidth=610> Clan Notice Function:&nbsp;&nbsp;&nbsp;Enabled&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_disable\">Disable</a>");
+					else
+						StringUtil.append(html, "<tr><td fixwidth=610> Clan Notice Function:&nbsp;&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_enable\">Enable</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;Disabled");
+					
+					StringUtil.append(html,
+							"</td></tr>" +
+							"</table>" +
+							"<img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">" +
+							"<br> <br>" +
+							"<table width=610 border=0 cellspacing=2 cellpadding=0>" +
+							"<tr><td>Edit Notice: </td></tr>" +
+							"<tr><td height=5></td></tr>" +
+							"<tr><td>" +
+							"<MultiEdit var =\"Content\" width=610 height=100>" +
+							"</td></tr>" +
+							"</table>" +
+							"<br>" +
+							"<table width=610 border=0 cellspacing=0 cellpadding=0>" +
+							"<tr><td height=5></td></tr>" +
+							"<tr>" +
+							"<td align=center FIXWIDTH=65><button value=\"&$140;\" action=\"Write Notice Set _ Content Content Content\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>" +
+							"<td align=center FIXWIDTH=45></td>" +
+							"<td align=center FIXWIDTH=500></td>" +
+							"</tr>" +
+							"</table>" +
+							"</center>" +
+							"</body>" +
+							"</html>"
+							);
+					send1001(html.toString(), activeChar);
+					send1002(activeChar,activeChar.getClan().getNotice()," ","0");
+				}
+				else
+				{
+					StringUtil.append(html,
+							"<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\">" +
+							"<center>" +
+							"<table border=0 cellspacing=0 cellpadding=0><tr>" +
+							"<td>You are not your clan's leader, and therefore cannot change the clan notice</td>" +
+							"</tr></table>"
+							);
+					if (activeChar.getClan().isNoticeEnabled())
+					{
+						StringUtil.append(html, 
+								"<table border=0 cellspacing=0 cellpadding=0>" +
+								"<tr>" +
+								"<td>The current clan notice:</td>" +
+								"</tr>" +
+								"<tr><td fixwidth=5></td>" +
+								"<td FIXWIDTH=600 align=left>" +
+								activeChar.getClan().getNotice() +
+								"</td>" +
+								"<td fixqqwidth=5></td>" +
+								"</tr>" +
+								"</table>"
+								);
+					}
+					StringUtil.append(html,
+							"</center>" +
+							"</body>" +
+							"</html>"
+							);
+					separateAndSend(html.toString(), activeChar);
+				}
+			}
+		}
+	}

	/**
	 * @param activeChar
	 */
	private void clanlist(L2PcInstance activeChar, int index)
	{
@@ -281,7 +395,7 @@

					+ ";cmail\">[CLAN MAIL]</a>&nbsp;&nbsp;");
-				html.append("<a action=\"bypass _bbsclan_clanhome;" + clanId
+				html.append("<a action=\"bypass _bbsclan_clannotice_edit;" + clanId
					+ ";cnotice\">[CLAN NOTICE]</a>&nbsp;&nbsp;");
				html.append("</td>");

@@ -367,7 +481,11 @@
 	public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
 	{
 		// TODO Auto-generated method stub
-		
+		if (ar1.equals("Set"))
+		{
+			activeChar.getClan().setNotice(ar4);
+			parsecmd("_bbsclan_clanhome;" + activeChar.getClan().getClanId(),activeChar);
+		}
 	}
 	
 }
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/communitybbs/CommunityBoard.java
===================================================================
@@ -129,6 +129,10 @@
 				{
 					RegionBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
 				}
+				else if (url.equals("Notice"))
+				{
+					ClanBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
+				}
 				else
 				{
 					ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + url + " is not implemented yet</center><br><br></body></html>", "101");

Index: java/net/sf/l2j/gameserver/util/StringUtil.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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package lt.equal.util;
+
+public final class StringUtil
+{
+	
+	private StringUtil()
+	{
+	}
+	
+	public static String concat(final String... strings)
+	{
+		final StringBuilder sbString = new StringBuilder(getLength(strings));
+		
+		for (final String string : strings)
+		{
+			sbString.append(string);
+		}
+		
+		return sbString.toString();
+	}
+	
+	public static StringBuilder startAppend(final int sizeHint, final String... strings)
+	{
+		final int length = getLength(strings);
+		final StringBuilder sbString = new StringBuilder(sizeHint > length ? sizeHint : length);
+		
+		for (final String string : strings)
+		{
+			sbString.append(string);
+		}
+		
+		return sbString;
+	}
+	
+	public static void append(final StringBuilder sbString, final String... strings)
+	{
+		sbString.ensureCapacity(sbString.length() + getLength(strings));
+		
+		for (final String string : strings)
+		{
+			sbString.append(string);
+		}
+	}
+	
+	private static int getLength(final String[] strings)
+	{
+		int length = 0;
+		
+		for (final String string : strings)
+		{
+			if (string == null)
+				length += 4;
+			else
+				length += string.length();
+		}
+		
+		return length;
+	}
+}

Index: /trunk/DataPack/sql/clan_notices.sql
===================================================================
+SET FOREIGN_KEY_CHECKS=0;
+-- ----------------------------
+-- Table structure for `clan_notices`
+-- ----------------------------
+DROP TABLE IF EXISTS `clan_notices`;
+CREATE TABLE `clan_notices` (
+  `clan_id` int(32) NOT NULL,
+  `enabled` varchar(5) NOT NULL,
+  `notice` varchar(512) NOT NULL,
+  PRIMARY KEY  (`clan_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;


Arquivos Anexados
Tipo de Arquivo: txt 	Clan Notice.txt (13.3 KB, 17 visualizações)
Última edição por Lanterna-Verde; 17-12-2010 às 08:58 PM..