| AiramCruZ |
18-07-2013 10:35 PM |
[Freya]Aio e Vip System
Código:
### Eclipse Workspace Patch 1.0
#P CT25-DataPack
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminVip.java
===================================================================
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminVip.java (revision 0)
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminVip.java (working copy)
@@ -0,0 +1,228 @@
+package handlers.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import ct25.xtreme.Config;
+import ct25.xtreme.L2DatabaseFactory;
+import ct25.xtreme.gameserver.GmListTable;
+import ct25.xtreme.gameserver.handler.IAdminCommandHandler;
+import ct25.xtreme.gameserver.model.L2Object;
+import ct25.xtreme.gameserver.model.L2World;
+import ct25.xtreme.gameserver.model.actor.instance.L2PcInstance;
+import ct25.xtreme.gameserver.network.SystemMessageId;
+import ct25.xtreme.gameserver.network.serverpackets.EtcStatusUpdate;
+import ct25.xtreme.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Give / Take Status Vip to Player
+ * Changes name color and title color if enabled
+ *
+ * Uses:
+ * setvip [<player_name>] [<time_duration in days>]
+ * removevip [<player_name>]
+ *
+ * If <player_name> is not specified, the current target player is used.
+ *
+ *
+ * @author KhayrusS
+ *
+ */
+public class AdminVip implements IAdminCommandHandler
+{
+ private static String[] _adminCommands = { "admin_setvip", "admin_removevip" };
+ private final static Logger _log = Logger.getLogger(AdminVip.class.getName());
+
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ /*if (!Config.ALT_PRIVILEGES_ADMIN)
+ if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
+ {
+ GmListTable.broadcastMessageToGMs("Player "+activeChar.getName()+ " tryed illegal action set vip stat");
+ return false;
+ }*/
+
+ if (command.startsWith("admin_setvip"))
+ {
+ StringTokenizer str = new StringTokenizer(command);
+ L2Object target = activeChar.getTarget();
+
+ L2PcInstance player = null;
+ SystemMessage sm = new SystemMessage(SystemMessageId.S1);
+
+ if (target != null && target instanceof L2PcInstance)
+ player = (L2PcInstance)target;
+ else
+ player = activeChar;
+
+ try
+ {
+ str.nextToken();
+ String time = str.nextToken();
+ if (str.hasMoreTokens())
+ {
+ String playername = time;
+ time = str.nextToken();
+ player = L2World.getInstance().getPlayer(playername);
+ doVip(activeChar, player, playername, time);
+ }
+ else
+ {
+ String playername = player.getName();
+ doVip(activeChar, player, playername, time);
+ }
+ if(!time.equals("0"))
+ {
+ sm.addString("You are now a Vip , congratulations!");
+ player.sendPacket(sm);
+ }
+ }
+ catch(Exception e)
+ {
+ activeChar.sendMessage("Usage: //setvip <char_name> [time](in days)");
+ }
+
+ player.broadcastUserInfo();
+ if(player.isVip())
+ return true;
+ }
+ else if(command.startsWith("admin_removevip"))
+ {
+ StringTokenizer str = new StringTokenizer(command);
+ L2Object target = activeChar.getTarget();
+
+ L2PcInstance player = null;
+
+ if (target != null && target instanceof L2PcInstance)
+ player = (L2PcInstance)target;
+ else
+ player = activeChar;
+
+ try
+ {
+ str.nextToken();
+ if (str.hasMoreTokens())
+ {
+ String playername = str.nextToken();
+ player = L2World.getInstance().getPlayer(playername);
+ removeVip(activeChar, player, playername);
+ }
+ else
+ {
+ String playername = player.getName();
+ removeVip(activeChar, player, playername);
+ }
+ }
+ catch(Exception e)
+ {
+ activeChar.sendMessage("Usage: //removevip <char_name>");
+ }
+ player.broadcastUserInfo();
+ if(!player.isVip())
+ return true;
+ }
+ return false;
+ }
+
+ public void doVip(L2PcInstance activeChar, L2PcInstance _player, String _playername, String _time)
+ {
+ int days = Integer.parseInt(_time);
+ if (_player == null)
+ {
+ activeChar.sendMessage("not found char" + _playername);
+ return;
+ }
+
+ if(days > 0)
+ {
+ _player.setVip(true);
+ _player.setEndTime("vip", days);
+
+ Connection connection = null;
+ try
+ {
+ connection = L2DatabaseFactory.getInstance().getConnection();
+
+ PreparedStatement statement = connection.prepareStatement("UPDATE characters SET vip=1, vip_end=? WHERE charId=?");
+ statement.setLong(1, _player.getVipEndTime());
+ statement.setInt(2, _player.getObjectId());
+ statement.execute();
+ statement.close();
+ connection.close();
+
+ if(Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
+ _player.getAppearance().setNameColor(Config.VIP_NCOLOR);
+
+ if(Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
+ _player.getAppearance().setTitleColor(Config.VIP_TCOLOR);
+
+ _player.broadcastUserInfo();
+ _player.sendPacket(new EtcStatusUpdate(_player));
+ GmListTable.broadcastMessageToGMs("GM "+ activeChar.getName()+ " set vip stat for player "+ _playername + " for " + _time + " day(s)");
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING,"could not set vip stats of char:", e);
+ }
+ finally
+ {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ else
+ {
+ removeVip(activeChar, _player, _playername);
+ }
+ }
+
+ public void removeVip(L2PcInstance activeChar, L2PcInstance _player, String _playername)
+ {
+ _player.setVip(false);
+ _player.setVipEndTime(0);
+
+ Connection connection = null;
+ try
+ {
+ connection = L2DatabaseFactory.getInstance().getConnection();
+
+ PreparedStatement statement = connection.prepareStatement("UPDATE characters SET vip=0, vip_end=0 WHERE charId=?");
+ statement.setInt(1, _player.getObjectId());
+ statement.execute();
+ statement.close();
+ connection.close();
+
+ _player.getAppearance().setNameColor(0xFFFFFF);
+ _player.getAppearance().setTitleColor(0xFFFFFF);
+ _player.broadcastUserInfo();
+ _player.sendPacket(new EtcStatusUpdate(_player));
+ GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" remove vip stat of player "+ _playername);
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING,"could not remove vip stats of char:", e);
+ }
+ finally
+ {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public String[] getAdminCommandList()
+ {
+ return _adminCommands;
+ }
+}
Index: dist/sql/game/characters.sql
===================================================================
--- dist/sql/game/characters.sql (revision 36)
+++ dist/sql/game/characters.sql (working copy)
@@ -58,6 +58,11 @@
`vitality_points` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`createTime` bigint(13) unsigned NOT NULL DEFAULT '0',
`language` VARCHAR(2) DEFAULT NULL,
+ `vip` decimal(1,0) NOT NULL DEFAULT 0,
+ `vip_end` decimal(20,0) NOT NULL DEFAULT 0,
+ `aio` decimal(1,0) NOT NULL DEFAULT 0,
+ `aio_end` decimal(20,0) NOT NULL DEFAULT 0,
+
PRIMARY KEY (`charId`),
KEY `account_name` (`account_name`),
KEY `char_name` (`char_name`),
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminAio.java
===================================================================
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminAio.java (revision 0)
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminAio.java (working copy)
@@ -0,0 +1,238 @@
+package handlers.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import ct25.xtreme.Config;
+import ct25.xtreme.L2DatabaseFactory;
+import ct25.xtreme.gameserver.GmListTable;
+import ct25.xtreme.gameserver.handler.IAdminCommandHandler;
+import ct25.xtreme.gameserver.model.L2Object;
+import ct25.xtreme.gameserver.model.L2World;
+import ct25.xtreme.gameserver.model.actor.instance.L2PcInstance;
+import ct25.xtreme.gameserver.network.SystemMessageId;
+import ct25.xtreme.gameserver.network.serverpackets.EtcStatusUpdate;
+import ct25.xtreme.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Give / Take Status Aio to Player
+ * Changes name color and title color if enabled
+ *
+ * Uses:
+ * setaio [<player_name>] [<time_duration in days>]
+ * removeaio [<player_name>]
+ *
+ * If <player_name> is not specified, the current target player is used.
+ *
+ *
+ * @author KhayrusS
+ *
+ */
+public class AdminAio implements IAdminCommandHandler
+{
+ private static String[] _adminCommands = { "admin_setaio", "admin_removeaio" };
+ private final static Logger _log = Logger.getLogger(AdminAio.class.getName());
+
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ /*if (!Config.ALT_PRIVILEGES_ADMIN)
+ if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
+ {
+ GmListTable.broadcastMessageToGMs("Player "+activeChar.getName()+ " tryed illegal action set Aio stat");
+ return false;
+ }*/
+
+ if (command.startsWith("admin_setaio"))
+ {
+ StringTokenizer str = new StringTokenizer(command);
+ L2Object target = activeChar.getTarget();
+
+ L2PcInstance player = null;
+ SystemMessage sm = new SystemMessage(SystemMessageId.S1);
+
+ if (target != null && target instanceof L2PcInstance)
+ player = (L2PcInstance)target;
+ else
+ player = activeChar;
+
+ try
+ {
+ str.nextToken();
+ String time = str.nextToken();
+ if (str.hasMoreTokens())
+ {
+ String playername = time;
+ time = str.nextToken();
+ player = L2World.getInstance().getPlayer(playername);
+ doAio(activeChar, player, playername, time);
+ }
+ else
+ {
+ String playername = player.getName();
+ doAio(activeChar, player, playername, time);
+ }
+ if(!time.equals("0"))
+ {
+ sm.addString("You are now a Aio, Congratulations!");
+ player.sendPacket(sm);
+ }
+ }
+ catch(Exception e)
+ {
+ activeChar.sendMessage("Usage: //setaio <char_name> [time](in days)");
+ }
+
+ player.broadcastUserInfo();
+ if(player.isAio())
+ return true;
+ }
+ else if(command.startsWith("admin_removeaio"))
+ {
+ StringTokenizer str = new StringTokenizer(command);
+ L2Object target = activeChar.getTarget();
+
+ L2PcInstance player = null;
+
+ if (target != null && target instanceof L2PcInstance)
+ player = (L2PcInstance)target;
+ else
+ player = activeChar;
+
+ try
+ {
+ str.nextToken();
+ if (str.hasMoreTokens())
+ {
+ String playername = str.nextToken();
+ player = L2World.getInstance().getPlayer(playername);
+ removeAio(activeChar, player, playername);
+ }
+ else
+ {
+ String playername = player.getName();
+ removeAio(activeChar, player, playername);
+ }
+ }
+ catch(Exception e)
+ {
+ activeChar.sendMessage("Usage: //removeaio <char_name>");
+ }
+ player.broadcastUserInfo();
+ if(!player.isAio())
+ return true;
+ }
+ return false;
+ }
+
+ public void doAio(L2PcInstance activeChar, L2PcInstance _player, String _playername, String _time)
+ {
+ int days = Integer.parseInt(_time);
+ if (_player == null)
+ {
+ activeChar.sendMessage("not found char" + _playername);
+ return;
+ }
+
+ if(days > 0)
+ {
+ _player.setAio(true);
+ _player.setEndTime("aio", days);
+ _player.getStat().addExp(_player.getStat().getExpForLevel(81));
+
+ Connection connection = null;
+ try
+ {
+ connection = L2DatabaseFactory.getInstance().getConnection();
+
+ PreparedStatement statement = connection.prepareStatement("UPDATE characters SET aio=1, aio_end=? WHERE charId=?");
+ statement.setLong(1, _player.getAioEndTime());
+ statement.setInt(2, _player.getObjectId());
+ statement.execute();
+ statement.close();
+ connection.close();
+
+ if(Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
+ _player.getAppearance().setNameColor(Config.AIO_NCOLOR);
+
+ if(Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
+ _player.getAppearance().setTitleColor(Config.AIO_TCOLOR);
+
+ _player.rewardAioSkills();
+ if(Config.ALLOW_AIO_ITEM && activeChar.isAio())
+ _player.getInventory().addItem("", Config.AIO_ITEMID, 1, _player, null);
+ _player.broadcastUserInfo();
+ _player.sendPacket(new EtcStatusUpdate(_player));
+ _player.sendSkillList();
+ GmListTable.broadcastMessageToGMs("GM "+ activeChar.getName()+ " set Aio stat for player "+ _playername + " for " + _time + " day(s)");
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING,"could not set Aio stats to char:", e);
+ }
+ finally
+ {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ else
+ {
+ removeAio(activeChar, _player, _playername);
+ }
+ }
+
+ public void removeAio(L2PcInstance activeChar, L2PcInstance _player, String _playername)
+ {
+ _player.setAio(false);
+ _player.setAioEndTime(0);
+
+ Connection connection = null;
+ try
+ {
+ connection = L2DatabaseFactory.getInstance().getConnection();
+
+ PreparedStatement statement = connection.prepareStatement("UPDATE characters SET aio=0, aio_end=0 WHERE charId=?");
+ statement.setInt(1, _player.getObjectId());
+ statement.execute();
+ statement.close();
+ connection.close();
+
+ _player.lostAioSkills();
+ if(Config.ALLOW_AIO_ITEM && activeChar.isAio() == false)
+ _player.getInventory().destroyItemByItemId("", Config.AIO_ITEMID, 1, _player, null);
+ _player.getWarehouse().destroyItemByItemId("", Config.AIO_ITEMID, 1, _player, null);
+ _player.getAppearance().setNameColor(0xFFFFFF);
+ _player.getAppearance().setTitleColor(0xFFFFFF);
+ _player.broadcastUserInfo();
+ _player.sendPacket(new EtcStatusUpdate(_player));
+ _player.sendSkillList();
+ GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" remove Aio stat of player "+ _playername);
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING,"could not remove Aio stats of char:", e);
+ }
+ finally
+ {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public String[] getAdminCommandList()
+ {
+ return _adminCommands;
+ }
+}
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 36)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -31,6 +31,7 @@
import handlers.actionhandlers.L2SummonActionShift;
import handlers.actionhandlers.L2TrapAction;
import handlers.admincommandhandlers.AdminAdmin;
+import handlers.admincommandhandlers.AdminAio;
import handlers.admincommandhandlers.AdminAnnouncements;
import handlers.admincommandhandlers.AdminBBS;
import handlers.admincommandhandlers.AdminBan;
@@ -99,6 +100,7 @@
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTvTEvent;
import handlers.admincommandhandlers.AdminUnblockIp;
+import handlers.admincommandhandlers.AdminVip;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
import handlers.bypasshandlers.Augment;
@@ -301,6 +303,7 @@
private static void loadAdminHandlers()
{
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminAdmin());
+ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminAio());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminAnnouncements());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminBan());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminBBS());
@@ -369,6 +372,7 @@
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminTest());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminTvTEvent());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminUnblockIp());
+ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminVip());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminVitality());
AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminZone());
_log.config("Loaded " + AdminCommandHandler.getInstance().size() + " AdminCommandHandlers");
#P CT25-GameServer
Index: java/ct25/xtreme/gameserver/network/serverpackets/SystemMessage.java
===================================================================
--- java/ct25/xtreme/gameserver/network/serverpackets/SystemMessage.java (revision 36)
+++ java/ct25/xtreme/gameserver/network/serverpackets/SystemMessage.java (working copy)
@@ -137,7 +137,7 @@
private SMParam[] _params;
private int _paramIndex;
- private SystemMessage(final SystemMessageId smId)
+ public SystemMessage(final SystemMessageId smId)
{
final int paramCount = smId.getParamCount();
_smId = smId;
Index: dist/game/config/l2jmods.properties
===================================================================
--- dist/game/config/l2jmods.properties (revision 36)
+++ dist/game/config/l2jmods.properties (working copy)
@@ -480,3 +480,48 @@
# will be 1+2=3. Use 0 or negative value for unlimited number of connections.
# Default: 127.0.0.1,0 (no limits from localhost)
DualboxCheckWhitelist = 127.0.0.1,0
+
+# ---------------------------------------
+# Aio System ( By KhayrusS )
+# ---------------------------------------
+# Enable / Disable Name Color
+AllowAioNameColor = True
+AioNameColor = 88AA88
+# Enable / Disable Title Color
+AllowAioTitleColor = True
+AioTitleColor = 88AA88
+
+EnableAioSystem = True
+# List of Aio Skills
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+AioSkills = 1085,3;1304,3;1087,3;1354,1;1062,2;1005,3;1243,6;1045,6;1048,6;\
+1311,6;168,3;213,8;1007,3;1309,3;1552,3;1006,3;1229,15;1308,3;1253,3;1284,3;\
+1009,3;1310,4;1363,1;1362,1;1397,3;1292,6;1078,6;307,1;276,1;309,1;274,1;275,1;\
+272,1;277,1;273,1;311,1;366,1;365,1;310,1;271,1;1242,3;1257,3;1353,3;1391,3;\
+1352,1;229,7;228,3;1077,3;1218,33;1059,3;1219,33;1217,33;1388,3;1389,3;1240,3;\
+1086,2;1032,3;1073,2;1036,2;1035,4;1068,3;1003,3;1282,2;1356,1;1355,1;1357,33;\
+1044,3;1182,3;1191,3;1033,3;1189,3;1259,4;1306,6;234,23;1040,3;364,1;264,1;306,1;\
+269,1;270,1;265,1;363,1;349,1;308,1;305,1;304,1;267,1;266,1;268,1;1390,3;1303,2;\
+1204,2;1268,4
+
+# Ativa ou Desativar a opcao de AIO ganhar Item!
+AllowAIOItem = False
+
+# ID do item que vai ganhar quando virar AIO!
+ItemIdAio = 9945
+
+# ---------------------------------------
+# Vip System ( By KhayrusS )
+# ---------------------------------------
+# Enable / Disable Name Color
+AllowVipNameColor = True
+VipNameColor = 0088FF
+# Enable / Disable Title Color
+AllowVipTitleColor = True
+VipTitleColor = 0088FF
+
+# if True Player Vip gain Xp*VipMulXp and Sp*VipMulSp
+# Note only works if player not in party
+AllowVipMulXpSp = True
+VipMulXp = 2
+VipMulSp = 2
Index: java/ct25/xtreme/gameserver/model/actor/L2Attackable.java
===================================================================
--- java/ct25/xtreme/gameserver/model/actor/L2Attackable.java (revision 36)
+++ java/ct25/xtreme/gameserver/model/actor/L2Attackable.java (working copy)
@@ -733,6 +733,11 @@
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.OVER_HIT));
exp += calculateOverhitExp(exp);
}
+ if (player.isVip() && Config.ALLOW_VIP_XPSP)
+ {
+ exp *= Config.VIP_XP;
+ sp *= Config.VIP_SP;
+ }
}
// Distribute the Exp and SP between the L2PcInstance and its L2Summon
Index: java/ct25/xtreme/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/ct25/xtreme/gameserver/model/actor/instance/L2PcInstance.java (revision 36)
+++ java/ct25/xtreme/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -15,6 +15,7 @@
package ct25.xtreme.gameserver.model.actor.instance;
import java.sql.Connection;
+import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -290,9 +291,9 @@
private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE charId=? AND class_index=?";
// Character Character SQL String Definitions:
- private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createTime) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=? WHERE charId=?";
- private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createTime,language FROM characters WHERE charId=?";
+ private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createTime,vip,vip_end,aio,aio_end) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,vip=?,vip_end=?,aio=?,aio_end=? WHERE charId=?";
+ private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createTime,language,vip,vip_end,aio,aio_end FROM characters WHERE charId=?";
// Character Teleport Bookmark:
private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
@@ -710,6 +711,14 @@
public final ReentrantLock soulShotLock = new ReentrantLock();
+ /** Vip System */
+ private boolean _isVip = false;
+ private long _vip_endTime = 0;
+
+ /** Aio System */
+ private boolean _isAio = false;
+ private long _aio_endTime = 0;
+
/** Event parameters */
public int eventX;
public int eventY;
@@ -7034,7 +7043,11 @@
statement.setInt(35, isNoble() ? 1 :0);
statement.setLong(36, 0);
statement.setLong(37,getCreateTime());
-
+ statement.setInt(38, isVip() ? 1 :0);
+ statement.setLong(39, 0);
+ statement.setInt(40, isAio() ? 1 :0);
+ statement.setLong(41, 0);
+
statement.executeUpdate();
statement.close();
}
@@ -7215,6 +7228,13 @@
player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
+ // Vip System
+ player.setVip(rset.getInt("vip") == 1 ? true : false);
+ player.setVipEndTime(rset.getLong("vip_end"));
+ // Aio System
+ player.setAio(rset.getInt("aio") == 1 ? true : false);
+ player.setAioEndTime(rset.getLong("aio_end"));
+
player.setVitalityPoints(rset.getInt("vitality_points"), true);
// Add the L2PcInstance object in _allObjects
@@ -7672,7 +7692,11 @@
statement.setInt(50, getBookMarkSlot());
statement.setInt(51, getVitalityPoints());
statement.setString(52, getLang());
- statement.setInt(53, getObjectId());
+ statement.setInt(53, isVip() ? 1 : 0);
+ statement.setLong(54, getVipEndTime());
+ statement.setInt(55, isAio() ? 1 : 0);
+ statement.setLong(56, getAioEndTime());
+ statement.setInt(57, getObjectId());
statement.execute();
statement.close();
@@ -15189,7 +15213,138 @@
{
_player = player;
}
+
+ /** Vip System Start */
+ public boolean isVip()
+ {
+ return _isVip;
+ }
+
+ public void setVip(boolean val)
+ {
+ _isVip = val;
+
+ }
+
+ public void setVipEndTime(long val)
+ {
+ _vip_endTime = val;
+ }
+
+ public long getVipEndTime()
+ {
+ return _vip_endTime;
+ }
+
+ /** Aio System Start */
+ public boolean isAio()
+ {
+ return _isAio;
+ }
+ public void setAio(boolean val)
+ {
+ _isAio = val;
+
+ }
+
+ public void rewardAioSkills()
+ {
+ L2Skill skill;
+ for(Integer skillid : Config.AIO_SKILLS.keySet())
+ {
+ int skilllvl = Config.AIO_SKILLS.get(skillid);
+ skill = SkillTable.getInstance().getInfo(skillid,skilllvl);
+ if(skill != null)
+ {
+ addSkill(skill, true);
+ }
+ }
+ sendMessage("GM give to you Aio's skills");
+ }
+
+ public void lostAioSkills()
+ {
+ L2Skill skill;
+ for(Integer skillid : Config.AIO_SKILLS.keySet())
+ {
+ int skilllvl = Config.AIO_SKILLS.get(skillid);
+ skill = SkillTable.getInstance().getInfo(skillid,skilllvl);
+ removeSkill(skill);
+ }
+ }
+
+ public void setAioEndTime(long val)
+ {
+ _aio_endTime = val;
+ }
+
+ public void setEndTime(String process, int val)
+ {
+ if (val > 0)
+ {
+ long end_day;
+ Calendar calendar = Calendar.getInstance();
+ if (val >= 30)
+ {
+ while(val >= 30)
+ {
+ if(calendar.get(Calendar.MONTH)== 11)
+ calendar.roll(Calendar.YEAR, true);
+ calendar.roll(Calendar.MONTH, true);
+ val -= 30;
+ }
+ }
+ if (val < 30 && val > 0)
+ {
+ while(val > 0)
+ {
+ if(calendar.get(Calendar.DATE)== 28 && calendar.get(Calendar.MONTH) == 1)
+ calendar.roll(Calendar.MONTH, true);
+ if(calendar.get(Calendar.DATE)== 30)
+ {
+ if(calendar.get(Calendar.MONTH) == 11)
+ calendar.roll(Calendar.YEAR, true);
+ calendar.roll(Calendar.MONTH, true);
+
+ }
+ calendar.roll(Calendar.DATE, true);
+ val--;
+ }
+ }
+
+ end_day = calendar.getTimeInMillis();
+ if(process.equals("aio"))
+ _aio_endTime = end_day;
+ else if(process.equals("vip"))
+ _vip_endTime = end_day;
+ else
+ {
+ System.out.println("process "+ process + "no Known while try set end date");
+ return;
+ }
+ Date dt = new Date(end_day);
+ System.out.println(""+process +" end time for player " + getName() + " is " + dt);
+ }
+ else
+ {
+ if(process.equals("aio"))
+ _aio_endTime = 0;
+ else if(process.equals("vip"))
+ _vip_endTime = 0;
+ else
+ {
+ System.out.println("process "+ process + "no Known while try set end date");
+ return;
+ }
+ }
+ }
+
+ public long getAioEndTime()
+ {
+ return _aio_endTime;
+ }
+
// Punish PHXEnchanters
public void overEnchPunish()
{
Index: java/ct25/xtreme/Config.java
===================================================================
--- java/ct25/xtreme/Config.java (revision 36)
+++ java/ct25/xtreme/Config.java (working copy)
@@ -35,12 +35,15 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilderFactory;
+import javolution.util.FastMap;
+
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -766,7 +769,24 @@
public static boolean BUFFER_NPC_ENABLE_REMOVE;
public static int BUFFER_NPC_FEE_REMOVE[];
public static boolean BUFFER_NPC_REMOVE_AMOUNT;
-
+ /* Vip System */
+ public static boolean ALLOW_VIP_NCOLOR;
+ public static int VIP_NCOLOR;
+ public static boolean ALLOW_VIP_TCOLOR;
+ public static int VIP_TCOLOR;
+ public static boolean ALLOW_VIP_XPSP;
+ public static int VIP_XP;
+ public static int VIP_SP;
+ /* Aio System */
+ public static boolean ENABLE_AIO_SYSTEM;
+ public static Map<Integer, Integer> AIO_SKILLS;
+ public static boolean ALLOW_AIO_NCOLOR;
+ public static int AIO_NCOLOR;
+ public static boolean ALLOW_AIO_TCOLOR;
+ public static int AIO_TCOLOR;
+ public static boolean ALLOW_AIO_ITEM;
+ public static int AIO_ITEMID;
+
//--------------------------------------------------
// NPC Settings
//--------------------------------------------------
@@ -2575,7 +2595,51 @@
BUFFER_NPC_FEE_REMOVE = getIntArray(L2JModSettings, "BufferNpcFeeRemove", new int[] { 57, 1000000 }, ",");
BUFFER_NPC_REMOVE_AMOUNT = Boolean.parseBoolean(L2JModSettings.getProperty("BufferNpcRemoveAmount", "false"));
//------------------------------- end------------------------------------------------------------------------//
-
+ // -------------------- //
+ // Aio e Vip System //
+ // -------------------- //
+ ALLOW_VIP_NCOLOR = Boolean.parseBoolean(L2JModSettings.getProperty("AllowVipNameColor", "True"));
+ VIP_NCOLOR = Integer.decode("0x" + L2JModSettings.getProperty("VipNameColor", "0088FF"));
+ ALLOW_VIP_TCOLOR = Boolean.parseBoolean(L2JModSettings.getProperty("AllowVipTitleColor", "True"));
+ VIP_TCOLOR = Integer.decode("0x" + L2JModSettings.getProperty("VipTitleColor", "0088FF"));
+ ALLOW_VIP_XPSP = Boolean.parseBoolean(L2JModSettings.getProperty("AllowVipMulXpSp", "True"));
+ VIP_XP = Integer.parseInt(L2JModSettings.getProperty("VipMulXp", "2"));
+ VIP_SP = Integer.parseInt(L2JModSettings.getProperty("VipMulSp", "2"));
+ ENABLE_AIO_SYSTEM = Boolean.parseBoolean(L2JModSettings.getProperty("EnableAioSystem", "True"));
+ ALLOW_AIO_NCOLOR = Boolean.parseBoolean(L2JModSettings.getProperty("AllowAioNameColor", "True"));
+ AIO_NCOLOR = Integer.decode("0x" + L2JModSettings.getProperty("AioNameColor", "88AA88"));
+ ALLOW_AIO_TCOLOR = Boolean.parseBoolean(L2JModSettings.getProperty("AllowAioTitleColor", "True"));
+ AIO_TCOLOR = Integer.decode("0x" + L2JModSettings.getProperty("AioTitleColor", "88AA88"));
+ AIO_ITEMID = Integer.parseInt(L2JModSettings.getProperty("ItemIdAio", "9945"));
+ ALLOW_AIO_ITEM = Boolean.parseBoolean(L2JModSettings.getProperty("AllowAIOItem", "False"));
+ if(ENABLE_AIO_SYSTEM) //create map if system is enabled
+ {
+ String[] AioSkillsSplit = L2JModSettings.getProperty("AioSkills", "").split(";");
+ AIO_SKILLS = new FastMap<Integer, Integer>(AioSkillsSplit.length);
+ for (String skill : AioSkillsSplit)
+ {
+ String[] skillSplit = skill.split(",");
+ if (skillSplit.length != 2)
+ {
+ System.out.println("[Aio System]: invalid config property in l2jmods.properties -> AioSkills \"" + skill + "\"");
+ }
+ else
+ {
+ try
+ {
+ AIO_SKILLS.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!skill.equals(""))
+ {
+ System.out.println("[Aio System]: invalid config property in l2jmods.properties -> AioSkills \"" + skillSplit[0] + "\"" + skillSplit[1]);
+ }
+ }
+ }
+ }
+ }
+
L2JMOD_ANTIFEED_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("AntiFeedEnable", "false"));
L2JMOD_ANTIFEED_DUALBOX = Boolean.parseBoolean(L2JModSettings.getProperty("AntiFeedDualbox", "true"));
L2JMOD_ANTIFEED_DISCONNECTED_AS_DUALBOX = Boolean.parseBoolean(L2JModSettings.getProperty("AntiFeedDisconnectedAsDualbox", "true"));
Index: java/ct25/xtreme/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/ct25/xtreme/gameserver/network/clientpackets/EnterWorld.java (revision 36)
+++ java/ct25/xtreme/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -14,6 +14,9 @@
*/
package ct25.xtreme.gameserver.network.clientpackets;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
import java.util.logging.Logger;
import ct25.xtreme.Config;
@@ -101,7 +104,9 @@
private static final String _C__03_ENTERWORLD = "[C] 03 EnterWorld";
private static Logger _log = Logger.getLogger(EnterWorld.class.getName());
-
+ long _daysleft;
+ SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
+
private int[][] tracert = new int[5][4];
public TaskPriority getPriority()
@@ -370,7 +375,25 @@
engage(activeChar);
notifyPartner(activeChar,activeChar.getPartnerId());
}
-
+
+ if(activeChar.isVip())
+ onEnterVip(activeChar);
+
+ if(activeChar.isAio())
+ onEnterAio(activeChar);
+
+ if(Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
+ activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
+
+ if(Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
+ activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
+
+ if(Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
+ activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
+
+ if(Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
+ activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
+
if (activeChar.isCursedWeaponEquipped())
{
CursedWeaponsManager.getInstance().getCursedWeapon(activeChar.getCursedWeaponEquippedId()).cursedOnLogin();
@@ -585,8 +608,61 @@
}
}
}
+
+ private void onEnterAio(L2PcInstance activeChar)
+ {
+ long now = Calendar.getInstance().getTimeInMillis();
+ long endDay = activeChar.getAioEndTime();
+ if(now > endDay)
+ {
+ activeChar.setAio(false);
+ activeChar.setAioEndTime(0);
+ activeChar.lostAioSkills();
+ activeChar.sendMessage("Removed your Aio stats... period ends ");
+ }
+ else
+ {
+ Date dt = new Date(endDay);
+ _daysleft = (endDay - now)/86400000;
+ if(_daysleft > 30)
+ activeChar.sendMessage("Aio period ends in " + df.format(dt) + ". enjoy the Game");
+ else if(_daysleft > 0)
+ activeChar.sendMessage("left " + (int)_daysleft + " days for Aio period ends");
+ else if(_daysleft < 1)
+ {
+ long hour = (endDay - now)/3600000;
+ activeChar.sendMessage("left " + (int)hour + " hours to Aio period ends");
+ }
+ }
+ }
+
+ private void onEnterVip(L2PcInstance activeChar)
+ {
+ long now = Calendar.getInstance().getTimeInMillis();
+ long endDay = activeChar.getVipEndTime();
+ if(now > endDay)
+ {
+ activeChar.setVip(false);
+ activeChar.setVipEndTime(0);
+ activeChar.sendMessage("Removed your Vip stats... period ends ");
+ }
+ else
+ {
+ Date dt = new Date(endDay);
+ _daysleft = (endDay - now)/86400000;
+ if(_daysleft > 30)
+ activeChar.sendMessage("Vip period ends in " + df.format(dt) + ". enjoy the Game");
+ else if(_daysleft > 0)
+ activeChar.sendMessage("left " + (int)_daysleft + " days for Vip period ends");
+ else if(_daysleft < 1)
+ {
+ long hour = (endDay - now)/3600000;
+ activeChar.sendMessage("left " + (int)hour + " hours to Vip period ends");
+ }
+ }
+ }
+
-
/**
* @param activeChar
*/
Créditos:KhayrusS(Criação),BossForever(Adaptaç ão) e Rildo Dantas
|