Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 84)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -1281,6 +1281,10 @@
- + public static int ID_REWARD;
- + public static int MIN_PVP;
- + ID_REWARD = players.getProperty("IdReward", 57);
- + MIN_PVP = players.getProperty("MinPvp", 200);
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/IUserCommandHandler.java (revision 84)
- +++ java/net/sf/l2j/gameserver/handler/IUserCommandHandler.java (working copy)
- @@ -25,6 +25,7 @@
- + import net.sf.l2j.gameserver.handler.usercommandhandlers.SocialTime;
- - registerHandler(new Loc());
- + registerHandler(new Loc());
- + registerHandler(new SocialTime());
- ===================================================================
- --- java/net.sf.l2j.gameserver.model.actor.Player.java (revision 84)
- +++ java/net.sf.l2j.gameserver.model.actor.Player.java (working copy)
- @@ -2448,6 +2448,11 @@
- + public long getOnlineTime()
- + {
- + return _onlineTime;
- + }
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/SocialTime.java (revision 0)
- +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/SocialTime.java (working copy)
- @@ -0,0 +1,84 @@
- + package net.sf.l2j.gameserver.handler.usercommandhandlers;
- +
- + import java.math.BigDecimal;
- +
- + import net.sf.l2j.Config;
- + import net.sf.l2j.gameserver.handler.IUserCommandHandler;
- + import net.sf.l2j.gameserver.model.actor.Player;
- +
- + /**
- + * @author Juvenil Walker
- + *
- + */
- + public class SocialTime implements IUserCommandHandler
- + {
- + private static final int[] COMMAND_IDS =
- + {
- + 120,121
- + };
- +
- + @Override
- + public void useUserCommand(int id, Player activeChar)
- + {
- + int _calcule = (int) arredondaValor(1, activeChar.getOnlineTime() / 3600);
- +
- + if (id == 120)
- + {
- + if ((_calcule >= 1) && (activeChar.getPvpKills() >= Config.MIN_PVP))
- + {
- + activeChar.addItem("Coins", Config.ID_REWARD, _calcule, activeChar, true);
- + activeChar.setOnlineTime(0);
- + }
- + else
- + {
- + if (activeChar.getPvpKills() < Config.MIN_PVP)
- + activeChar.sendMessage("Você precisa de "+ Config.MIN_PVP +" pvp para prosseguir com a troca. Você só tem " + activeChar.getPvpKills() + " PvP'S");
- +
- + if (_calcule < 1)
- + activeChar.sendMessage("Você não tem 1 hora online agora.");
- + }
- + }
- + else if(id == 121)
- + {
- + if (_calcule >= 1)
- + activeChar.sendMessage("Você tem atualmente "+ _calcule +" horas online.");
- + else if (_calcule < 1)
- + activeChar.sendMessage("Você tem atualmente " + activeChar.getOnlineTime() / 60 + " minutos online.");
- + }
- +
- + return;
- + }
- +
- +
- + public double arredondaValor(int casasDecimais, double valor)
- + {
- + return new BigDecimal(valor).setScale(casasDecimais, 3).doubleValue();
- + }
- +
- + @Override
- + public int[] getUserCommandList()
- + {
- + return COMMAND_IDS;
- + }
- + }
- ===================================================================
- --- java/net/sf/l2j/gameserver/config/player.propriet (revision 0)
- +++ java/net/sf/l2j/gameserver/config/player.propriet (working copy)
- @@ -0,0 +1,84 @@
- + #============================================
- + # /tempo_online /trocar_tempo
- + #============================================
- + IdReward = 57
- + MinPvp = 200
- ===================================================================
- +++ System/commandname-e.dat
- @@ -0,0 +1,84 @@
- + 120 121 tempo_online
- + 121 120 trocar_tempo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement