Jump to content
  • 0

[Question] About server Donator


Question

Posted

Well i have my own server and i wanted to know, how can I add Donator status to players?

Didn`t find any guide in this forum or in google search, can somebosy please help me?

3 answers to this question

Recommended Posts

  • 0
Posted

try to see in gameserver/data/config/  and there must be a file Custom.properties or CustomMOD.properties

 

and search there if u have donator mod ... if it is  go in game select a player and do //vip

 

 

 

if don't have use this code by Inteprid

 

Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/model/actor/instance/L2PcInstance.java (revision 8)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/model/actor/instance/L2PcInstance.java (revision 18)
@@ -216,6 +216,6 @@
     private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC";
     private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,donator=? WHERE obj_id=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,donator FROM characters WHERE obj_id=?";
     private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
     private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
@@ -448,4 +448,5 @@
     private boolean _noble = false;
     private boolean _hero = false;
+    private boolean _isDonator = false;
     /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
     private L2FolkInstance _lastFolkNpc = null;
@@ -5509,4 +5510,5 @@
                 player.setNewbie(rset.getInt("newbie") == 1);
                 player.setNoble(rset.getInt("nobless") == 1);
+                player.setDonator((rset.getInt("donator")==1)? true : false);
                 player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
                 if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -5953,5 +5955,6 @@
             statement.setString(55, getName());
             statement.setLong(56, getDeathPenaltyBuffLevel());
-            statement.setInt(57, getObjectId());
+            statement.setInt(57, isDonator() ? 1 : 0);
+            statement.setInt(58, getObjectId());
             statement.execute();
             statement.close();
@@ -10236,3 +10239,13 @@
         return _floodProtectors;
     }
+    
+    public boolean isDonator()
+    {
+          return _isDonator;
+    }
+          
+    public void setDonator(boolean value)
+    {
+        _isDonator = value;
+    }
}
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/DonatorCommandHandler.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/DonatorCommandHandler.java (revision 18)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/DonatorCommandHandler.java (revision 18)
@@ -0,0 +1,75 @@
+/*
+ * 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.ins.gameserver.handler;
+
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javolution.util.FastMap;
+import net.ins.Config;
+
+public class DonatorCommandHandler
+{
+    private static Logger _log = Logger.getLogger(ItemHandler.class.getName());
+    private static DonatorCommandHandler _instance;
+    private Map<String, IDonatorCommandHandler> _datatable;
+
+    public static DonatorCommandHandler getInstance()
+    {
+        if (_instance == null)
+            _instance = new DonatorCommandHandler();
+        return _instance;
+    }
+
+    private DonatorCommandHandler()
+    {
+        _datatable = new FastMap<String, IDonatorCommandHandler>();
+
+        _log.config("DonatorCommandHandler: Loaded " + _datatable.size() + " handlers.");
+    }
+
+    public void registerDonatorCommandHandler(IDonatorCommandHandler handler)
+    {
+        String[] ids = handler.getDonatorCommandList();
+        for (int i = 0; i < ids.length; i++)
+        {
+            if (Config.DEBUG)
+                _log.fine("Adding handler for command " + ids[i]);
+            _datatable.put(ids[i], handler);
+        }
+    }
+
+    public IDonatorCommandHandler getDonatorCommandHandler(String DonatorCommand)
+    {
+        String command = DonatorCommand;
+        if (DonatorCommand.indexOf(" ") != -1)
+            command = DonatorCommand.substring(0, DonatorCommand.indexOf(" "));
+        if (Config.DEBUG)
+            _log.fine("getting handler for command: " + command + " -> " + (_datatable.get(command) != null));
+        return _datatable.get(command);
+    }
+
+    /**
+     * @return
+     */
+    public int size()
+    {
+        return _datatable.size();
+    }
+}
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/IDonatorCommandHandler.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/IDonatorCommandHandler.java (revision 18)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/IDonatorCommandHandler.java (revision 18)
@@ -0,0 +1,45 @@
+/*
+ * 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.ins.gameserver.handler;
+
+import net.ins.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class ...
+ * 
+ * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:09 $
+ */
+public interface IDonatorCommandHandler
+{
+    /**
+     * this is the worker method that is called when someone uses an admin command.
+     * 
+     * @param activeChar
+     * @param command
+     * @return command success
+     */
+    public boolean useDonatorCommand(String command, L2PcInstance activeChar, String target);
+
+    /**
+     * this method is called at initialization to register all the item ids automatically
+     * 
+     * @return all known itemIds
+     */
+    public String[] getDonatorCommandList();
+}
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/chathandlers/ChatAll.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/chathandlers/ChatAll.java (revision 2)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/chathandlers/ChatAll.java (revision 18)
@@ -19,5 +19,7 @@

import net.ins.Config;
+import net.ins.gameserver.handler.DonatorCommandHandler;
import net.ins.gameserver.handler.IChatHandler;
+import net.ins.gameserver.handler.IDonatorCommandHandler;
import net.ins.gameserver.handler.IVoicedCommandHandler;
import net.ins.gameserver.handler.VoicedCommandHandler;
@@ -44,4 +46,5 @@
     {
         boolean vcd_used = false;
+        boolean dcd_used = false;
         if (text.startsWith("."))
         {
@@ -79,5 +82,43 @@
             }
         }
-        if (!vcd_used)
+        else if (text.startsWith("-"))
+        {
+            StringTokenizer st = new StringTokenizer(text);
+            IDonatorCommandHandler dch;
+            String command = "";
+            if (activeChar.isDonator())
+            {
+                if (st.countTokens() > 1)
+                {
+                    command = st.nextToken().substring(1);
+                    target = text.substring(command.length() + 2);
+                    dch = DonatorCommandHandler.getInstance().getDonatorCommandHandler(command);
+                }
+                else
+                {
+                    command = text.substring(1);
+                    if (Config.DEBUG)
+                        _log.info("Command: " + command);
+                    dch = DonatorCommandHandler.getInstance().getDonatorCommandHandler(command);
+                }
+                if (!activeChar.getFloodProtectors().getVoicedCommands().tryPerformAction("voiced command ." + command))
+                {
+                    activeChar.sendMessage("Do not spam voiced commands.");
+                    return;
+                }
+                if (dch != null)
+                {
+                    dch.useDonatorCommand(command, activeChar, target);
+                    dcd_used = true;
+                }
+                else
+                {
+                    if (Config.DEBUG)
+                        _log.warning("No handler registered for bypass '" + command + "'");
+                    dcd_used = false;
+                }
+            }
+        }
+        if (!vcd_used || !dcd_used)
         {
             CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/AdminCommandHandler.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/AdminCommandHandler.java (revision 2)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/AdminCommandHandler.java (revision 18)
@@ -33,4 +33,5 @@
import net.ins.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
import net.ins.gameserver.handler.admincommandhandlers.AdminDelete;
+import net.ins.gameserver.handler.admincommandhandlers.AdminDonator;
import net.ins.gameserver.handler.admincommandhandlers.AdminDoorControl;
import net.ins.gameserver.handler.admincommandhandlers.AdminEditChar;
@@ -94,4 +95,5 @@
         _datatable = new FastMap<String, IAdminCommandHandler>();
         registerAdminCommandHandler(new AdminAdmin());
+        registerAdminCommandHandler(new AdminDonator());
         registerAdminCommandHandler(new AdminInvul());
         registerAdminCommandHandler(new AdminDelete());
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/admincommandhandlers/AdminDonator.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/admincommandhandlers/AdminDonator.java (revision 18)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/admincommandhandlers/AdminDonator.java (revision 18)
@@ -0,0 +1,152 @@
+/*
+ * 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.ins.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.ins.L2DatabaseFactory;
+import net.ins.gameserver.Announcements;
+import net.ins.gameserver.datatables.GmListTable;
+import net.ins.gameserver.handler.IAdminCommandHandler;
+import net.ins.gameserver.model.L2Object;
+import net.ins.gameserver.model.actor.instance.L2PcInstance;
+import net.ins.gameserver.network.SystemMessageId;
+import net.ins.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ *
+ * Author Rayan
+ *
+ */
+public class AdminDonator implements IAdminCommandHandler
+{
+    private static String[] _adminCommands =
+    {
+        "admin_setdonator",};
+    private final static Logger _log = Logger.getLogger(AdminDonator.class.getName());
+
+    public boolean useAdminCommand(String command, L2PcInstance activeChar)
+    {
+        if (command.startsWith("admin_setdonator"))
+        {
+            L2Object target = activeChar.getTarget();
+            L2PcInstance player = null;
+            SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
+            if (target instanceof L2PcInstance)
+                player = (L2PcInstance)target;
+            else
+                player = activeChar;
+            
+            if (player.isDonator())
+            {
+                player.setDonator(false);
+                sm.addString("You are no longer a server donator.");
+                GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed donator stat of player"+ target.getName());
+                Connection connection = null;
+                try
+                {
+                    connection = L2DatabaseFactory.getInstance().getConnection();
+
+                    PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
+                    statement.setString(1,target.getName());
+                    ResultSet rset = statement.executeQuery();
+                    int objId = 0;
+                    if (rset.next())
+                        objId = rset.getInt(1);
+                    rset.close();
+                    statement.close();
+
+                    if (objId == 0) 
+                    {
+                        connection.close(); 
+                        return false;
+                    }
+
+                    statement = connection.prepareStatement("UPDATE characters SET donator=0 WHERE obj_id=?");
+                    statement.setInt(1, objId);
+                    statement.execute();
+                    statement.close();
+                    connection.close();
+                }
+                catch (Exception e)
+                {
+                    _log.log(Level.WARNING,"could not set donator stats of char:", e);
+                }
+                finally
+                {
+                    L2DatabaseFactory.close(connection);
+                }
+            }
+            else
+            {
+                player.setDonator(true);
+                sm.addString("You are now a server donator, congratulations!");
+                GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" has given donator stat for player "+target.getName()+".");
+                Connection connection = null;
+                try
+                {
+                    connection = L2DatabaseFactory.getInstance().getConnection();
+
+                    PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
+                    statement.setString(1,target.getName());
+                    ResultSet rset = statement.executeQuery();
+                    int objId = 0;
+                    if (rset.next())
+                        objId = rset.getInt(1);
+                    rset.close();
+                    statement.close();
+
+                    if (objId == 0) 
+                    {
+                        connection.close(); 
+                        return false;
+                    }
+
+                    statement = connection.prepareStatement("UPDATE characters SET donator=1 WHERE obj_id=?");
+                    statement.setInt(1, objId);
+                    statement.execute();
+                    statement.close();
+                    connection.close();
+                }
+                catch (Exception e)
+                {
+                    _log.log(Level.WARNING,"could not set donator stats of char:", e);
+                }
+                finally
+                {
+                    L2DatabaseFactory.close(connection);
+                }
+
+            }
+            player.sendPacket(sm);
+            player.broadcastUserInfo();
+            if(player.isDonator() == true)
+                Announcements.getInstance().announceToAll(player.getName() + " Has Become a Server Donator!");
+        }
+        return false;
+    }
+   public String[] getAdminCommandList()
+   {
+        return _adminCommands;
+   }
+}

 

 

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • ⚡ 5TB Storage + Gemini Advanced 12-18M upgrade active! Keeps your personal files 100% private with instant automated setup.     FINAL CALL: Google is Shutting This Down After October 2026! Google will NEVER bring back this window of opportunity again. Once this month ends, this massive backdoor upgrade is gone permanently!  BUY 2, GET 1 FREE IS STILL LIVE! Stock up now for yourself, your family, your business, and your friends! Think about it: Every single person you know uses a Gmail account, and everyone is running out of storage. Don't let your loved ones get trapped paying $20–$30 every single month when you can set them up with 5TB Cloud Storage + Gemini Advanced (12–18 Months) right now for only $15! Why Buy Bulk Activations Today? Instant Gift Value: Perfect lifetime-style gift for clients, family, or team members. 100% Private & Safe: Activates on personal Gmails—zero passwords or logins required. Global Access: Works worldwide with zero VPN hassles. Instant Automated Delivery: Receive your activation links in seconds 24/7! ‍ Time is running out fast—secure your extra free licenses before the October deadline hits! Order Your Bundle Now on the Website
    • Since technical talk offends people, I believe I should return back to writting my Lineage 2 lore stories. Here's the next one:   Once upon a time, there was a boy and a small adorable wolf.    The boy really loved the wolf but as the wolf grow older and bigger, it became agressive and would bite the boy. One day the boy and the wolf decided to go to the city to buy potions. The road was long and hilly so the boy moved all his adena to the wolf bags to help his legs and reach the city easier.   When they reached the city, the boy tried to take the adena out of the wolf's bags. But the wolf would not ! He bit the boy and said "You will not get this adena back, this is my adena". The boy got angry. He decided to go to the pet master and ask for help.    "Pet master, pet master ! My wolf is big, bad and angry and it won't obey me. I want my adena back and it bites me. "   The pet master looked at the big angry wolf, then looked at the boy and said. "I have a solution for your problem young one. I have magic. Dark magic. I can turn your big bad elder wolf into a younger puppy for free, all you have to do is spell the magic chants. Nothing more, no wolf modifying wands, just your say".   The boy thought about it for a bit, and decided that he indeed wanted to turn things back. But when he was about to spell the magic words, guards arrived at the pet master.    The city guard captain said "Is this the big bad angry wolf that bites people and doesn't give back his adena ? We will kill this wolf !"    For a moment the boy hesitated but he said "This wolf is big bad and angry, but I love this wolf and I dont want it to die ! Please don't kill the big bad angry wolf." But the boy was not fast enough. The guards jumped the wolf and started slashing on him with their swords. The boy didn't know what to do, so in it its final moments right as the wolf was about to die, it spelled the magic words. "Pet master, make my wolf young and adorable again !"   But he was not fast enough. The wolf got slashed and killed by the guards just one moment before the boy could finish his last word.    But as the words came out of his mouth, with the wolf's dead body on the floor, a younger wolf manifested out of thin air. The magic was real. The guards got scared and run away. Now the boy was left with a dead old bad angry wolf and next to him an alive younger version.    The boys joy was even bigger when it opened the new wolfs bags and his adena was finally there. He took the adena and went back to buy potions in the city.   Twenty four hours later, the boy couldn't believe how his fortune would change ...   (No AI was used to write this story)
    • This is like 2017 MaxCheaters. i love it.
    • NEW SEASON GRAND OPENING FROM - 30 OCTOBER 2026, FRIDAY, 20:00 +2 GMT !
    • My bug report was a proper submission. I shouldn't have shown the exploit, I will accept that. Let's end it here. 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..