A Project for Chronicle 4 based on L2JServer.


    double XP and SP on saturdays

    Share
    avatar
    jamaica

    Posts : 135
    Join date : 2013-02-24
    Age : 28
    Location : Romania

    double XP and SP on saturdays

    Post  jamaica on 11th October 2013, 12:00

    a little code what i have just made it for low rates so....there we go..


    Code:
    Config.java

        public static float RATE_XP;
        public static float RATE_SP;
    +    public static float SATURDAY_RATE_XP;
    +    public static float SATURDAY_RATE_SP;


        RATE_XP = Float.parseFloat(server.getProperty("RateXp", "1."));
        RATE_SP = Float.parseFloat(server.getProperty("RateSp", "1."));
    +    SATURDAY_RATE_XP = Float.parseFloat(server.getProperty("SaturDayXp", "2."));
    +    SATURDAY_RATE_SP = Float.parseFloat(server.getProperty("SaturDaySp", "2."));

    Config.properties

    # =================================================================
    #                              RATES
    # =================================================================

        # Rate control
        RateXp = 1.
        RateSp = 1.
    +    SaturDayXp = 2.
    +    SaturDaySp = 2.


    L2NpcInstance.java
    _    /**
    _    * Return the Exp Reward of this L2Npc contained in the L2NpcTemplate (modified by _RATE_XP).<BR><BR>
    _    */
    _    public int getExpReward()
    _    {     
    _      return (int) (getTemplate().rewardExp * Config.RATE_XP);        
    _    }

    +    private int Savvato()
    +    {
    +      return Calendar.SATURDAY;
    +    }

    +    /**
    +    * Return the Exp Reward of this L2Npc contained in the L2NpcTemplate (modified by +RATE_XP).<BR><BR>
    +    */
    +    public int getExpReward()
    +    {
    +       if(Savvato() != 0)
    +           return (int) (getTemplate().rewardExp * Config.SATURDAY_RATE_XP);
    +       else
    +          return (int) (getTemplate().rewardExp * Config.RATE_XP);
    +          
    +    }

    _    /**
    _    * Return the SP Reward of this L2Npc contained in the L2NpcTemplate (modified by _RATE_SP).<BR><BR>
    _    */
    _    public int getSpReward()
    _    {
    _       return (int) (getTemplate().rewardSp * Config.RATE_SP);
    _    }

    +    /**
    +    * Return the SP Reward of this L2Npc contained in the L2NpcTemplate (modified by +RATE_SP).<BR><BR>
    +    */
    +    public int getSpReward()
    +    {
    +       if(Savvato() != 0)
    +          return (int) (getTemplate().rewardExp * Config.SATURDAY_RATE_SP);
    +       else
    +           return (int) (getTemplate().rewardSp * Config.RATE_SP);
    +    }
    avatar
    jamaica

    Posts : 135
    Join date : 2013-02-24
    Age : 28
    Location : Romania

    Re: double XP and SP on saturdays

    Post  jamaica on 18th October 2013, 12:18

    could someone check this script and where ive made mistake? cause i made it and untill today when i start the last tests i didnt check but it seems when i applyed this patch nobody gets xp xD
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: double XP and SP on saturdays

    Post  DnR on 19th October 2013, 15:00

    jamaica wrote:could someone check this script and where ive made mistake? cause i made it and untill today when i start the last tests i didnt check but it seems when i applyed this patch nobody gets xp xD
    What do you mean by "nobody gets xp"?
    avatar
    jamaica

    Posts : 135
    Join date : 2013-02-24
    Age : 28
    Location : Romania

    Re: double XP and SP on saturdays

    Post  jamaica on 19th October 2013, 16:14

    DnR wrote:
    jamaica wrote:could someone check this script and where ive made mistake? cause i made it and untill today when i start the last tests i didnt check but it seems when i applyed this patch nobody gets xp xD
    What do you mean by "nobody gets xp"?

    while u had this patch on, none of players gets xp, they kill mobs and they get 0 xp 0 sp
    avatar
    mystogan64

    Posts : 51
    Join date : 2013-10-04

    Re: double XP and SP on saturdays

    Post  mystogan64 on 19th October 2013, 17:04

    net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.java
    Code:

    /**
    * Return the Exp Reward of this L2NpcInstance contained in the L2NpcTemplate (modified by RATE_XP).<BR>
    * <BR>
    */
    +private int saturday()
    + {
    + return Calendar.SATURDAY;
    + }
    public int getExpReward()
    {
    + if (saturday() != 0)
    + {
    + return (int) (getTemplate().rewardExp * Config.SATURDAY_RATE_XP);
    + }
    double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
    return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
    }

    /**
    * Return the SP Reward of this L2NpcInstance contained in the L2NpcTemplate (modified by RATE_SP).<BR>
    * <BR>
    */
    public int getSpReward()
    {
    + if (saturday() != 0)
    + {
    + return (int) (getTemplate().rewardExp * Config.SATURDAY_RATE_SP);
    + }
    double rateSp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
    return (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP);
    }
    avatar
    jamaica

    Posts : 135
    Join date : 2013-02-24
    Age : 28
    Location : Romania

    Re: double XP and SP on saturdays

    Post  jamaica on 19th October 2013, 18:56

    im getting a tinny error at line

    {
    return Calendar.SATURDAY;
    }

    calendar cannot be resolved like a variable....and a tinny red X with a sign of light bulb next to it....and now im really confused..
    avatar
    mystogan64

    Posts : 51
    Join date : 2013-10-04

    Re: double XP and SP on saturdays

    Post  mystogan64 on 19th October 2013, 19:50

    jamaica wrote:im getting a tinny error at line

    {
    return Calendar.SATURDAY;
    }

    calendar cannot be resolved like a variable....and a tinny red X with a sign of light bulb next to it....and now im really confused..
    My bad , i forgot to mention that you need to import the calendar.

    Code:

    import java.util.Calendar;
    avatar
    jamaica

    Posts : 135
    Join date : 2013-02-24
    Age : 28
    Location : Romania

    Re: double XP and SP on saturdays

    Post  jamaica on 19th October 2013, 19:51

    i did....this was the first move when the error pops out but when i compiled and i recheck none of players got xp nor sp
    avatar
    dandiarena

    Posts : 95
    Join date : 2013-06-20
    Age : 26
    Location : Argentina

    Re: double XP and SP on saturdays

    Post  dandiarena on 21st October 2013, 21:25

    this works? and if its good, works only for saturday or a day that you want.
    avatar
    jamaica

    Posts : 135
    Join date : 2013-02-24
    Age : 28
    Location : Romania

    Re: double XP and SP on saturdays

    Post  jamaica on 21st October 2013, 22:14

    what misto posted works fine and if u want another day just change in configuration
    avatar
    dandiarena

    Posts : 95
    Join date : 2013-06-20
    Age : 26
    Location : Argentina

    Re: double XP and SP on saturdays

    Post  dandiarena on 30th October 2013, 01:55

    its posible to edit this code, for more days? like saturdays and sundays

    Sponsored content

    Re: double XP and SP on saturdays

    Post  Sponsored content


      Current date/time is 19th November 2017, 18:16