Jump to content

Hyo

Members
  • Posts

    124
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Hyo

  1. Certified Skill Not Found??
  2. Someone can tell because after adding a custom skill to my list and restart it disappears ? The skill is this: <skill id="30000" levels="21" name="PvP Damage"> <table name="#magicLvl"> 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 </table> <table name="#bonus"> 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 </table> <set name="magicLvl" val="#magicLvl" /> <set name="target" val="TARGET_SELF" /> <set name="operateType" val="P" /> <for> <mul order="0x30" stat="pvpPhysDmg" val="#bonus" /> <mul order="0x30" stat="pvpPhysSkillsDmg" val="#bonus" /> <mul order="0x30" stat="pvpMagicalDmg" val="#bonus" /> </for> </skill> Im using l2jServer high five EDIT: It was a problem to add the skill in skillgrp.dat , problem solved. Lock or delete the topic :alone:
  3. how i can put the ProtectionTimeReset from minutes to seconds?
  4. check in " l2j shares and files" u can see many of this codes :poker face:
  5. Ready, problem solved... i edit my L2PcInstance.java public void setHero(boolean hero) { if (hero && (_baseClass == _activeClass)) { for (Skill skill : SkillTreesData.getInstance().getHeroSkillTree().values()) { addSkill(skill, false); // Don't persist hero skills into database } } else { for (Skill skill : SkillTreesData.getInstance().getHeroSkillTree().values()) { - - removeSkill(skill, false, true); // Just remove skills from non-hero players + + addSkill(skill, false); // Don't persist hero skills into database } } _hero = hero; sendSkillList(); } and they work. Love you guys :alone:
  6. maybe... edit if (hero && (_baseClass == _activeClass)) for if (hero) or not? :happyforever:
  7. I search on my Hero.java but idk what i need edit or add :okey: import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.logging.Level; import java.util.logging.Logger; import javolution.util.FastList; import javolution.util.FastMap; import com.l2jserver.Config; import com.l2jserver.L2DatabaseFactory; import com.l2jserver.gameserver.cache.HtmCache; import com.l2jserver.gameserver.datatables.CharNameTable; import com.l2jserver.gameserver.datatables.ClanTable; import com.l2jserver.gameserver.datatables.ClassListData; import com.l2jserver.gameserver.datatables.NpcTable; import com.l2jserver.gameserver.instancemanager.CastleManager; import com.l2jserver.gameserver.model.L2Clan; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jserver.gameserver.model.itemcontainer.Inventory; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.model.olympiad.Olympiad; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo; import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.network.serverpackets.UserInfo; import com.l2jserver.util.StringUtil; /** * @author godson */ public class Hero { private static final Logger _log = Logger.getLogger(Hero.class.getName()); private static final String GET_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.played FROM heroes, characters WHERE characters.charId = heroes.charId AND heroes.played = 1"; private static final String GET_ALL_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.played FROM heroes, characters WHERE characters.charId = heroes.charId"; private static final String UPDATE_ALL = "UPDATE heroes SET played = 0"; private static final String INSERT_HERO = "INSERT INTO heroes (charId, class_id, count, played) VALUES (?,?,?,?)"; private static final String UPDATE_HERO = "UPDATE heroes SET count = ?, played = ? WHERE charId = ?"; private static final String GET_CLAN_ALLY = "SELECT characters.clanid AS clanid, coalesce(clan_data.ally_Id, 0) AS allyId FROM characters LEFT JOIN clan_data ON clan_data.clan_id = characters.clanid WHERE characters.charId = ?"; private static final String GET_CLAN_NAME = "SELECT clan_name FROM clan_data WHERE clan_id = (SELECT clanid FROM characters WHERE charId = ?)"; // delete hero items private static final String DELETE_ITEMS = "DELETE FROM items WHERE item_id IN (6842, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 9388, 9389, 9390) AND owner_id NOT IN (SELECT charId FROM characters WHERE accesslevel > 0)"; private static final Map<Integer, StatsSet> _heroes = new FastMap<>(); private static final Map<Integer, StatsSet> _completeHeroes = new FastMap<>(); private static final Map<Integer, StatsSet> _herocounts = new FastMap<>(); private static final Map<Integer, List<StatsSet>> _herofights = new FastMap<>(); private static final Map<Integer, List<StatsSet>> _herodiary = new FastMap<>(); private static final Map<Integer, String> _heroMessage = new FastMap<>(); public static final String COUNT = "count"; public static final String PLAYED = "played"; public static final String CLAN_NAME = "clan_name"; public static final String CLAN_CREST = "clan_crest"; public static final String ALLY_NAME = "ally_name"; public static final String ALLY_CREST = "ally_crest"; public static final int ACTION_RAID_KILLED = 1; public static final int ACTION_HERO_GAINED = 2; public static final int ACTION_CASTLE_TAKEN = 3; public static Hero getInstance() { return SingletonHolder._instance; } protected Hero() { init(); } private void init() { _heroes.clear(); _completeHeroes.clear(); _herocounts.clear(); _herofights.clear(); _herodiary.clear(); _heroMessage.clear(); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement(GET_HEROES); ResultSet rset = statement.executeQuery(); PreparedStatement statement2 = con.prepareStatement(GET_CLAN_ALLY); while (rset.next()) { StatsSet hero = new StatsSet(); int charId = rset.getInt(Olympiad.CHAR_ID); hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME)); hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID)); hero.set(COUNT, rset.getInt(COUNT)); hero.set(PLAYED, rset.getInt(PLAYED)); loadFights(charId); loadDiary(charId); loadMessage(charId); processHeros(statement2, charId, hero); _heroes.put(charId, hero); } rset.close(); statement.close(); statement = con.prepareStatement(GET_ALL_HEROES); rset = statement.executeQuery(); while (rset.next()) { StatsSet hero = new StatsSet(); int charId = rset.getInt(Olympiad.CHAR_ID); hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME)); hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID)); hero.set(COUNT, rset.getInt(COUNT)); hero.set(PLAYED, rset.getInt(PLAYED)); processHeros(statement2, charId, hero); _completeHeroes.put(charId, hero); } statement2.close(); rset.close(); statement.close(); } catch (SQLException e) { _log.log(Level.WARNING, "Hero System: Couldnt load Heroes", e); } _log.info("Hero System: Loaded " + _heroes.size() + " Heroes."); _log.info("Hero System: Loaded " + _completeHeroes.size() + " all time Heroes."); } private void processHeros(PreparedStatement ps, int charId, StatsSet hero) throws SQLException { ps.setInt(1, charId); ResultSet rs = ps.executeQuery(); if (rs.next()) { int clanId = rs.getInt("clanid"); int allyId = rs.getInt("allyId"); String clanName = ""; String allyName = ""; int clanCrest = 0; int allyCrest = 0; if (clanId > 0) { clanName = ClanTable.getInstance().getClan(clanId).getName(); clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId(); if (allyId > 0) { allyName = ClanTable.getInstance().getClan(clanId).getAllyName(); allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId(); } } hero.set(CLAN_CREST, clanCrest); hero.set(CLAN_NAME, clanName); hero.set(ALLY_CREST, allyCrest); hero.set(ALLY_NAME, allyName); } rs.close(); ps.clearParameters(); } private String calcFightTime(long FightTime) { String format = String.format("%%0%dd", 2); FightTime = FightTime / 1000; String seconds = String.format(format, FightTime % 60); String minutes = String.format(format, (FightTime % 3600) / 60); String time = minutes + ":" + seconds; return time; } /** * Restore hero message from Db. * @param charId */ public void loadMessage(int charId) { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { String message = null; PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"); statement.setInt(1, charId); ResultSet rset = statement.executeQuery(); rset.next(); message = rset.getString("message"); _heroMessage.put(charId, message); rset.close(); statement.close(); } catch (SQLException e) { _log.log(Level.WARNING, "Hero System: Couldnt load Hero Message for CharId: " + charId, e); } } public void loadDiary(int charId) { final List<StatsSet> _diary = new FastList<>(); int diaryentries = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"); statement.setInt(1, charId); ResultSet rset = statement.executeQuery(); while (rset.next()) { StatsSet _diaryentry = new StatsSet(); long time = rset.getLong("time"); int action = rset.getInt("action"); int param = rset.getInt("param"); String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(time)); _diaryentry.set("date", date); if (action == ACTION_RAID_KILLED) { L2NpcTemplate template = NpcTable.getInstance().getTemplate(param); if (template != null) { _diaryentry.set("action", template.getName() + " was defeated"); } } else if (action == ACTION_HERO_GAINED) { _diaryentry.set("action", "Gained Hero status"); } else if (action == ACTION_CASTLE_TAKEN) { Castle castle = CastleManager.getInstance().getCastleById(param); if (castle != null) { _diaryentry.set("action", castle.getName() + " Castle was successfuly taken"); } } _diary.add(_diaryentry); diaryentries++; } rset.close(); statement.close(); _herodiary.put(charId, _diary); _log.info("Hero System: Loaded " + diaryentries + " diary entries for Hero: " + CharNameTable.getInstance().getNameById(charId)); } catch (SQLException e) { _log.log(Level.WARNING, "Hero System: Couldnt load Hero Diary for CharId: " + charId, e); } } public void loadFights(int charId) { final List<StatsSet> _fights = new FastList<>(); StatsSet _herocountdata = new StatsSet(); Calendar _data = Calendar.getInstance(); _data.set(Calendar.DAY_OF_MONTH, 1); _data.set(Calendar.HOUR_OF_DAY, 0); _data.set(Calendar.MINUTE, 0); _data.set(Calendar.MILLISECOND, 0); long from = _data.getTimeInMillis(); int numberoffights = 0; int _victorys = 0; int _losses = 0; int _draws = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start<? ORDER BY start ASC"); statement.setInt(1, charId); statement.setInt(2, charId); statement.setLong(3, from); ResultSet rset = statement.executeQuery(); int charOneId; int charOneClass; int charTwoId; int charTwoClass; int winner; long start; int time; int classed; while (rset.next()) { charOneId = rset.getInt("charOneId"); charOneClass = rset.getInt("charOneClass"); charTwoId = rset.getInt("charTwoId"); charTwoClass = rset.getInt("charTwoClass"); winner = rset.getInt("winner"); start = rset.getLong("start"); time = rset.getInt("time"); classed = rset.getInt("classed"); if (charId == charOneId) { String name = CharNameTable.getInstance().getNameById(charTwoId); String cls = ClassListData.getInstance().getClass(charTwoClass).getClientCode(); if ((name != null) && (cls != null)) { StatsSet fight = new StatsSet(); fight.set("oponent", name); fight.set("oponentclass", cls); fight.set("time", calcFightTime(time)); String date = (new SimpleDateFormat("yyyy-MM-dd HH:mm")).format(new Date(start)); fight.set("start", date); fight.set("classed", classed); if (winner == 1) { fight.set("result", "<font color=\"00ff00\">victory</font>"); _victorys++; } else if (winner == 2) { fight.set("result", "<font color=\"ff0000\">loss</font>"); _losses++; } else if (winner == 0) { fight.set("result", "<font color=\"ffff00\">draw</font>"); _draws++; } _fights.add(fight); numberoffights++; } } else if (charId == charTwoId) { String name = CharNameTable.getInstance().getNameById(charOneId); String cls = ClassListData.getInstance().getClass(charOneClass).getClientCode(); if ((name != null) && (cls != null)) { StatsSet fight = new StatsSet(); fight.set("oponent", name); fight.set("oponentclass", cls); fight.set("time", calcFightTime(time)); String date = (new SimpleDateFormat("yyyy-MM-dd HH:mm")).format(new Date(start)); fight.set("start", date); fight.set("classed", classed); if (winner == 1) { fight.set("result", "<font color=\"ff0000\">loss</font>"); _losses++; } else if (winner == 2) { fight.set("result", "<font color=\"00ff00\">victory</font>"); _victorys++; } else if (winner == 0) { fight.set("result", "<font color=\"ffff00\">draw</font>"); _draws++; } _fights.add(fight); numberoffights++; } } } rset.close(); statement.close(); _herocountdata.set("victory", _victorys); _herocountdata.set("draw", _draws); _herocountdata.set("loss", _losses); _herocounts.put(charId, _herocountdata); _herofights.put(charId, _fights); _log.info("Hero System: Loaded " + numberoffights + " fights for Hero: " + CharNameTable.getInstance().getNameById(charId)); } catch (SQLException e) { _log.log(Level.WARNING, "Hero System: Couldnt load Hero fights history for CharId: " + charId, e); } } public Map<Integer, StatsSet> getHeroes() { return _heroes; } public int getHeroByClass(int classid) { for (Entry<Integer, StatsSet> e : _heroes.entrySet()) { if (e.getValue().getInteger(Olympiad.CLASS_ID) == classid) { return e.getKey(); } } return 0; } public void resetData() { _herodiary.clear(); _herofights.clear(); _herocounts.clear(); _heroMessage.clear(); } public void showHeroDiary(L2PcInstance activeChar, int heroclass, int charid, int page) { final int perpage = 10; if (_herodiary.containsKey(charid)) { List<StatsSet> _mainlist = _herodiary.get(charid); NpcHtmlMessage DiaryReply = new NpcHtmlMessage(5); final String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herodiary.htm"); if ((htmContent != null) && _heroMessage.containsKey(charid)) { DiaryReply.setHtml(htmContent); DiaryReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid)); DiaryReply.replace("%message%", _heroMessage.get(charid)); DiaryReply.disableValidation(); if (!_mainlist.isEmpty()) { FastList<StatsSet> _list = FastList.newInstance(); _list.addAll(_mainlist); Collections.reverse(_list); boolean color = true; final StringBuilder fList = new StringBuilder(500); int counter = 0; int breakat = 0; for (int i = ((page - 1) * perpage); i < _list.size(); i++) { breakat = i; StatsSet _diaryentry = _list.get(i); StringUtil.append(fList, "<tr><td>"); if (color) { StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">"); } else { StringUtil.append(fList, "<table width=270>"); } StringUtil.append(fList, "<tr><td width=270><font color=\"LEVEL\">" + _diaryentry.getString("date") + ":xx</font></td></tr>"); StringUtil.append(fList, "<tr><td width=270>" + _diaryentry.getString("action") + "</td></tr>"); StringUtil.append(fList, "<tr><td> </td></tr></table>"); StringUtil.append(fList, "</td></tr>"); color = !color; counter++; if (counter >= perpage) { break; } } if (breakat < (_list.size() - 1)) { DiaryReply.replace("%buttprev%", "<button value=\"Prev\" action=\"bypass _diary?class=" + heroclass + "&page=" + (page + 1) + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } else { DiaryReply.replace("%buttprev%", ""); } if (page > 1) { DiaryReply.replace("%buttnext%", "<button value=\"Next\" action=\"bypass _diary?class=" + heroclass + "&page=" + (page - 1) + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } else { DiaryReply.replace("%buttnext%", ""); } DiaryReply.replace("%list%", fList.toString()); FastList.recycle(_list); } else { DiaryReply.replace("%list%", ""); DiaryReply.replace("%buttprev%", ""); DiaryReply.replace("%buttnext%", ""); } activeChar.sendPacket(DiaryReply); } } } public void showHeroFights(L2PcInstance activeChar, int heroclass, int charid, int page) { final int perpage = 20; int _win = 0; int _loss = 0; int _draw = 0; if (_herofights.containsKey(charid)) { List<StatsSet> _list = _herofights.get(charid); NpcHtmlMessage FightReply = new NpcHtmlMessage(5); final String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herohistory.htm"); if (htmContent != null) { FightReply.setHtml(htmContent); FightReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid)); FightReply.disableValidation(); if (!_list.isEmpty()) { if (_herocounts.containsKey(charid)) { StatsSet _herocount = _herocounts.get(charid); _win = _herocount.getInteger("victory"); _loss = _herocount.getInteger("loss"); _draw = _herocount.getInteger("draw"); } boolean color = true; final StringBuilder fList = new StringBuilder(500); int counter = 0; int breakat = 0; for (int i = ((page - 1) * perpage); i < _list.size(); i++) { breakat = i; StatsSet fight = _list.get(i); StringUtil.append(fList, "<tr><td>"); if (color) { StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">"); } else { StringUtil.append(fList, "<table width=270>"); } StringUtil.append(fList, "<tr><td width=220><font color=\"LEVEL\">" + fight.getString("start") + "</font> " + fight.getString("result") + "</td><td width=50 align=right>" + (fight.getInteger("classed") > 0 ? "<font color=\"FFFF99\">cls</font>" : "<font color=\"999999\">non-cls<font>") + "</td></tr>"); StringUtil.append(fList, "<tr><td width=220>vs " + fight.getString("oponent") + " (" + fight.getString("oponentclass") + ")</td><td width=50 align=right>(" + fight.getString("time") + ")</td></tr>"); StringUtil.append(fList, "<tr><td colspan=2> </td></tr></table>"); StringUtil.append(fList, "</td></tr>"); color = !color; counter++; if (counter >= perpage) { break; } } if (breakat < (_list.size() - 1)) { FightReply.replace("%buttprev%", "<button value=\"Prev\" action=\"bypass _match?class=" + heroclass + "&page=" + (page + 1) + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } else { FightReply.replace("%buttprev%", ""); } if (page > 1) { FightReply.replace("%buttnext%", "<button value=\"Next\" action=\"bypass _match?class=" + heroclass + "&page=" + (page - 1) + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } else { FightReply.replace("%buttnext%", ""); } FightReply.replace("%list%", fList.toString()); } else { FightReply.replace("%list%", ""); FightReply.replace("%buttprev%", ""); FightReply.replace("%buttnext%", ""); } FightReply.replace("%win%", String.valueOf(_win)); FightReply.replace("%draw%", String.valueOf(_draw)); FightReply.replace("%loos%", String.valueOf(_loss)); activeChar.sendPacket(FightReply); } } } public synchronized void computeNewHeroes(List<StatsSet> newHeroes) { updateHeroes(true); if (!_heroes.isEmpty()) { for (StatsSet hero : _heroes.values()) { String name = hero.getString(Olympiad.CHAR_NAME); L2PcInstance player = L2World.getInstance().getPlayer(name); if (player == null) { continue; } try { player.setHero(false); for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++) { L2ItemInstance equippedItem = player.getInventory().getPaperdollItem(i); if ((equippedItem != null) && equippedItem.isHeroItem()) { player.getInventory().unEquipItemInSlot(i); } } for (L2ItemInstance item : player.getInventory().getAvailableItems(false, false, false)) { if ((item != null) && item.isHeroItem()) { player.destroyItem("Hero", item, null, true); InventoryUpdate iu = new InventoryUpdate(); iu.addRemovedItem(item); player.sendPacket(iu); } } player.broadcastUserInfo(); } catch (NullPointerException e) { } } } if (newHeroes.isEmpty()) { _heroes.clear(); return; } Map<Integer, StatsSet> heroes = new FastMap<>(); for (StatsSet hero : newHeroes) { int charId = hero.getInteger(Olympiad.CHAR_ID); if ((_completeHeroes != null) && _completeHeroes.containsKey(charId)) { StatsSet oldHero = _completeHeroes.get(charId); int count = oldHero.getInteger(COUNT); oldHero.set(COUNT, count + 1); oldHero.set(PLAYED, 1); heroes.put(charId, oldHero); } else { StatsSet newHero = new StatsSet(); newHero.set(Olympiad.CHAR_NAME, hero.getString(Olympiad.CHAR_NAME)); newHero.set(Olympiad.CLASS_ID, hero.getInteger(Olympiad.CLASS_ID)); newHero.set(COUNT, 1); newHero.set(PLAYED, 1); heroes.put(charId, newHero); } } deleteItemsInDb(); _heroes.clear(); _heroes.putAll(heroes); heroes.clear(); updateHeroes(false); L2PcInstance player; for (Integer charId : _heroes.keySet()) { player = L2World.getInstance().getPlayer(charId); if (player != null) { player.setHero(true); L2Clan clan = player.getClan(); if (clan != null) { clan.addReputationScore(Config.HERO_POINTS, true); SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_C1_BECAME_HERO_AND_GAINED_S2_REPUTATION_POINTS); sm.addString(CharNameTable.getInstance().getNameById(charId)); sm.addNumber(Config.HERO_POINTS); clan.broadcastToOnlineMembers(sm); } player.sendPacket(new UserInfo(player)); player.sendPacket(new ExBrExtraUserInfo(player)); player.broadcastUserInfo(); // Set Gained hero and reload data setHeroGained(player.getObjectId()); loadFights(player.getObjectId()); loadDiary(player.getObjectId()); _heroMessage.put(player.getObjectId(), ""); } else { // Set Gained hero and reload data setHeroGained(charId); loadFights(charId); loadDiary(charId); _heroMessage.put(charId, ""); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement(GET_CLAN_NAME); statement.setInt(1, charId); ResultSet rset = statement.executeQuery(); if (rset.next()) { String clanName = rset.getString("clan_name"); if (clanName != null) { L2Clan clan = ClanTable.getInstance().getClanByName(clanName); if (clan != null) { clan.addReputationScore(Config.HERO_POINTS, true); SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_C1_BECAME_HERO_AND_GAINED_S2_REPUTATION_POINTS); sm.addString(CharNameTable.getInstance().getNameById(charId)); sm.addNumber(Config.HERO_POINTS); clan.broadcastToOnlineMembers(sm); } } } rset.close(); statement.close(); } catch (Exception e) { _log.warning("could not get clan name of player with objectId:" + charId + ": " + e); } } } } public void updateHeroes(boolean setDefault) { // _herofights = new FastMap<Integer, List<StatsSet>>(); // _herocounts = new FastMap<Integer, StatsSet>(); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement; if (setDefault) { statement = con.prepareStatement(UPDATE_ALL); statement.execute(); statement.close(); } else { StatsSet hero; int heroId; for (Entry<Integer, StatsSet> entry : _heroes.entrySet()) { hero = entry.getValue(); heroId = entry.getKey(); if (_completeHeroes.isEmpty() || !_completeHeroes.containsKey(heroId)) { statement = con.prepareStatement(INSERT_HERO); statement.setInt(1, heroId); statement.setInt(2, hero.getInteger(Olympiad.CLASS_ID)); statement.setInt(3, hero.getInteger(COUNT)); statement.setInt(4, hero.getInteger(PLAYED)); statement.execute(); statement.close(); statement = con.prepareStatement(GET_CLAN_ALLY); statement.setInt(1, heroId); ResultSet rset = statement.executeQuery(); if (rset.next()) { int clanId = rset.getInt("clanid"); int allyId = rset.getInt("allyId"); String clanName = ""; String allyName = ""; int clanCrest = 0; int allyCrest = 0; if (clanId > 0) { clanName = ClanTable.getInstance().getClan(clanId).getName(); clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId(); if (allyId > 0) { allyName = ClanTable.getInstance().getClan(clanId).getAllyName(); allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId(); } } hero.set(CLAN_CREST, clanCrest); hero.set(CLAN_NAME, clanName); hero.set(ALLY_CREST, allyCrest); hero.set(ALLY_NAME, allyName); } rset.close(); statement.close(); _heroes.remove(heroId); _heroes.put(heroId, hero); _completeHeroes.put(heroId, hero); } else { statement = con.prepareStatement(UPDATE_HERO); statement.setInt(1, hero.getInteger(COUNT)); statement.setInt(2, hero.getInteger(PLAYED)); statement.setInt(3, heroId); statement.execute(); statement.close(); } } } } catch (SQLException e) { _log.log(Level.WARNING, "Hero System: Couldnt update Heroes", e); } } public void setHeroGained(int charId) { setDiaryData(charId, ACTION_HERO_GAINED, 0); } public void setRBkilled(int charId, int npcId) { setDiaryData(charId, ACTION_RAID_KILLED, npcId); L2NpcTemplate template = NpcTable.getInstance().getTemplate(npcId); if (_herodiary.containsKey(charId) && (template != null)) { // Get Data List<StatsSet> _list = _herodiary.get(charId); // Clear old data _herodiary.remove(charId); // Prepare new data StatsSet _diaryentry = new StatsSet(); String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(System.currentTimeMillis())); _diaryentry.set("date", date); _diaryentry.set("action", template.getName() + " was defeated"); // Add to old list _list.add(_diaryentry); // Put new list into diary _herodiary.put(charId, _list); } } public void setCastleTaken(int charId, int castleId) { setDiaryData(charId, ACTION_CASTLE_TAKEN, castleId); Castle castle = CastleManager.getInstance().getCastleById(castleId); if ((castle != null) && _herodiary.containsKey(charId)) { // Get Data List<StatsSet> _list = _herodiary.get(charId); // Clear old data _herodiary.remove(charId); // Prepare new data StatsSet _diaryentry = new StatsSet(); String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(System.currentTimeMillis())); _diaryentry.set("date", date); _diaryentry.set("action", castle.getName() + " Castle was successfuly taken"); // Add to old list _list.add(_diaryentry); // Put new list into diary _herodiary.put(charId, _list); } } public void setDiaryData(int charId, int action, int param) { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"); statement.setInt(1, charId); statement.setLong(2, System.currentTimeMillis()); statement.setInt(3, action); statement.setInt(4, param); statement.execute(); statement.close(); } catch (SQLException e) { if (_log.isLoggable(Level.SEVERE)) { _log.log(Level.SEVERE, "SQL exception while saving DiaryData.", e); } } } /** * Set new hero message for hero * @param player the player instance * @param message String to set */ public void setHeroMessage(L2PcInstance player, String message) { _heroMessage.put(player.getObjectId(), message); if (player.isDebug()) { _log.info("Hero message for player: " + player.getName() + ":[" + player.getObjectId() + "] set to: [" + message + "]"); } } /** * Update hero message in database * @param charId character objid */ public void saveHeroMessage(int charId) { if (_heroMessage.get(charId) == null) { return; } try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"); statement.setString(1, _heroMessage.get(charId)); statement.setInt(2, charId); statement.execute(); statement.close(); } catch (SQLException e) { _log.log(Level.SEVERE, "SQL exception while saving HeroMessage.", e); } } private void deleteItemsInDb() { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement(DELETE_ITEMS); statement.execute(); statement.close(); } catch (SQLException e) { _log.log(Level.WARNING, "", e); } } /** * Saving task for {@link Hero}<BR> * Save all hero messages to DB. */ public void shutdown() { for (int charId : _heroMessage.keySet()) { saveHeroMessage(charId); } } /** * @param objectId the player's object Id to verify. * @return {@code true} if there are heros and the player is in the list, {@code false} otherwise. */ public boolean isHero(int objectId) { return _heroes.containsKey(objectId); } private static class SingletonHolder { protected static final Hero _instance = new Hero(); } }
  8. where i can find it? im using l2jserver
  9. As I can do to make the hero skills are also in the subclass and not just in the main class?
  10. Problem solved I edit my RequestExTryToPutEnchantTargetItem.java package com.l2jserver.gameserver.network.clientpackets; import java.util.logging.Level; import com.l2jserver.gameserver.datatables.EnchantItemData; import com.l2jserver.gameserver.model.EnchantScroll; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExPutEnchantTargetItemResult; ++ import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage; /** * @author KenM */ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket { private static final String _C__D0_4C_REQUESTEXTRYTOPUTENCHANTTARGETITEM = "[C] D0:4C RequestExTryToPutEnchantTargetItem"; private int _objectId = 0; @Override protected void readImpl() { _objectId = readD(); } @Override protected void runImpl() { L2PcInstance activeChar = getClient().getActiveChar(); if ((_objectId == 0) || (activeChar == null)) { return; } if (activeChar.isEnchanting()) { return; } L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId); L2ItemInstance scroll = activeChar.getActiveEnchantItem(); if ((item == null) || (scroll == null)) { return; } EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll); if ((scrollTemplate == null) || !scrollTemplate.isValid(item)) { activeChar.sendPacket(SystemMessageId.DOES_NOT_FIT_SCROLL_CONDITIONS); activeChar.setActiveEnchantItem(null); activeChar.sendPacket(new ExPutEnchantTargetItemResult(0)); if (scrollTemplate == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Undefined scroll have been used id: " + scroll.getItemId()); } return; } activeChar.setIsEnchanting(true); ++ double chance = scrollTemplate.getChance(item, null); ++ activeChar.sendPacket(new ExShowScreenMessage("You have " + chance + "% chance of success!", 3000)); activeChar.setActiveEnchantTimestamp(System.currentTimeMillis()); activeChar.sendPacket(new ExPutEnchantTargetItemResult(_objectId)); } @Override public String getType() { return _C__D0_4C_REQUESTEXTRYTOPUTENCHANTTARGETITEM; } } :happyforever:
  11. Ok, now are found... but the message leave when i use the scroll.. i want to message leave when i put the item can understand me? My custom enchant config <enchant id="959" isBlessed="true" targetGrade="s"> <!-- Custom Progressive enchant system uncomment the lines below to enable. --> <step level="1" successRate="100.00" /> <step level="2" successRate="100.00" /> <step level="3" successRate="100.00" /> <step level="4" successRate="80.00" /> <step level="5" successRate="75.00" /> <step level="6" successRate="70.00" /> <step level="7" successRate="65.00" /> <step level="8" successRate="60.00" /> <step level="9" successRate="55.00" /> <step level="10" successRate="50.00" /> <step level="11" successRate="45.00" /> <step level="12" successRate="40.00" /> <step level="13" successRate="35.00" /> <step level="14" successRate="30.00" /> <step level="15" successRate="25.00" /> <step level="16" successRate="20.00" /> </enchant>
  12. i edit my itemhandlers/enchantscroll.java package handlers.itemhandlers; import com.l2jserver.gameserver.handler.IItemHandler; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; + import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ChooseInventoryItem; public class EnchantScrolls implements IItemHandler { @Override public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeChar = playable.getActingPlayer(); if (activeChar.isCastingNow()) { return false; } if (activeChar.isEnchanting()) { activeChar.sendPacket(SystemMessageId.ENCHANTMENT_ALREADY_IN_PROGRESS); return false; } activeChar.setActiveEnchantItem(item); + activeChar.sendPacket(new ExShowScreenMessage("You have " + Config.ENCHANT_CHANCE + "% chance of success!", 6000)); activeChar.sendPacket(new ChooseInventoryItem(item.getItemId())); return true; } } Note: i use the same enchant chance for armors,weaps and jewels. And i take this error in the gameserver console :(
  13. but what i need add? Sorry but im a little newbie :okey:
  14. ExShowScreenMessage.java package com.l2jserver.gameserver.network.serverpackets; import java.util.ArrayList; import java.util.List; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; /** * @author Kerberos */ public class ExShowScreenMessage extends L2GameServerPacket { private final int _type; private final int _sysMessageId; private final int _unk1; private final int _unk2; private final int _unk3; private final boolean _fade; private final int _size; private final int _position; private boolean _effect; private final String _text; private final int _time; private final int _npcString; private List<String> _parameters; public ExShowScreenMessage(String text, int time) { _type = 1; _sysMessageId = -1; _unk1 = 0; _unk2 = 0; _unk3 = 0; _fade = false; _position = 0x02; _text = text; _time = time; _size = 0; _effect = false; _npcString = -1; } public ExShowScreenMessage(NpcStringId npcString, int position, int time) // For npcstring { _type = 2; _sysMessageId = -1; _unk1 = 0; _unk2 = 0; _unk3 = 0; _fade = false; _position = position; _text = null; _time = time; _size = 0; _effect = false; _npcString = npcString.getId(); } public ExShowScreenMessage(SystemMessageId systemMsg, int position, int time) // For SystemMessage { _type = 2; _sysMessageId = systemMsg.getId(); _unk1 = 0; _unk2 = 0; _unk3 = 0; _fade = false; _position = position; _text = null; _time = time; _size = 0; _effect = false; _npcString = -1; } public ExShowScreenMessage(int type, int messageId, int position, int unk1, int size, int unk2, int unk3, boolean showEffect, int time, boolean fade, String text, NpcStringId npcString) { _type = type; _sysMessageId = messageId; _unk1 = unk1; _unk2 = unk2; _unk3 = unk3; _fade = fade; _position = position; _text = text; _time = time; _size = size; _effect = showEffect; _npcString = npcString.getId(); } public ExShowScreenMessage(int type, int messageId, int position, int unk1, int size, int unk2, int unk3, boolean showEffect, int time, boolean fade, String text, NpcStringId npcString, String params) { _type = type; _sysMessageId = messageId; _unk1 = unk1; _unk2 = unk2; _unk3 = unk3; _fade = fade; _position = position; _text = text; _time = time; _size = size; _effect = showEffect; _npcString = npcString.getId(); } /** * String parameter for argument S1,S2,.. in npcstring-e.dat * @param text */ public void addStringParameter(String text) { if (_parameters == null) { _parameters = new ArrayList<>(); } _parameters.add(text); } @Override protected void writeImpl() { writeC(0xFE); writeH(0x39); writeD(_type); // 0 - system messages, 1 - your defined text, 2 - npcstring writeD(_sysMessageId); // system message id (_type must be 0 otherwise no effect) writeD(_position); // message position writeD(_unk1); // ? writeD(_size); // font size 0 - normal, 1 - small writeD(_unk2); // ? writeD(_unk3); // ? writeD(_effect ? 1 : 0); // upper effect (0 - disabled, 1 enabled) - _position must be 2 (center) otherwise no effect writeD(_time); // time writeD(_fade ? 1 : 0); // fade effect (0 - disabled, 1 enabled) writeD(_npcString); // npcString if (_npcString == -1) { writeS(_text); // your text (_type must be 1, otherwise no effect) } else { if (_parameters != null) { for (String s : _parameters) { writeS(s); } } } } public ExShowScreenMessage setUpperEffect(boolean value) { _effect = value; return this; } } Itemhandler package handlers.itemhandlers; import com.l2jserver.gameserver.handler.IItemHandler; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ChooseInventoryItem; public class EnchantScrolls implements IItemHandler { @Override public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeChar = playable.getActingPlayer(); if (activeChar.isCastingNow()) { return false; } if (activeChar.isEnchanting()) { activeChar.sendPacket(SystemMessageId.ENCHANTMENT_ALREADY_IN_PROGRESS); return false; } activeChar.setActiveEnchantItem(item); activeChar.sendPacket(new ChooseInventoryItem(item.getItemId())); return true; } }
  15. Is there any way to do that using java to enchant an item leaves a message on the screen saying the chanse of success ? like "you have X% chance to enchant your item" im use l2jServer high five Looking I found that should edit the "RequestExTryToPutEnchantTargetItem.java" But exactly who should edit to make it work ? package com.l2jserver.gameserver.network.clientpackets; import java.util.logging.Level; import com.l2jserver.gameserver.datatables.EnchantItemData; import com.l2jserver.gameserver.model.EnchantScroll; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExPutEnchantTargetItemResult; /** * @author KenM */ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket { private static final String _C__D0_4C_REQUESTEXTRYTOPUTENCHANTTARGETITEM = "[C] D0:4C RequestExTryToPutEnchantTargetItem"; private int _objectId = 0; @Override protected void readImpl() { _objectId = readD(); } @Override protected void runImpl() { L2PcInstance activeChar = getClient().getActiveChar(); if ((_objectId == 0) || (activeChar == null)) { return; } if (activeChar.isEnchanting()) { return; } L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId); L2ItemInstance scroll = activeChar.getActiveEnchantItem(); if ((item == null) || (scroll == null)) { return; } EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll); if ((scrollTemplate == null) || !scrollTemplate.isValid(item)) { activeChar.sendPacket(SystemMessageId.DOES_NOT_FIT_SCROLL_CONDITIONS); activeChar.setActiveEnchantItem(null); activeChar.sendPacket(new ExPutEnchantTargetItemResult(0)); if (scrollTemplate == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Undefined scroll have been used id: " + scroll.getItemId()); } return; } activeChar.setIsEnchanting(true); activeChar.setActiveEnchantTimestamp(System.currentTimeMillis()); activeChar.sendPacket(new ExPutEnchantTargetItemResult(_objectId)); } @Override public String getType() { return _C__D0_4C_REQUESTEXTRYTOPUTENCHANTTARGETITEM; } }
  16. This code has what you're looking for, I 'm testing and is very good. http://www.maxcheaters.com/topic/141971-rank-pvp-system-389-il-h5/
  17. w00t? i will check it :P
  18. Npc lvl will show in the next restart. For tomorrow first changelog!
  19. • Patch Download• https://mega.co.nz/#!t4pjhJKL!F6patA0J1UVXvnTDWm3KLFz21rBfIqm3KxtYeRiT04Q http://www.4shared.com/rar/FNE1jM2L/L2GemV1.html http://www.mediafire.com/download/3e3xxuyafbpxw7d/L2GemV1.rar In a few minuts i will ad the npc lvl for u ^^
  20. It is impossible, both in Spanish and English work, anyway I'll add downloads to post ...
  21. Nopeee, http://l2gem.com try again.
  22. I will remove it from npc and change for retail. Yes we can put npc lvl i have a lot ofwork for this weekend :P
  23. Hello! We are L2Gem Staff and we are here to introduce our Lineage II High Five proyect. Our goal is to provide a stable, international, high quality server where players from around the world can have a good time with the safety of playing on a server that will endure over time. We are working under a private L2J Pack that offers the perfect retail experience most players are looking for. Next are detailed our main features, dont miss them! (Anyway, keep in mind that we are a retail like server, wich means that most of the retail features, even working fully, are not listed above). • Join us • L2Gem Webiste L2Gem Forum New! L2Gem team thinks that the forum is an essential part of any server, so we encourage you to register and begin participating right now! • About Grand Opening • - OBT opening: 01-11-2013 (further info here) - Official opening: 01-12-2013 • About our rates • - Experience (EXP) 15x - Skill Points (SP) 15x - Adena 10x - Drop Items 7x (few 1x) - Quest Experience (EXP) 3x - Quest Skill Points (SP) 3x - Quest Adena 3x - Quest Drop Items 4x - Spoil 8x - Weight Limit 5x - Manor 2x - Fishing 4x • About our general features • - Private High Five source. - Flawless commercial Geodata & Pathnodes. - Retail like gameplay. - Quests/Instances/Skills fully working. - 1st/2nd/3rd Class Changer NPC. - Custom Comunnity Board (alt+B: Gmshop, buffer, gatekeeper, services tab and much more...) - Vote Reward item. - Character Password at login. - Anti-bot system aswell as Bot report button. - Anti-DOS/DDOS protection. • About our enchants • - Safe Enchant 4 - Max. Enchant 16 - Normal Scroll chance 55% - Blessed Scroll chance 58% - Ancient Scroll chance 68% (Even enchants fails, it will stay) - Elemental Max. Level Level 7 - Elemental Stone chance 40% - Elemental Crystal chance 30% • About our configurations • - Buffs dances and songs duration: 1 hour - Buff slots: 24 - Dance and Songs slots: 12 - Olympiads Max. enchant: 8 - Sub-Class Max. level: 85 - Sub-Class can be taken without quest. - Offline Shop system. - Auto learn skills (not forgotten skills) - Auto loot (not for Raid & Grand Boss drops) - Champion moobs enabled. - Wedding system. • Patch Download• https://mega.co.nz/#!t4pjhJKL!F6patA0J1UVXvnTDWm3KLFz21rBfIqm3KxtYeRiT04Q http://www.4shared.com/rar/FNE1jM2L/L2GemV1.html http://www.mediafire.com/download/3e3xxuyafbpxw7d/L2GemV1.rar • Screenshots • Thanks for reading, and if you got any doubt about anything related to our server, please contact us!
  24. Beta Server On! http://l2gem.com
  25. Thanks, we'll be waiting!
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock