Secret Experience

Secret Experience (https://secretexperience.net/index.php)
-   [Lineage] Java Mods (https://secretexperience.net/forumdisplay.php?f=636)
-   -   [L2JServer] Auto Rewarder (https://secretexperience.net/showthread.php?t=33945)

AiramCruZ 18-07-2013 10:47 PM

Auto Rewarder
 
Você poe um certo tempo para todos os players receberem um certo item.
Código:

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/entity/custom/AutoRewarder.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/custom/AutoRewarder.java    (revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/custom/AutoRewarder.java    (working copy)
@@ -0,0 +1,51 @@
+/*
+ * 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 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 AutoRewarder
+{     
+      public static void getInstance()
+      {
+              ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
+              {
+                      @Override
+                      public void run()
+                      {
+                              AutoReward();
+                      }
+                     
+              }, 0,Config.AUTO_REWARD_DELAY * 1000);
+      }
+      public static void AutoReward()
+      {
+              Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
+              for (L2PcInstance p : pls)
+              {
+                      p.addItem(null, Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, p, true);
+              }
+      }
+     
+}
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java  (revision 13)
+++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
@@ -90,6 +90,7 @@
 import net.sf.l2j.gameserver.model.PartyMatchRoomList;
 import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
 import net.sf.l2j.gameserver.model.entity.custom.AnnounceOnlinePlayers;
+import net.sf.l2j.gameserver.model.entity.custom.AutoRewarder;
 import net.sf.l2j.gameserver.model.entity.Castle;
 import net.sf.l2j.gameserver.model.entity.Hero;
 import net.sf.l2j.gameserver.model.olympiad.Olympiad;
@@ -272,6 +273,10 @@
                _log.config("UserCommandHandler: Loaded " + UserCommandHandler.getInstance().size() + " handlers.");
               
                Util.printSection("Custom");
+             
+              if (Config.ALLOW_AUTO_REWARDER)
+                      AutoRewarder.getInstance();
+             
                if (Config.ALLOW_WEDDING)
                {
                        CoupleManager.getInstance();
Index: config/aCis.properties
===================================================================
--- config/aCis.properties      (revision 15)
+++ config/aCis.properties      (working copy)
@@ -113,4 +113,13 @@
+
+# Auto rewarder.
+AllowAutoRewarder = True
+# Delay for reward. (in seconds)
+AutoRewardDelay = 1200
+# ID of item reward.
+AutoRewardID = 57
+# Count of item reward.
+AutoRewardCount = 1000
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 15)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -131,6 +131,11 @@
+     
+      public static boolean ALLOW_AUTO_REWARDER;
+      public static int AUTO_REWARD_DELAY;
+      public static int AUTO_REWARD_ID;
+      public static int AUTO_REWARD_COUNT;
       
        // --------------------------------------------------
        // Clans settings
@@ -866,6 +871,11 @@
+                             
+                              ALLOW_AUTO_REWARDER = Boolean.parseBoolean(aCis.getProperty("AllowAutoRewarder", "True"));
+                              AUTO_REWARD_DELAY = Integer.parseInt(aCis.getProperty("AutoRewardDelay", "1200"));
+                              AUTO_REWARD_ID = Integer.parseInt(aCis.getProperty("AutoRewardID", "57"));
+                              AUTO_REWARD_COUNT = Integer.parseInt(aCis.getProperty("AutoRewardCount", "1000"));
                        }
                        catch (Exception e)
                        {

Creditos: Debian

willll 19-07-2013 03:49 PM

Se o player estiver em .offline tbm ganha?

adriano123 19-07-2013 04:55 PM

eu tenho um sistema que fuciona no site troca tempo por itens

inclusive foi o Andre rium que montou ele ai eu so inclementei e corrigi uns bugzinhos e adaptei pra rev Fronzen


Uma hora dessa posto ela aqui!!

KaL 20-07-2013 10:15 PM

Citação:

Postado Originalmente por willll (Post 163018)
Se o player estiver em .offline tbm ganha?

Visto que o player só será removido do L2World após a desconexão total do char, sim, também receberá.


Horários baseados na GMT -3. Agora são 10:47 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.