Jump to content
  • 0

Premium Account


EdenEternal

Question

hi MaxCheaters.com!

 

server:interlude.l2jteon rev.566

 

i want to create Premium Accounts on My Server.

example: who have premium account for him rates will be x100x100x100

 

Link to comment
Share on other sites

Recommended Posts

  • 0

if you have made this mod please write little mod how to do this

i think its best if you start learning a bit more java.. before thinking of moding your server more than what config files allow..

 

great.. and now that youre so good.. you can keep answering the next 10posts of how do i add that to my server?

 

 

//off topic

 

ohhh cmon the modern worlds post hunting leave it as it is

 

if someone dont get it he talk about a diff file

 

obviously my post wasnt spam, however yourse is..

 

ofc but this is a simple way :)

L2NpcInstance

   public int getExpReward()

   {

      double rateXp = getStat().calcStat(Stats.MAX_HP , 1, this, null);

+      if (player.isDonator())

+         return (int)(getTemplate().rewardExp * rateXp * Config.RATE_XP * Config.DONATOR_XP);

+      else

        return (int)(getTemplate().rewardExp * rateXp * Config.RATE_XP);

   }

 

im not sure why you quoted me.. however now you can start explaining it to lekino.. gl.

 

Link to comment
Share on other sites

  • 0

i have found this patch for premium accounts

 

Index: /trunk/DataPack/sql/character_premium.sql
===================================================================
--- /trunk/DataPack/sql/character_premium.sql (revision 258)
+++ /trunk/DataPack/sql/character_premium.sql (revision 258)
@@ -0,0 +1,18 @@
+-- ----------------------------
+-- Table structure for character_premium
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `character_premium` (
+  `account_name` varchar(45) NOT NULL DEFAULT '',
+  `premium_service` int(1) NOT NULL DEFAULT '0',
+  `enddate` decimal(20,0) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`account_name`)
+);
+-- ----------------------------
+-- Table structure for character_premium
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `character_premium` (
+  `account_name` varchar(45) NOT NULL DEFAULT '',
+  `premium_service` int(1) NOT NULL DEFAULT '0',
+  `enddate` decimal(20,0) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`account_name`)
+);
Index: /trunk/DataPack/tools/database_installer.bat
===================================================================
--- /trunk/DataPack/tools/database_installer.bat (revision 252)
+++ /trunk/DataPack/tools/database_installer.bat (revision 258)
@@ -542,4 +542,5 @@
character_quest_global_data.sql
character_quests.sql
+character_premium.sql
character_raid_points.sql
character_recipebook.sql
Index: /trunk/DataPack/tools/full_install.sql
===================================================================
--- /trunk/DataPack/tools/full_install.sql (revision 251)
+++ /trunk/DataPack/tools/full_install.sql (revision 258)
@@ -67,4 +67,5 @@
DROP TABLE IF EXISTS character_quest_global_data;
DROP TABLE IF EXISTS character_quests;
+DROP TABLE IF EXISTS character_premium;
DROP TABLE IF EXISTS character_raid_points;
DROP TABLE IF EXISTS character_recipebook;
Index: /trunk/DataPack/tools/database_installer.sh
===================================================================
--- /trunk/DataPack/tools/database_installer.sh (revision 251)
+++ /trunk/DataPack/tools/database_installer.sh (revision 258)
@@ -287,4 +287,5 @@
$MYG < ../sql/character_quest_global_data.sql &> /dev/null
$MYG < ../sql/character_quests.sql &> /dev/null
+$MYG < ../sql/character_premium.sql &> /dev/null
$MYG < ../sql/character_raid_points.sql &> /dev/null
$MYG < ../sql/character_recipebook.sql &> /dev/null
Index: /trunk/DataPack/data/html/admin/premium_menu.htm
===================================================================
--- /trunk/DataPack/data/html/admin/premium_menu.htm (revision 258)
+++ /trunk/DataPack/data/html/admin/premium_menu.htm (revision 258)
@@ -0,0 +1,29 @@
+<html><title>Premium Service Menu</title><body>
+<center>
+<table width=270 border=0 bgcolor="666666">
+<tr>
+<td><button value="Main" action="bypass -h admin_admin" width=50 height=15 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
+<td><button value="Game" action="bypass -h admin_admin2" width=50 height=15 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
+<td><button value="Effects" action="bypass -h admin_admin3" width=50 height=15 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
+<td><button value="Server" action="bypass -h admin_admin4" width=50 height=15 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
+<td><button value="Mods" action="bypass -h admin_admin5" width=50 height=15 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
+</tr>
+</table>
+<br>
+<font color="LEVEL">Premium Service Menu</font><br>
+<table width=250>
+<tr>
+<td>Enter Account Name:</td>
+<td><edit var="acc_name" width=200></td>
+</tr>
+</table>
+<br>
+<table width=260>
+<tr>
+<td><button value="Add 1 month Premium Services" action="bypass -h admin_premium_add1 $acc_name" width=200 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+<td><button value="Add 2 month Premium Services" action="bypass -h admin_premium_add2 $acc_name" width=200 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+<td><button value="Add 3 month Premium Services" action="bypass -h admin_premium_add3 $acc_name" width=200 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+</tr>
+</table>
+</center>
+</body></html>
Index: /trunk/DataPack/data/html/admin/main_menu.htm
===================================================================
--- /trunk/DataPack/data/html/admin/main_menu.htm (revision 221)
+++ /trunk/DataPack/data/html/admin/main_menu.htm (revision 258)
@@ -54,4 +54,5 @@
<td><button value="TradeOff" action="bypass -h admin_tradeoff" width=65 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button value="Invul" action="bypass -h admin_invul" width=65 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
+<td><button value="Pr.Service" action="bypass -h admin_premium_menu" width=65 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr><tr>
<td><button value="Wyvern" action="bypass -h admin_ride_wyvern" width=65 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
Index: /trunk/Game/config/main/rates.ini
===================================================================
--- /trunk/Game/config/main/rates.ini (revision 221)
+++ /trunk/Game/config/main/rates.ini (revision 258)
@@ -49,4 +49,18 @@
# Рейт на дроп квестовых предметов. Внимание: данная опция работает не во всех квестах. Многие квесты нужно редактировать в датапаке для работы этой опции.
RateDropQuest = 1
+
+# ---------------------------------------------------------------------------
+# Система Премиум-Аккаунт (ПА)
+# ---------------------------------------------------------------------------
+# Включить функцию Премиум-Аккаунт (ПА)?
+# По умолчанию: False
+UsePremiumServices = False
+# Какие рейты будут приниматься для обладателей ПА?
+PremiumRateXp = 2
+PremiumRateSp = 2
+PremiumRateDropAdena = 2
+PremiumRateDropItems = 2
+PremiumRateDropSpoil = 2
+PremiumRateDropQuest = 2

# List of RaidBoss items affected by RateDropBossJewel (separated by ",")
Index: /trunk/Game/src/main/java/com/l2open/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/Game/src/main/java/com/l2open/gameserver/model/actor/instance/L2PcInstance.java (revision 221)
+++ /trunk/Game/src/main/java/com/l2open/gameserver/model/actor/instance/L2PcInstance.java (revision 258)
@@ -299,4 +299,7 @@
	// Character Transformation SQL String Definitions:
	private static final String UPDATE_CHAR_TRANSFORM = "UPDATE characters SET transform_id=? WHERE charId=?";
+	// Character PremiumService String Definitions:
+	private static final String RESTORE_PREMIUMSERVICE = "SELECT premium_service,enddate FROM character_premium WHERE account_name=?";
+	private static final String	UPDATE_PREMIUMSERVICE = "UPDATE character_premium SET premium_service=?,enddate=? WHERE account_name=?";
	public static final int REQUEST_TIMEOUT = 15;
	public static final int STORE_PRIVATE_NONE = 0;
