Otorga a los jugadores online una recompensa, sistema dual-box añadido.
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java (revision 95)
+++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -99,6 +99,7 @@
import net.sf.l2j.gameserver.model.entity.custom.HzVoteReward;
import net.sf.l2j.gameserver.model.entity.custom.LMS;
import net.sf.l2j.gameserver.model.entity.custom.LuckyChests;
+import net.sf.l2j.gameserver.model.entity.custom.MiniReward;
import net.sf.l2j.gameserver.model.entity.custom.PvPMaster;
import net.sf.l2j.gameserver.model.entity.custom.QuizEvent;
import net.sf.l2j.gameserver.model.entity.custom.SoloEvent;
@@ -286,6 +287,9 @@
Util.printSection("Custom");
AchievementsManager.getInstance();
L2BufferInstance.makeBufferBuffsList();
+ if (Config.ALLOW_MINI_REWARD_SYSTEM){
+ MiniReward.getInstance();
+ }
// -------------------------------------------- //
Index: java/net/sf/l2j/gameserver/model/entity/custom/MiniReward.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/custom/MiniReward.java (revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/custom/MiniReward.java (working copy)
@@ -0,0 +1,83 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.entity.custom;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author Debian
+ *
+ */
+public class MiniReward
+{
+ @SuppressWarnings("unused")
+ static HashMap<String, Integer> playerIps = new HashMap<String, Integer>();
+
+ public static void getInstance()
+ {
+ ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ MiniReward();
+ }
+
+ private void MiniReward()
+ {
+ Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
+ for (L2PcInstance p : pls)
+ {
+ boolean canReward = false;
+ String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
+ if (playerIps.containsKey(pIp))
+ {
+ int count = playerIps.get(pIp);
+ if (count < Config.DUALBOXES_ALLOWED)
+ {
+ playerIps.remove(pIp);
+ playerIps.put(pIp, count+1);
+ canReward = true;
+ }
+ else
+ {
+ canReward = true;
+ playerIps.put(pIp, 1);
+ }
+ }
+
+ if (canReward)
+ {
+ for (int i : Config.MINI_REWARD.keySet())
+ {
+ p.addItem("Mini Reward.", i, Config.MINI_REWARD.get(i), p, true);
+ }
+ }
+ else
+ {
+ p.sendMessage("Already "+Config.DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
+ }
+ playerIps.clear();
+ }
+ }
+ }, 0, 86400 * 1000);
+ }
+}
\ No newline at end of file
Index: config/aCis.properties
===================================================================
--- config/aCis.properties (revision 95)
+++ config/aCis.properties (working copy)
@@ -257,6 +257,18 @@
# Seconds to give back buffs after cancel.
CustomCancelSeconds = 7
+# Allow mini reward system.
+AllowMiniRewardSystem = True
+# Mini rewards (id,count;id,count;).
+MiniReward = 3481,10;
+# Dualboxes allowed.
+DualboxesAllowed = 1
+
# Restrictions so that some classes can't wear a kind of weapon.
# If they do, they get penalty.
BowRestrictedClasses =
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 95)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -264,6 +264,13 @@
public static Vector<int[]> PVP_ZONE_RESPAWN_POINTS = new Vector<>();
+ public static boolean ALLOW_MINI_REWARD_SYSTEM;
+ public static Map<Integer, Integer> MINI_REWARD = new HashMap<Integer, Integer>();
+ public static int DUALBOXES_ALLOWED;
+
// --------------------------------------------------
// Clans settings
// --------------------------------------------------
@@ -1231,6 +1238,26 @@
PVP_ZONE_RESPAWN_POINTS.add(val);
}
}
+
+ ALLOW_MINI_REWARD_SYSTEM = Boolean.parseBoolean(aCis.getProperty("AllowMiniRewardSystem", "True"));
+ String MINI_REWARD_VALUE = aCis.getProperty("MiniReward", "57,10000;");
+ String[] mini_reward_value_splitted_1 = MINI_REWARD_VALUE.split(";");
+ for (String i : mini_reward_value_splitted_1)
+ {
+ String[] mini_reward_value_splitted_2 = i.split(",");
+ MINI_REWARD.put(Integer.parseInt(mini_reward_value_splitted_2[0]), Integer.parseInt(mini_reward_value_splitted_2[1]));
+ }
+ DUALBOXES_ALLOWED = Integer.parseInt(aCis.getProperty("DualboxesAllowed", "1"));
}
catch (Exception e)
{
By Debian