View difference between Paste ID: hCzedjZx and c8c4ez56
SHOW: | | - or go back to the newest paste.
1
diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
2
index e0405b0..4a44fb5 100644
3
--- a/java/net/sf/l2j/Config.java
4
+++ b/java/net/sf/l2j/Config.java
5
@@ -551,7 +551,7 @@
6
 	public static boolean NO_SPAWNS;
7
 	public static boolean DEVELOPER;
8
 	public static boolean PACKET_HANDLER_DEBUG;
9
-	
10
+	public static boolean ALT_OLY_END_ANNOUNCE;
11
 	/** Deadlock Detector */
12
 	public static boolean DEADLOCK_DETECTOR;
13
 	public static int DEADLOCK_CHECK_INTERVAL;
14
@@ -952,6 +952,7 @@
15
 	private static final void loadSpecialMods()
16
 	{
17
 		final ExProperties Special = initProperties(SPECIALMODS);
18
+		ALT_OLY_END_ANNOUNCE = Boolean.parseBoolean(Special.getProperty("AltOlyEndAnnounce", "False"));
19
 		ENABLE_ALTERNATIVE_SKILL_DURATION = Boolean.parseBoolean(Special.getProperty("EnableModifySkillDuration", "false"));
20
 		if(ENABLE_ALTERNATIVE_SKILL_DURATION)
21
 		{
22
diff --git a/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java b/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
23
index 96cdf65..077081e 100644
24
--- a/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
25
+++ b/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
26
@@ -27,6 +27,7 @@
27
 import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc;
28
 import net.sf.l2j.gameserver.model.zone.type.OlympiadStadiumZone;
29
 import net.sf.l2j.gameserver.network.SystemMessageId;
30
+import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
31
 import net.sf.l2j.gameserver.network.serverpackets.NpcSay;
32
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
33
 
34
@@ -64,10 +65,10 @@
35
 	public static final String COMP_LOST = "competitions_lost";
36
 	public static final String COMP_DRAWN = "competitions_drawn";
37
 	
38
-	protected long _olympiadEnd;
39
-	protected long _validationEnd;
40
+	protected static long _olympiadEnd;
41
+	protected static long _validationEnd;
42
 	
43
-	protected OlympiadState _period;
44
+	protected static OlympiadState _period;
45
 	protected long _nextWeeklyChange;
46
 	protected int _currentCycle;
47
 	private long _compEnd;
48
@@ -389,7 +390,7 @@
49
 		}, getMillisToCompBegin());
50
 	}
51
 	
52
-	private long getMillisToOlympiadEnd()
53
+	public static long getMillisToOlympiadEnd()
54
 	{
55
 		return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
56
 	}
57
@@ -402,14 +403,35 @@
58
 		_scheduledOlympiadEnd = ThreadPool.schedule(new OlympiadEndTask(), 0);
59
 	}
60
 	
61
-	protected long getMillisToValidationEnd()
62
+	protected static long getMillisToValidationEnd()
63
 	{
64
 		if (_validationEnd > Calendar.getInstance().getTimeInMillis())
65
 			return (_validationEnd - Calendar.getInstance().getTimeInMillis());
66
 		
67
 		return 10L;
68
 	}
69
-	
70
+	public static void olympiadEnd(Player player)
71
+	{
72
+		long milliToEnd;
73
+		if(_period ==  OlympiadState.COMPETITION)
74
+		{
75
+			milliToEnd = getMillisToOlympiadEnd();
76
+		}
77
+		else
78
+		{
79
+			milliToEnd = getMillisToValidationEnd();
80
+		}
81
+		
82
+		double numSecs = milliToEnd / 1000 % 60;
83
+		double countDown = (milliToEnd / 1000 - numSecs) / 60;
84
+		int numMins = (int) Math.floor(countDown % 60);
85
+		countDown = (countDown - numMins) / 60;
86
+		int numHours = (int) Math.floor(countDown % 24);
87
+		int numDays = (int) Math.floor((countDown - numHours) / 24);
88
+		
89
+		CreatureSay cs = new CreatureSay(0, SayType.PARTY, "Announcements", "Olympiad period ends in " + numDays + " days, " + numHours + " hours and " + numMins + " mins.");
90
+		player.sendPacket(cs);
91
+	}
92
 	public boolean isOlympiadEnd()
93
 	{
94
 		return _period == OlympiadState.VALIDATION;
95
diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
96
index 48ed287..d0a9768 100644
97
--- a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
98
+++ b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
99
@@ -230,6 +230,11 @@
100
 		player.sendPacket(SevenSignsManager.getInstance().getCurrentPeriod().getMessageId());
101
 		AnnouncementData.getInstance().showAnnouncements(player, false);
102
 		
103
+		if (Config.ALT_OLY_END_ANNOUNCE)
104
+		{
105
+			Olympiad.olympiadEnd(player);
106
+		} 
107
+		
108
 		// if player is DE, check for shadow sense skill at night
109
 		if (player.getRace() == ClassRace.DARK_ELF && player.hasSkill(L2Skill.SKILL_SHADOW_SENSE))
110
 			player.sendPacket(SystemMessage.getSystemMessage((GameTimeTaskManager.getInstance().isNight()) ? SystemMessageId.NIGHT_S1_EFFECT_APPLIES : SystemMessageId.DAY_S1_EFFECT_DISAPPEARS).addSkillName(L2Skill.SKILL_SHADOW_SENSE));
111
112
113
Parte config.
114
115
+#=====================================================
116
+#       Annuncie Time Olympiad in Login Server
117
+#=====================================================
118
+# Announce olympiad end on enter world.
119
+# Default: False
120
+AltOlyEndAnnounce = True
121