Browse Source

Naming conventions: accounts.access_level -> accessLevel. Requires DP updates. I'm going to continue with similar changes in the upcoming days, please be aware of the changes that should be needed if you wrote web or GUI apps around the L2J database. For L2J developers: let's please avoid misleading/mixed naming when it comes to fields and tables.

DrLecter 17 years ago
parent
commit
7160e89972

+ 4 - 4
L2_GameServer_T1/java/net/sf/l2j/accountmanager/SQLAccountManager.java

@@ -114,11 +114,11 @@ public class SQLAccountManager
 		int count = 0;
 		int count = 0;
 		java.sql.Connection con = null;
 		java.sql.Connection con = null;
 		con = L2DatabaseFactory.getInstance().getConnection();
 		con = L2DatabaseFactory.getInstance().getConnection();
-		PreparedStatement statement = con.prepareStatement("SELECT login, access_level FROM accounts ORDER BY login ASC");
+		PreparedStatement statement = con.prepareStatement("SELECT login, accessLevel FROM accounts ORDER BY login ASC");
 		ResultSet rset = statement.executeQuery();
 		ResultSet rset = statement.executeQuery();
         while (rset.next())
         while (rset.next())
         {
         {
-			System.out.println(rset.getString("login")	+ " -> " + rset.getInt("access_level"));
+			System.out.println(rset.getString("login")	+ " -> " + rset.getInt("accessLevel"));
 			count++;
 			count++;
         }
         }
 		rset.close();
 		rset.close();
@@ -137,7 +137,7 @@ public class SQLAccountManager
 		// Add to Base
 		// Add to Base
 		java.sql.Connection con = null;
 		java.sql.Connection con = null;
 		con = L2DatabaseFactory.getInstance().getConnection();
 		con = L2DatabaseFactory.getInstance().getConnection();
-		PreparedStatement statement = con.prepareStatement("REPLACE	accounts (login, password, access_level) VALUES (?,?,?)");
+		PreparedStatement statement = con.prepareStatement("REPLACE	accounts (login, password, accessLevel) VALUES (?,?,?)");
 		statement.setString(1, account);
 		statement.setString(1, account);
 		statement.setString(2, Base64.encodeBytes(newpass));
 		statement.setString(2, Base64.encodeBytes(newpass));
 		statement.setString(3, level);
 		statement.setString(3, level);
@@ -162,7 +162,7 @@ public class SQLAccountManager
 			// Exist
 			// Exist
 
 
 			// Update
 			// Update
-			statement = con.prepareStatement("UPDATE accounts SET access_level=? WHERE login=?;");
+			statement = con.prepareStatement("UPDATE accounts SET accessLevel=? WHERE login=?;");
 			statement.setEscapeProcessing(true);
 			statement.setEscapeProcessing(true);
 			statement.setString(1, level);
 			statement.setString(1, level);
 			statement.setString(2, account);
 			statement.setString(2, account);

+ 24 - 21
L2_GameServer_T1/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java

@@ -1,16 +1,20 @@
 /*
 /*
- * 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/>.
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
  */
  */
 package net.sf.l2j.gameserver.clientpackets;
 package net.sf.l2j.gameserver.clientpackets;
 
 
@@ -24,6 +28,7 @@ import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.GmListTable;
 import net.sf.l2j.gameserver.GmListTable;
+import net.sf.l2j.gameserver.LoginServerThread;
 import net.sf.l2j.gameserver.Olympiad;
 import net.sf.l2j.gameserver.Olympiad;
 import net.sf.l2j.gameserver.SevenSigns;
 import net.sf.l2j.gameserver.SevenSigns;
 import net.sf.l2j.gameserver.TaskPriority;
 import net.sf.l2j.gameserver.TaskPriority;
@@ -33,7 +38,6 @@ import net.sf.l2j.gameserver.datatables.MapRegionTable;
 import net.sf.l2j.gameserver.handler.AdminCommandHandler;
 import net.sf.l2j.gameserver.handler.AdminCommandHandler;
 import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
 import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
 import net.sf.l2j.gameserver.instancemanager.CoupleManager;
 import net.sf.l2j.gameserver.instancemanager.CoupleManager;
-import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
 import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
 import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
 import net.sf.l2j.gameserver.instancemanager.PetitionManager;
 import net.sf.l2j.gameserver.instancemanager.PetitionManager;
 import net.sf.l2j.gameserver.instancemanager.SiegeManager;
 import net.sf.l2j.gameserver.instancemanager.SiegeManager;
@@ -190,11 +194,6 @@ public class EnterWorld extends L2GameClientPacket
             engage(activeChar);
             engage(activeChar);
             notifyPartner(activeChar,activeChar.getPartnerId());
             notifyPartner(activeChar,activeChar.getPartnerId());
         }
         }
-        
-        if(activeChar.isCursedWeaponEquiped()) 
-        { 
-            CursedWeaponsManager.getInstance().getCursedWeapon(activeChar.getCursedWeaponEquipedId()).giveSkill(); 
-        }
 
 
         if (activeChar.getAllEffects() != null)
         if (activeChar.getAllEffects() != null)
         {
         {
@@ -236,11 +235,11 @@ public class EnterWorld extends L2GameClientPacket
         sendPacket(sm);
         sendPacket(sm);
 
 
         sm = new SystemMessage(SystemMessageId.S1_S2);
         sm = new SystemMessage(SystemMessageId.S1_S2);
-        sm.addString(getText("V2VsY29tZSB0byBhIEwySiBTZXJ2ZXIsIGZvdW5kZWQgYnkgTDJDaGVmLg=="));
+        sm.addString(getText("VGhpcyBzZXJ2ZXIgdXNlcyBMMkosIGEgcHJvamVjdCBmb3VuZGVkIGJ5IEwyQ2hlZg==\n"));
 
 
         sendPacket(sm);
         sendPacket(sm);
         sm = new SystemMessage(SystemMessageId.S1_S2);
         sm = new SystemMessage(SystemMessageId.S1_S2);
-        sm.addString(getText("RGV2ZWxvcGVkIGJ5IHRoZSBMMkogRGV2IFRlYW0gYXQgbDJqc2VydmVyLmNvbS4="));
+        sm.addString(getText("YW5kIGRldmVsb3BlZCBieSB0aGUgTDJKIERldiBUZWFtIGF0IGwyanNlcnZlci5jb20=\n"));
 
 
         sendPacket(sm);
         sendPacket(sm);
 
 
@@ -260,7 +259,11 @@ public class EnterWorld extends L2GameClientPacket
         sm = null;
         sm = null;
 
 
         sm = new SystemMessage(SystemMessageId.S1_S2);
         sm = new SystemMessage(SystemMessageId.S1_S2);
-        sm.addString(getText("Q29weXJpZ2h0IDIwMDQtMjAwNw=="));
+        sm.addString(getText("Q29weXJpZ2h0IDIwMDQtMjAwOA==\n"));
+        sendPacket(sm);
+        sm = new SystemMessage(SystemMessageId.S1_S2);
+        sm.addString(LoginServerThread.getInstance().getServerName());
+        sm.addString(getText("V2VsY29tZSB0byA="));
         sendPacket(sm);
         sendPacket(sm);
 
 
         SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);
         SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);

+ 6 - 6
L2_GameServer_T1/java/net/sf/l2j/loginserver/LoginController.java

