04-21-2010, 01:16 AM
Gracia Epilogue L2j
ЗЫ... просьба,закрепить...100% работает
Index: /trunk/datapack_development/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
===================================================================
--- /trunk/datapack_development/data/scripts/handlers/admincommandhandlers/AdminEditChar.java (revision 686)
+++ /trunk/datapack_development/data/scripts/handlers/admincommandhandlers/AdminEditChar.java (revision 853)
@@ -477,6 +477,13 @@
{
return false;
}
+ Connection con = null;
+ PreparedStatement statement;
+ con = L2DatabaseFactory.getInstance().getConnection();
+ statement = con.prepareStatement("UPDATE characters SET nick_color = ? WHERE charId = ?");
+ statement.setString(1, val);
+ statement.setInt(2, player.getObjectId());
+ statement.execute();
player.getAppearance().setNameColor(Integer.decode("0x" + val));
player.sendMessage("Your name color has been changed by a GM");
player.broadcastUserInfo();
Index: /trunk/datapack_development/sql/characters.sql
===================================================================
--- /trunk/datapack_development/sql/characters.sql (revision 859)
+++ /trunk/datapack_development/sql/characters.sql (revision 860)
@@ -60,6 +60,7 @@
`bookmarkslot` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`vitality_points` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`createTime` DECIMAL(20,0) NOT NULL default 0,
+ `nick_color` char(6) DEFAULT 'FFFFFF',
`language` VARCHAR(2) DEFAULT NULL,
PRIMARY KEY (`charId`),
KEY `clanid` (`clanid`)
Index: /trunk/L2_GameServer/java/ru/l2open/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/L2_GameServer/java/ru/l2open/gameserver/model/actor/instance/L2PcInstance.java (revision 686)
+++ /trunk/L2_GameServer/java/ru/l2open/gameserver/model/actor/instance/L2PcInstance.java (revision 858)
@@ -271,9 +271,9 @@
private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE charId=? AND class_index=?";
// Character Character SQL String Definitions:
- private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date,createTime) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date,createTime,nick_color) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,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=?,bookmarkslot=?,vitality_points=?,language=? WHERE charId=?";
- private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, 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,bookmarkslot,vitality_points,createTime,language FROM characters WHERE charId=?";
+ private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, 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,bookmarkslot,vitality_points,createTime,nick_color,language FROM characters WHERE charId=?";
// Character Teleport Bookmark:
private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
@@ -419,6 +419,9 @@
/** The PvP Flag state of the L2PcInstance (0=White, 1=Purple) */
private byte _pvpFlag;
+ /** The NickName Character Color */
+ private String _nickColor = new String("FFFFFF");
+
/** The Fame of this L2PcInstance */
private int _fame;
private ScheduledFuture<?> _fameTask;
@@ -7134,6 +7137,7 @@
statement.setLong(36, 0);
statement.setLong(37,System.currentTimeMillis());
statement.setLong(38,getCreateTime());
+ statement.setString(39, _nickColor);
statement.executeUpdate();
statement.close();
@@ -7209,6 +7213,7 @@
player.setOnlineTime(rset.getLong("onlinetime"));
player.setNewbie(rset.getInt("newbie"));
player.setNoble(rset.getInt("nobless")==1);
+ player.setNickNameColor(rset.getString("nick_color"));
player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -7392,7 +7397,17 @@
return player;
}
-
+
+ /**
+ * @param string
+ */
+ private void setNickNameColor(String color)
+ {
+ int decode = 0;
+ decode = Integer.decode("0x"+color);
+ getAppearance().setNameColor(decode);
+ }
+
/**
* @return
*/
ЗЫ... просьба,закрепить...100% работает