L2JLisvus

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    [Gift] Skill Cooldown Timestamps

    DnR
    DnR
    Admin
    Admin


    Posts : 1475
    Join date : 2012-12-03
    Age : 34

    [Gift] Skill Cooldown Timestamps Empty [Gift] Skill Cooldown Timestamps

    Post  DnR 6th August 2019, 21:10

    So this is a small feature I like, but nobody used it in older chronicles so far.
    This patch notifies players about skill remaining cooltime, just like client did since Hellbound version.
    It also uses client custom system messages that use ItemSound3.sys_shortage, just like old message.
    If you wish to avoid client customization, use sendMessage method with your own custom string texts.

    Example:
    [Gift] Skill Cooldown Timestamps System10

    Client patch (systemmsg-e.dat):
    Code:

    2303 1 There are $s2 second(s) remaining in $s1's re-use time. 0 79 9B B0 -1 ItemSound3.sys_shortage
    2304 1 There are $s2 minute(s), $s3 second(s) remaining in $s1's re-use time. 0 79 9B B0 -1 ItemSound3.sys_shortage
    2305 1 There are $s2 hour(s), $s3 minute(s), and $s4 second(s) remaining in $s1's re-use time. 0 79 9B B0 -1 ItemSound3.sys_shortage
    Or just paste file below inside your system folder and replace old one.
    File

    Server patch:
    Code:

    ### Eclipse Workspace Patch 1.0
    #P Lisvus_GameServer
    Index: java/net/sf/l2j/gameserver/model/L2Character.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/model/L2Character.java (revision 632)
    +++ java/net/sf/l2j/gameserver/model/L2Character.java (working copy)
    @@ -1198,9 +1198,7 @@
     {
     if (this instanceof L2PcInstance)
     {
    - SystemMessage sm = new SystemMessage(SystemMessage.S1_PREPARED_FOR_REUSE);
    - sm.addSkillName(skill.getId(), skill.getLevel());
    - sendPacket(sm);
    + ((L2PcInstance)this).notifySkillCoolTime(skill);
     }
     getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
     
    Index: java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java (revision 631)
    +++ java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java (working copy)
    @@ -756,6 +756,11 @@
     public static final int FALL_DAMAGE_S1 = 296;
     public static final int RELEASE_PET_ON_BOAT = 1523;
     
    + // Skill reuse timestamps
    + public static final int S2_SECONDS_REMAIMNING_FOR_REUSE_S1 = 2303;
    + public static final int S2_MINUTES_S3_SECONDS_REMAINING_FOR_REUSE_S1 = 2304;
    + public static final int S2_HOURS_S3_MINUTES_S4_SECONDS_REMAINING_FOR_REUSE_S1 = 2305;
    +
     /**
     * @param messageId
     */
    Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 633)
    +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
    @@ -8131,9 +8131,7 @@
     // Check if a skill is disabled while attacking
     if (isSkillDisabled(skill.getId()) && (isAttackingNow() || (skill.getCastRange() < 0)))
     {
    - SystemMessage sm = new SystemMessage(SystemMessage.S1_PREPARED_FOR_REUSE);
    - sm.addSkillName(skill.getId(), skill.getLevel());
    - sendPacket(sm);
    + notifySkillCoolTime(skill);
     return;
     }
     
    @@ -11709,6 +11707,52 @@
     }
     
     /**
    + * Sends messages to client to notify user for skill remaining cool time.
    + *
    + * @param skill
    + */
    + public void notifySkillCoolTime(L2Skill skill)
    + {
    + SystemMessage sm = null;
    +     Map<Integer, TimeStamp> timeStamp = getReuseTimeStamps();
    +
    +     if (timeStamp != null && timeStamp.containsKey(skill.getId()))
    +     {
    +     int remainingTime = (int)(_reuseTimeStamps.get(skill.getId()).getRemaining()/1000);
    +     int hours = remainingTime/3600;
    +     int minutes = (remainingTime%3600)/60;
    +     int seconds = (remainingTime%60);
    +     if (hours > 0)
    +     {
    +     sm = new SystemMessage(SystemMessage.S2_HOURS_S3_MINUTES_S4_SECONDS_REMAINING_FOR_REUSE_S1);
    +     sm.addSkillName(skill);
    +     sm.addNumber(hours);
    +     sm.addNumber(minutes);
    +     }
    +     else if (minutes > 0)
    +     {
    +     sm = new SystemMessage(SystemMessage.S2_MINUTES_S3_SECONDS_REMAINING_FOR_REUSE_S1);
    +     sm.addSkillName(skill);
    +     sm.addNumber(minutes);
    +     }
    +     else
    +     {
    +     sm = new SystemMessage(SystemMessage.S2_SECONDS_REMAIMNING_FOR_REUSE_S1);
    +     sm.addSkillName(skill);
    +     }
    +
    +     sm.addNumber(seconds);
    +     }
    +     else
    +     {
    +     sm = new SystemMessage(SystemMessage.S1_PREPARED_FOR_REUSE);
    +     sm.addSkillName(skill);
    +     }
    +
    +     sendPacket(sm);
    + }
    +
    + /**
          * Returns the Number of Charges this L2PcInstance got.
          * @return
          */


    Best regards,
    DnR
    DnR
    DnR
    Admin
    Admin


    Posts : 1475
    Join date : 2012-12-03
    Age : 34

    [Gift] Skill Cooldown Timestamps Empty Re: [Gift] Skill Cooldown Timestamps

    Post  DnR 8th August 2019, 18:21

    First post updated.

      Current date/time is 19th May 2024, 11:48