Bladeren bron

BETA: Minor formatting for OlympiadManagerLink.

Zoey76 13 jaren geleden
bovenliggende
commit
d6d90f68ec
1 gewijzigde bestanden met toevoegingen van 36 en 38 verwijderingen
  1. 36 38
      L2J_DataPack_BETA/data/scripts/handlers/bypasshandlers/OlympiadManagerLink.java

+ 36 - 38
L2J_DataPack_BETA/data/scripts/handlers/bypasshandlers/OlympiadManagerLink.java

@@ -42,20 +42,12 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.util.L2FastList;
 
 /**
- * 
  * @author DS
- *
  */
 public class OlympiadManagerLink implements IBypassHandler
 {
-	private static final String[] COMMANDS =
-	{
-		"olympiaddesc",
-		"olympiadnoble",
-		"olybuff",
-		"olympiad"
-	};
-
+	private static final String[] COMMANDS = { "olympiaddesc", "olympiadnoble", "olybuff", "olympiad" };
+	
 	private static final String FEWER_THAN = "Fewer than " + String.valueOf(Config.ALT_OLY_REG_DISPLAY);
 	private static final String MORE_THAN = "More than " + String.valueOf(Config.ALT_OLY_REG_DISPLAY);
 	private static final int GATE_PASS = Config.ALT_OLY_COMP_RITEM;
@@ -63,20 +55,21 @@ public class OlympiadManagerLink implements IBypassHandler
 	public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
 	{
 		if (!(target instanceof L2OlympiadManagerInstance))
+		{
 			return false;
-
+		}
+		
 		try
 		{
 			if (command.toLowerCase().startsWith(COMMANDS[0])) // desc
 			{
-				int val = Integer.parseInt(command.substring(13,14));
+				int val = Integer.parseInt(command.substring(13, 14));
 				String suffix = command.substring(14);
-				((L2OlympiadManagerInstance)target).showChatWindow(activeChar, val, suffix);
+				((L2OlympiadManagerInstance) target).showChatWindow(activeChar, val, suffix);
 			}
 			else if (command.toLowerCase().startsWith(COMMANDS[1])) // noble
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
-				
+				final NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
 				if (activeChar.isCursedWeaponEquipped())
 				{
 					html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_cursed_weapon.htm");
@@ -90,25 +83,24 @@ public class OlympiadManagerLink implements IBypassHandler
 					activeChar.sendPacket(html);
 					return false;
 				}
-				if (!activeChar.isNoble() || activeChar.getClassId().level() < 3)
+				if (!activeChar.isNoble() || (activeChar.getClassId().level() < 3))
 				{
 					html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_thirdclass.htm");
 					html.replace("%objectId%", String.valueOf(target.getObjectId()));
 					activeChar.sendPacket(html);
-					return false;					
+					return false;
 				}
 				
 				int passes;
 				int val = Integer.parseInt(command.substring(14));
-				
-				switch(val)
+				switch (val)
 				{
 					case 0: // H5 match selection
 						if (!OlympiadManager.getInstance().isRegistered(activeChar))
 						{
-							final int olympiad_round = 0;		// TODO : implement me
-							final int olympiad_week = 0;		// TODO: implement me
-							final int olympiad_participant = 0;	// TODO: implement me
+							final int olympiad_round = 0; // TODO : implement me
+							final int olympiad_week = 0; // TODO: implement me
+							final int olympiad_participant = 0; // TODO: implement me
 							
 							html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_desc2a.htm");
 							html.replace("%objectId%", String.valueOf(target.getObjectId()));
@@ -123,7 +115,7 @@ public class OlympiadManagerLink implements IBypassHandler
 							html.replace("%objectId%", String.valueOf(target.getObjectId()));
 							activeChar.sendPacket(html);
 						}
-					break;
+						break;
 					case 1: // unregister
 						OlympiadManager.getInstance().unRegisterNoble(activeChar);
 						break;
@@ -137,7 +129,9 @@ public class OlympiadManagerLink implements IBypassHandler
 							for (List<Integer> cls : allClassed)
 							{
 								if (cls != null)
+								{
 									classed += cls.size();
+								}
 							}
 						}
 						html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_registered.htm");
@@ -185,10 +179,10 @@ public class OlympiadManagerLink implements IBypassHandler
 						}
 						break;
 					case 7: // Equipment Rewards
-						MultiSell.getInstance().separateAndSend(102, activeChar, (L2Npc)target, false);
+						MultiSell.getInstance().separateAndSend(102, activeChar, (L2Npc) target, false);
 						break;
 					case 8: // Misc. Rewards
-						MultiSell.getInstance().separateAndSend(103, activeChar, (L2Npc)target, false);
+						MultiSell.getInstance().separateAndSend(103, activeChar, (L2Npc) target, false);
 						break;
 					case 9: // Your Grand Olympiad Score from the previous period is %points% point(s) | TODO: cleanup (not used anymore)
 						int point = Olympiad.getInstance().getLastNobleOlympiadPoints(activeChar.getObjectId());
@@ -207,7 +201,7 @@ public class OlympiadManagerLink implements IBypassHandler
 							iu.addModifiedItem(item);
 							activeChar.sendPacket(iu);
 							
-							SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+							final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
 							sm.addItemNumber(passes);
 							sm.addItemName(item);
 							activeChar.sendPacket(sm);
@@ -224,30 +218,32 @@ public class OlympiadManagerLink implements IBypassHandler
 			else if (command.toLowerCase().startsWith(COMMANDS[2])) // buff
 			{
 				if (activeChar.olyBuff <= 0)
+				{
 					return false;
-
+				}
+				
 				NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
 				String[] params = command.split(" ");
 				
 				if (params[1] == null)
 				{
-					_log.warning("Olympiad Buffer Warning: npcId = " + ((L2Npc)target).getNpcId() + " has no buffGroup set in the bypass for the buff selected.");
+					_log.warning("Olympiad Buffer Warning: npcId = " + ((L2Npc) target).getNpcId() + " has no buffGroup set in the bypass for the buff selected.");
 					return false;
 				}
 				int buffGroup = Integer.parseInt(params[1]);
 				
-				int[] npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(((L2Npc)target).getNpcId(), buffGroup);
+				int[] npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(((L2Npc) target).getNpcId(), buffGroup);
 				
 				if (npcBuffGroupInfo == null)
 				{
-					_log.warning("Olympiad Buffer Warning: npcId = " + ((L2Npc)target).getNpcId() + " Location: " + target.getX() + ", " + target.getY() + ", " + target.getZ() + " Player: " + activeChar.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
+					_log.warning("Olympiad Buffer Warning: npcId = " + ((L2Npc) target).getNpcId() + " Location: " + target.getX() + ", " + target.getY() + ", " + target.getZ() + " Player: " + activeChar.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
 					return false;
 				}
 				
 				int skillId = npcBuffGroupInfo[0];
 				int skillLevel = npcBuffGroupInfo[1];
 				
-				L2Skill skill = SkillTable.getInstance().getInfo(skillId,skillLevel);
+				L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel);
 				
 				target.setTarget(activeChar);
 				
@@ -283,7 +279,7 @@ public class OlympiadManagerLink implements IBypassHandler
 			}
 			else if (command.toLowerCase().startsWith(COMMANDS[3])) // olympiad
 			{
-				int val = Integer.parseInt(command.substring(9,10));
+				int val = Integer.parseInt(command.substring(9, 10));
 				
 				NpcHtmlMessage reply = new NpcHtmlMessage(target.getObjectId());
 				
@@ -292,7 +288,7 @@ public class OlympiadManagerLink implements IBypassHandler
 					case 2: // show rank for a specific class 
 						// for example >> Olympiad 1_88
 						int classId = Integer.parseInt(command.substring(11));
-						if ((classId >= 88 && classId <= 118) || (classId >= 131 && classId <= 134) || classId == 136)
+						if (((classId >= 88) && (classId <= 118)) || ((classId >= 131) && (classId <= 134)) || (classId == 136))
 						{
 							L2FastList<String> names = Olympiad.getInstance().getClassLeaderBoard(classId);
 							reply.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_ranking.htm");
@@ -300,16 +296,18 @@ public class OlympiadManagerLink implements IBypassHandler
 							int index = 1;
 							for (String name : names)
 							{
-								reply.replace("%place"+index+"%", String.valueOf(index));
-								reply.replace("%rank"+index+"%", name);
+								reply.replace("%place" + index + "%", String.valueOf(index));
+								reply.replace("%rank" + index + "%", name);
 								index++;
 								if (index > 10)
+								{
 									break;
+								}
 							}
 							for (; index <= 10; index++)
 							{
-								reply.replace("%place"+index+"%", "");
-								reply.replace("%rank"+index+"%", "");
+								reply.replace("%place" + index + "%", "");
+								reply.replace("%rank" + index + "%", "");
 							}
 							
 							reply.replace("%objectId%", String.valueOf(target.getObjectId()));
@@ -329,7 +327,7 @@ public class OlympiadManagerLink implements IBypassHandler
 		{
 			_log.log(Level.INFO, "Exception in " + e.getMessage(), e);
 		}
-
+		
 		return true;
 	}