|
Membro - Veterano
Registrado em: Dec 2009
Posts: 1,335
Agradecido 803 Vezes em 427 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Rate
Designer:
Meu Estado:
|
Donator System
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 @@
+
+#---------------------------------------------------------------
+# 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: 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());
Index: H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/handler/AdminDonator.java
===================================================================
--- H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/handler/AdminDonator.java (revision 1347)
+++ H:/Eclipse pastas/*********_CORE/java/com/it/br/gameserver/handler/AdminDonator.java (working copy)
@@ -39,6 +39,7 @@
+/*
+ * 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;
+ }
+}
|