Jump to content

Recommended Posts

Posted

Hello, I thought to add announcements in my server and I did by this way.

 

I am still newbie in java* so I don't know if works correct. It's really easy, but I do practice.

 

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 9)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -23,6 +23,7 @@
import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
+import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.instancemanager.CoupleManager;
import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
@@ -34,6 +35,7 @@
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.ClanHall;
import net.sf.l2j.gameserver.model.entity.Couple;
import net.sf.l2j.gameserver.model.entity.Siege;
@@ -110,6 +112,7 @@
			activeChar.sendPacket(new PledgeSkillList(activeChar.getClan()));
			notifyClanMembers(activeChar);
			notifySponsorOrApprentice(activeChar);
+			Announcements(activeChar);

			// Add message at connexion if clanHall not paid.
			ClanHall clanHall = ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan());
@@ -250,6 +253,35 @@
			activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
	}

+	public static void Announcements(L2PcInstance activeChar)
+	{
+		if (activeChar.isHero())
+		{
+			Announcements.announceToAll("Hero "+activeChar.getName()+" has been logged in.");
+		}
+		
+		/**
+		 * 
+		 * if (activeChar.isVip())
+		 * {
+		 *     Announcements.announceToAll("VIP "+activeChar.getName()+" has been logged in.");
+		 * }
+		 * 
+		 */
+					
+		L2Clan clan = activeChar.getClan();
+
+	        if (clan != null)
+	        {
+	            if (clan.hasCastle())
+	            {
+	                Castle castle = CastleManager.getInstance().getCastleById(clan.getCastleId());
+	                if ((castle != null) && (activeChar.getObjectId() == clan.getLeaderId()))
+	                    Announcements.announceToAll("Lord " + activeChar.getName() + " ruler of " + castle.getName() + " castle is now online!");
+	            }
+	        }
+	}
+	
	private static void engage(L2PcInstance cha)
	{
		int _chaid = cha.getObjectId();

 

VIP has /** because VIP system is not implemented.

 

This code includes : Hero, VIP, Castle Lord announcements.

 

Coded on aCis, have fun!

Posted

so if some1 is Hero and owner of a castle (leader) we will get 2 announcments since there are no "return;" in your mothod !

 

Good try .. keep trying

Posted

so if some1 is Hero and owner of a castle (leader) we will get 2 announcments since there are no "return;" in your mothod !

 

Good try .. keep trying

Thanks but where I have to add "return;" ?
Posted

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 9)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -23,6 +23,7 @@
import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
+import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.instancemanager.CoupleManager;
import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
@@ -34,6 +35,7 @@
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.ClanHall;
import net.sf.l2j.gameserver.model.entity.Couple;
import net.sf.l2j.gameserver.model.entity.Siege;
@@ -110,6 +112,7 @@
			activeChar.sendPacket(new PledgeSkillList(activeChar.getClan()));
			notifyClanMembers(activeChar);
			notifySponsorOrApprentice(activeChar);
+			Announcements(activeChar);

			// Add message at connexion if clanHall not paid.
			ClanHall clanHall = ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan());
@@ -250,6 +253,35 @@
			activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
	}

+	public static void Announcements(L2PcInstance activeChar)
+	{
+		if (activeChar.isHero())
+		{
+			Announcements.announceToAll("Hero "+activeChar.getName()+" has been logged in.");
+                       return;
+		}
+		
+		/**
+		 * 
+		 * if (activeChar.isVip())
+		 * {
+		 *     Announcements.announceToAll("VIP "+activeChar.getName()+" has been logged in.");
+                *     return;
+		 * }
+		 * 
+		 */
+					
+		L2Clan clan = activeChar.getClan();
+
+	        if (clan != null)
+	        {
+	            if (clan.hasCastle())
+	            {
+	                Castle castle = CastleManager.getInstance().getCastleById(clan.getCastleId());
+	                if ((castle != null) && (activeChar.getObjectId() == clan.getLeaderId()))
+                        {
+	                      Announcements.announceToAll("Lord " + activeChar.getName() + " ruler of " + castle.getName() + " castle is now online!");
+                             return;
+                        }
+	            }
+	        }
+	}
+	
	private static void engage(L2PcInstance cha)
	{
		int _chaid = cha.getObjectId();

 

something like this !

 

This way everytime that enters a check will return (aka will not continue to the next checks of the method)

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


×
×
  • 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