Autor Tema: Event Crazy Rates [JFrozen] ~ [Acis]  (Leído 29 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado UndergrOundCodes

  • Grado C
  • *
  • Topic Author
  • Mensajes: 112
  • 00
  • Agradecimientos: 69
  • Enjoy the game
    • Facebook Page
  • Cronica: : Interlude
  • Revision: ultima
  • S.O: Windows 7
  • Serverpack : jfrozen
Event Crazy Rates [JFrozen] ~ [Acis]
« en: Marzo 27, 2020, 01:33:11 am »
gracias
Este post tiene 0 agradecimientos
  • Añade a tus favoritos
  • Evento que duplica los rates por un limite de tiempo. Esta para FROZEN  y ACIS.

    NO tuve tiempo de poder probarlo. Si funciona, avisen por aca :01:


    JFROZEN


    Código: [Seleccionar]
    Index: gameserver/config/frozen/CrazyRates.properties
    ===================================================================
    --- gameserver/config/frozen/CrazyRates.properties (revision 0)
    +++ gameserver/config/frozen/CrazyRates.properties (revision 111)
    @@ -0,0 +1,23 @@
    +# ---------------------------------------------- #
    +#        Evento Crazy Rates by allanalcantara    #
    +# ---------------------------------------------- #
    +# Nombre de evento
    +# Default = Crazy Rates
    +ChangeNameNpc = Crazy Rates
    +#==============================
    +# Rate a ser Multiplicado
    +# Default : 2
    +RateMultipler = 2
    +#==============================
    +# Tiempo para iniciar el evento despues de iniciar el servidor
    +# Default = 10 / 10 Minuts.
    +StartEventTime = 10
    +#==============================
    +# Tiempo para nuevas taxas
    +# Default = 10 / 10 minutes
    +TimeWithNewRates = 10
    +#==============================
    +# Intervalo de evento
    +# Default = 30 / 30 minutes
    +TimeForStartEventAgain = 30
    +#==============================
    \ No newline at end of file
    Index: gameserver/head-src/com/l2jfrozen/gameserver/model/entity/event/CrazyRates.java
    ===================================================================
    --- gameserver/head-src/com/l2jfrozen/gameserver/model/entity/event/CrazyRates.java (revision 0)
    +++ gameserver/head-src/com/l2jfrozen/gameserver/model/entity/event/CrazyRates.java (revision 111)
    @@ -0,0 +1,73 @@
    +package com.l2jfrozen.gameserver.model.entity.event;
    +
    +import com.l2jfrozen.Config;
    +import com.l2jfrozen.gameserver.model.entity.Announcements;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
    +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jfrozen.gameserver.model.quest.Quest;
    +
    +/**
    + * Crazy Rates Event rev 5.0
    + * @author LasTravel
    + * @author allanalcantara
    + * @version L2Demonniac v5.0
    + */
    +
    + public class CrazyRates extends Quest
    + {
    + //Few Configs
    + private static final boolean AutomaticEvent = true;
    +
    + //Other config
    + private static final String EventName = "Config.NAME_NPC_EVENT";
    + private static final int RateMultipler = Config.RATE_MULTIPLER;
    +
    + //Time configs all are on minutes
    + private static final int AfterRestart = Config.START_EVENT;
    + private static final int TimeWithNewRates = Config.TIME_NEW_RATES;
    + private static final int TimeForStartEventAgain = Config.TIME_EVENT_RATES_AGAIN;
    +
    + public CrazyRates(int questId, String name, String descr)
    + {
    + super(questId, name, descr);
    +
    + //First Start After Restart or Load the script
    + startQuestTimer("FirstStartAfterRestart",AfterRestart*60000, null, null);     
    + }
    +
    + public String onAdvEvent (String event, L2NpcInstance npc, L2PcInstance player)
    + {
    + if (event.equalsIgnoreCase("FirstStartAfterRestart"))
    + {
    + Config.RATE_XP = RateMultipler*Config.RATE_XP;
    + Config.RATE_SP = RateMultipler*Config.RATE_SP;
    + Config.RATE_DROP_ITEMS = RateMultipler*Config.RATE_DROP_ITEMS;
    + Config.ITEMS_RAID = RateMultipler*Config.ITEMS_RAID;
    +       
    + Announcements.getInstance().announceToAll(EventName +", for " + TimeWithNewRates + " minute(s) the rates are  multiplied for "+ RateMultipler +". !");
    + startQuestTimer("RestoreRates",TimeWithNewRates*60000, null, null);
    + }
    +
    + if (event.equalsIgnoreCase("RestoreRates"))
    + {
    + Config.RATE_XP = Config.RATE_XP/RateMultipler;
    + Config.RATE_SP = Config.RATE_SP/RateMultipler;
    + Config.RATE_DROP_ITEMS = Config.RATE_DROP_ITEMS/RateMultipler;
    + Config.ITEMS_RAID = Config.ITEMS_RAID/RateMultipler;
    +
    + Announcements.getInstance().announceToAll(EventName + ", Rates Aumentados, Aproveitem!!");
    +
    + if (AutomaticEvent)
    + {
    + startQuestTimer("FirstStartAfterRestart",TimeForStartEventAgain*60000, null, null);
    + }
    + }
    + return "";
    + }
    +
    + public static void main(String[] args)
    + {
    + new CrazyRates(-1, EventName, "events");
    + System.out.println(EventName + " - ONLINE");
    + }
    +}
    \ No newline at end of file
    Index: gameserver/head-src/com/l2jfrozen/Config.java
    ===================================================================
    --- gameserver/head-src/com/l2jfrozen/Config.java (revision 110)
    +++ gameserver/head-src/com/l2jfrozen/Config.java (revision 111)
    @@ -1776,8 +1776,39 @@
     }

      //============================================================
    +
    + public static int RATE_MULTIPLER;
    + public static int START_EVENT;
    + public static int TIME_NEW_RATES;
    + public static int TIME_EVENT_RATES_AGAIN;
    + public static String NAME_NPC_EVENT;
    +
    + //============================================================
    +
    + public static void loadCrazyRatesConfig()
    + {
    + final String CrazyRates = FService.CRAZY_RATES_FILE;
    +
    + try
    +   {
    + Properties CrazyRatesSettings = new Properties();
    + InputStream is = new FileInputStream(new File(CrazyRates));
    + CrazyRatesSettings.load(is);
    + is.close();
    +
    + NAME_NPC_EVENT = CrazyRatesSettings.getProperty("ChangeNameNpc", "Crazy Rates");
    + RATE_MULTIPLER = Integer.parseInt(CrazyRatesSettings.getProperty("RateMultipler", "2"));
    + START_EVENT = Integer.parseInt(CrazyRatesSettings.getProperty("StartEventTime", "10"));
    + TIME_NEW_RATES = Integer.parseInt(CrazyRatesSettings.getProperty("TimeWithNewRates", "10"));
    + TIME_EVENT_RATES_AGAIN = Integer.parseInt(CrazyRatesSettings.getProperty("TimeForStartEventAgain", "30"));
    +   }
    +   catch (Exception e)
    +   {
    +    e.printStackTrace();
    +   throw new Error("Failed to Load "+CrazyRates+" File.");
    +   }
    + }

    -
     //============================================================
     public static String[] REBIRTH_ITEM_PRICE;
     public static String[] REBIRTH_MAGE_SKILL;
    Index: gameserver/head-src/com/l2jfrozen/FService.java
    ===================================================================
    --- gameserver/head-src/com/l2jfrozen/FService.java (revision 110)
    +++ gameserver/head-src/com/l2jfrozen/FService.java (revision 111)
    @@ -71,6 +71,7 @@
     public static final String EVENT_TVT_FILE = "./config/frozen/tvt.properties";
     public static final String EVENT_TW_FILE = "./config/frozen/tw.properties";
     public static final String IRC_FILE = "./config/frozen/irc.properties";
    + public static final String CRAZY_RATES_FILE = "./config/frozen/CrazyRates.properties";

     //fun -- events
     public static final String AWAY_FILE = "./config/fun/away.properties";

    -

    ACIS


    Código: [Seleccionar]
    # ==========================

    # Crazy Rates

    # ==========================

    # Rate a ser Multiplicado

    # Default : 2

    RateMultipler = 2

    # Tempo de Start ao evento Apois Iniciar o server

    # Default = 10 / 10 Minuts.

    TimeCrazy = 10

     

    /*

    * 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 .

    */

    package net.sf.l2j.gameserver.model.entity;

     

    import net.sf.l2j.Config;

    import net.sf.l2j.gameserver.util.Broadcast;

     

    public class CrazyRates

    {

    public static void DoubleRates()

    {

    Config.RATE_XP = Config.RATE_MULTIPLER * Config.RATE_XP;

    Config.RATE_SP = Config.RATE_MULTIPLER * Config.RATE_SP;

    Config.RATE_DROP_ITEMS = Config.RATE_MULTIPLER * Config.RATE_DROP_ITEMS;

    Config.RATE_DROP_ADENA = Config.RATE_MULTIPLER * Config.RATE_DROP_ADENA;

    Broadcast.announceToOnlinePlayers("O Evento Crazy Rates comecou voce tem " + Config.TIME_CRAZYRATE + " minutos para dropa e upar as rates foram multiplicadas por " + Config.RATE_MULTIPLER);

    }

     

    public static void DivideRates()

    {

    Config.RATE_XP = Config.RATE_XP / Config.RATE_MULTIPLER;

    Config.RATE_SP = Config.RATE_SP / Config.RATE_MULTIPLER;

    Config.RATE_DROP_ITEMS = Config.RATE_DROP_ITEMS / Config.RATE_MULTIPLER;

    Config.RATE_DROP_ADENA = Config.RATE_DROP_ADENA / Config.RATE_MULTIPLER;

    Broadcast.announceToOnlinePlayers("O Evento terminou !!");

    }

     

    public static void EventManager()

    {

    DoubleRates();

    try

    {

    Thread.sleep(Config.TIME_CRAZYRATE * 1000 * 60); // Tempo em Minutos

    }

    catch (Exception e)

    {

    e.printStackTrace();

    }

    DivideRates();

    }

    }

     

     

     

     

     

     

    /**Event Crazy Rate*/

    public static int RATE_MULTIPLER;

    public static int TIME_CRAZYRATE;

     

     

    RATE_MULTIPLER = Integer.parseInt(eventsCustom.getProperty("RateMultipler", "2"));

    TIME_CRAZYRATE = Integer.parseInt(eventsCustom.getProperty("TimeCrazy", "1"));

     

     

    /*

    * 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 .

    */

    package net.sf.l2j.gameserver.handler.admincommandhandlers;

     

    public class StartEvent implements Runnable

    {

    @Override

    public void run()

    {

    net.sf.l2j.gameserver.model.entity.CrazyRates.EventManager();

    }

    }

     

    /*

    * 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 .

    */

    package net.sf.l2j.gameserver.handler.admincommandhandlers;

     

    import java.util.StringTokenizer;

     

    import net.sf.l2j.commons.concurrent.ThreadPool;

     

    import net.sf.l2j.Config;

    import net.sf.l2j.gameserver.handler.IAdminCommandHandler;

    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

     

    public class AdminCrazy implements IAdminCommandHandler

    {

    private static String[] _adminCommands =

    {

    "admin_crazy_event"

    };

     

    private enum CommandEnum

    {

    admin_crazy_event

    }

     

    public void run()

    {

    net.sf.l2j.gameserver.model.entity.CrazyRates.EventManager();

    }

     

     

    @SuppressWarnings("unused")

    @Override

    public boolean useAdminCommand(String command, L2PcInstance activeChar)

    {

    StringTokenizer st = new StringTokenizer(command);

     

    CommandEnum comm = CommandEnum.valueOf(st.nextToken());

     

    if(comm == null)

    return false;

    long flush2 = 0,timeL = 0;

     

    switch(comm)

    {

    case admin_crazy_event:

    {

     

    boolean no_token = false;

     

    if(st.hasMoreTokens()){ //char_name not specified

    String doublerate = st.nextToken();

    int rate = Integer.parseInt(doublerate);

     

    Config.RATE_MULTIPLER = rate;

    if(1 == 2)

    {

     

    if (st.hasMoreTokens()) //time

    {

    String time = st.nextToken();

     

    try{

    int value = Integer.parseInt(time);

    Config.TIME_CRAZYRATE = value;

     

    ThreadPool.schedule(new StartEvent(), flush2);

     

    if(value>0)

    {

    }

    else

    {

    activeChar.sendMessage("Time must be bigger then 0!");

    return false;

    }

    }

    catch(NumberFormatException e)

    {

    activeChar.sendMessage("Time must be a number!");

    return false;

    }

    }

    else

    {

    no_token = true;

    }

    }

    }

    else

    {

    no_token=true;

    }

    if(no_token)

    {

    activeChar.sendMessage("Usage: //crazy_event [time](In Minutes)");

    return false;

    }

    }

    }

    return true;

    }

     

    @Override

    public String[] getAdminCommandList()

    {

    return _adminCommands;

    }

    }

     

     

    registerAdminCommandHandler(new AdminCrazy());


    Creditos: allanalcantara