@@ -427,7 +427,7 @@ public class LoginController
 		{
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
 			con = L2DatabaseFactory.getInstance().getConnection();
 
 
-			String stmt = "UPDATE accounts SET access_level=? WHERE login=?";
+			String stmt = "UPDATE accounts SET accessLevel=? WHERE login=?";
 			statement = con.prepareStatement(stmt);
 			statement = con.prepareStatement(stmt);
 			statement.setInt(1, banLevel);
 			statement.setInt(1, banLevel);
 			statement.setString(2, account);
 			statement.setString(2, account);
@@ -459,7 +459,7 @@ public class LoginController
 		try
 		try
 		{
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
 			con = L2DatabaseFactory.getInstance().getConnection();
-			statement = con.prepareStatement("SELECT access_level FROM accounts WHERE login=?");
+			statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");
 			statement.setString(1, user);
 			statement.setString(1, user);
 			ResultSet rset = statement.executeQuery();
 			ResultSet rset = statement.executeQuery();
 			if (rset.next())
 			if (rset.next())
@@ -539,13 +539,13 @@ public class LoginController
 			int lastServer = 1;
 			int lastServer = 1;
 
 
 			con = L2DatabaseFactory.getInstance().getConnection();
 			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT password, access_level, lastServer FROM accounts WHERE login=?");
+			PreparedStatement statement = con.prepareStatement("SELECT password, accessLevel, lastServer FROM accounts WHERE login=?");
 			statement.setString(1, user);
 			statement.setString(1, user);
 			ResultSet rset = statement.executeQuery();
 			ResultSet rset = statement.executeQuery();
 			if (rset.next())
 			if (rset.next())
 			{
 			{
 				expected = Base64.decode(rset.getString("password"));
 				expected = Base64.decode(rset.getString("password"));
-				access = rset.getInt("access_level");
+				access = rset.getInt("accessLevel");
 				lastServer = rset.getInt("lastServer");
 				lastServer = rset.getInt("lastServer");
 				if (lastServer <= 0) lastServer = 1; // minServerId is 1 in Interlude
 				if (lastServer <= 0) lastServer = 1; // minServerId is 1 in Interlude
 				if (Config.DEBUG) _log.fine("account exists");
 				if (Config.DEBUG) _log.fine("account exists");
@@ -560,7 +560,7 @@ public class LoginController
 				{
 				{
 					if ((user.length() >= 2) && (user.length() <= 14))
 					if ((user.length() >= 2) && (user.length() <= 14))
 					{
 					{
-						statement = con.prepareStatement("INSERT INTO accounts (login,password,lastactive,access_level,lastIP) values(?,?,?,?,?)");
+						statement = con.prepareStatement("INSERT INTO accounts (login,password,lastactive,accessLevel,lastIP) values(?,?,?,?,?)");
 						statement.setString(1, user);
 						statement.setString(1, user);
 						statement.setString(2, Base64.encodeBytes(hash));
 						statement.setString(2, Base64.encodeBytes(hash));
 						statement.setLong(3, System.currentTimeMillis());
 						statement.setLong(3, System.currentTimeMillis());
@@ -668,7 +668,7 @@ public class LoginController
 		try
 		try
 		{
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
 			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT access_level FROM accounts WHERE login=?");
+			PreparedStatement statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");
 			statement.setString(1, user);
 			statement.setString(1, user);
 			ResultSet rset = statement.executeQuery();
 			ResultSet rset = statement.executeQuery();
 			if (rset.next())
 			if (rset.next())

+ 2 - 2
L2_GameServer_T1/sql/l2jdb_create.sql

@@ -5,8 +5,8 @@ CREATE TABLE accounts (
   login varchar(45) ,
   login varchar(45) ,
   password varchar(45) ,
   password varchar(45) ,
   lastactive decimal(20) ,
   lastactive decimal(20) ,
-  access_level decimal(11) ,
-  lastIP varchar(16),
+  accessLevel tinyint ,
+  lastIP char(15),
   PRIMARY KEY  (login)
   PRIMARY KEY  (login)
 );
 );
 
 

+ 2 - 2
L2_GameServer_T1/sql/l2jdb_login_account.sql

@@ -5,7 +5,7 @@ CREATE TABLE `accounts` (
   `login` VARCHAR(45) NOT NULL default '',
   `login` VARCHAR(45) NOT NULL default '',
   `password` VARCHAR(45) ,
   `password` VARCHAR(45) ,
   `lastactive` DECIMAL(20),
   `lastactive` DECIMAL(20),
-  `access_level` INT,
-  `lastIP` VARCHAR(20),
+  `accessLevel` TINYINT,
+  `lastIP` CHAR(15),
   PRIMARY KEY (`login`)
   PRIMARY KEY (`login`)
 );
 );