Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Server
- Index: java/com/l2jserver/gameserver/model/olympiad/Olympiad.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/olympiad/Olympiad.java (revision 4526)
- +++ java/com/l2jserver/gameserver/model/olympiad/Olympiad.java (working copy)
- @@ -44,6 +44,7 @@
- import com.l2jserver.gameserver.ThreadPoolManager;
- import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
- import com.l2jserver.gameserver.instancemanager.ZoneManager;
- +import com.l2jserver.gameserver.model.L2World;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.entity.Hero;
- import com.l2jserver.gameserver.network.SystemMessageId;
- @@ -477,6 +478,12 @@
- _scheduledCompStart = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
- public void run()
- {
- + //running change legend
- + for (L2PcInstance atkChar: L2World.getInstance().getAllPlayers().values()){
- + atkChar.pvpPeriodToBase(atkChar.getName());
- + }
- + L2PcInstance.changeLegend();
- +
- if (isOlympiadEnd())
- return;
- Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4526)
- +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -287,8 +287,8 @@
- // 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,createTime) 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=?,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=?,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, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, 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 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=?,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=?,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=?,legend=?,pvp_period=? 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, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createTime,language,legend,pvp_period 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 (?,?,?,?,?,?,?,?)";
- @@ -452,6 +452,16 @@
- private boolean _isIn7sDungeon = false;
- + //Legend System
- + private int _legend;
- +
- + private int _pvpPeriod;
- +
- + public static String legendName;
- +
- + public static int mostPvpPeriod;
- +
- +
- private int _bookmarkslot = 0; // The Teleport Bookmark Slot
- private List<TeleportBookmark> tpbookmark = new FastList<TeleportBookmark>();
- @@ -982,7 +992,109 @@
- return (getSkill() != null) ? getSkill().getId() : -1;
- }
- }
- + public void pvpPeriodToBase(String x){
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("UPDATE characters SET pvp_period=? where char_name=?");
- + statement.setInt(1, getPvpPeriod());
- + statement.setString(2, x);
- + statement.execute();
- + statement.close();
- + }
- + catch (Exception e)
- + {
- + }
- + finally
- + {
- + L2DatabaseFactory.close(con);
- + }
- + }
- + public static void changeLegend(){
- + Connection con = null;
- + try
- + {
- +
- + con = L2DatabaseFactory.getInstance().getConnection();
- +
- + //choosing legend and making him legend in game
- + PreparedStatement statement = con.prepareStatement("SELECT char_name,pvp_period FROM characters WHERE accesslevel=0 ORDER BY pvp_period DESC LIMIT 1");
- + ResultSet rset = statement.executeQuery();
- +
- + if(rset.next())
- + {
- + legendName = rset.getString("char_name");
- + mostPvpPeriod = rset.getInt("pvp_period");
- + Announcements.getInstance().announceToAll(legendName+" is new server Legend with "+mostPvpPeriod+" kills today" );
- + for (L2PcInstance atkChar: L2World.getInstance().getAllPlayers().values()){
- + if (atkChar.getName().equals(legendName)){
- + atkChar.setLegend(1);
- + atkChar.updateLegend();
- + }
- + }
- + }
- + rset.close();
- + statement.close();
- +
- + //deleting from DB stats from last day
- + statement = con.prepareStatement("UPDATE characters SET legend=0, pvp_period=0");
- + statement.execute();
- + statement.close();
- +
- + //deleting pvp and legends from game also
- + for (L2PcInstance atkChar: L2World.getInstance().getAllPlayers().values()){
- + if(!atkChar.getName().equals(legendName)){
- + atkChar.setLegend(0);
- + atkChar.updateLegend();
- + }
- + atkChar.setPvpPeriod(0);
- + }
- +
- + //Making some1 else a legend
- + statement = con.prepareStatement("UPDATE characters SET legend=? where char_name=?");
- + statement.setInt(1, 1);
- + statement.setString(2, legendName);
- + statement.execute();
- + statement.close();
- + }
- + catch (Exception e)
- + {
- + _log.warning("Could not Change Legend");
- + }
- + finally
- + {
- + L2DatabaseFactory.close(con);
- + }
- + }
- + public void setLegend(int x){
- + _legend = x;
- + }
- + public void updateLegend(){
- + if(getLegend()==1){
- + setTitle("I am Legend");
- + broadcastPacket(new CharInfo(this));
- + broadcastTitleInfo();
- + storeCharBase();
- + }else{
- + setTitle("");
- + broadcastPacket(new CharInfo(this));
- + broadcastTitleInfo();
- + storeCharBase();
- + }
- + }
- + public int getLegend(){
- + return _legend;
- + }
- +
- + public void setPvpPeriod(int x){
- + _pvpPeriod = x;
- + }
- +
- + public int getPvpPeriod(){
- + return _pvpPeriod;
- + }
- //summon friend
- private SummonRequest _summonRequest = new SummonRequest();
- @@ -5682,6 +5794,8 @@
- // Add karma to attacker and increase its PK counter
- setPvpKills(getPvpKills() + 1);
- + setPvpPeriod(getPvpPeriod() + 1);
- +
- // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- sendPacket(new ExBrExtraUserInfo(this));
- @@ -7243,6 +7357,10 @@
- // Set Teleport Bookmark Slot
- player.setBookMarkSlot(rset.getInt("BookmarkSlot"));
- + //Legend
- + player.setLegend(rset.getInt("Legend"));
- + player.setPvpPeriod(rset.getInt("pvp_period"));
- +
- //character creation Time
- player.setCreateTime(rset.getLong("createTime"));
- @@ -7690,7 +7808,9 @@
- statement.setInt(50, getBookMarkSlot());
- statement.setInt(51, getVitalityPoints());
- statement.setString(52, getLang());
- - statement.setInt(53, getObjectId());
- + statement.setInt(53, getLegend());
- + statement.setInt(54, getPvpPeriod());
- + statement.setInt(55, getObjectId());
- statement.execute();
- statement.close();
- Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 4524)
- +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -410,6 +410,9 @@
- // no broadcast needed since the player will already spawn dead to others
- sendPacket(new Die(activeChar));
- }
- +
- + if(activeChar.getLegend()==1)
- + Announcements.getInstance().announceToAll(activeChar.getName()+", server Legend, has logged into game");
- activeChar.onPlayerEnter();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement