Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5550)
- +++ 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=?,pvpPoints=?,rank=? 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,pvpPoints,rank 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 (?,?,?,?,?,?,?,?)";
- @@ -413,6 +413,10 @@
- /** The PK counter of the L2PcInstance (= Number of non PvP Flagged player killed) */
- private int _pkKills;
- + private int _pvpPoints;
- +
- + private int _rank;
- +
- /** The PvP Flag state of the L2PcInstance (0=White, 1=Purple) */
- private byte _pvpFlag;
- @@ -4343,7 +4347,67 @@
- DuelManager.getInstance().broadcastToOppositTeam(this, update);
- }
- }
- -
- + public void updateRank()
- + {
- + if (Config.PVP_RANK_SYSTEM_ENABLED)
- + {
- + //Check if the character has GM access
- + if (isGM())
- + return;
- + {
- + if ((getPvpPoints() >= (Config.PVP_LVL1)) && (getPvpPoints() <= (Config.PVP_LVL2)))
- + {
- + setRank(1);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK1);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL2)) && (getPvpPoints() <= (Config.PVP_LVL3)))
- + {
- + setRank(2);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK2);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL3)) && (getPvpPoints() <= (Config.PVP_LVL4)))
- + {
- + setRank(3);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK3);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL4)) && (getPvpPoints() <= (Config.PVP_LVL5)))
- + {
- + setRank(4);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK4);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL5)) && (getPvpPoints() <= (Config.PVP_LVL6)))
- + {
- + setRank(5);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK5);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL6)) && (getPvpPoints() <= (Config.PVP_LVL7)))
- + {
- + setRank(6);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK6);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL7)) && (getPvpPoints() <= (Config.PVP_LVL8)))
- + {
- + setRank(7);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK7);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL8)) && (getPvpPoints() <= (Config.PVP_LVL9)))
- + {
- + setRank(8);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK8);
- + }
- + else if ((getPvpPoints() >= (Config.PVP_LVL9)) && (getPvpPoints() <= (Config.PVP_LVL10)))
- + {
- + setRank(9);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK9);
- + }
- + else if (getPvpPoints() >= (Config.PVP_LVL10))
- + {
- + setRank(10);
- + getAppearance().setNameColor(Config.NAME_COLOR_FOR_RANK10);
- + }
- + }
- + }
- + }
- /**
- * Send a Server->Client packet UserInfo to this L2PcInstance and CharInfo to all L2PcInstance in its _KnownPlayers.<BR><BR>
- *
- @@ -5337,6 +5401,54 @@
- if (killer != null)
- {
- + if (killer instanceof L2PcInstance && getPvpFlag() > 0)
- + {
- + L2Party party = killer.getParty();
- + L2PcInstance kill = (L2PcInstance) killer;
- + int pointsToAdd;
- + if (party == null)
- + {
- + pointsToAdd = (int) (_fame*0.05);
- + }
- + else
- + {
- + pointsToAdd = (int) (_fame*0.05/party.getMemberCount());
- + }
- + int pointsToRemove = _fame - pointsToAdd < 0 ? 0 : _fame - pointsToAdd;
- + kill.setFame(kill.getFame() + pointsToAdd);
- + kill.setSp(kill.getSp() + pointsToAdd);
- + kill.setPvpPoints(kill.getPvpPoints() + pointsToAdd);
- + setFame(pointsToRemove);
- + killer.sendMessage("You have earned " + pointsToAdd + " Fame Points from " + getName() + "");
- + killer.broadcastPacket(new MagicSkillUse(killer, 23021, 1, 0, 0));
- + broadcastUserInfo();
- + {
- + if(killer instanceof L2PcInstance && getPvpFlag() > 0)
- + {
- + if (party != null)
- + {
- + for(L2PcInstance PartyMember : party.getPartyMembers())
- + {
- + if(PartyMember.isInsideRadius(this, 1600, true, false) && PartyMember != killer)
- + {
- + int numberToAdd = (int) (_fame*0.05/party.getMemberCount());
- + PartyMember.setFame(PartyMember.getFame() + numberToAdd);
- + PartyMember.setSp(PartyMember.getSp() + numberToAdd);
- + PartyMember.setPvpPoints(kill.getPvpPoints() + numberToAdd);
- + int pointsToRemove1 = _fame - numberToAdd < 0 ? 0 : _fame - numberToAdd;
- + setFame(pointsToRemove1);
- + PartyMember.setPvpKills(PartyMember.getPvpKills() + 1);
- + PartyMember.sendMessage("You have earned " + numberToAdd + " Fame Points from " + getName() + "");
- + PartyMember.broadcastPacket(new MagicSkillUse(PartyMember, 23021, 1, 0, 0));
- + broadcastUserInfo();
- + }
- + }
- + }
- + }
- + }
- + }
- +
- + broadcastUserInfo();
- L2PcInstance pk = killer.getActingPlayer();
- TvTEvent.onKill(killer, this);
- @@ -5683,7 +5795,8 @@
- {
- // Add karma to attacker and increase its PK counter
- setPvpKills(getPvpKills() + 1);
- -
- + updateRank();
- + broadcastUserInfo();
- // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- sendPacket(new ExBrExtraUserInfo(this));
- @@ -7027,6 +7140,8 @@
- statement.setLong(36, 0);
- statement.setLong(37,getCreateTime());
- +
- +
- statement.executeUpdate();
- statement.close();
- }
- @@ -7224,6 +7339,10 @@
- // Language
- player.setLang(rset.getString("language"));
- + player.setPvpPoints(rset.getInt("pvpPoints"));
- +
- + player.setRank(rset.getInt("rank"));
- +
- // Retrieve the name and ID of the other characters assigned to this account.
- PreparedStatement stmt = con.prepareStatement("SELECT charId, char_name FROM characters WHERE account_name=? AND charId<>?");
- stmt.setString(1, player._accountName);
- @@ -7289,6 +7408,8 @@
- if (Config.STORE_UI_SETTINGS)
- player.restoreUISettings();
- +
- + player.updateRank();
- }
- catch (Exception e)
- {
- @@ -7665,7 +7786,9 @@
- statement.setInt(50, getBookMarkSlot());
- statement.setInt(51, getVitalityPoints());
- statement.setString(52, getLang());
- - statement.setInt(53, getObjectId());
- + statement.setInt(53, getPvpPoints());
- + statement.setInt(54, getRank());
- + statement.setInt(55, getObjectId());
- statement.execute();
- statement.close();
- @@ -14475,7 +14598,25 @@
- L2DatabaseFactory.close(con);
- }
- }
- + public void setPvpPoints(int points)
- + {
- + _pvpPoints = points;
- + }
- + public int getPvpPoints()
- + {
- + return _pvpPoints;
- + }
- + public void setRank(int rank)
- + {
- + _rank = rank;
- + }
- +
- + public int getRank()
- + {
- + return _rank;
- + }
- +
- public double getCollisionRadius()
- {
- if (getAppearance().getSex())
- Index: java/com/l2jserver/gameserver/network/clientpackets/Action.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/clientpackets/Action.java (revision 5550)
- +++ java/com/l2jserver/gameserver/network/clientpackets/Action.java (working copy)
- @@ -122,7 +122,7 @@
- obj.onAction(activeChar);
- break;
- case 1:
- - if (!activeChar.isGM() && !((obj instanceof L2Npc) && Config.ALT_GAME_VIEWNPC))
- + if (!activeChar.isGM() && !(obj instanceof L2PcInstance)&& !((obj instanceof L2Npc) && Config.ALT_GAME_VIEWNPC))
- obj.onAction(activeChar, false);
- else
- obj.onActionShift(activeChar);
- Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 5550)
- +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -328,6 +328,8 @@
- }
- activeChar.sendPacket(new QuestList());
- + if (activeChar.getPvpPoints()>=(Config.PVP_LVL1) && (Config.PVP_RANK_SYSTEM_ENABLED)) activeChar.updateRank();
- +
- if (Config.PLAYER_SPAWN_PROTECTION > 0)
- activeChar.setProtection(true);
- Index: java/com/l2jserver/Config.java
- ===================================================================
- --- java/com/l2jserver/Config.java (revision 5550)
- +++ java/com/l2jserver/Config.java (working copy)
- @@ -725,7 +725,27 @@
- public static int L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
- public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
- public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
- -
- + public static boolean PVP_RANK_SYSTEM_ENABLED;
- + public static int PVP_LVL1;
- + public static int PVP_LVL2;
- + public static int PVP_LVL3;
- + public static int PVP_LVL4;
- + public static int PVP_LVL5;
- + public static int PVP_LVL6;
- + public static int PVP_LVL7;
- + public static int PVP_LVL8;
- + public static int PVP_LVL9;
- + public static int PVP_LVL10;
- + public static int NAME_COLOR_FOR_RANK1;
- + public static int NAME_COLOR_FOR_RANK2;
- + public static int NAME_COLOR_FOR_RANK3;
- + public static int NAME_COLOR_FOR_RANK4;
- + public static int NAME_COLOR_FOR_RANK5;
- + public static int NAME_COLOR_FOR_RANK6;
- + public static int NAME_COLOR_FOR_RANK7;
- + public static int NAME_COLOR_FOR_RANK8;
- + public static int NAME_COLOR_FOR_RANK9;
- + public static int NAME_COLOR_FOR_RANK10;
- //--------------------------------------------------
- // NPC Settings
- //--------------------------------------------------
- @@ -2421,7 +2441,27 @@
- }
- }
- }
- -
- + PVP_RANK_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("EnableRankSystem", "true"));
- + PVP_LVL1 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl1", "25000"));
- + PVP_LVL2 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl2", "50000"));
- + PVP_LVL3 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl3", "75000"));
- + PVP_LVL4 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl4", "100000"));
- + PVP_LVL5 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl5", "150000"));
- + PVP_LVL6 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl6", "200000"));
- + PVP_LVL7 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl7", "300000"));
- + PVP_LVL8 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl8", "400000"));
- + PVP_LVL9 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl9", "500000"));
- + PVP_LVL10 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl10", "700000"));
- + NAME_COLOR_FOR_RANK1 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank1", "00FF00"));
- + NAME_COLOR_FOR_RANK2 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank2", "00FF00"));
- + NAME_COLOR_FOR_RANK3 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank3", "00FF00"));
- + NAME_COLOR_FOR_RANK4 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank4", "00FF00"));
- + NAME_COLOR_FOR_RANK5 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank5", "00FF00"));
- + NAME_COLOR_FOR_RANK6 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank6", "00FF00"));
- + NAME_COLOR_FOR_RANK7 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank7", "00FF00"));
- + NAME_COLOR_FOR_RANK8 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank8", "00FF00"));
- + NAME_COLOR_FOR_RANK9 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank9", "00FF00"));
- + NAME_COLOR_FOR_RANK10 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForRank10", "00FF00"));
- BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
- BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
- BANKING_SYSTEM_ADENA = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement