No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.
CitarCORE:
Index: dist/game/config/SmartCB.properties
===================================================================
--- dist/game/config/SmartCB.properties (revision 0)
+++ dist/game/config/SmartCB.properties (working copy)
@@ -0,0 +1,33 @@
+# ---------------------------------------------------------------------------
+# Smart CommunityBoard Settings
+# ---------------------------------------------------------------------------
+# This properties file is solely for the Smart CB modifications.
+# The Smart CB has been created by Darule.
+
+# ---------------------------------------------------------------------------
+# Top Players Options
+# ---------------------------------------------------------------------------
+# Explanation 1
+# Default value 19
+TopPlayerRowHeight = 19
+
+# Here you can specify the amount of the results that will be displayed.
+# Default value 20
+TopPlayerResults = 20
+
+# Explanation 1
+# Default value 17
+RaidListRowHeight = 17
+
+# Here you can specify the amount of the results that will be displayed.
+# Default value 20 , max is 26. If you change this you have to check the Raids Pagination because some pages might be empty.
+RaidListResults = 20
+
+# If you enable this option Raid List results will be sorted using asceding level (Smaller level raids will appear 1st)
+# Default = True
+RaidListSortAsc = True
+
+# If you enable this option on the stat page 2 rows will appear under Players Online on stats page.
+# Real active players and detached players.
+# Default = True
+AllowRealOnlineStats = True
\ No newline at end of file
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 5370)
+++ java/com/l2jserver/Config.java (working copy)
@@ -90,8 +90,19 @@
public static final String SECURITY_CONFIG_FILE = "./config/security.properties";
public static final String EMAIL_CONFIG_FILE = "./config/email.properties";
public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.properties";
+ public static final String SMART_CB = "./config/SmartCB.properties";
// --------------------------------------------------
+ // Smart Community Board Definitions
+ // --------------------------------------------------
+ public static int TOP_PLAYER_ROW_HEIGHT;
+ public static int TOP_PLAYER_RESULTS;
+ public static int RAID_LIST_ROW_HEIGHT;
+ public static int RAID_LIST_RESULTS;
+ public static boolean RAID_LIST_SORT_ASC;
+ public static boolean ALLOW_REAL_ONLINE_STATS;
+
+ // --------------------------------------------------
// L2J Variable Definitions
// --------------------------------------------------
public static boolean ALT_GAME_DELEVEL;
@@ -1260,6 +1271,25 @@
throw new Error("Failed to Load " + COMMUNITY_CONFIGURATION_FILE + " File.");
}
+ // Load Smart CB Properties file (if exists)
+ final File smartcb = new File(SMART_CB);
+ try (InputStream is = new FileInputStream(smartcb))
+ {
+ L2Properties smartCB = new L2Properties();
+ smartCB.load(is);
+ TOP_PLAYER_ROW_HEIGHT = Integer.parseInt(smartCB.getProperty("TopPlayerRowHeight", "19"));
+ TOP_PLAYER_RESULTS = Integer.parseInt(smartCB.getProperty("TopPlayerResults", "20"));
+ RAID_LIST_ROW_HEIGHT = Integer.parseInt(smartCB.getProperty("RaidListRowHeight", "18"));
+ RAID_LIST_RESULTS = Integer.parseInt(smartCB.getProperty("RaidListResults", "20"));
+ RAID_LIST_SORT_ASC = Boolean.parseBoolean(smartCB.getProperty("RaidListSortAsc", "True"));
+ ALLOW_REAL_ONLINE_STATS = Boolean.parseBoolean(smartCB.getProperty("AllowRealOnlineStats", "True"));
+ }
+ catch (Exception e)
+ {
+ _log.warning("Config: " + e.getMessage());
+ throw new Error("Failed to Load " + SMART_CB + " File.");
+ }
+
// Load Feature L2Properties file (if exists)
final File feature = new File(FEATURE_CONFIG_FILE);
try (InputStream is = new FileInputStream(feature))
Index: java/com/l2jserver/gameserver/communitybbs/BB/Forum.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/BB/Forum.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/BB/Forum.java (working copy)
@@ -292,7 +292,7 @@
*/
public void vload()
{
- if (!_loaded)
+ if (_loaded == false)
{
load();
getChildren();
Index: java/com/l2jserver/gameserver/communitybbs/CastleStatus.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/CastleStatus.java (revision 0)
+++ java/com/l2jserver/gameserver/communitybbs/CastleStatus.java (working copy)
@@ -0,0 +1,102 @@
+package com.l2jserver.gameserver.communitybbs;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.l2jserver.L2DatabaseFactory;
+
+import javolution.text.TextBuilder;
+
+public class CastleStatus
+{
+ private TextBuilder _playerList = new TextBuilder();
+
+ public CastleStatus()
+ {
+ loadFromDB();
+ }
+
+ @SuppressWarnings("null")
+ private void loadFromDB()
+ {
+ Connection con = null;
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+
+ for (int i = 1; i < 9; i++)
+ {
+ PreparedStatement statement = con.prepareStatement("SELECT clan_name, clan_level FROM clan_data WHERE hasCastle=" + i + ";");
+ ResultSet result = statement.executeQuery();
+
+ PreparedStatement statement2 = con.prepareStatement("SELECT name, siegeDate, taxPercent FROM castle WHERE id=" + i + ";");
+ ResultSet result2 = statement2.executeQuery();
+
+ while (result.next())
+ {
+ String owner = result.getString("clan_name");
+ int level = result.getInt("clan_level");
+
+ while (result2.next())
+ {
+ String name = result2.getString("name");
+ long someLong = result2.getLong("siegeDate");
+ int tax = result2.getInt("taxPercent");
+ Date anotherDate = new Date(someLong);
+ String DATE_FORMAT = "dd-MMM-yyyy HH:mm";
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+
+ addCastleToList(name, owner, level, tax, sdf.format(anotherDate));
+ }
+
+ result2.close();
+ statement2.close();
+ }
+
+ result.close();
+ statement.close();
+ }
+ }
+
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ private void addCastleToList(String name, String owner, int level, int tax, String siegeDate)
+ {
+ _playerList.append("<table border=0 cellspacing=0 cellpadding=2 width=750>");
+ _playerList.append("<tr>");
+ _playerList.append("<td FIXWIDTH=10></td>");
+ _playerList.append("<td FIXWIDTH=100>" + name + "</td>");
+ _playerList.append("<td FIXWIDTH=100>" + owner + "</td>");
+ _playerList.append("<td FIXWIDTH=80>" + level + "</td>");
+ _playerList.append("<td FIXWIDTH=40>" + tax + "</td>");
+ _playerList.append("<td FIXWIDTH=180>" + siegeDate + "</td>");
+ _playerList.append("<td FIXWIDTH=5></td>");
+ _playerList.append("</tr>");
+ _playerList.append("</table>");
+ _playerList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
+ }
+
+ public String loadCastleList()
+ {
+ return _playerList.toString();
+ }
+}
Index: java/com/l2jserver/gameserver/communitybbs/ClanList.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/ClanList.java (revision 0)
+++ java/com/l2jserver/gameserver/communitybbs/ClanList.java (working copy)
@@ -0,0 +1,116 @@
+package com.l2jserver.gameserver.communitybbs;
+
+import com.l2jserver.L2DatabaseFactory;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import javolution.text.TextBuilder;
+
+public class ClanList
+{
+ private TextBuilder _clanList = new TextBuilder();
+
+ public ClanList(int type)
+ {
+ loadFromDB(type);
+ }
+
+ private void loadFromDB(int type)
+ {
+ Connection con = null;
+ int stpoint = 0;
+ int results = 20;
+ String castlename = "";
+ String allystatus = "";
+ String leadername = "";
+ for (int count = 1; count != type; count++)
+ {
+ stpoint += 20;
+ }
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT clan_id, clan_name, ally_name, leader_id, clan_level, reputation_score, hasCastle, ally_id FROM clan_data ORDER BY `clan_level` desc Limit " + stpoint + ", " + results);
+ ResultSet result = statement.executeQuery();
+ int pos = 0;
+
+ while (result.next())
+ {
+ int clanid = result.getInt("leader_id");
+ String clan = result.getString("clan_name");
+ String ally = result.getString("ally_name");
+ int clanleader = result.getInt("leader_id");
+ int clanlevel = result.getInt("clan_level");
+ int reputation = result.getInt("reputation_score");
+ int hascastle = result.getInt("hasCastle");
+ int allyid = result.getInt("ally_id");
+ if (allyid != 0)
+ {
+ if (allyid == clanid)
+ allystatus = "Alliance Leader";
+ allystatus = "Affiliated Clan";
+ }
+ else
+ {
+ allystatus = "-";
+ ally = "[no-ally]";
+ }
+ if (hascastle != 0)
+ {
+ PreparedStatement statement2 = con.prepareStatement("SELECT name FROM castle WHERE id=" + hascastle);
+ ResultSet result2 = statement2.executeQuery();
+ if (result2.next())
+ castlename = result2.getString("name");
+ result2.close();
+ statement2.close();
+ }
+ else
+ castlename = "[none]";
+ PreparedStatement statement3 = con.prepareStatement("SELECT char_name FROM characters WHERE charId=" + clanleader);
+ ResultSet result3 = statement3.executeQuery();
+
+ if (result3.next())
+ leadername = result3.getString("char_name");
+ result3.close();
+ statement3.close();
+ pos++;
+ addClanToList(pos, clan, ally, leadername, clanlevel, reputation, castlename, allystatus);
+ }
+ result.close();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ L2DatabaseFactory.close(con);
+ }
+ }
+
+ private void addClanToList(int pos, String clan, String ally, String leadername, int clanlevel, int reputation, String castlename, String allystatus)
+ {
+ _clanList.append("<table border=0 cellspacing=0 cellpadding=2 width=760>");
+ _clanList.append("<tr>");
+ _clanList.append("<td FIXWIDTH=5></td>");
+ _clanList.append("<td FIXWIDTH=20>" + pos + "</td>");
+ _clanList.append("<td FIXWIDTH=90>" + clan + "</td>");
+ _clanList.append("<td FIXWIDTH=90>" + ally + "</td>");
+ _clanList.append("<td FIXWIDTH=85>" + leadername + "</td>");
+ _clanList.append("<td FIXWIDTH=45 align=center>" + clanlevel + "</td>");
+ _clanList.append("<td FIXWIDTH=70 align=center>" + reputation + "</td>");
+ _clanList.append("<td FIXWIDTH=50 align=center>" + castlename + "</td>");
+ _clanList.append("<td FIXWIDTH=70 align=center>" + allystatus + "</td>");
+ _clanList.append("<td FIXWIDTH=5></td>");
+ _clanList.append("</tr>");
+ _clanList.append("</table>");
+ _clanList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
+ }
+
+ public String loadClanList()
+ {
+ return _clanList.toString();
+ }
+}
Index: java/com/l2jserver/gameserver/communitybbs/CommunityBoard.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/CommunityBoard.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/CommunityBoard.java (working copy)
@@ -27,6 +27,10 @@
public class CommunityBoard
{
+ private CommunityBoard()
+ {
+ }
+
public static CommunityBoard getInstance()
{
return SingletonHolder._instance;
@@ -144,6 +148,7 @@
}
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final CommunityBoard _instance = new CommunityBoard();
Index: java/com/l2jserver/gameserver/communitybbs/GrandBossList.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/GrandBossList.java (revision 0)
+++ java/com/l2jserver/gameserver/communitybbs/GrandBossList.java (working copy)
@@ -0,0 +1,84 @@
+package com.l2jserver.gameserver.communitybbs;
+
+import com.l2jserver.L2DatabaseFactory;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import javolution.text.TextBuilder;
+
+public class GrandBossList
+{
+ private TextBuilder _GrandBossList = new TextBuilder();
+
+ public GrandBossList()
+ {
+ loadFromDB();
+ }
+
+ private void loadFromDB()
+ {
+ Connection con = null;
+ int pos = 0;
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT boss_id, status FROM grandboss_data");
+ ResultSet result = statement.executeQuery();
+
+ nextnpc:
+ while (result.next())
+ {
+ int npcid = result.getInt("boss_id");
+ int status = result.getInt("status");
+ if (npcid == 29066 || npcid == 29067 || npcid == 29068 || npcid == 29118)
+ continue nextnpc;
+
+ PreparedStatement statement2 = con.prepareStatement("SELECT name FROM npc WHERE id=" + npcid);
+ ResultSet result2 = statement2.executeQuery();
+
+ while (result2.next())
+ {
+ pos++;
+ boolean rstatus = false;
+ if (status == 0)
+ rstatus = true;
+ String npcname = result2.getString("name");
+ addGrandBossToList(pos, npcname, rstatus);
+ }
+ result2.close();
+ statement2.close();
+ }
+
+ result.close();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ L2DatabaseFactory.close(con);
+ }
+ }
+
+ private void addGrandBossToList(int pos, String npcname, boolean rstatus)
+ {
+ _GrandBossList.append("<table border=0 cellspacing=0 cellpadding=2>");
+ _GrandBossList.append("<tr>");
+ _GrandBossList.append("<td FIXWIDTH=5></td>");
+ _GrandBossList.append("<td FIXWIDTH=50>" + pos + "</td>");
+ _GrandBossList.append("<td FIXWIDTH=130>" + npcname + "</td>");
+ _GrandBossList.append("<td FIXWIDTH=60 align=center>" + ((rstatus) ? "<font color=99FF00>Alive</font>" : "<font color=CC0000>Dead</font>") + "</td>");
+ _GrandBossList.append("<td FIXWIDTH=5></td>");
+ _GrandBossList.append("</tr>");
+ _GrandBossList.append("</table>");
+ _GrandBossList.append("<img src=\"L2UI.Squaregray\" width=\"250\" height=\"1\">");
+ }
+
+ public String loadGrandBossList()
+ {
+ return _GrandBossList.toString();
+ }
+}
Index: java/com/l2jserver/gameserver/communitybbs/HeroeList.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/HeroeList.java (revision 0)
+++ java/com/l2jserver/gameserver/communitybbs/HeroeList.java (working copy)
@@ -0,0 +1,197 @@
+package com.l2jserver.gameserver.communitybbs;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Map;
+
+import com.l2jserver.L2DatabaseFactory;
+
+import javolution.text.TextBuilder;
+import javolution.util.FastMap;
+
+public class HeroeList
+{
+ private int _posId;
+ private TextBuilder _heroeList = new TextBuilder();
+
+ public HeroeList()
+ {
+ loadFromDB();
+ }
+
+ @SuppressWarnings("null")
+ private void loadFromDB()
+ {
+ java.sql.Connection con = null;
+ try
+ {
+ _posId = 0;
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT h.count, h.played, ch.char_name, ch.base_class, ch.online, cl.clan_name, cl.ally_name FROM heroes h LEFT JOIN characters ch ON ch.charId=h.charId LEFT OUTER JOIN clan_data cl ON cl.clan_id=ch.clanid ORDER BY h.count DESC, ch.char_name ASC LIMIT 20");
+
+ ResultSet result = statement.executeQuery();
+
+ while (result.next())
+ {
+ boolean status = false;
+ _posId = _posId + 1;
+
+ if (result.getInt("online") == 1)
+ status = true;
+
+ addPlayerToList(_posId, result.getInt("count"), result.getInt("played"), result.getString("char_name"), result.getInt("base_class"), result.getString("clan_name"), result.getString("ally_name"), status);
+ }
+ result.close();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ public String loadHeroeList()
+ {
+ return _heroeList.toString();
+ }
+
+ private void addPlayerToList(int objId, int count, int played, String name, int ChrClass, String clan, String ally, boolean isOnline)
+ {
+ _heroeList.append("<table border=0 cellspacing=0 cellpadding=2 width=750>");
+ _heroeList.append("<tr>");
+ _heroeList.append("<td FIXWIDTH=10></td>");
+ _heroeList.append("<td FIXWIDTH=40>" + objId + ".</td>");
+ _heroeList.append("<td FIXWIDTH=150>" + name + "</td>");
+ _heroeList.append("<td FIXWIDTH=160>" + className(ChrClass) + "</td>");
+ _heroeList.append("<td FIXWIDTH=80>" + count + "</td>");
+ _heroeList.append("<td FIXWIDTH=80>" + played + "</td>");
+ _heroeList.append("<td FIXWIDTH=160>" + clan + "</td>");
+ _heroeList.append("<td FIXWIDTH=160>" + ally + "</td>");
+ _heroeList.append("<td FIXWIDTH=70>" + ((isOnline) ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
+ _heroeList.append("<td FIXWIDTH=5></td>");
+ _heroeList.append("</tr>");
+ _heroeList.append("</table>");
+ _heroeList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
+ }
+
+ public final static String className(int classId)
+ {
+ Map<Integer, String> classList;
+ classList = new FastMap<Integer, String>();
+ classList.put(0, "Fighter");
+ classList.put(1, "Warrior");
+ classList.put(2, "Gladiator");
+ classList.put(3, "Warlord");
+ classList.put(4, "Knight");
+ classList.put(5, "Paladin");
+ classList.put(6, "Dark Avenger");
+ classList.put(7, "Rogue");
+ classList.put(8, "Treasure Hunter");
+ classList.put(9, "Hawkeye");
+ classList.put(10, "Mage");
+ classList.put(11, "Wizard");
+ classList.put(12, "Sorcerer");
+ classList.put(13, "Necromancer");
+ classList.put(14, "Warlock");
+ classList.put(15, "Cleric");
+ classList.put(16, "Bishop");
+ classList.put(17, "Prophet");
+ classList.put(18, "Elven Fighter");
+ classList.put(19, "Elven Knight");
+ classList.put(20, "Temple Knight");
+ classList.put(21, "Swordsinger");
+ classList.put(22, "Elven Scout");
+ classList.put(23, "Plains Walker");
+ classList.put(24, "Silver Ranger");
+ classList.put(25, "Elven Mage");
+ classList.put(26, "Elven Wizard");
+ classList.put(27, "Spellsinger");
+ classList.put(28, "Elemental Summoner");
+ classList.put(29, "Oracle");
+ classList.put(30, "Elder");
+ classList.put(31, "Dark Fighter");
+ classList.put(32, "Palus Knightr");
+ classList.put(33, "Shillien Knight");
+ classList.put(34, "Bladedancer");
+ classList.put(35, "Assasin");
+ classList.put(36, "Abyss Walker");
+ classList.put(37, "Phantom Ranger");
+ classList.put(38, "Dark Mage");
+ classList.put(39, "Dark Wizard");
+ classList.put(40, "Spellhowler");
+ classList.put(41, "Phantom Summoner");
+ classList.put(42, "Shillien Oracle");
+ classList.put(43, "Shilien Elder");
+ classList.put(44, "Orc Fighter");
+ classList.put(45, "Orc Raider");
+ classList.put(46, "Destroyer");
+ classList.put(47, "Orc Monk");
+ classList.put(48, "Tyrant");
+ classList.put(49, "Orc Mage");
+ classList.put(50, "Orc Shaman");
+ classList.put(51, "Overlord");
+ classList.put(52, "Warcryer");
+ classList.put(53, "Dwarven Fighter");
+ classList.put(54, "Scavenger");
+ classList.put(55, "Bounty Hunter");
+ classList.put(56, "Artisan");
+ classList.put(57, "Warsmith");
+ classList.put(88, "Duelist");
+ classList.put(89, "Dreadnought");
+ classList.put(90, "Phoenix Knight");
+ classList.put(91, "Hell Knight");
+ classList.put(92, "Sagittarius");
+ classList.put(93, "Adventurer");
+ classList.put(94, "Archmage");
+ classList.put(95, "Soultaker");
+ classList.put(96, "Arcana Lord");
+ classList.put(97, "Cardinal");
+ classList.put(98, "Hierophant");
+ classList.put(99, "Evas Templar");
+ classList.put(100, "Sword Muse");
+ classList.put(101, "Wind Rider");
+ classList.put(102, "Moonlight Sentinel");
+ classList.put(103, "Mystic Muse");
+ classList.put(104, "Elemental Master");
+ classList.put(105, "Evas Saint");
+ classList.put(106, "Shillien Templar");
+ classList.put(107, "Spectral Dancer");
+ classList.put(108, "Ghost Hunter");
+ classList.put(109, "Ghost Sentinel");
+ classList.put(110, "Storm Screamer");
+ classList.put(111, "Spectral Master");
+ classList.put(112, "Shillien Saint");
+ classList.put(113, "Titan");
+ classList.put(114, "Grand Khavatari");
+ classList.put(115, "Dominator");
+ classList.put(116, "Doomcryer");
+ classList.put(117, "Fortune Seeker");
+ classList.put(118, "Maestro");
+ classList.put(123, "Male Soldier");
+ classList.put(124, "Female Soldier");
+ classList.put(125, "Trooper");
+ classList.put(126, "Warder");
+ classList.put(127, "Berserker");
+ classList.put(128, "Male Soulbreaker");
+ classList.put(129, "Female Soulbreaker");
+ classList.put(130, "Arbalester");
+ classList.put(131, "Doombringer");
+ classList.put(132, "Male Soulhound");
+ classList.put(133, "Female Soulhound");
+ classList.put(134, "Trickster");
+ classList.put(135, "Inspector");
+ classList.put(136, "Judicator");
+
+ return classList.get(classId);
+ }
+}
Index: java/com/l2jserver/gameserver/communitybbs/Manager/AdminBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/AdminBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/AdminBBSManager.java (working copy)
@@ -27,6 +27,14 @@
return SingletonHolder._instance;
}
+ private AdminBBSManager()
+ {
+ }
+
+ /**
+ *
+ * @see com.l2jserver.gameserver.communitybbs.Manager.BaseBBSManager#parsecmd(java.lang.String, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
+ */
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
@@ -65,6 +73,7 @@
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final AdminBBSManager _instance = new AdminBBSManager();
Index: java/com/l2jserver/gameserver/communitybbs/Manager/ClanBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/ClanBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/ClanBBSManager.java (working copy)
@@ -24,6 +24,10 @@
public class ClanBBSManager extends BaseBBSManager
{
+ private ClanBBSManager()
+ {
+ }
+
public static ClanBBSManager getInstance()
{
return SingletonHolder._instance;
@@ -274,6 +278,7 @@
clanhome(activeChar, activeChar.getClan().getClanId());
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final ClanBBSManager _instance = new ClanBBSManager();
Index: java/com/l2jserver/gameserver/communitybbs/Manager/ForumsBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/ForumsBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/ForumsBBSManager.java (working copy)
@@ -41,7 +41,7 @@
return SingletonHolder._instance;
}
- protected ForumsBBSManager()
+ private ForumsBBSManager()
{
_table = new FastList<Forum>();
@@ -157,6 +157,7 @@
{
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final ForumsBBSManager _instance = new ForumsBBSManager();
Index: java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java (working copy)
@@ -32,10 +32,16 @@
public class PostBBSManager extends BaseBBSManager
{
+
private Map<Topic, Post> _postByTopic;
- protected PostBBSManager()
+ public static PostBBSManager getInstance()
{
+ return SingletonHolder._instance;
+ }
+
+ private PostBBSManager()
+ {
_postByTopic = new FastMap<Topic, Post>();
}
@@ -45,7 +51,7 @@
post = _postByTopic.get(t);
if (post == null)
{
- post = new Post(t);
+ post = load(t);
_postByTopic.put(t, post);
}
return post;
@@ -67,6 +73,17 @@
}
}
+ /**
+ * @param t
+ * @return
+ */
+ private Post load(Topic t)
+ {
+ Post p;
+ p = new Post(t);
+ return p;
+ }
+
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
@@ -288,34 +305,31 @@
}
else
{
- final Post p = getGPosttByTopic(t);
+ CPost cp = null;
+ Post p = getGPosttByTopic(t);
if (p != null)
{
- final CPost cp = p.getCPost(idp);
- if (cp == null)
- {
- ShowBoard sb = new ShowBoard("<html><body><br><br><center>the post: " + idp
- + " does not exist !</center><br><br></body></html>", "101");
- activeChar.sendPacket(sb);
- activeChar.sendPacket(new ShowBoard(null, "102"));
- activeChar.sendPacket(new ShowBoard(null, "103"));
- }
- else
- {
- p.getCPost(idp).postTxt = ar4;
- p.updatetxt(idp);
- parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), activeChar);
- }
+ cp = p.getCPost(idp);
}
+ if (cp == null)
+ {
+ ShowBoard sb = new ShowBoard("<html><body><br><br><center>the post: " + idp
+ + " does not exist !</center><br><br></body></html>", "101");
+ activeChar.sendPacket(sb);
+ activeChar.sendPacket(new ShowBoard(null, "102"));
+ activeChar.sendPacket(new ShowBoard(null, "103"));
+ }
+ else
+ {
+ p.getCPost(idp).postTxt = ar4;
+ p.updatetxt(idp);
+ parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), activeChar);
+ }
}
}
}
- public static PostBBSManager getInstance()
- {
- return SingletonHolder._instance;
- }
-
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final PostBBSManager _instance = new PostBBSManager();
Index: java/com/l2jserver/gameserver/communitybbs/Manager/RegionBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/RegionBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/RegionBBSManager.java (working copy)
@@ -54,6 +54,10 @@
}
};
+ private RegionBBSManager()
+ {
+ }
+
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
@@ -564,6 +568,7 @@
return null;
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final RegionBBSManager _instance = new RegionBBSManager();
Index: java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java (working copy)
@@ -1,66 +1,128 @@
-/*
- * 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 <http://www.gnu.org/licenses/>.
- */
package com.l2jserver.gameserver.communitybbs.Manager;
+import java.io.File;
import java.util.StringTokenizer;
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.GameTimeController;
import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.communitybbs.CastleStatus;
+import com.l2jserver.gameserver.communitybbs.ClanList;
+import com.l2jserver.gameserver.communitybbs.GrandBossList;
+import com.l2jserver.gameserver.communitybbs.HeroeList;
+import com.l2jserver.gameserver.communitybbs.RaidList;
+import com.l2jserver.gameserver.communitybbs.TopPlayers;
+import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
-
public class TopBBSManager extends BaseBBSManager
{
+
+ private TopBBSManager()
+ {
+ }
+
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
- if (command.equals("_bbstop"))
+ String path = "data/html/CommunityBoard/";
+ String filepath = "";
+ String content = "";
+
+ if (command.equals("_bbstop") | command.equals("_bbshome"))
{
- String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
- if (content == null)
- {
- content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
- }
+ filepath = path + "index.htm";
+ content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filepath);
separateAndSend(content, activeChar);
}
- else if (command.equals("_bbshome"))
- {
- String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
- if (content == null)
- {
- content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
- }
- separateAndSend(content, activeChar);
- }
else if (command.startsWith("_bbstop;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
- int idp = Integer.parseInt(st.nextToken());
- String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
- if (content == null)
+ String file = st.nextToken();
+ filepath = path + file + ".htm";
+ File filecom = new File(filepath);
+
+ if (!(filecom.exists()))
{
- content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/" + idp
- + ".htm' </center></body></html>";
+ content = "<html><body><br><br><center>The command " + command + " points to file(" + filepath + ") that NOT exists.</center></body></html>";
+ separateAndSend(content, activeChar);
+ return;
}
+ content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filepath);
+
+ if (content.isEmpty())
+ content = "<html><body><br><br><center>Content Empty: The command " + command + " points to an invalid or empty html file(" + filepath + ").</center></body></html>";
+
+ switch (file)
+ {
+ case "toppvp":
+ TopPlayers pvp = new TopPlayers(file);
+ content = content.replaceAll("%toppvp%", pvp.loadTopList());
+ break;
+ case "toppk":
+ TopPlayers pk = new TopPlayers(file);
+ content = content.replaceAll("%toppk%", pk.loadTopList());
+ break;
+ case "toprbrank":
+ TopPlayers raid = new TopPlayers(file);
+ content = content.replaceAll("%toprbrank%", raid.loadTopList());
+ break;
+ case "topadena":
+ TopPlayers adena = new TopPlayers(file);
+ content = content.replaceAll("%topadena%", adena.loadTopList());
+ break;
+ case "toponline":
+ TopPlayers online = new TopPlayers(file);
+ content = content.replaceAll("%toponline%", online.loadTopList());
+ break;
+ case "heroes":
+ HeroeList hr = new HeroeList();
+ content = content.replaceAll("%heroelist%", hr.loadHeroeList());
+ break;
+ case "castle":
+ CastleStatus status = new CastleStatus();
+ content = content.replaceAll("%castle%", status.loadCastleList());
+ break;
+ case "boss":
+ GrandBossList gb = new GrandBossList();
+ content = content.replaceAll("%gboss%", gb.loadGrandBossList());
+ break;
+ case "stats":
+ content = content.replace("%online%", Integer.toString(L2World.getInstance().getAllPlayersCount()));
+ content = content.replace("%servercapacity%", Integer.toString(Config.MAXIMUM_ONLINE_USERS));
+ content = content.replace("%serverruntime%", getServerRunTime());
+ if (Config.ALLOW_REAL_ONLINE_STATS)
+ content = content.replace("%serveronline%", getRealOnline());
+ else
+ content = content.replace("%serveronline%", "");
+ break;
+ default:
+ break;
+
+ }
+ if (file.startsWith("clan"))
+ {
+ int cid = Integer.parseInt(file.substring(4));
+ ClanList cl = new ClanList(cid);
+ content = content.replaceAll("%clanlist%", cl.loadClanList());
+ }
+ if (file.startsWith("raid"))
+ {
+ String rfid = file.substring(4);
+ RaidList rd = new RaidList(rfid);
+ content = content.replaceAll("%raidlist%", rd.loadRaidList());
+ }
+ if (content.isEmpty())
+ {
+ content = "<html><body><br><br><center>404 :File not found or empty: " + filepath + " your command is " + command + "</center></body></html>";
+ }
separateAndSend(content, activeChar);
}
else
{
- ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
- + " is not implemented yet</center><br><br></body></html>", "101");
+ ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
@@ -77,8 +139,34 @@
return SingletonHolder._instance;
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final TopBBSManager _instance = new TopBBSManager();
}
+
+ public String getServerRunTime()
+ {
+ int timeSeconds = (GameTimeController.getGameTicks() - 36000) / 10;
+ String timeResult = "";
+ if (timeSeconds >= 86400)
+ timeResult = Integer.toString(timeSeconds / 86400) + " Days " + Integer.toString((timeSeconds % 86400) / 3600) + " hours";
+ else
+ timeResult = Integer.toString(timeSeconds / 3600) + " Hours " + Integer.toString((timeSeconds % 3600) / 60) + " mins";
+ return timeResult;
+ }
+
+ public String getRealOnline()
+ {
+ int counter = 0;
+ for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayersArray())
+ {
+ if (onlinePlayer.isOnline() && (onlinePlayer.getClient() != null && !onlinePlayer.getClient().isDetached()))
+ {
+ counter++;
+ }
+ }
+ String realOnline = "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Active</td><td FIXWIDTH=470><font color=26e600>" + counter + "</font></td></tr>" + "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Shops</td><td FIXWIDTH=470><font color=26e600>" + (L2World.getInstance().getAllPlayersCount() - counter) + "</font></td></tr>";
+ return realOnline;
+ }
}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/communitybbs/Manager/TopicBBSManager.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/Manager/TopicBBSManager.java (revision 5370)
+++ java/com/l2jserver/gameserver/communitybbs/Manager/TopicBBSManager.java (working copy)
@@ -42,7 +42,7 @@
return SingletonHolder._instance;
}
- protected TopicBBSManager()
+ private TopicBBSManager()
{
_table = new FastList<Topic>();
_maxId = new FastMap<Forum, Integer>().shared();
@@ -442,6 +442,7 @@
separateAndSend(html.toString(), activeChar);
}
+ @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final TopicBBSManager _instance = new TopicBBSManager();
Index: java/com/l2jserver/gameserver/communitybbs/RaidList.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/RaidList.java (revision 0)
+++ java/com/l2jserver/gameserver/communitybbs/RaidList.java (working copy)
@@ -0,0 +1,101 @@
+package com.l2jserver.gameserver.communitybbs;
+
+import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import javolution.text.TextBuilder;
+
+public class RaidList
+{
+ private TextBuilder _raidList = new TextBuilder();
+
+ public RaidList(String rfid)
+ {
+ loadFromDB(rfid);
+ }
+
+ private void loadFromDB(String rfid)
+ {
+ int type = Integer.parseInt(rfid);
+ Connection con = null;
+ int stpoint = 0;
+ int pos = 0;
+ String sort = "";
+ if (Config.RAID_LIST_SORT_ASC)
+ sort = "ASC";
+ else
+ sort = "DESC";
+ for (int count = 1; count != type; count++)
+ {
+ stpoint += Config.RAID_LIST_RESULTS;
+ }
+
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT id, name, level FROM npc WHERE type='L2RaidBoss' AND EXISTS (SELECT * FROM raidboss_spawnlist WHERE raidboss_spawnlist.boss_id = npc.id) ORDER BY `level` " + sort + " Limit " + stpoint + ", " + Config.RAID_LIST_RESULTS);
+ ResultSet result = statement.executeQuery();
+ pos = stpoint;
+
+ while (result.next())
+ {
+ int npcid = result.getInt("id");
+ String npcname = result.getString("name");
+ int rlevel = result.getInt("level");
+ PreparedStatement statement2 = con.prepareStatement("SELECT respawn_time, respawn_min_delay, respawn_max_delay FROM raidboss_spawnlist WHERE boss_id=" + npcid);
+ ResultSet result2 = statement2.executeQuery();
+
+ while (result2.next())
+ {
+ pos++;
+ boolean rstatus = false;
+ long respawn = result2.getLong("respawn_time");
+ if (respawn == 0)
+ rstatus = true;
+ int mindelay = result2.getInt("respawn_min_delay");
+ int maxdelay = result2.getInt("respawn_max_delay");
+ mindelay = mindelay / 60 / 60;
+ maxdelay = maxdelay / 60 / 60;
+ addRaidToList(pos, npcname, rlevel, mindelay, maxdelay, rstatus);
+ }
+ result2.close();
+ statement2.close();
+ }
+
+ result.close();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ L2DatabaseFactory.close(con);
+ }
+ }
+
+ private void addRaidToList(int pos, String npcname, int rlevel, int mindelay, int maxdelay, boolean rstatus)
+ {
+ _raidList.append("<table border=0 cellspacing=0 cellpadding=2 width=750 height="+Config.RAID_LIST_ROW_HEIGHT+">");
+ _raidList.append("<tr>");
+ _raidList.append("<td FIXWIDTH=5></td>");
+ _raidList.append("<td FIXWIDTH=20>" + pos + "</td>");
+ _raidList.append("<td FIXWIDTH=270>" + npcname + "</td>");
+ _raidList.append("<td FIXWIDTH=50>" + rlevel + "</td>");
+ _raidList.append("<td FIXWIDTH=120 align=center>" + mindelay + " - " + maxdelay + "</td>");
+ _raidList.append("<td FIXWIDTH=50 align=center>" + ((rstatus) ? "<font color=99FF00>Alive</font>" : "<font color=CC0000>Dead</font>") + "</td>");
+ _raidList.append("<td FIXWIDTH=5></td>");
+ _raidList.append("</tr>");
+ _raidList.append("</table>");
+ _raidList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
+ }
+
+ public String loadRaidList()
+ {
+ return _raidList.toString();
+ }
+}
Index: java/com/l2jserver/gameserver/communitybbs/TopPlayers.java
===================================================================
--- java/com/l2jserver/gameserver/communitybbs/TopPlayers.java (revision 0)
+++ java/com/l2jserver/gameserver/communitybbs/TopPlayers.java (working copy)
@@ -0,0 +1,243 @@
+package com.l2jserver.gameserver.communitybbs;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Map;
+
+import javolution.text.TextBuilder;
+import javolution.util.FastMap;
+
+import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
+
+public class TopPlayers
+{
+ private int pos;
+ private TextBuilder _topList = new TextBuilder();
+ String sort = "";
+
+ public TopPlayers(String file)
+ {
+ loadDB(file);
+ }
+
+ @SuppressWarnings("null")
+ private void loadDB(String file)
+ {
+ Connection con = null;
+
+ switch (file)
+ {
+ case "toppvp":
+ sort = "pvpkills";
+ break;
+ case "toppk":
+ sort = "pkkills";
+ break;
+ case "topadena":
+ sort = "SUM(it.count)";
+ break;
+ case "toprbrank":
+ sort = "SUM(chr.points)";
+ break;
+ case "toponline":
+ sort = "onlinetime";
+ break;
+ default:
+ break;
+
+ }
+
+ try
+ {
+ pos = 0;
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.charId=chr.charId LEFT OUTER JOIN items it ON ch.charId=it.owner_id WHERE item_id=57 GROUP BY ch.charId ORDER BY " + sort + " DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
+
+ ResultSet result = statement.executeQuery();
+
+ while (result.next())
+ {
+ boolean status = false;
+ pos++;
+
+ if (result.getInt("online") == 1)
+ status = true;
+ String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
+ String adenas = getAdenas(result.getInt("SUM(it.count)"));
+
+ addChar(pos, result.getString("ch.char_name"), result.getInt("base_class"), result.getInt("ch.pvpkills"), result.getInt("ch.pkkills"), result.getInt("SUM(chr.points)"), adenas, timeon, status);
+ }
+
+ result.close();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+ }
+
+ public String loadTopList()
+ {
+ return _topList.toString();
+ }
+
+ private void addChar(int position, String name, int classid, int pvp, int pk, int raid, String adenas, String online, boolean isOnline)
+ {
+ _topList.append("<table border=0 cellspacing=0 cellpadding=2 bgcolor=050505 height=" + Config.TOP_PLAYER_ROW_HEIGHT + "><tr><td FIXWIDTH=5></td>");
+ _topList.append("<td FIXWIDTH=20>" + position + ".</td>");
+ _topList.append("<td FIXWIDTH=180>" + name + "</td>");
+ _topList.append("<td FIXWIDTH=175>" + className(classid) + "</td>");
+ _topList.append("<td FIXWIDTH=60>" + pvp + "</td>");
+ _topList.append("<td FIXWIDTH=60>" + pk + "</td>");
+ _topList.append("<td FIXWIDTH=65>" + raid + "</td>");
+ _topList.append("<td FIXWIDTH=150>" + adenas + "</td>");
+ _topList.append("<td FIXWIDTH=148>" + online + "</td>");
+ _topList.append("<td FIXWIDTH=65>" + ((isOnline) ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
+ _topList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"758\" height=\"1\">");
+
+ }
+
+ public final static String className(int classid)
+ {
+ Map<Integer, String> classList;
+ classList = new FastMap<Integer, String>();
+ classList.put(0, "Fighter");
+ classList.put(1, "Warrior");
+ classList.put(2, "Gladiator");
+ classList.put(3, "Warlord");
+ classList.put(4, "Knight");
+ classList.put(5, "Paladin");
+ classList.put(6, "Dark Avenger");
+ classList.put(7, "Rogue");
+ classList.put(8, "Treasure Hunter");
+ classList.put(9, "Hawkeye");
+ classList.put(10, "Mage");
+ classList.put(11, "Wizard");
+ classList.put(12, "Sorcerer");
+ classList.put(13, "Necromancer");
+ classList.put(14, "Warlock");
+ classList.put(15, "Cleric");
+ classList.put(16, "Bishop");
+ classList.put(17, "Prophet");
+ classList.put(18, "Elven Fighter");
+ classList.put(19, "Elven Knight");
+ classList.put(20, "Temple Knight");
+ classList.put(21, "Swordsinger");
+ classList.put(22, "Elven Scout");
+ classList.put(23, "Plains Walker");
+ classList.put(24, "Silver Ranger");
+ classList.put(25, "Elven Mage");
+ classList.put(26, "Elven Wizard");
+ classList.put(27, "Spellsinger");
+ classList.put(28, "Elemental Summoner");
+ classList.put(29, "Oracle");
+ classList.put(30, "Elder");
+ classList.put(31, "Dark Fighter");
+ classList.put(32, "Palus Knightr");
+ classList.put(33, "Shillien Knight");
+ classList.put(34, "Bladedancer");
+ classList.put(35, "Assasin");
+ classList.put(36, "Abyss Walker");
+ classList.put(37, "Phantom Ranger");
+ classList.put(38, "Dark Mage");
+ classList.put(39, "Dark Wizard");
+ classList.put(40, "Spellhowler");
+ classList.put(41, "Phantom Summoner");
+ classList.put(42, "Shillien Oracle");
+ classList.put(43, "Shilien Elder");
+ classList.put(44, "Orc Fighter");
+ classList.put(45, "Orc Raider");
+ classList.put(46, "Destroyer");
+ classList.put(47, "Orc Monk");
+ classList.put(48, "Tyrant");
+ classList.put(49, "Orc Mage");
+ classList.put(50, "Orc Shaman");
+ classList.put(51, "Overlord");
+ classList.put(52, "Warcryer");
+ classList.put(53, "Dwarven Fighter");
+ classList.put(54, "Scavenger");
+ classList.put(55, "Bounty Hunter");
+ classList.put(56, "Artisan");
+ classList.put(57, "Warsmith");
+ classList.put(88, "Duelist");
+ classList.put(89, "Dreadnought");
+ classList.put(90, "Phoenix Knight");
+ classList.put(91, "Hell Knight");
+ classList.put(92, "Sagittarius");
+ classList.put(93, "Adventurer");
+ classList.put(94, "Archmage");
+ classList.put(95, "Soultaker");
+ classList.put(96, "Arcana Lord");
+ classList.put(97, "Cardinal");
+ classList.put(98, "Hierophant");
+ classList.put(99, "Evas Templar");
+ classList.put(100, "Sword Muse");
+ classList.put(101, "Wind Rider");
+ classList.put(102, "Moonlight Sentinel");
+ classList.put(103, "Mystic Muse");
+ classList.put(104, "Elemental Master");
+ classList.put(105, "Evas Saint");
+ classList.put(106, "Shillien Templar");
+ classList.put(107, "Spectral Dancer");
+ classList.put(108, "Ghost Hunter");
+ classList.put(109, "Ghost Sentinel");
+ classList.put(110, "Storm Screamer");
+ classList.put(111, "Spectral Master");
+ classList.put(112, "Shillien Saint");
+ classList.put(113, "Titan");
+ classList.put(114, "Grand Khavatari");
+ classList.put(115, "Dominator");
+ classList.put(116, "Doomcryer");
+ classList.put(117, "Fortune Seeker");
+ classList.put(118, "Maestro");
+ classList.put(123, "Male Soldier");
+ classList.put(124, "Female Soldier");
+ classList.put(125, "Trooper");
+ classList.put(126, "Warder");
+ classList.put(127, "Berserker");
+ classList.put(128, "Male Soulbreaker");
+ classList.put(129, "Female Soulbreaker");
+ classList.put(130, "Arbalester");
+ classList.put(131, "Doombringer");
+ classList.put(132, "Male Soulhound");
+ classList.put(133, "Female Soulhound");
+ classList.put(134, "Trickster");
+ classList.put(135, "Inspector");
+ classList.put(136, "Judicator");
+
+ return classList.get(classid);
+ }
+
+ public String getPlayerRunTime(int secs)
+ {
+ String timeResult = "";
+ if (secs >= 86400)
+ timeResult = Integer.toString(secs / 86400) + " Days " + Integer.toString((secs % 86400) / 3600) + " hours";
+ else
+ timeResult = Integer.toString(secs / 3600) + " Hours " + Integer.toString((secs % 3600) / 60) + " mins";
+ return timeResult;
+ }
+ public String getAdenas(int adena)
+ {
+ String adenas = "";
+ if (adena >= 1000000000)
+ adenas = Integer.toString(adena / 1000000000) + " Billion " + Integer.toString((adena % 1000000000) / 1000000) + " million";
+ else
+ adenas = Integer.toString(adena / 1000000) + " Million " + Integer.toString((adena % 1000000) / 1000) + " k";
+ return adenas;
+ }
+}
### Eclipse Workspace Patch 1.0
#P L2J_DataPack_BETA
Index: dist/game/config/adminCommands.xml
===================================================================
--- dist/game/config/adminCommands.xml (revision 10428)
+++ dist/game/config/adminCommands.xml (working copy)
@@ -117,6 +117,8 @@
<!-- ADMIN EDIT CHAR -->
<admin command="admin_edit_character" accessLevel="7" />
+ <admin command="admin_show_inventory" accessLevel="7" />
+ <admin command="admin_delete_item" accessLevel="7" />
<admin command="admin_current_player" accessLevel="7" />
<admin command="admin_nokarma" accessLevel="7" />
<admin command="admin_setkarma" accessLevel="7" />
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminInventory.java
===================================================================
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminInventory.java (revision 0)
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminInventory.java (working copy)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 <http://www.gnu.org/licenses/>.
+ */
+package handlers.admincommandhandlers;
+
+import com.l2jserver.gameserver.handler.IAdminCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.util.Util;
+
+/**
+ * This class handles following admin commands:
+ * <ul>
+ * <li>show_ivetory</li>
+ * <li>delete_item</li>
+ * </ul>
+ * @author Zealar
+ */
+public class AdminInventory implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_show_inventory",
+ "admin_delete_item"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if ((activeChar.getTarget() == null))
+ {
+ activeChar.sendMessage("Select a target");
+ return false;
+ }
+
+ if (!activeChar.getTarget().isPlayer())
+ {
+ activeChar.sendMessage("Target need to be player");
+ return false;
+ }
+
+ L2PcInstance player = activeChar.getTarget().getActingPlayer();
+
+ if (command.startsWith(ADMIN_COMMANDS[0]))
+ {
+ if (command.length() > ADMIN_COMMANDS[0].length())
+ {
+ String com = command.substring(ADMIN_COMMANDS[0].length() + 1);
+ if (Util.isDigit(com))
+ {
+ showItemsPage(activeChar, Integer.parseInt(com));
+ }
+ }
+
+ else
+ {
+ showItemsPage(activeChar, 0);
+ }
+ }
+ else if (command.contains(ADMIN_COMMANDS[1]))
+ {
+ String val = command.substring(ADMIN_COMMANDS[1].length() + 1);
+
+ player.destroyItem("GM Destroy", Integer.parseInt(val), player.getInventory().getItemByObjectId(Integer.parseInt(val)).getCount(), null, true);
+ showItemsPage(activeChar, 0);
+ }
+
+ return true;
+ }
+
+ private void showItemsPage(L2PcInstance activeChar, int page)
+ {
+ final L2PcInstance target = activeChar.getTarget().getActingPlayer();
+
+ final L2ItemInstance[] items = target.getInventory().getItems();
+
+ int maxItemsPerPage = 10;
+ int maxPages = items.length / maxItemsPerPage;
+ if (items.length > (maxItemsPerPage * maxPages))
+ {
+ maxPages++;
+ }
+
+ if (page > maxPages)
+ {
+ page = maxPages;
+ }
+
+ int itemsStart = maxItemsPerPage * page;
+ int itemsEnd = items.length;
+ if ((itemsEnd - itemsStart) > maxItemsPerPage)
+ {
+ itemsEnd = itemsStart + maxItemsPerPage;
+ }
+
+ final NpcHtmlMessage adminReply = new NpcHtmlMessage();
+ adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/inventory.htm");
+ adminReply.replace("%PLAYER_NAME%", target.getName());
+
+ StringBuilder sbPages = new StringBuilder();
+ for (int x = 0; x < maxPages; x++)
+ {
+ int pagenr = x + 1;
+ sbPages.append("<td><button value=\"" + String.valueOf(pagenr) + "\" action=\"bypass -h admin_show_inventory " + String.valueOf(x) + "\" width=20 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+ }
+
+ adminReply.replace("%PAGES%", sbPages.toString());
+
+ StringBuilder sbItems = new StringBuilder();
+
+ for (int i = itemsStart; i < itemsEnd; i++)
+ {
+ sbItems.append("<tr><td><img src=\"" + items[i].getItem().getIcon() + "\" width=32 height=32></td>");
+ sbItems.append("<td width=60>" + items[i].getName() + "</td>");
+ sbItems.append("<td><button action=\"bypass -h admin_delete_item " + String.valueOf(items[i].getObjectId()) + "\" width=16 height=16 back=\"L2UI_ct1.Button_DF_Delete\" fore=\"L2UI_ct1.Button_DF_Delete\">" + "</td></tr>");
+ }
+
+ adminReply.replace("%ITEMS%", sbItems.toString());
+
+ activeChar.sendPacket(adminReply);
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 10428)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -88,6 +88,7 @@
import handlers.admincommandhandlers.AdminHtml;
import handlers.admincommandhandlers.AdminInstance;
import handlers.admincommandhandlers.AdminInstanceZone;
+import handlers.admincommandhandlers.AdminInventory;
import handlers.admincommandhandlers.AdminInvul;
import handlers.admincommandhandlers.AdminKick;
import handlers.admincommandhandlers.AdminKill;
@@ -353,6 +354,7 @@
AdminHtml.class,
AdminInstance.class,
AdminInstanceZone.class,
+ AdminInventory.class,
AdminInvul.class,
AdminKick.class,
AdminKill.class,
Index: dist/game/data/html/admin/inventory.htm
===================================================================
--- dist/game/data/html/admin/inventory.htm (revision 0)
+++ dist/game/data/html/admin/inventory.htm (working copy)
@@ -0,0 +1,15 @@
+<html><body><title>Inventory : %PLAYER_NAME%</title>
+<center>
+<table width=270>
+ <tr>
+ %PAGES%
+ </tr>
+</table>
+===========================
+</center>
+<br>
+<table width=270>
+ %ITEMS%
+</table>
+</body>
+</html>
\ No newline at end of file
package l2p.gameserver.network;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import jonelo.sugar.util.Base64;
import l2p.commons.dbutils.DbUtils;
import l2p.gameserver.Config;
import l2p.gameserver.database.DatabaseFactory;
import l2p.gameserver.model.Player;
import l2p.gameserver.network.GameClient;
import l2p.gameserver.serverpackets.Ex2ndPasswordAck;
import l2p.gameserver.serverpackets.Ex2ndPasswordCheck;
import l2p.gameserver.serverpackets.Ex2ndPasswordVerify;
import l2p.gameserver.utils.Log;
import l2p.gameserver.utils.Util;
public class SecondaryPasswordAuth
{
private final Logger _log = Logger.getLogger(SecondaryPasswordAuth.class.getName());
private final GameClient _activeClient;
private String _password;
private int _wrongAttempts;
private boolean _authed;
private static final String VAR_PWD = "secauth_pwd";
private static final String VAR_WTE = "secauth_wte";
private static final String SELECT_PASSWORD = "SELECT var, value FROM character_secondary_password WHERE account_name=? AND var LIKE 'secauth_%'";
private static final String INSERT_PASSWORD = "INSERT INTO character_secondary_password VALUES (?, ?, ?)";
private static final String UPDATE_PASSWORD = "UPDATE character_secondary_password SET value=? WHERE account_name=? AND var=?";
private static final String INSERT_ATTEMPT = "INSERT INTO character_secondary_password VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?";
// private static final String BAN_ACCOUNT = "UPDATE accounts SET banExpires=? WHERE login=?";
/**
* @param activeClient
*/
public SecondaryPasswordAuth(GameClient activeClient)
{
_activeClient = activeClient;
_password = null;
_wrongAttempts = 0;
_authed = false;
loadPassword();
}
private void loadPassword()
{
String var, value = null;
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(SELECT_PASSWORD);
statement.setString(1, _activeClient.getLogin());
ResultSet rs = statement.executeQuery();
while(rs.next())
{
var = rs.getString("var");
value = rs.getString("value");
if(var.equals(VAR_PWD))
_password = value;
else if(var.equals(VAR_WTE))
_wrongAttempts = Integer.parseInt(value);
}
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while reading password.", e);
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
}
public boolean savePassword(String password)
{
if(passwordExist())
{
_log.warning("[SecondaryPasswordAuth]" + _activeClient.getLogin() + " forced savePassword");
_activeClient.closeNow(true);
return false;
}
if(!validatePassword(password))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}
password = cryptPassword(password);
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(INSERT_PASSWORD);
statement.setString(1, _activeClient.getLogin());
statement.setString(2, VAR_PWD);
statement.setString(3, password);
statement.execute();
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while writing password.", e);
return false;
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
_password = password;
return true;
}
public boolean insertWrongAttempt(int attempts)
{
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(INSERT_ATTEMPT);
statement.setString(1, _activeClient.getLogin());
statement.setString(2, VAR_WTE);
statement.setString(3, Integer.toString(attempts));
statement.setString(4, Integer.toString(attempts));
statement.execute();
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while writing wrong attempts.", e);
return false;
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
return true;
}
public boolean changePassword(String oldPassword, String newPassword)
{
if(!passwordExist())
{
_log.warning("[SecondaryPasswordAuth]" + _activeClient.getLogin() + " forced changePassword");
_activeClient.closeNow(true);
return false;
}
if(!checkPassword(oldPassword, true))
return false;
if(!validatePassword(newPassword))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}
newPassword = cryptPassword(newPassword);
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(UPDATE_PASSWORD);
statement.setString(1, newPassword);
statement.setString(2, _activeClient.getLogin());
statement.setString(3, VAR_PWD);
statement.execute();
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while reading password.", e);
return false;
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
_password = newPassword;
_authed = false;
return true;
}
public boolean checkPassword(String password, boolean skipAuth)
{
password = cryptPassword(password);
if(!password.equals(_password))
{
_wrongAttempts++;
if(_wrongAttempts < Config.SECOND_AUTH_MAX_ATTEMPTS)
{
_activeClient.sendPacket(new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_WRONG, _wrongAttempts));
insertWrongAttempt(_wrongAttempts);
}
else
{
if(Config.SECOND_AUTH_BAN_ACC)
banAccount(_activeClient.getActiveChar());
Log.add(_activeClient.getLogin() + " - (" + _activeClient.getIpAddr() + ") has inputted the wrong password " + _wrongAttempts + " times in row.", "banned_accounts");
insertWrongAttempt(0);
_activeClient.close(new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_BAN, Config.SECOND_AUTH_MAX_ATTEMPTS));
}
return false;
}
if(!skipAuth)
{
_authed = true;
_activeClient.sendPacket(new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_OK, _wrongAttempts));
}
insertWrongAttempt(0);
return true;
}
private void banAccount(Player plyr)
{
long banTime = Config.SECOND_AUTH_BAN_TIME;
try
{
plyr.setAccessLevel(-100);
ban(plyr, banTime);
plyr.kick();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while banning account.", e);
}
}
private void ban(Player actor, long time)
{
long date = Calendar.getInstance().getTimeInMillis();
long endban = date / 1000 + time * 60;
String msg = "Secondary Password Auth ban Player" + actor.getName() + " on " + time + " sec";
Connection con = null;
PreparedStatement statement = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("INSERT INTO bans (account_name, obj_id, baned, unban, reason, GM, endban) VALUES(?,?,?,?,?,?,?)");
statement.setString(1, actor.getAccountName());
statement.setInt(2, actor.getObjectId());
statement.setString(3, "SU");
statement.setString(4, "SU");
statement.setString(5, msg);
statement.setString(6, "SU");
statement.setLong(7, endban);
statement.execute();
}
catch(Exception e)
{
_log.warning("could not store bans data:" + e);
}
finally
{
DbUtils.closeQuietly(con, statement);
}
}
public boolean passwordExist()
{
return _password == null ? false : true;
}
public void openDialog()
{
if(passwordExist())
_activeClient.sendPacket(new Ex2ndPasswordCheck(Ex2ndPasswordCheck.PASSWORD_PROMPT));
else
_activeClient.sendPacket(new Ex2ndPasswordCheck(Ex2ndPasswordCheck.PASSWORD_NEW));
}
public boolean isAuthed()
{
return _authed;
}
private String cryptPassword(String password)
{
try
{
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] raw = password.getBytes("UTF-8");
byte[] hash = md.digest(raw);
return Base64.encodeBytes(hash);
}
catch(NoSuchAlgorithmException e)
{
_log.severe("[SecondaryPasswordAuth]Unsupported Algorythm");
}
catch(UnsupportedEncodingException e)
{
_log.severe("[SecondaryPasswordAuth]Unsupported Encoding");
}
return null;
}
private boolean validatePassword(String password)
{
if(!Util.isDigit(password))
return false;
if(password.length() < 6 || password.length() >
return false;
if(Config.SECOND_AUTH_STRONG_PASS)
{
for(int i = 0; i < password.length() - 1; i++)
{
char curCh = password.charAt(i);
char nxtCh = password.charAt(i + 1);
if(curCh + 1 == nxtCh)
return false;
else if(curCh - 1 == nxtCh)
return false;
else if(curCh == nxtCh)
return false;
}
for(int i = 0; i < password.length() - 2; i++)
{
String toChk = password.substring(i + 1);
StringBuffer chkEr = new StringBuffer(password.substring(i, i + 2));
if(toChk.contains(chkEr))
return false;
else if(toChk.contains(chkEr.reverse()))
return false;
}
}
_wrongAttempts = 0;
return true;
}
}
public static boolean SECOND_AUTH_ENABLED;
public static boolean SECOND_AUTH_BAN_ACC;
public static boolean SECOND_AUTH_STRONG_PASS;
public static int SECOND_AUTH_MAX_ATTEMPTS;
public static long SECOND_AUTH_BAN_TIME;
public static String SECOND_AUTH_REC_LINK;
SECOND_AUTH_ENABLED = serverSettings.getProperty("SAEnabled", false);
SECOND_AUTH_BAN_ACC = serverSettings.getProperty("SABanAccEnabled", false);
SECOND_AUTH_STRONG_PASS = serverSettings.getProperty("SAStrongPass", false);
SECOND_AUTH_MAX_ATTEMPTS = serverSettings.getProperty("SAMaxAttemps", 5);
SECOND_AUTH_BAN_TIME = serverSettings.getProperty("SABanTime", 480);
SECOND_AUTH_REC_LINK = serverSettings.getProperty("SARecoveryLink", "http://www.my-domain...harPassRec.php");
Public static Boolean isdigit (String text)
{
if (text == null | | text.isEmpty ())
return false;
for (char C: text.toCharArray ())
if (! Character.isDigit ©)
return false;
return true ;
}
}
# ============================ ============
# Settings to set a password on your character SA (Secondary Auth)
# Pre-include this option in the client (UseSecondaryAuth = true)
# ============== ==========================
# include whether the system SA
SAEnabled = True
# ban account after a user has exceeded the number of password attempts?
SABanAccEnabled = True
# Enhanced password system, combined with the odd even sure!
SAStrongPass = False
# The maximum number of password attempts
SAMaxAttemps = 5
# Banlength Chara for failure password (min)
SABanTime = 480
# link to the password recovery page
SARecoveryLink = http://www . My-Domain ... charPassRec.php
# ======================================= =
DROP TABLE IF EXISTS `character_secondary_password`;
CREATE TABLE `character_secondary_password` (
`account_name` VARCHAR (45) NOT NULL DEFAULT'',
`var` VARCHAR (20) NOT NULL DEFAULT'',
`value` VARCHAR (255),
PRIMARY KEY (account_name ``, `var`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package handlers.voicedcommandhandlers;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.L2ClanMember;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
/**
* ClanMessage (cmenssage)
* Original Java script by Fissban.
* @author swarlog
*/
public class ClanMessage implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"cmenssage"
};
@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
target = activeChar.getName() + ": " + target;
final ExShowScreenMessage cs = new ExShowScreenMessage(target, 5000);
if (activeChar.getClan() != null)
{
if (activeChar.isClanLeader())
{
for (L2ClanMember member : activeChar.getClan().getMembers())
{
if (member.isOnline())
{
member.getPlayerInstance().sendPacket(cs);
}
}
return true;
}
activeChar.sendMessage("Solo el lider del clan puede utilizar este comando!");
return false;
}
activeChar.sendMessage("Solo los lideres de un clan pueden utilizar este comando y tu no tienes clan!");
return false;
}
@Override
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
Index: 07000-07099.xml
===================================================================
--- 07000-07099.xml (revision 10328)
+++ 07000-07099.xml (working copy)
@@ -243,13 +243,13 @@
<skill id="7029" levels="4" name="Super Haste">
<!-- GM Skill -->
<table name="#amount"> 1 1 1 2 </table>
- <table name="#mAtkSpd"> 2 3 3 2 </table>
- <table name="#pAtk"> 1 1 10000 1 </table>
- <table name="#pAtkSpd"> 2 3 3 2 </table>
- <table name="#reuse"> 0.01 0.01 0.01 1 </table>
- <table name="#runSpd"> 2 3 3 1 </table>
+ <table name="#mAtkSpd"> 2 3 3 4 </table>
+ <table name="#pAtk"> 1 1 10000 10000 </table>
+ <table name="#pAtkSpd"> 2 3 3 4 </table>
+ <table name="#reuse"> 0.01 0.01 0.01 0.01 </table>
+ <table name="#runSpd"> 2 3 3 4 </table>
<set name="abnormalLvl" val="1" />
- <set name="abnormalTime" val="1200" />
+ <set name="abnormalTime" val="10000" />
<set name="abnormalType" val="ATTACK_TIME_DOWN" />
<set name="effectPoint" val="1" />
<set name="icon" val="icon.skill7029" />
<skill id="7029" levels="4" name="Super Haste">
<!-- TODO: Mejorada GM Skill -->
<table name="#amount"> 1 1 1 2 </table>
<table name="#mAtkSpd"> 2 3 3 4 </table>
<table name="#pAtk"> 1 1 10000 10000 </table>
<table name="#pAtkSpd"> 2 3 3 4 </table>
<table name="#reuse"> 0.01 0.01 0.01 0.01 </table>
<table name="#runSpd"> 2 3 3 4 </table>
<set name="abnormalLvl" val="1" />
<set name="abnormalTime" val="100000" />
<set name="abnormalType" val="ATTACK_TIME_DOWN" />
<set name="effectPoint" val="1" />
<set name="icon" val="icon.skill7029" />
<set name="magicLvl" val="1" />
<set name="operateType" val="A2" />
<set name="rideState" val="NONE" />
<set name="targetType" val="SELF" />
<for>
<effect name="Buff">
<mul stat="pAtkSpd" val="#pAtkSpd" />
<mul stat="runSpd" val="#runSpd" />
<mul stat="mAtkSpd" val="#mAtkSpd" />
<mul stat="pAtk" val="#pAtk" />
<mul stat="pReuse" val="#reuse" />
<mul stat="mReuse" val="#reuse" />
<mul stat="regMp" val="#amount" />
<mul stat="regMp" val="#amount" />
<mul stat="maxMp" val="#amount" />
<mul stat="weightLimit" val="#amount" />
</effect>
</for>
</skill>
Index: /trunk/Interlude/java/config/command-privileges.properties
===================================================================
@@ -62,4 +62,13 @@
admin_list_announcements = 75
admin_reload_announcements = 100
+# Auto Announcements
+admin_list_autoannouncements = 100
+admin_add_autoannouncement = 100
+admin_del_autoannouncement = 100
+admin_autoannounce = 100
Index: /trunk/Interlude/java/net/sf/l2j/gameserver/handler/AutoAnnouncementHandler.java
===================================================================
+package net.sf.l2j.gameserver.handler;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ScheduledFuture;
+
+import javolution.text.TextBuilder;
+import javolution.util.FastMap;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
+
+public class AutoAnnouncementHandler
+{
+ private static AutoAnnouncementHandler _instance;
+
+ private static final long DEFAULT_ANNOUNCEMENT_DELAY = 180000; // 3 mins by default
+
+ protected Map<Integer, AutoAnnouncementInstance> _registeredAnnouncements;
+
+ protected AutoAnnouncementHandler()
+ {
+ _registeredAnnouncements = new FastMap<Integer, AutoAnnouncementInstance>();
+ restoreAnnouncementData();
+ }
+
+ private void restoreAnnouncementData()
+ {
+ int numLoaded = 0;
+ java.sql.Connection con = null;
+ PreparedStatement statement = null;
+ ResultSet rs = null;
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+
+ statement = con.prepareStatement("SELECT * FROM auto_announcements ORDER BY id");
+ rs = statement.executeQuery();
+
+ while (rs.next())
+ {
+ numLoaded++;
+
+ registerGlobalAnnouncement(rs.getInt("id"), rs.getString("announcement"), rs.getLong("delay"));
+
+ }
+
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ }
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ public void listAutoAnnouncements(L2PcInstance activeChar)
+ {
+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+
+ TextBuilder replyMSG = new TextBuilder("<html><body>");
+ replyMSG.append("<table width=260><tr>");
+ replyMSG.append("<td width=40></td>");
+ replyMSG.append("<button value=\"Main\" action=\"bypass -h admin_admin\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>");
+ replyMSG.append("<td width=180><center>Auto Announcement Menu</center></td>");
+ replyMSG.append("<td width=40></td>");
+ replyMSG.append("</tr></table>");
+ replyMSG.append("<br><br>");
+ replyMSG.append("<center>Add new auto announcement:</center>");
+ replyMSG.append("<center><multiedit var=\"new_autoannouncement\" width=240 height=30></center><br>");
+ replyMSG.append("<br><br>");
+ replyMSG.append("<center>Delay: <edit var=\"delay\" width=70></center>");
+ replyMSG.append("<center>Note: Time in Seconds 60s = 1 min.</center>");
+ replyMSG.append("<br><br>");
+ replyMSG.append("<center><table><tr><td>");
+ replyMSG.append("<button value=\"Add\" action=\"bypass -h admin_add_autoannouncement $delay $new_autoannouncement\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td>");
+ replyMSG.append("</td></tr></table></center>");
+ replyMSG.append("<br>");
+
+ for (AutoAnnouncementInstance announcementInst : AutoAnnouncementHandler.getInstance().values())
+ {
+ replyMSG.append("<table width=260><tr><td width=220>[" + announcementInst.getDefaultDelay() + "s] " + announcementInst.getDefaultTexts().toString() + "</td><td width=40>");
+ replyMSG.append("<button value=\"Delete\" action=\"bypass -h admin_del_autoannouncement " + announcementInst.getDefaultId() + "\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr></table>");
+ }
+
+ replyMSG.append("</body></html>");
+
+ adminReply.setHtml(replyMSG.toString());
+ activeChar.sendPacket(adminReply);
+ }
+
+ public static AutoAnnouncementHandler getInstance()
+ {
+ if (_instance == null) _instance = new AutoAnnouncementHandler();
+
+ return _instance;
+ }
+
+ public int size()
+ {
+ return _registeredAnnouncements.size();
+ }
+
+ /**
+ * Registers a globally active autoannouncement.
+ * <BR>
+ * Returns the associated auto announcement instance.
+ *
+ * @param String announcementTexts
+ * @param int announcementDelay (-1 = default delay)
+ * @return AutoAnnouncementInstance announcementInst
+ */
+ public AutoAnnouncementInstance registerGlobalAnnouncement(int id, String announcementTexts, long announcementDelay)
+ {
+ return registerAnnouncement(id, announcementTexts, announcementDelay);
+ }
+
+ /**
+ * Registers a NON globally-active auto announcement
+ * <BR>
+ * Returns the associated auto chat instance.
+ *
+ * @param String announcementTexts
+ * @param int announcementDelay (-1 = default delay)
+ * @return AutoAnnouncementInstance announcementInst
+ */
+ public AutoAnnouncementInstance registerAnnouncment(int id, String announcementTexts, long announcementDelay)
+ {
+ return registerAnnouncement(id, announcementTexts, announcementDelay);
+ }
+
+ public AutoAnnouncementInstance registerAnnouncment(String announcementTexts, long announcementDelay)
+ {
+ int nextId = nextAutoAnnouncmentId();
+
+ java.sql.Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("INSERT INTO auto_announcements (id,announcement,delay) " + "VALUES (?,?,?)");
+ statement.setInt(1, nextId);
+ statement.setString(2, announcementTexts);
+ statement.setLong(3, announcementDelay);
+
+
+ statement.executeUpdate();
+
+ statement.close();
+ } catch (Exception e) {
+ } finally {
+ try { con.close(); } catch (Exception e) {}
+ }
+
+ return registerAnnouncement(nextId, announcementTexts, announcementDelay);
+ }
+
+ public int nextAutoAnnouncmentId()
+ {
+
+ int nextId = 0;
+
+ java.sql.Connection con = null;
+ PreparedStatement statement = null;
+ ResultSet rs = null;
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+
+ statement = con.prepareStatement("SELECT id FROM auto_announcements ORDER BY id");
+ rs = statement.executeQuery();
+
+ while (rs.next())
+ {
+ if(rs.getInt("id") > nextId)
+ nextId = rs.getInt("id");
+ }
+
+ statement.close();
+
+ nextId++;
+ }
+ catch (Exception e)
+ {
+ }
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ return nextId;
+ }
+
+ private final AutoAnnouncementInstance registerAnnouncement(int id, String announcementTexts, long chatDelay)
+ {
+ AutoAnnouncementInstance announcementInst = null;
+
+ if (chatDelay < 0) chatDelay = DEFAULT_ANNOUNCEMENT_DELAY;
+
+ if (_registeredAnnouncements.containsKey(id)) announcementInst = _registeredAnnouncements.get(id);
+ else announcementInst = new AutoAnnouncementInstance(id, announcementTexts, chatDelay);
+
+ _registeredAnnouncements.put(id, announcementInst);
+
+ return announcementInst;
+ }
+
+ public Collection<AutoAnnouncementInstance> values()
+ {
+ return _registeredAnnouncements.values();
+ }
+
+ /**
+ * Removes and cancels ALL auto announcement for the given announcement id.
+ *
+ * @param int Id
+ * @return boolean removedSuccessfully
+ */
+ public boolean removeAnnouncement(int id)
+ {
+ AutoAnnouncementInstance announcementInst = _registeredAnnouncements.get(id);
+
+ java.sql.Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("DELETE FROM auto_announcements WHERE id=?");
+ statement.setInt(1, announcementInst.getDefaultId());
+ statement.executeUpdate();
+
+ statement.close();
+ } catch (Exception e) {
+ } finally {
+ try { con.close(); } catch (Exception e) {}
+ }
+
+ return removeAnnouncement(announcementInst);
+ }
+
+ /**
+ * Removes and cancels ALL auto announcement for the given announcement instance.
+ *
+ * @param AutoAnnouncementInstance announcementInst
+ * @return boolean removedSuccessfully
+ */
+ public boolean removeAnnouncement(AutoAnnouncementInstance announcementInst)
+ {
+ if (announcementInst == null) return false;
+
+ _registeredAnnouncements.remove(announcementInst.getDefaultId());
+ announcementInst.setActive(false);
+
+ return true;
+ }
+
+ /**
+ * Returns the associated auto announcement instance either by the given announcement ID
+ * or object ID.
+ *
+ * @param int id
+ * @return AutoAnnouncementInstance announcementInst
+ */
+ public AutoAnnouncementInstance getAutoAnnouncementInstance(int id)
+ {
+ return _registeredAnnouncements.get(id);
+ }
+
+ /**
+ * Sets the active state of all auto announcement instances to that specified,
+ * and cancels the scheduled chat task if necessary.
+ *
+ * @param boolean isActive
+ */
+ public void setAutoAnnouncementActive(boolean isActive)
+ {
+ for (AutoAnnouncementInstance announcementInst : _registeredAnnouncements.values())
+ announcementInst.setActive(isActive);
+ }
+
+ /**
+ * Auto Announcement Instance
+ */
+ public class AutoAnnouncementInstance
+ {
+ private long _defaultDelay = DEFAULT_ANNOUNCEMENT_DELAY;
+ private String _defaultTexts;
+ private boolean _defaultRandom = false;
+ private Integer _defaultId;
+
+ private boolean _isActive;
+
+ public ScheduledFuture<?> _chatTask;
+
+ protected AutoAnnouncementInstance(int id, String announcementTexts, long announcementDelay)
+ {
+ _defaultId = id;
+ _defaultTexts = announcementTexts;
+ _defaultDelay = (announcementDelay * 1000);
+
+ setActive(true);
+ }
+
+ public boolean isActive()
+ {
+ return _isActive;
+ }
+
+ public boolean isDefaultRandom()
+ {
+ return _defaultRandom;
+ }
+
+ public long getDefaultDelay()
+ {
+ return _defaultDelay;
+ }
+
+ public String getDefaultTexts()
+ {
+ return _defaultTexts;
+ }
+
+ public Integer getDefaultId()
+ {
+ return _defaultId;
+ }
+
+ public void setDefaultChatDelay(long delayValue)
+ {
+ _defaultDelay = delayValue;
+ }
+
+ public void setDefaultChatTexts(String textsValue)
+ {
+ _defaultTexts = textsValue;
+ }
+
+ public void setDefaultRandom(boolean randValue)
+ {
+ _defaultRandom = randValue;
+ }
+
+ public void setActive(boolean activeValue)
+ {
+ if (_isActive == activeValue) return;
+
+ _isActive = activeValue;
+
+
+ if (isActive())
+ {
+ AutoAnnouncementRunner acr = new AutoAnnouncementRunner(_defaultId);
+ _chatTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(acr,
+ _defaultDelay,
+ _defaultDelay);
+ }
+ else
+ {
+ _chatTask.cancel(false);
+ }
+ }
+
+
+ /**
+ * Auto Announcement Runner
+ * <BR><BR>
+ * Represents the auto announcement scheduled task for each announcement instance.
+ *
+ * @author chief
+ */
+ private class AutoAnnouncementRunner implements Runnable
+ {
+ protected int id;
+
+ protected AutoAnnouncementRunner(int pId)
+ {
+ id = pId;
+ }
+
+ public synchronized void run()
+ {
+ AutoAnnouncementInstance announcementInst = _registeredAnnouncements.get(id);
+
+ String text;
+
+ text = announcementInst.getDefaultTexts();
+
+ if (text == null) return;
+
+ Announcements.getInstance().announceToAll(text);
+ }
+ }
+ }
+}
Index: /trunk/Interlude/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAutoAnnouncements.java
===================================================================
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.AutoAnnouncementHandler;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class handles following admin commands:
+ * - announce text = announces text to all players
+ * - list_announcements = show menu
+ * - reload_announcements = reloads announcements from txt file
+ * - announce_announcements = announce all stored announcements to all players
+ * - add_announcement text = adds text to startup announcements
+ * - del_announcement id = deletes announcement with respective id
+ *
+ * @version $Revision: 1.4.4.5 $ $Date: 2005/04/11 10:06:06 $
+ */
+public class AdminAutoAnnouncements implements IAdminCommandHandler {
+
+ private static String[] ADMIN_COMMANDS = {
+ "admin_list_autoannouncements",
+ "admin_add_autoannouncement",
+ "admin_del_autoannouncement",
+ "admin_autoannounce"
+ };
+ private static final int REQUIRED_LEVEL = Config.GM_ANNOUNCE;
+
+ public boolean useAdminCommand(String command, L2PcInstance admin) {
+ if (!Config.ALT_PRIVILEGES_ADMIN)
+ if (!(checkLevel(admin.getAccessLevel()) && admin.isGM())) return false;
+
+ if (command.equals("admin_list_autoannouncements"))
+ {
+ AutoAnnouncementHandler.getInstance().listAutoAnnouncements(admin);
+ }
+ else if (command.startsWith("admin_add_autoannouncement"))
+ {
+ //FIXME the player can send only 16 chars (if you try to send more it sends null), remove this function or not?
+ if (!command.equals("admin_add_autoannouncement"))
+ {
+ try{
+ StringTokenizer st = new StringTokenizer(command.substring(27));
+ int delay = Integer.parseInt(st.nextToken().trim());
+ String autoAnnounce = st.nextToken();
+
+ if (delay > 30)
+ {
+ while (st.hasMoreTokens()) {
+ autoAnnounce = autoAnnounce + " " + st.nextToken();
+ };
+
+ AutoAnnouncementHandler.getInstance().registerAnnouncment(autoAnnounce, delay);
+ AutoAnnouncementHandler.getInstance().listAutoAnnouncements(admin);
+ }
+
+ } catch(StringIndexOutOfBoundsException e){}//ignore errors
+ }
+ }
+ else if (command.startsWith("admin_del_autoannouncement"))
+ {
+ try
+ {
+ int val = new Integer(command.substring(27)).intValue();
+ AutoAnnouncementHandler.getInstance().removeAnnouncement(val);
+ AutoAnnouncementHandler.getInstance().listAutoAnnouncements(admin);
+ }
+ catch (StringIndexOutOfBoundsException e)
+ { }
+ }
+
+ // Command is admin autoannounce
+ else if (command.startsWith("admin_autoannounce"))
+ {
+ // Call method from another class
+ AutoAnnouncementHandler.getInstance().listAutoAnnouncements(admin);
+ }
+
+ return true;
+ }
+
+ public String[] getAdminCommandList() {
+ return ADMIN_COMMANDS;
+ }
+
+ private boolean checkLevel(int level) {
+ return (level >= REQUIRED_LEVEL);
+ }
+
+}
Index: /trunk/Datapack/sql/autoanounce.sql
===================================================================
@@ -0,0 +1,9 @@
+-- ----------------------------
+-- Table structure for auto_announcements
+-- ----------------------------
+CREATE TABLE `auto_announcements` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `announcement` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
+ `delay` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
Index: /trunk/Datapack/tools/database_installer.bat
===================================================================
+autoanounce.sql
Index: /trunk/Datapack/data/html/admin/announce.htm
===================================================================
@@ -11,4 +11,5 @@
<td><button value="Announce" action="bypass -h admin_announce_menu $new_announcement" width=60 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
<td><button value="Reload" action="bypass -h admin_announce_announcements" width=60 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
+<td><button value="Auto Announce" action="bypass -h admin_autoannounce $menu_command" width=55 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
</tr></table></center>
%announces%
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/custom/randompvpzone/RandomPvpZone.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2004-2015 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 <http://www.gnu.org/licenses/>.
+ */
+package custom.randompvpzone;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.zone.L2ZoneType;
+import com.l2jserver.util.Rnd;
+
+/**
+ * @author Ezequiel
+ */
+public class RandomPvpZone extends AbstractNpcAI
+{
+ // zonas id
+ private final int zoneid1 = 100000;
+ private final int zoneid2 = 100001;
+ private final int zoneid3 = 100002;
+ private final int zoneid4 = 100003;
+
+ // tiempo de cada zone 30 min
+ private final int tiempocadazona = 1800000;
+ private int zonechoose;
+ private long time;
+
+ public RandomPvpZone()
+ {
+ super(RandomPvpZone.class.getSimpleName(), "custom");
+
+ // agregamos las zonas
+ addEnterZoneId(zoneid1, zoneid2, zoneid3, zoneid4);
+ addExitZoneId(zoneid1, zoneid2, zoneid3, zoneid4);
+
+ time = System.currentTimeMillis();
+
+ zonechoose = zoneid1;
+ }
+
+ @Override
+ public String onEnterZone(L2Character character, L2ZoneType zone)
+ {
+
+ if (zone.getId() == luckyzone())
+ {
+ character.sendMessage("Estas en una zona pvp");
+ character.updatePvPFlag(1);
+
+ }
+
+ return super.onEnterZone(character, zone);
+ }
+
+ @Override
+ public String onExitZone(L2Character character, L2ZoneType zone)
+ {
+ if (zone.getId() == luckyzone())
+ {
+ character.sendMessage("Has salido de la zona Pvp");
+ character.updatePvPFlag(0);
+ }
+
+ return super.onExitZone(character, zone);
+
+ }
+
+ private int luckyzone()
+ {
+ if (System.currentTimeMillis() > (time + tiempocadazona))
+ {
+ // elije una zona random
+ zonechoose = Rnd.get(zoneid1, zoneid4);
+ time = System.currentTimeMillis();
+ }
+ return zonechoose;
+ }
+
+ public static void main(String[] args)
+ {
+ new RandomPvpZone();
+ }
+}
\ No newline at end of file
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/zones/randompvpzone.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
+ <!-- Custom Script Zones -->
+ <zone name="RandomPvpZone1" id="100000" type="ScriptZone" shape="Cylinder" minZ="editar" maxZ="editar" rad="editar">
+ <node X="editar" Y="editar" />
+ </zone>
+ <zone name="RandomPvpZone2" id="100001" type="ScriptZone" shape="Cylinder" minZ="editar" maxZ="editar" rad="editar">
+ <node X="editar" Y="editar" />
+ </zone>
+ <zone name="RandomPvpZone3" id="100002" type="ScriptZone" shape="Cylinder" minZ="editar" maxZ="editar" rad="editar">
+ <node X="editar" Y="editar" />
+ </zone>
+ <zone name="RandomPvpZone4" id="100003" type="ScriptZone" shape="Cylinder" minZ="editar" maxZ="editar" rad="editar">
+ <node X="editar" Y="editar" />
+ </zone>
+</list>
\ No newline at end of file
CitarHow it works:
- Checking the number of things (items.php)
- Checking the amount of skill (skills.php)
- Checking the number of prescriptions (recipebook.php)
- Connecting to a database (the settings in config.php)
- Check for the existence of a temporary table TABLENAME (in config.php table name must be unique! Otherwise there cleaning noun. Table)
- If the table does not, it creates a temporary table
- If the table has a database, then a truncate - the complete removal of all table rows
- Parses a file with the names of accounts corresponding regular expression [az, AZ ,0-9] {4,16} (in config.php: URL)
- Create a password accounts with the names (in config.php encryption ENCODEPASS choice sha1 or whirlpool)
- All sparsennye logins stored in TABLENAME
- Remove duplicate in TABLENAME
- Find and delete existing accounts. Matched against the names of the accounts to a table TABLENAME server TBL_ACCOUNTS
- Register account
- Check for unique names of the characters. If the character's name is occupied, the name is added to the text [az, AZ ,0-9] {2,4} (in config.php: CONCATNAME)
- Creating a character creation tables server build. Randomly adding coordinates (zone.php)
- Creating a character stats. Randomly add a class
- Create a character skills (skills trained to lvl 85)
- Adding itemov character in inventory
- Added shortcuts in the panel (3 tag: buy, sell, kraft)
- Adding parameters offline commerce (offline_trade.php)
- Adding recipes character class if 118 => «Maestro»
List of files:
config.php - config. file
db_version.php - table names
functions.php - functions
gen_char.php - generator start
index.php - the main page. gen_char.php runs after entering username and password (default admin: admin)
items.php - arrays of things
names.txt - a list of names to create an account
offline_trade.php - parameter list offline trade
recipebook.php - arrays recipes
skills.php - arrays of skills and classes
zone.php - character coordinates
DOC / create_skills_array.txt - creating an array of skills to create a character
DOC / HELP.txt - Documentation
DOC / test_database.sql - test database
### Eclipse Workspace Patch 1.0
#P L2J_DataPack
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9024)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -42,6 +42,7 @@
import handlers.admincommandhandlers.AdminClan;
import handlers.admincommandhandlers.AdminCreateItem;
import handlers.admincommandhandlers.AdminCursedWeapons;
+import handlers.admincommandhandlers.AdminDanceSystem;
import handlers.admincommandhandlers.AdminDebug;
import handlers.admincommandhandlers.AdminDelete;
import handlers.admincommandhandlers.AdminDisconnect;
@@ -431,6 +450,8 @@
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,
+ AdminDanceSystem.class,
},
{
// Bypass Handlers
Index: dist/game/data/html/admin/dancesystem.htm
===================================================================
--- dist/game/data/html/admin/dancesystem.htm (revision 0)
+++ dist/game/data/html/admin/dancesystem.htm (revision 0)
@@ -0,0 +1,17 @@
+<html><head><title>Dance Panel</title></head><body>
+<center><br><center><font color="3399ff">Infos:</font></center><br>
+<table width="270" cellpadding="5" bgcolor=444444>
+<tr>
+<td valign="top">From here you can start a dancing event! All players will dance untill the end of the song!<br> Just select the name of the song from the list above! During the event all players will be immortal and paralized !</td>!
+</tr>
+</table>
+</center>
+<br><br>
+<center><font color="3399ff">Songs List:</font></center><br>
+<center>
+<table width=125 border=0 bgcolor=444444><tr><br><br><br><br>
+<td><button action="bypass -h admin_gangnam" value="Gangnam Style" width=140 height=27 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+<td><button action="bypass -h admin_sexi" value="I'm Sexy and i know it" width=140 height=27 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+</tr></table><br>
+<br><br><br>by <font color="3399ff">NeverMore</font>
+</center></body></html>
\ No newline at end of file
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminDanceSystem.java
===================================================================
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminDanceSystem.java (revision 0)
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminDanceSystem.java (revision 0)
@@ -0,0 +1,148 @@
+package handlers.admincommandhandlers;
+
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.handler.IAdminCommandHandler;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.effects.AbnormalEffect;
+import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
+import com.l2jserver.gameserver.network.serverpackets.PlaySound;
+
+/**
+ *
+ * @author NeverMore
+ */
+public class AdminDanceSystem implements IAdminCommandHandler
+{
+ boolean _temp = false;
+
+ private static final String[] ADMIN_COMMANDS = { "admin_dance" , "admin_gangnam", "admin_sexi"};
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if (command.equals("admin_dance"))
+ {
+ AdminHelpPage.showHelpPage(activeChar, "dancesystem.htm");
+ }
+
+ if (command.equals("admin_gangnam"))
+ {
+ if (_temp == true)
+ {
+ ExShowScreenMessage message1 = new ExShowScreenMessage("There is already a dancing event running! Try later!", 4000);
+ activeChar.sendPacket(message1);
+ return false;
+ }
+ _temp = true;
+ ExShowScreenMessage message1 = new ExShowScreenMessage("Lets have some fun ! In 30 sec's dance event begins !", 4000);
+ activeChar.sendPacket(message1);
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ for(L2PcInstance player : L2World.getInstance().getAllPlayersArray())
+ {
+ PlaySound _song = new PlaySound(1, "Gangnam", 0, 0, 0, 0, 0);
+ player.sendPacket(_song);
+ ExShowScreenMessage message1 = new ExShowScreenMessage( "Show me what you got , lets shake it baby !", 8000);
+ player.sendPacket(message1);
+ player.setIsParalyzed(true);
+ player.setIsInvul(true);
+ player.broadcastSocialAction(10);
+ player.startAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
+ ThreadPoolManager.getInstance().scheduleGeneral(new MyTask(), 3500);
+ ThreadPoolManager.getInstance().scheduleGeneral(new MyTask2(), 40000);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }, (30000));
+ }
+
+ if (command.equals("admin_sexi"))
+ {
+ if (_temp == true)
+ {
+ ExShowScreenMessage message1 = new ExShowScreenMessage("There is already a dancing event running! Try later!", 4000);
+ activeChar.sendPacket(message1);
+ return false;
+ }
+ _temp = true;
+ ExShowScreenMessage message1 = new ExShowScreenMessage("Lets have some fun ! In 30 sec's dance event begins !", 4000);
+ activeChar.sendPacket(message1);
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ for(L2PcInstance player : L2World.getInstance().getAllPlayersArray())
+ {
+ PlaySound _song = new PlaySound(1, "sexi", 0, 0, 0, 0, 0);
+ player.sendPacket(_song);
+ ExShowScreenMessage message1 = new ExShowScreenMessage( "Show me what you got , lets shake it baby !", 8000);
+ player.sendPacket(message1);
+ player.setIsParalyzed(true);
+ player.setIsInvul(true);
+ player.broadcastSocialAction(10);
+ player.startAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
+ ThreadPoolManager.getInstance().scheduleGeneral(new MyTask(), 3500);
+ ThreadPoolManager.getInstance().scheduleGeneral(new MyTask2(), 43000);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }, (30000));
+ }
+
+ return false;
+ }
+
+ class MyTask implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ if(_temp == true)
+ {
+ for(L2PcInstance player : L2World.getInstance().getAllPlayersArray())
+ {
+ player.broadcastSocialAction(18);
+ }
+ ThreadPoolManager.getInstance().scheduleGeneral(new MyTask(), 18000);
+ }
+ }
+ }
+ class MyTask2 implements Runnable
+ {
+
+ @Override
+ public void run()
+ {
+ for(L2PcInstance player : L2World.getInstance().getAllPlayersArray())
+ {
+ _temp = false;
+ player.setIsParalyzed(false);
+ player.setIsInvul(false);
+ player.broadcastSocialAction(10);
+ player.broadcastSocialAction(11);
+ player.stopAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
+ }
+ }
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
Index: dist/game/config/adminCommands.xml
===================================================================
--- dist/game/config/adminCommands.xml (revision 9024)
+++ dist/game/config/adminCommands.xml (working copy)
@@ -26,6 +26,11 @@
<admin command="admin_config_server" accessLevel="7" />
<admin command="admin_gmon" accessLevel="7" />
+ <!-- ADMIN DANCE SYSTEM -->
+ <admin command="admin_gangnam" accessLevel="7" />
+ <admin command="admin_dance" accessLevel="7" />
+ <admin command="admin_sexi" accessLevel="7" />
+
<!-- ADMIN ANNOUNCEMENTS -->
<admin command="admin_list_announcements" accessLevel="7" />
<admin command="admin_list_critannouncements" accessLevel="7" />