Você não é registrado, por favor registre-se para ter acesso ao conteúdo completo.
Caso seja registrado, efetue login.
Esqueceu sua senha? Clique aqui
Recomendamos o uso do Mozilla Firefox para uma melhor visualização.    


Início Postados Hoje Marcar Fóruns Como Lidos Álbums Banidos SE Team Medalhas
Voltar   Secret Experience > Área L2J > [L2J] Dúvidas > [L2J] Dúvidas Solucionadas
Registrar Loteria VIPStaff SERegras do fórum Comunidade Arcade Postados Hoje Pesquisar Experience
   

Secret Experience.NET   Secret Experience Corporation - Welcome To The Real World
     Anúncios SE

Resposta
 
Ferramentas do Tópico Modos de Exibição
Antigo 28-07-2010, 01:59 PM   #1
Amigo SE
 
Avatar de C.Bartowski
 
Registrado em: Feb 2010
Localização: Caxias do Sul - RS
Posts: 644
Agradeceu: 405
Agradecido 582 Vezes em 224 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Rate Designer: Iniciante
Meu Estado:
Enviar mensagem via Windows Live Messenger para C.Bartowski
Nome Real: Henrique Galafassi Dalssaso

Inventório de C.Bartowski

Padrão Codigo do //setdonator

Bom galera tipo assim...

Tem um amigo meu que ta fazendo um projeto e tals... e Ta add o mod e tals mas ta dando o Erro no Mod...

E tipo só to esperando ele add esse mod pra eu fazer a base do Meu Server para colocar on... Blz blz vamos ao erro...

----------------------------------

Tipo ele ta dizendo que Ta faltando Codigo no Mod aqui...

E tipo quando vai criar o Char o Char fica sem HP e Aparece num Lugar que tem Agua...

E tipo o Comando nao Funciona nos GM's ou ADM's

Tipo vou postar aqui o Código aqui pra vocês verem...

-------------------------------

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
Index: Trunk\L2JStep_CORE\config\Custom\L2JMods.properties
===================================================================
--- Trunk\L2JStep_CORE\config\Custom\L2JMods.properties (revision 59)
+++ Trunk\L2JStep_CORE\config\Custom\L2JMods.properties (revision 65)
@@ -30,2 +30,15 @@
+# ---------------------------------
+# Donator Color Name & Title Config
+# ---------------------------------
+# Donator Name Color Enabled?.
+DonatorNameColorEnabled = false
+# Donator Color Name Selection.
+DonatorColorName = 00FF00
+# Donator Title Color Enabled?
+DonatorTitleColorEnabled = false
+# Donator Color Name Selection.
+DonatorTitleColor = 00FFFF
+
Index: Trunk\L2JStep_CORE\java\com\l2jstep\Config.java
===================================================================
--- Trunk\L2JStep_CORE\java\com\l2jstep\Config.java (revision 59)
+++ Trunk\L2JStep_CORE\java\com\l2jstep\Config.java (revision 65)
@@ -30,2 +30,15 @@

+public static boolean DONATOR_NAME_COLOR_ENABLED;
+public static int DONATOR_NAME_COLOR;
+public static boolean DONATOR_TITLE_COLOR_ENABLED;
+public static int DONATOR_TITLE_COLOR;


@@ -30,2 +30,15 @@
+                               /** Donator color name **/
+                               DONATOR_NAME_COLOR_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("Do natorNameColorEnabled", "False"));
+                               DONATOR_NAME_COLOR = Integer.decode("0x" + otherSettings.getProperty("DonatorColorName", "00FF00"));
+                               DONATOR_TITLE_COLOR_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("Do natorTitleColorEnabled", "False"));
+                               DONATOR_TITLE_COLOR = Integer.decode("0x" + otherSettings.getProperty("DonatorTitleColor", "00FF00"));


Index: Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\clientpackets\EnterWorld.java
===================================================================
---  Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\clientpackets\EnterWorld.java (revision 59)
+++  Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\clientpackets\EnterWorld.java (revision 65)
@@ -30,2 +30,15 @@

-		 activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
+        if (Config.DONATOR_NAME_COLOR_ENABLED)
+        {
+        	if (activeChar.isDonator())
+        	{
+        		activeChar.getAppearance().setNameColor(Config.DONATOR_NAME_COLOR);
+        		activeChar.sendMessage("Welcome Back: " + activeChar.getName() + " to our Server!");
+        		activeChar.sendMessage("Aww and btw " + activeChar.getName() + " please take time to vote ;)");
+        		activeChar.sendMessage("Please, Enjoy your Stay !");
+        	}
+        }
+
+		 activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());

Index: Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\clientpackets\L2PlayableInstance.java
===================================================================
--- Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\clientpackets\L2PlayableInstance.java (revision 59)
+++ Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\clientpackets\L2PlayableInstance.java (revision 65)
@@ -30,2 +30,15 @@

 	/** 
 	* @param blessing 
 	*/ 
 	public void stopProtectionBlessing(L2Effect effect) 
 	{ 
 		if (effect == null) stopEffects(L2Effect.EffectType.PROTECTION_BLESSING); 
 		else removeEffect(effect); 
 		setProtectionBlessing(false); 
 		updateAbnormalEffect(); 
 	}      
+
+    	/** donator System **/ 
+    	private boolean	_donator	= false;
+
+   	/**
+    	 * Set the Donator Flag of the L2PlayableInstance.<BR><BR>
+    	 **/
+    	public void setDonator(boolean value)
+    	{
+    		_donator = value;
+    	}
+
+   	/**
+    	 * Return True if the L2PlayableInstance is a Donator.<BR><BR>
+    	 **/
+    	public boolean isDonator()
+    	{
+    		return _donator;
+    	}

Index: Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\model\actor\instance\L2PcInstance.java
===================================================================
--- Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\model\actor\instance\L2PcInstance.java (revision 59)
+++ Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\model\actor\instance\L2PcInstance.java (revision 65)
@@ -30,2 +30,15 @@

-    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=?,in_jail=?,jail_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, in_jail, jail_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=?,in_jail=?,jail_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, in_jail, jail_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=?";

@@ -30,2 +30,15 @@

 				player.setNewbie(rset.getInt("newbie")==1);
 				player.setNoble(rset.getInt("nobless")==1);
+               player.setHero(rset.getInt("hero")==1);
+               player.setDonator(rset.getInt("donator")==1);
+

@@ -30,2 +30,15 @@
 	public void leaveOlympiadObserverMode()
    {
 		setTarget(null);
 		sendPacket(new ExOlympiadMode(0));
        teleToLocation(_obsX, _obsY, _obsZ, true);
        getAppearance().setVisible();
        setIsInvul(false);
        if (getAI() != null)
 		{
            getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
        }
        Olympiad.getInstance().removeSpectator(_olympiadGameId, this);
        _olympiadGameId = -1;
        _observerMode = false;
 		broadcastUserInfo();
    }
+
+	public void updateNameTitleColor()
+	{
+		// Donator Color  and title update
+		// Note: this code can be used for GM's too
+		if (isDonator())
+			getAppearance().setNameColor(Config.DONATOR_NAME_COLOR);
+			getAppearance().setTitleColor(Config.DONATOR_TITLE_COLOR);
+		broadcastUserInfo();
+	}
+
    public void setOlympiadSide(int i)
    {
        _olympiadSide = i;
    }

Index: Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\handler\AdminCommandHandler\AdminDonator.java
===================================================================
--- Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\handler\AdminCommandHandler\AdminDonator.java (revision 59)
+++ Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\handler\AdminCommandHandler\AdminDonator.java (revision 65)
@@ -30,2 +30,15 @@
+/*
+ * 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 com.l2jstep.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.l2jstep.Config;
+import com.l2jstep.L2DatabaseFactory;
+import com.l2jstep.gameserver.GmListTable;
+import com.l2jstep.gameserver.handler.IAdminCommandHandler;
+import com.l2jstep.gameserver.model.L2Object;
+import com.l2jstep.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jstep.gameserver.network.SystemMessageId;
+import com.l2jstep.gameserver.network.serverpackets.SystemMessage;
+/**
+ * @author L2Step
+ */
+public class AdminDonator implements IAdminCommandHandler
+{
+	private static String[] _adminCommands =
+	{
+		"admin_setdonator",};
+	private final static Log _log = LogFactory.getLog(AdminDonator.class.getName());
+	private static final int REQUIRED_LEVEL = Config.GM_MENU;
+
+	public boolean useAdminCommand(String command, L2PcInstance activeChar)
+	{
+		if (!Config.ALT_PRIVILEGES_ADMIN)
+		{
+			if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
+			{
+				return false;
+			}
+		}
+		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);
+				player.updateNameTitleColor();
+				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.warn("could not set donator stats of char:", e);
+				}
+				finally
+				{
+					try { connection.close(); } catch (Exception e) {}
+				}
+			}
+			else
+			{
+				player.setDonator(true);
+				player.updateNameTitleColor();
+				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.warn("could not set donator stats of char:", e);
+				}
+				finally
+				{
+					try { connection.close(); } catch (Exception e) {}
+				}
+
+			}
+			player.sendPacket(sm);
+			player.broadcastUserInfo();
+			if(player.isDonator() == true)
+			{
+			}
+		}
+		return false;
+	}
+   public String[] getAdminCommandList() {
+		return _adminCommands;
+	}
+	private boolean checkLevel(int level)
+	{
+		return (level >= REQUIRED_LEVEL);
+	}
+}

Index: Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\handler\AdminCommandHandler.java
===================================================================
--- Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\handler\AdminCommandHandler.java (revision 59)
+++ Trunk\L2JStep_CORE\java\com\l2jstep\gameserver\handler\AdminCommandHandler.java (revision 65)
@@ -30,2 +30,15 @@

  import com.l2jstep.gameserver.handler.admincommandhandlers.AdminAdmin;
+ import net.sf.l2j.gameserver.handler.admincommandhandlers .AdminHero;
+ import net.sf.l2j.gameserver.handler.admincommandhandlers .AdminNoble;
+ import net.sf.l2j.gameserver.handler.admincommandhandlers .AdminDonator;
  import com.l2jstep.gameserver.handler.admincommandhandlers.AdminAnnouncements;

@@ -30,2 +30,15 @@

 		registerAdminCommandHandler(new AdminAdmin());
 		registerAdminCommandHandler(new AdminHero());
 		registerAdminCommandHandler(new AdminNoble());
+		registerAdminCommandHandler(new AdminDonator());
 		registerAdminCommandHandler(new AdminInvul());


Index: Trunk\L2JStep_CORE\config\command-privileges.propierties
===================================================================
--- Trunk\L2JStep_CORE\config\command-privileges.propierties (revision 59)
+++ Trunk\L2JStep_CORE\config\command-privileges.propierties (revision 65)
@@ -30,2 +30,15 @@

+#################
+### L2JArchid ###
+#################
+admin_sethero = 100
+admin_setnoble = 100
+admin_setdonator = 100


Index: Trunk\L2JStep_DP\sql\characters.sql
===================================================================
--- Trunk\L2JStep_DP\sql\characters.sql (revision 59)
+++ Trunk\L2JStep_DP\sql\characters.sql (revision 65)
@@ -30,2 +30,15 @@
  clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
  death_penalty_level int(2) NOT NULL DEFAULT 0,
+ donator int{1) NOT NULL DEFAULT 0,
  PRIMARY KEY  (obj_Id),
  KEY `clanid` (`clanid`)
 ) ;
