Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2JHellasC
- Index: java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java (revision 515)
- +++ java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -269,8 +269,8 @@
- private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
- // Character Character
- - 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=?, chat_filter_count=?,hitman_target=?, event_points=? 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, hero, donator, chatban_timer, chatban_reason, chat_filter_count,hitman_target, email, emailcode, hasSubEmail, answer, secCode, emailchangecode, hasSubSec, lastVoteHopzone, lastVoteTopzone, hasVotedHop, hasVotedTop, monthVotes, totalVotes, tries, event_points 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=?, chat_filter_count=?,hitman_target=?, event_points=?, hero_custom=?, hero_custom_end=? 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, hero, donator, chatban_timer, chatban_reason, chat_filter_count,hitman_target, email, emailcode, hasSubEmail, answer, secCode, emailchangecode, hasSubSec, lastVoteHopzone, lastVoteTopzone, hasVotedHop, hasVotedTop, monthVotes, totalVotes, tries, event_points, hero_custom, hero_custom_end 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 INSERT_CHARACTER = "INSERT INTO characters (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,movement_multiplier,attack_speed_multiplier,colRad,colHeight,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) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- @@ -627,6 +627,14 @@
- private boolean _noble = false;
- private boolean _hero = false;
- +
- + // Hero Custom System
- + private boolean _isHeroCustom = false;
- + private long _hero_custom_endTime = 0;
- /** Account Manager */
- private String _email = null;
- @@ -7372,6 +7380,14 @@
- player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));
- player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
- +
- + // Hero Custom
- + player.setHeroCustom(rset.getInt("hero_custom") == 1 ? true : false);
- + player.setHeroCustomEndTime(rset.getLong("hero_custom_end"));
- player.setChatFilterCount(rset.getInt("chat_filter_count"));
- player.setHitmanTarget(rset.getInt("hitman_target"));
- @@ -7752,7 +7768,11 @@
- statement.setInt(57, getChatFilterCount());
- statement.setInt(58, getHitmanTarget());
- statement.setInt(59, getEventPoints());
- - statement.setInt(60, getObjectId());
- + statement.setInt(60, isHeroCustom() ? 1 : 0);
- + statement.setLong(61, getHeroCustomEndTime());
- + statement.setInt(62, getObjectId());
- statement.execute();
- statement.close();
- @@ -12620,6 +12640,79 @@
- }
- }
- + public boolean isHeroCustom()
- + {
- + return _isHeroCustom;
- + }
- +
- + public void setHeroCustom(boolean val)
- + {
- + _isHeroCustom = val;
- + }
- +
- + public long getHeroCustomEndTime()
- + {
- + return _hero_custom_endTime;
- + }
- +
- + public void setHeroCustomEndTime(long val)
- + {
- + _hero_custom_endTime = val;
- + }
- +
- + public void setEndTime(String process, int val)
- + {
- + Calendar calendar = Calendar.getInstance();
- + calendar.add(Calendar.DAY_OF_MONTH, val);
- + long end_day = calendar.getTimeInMillis();
- +
- + if(process.equals("hero_custom"))
- + _hero_custom_endTime = end_day;
- + }
- +
- public int getPowerGrade()
- {
- return _powerGrade;
- Index: java/com/l2jhellas/Config.java
- ===================================================================
- --- java/com/l2jhellas/Config.java (revision 515)
- +++ java/com/l2jhellas/Config.java (working copy)
- @@ -81,12 +82,16 @@
- private static final String EVENT_RAID_CONFIG_FILE = "./config/Events/Raid.ini";
- private static final String EVENT_WEDDING_CONFIG_FILE = "./config/Events/Wedding.ini";
- // Mods Folder
- + private static final String MOD_OTHERS_CONFIG_FILE = "./config/Mods/Others.ini";
- private static final String MOD_CHAMPIONS_CONFIG_FILE = "./config/Mods/Champions.ini";
- private static final String MOD_L2JHellas_CONFIG_FILE = "./config/Mods/L2JHellas.ini";
- private static final String MOD_RANK_CONFIG_FILE = "./config/Mods/Rank PvP System.ini";
- @@ -347,6 +352,31 @@
- public static boolean CHAMPION_ENABLE;
- /**
- + * Others Mods Config File
- + */
- + // Hero Custom System
- + public static boolean ENABLE_HERO_CUSTOM_SYSTEM;
- +
- + /**
- * PvP Config File
- */
- public static boolean REMOVE_BUFFS_ON_DIE;
- @@ -1592,6 +1622,68 @@
- CHAMPION_SPCL_LVL_DIFF = Integer.parseInt(ChampionSettings.getProperty("ChampionSpecialItemLevelDiff", "0"));
- /**
- + * Others Mods
- + */
- + /** Hero Custom System */
- + ENABLE_HERO_CUSTOM_SYSTEM = Boolean.parseBoolean(OthersSettings.getProperty("EnableHeroCustomSystem", "True"));
- + /**
- * PvP
- */
- Properties PvPSettings = new Properties();
- Index: java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java (revision 515)
- +++ java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -12,8 +12,13 @@
- */
- package com.l2jhellas.gameserver.network.clientpackets;
- +import java.util.Calendar;
- +import java.util.Date;
- +
- +import com.l2jhellas.Config;
- import com.l2jhellas.gameserver.TaskPriority;
- import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jhellas.gameserver.network.serverpackets.CreatureSay;
- /**
- * Enter World Packet Handler
- @@ -46,7 +51,72 @@
- return;
- }
- activeChar.checks();
- +
- + // Hero System
- + if(activeChar.isHeroCustom()) {
- + onEnterHeroCustom(activeChar);
- + }
- +
- }
- +
- + private static void onEnterHeroCustom(L2PcInstance activeChar)
- + {
- + long now = Calendar.getInstance().getTimeInMillis();
- + long endDay = activeChar.getHeroCustomEndTime();
- + if(now > endDay)
- + {
- + activeChar.setHero(false);
- + activeChar.setHeroCustomEndTime(0);
- + activeChar.sendPacket(new CreatureSay(0,Say2.HERO_VOICE,"System","Your Hero period ends."));
- + }
- + else
- + {
- + if (activeChar.isHero())
- + {
- + activeChar.sendMessage("You Are Already A Hero!.");
- + }
- + else
- + {
- + Date dt = new Date(endDay);
- + activeChar.setHero(true);
- + activeChar.sendMessage("Your Hero period ends at: " + dt);
- + }
- + activeChar = null;
- + }
- + }
- @Override
- public String getType()
- Index: java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminHeroCustom.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminHeroCustom.java (revision 0)
- +++ java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminHeroCustom.java (working copy)
- @@ -0,0 +1,213 @@
- +/*
- + * 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.l2jhellas.gameserver.handler.admincommandhandlers;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.util.StringTokenizer;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import com.l2jhellas.gameserver.datatables.xml.AdminData;
- +import com.l2jhellas.gameserver.handler.IAdminCommandHandler;
- +import com.l2jhellas.gameserver.model.L2Object;
- +import com.l2jhellas.gameserver.model.L2World;
- +import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jhellas.gameserver.network.clientpackets.Say2;
- +import com.l2jhellas.gameserver.network.serverpackets.CreatureSay;
- +import com.l2jhellas.util.database.L2DatabaseFactory;
- +
- +/**
- + * Give / remove hero_custom status to player
- + * Changes name color and title color if enabled
- + *
- + * Uses:
- + * sethero_custom [<player_name>] [<time_duration in days>]
- + *
- + * If <player_name> is not specified, the current target player is used.
- + *
- + * @author Danilo Nascimento
- + *
- + */
- +public class AdminHeroCustom implements IAdminCommandHandler
- +{
- + private static String[] _adminCommands = { "admin_sethero_custom", "admin_removehero_custom" };
- + private final static Logger _log = Logger.getLogger(AdminHeroCustom.class.getName());
- +
- + @Override
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + if (command.startsWith("admin_sethero_custom"))
- + {
- + StringTokenizer str = new StringTokenizer(command);
- +
- + L2Object target = activeChar.getTarget();
- + L2PcInstance player = null;
- +
- + if (target != null && target instanceof L2PcInstance)
- + player = (L2PcInstance)target;
- + else
- + player = activeChar;
- +
- + try
- + {
- + str.nextToken();
- + String time = str.nextToken();
- + if (str.hasMoreTokens())
- + {
- + String playername = time;
- + time = str.nextToken();
- + player = L2World.getInstance().getPlayer(playername);
- + doHeroCustom(activeChar, player, playername, time);
- + }
- + else
- + {
- + String playername = player.getName();
- + doHeroCustom(activeChar, player, playername, time);
- + }
- + }
- + catch(Exception e)
- + {
- + activeChar.sendMessage("Usage: //sethero_custom <char_name> [time](in days)");
- + }
- +
- + player.broadcastUserInfo();
- +
- + if(player.isHeroCustom())
- + return true;
- + }
- + else if(command.startsWith("admin_removehero_custom"))
- + {
- + StringTokenizer str = new StringTokenizer(command);
- +
- + L2Object target = activeChar.getTarget();
- + L2PcInstance player = null;
- +
- + if (target instanceof L2PcInstance)
- + player = (L2PcInstance)target;
- + else
- + player = activeChar;
- +
- + try
- + {
- + str.nextToken();
- +
- + if (str.hasMoreTokens())
- + {
- + String playername = str.nextToken();
- + player = L2World.getInstance().getPlayer(playername);
- + removeHeroCustom(activeChar, player, playername);
- + }
- + else
- + {
- + String playername = player.getName();
- + removeHeroCustom(activeChar, player, playername);
- + }
- + }
- + catch(Exception e)
- + {
- + activeChar.sendMessage("Usage: //removehero_custom <char_name>");
- + }
- +
- + player.broadcastUserInfo();
- +
- + if(player.isHeroCustom())
- + return false;
- + }
- + return false;
- + }
- +
- + public void doHeroCustom(L2PcInstance activeChar, L2PcInstance _player, String _playername, String _time)
- + {
- + int days = Integer.parseInt(_time);
- +
- + if (_player == null)
- + {
- + activeChar.sendMessage("Character not found.");
- + return;
- + }
- + if (_player.isHeroCustom())
- + {
- + activeChar.sendMessage("Player " + _playername + " is already an Hero.");
- + return;
- + }
- +
- + if(days > 0)
- + {
- + _player.setHeroCustom(true);
- + _player.setHero(true);
- + _player.setEndTime("hero_custom", days);
- + _player.sendPacket(new CreatureSay(0,Say2.HERO_VOICE,"System","Dear player, you are now an Hero, congratulations."));
- +
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("UPDATE characters SET hero_custom=1, hero_custom_end=? WHERE obj_id=?");
- + statement.setLong(1, _player.getHeroCustomEndTime());
- + statement.setInt(2, _player.getObjectId());
- + statement.execute();
- + statement.close();
- +
- + _player.broadcastUserInfo();
- + _player.sendSkillList();
- +
- + AdminData.getInstance().broadcastMessageToGMs("GM "+ activeChar.getName()+ " set an Hero status for player "+ _playername + " for " + _time + " day(s)");
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
- + }
- + }
- + }
- +
- + public void removeHeroCustom(L2PcInstance activeChar, L2PcInstance _player, String _playername)
- + {
- + if (!_player.isHeroCustom())
- + {
- + activeChar.sendMessage("Player " + _playername + " is not an Hero.");
- + return;
- + }
- +
- + _player.setHeroCustom(false);
- + _player.setHero(false);
- + _player.setHeroCustomEndTime(0);
- +
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("UPDATE characters SET hero_custom=0, hero_custom_end=0 WHERE obj_id=?");
- + statement.setInt(1, _player.getObjectId());
- + statement.execute();
- + statement.close();
- +
- + _player.broadcastUserInfo();
- + _player.sendSkillList();
- +
- + AdminData.getInstance().broadcastMessageToGMs("GM "+activeChar.getName()+" removed Hero status of player "+ _playername);
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
- + }
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return _adminCommands;
- + }
- +}
- \ No newline at end of file
- Index: config/Mods/Others.ini
- ===================================================================
- --- config/Mods/Others.ini (revision 0)
- +++ config/Mods/Others.ini (working copy)
- @@ -0,0 +1,53 @@
- +#=============================================================
- +# Hero System
- +#=============================================================
- +EnableHeroCustomSystem = True
- \ No newline at end of file
- Index: java/com/l2jhellas/gameserver/handler/AdminCommandHandler.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/handler/AdminCommandHandler.java (revision 515)
- +++ java/com/l2jhellas/gameserver/handler/AdminCommandHandler.java (working copy)
- @@ -17,6 +17,9 @@
- import java.util.HashMap;
- import java.util.Map;
- +import com.l2jhellas.gameserver.handler.admincommandhandlers.AdminHeroCustom;
- +
- public class AdminCommandHandler implements IHandler<IAdminCommandHandler, String>
- {
- private final Map<String, IAdminCommandHandler> _datatable;
- @@ -24,6 +27,8 @@
- protected AdminCommandHandler()
- {
- _datatable = new HashMap<>();
- + registerHandler(new AdminHeroCustom());
- }
- @Override
Advertisement
Add Comment
Please, Sign In to add comment