@@ -13752,3 +13755,119 @@
		return new PcKnownList(this);
	}
+	
+	private void createPSdb()
+	{
+		Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("INSERT INTO character_premium (account_name,premium_service,enddate) values(?,?,?)");
+			statement.setString(1, _accountName);
+			statement.setInt(2, 0);
+			statement.setLong(3, 0);			
+			statement.executeUpdate();
+			statement.close();
+		}
+		catch (Exception e)
+		{
+			_log.warn("Could not insert char data: "+e);
+            e.printStackTrace();
+			return;
+		}
+		finally
+		{
+			try
+			{
+				if (con != null)
+					con.close();
+			}
+			catch (SQLException e)
+			{
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	private static void PStimeOver(String account)
+	{
+		Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement(UPDATE_PREMIUMSERVICE);
+			statement.setInt(1, 0);
+			statement.setLong(2, 0);
+			statement.setString(3, account);
+			statement.execute();
+			statement.close();
+		}
+		catch (SQLException e)
+		{
+			_log.warn("PremiumService:  Could not increase data");
+		}
+		finally
+		{
+			try
+			{
+				if (con != null)
+					con.close();
+			}
+			catch (SQLException e)
+			{
+				e.printStackTrace();
+			}
+		}		
+	}
+	
+	private static void restorePremServiceData(L2PcInstance player, String account)
+	{
+	    boolean sucess=false; 
+		Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement(RESTORE_PREMIUMSERVICE);
+			statement.setString(1, account);
+			ResultSet rset = statement.executeQuery();
+			while (rset.next())
+			{
+				sucess=true;
+				if (Config.USE_PREMIUMSERVICE){
+					if (rset.getLong("enddate") <= System.currentTimeMillis()){
+						PStimeOver(account);
+						player.setPremiumService(0);
+					}
+					else
+						player.setPremiumService(rset.getInt("premium_service"));
+				}
+				else
+					player.setPremiumService(0);
+			}
+
+			statement.close();
+			
+		}
+		catch (Exception e)
+		{
+			_log.warn("PremiumService: Could not restore PremiumService data for:" + account + "."+e);
+            e.printStackTrace();
+		}
+		finally
+		{
+			try
+			{
+				if (con != null)
+					con.close();
+			}
+			catch (SQLException e)
+			{
+				e.printStackTrace();
+			}
+		}
+		if (sucess==false)
+		{
+			player.createPSdb();
+			player.setPremiumService(0);
+		}
+	}
}
Index: /trunk/Game/src/main/java/com/l2open/gameserver/model/actor/L2Character.java
===================================================================
--- /trunk/Game/src/main/java/com/l2open/gameserver/model/actor/L2Character.java (revision 249)
+++ /trunk/Game/src/main/java/com/l2open/gameserver/model/actor/L2Character.java (revision 258)
@@ -6886,3 +6886,15 @@
	}

+	private int _PremiumService; 
+	
+    public void setPremiumService(int PS)
+     {
+          _PremiumService=PS;
+     }     
+     
+          public int getPremiumService()
+     {
+          return _PremiumService;
+      
+     }
}
Index: /trunk/Game/src/main/java/com/l2open/gameserver/handler/AdminCommandHandler.java
===================================================================
--- /trunk/Game/src/main/java/com/l2open/gameserver/handler/AdminCommandHandler.java (revision 221)
+++ /trunk/Game/src/main/java/com/l2open/gameserver/handler/AdminCommandHandler.java (revision 258)
@@ -67,4 +67,5 @@
import com.l2open.gameserver.handler.admincommandhandlers.AdminPledge;
import com.l2open.gameserver.handler.admincommandhandlers.AdminPolymorph;
+import com.l2open.gameserver.handler.admincommandhandlers.AdminPremium;
import com.l2open.gameserver.handler.admincommandhandlers.AdminQuest;
import com.l2open.gameserver.handler.admincommandhandlers.AdminReload;
Index: /trunk/Game/src/main/java/com/l2open/gameserver/handler/admincommandhandlers/AdminPremium.java
===================================================================
--- /trunk/Game/src/main/java/com/l2open/gameserver/handler/admincommandhandlers/AdminPremium.java (revision 258)
+++ /trunk/Game/src/main/java/com/l2open/gameserver/handler/admincommandhandlers/AdminPremium.java (revision 258)
@@ -0,0 +1,108 @@
+package com.l2open.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.PreparedStatement;
+
+import java.util.Calendar;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2open.L2DatabaseFactory;
+import com.l2open.gameserver.handler.IAdminCommandHandler;
+import com.l2open.gameserver.model.actor.instance.L2PcInstance;
+
+public class AdminPremium implements IAdminCommandHandler
+{
+	private static final String[] ADMIN_COMMANDS = { "admin_premium_menu", "admin_premium_add1", "admin_premium_add2", "admin_premium_add3" };
+	
+private static final String UPDATE_PREMIUMSERVICE = "UPDATE character_premium SET premium_service=?,enddate=? WHERE account_name=?";
+private static final Logger _log = Logger.getLogger(AdminPremium.class.getName());
+	
+	public boolean useAdminCommand(String command, L2PcInstance activeChar)
+	{
+		if (command.equals("admin_premium_menu"))
+		{
+			AdminHelpPage.showHelpPage(activeChar, "premium_menu.htm");
+		}
+		else if (command.startsWith("admin_premium_add1"))
+		{
+			try
+            {
+                String val = command.substring(19);
+                addPremiumServices(1, val);
+            }
+            catch(StringIndexOutOfBoundsException e)
+            {
+                activeChar.sendMessage("Err");
+            }
+        }
+		else if(command.startsWith("admin_premium_add2"))
+        {
+            try
+            {
+                String val = command.substring(19);
+                addPremiumServices(2, val);
+            }
+            catch(StringIndexOutOfBoundsException e)
+            {
+                activeChar.sendMessage("Err");
+            }
+        }
+		else if(command.startsWith("admin_premium_add3"))
+        {
+            try
+            {
+                String val = command.substring(19);
+                addPremiumServices(3, val);
+            }
+            catch(StringIndexOutOfBoundsException e)
+            {
+                activeChar.sendMessage("Err");
+            }
+        }
+        return true;
+    }
+	
+	public String[] getAdminCommandList()
+	{
+		return ADMIN_COMMANDS;
+	}
+	
+	private void addPremiumServices(int Months,String AccName)
+	{
+		Connection con = null;
+		try
+		{
+			Calendar finishtime = Calendar.getInstance();
+			finishtime.setTimeInMillis(System.currentTimeMillis());
+			finishtime.set(Calendar.SECOND, 0);
+			finishtime.add(Calendar.MONTH, Months);
+			
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement(UPDATE_PREMIUMSERVICE);
+			statement.setInt(1, 1);
+			statement.setLong(2, finishtime.getTimeInMillis());
+			statement.setString(3, AccName);
+			statement.execute();
+			statement.close();
+		}
+		catch (SQLException e)
+		{
+			_log.info("PremiumService:  Could not increase data");
+		}
+		finally
+		{
+			try
+			{
+				if (con != null)
+					con.close();
+			}
+			catch (SQLException e)
+			{
+				e.printStackTrace();
+			}
+		}		
+		
+	}
+}
Index: /trunk/Game/src/main/java/com/l2open/Config.java
===================================================================
--- /trunk/Game/src/main/java/com/l2open/Config.java (revision 233)
+++ /trunk/Game/src/main/java/com/l2open/Config.java (revision 258)
@@ -298,4 +298,11 @@
	public static int RATE_DROP_MANOR;
	public static float RATE_DROP_QUEST;
+	public static boolean	USE_PREMIUMSERVICE;
+	public static float		PREMIUM_RATE_XP;
+	public static float		PREMIUM_RATE_SP;
+	public static float		PREMIUM_RATE_DROP_ADENA;
+	public static float		PREMIUM_RATE_DROP_SPOIL;
+	public static float		PREMIUM_RATE_DROP_ITEMS;
+	public static float		PREMIUM_RATE_DROP_QUEST;
	public static float RATE_KARMA_EXP_LOST;
	public static float RATE_SIEGE_GUARDS_PRICE;
@@ -350,4 +357,11 @@
			RATE_DROP_MANOR = Integer.parseInt(ratesSettings.getProperty("RateDropManor", "1"));
			RATE_DROP_QUEST = Float.parseFloat(ratesSettings.getProperty("RateDropQuest", "1."));
+			USE_PREMIUMSERVICE = Boolean.parseBoolean(ratesSettings.getProperty("UsePremiumServices", "False"));
+			PREMIUM_RATE_XP = Float.parseFloat(ratesSettings.getProperty("PremiumRateXp", "2"));
+			PREMIUM_RATE_SP = Float.parseFloat(ratesSettings.getProperty("PremiumRateSp", "2"));
+			PREMIUM_RATE_DROP_ADENA = Float.parseFloat(ratesSettings.getProperty("PremiumRateDropAdena", "2"));
+			PREMIUM_RATE_DROP_SPOIL = Float.parseFloat(ratesSettings.getProperty("PremiumRateDropSpoil", "2"));
+			PREMIUM_RATE_DROP_ITEMS = Float.parseFloat(ratesSettings.getProperty("PremiumRateDropItems", "2"));
+			PREMIUM_RATE_DROP_QUEST = Float.parseFloat(ratesSettings.getProperty("PremiumRateDropQuest", "2"));
			RATE_KARMA_EXP_LOST = Float.parseFloat(ratesSettings.getProperty("RateKarmaExpLost", "1."));
			RATE_SIEGE_GUARDS_PRICE = Float.parseFloat(ratesSettings.getProperty("RateSiegeGuardsPrice", "1."));
@@ -2931,4 +2945,16 @@
		else if (pName.equalsIgnoreCase("RateDropQuest"))
			RATE_DROP_QUEST = Float.parseFloat(pValue);
+		else if (pName.equalsIgnoreCase("PremiumRateXp"))
+			PREMIUM_RATE_XP = Float.parseFloat(pValue);
+		else if (pName.equalsIgnoreCase("PremiumRateSp"))
+			PREMIUM_RATE_SP = Float.parseFloat(pValue);
+		else if (pName.equalsIgnoreCase("PremiumRateDropAdena"))
+			PREMIUM_RATE_DROP_ADENA = Float.parseFloat(pValue);
+		else if (pName.equalsIgnoreCase("PremiumRateDropSpoil"))
+			PREMIUM_RATE_DROP_SPOIL = Float.parseFloat(pValue);
+		else if (pName.equalsIgnoreCase("PremiumRateDropItems"))
+			PREMIUM_RATE_DROP_ITEMS = Float.parseFloat(pValue);
+		else if (pName.equalsIgnoreCase("PremiumRateDropQuest"))
+			PREMIUM_RATE_DROP_QUEST = Float.parseFloat(pValue);
		else if (pName.equalsIgnoreCase("RateKarmaExpLost"))
			RATE_KARMA_EXP_LOST = Float.parseFloat(pValue);

 

can someone make it for l2jteon?

Link to comment
Share on other sites

  • 0

i can't apply this patch because i can't use eclipse!

you want a java code without using eclipse?

maybe your pack is pre-configured too?

 

OH GAWD, 3 pages of spam for nothing.

Link to comment
Share on other sites

  • 0

when you see "+" it mean that you must add

when you see "-" it mean that you must delete :D

the lamest guide .... :D:D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...