@@ -30,2 +30,15 @@
+ALTER TABLE `characters` ADD `donator` decimal(1,0) NOT NULL DEFAULT 0;
+ALTER TABLE `characters` ADD `hero` decimal(1,0) NOT NULL DEFAULT 0;
Tipo não sou eu que to tentando add e tals... mas tipo ele me garante que ta Faltando Código pra add o mod e pra funfa Certinho...

Tipo só ta faltando isso pra eu faze meu server...

Da uma mão ae galera...


Vlw's e Obrigado desde Já..

__________________
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
C.Bartowski está offline   Responder com Citação
O seguinte membro ao lado disse Obrigado(a) a : C.Bartowski por gostar deste Post :
Mazokista (28-07-2010)
Links Patrocinados
Antigo 28-07-2010, 02:09 PM   #2
Guma
Membro - Veterano
 
Avatar de Guma
 
Registrado em: Sep 2009
Localização: Florianopolis (sc)
Posts: 591
Agradeceu: 72
Agradecido 724 Vezes em 241 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Enviar mensagem via Windows Live Messenger para Guma
Nome Real: i'm Guma

Inventório de Guma

Padrão

ta faltando?
nuss ... codigo em lugares errado pela metadade e por ai vai

dis pra ele tenta esse

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
 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;
+   }
+}

Guma está offline   Responder com Citação
Os Seguintes 5 Usuários disseram Obrigado(a) para Guma por gostarem deste post :
Arayashiki (28-07-2010), B1Z4R0 (28-07-2010), C.Bartowski (28-07-2010), Inspector (28-07-2010), Mazokista (28-07-2010)
Antigo 28-07-2010, 02:12 PM   #3
Amigo SE
 
Avatar de C.Bartowski
 
Registrado em: Feb 2010
Localização: Caxias do Sul - RS
Posts: 644
Agradeceu: 405
Agradecido 582 Vezes em 224 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Rate Designer: Iniciante
Meu Estado:
Enviar mensagem via Windows Live Messenger para C.Bartowski
Nome Real: Henrique Galafassi Dalssaso

Inventório de C.Bartowski

Padrão

Tipo guma será que só com esse Codigo que voce tem ae vai funcionar... Tipo seria o Código que ta dando esse erro...

Tipo como não sou eu que estou add o mod nao sei bem como é.. Pois ele pegou o Projeto da L2J2010 como base e como voce tirou o Mod da Rev ele quer add denovo para funcionar o VIP...

Se é esse que voce add Na 2010 vai funcionar....

Vou mandar ele testar.. e Logo posto aqui se deu Certo...

Por Enquanto Valeu Ae

__________________
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
C.Bartowski está offline   Responder com Citação
Antigo 28-07-2010, 04:32 PM   #4
Mazokista
Membro - Veterano
 
Avatar de Mazokista
 
Registrado em: Dec 2009
Posts: 1,335
Agradeceu: 490
Agradecido 803 Vezes em 427 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Sistema
Rate Designer: Iniciante
Meu Estado:
Enviar mensagem via Windows Live Messenger para Mazokista
Nome Real: Roberto

Inventório de Mazokista

Padrão

@Guma

O Projeto Qui estamos Adicionando e Base na L2J-2010 Revison 1173
Seguinte ....
Dei Uma Olhada no Codigo Nao Existe Essa Linha

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
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 @@
Da Uma Olhada Nesse Codigo .... A Unica Coisa Qui Nao Entendo Nao Da erro Algum na Hora da Compilacao so na Hora de
Criar o Char da Erro no Gs e Nao Consegui Criar o Char nem a P....

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
Index: /TrunK/*********_CORE/java/config/*********-Custom.properties
===================================================================
--- /TrunK/*********_CORE/java/config/*********-Custom.properties (revision 59)
+++ /TrunK/*********_CORE/java/config/*********-Custom.properties (revision 65)
@@ -30,2 +30,15 @@
 # Castle Circlets can be equipped only by clan members if they own a castle - default true 
 CastleCircletsRestriction = True
+
+#--------------------------------------------------------------- 
+# Donator Config                                               - 
+#---------------------------------------------------------------  
+# Donator Color Name & Title Config  
+# Donator Name Color Enabled?. 
+DonatorNameColorEnabled = False 
+# Donator Color Name Selection 
+DonatorColorName = 00FFFF 
+# Donator Title Color Enabled? 
+DonatorTitleColorEnabled = False 
+# Donator Color Name Selection 
+DonatorTitleColor = 00FF00
Index: /TrunK/*********_CORE/java/net/sf/l2j/Config.java
===================================================================
--- /TrunK/*********_CORE/java/net/sf/l2j/Config.java (revision 59)
+++ /TrunK/*********_CORE/java/net/sf/l2j/Config.java (revision 65)
@@ -891,4 +891,8 @@
     public static boolean   CASTLE_CROWN; 
     public static boolean   CASTLE_CIRCLETS; 
+    public static boolean   DONATOR_NAME_COLOR_ENABLED; 
+    public static int               DONATOR_NAME_COLOR; 
+    public static boolean   DONATOR_TITLE_COLOR_ENABLED; 
+    public static int               DONATOR_TITLE_COLOR; 
     /** ********* Custom - End */   
     
@@ -1983,5 +1987,10 @@
                is.close(); 
                 
-                CASTLE_SHIELD = Boolean.parseBoolean(*********Custom.getProperty("CastleShieldRestriction", "true"));  
+               DONATOR_NAME_COLOR_ENABLED = Boolean.parseBoolean(*********Custom.getProperty("DonatorNameColorEnabled", "False")); 
+               DONATOR_NAME_COLOR  = Integer.decode("0x" + *********Custom.getProperty("DonatorColorName", "00FFFF")); 
+               DONATOR_TITLE_COLOR_ENABLED = Boolean.parseBoolean(*********Custom.getProperty("DonatorTitleColorEnabled", "False")); 
+               DONATOR_TITLE_COLOR = Integer.decode("0x" + *********Custom.getProperty("DonatorTitleColor", "00FF00")); 
+
+               CASTLE_SHIELD = Boolean.parseBoolean(*********Custom.getProperty("CastleShieldRestriction", "true"));  
                 CLANHALL_SHIELD = Boolean.parseBoolean(*********Custom.getProperty("ClanHallShieldRestriction", "true"));  
                 APELLA_ARMORS = Boolean.parseBoolean(*********Custom.getProperty("ApellaArmorsRestriction", "true"));  
@@ -1989,5 +1998,5 @@
                 CASTLE_CROWN = Boolean.parseBoolean(*********Custom.getProperty("CastleLordsCrownRestriction", "true"));  
                 CASTLE_CIRCLETS = Boolean.parseBoolean(*********Custom.getProperty("CastleCircletsRestriction", "true"));                 
-            } 
+           } 
             catch (Exception e) 
             { 
Index: /TrunK/*********_CORE/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- /TrunK/*********_CORE/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 56)
+++ /TrunK/*********_CORE/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 65)
@@ -153,5 +153,13 @@
             activeChar.setProtection(true);
 
-               activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
+        if (activeChar.isdonator()) 
+                    { 
+                             activeChar.getAppearance().setNameColor(Config.DONATOR_NAME_COLOR); 
+                         activeChar.getAppearance().setTitleColor(Config.DONATOR_TITLE_COLOR); 
+                          activeChar.sendMessage("Welcome "+activeChar.getName()+" to our Server!"); 
+                           activeChar.sendMessage("Enjoy your Stay Mate!"); 
+                     } 
+        
+        activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
 
                if (L2Event.active && L2Event.connectionLossData.containsKey(activeChar.getName()) && L2Event.isOnEvent(activeChar))
Index: /TrunK/*********_CORE/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /TrunK/*********_CORE/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 57)
+++ /TrunK/*********_CORE/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 65)
@@ -216,6 +216,6 @@
        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=?,in_jail=?,jail_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, in_jail, jail_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=?,in_jail=?,jail_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, in_jail, jail_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 (?,?,?,?,?,?)";
@@ -453,5 +453,6 @@
        private boolean _noble = false;
        private boolean _hero = false;
-
+       private boolean _donator = false; 
+       
        /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
        private L2FolkInstance _lastFolkNpc = null;
@@ -5480,5 +5481,5 @@
                                                         "exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime," +
                                                         "cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace," +
-                                                        "base_class,newbie,nobless,power_grade,last_recom_date) " +
+                                                        "base_class,newbie,nobless,power_grade,last_recom_date,donator) " +
                        "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
                        statement.setString(1, _accountName);
@@ -5539,4 +5540,5 @@
                        statement.setLong(56, 0);
                        statement.setLong(57,System.currentTimeMillis());
+            statement.setInt(58, isdonator() ? 1 :0); 
                        statement.executeUpdate();
                        statement.close();
@@ -5612,5 +5614,6 @@
                                player.setNewbie(rset.getInt("newbie")==1);
                                player.setNoble(rset.getInt("nobless")==1);
-
+                               player.setdonator(rset.getInt("donator")==1); 
+                               
                                player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
                                if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -6076,5 +6079,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();
@@ -6207,4 +6211,14 @@
     {
         return _isIn7sDungeon;
+    } 
+     
+    public boolean isdonator() 
+    { 
+        return _donator; 
+    } 
+     
+    public void setdonator(boolean donator) 
+    { 
+        _donator = donator; 
     }
 
Index: /TrunK/*********_CORE/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminDonator.java
===================================================================
--- /TrunK/*********_CORE/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminDonator.java (revision 65)
+++ /TrunK/*********_CORE/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminDonator.java (revision 65)
@@ -0,0 +1,165 @@
+/*
+ * 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.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.GmListTable;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+/**
+ *
+ * Author Rayan
+ *
+ */
+public class AdminDonator implements IAdminCommandHandler
+{
+       private static String[] _adminCommands =
+       {
+               "admin_setdonator",};
+       private final static Log _log = LogFactory.getLog(AdminDonator.class.getName());
+       private static final int REQUIRED_LEVEL = Config.GM_MENU;
+
+       public boolean useAdminCommand(String command, L2PcInstance activeChar)
+       {
+               if (!Config.ALT_PRIVILEGES_ADMIN)
+               {
+                       if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
+                       {
+                               return false;
+                       }
+               }
+               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.warn("could not set donator stats of char:", e);
+                               }
+                               finally
+                               {
+                                       try { connection.close(); } catch (Exception e) {}
+                               }
+                       }
+                       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.warn("could not set donator stats of char:", e);
+                               }
+                               finally
+                               {
+                                       try { connection.close(); } catch (Exception e) {}
+                               }
+
+                       }
+                       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;
+       }
+       private boolean checkLevel(int level)
+       {
+               return (level >= REQUIRED_LEVEL);
+       }
+}
Index: /TrunK/*********_CORE/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- /TrunK/*********_CORE/java/net/sf/l2j/gameserver/GameServer.java (revision 56)
+++ /TrunK/*********_CORE/java/net/sf/l2j/gameserver/GameServer.java (revision 65)
@@ -77,4 +77,5 @@
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDelete;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDonator; 
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDoorControl;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar;
@@ -570,4 +571,5 @@
         _adminCommandHandler.registerAdminCommandHandler(new AdminTvTEvent());
         //_adminCommandHandler.registerAdminCommandHandler(new AdminRadar());
+        _adminCommandHandler.registerAdminCommandHandler(new AdminDonator()); 
         _log.config("AdminCommandHandler: Loaded " + _adminCommandHandler.size() + " handlers.");

Mazokista está offline   Responder com Citação
Antigo 28-07-2010, 05:55 PM   #5
Guma
Membro - Veterano
 
Avatar de Guma
 
Registrado em: Sep 2009
Localização: Florianopolis (sc)
Posts: 591
Agradeceu: 72
Agradecido 724 Vezes em 241 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Enviar mensagem via Windows Live Messenger para Guma
Nome Real: i'm Guma

Inventório de Guma

Padrão

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
Index: H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/model/actor/instance/L2PcInstance.java	(revision 1349)
+++ H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -214,8 +214,8 @@
 	private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)";
 	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=?,in_jail=?,jail_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, in_jail, jail_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=?,in_jail=?,jail_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, in_jail, jail_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 (?,?,?,?,?,?)";
     private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?";
@@ -435,6 +435,7 @@
 	private boolean _newbie;
 	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;
@@ -5696,8 +5697,9 @@
 				player.setPvpKills(rset.getInt("pvpkills"));
 				player.setPkKills(rset.getInt("pkkills"));
 				player.setOnlineTime(rset.getLong("onlinetime"));
-				player.setNewbie(rset.getInt("newbie")==1);
-				player.setNoble(rset.getInt("nobless")==1);
+				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())
@@ -6162,7 +6164,8 @@
 	    statement.setLong(54, getClanCreateExpiryTime());
 	    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();
@@ -8512,7 +8515,30 @@
     	}  
     	sendPacket(sl);  
     }  
+	public boolean isDonator()
+	{
+		return _isDonator;
+	}
 
+    public void setDonator(boolean value)
+	{
+		_isDonator = value;
+	}
+
+	public int getDonator()
+	{
+		@SuppressWarnings("unused")
+		int value = 1;
+		if (_isDonator == true)
+		{
+			return value = 1;
+		}
+		else
+		{
+			return value = 0;
+		}
+	}
+
     /**
      * 1. Add the specified class ID as a subclass (up to the maximum number of <b>three</b>)
      * for this character.<BR>
Index: H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/handler/AdminCommandHandler.java
===================================================================
--- H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/handler/AdminCommandHandler.java	(revision 1347)
+++ H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/handler/AdminCommandHandler.java	(working copy)
@@ -39,6 +39,7 @@
 import com.it.br.gameserver.handler.admincommandhandlers.AdminCreateItem;
 import com.it.br.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
 import com.it.br.gameserver.handler.admincommandhandlers.AdminDelete;
+import com.it.br.gameserver.handler.admincommandhandlers.AdminDonator;
 import com.it.br.gameserver.handler.admincommandhandlers.AdminDoorControl;
 import com.it.br.gameserver.handler.admincommandhandlers.AdminEditChar;
 import com.it.br.gameserver.handler.admincommandhandlers.AdminEditNpc;
@@ -122,6 +123,7 @@
 		registerAdminCommandHandler(new AdminAdmin());
 		registerAdminCommandHandler(new AdminInvul());
 		registerAdminCommandHandler(new AdminDelete());
+		registerAdminCommandHandler(new AdminDonator());
 		registerAdminCommandHandler(new AdminKill());
 		registerAdminCommandHandler(new AdminTarget());
 		registerAdminCommandHandler(new AdminShop());
admindonator.java

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
/*
 * 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 com.it.br.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 com.it.br.L2DatabaseFactory;
import com.it.br.gameserver.Announcements;
import com.it.br.gameserver.GmListTable;
import com.it.br.gameserver.handler.IAdminCommandHandler;
import com.it.br.gameserver.model.L2Object;
import com.it.br.gameserver.model.actor.instance.L2PcInstance;
import com.it.br.gameserver.network.SystemMessageId;
import com.it.br.gameserver.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;
   }
}
SS
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]

have fun.

Guma está offline   Responder com Citação
Os Seguintes 2 Usuários disseram Obrigado(a) para Guma por gostarem deste post :
C.Bartowski (28-07-2010), Mazokista (28-07-2010)
Resposta


Regras para Posts
Você não pode postar novos tópicos
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar seus posts

Código [IMG] Sim
Código HTML Não

Ir para...


Horários baseados na GMT -3. Agora são 12:58 AM.