Jump to content

Rootware

Legendary Member
  • Posts

    1,370
  • Credits

  • Joined

  • Last visited

  • Days Won

    14
  • Feedback

    100%

Community Answers

  1. Rootware's post in Classic Kamael - Castle info window was marked as the answer   
    This packet sending common info for another place, e.g. for Castles Status in Map window. You need to find packet which sending single castle info.
  2. Rootware's post in restricted zones was marked as the answer   
    All zone properties you can find into "zones" folder inside XML folder.
  3. Rootware's post in Auto Loot Adena was marked as the answer   
    Find this line in Monster.java
    if (((isRaidBoss() && Config.AUTO_LOOT_RAID) || (!isRaidBoss() && Config.AUTO_LOOT)) && player.getInventory().validateCapacityByItemId(holder))  
    and change to this
     
    if (((isRaidBoss() && Config.AUTO_LOOT_RAID) || (!isRaidBoss() && Config.AUTO_LOOT) || (holder.getId() == 57)) && player.getInventory().validateCapacityByItemId(holder))  
  4. Rootware's post in Custom html window was marked as the answer   
    As i know in H5 client exists 2 difference NpcHtmlDialogue packets and windows. You can use everywhere the legacy dialogue window w/o reward and conditions sections. And the second window change as you wish in interface scripts and use it for custom things.
     
    By the way, good stuff.
  5. Rootware's post in dualbox custom mod was marked as the answer   
    Use CatsGuard for this (diff patch for L2J Frozen included).
     
    https://www.4shared.com/rar/73hiS1Aaba/CatsGuard.html
     
    And after make a checks when mobs was killed for multibox usage and decrease rates if TRUE.
  6. Rootware's post in [L2jServer H5] Soulshot effects disable was marked as the answer   
    You need make few steps:
    Make in Player instance boolean variable like showShotSpell and make it as TRUE or restore from personal player's config; Make command or HTML window for changing this trigger; Edit all item handlers like: SoulShot.java, SpititShots.java, etc for next behavior. In all this handlers in the end of all checks exists code with broadcasting MagicSkillUse packet which contains skill id of soulshot/spiritshot. You need make FOR() cycle for manual broadcasting this packet by condition if showShotSpell is TRUE. Or dublicate existing broadcastPacketInRadius() as new (e.g. broadcastShotUsagePacketInRadius()) with this condition. This case will more elegant. PROFIT. Server will use SS/BSS and don't send them usage if palyer blocked them.
  7. Rootware's post in Black Screen When Sellect Buffs Or Images In Game was marked as the answer   
    Try to check DirectX installation from official web installer. Try to install requires C++ Libraries for client. Try to run l2.exe in compatible mode with previous OS version (e.g. for Win10 use Win7 compatible mode).  
  8. Rootware's post in how to change color on player.sendMessage? was marked as the answer   
    As i know a message color specified in 4 bytes values (R G B and transparency) inside systemmsg-e.dat. Server side can't handle the colors except if you will change chat type of message. But it will another story.
  9. Rootware's post in l2jacis inverntor bug was marked as the answer   
    If you want change stackable type for item then you need make 2 steps:
     
    1. Server side - setup for current item the flag is_stackable in TRUE.
    2. In client inside etcitemgrp.dat change stackable column value from 0 to 1.
     
    If you need many items for changing then better write the script which will parse files and change all necessary places automatically.
  10. Rootware's post in Looking for L2 CLassic Developer. was marked as the answer   
    The better than this Classic pack you never find. Even if you hire the developers team they not fixes all bugs. Use as is, better only L2OFF.
  11. Rootware's post in Add more Starting items using SQL Tables was marked as the answer   
    You need into "char_templates.sql" add new rows like itemX for additional more starting items than 5 existing.
     
    At this moment uses 5 columns:
    `items1` int(4) NOT NULL default '0', `items2` int(4) NOT NULL default '0', `items3` int(4) NOT NULL default '0', `items4` int(4) NOT NULL default '0', `items5` int(10) NOT NULL default '0',  
    Just add more rows (e.g. "item6", "item7", etc) and after you can manage what the char template will use more items. 
     
    Inside CharTemplateTable.java you need to change this line
    for (int x = 1; x < 6; x++) to
    for (int x = 1; x < ITEMS_COUNT_PLUS_ONE; x++)  
  12. Rootware's post in Chat log not being created was marked as the answer   
    Your log.cfg contains necessary properties for log4j but don't uses in L2J Frozen. You need get him content and put into logger.properties file. This file uses as property definer for log4j.
     
    Or rename logger.properties to logger.properties.bak and rename log.cfg to logger.properties. for check my assuming.
     
    I think it will work.
  13. Rootware's post in Client Icons Question was marked as the answer   
    Check L2IU_CT1.utx via UTPT program.
  14. Rootware's post in Need help keeping the color aCis Interlude was marked as the answer   
    Create in characters table 2 new string rows for storing name and title colors with default values for setup and reset colors. Add 2 new fields in Player class for storing color properties. Add into Appearance class 2 new field for usage custom colors (temporary for event or another cases w/o saving in DB). If colors in Appearance matches with defauls then call Player's class colors otherwise use Appearance color. Add usage in CharInfo and UserInfo colors via Appearance class. Add Color manager. Profit.
  15. Rootware's post in .vote Command was marked as the answer   
    DELETE FROM vote_system WHERE value_type=2; Execute this query from Navicat or phpMyAdmin.
    package handler.voicecommands; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import l2f.commons.util.Rnd; import l2f.gameserver.Config; import l2f.gameserver.ThreadPoolManager; import l2f.gameserver.database.DatabaseFactory; import l2f.gameserver.handler.voicecommands.IVoicedCommandHandler; import l2f.gameserver.handler.voicecommands.VoicedCommandHandler; import l2f.gameserver.model.GameObjectsStorage; import l2f.gameserver.model.Player; import l2f.gameserver.network.serverpackets.Say2; import l2f.gameserver.network.serverpackets.components.ChatType; import l2f.gameserver.scripts.Functions; import l2f.gameserver.scripts.ScriptFile; import l2f.gameserver.utils.BatchStatement; import l2f.gameserver.vote.VoteRead; public class RewardVote implements IVoicedCommandHandler, ScriptFile { private static enum ValueType { ACCOUNT_NAME, IP_ADRESS } private static final String[] COMMANDS_LIST = new String[] { "vote", "getreward", "getvote", "votereward", "voteme", "fuckvote", "rewardget", "reward", "votereward"}; // Rewards private static final int[][] BLESSED_ENCHANTS_CATEGORY = { { 6673, 1 } }; private static final int[] PERMANENT_CATEGORY = { 37004, // Vote Rune 1 }; private static final int[][] MISC_CATEGORY = { { 37007, 1 }, { 37007, 2 }, { 37007, 3 } }; private static final double[][] RANDOM_CATEGORY = { { 6577,// 1 Blessed Enchant Weapon S 1, 0.05 }, { 6578,// 1 Blessed Enchant Armor S 1, 0.05 }, { 13071,// 1 Red Soul Crystal - Stage 16 1, 0.05 }, { 13072,// 1 Blue Soul Crystal - Stage 16 1, 0.05 }, { 13073,// 1 Green Soul Crystal - Stage 16 1, 0.155 }, { 10480,// 1 Red Soul Crystal - Stage 15 1, 0.155 }, { 10481,// 1 Blue Soul Crystal - Stage 15 1, 0.155 }, { 10482,// 1 Green Soul Crystal - Stage 15 1, 0.566 }, { 14169,// 1 Top Life Stone Level 84 1, 1.25 }, { 14168,// 1 High Life Stone Level 84 1, 2.0 }, { 13073,// 1 Giant's Codex - Mastery 1, 3.333 }, { 959,// 1 Enchant Weapon S 1, 3.0 }, { 6622,// 1 Giant's Codex 3, 8.0 }, { 960,// 1 Enchant Armor S 1, 8.0 }, { 9552,// 1 Fire Crystal 1, 8.0 }, { 9553,// 1 Water Crystal 1, 8.0 }, { 9556,// 1 Dark Crystal 1, 8.0 }, { 9557,// 1 Holy Crystal 1, 8.0 }, { 9554,// 1 Earth Crystal 1, 8.0 }, { 9555,// 1 Wind Crystal 1, 8.0 }, { 9546,// 1 Fire Stone 2, 20.0 }, { 9547,// 1 Water Stone 2, 20.0 }, { 9548,// 1 Earth Stone 2, 20.0 }, { 9549,// 1 Wind Stone 2, 20.0 }, { 9550,// 1 Dark Stone 2, 20.0 }, { 9551,// 1 Holy Stone 2, 100.0 }, }; private static final long VOTE_COMMAND_REUSE = 1 * 3 * 1000L; // 5 Minutes private static final long VOTE_PENALTY = 12 * 60 * 60 * 1000L; // 12 Hours public static final Map<Integer, Long> _votePlayerReuses = new ConcurrentHashMap<Integer, Long>(); public static final Map<String, Long> _accountPenalties = new ConcurrentHashMap<String, Long>(); public static final Map<String, Long> _ipPenalties = new ConcurrentHashMap<String, Long>(); public RewardVote() { // If there is a set vote reward message, schedule it if(!Config.VOTE_REWARD_MSG.isEmpty()) ThreadPoolManager.getInstance().scheduleAtFixedRate(new VoteAnnounceTask(), 1 * 60 * 1000, Config.ANNOUNCE_VOTE_DELAY * 1000); // Restore from the db all the penalties of the votes, it doesn't matter if its 0. So we can do it only once at start Connection con = null; PreparedStatement statement = null; ResultSet rset = null; try { con = DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT * FROM vote_system"); rset = statement.executeQuery(); while(rset.next()) { final String value = rset.getString("value"); final long time = rset.getLong("penalty_time"); switch(rset.getInt("value_type")) { // Account Name case 0: { _accountPenalties.put(value, time); break; } // Ip Address case 1: { _ipPenalties.put(value, time); break; } } } } catch(Exception e) {} } @Override public boolean useVoicedCommand(String command, Player activeChar, String params) { if(command.equalsIgnoreCase("vote")) { try { // No connection, no vote if(activeChar.getNetConnection() == null) return false; if(!Config.ENABLE_VOTE) { activeChar.sendMessage("Voting is currently disabled!"); return false; } // Min lvl 40 if(activeChar.getLevel() < 1) { activeChar.sendMessage("You need to be at least level 1 to use this command."); return false; } final long currentTime = System.currentTimeMillis(); // Synerge - Check if voting is not blocked. If a web connection ocurrs, then the vote will be block for everyone for 15 minutes if(VoteRead._siteBlockTime >= currentTime) { activeChar.sendMessage("There are problems with the connection to the vote site, so it has been disabled for some minutes. Try again later"); return false; } // Check player vote reuse if(activeChar.getAccessLevel() < 1 && _votePlayerReuses.containsKey(activeChar.getObjectId())) { if(_votePlayerReuses.get(activeChar.getObjectId()) > currentTime) { activeChar.sendMessage("You can use this command only once every 5 minutes."); return false; } } _votePlayerReuses.put(activeChar.getObjectId(), currentTime + VOTE_COMMAND_REUSE); // Getting IP of client. final String IPClient = activeChar.getIP(); // Check the penalties of the player to see if he can vote again if(!checkPlayerPenalties(activeChar, IPClient, true)) return false; // Return 0 if he didnt voted. Date when he voted on website /*final long dateHeVotedOnWebsite = VoteRead.checkVotedIP(IPClient); if(dateHeVotedOnWebsite < 1) { activeChar.sendMessage("To claim reward, you need to vote on all banners!"); return false; }*/ if (!hasVoted(activeChar)) { activeChar.sendMessage("To claim reward, you need to vote!"); return false; } // Add the vote penalty to the player addNewPlayerPenalty(activeChar, IPClient); // Give the rewards giveRewards(activeChar); activeChar.sendMessage("Successfully rewarded."); return true; } catch(Exception e) { e.printStackTrace(); } } return false; } // Thread to send to all players that didn't voted yet to vote for the server protected static class VoteAnnounceTask implements Runnable { @Override public void run() { if(Config.VOTE_REWARD_MSG.isEmpty()) return; final Say2 announce = new Say2(0, ChatType.ANNOUNCEMENT, "", Config.VOTE_REWARD_MSG); final Iterable<Player> world = GameObjectsStorage.getAllPlayersForIterate(); for(Player player : world) { if(player == null || player.getNetConnection() == null) continue; // No offline or store mode if(player.isInStoreMode()) continue; // If the player has an active penalty means that he already voted if(!checkPlayerPenalties(player, player.getIP(), false)) continue; player.sendPacket(announce); } } } /** * Gives to the player all the vote rewards * * @param player */ protected static void giveRewards(Player player) { // First give the permanent item Functions.addItem(player, PERMANENT_CATEGORY[0], PERMANENT_CATEGORY[1], "VoteReward Permanent"); // First give the vote main random reward final int[] reward = getReward(); Functions.addItem(player, reward[0], reward[1], "VoteReward Main"); // Then give some random rewards for(double[] item : RANDOM_CATEGORY) { if(Rnd.chance(item[2])) { Functions.addItem(player, (int) item[0], (long) item[1], "Vote Random Reward"); return; } } } /** * Puts new penalties for the account name, ip and hwid of the player after he succesfully voted * * @param activeChar * @param IPClient */ protected static void addNewPlayerPenalty(Player activeChar, String IPClient) { final long newPenalty = System.currentTimeMillis() + VOTE_PENALTY; _accountPenalties.put(activeChar.getAccountName(), newPenalty); _ipPenalties.put(IPClient, newPenalty); // Also store the penalties in the db Connection con = null; PreparedStatement statement = null; try { con = DatabaseFactory.getInstance().getConnection(); statement = BatchStatement.createPreparedStatement(con, "REPLACE INTO vote_system(value_type, value, penalty_time) VALUES (?, ?, ?)"); final String[] values = new String[] { activeChar.getAccountName(), IPClient}; for(ValueType type : ValueType.values()) { statement.setInt(1, type.ordinal()); statement.setString(2, values[type.ordinal()]); statement.setLong(3, newPenalty); statement.addBatch(); } statement.executeBatch(); } catch(Exception e) {} } /** * @param activeChar * @param IPClient * @param sendMessage * @return Returns true if the player doesn't have an active penalty after voting */ protected static boolean checkPlayerPenalties(Player activeChar, String IPClient, boolean sendMessage) { final long accountPenalty = checkPenalty(ValueType.ACCOUNT_NAME, activeChar.getAccountName()); final long ipPenalty = checkPenalty(ValueType.IP_ADRESS, IPClient); final int penalty = (int) ((Math.max(accountPenalty, ipPenalty) - System.currentTimeMillis()) / (60 * 1000L)); if(penalty > 0) { if(sendMessage) { if(penalty > 60) { activeChar.sendMessage("You can vote only once every 12 hours. You still have to wait " + (penalty / 60) + " hours " + (penalty % 60) + " minutes."); } else { activeChar.sendMessage("You can vote only once every 12 hours. You still have to wait " + penalty + " minutes."); } } return false; } return true; } /** * @param type * @param value * @return Returns the penalty of a particular type and value if it exists */ private static long checkPenalty(ValueType type, String value) { switch(type) { case ACCOUNT_NAME: { if(_accountPenalties.containsKey(value)) return _accountPenalties.get(value); break; } case IP_ADRESS: { if(_ipPenalties.containsKey(value)) return _ipPenalties.get(value); break; } } return 0; } public static int[] getReward() { return MISC_CATEGORY[Rnd.get(MISC_CATEGORY.length)]; } @Override public void onLoad() { VoicedCommandHandler.getInstance().registerVoicedCommandHandler(this); } @Override public void onReload() { // } @Override public void onShutdown() { // } @Override public String[] getVoicedCommandList() { return COMMANDS_LIST; } // New Topzone Vote Reward System (API) public String getApiEndpoint(Player player) { return String.format("https://api.l2topzone.com/v1/vote?token=%s&ip=%s", Config.VOTE_TOPZONE_APIKEY, player.getIP()); } public boolean hasVoted(Player player) { try { String endpoint = getApiEndpoint(player); if (endpoint.startsWith("err")) return false; String voted = grabValue(getApiResponse(endpoint), "\"isVoted\":", ",\"serverTime\""); return tryParseBool(voted); } catch (Exception e) { player.sendMessage("Something went wrong. Please try again later."); e.printStackTrace(); } return false; } public boolean tryParseBool(String bool) { if (bool.startsWith("1")) return true; CharSequence cs = "voteTime"; if (bool.contains(cs)) { //System.out.println("Contains \"voteTime\""); String newbool = bool.substring(0, 4); //System.out.println("Bool to pass: " + newbool); return Boolean.parseBoolean(newbool); } return Boolean.parseBoolean(bool.trim()); } public String getApiResponse(String endpoint) { StringBuilder stringBuilder = new StringBuilder(); try { URL url = new URL(endpoint); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.addRequestProperty("User-Agent", "Mozilla/4.76"); connection.setRequestMethod("GET"); connection.setReadTimeout(5 * 1000); connection.connect(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { String line = null; while ((line = reader.readLine()) != null) { stringBuilder.append(line + "\n"); } } connection.disconnect(); System.out.println(stringBuilder.toString());// return stringBuilder.toString(); } catch (Exception e) { System.out.println("Something went wrong in VoteBase::getApiResponse"); e.printStackTrace(); return "err"; } } private static String grabValue(String str, String open, String close) { final int INDEX_NOT_FOUND = -1; if (str == null || open == null || close == null) { return null; } int start = str.indexOf(open); if (start != INDEX_NOT_FOUND) { int end = str.indexOf(close, start + open.length()); if (end != INDEX_NOT_FOUND) { return str.substring(start + open.length(), end); } } return null; } }  
  16. Rootware's post in Bracalet condition was marked as the answer   
    The pointless to make something what already exists in L2.
     
    Item:
    <item id="9589" type="Armor" name="Iron Bracelet"> <set name="icon" val="icon.etc_rbracelet_c_i00" /> <set name="default_action" val="EQUIP" /> <set name="bodypart" val="rbracelet" /> <set name="immediate_effect" val="true" /> <set name="crystal_count" val="72" /> <set name="crystal_type" val="C" /> <set name="material" val="SILVER" /> <set name="weight" val="150" /> <set name="price" val="216000" /> <set name="item_skill" val="3322-1" /> </item>  
    Skill:
    <skill id="3322" levels="1" name="Brass Bracelet"> <!-- Confirmed CT2.5 --> <set name="icon" val="icon.etc_rbracelet_c_i00" /> <set name="magicLvl" val="20" /> <set name="operateType" val="P" /> <set name="targetType" val="SELF" /> <for> <effect name="TalismanSlot"> <param slots="1" /> </effect> </for> </skill> If you really need new one item with one slot then make new item by posted example and specify this skill ID.
  17. Rootware's post in [AuthD] ServerList packet was marked as the answer   
    The display of this information is affected by this parameter in L2.INI.
    [URL] UseAuthUserData=True Thanks to me.
  18. Rootware's post in error java was marked as the answer   
    Pointless to add check for not null, because condition throw up TRUE after first null check if object null.
     
    This will always throw up NullException for Fake Players.
     
    receiver.getClient().isDetached() The reason - client is null.
     
    if (receiver == null || (receiver.getClient() != null && receiver.getClient().isDetached() && !(receiver instanceof FakePlayer))) Something like this.
  19. Rootware's post in Problem With Hauthd was marked as the answer   
    Wrong server name. In this config IP not uses. Example:
    Server = SERVER\SQLEXPRESS
  20. Rootware's post in Dyes Icons was marked as the answer   
    Icon.utx?
  21. Rootware's post in Other Language On Npcs Html was marked as the answer   
    Add to player instance the new ENUM variable like _language and use him as suffix for pathway of HTML page/folder. As default use EN and add command for calling HTML page for changing language.
     
    Is not so hard, just many copy/paste work. In the end you got core supporting for any amount of language's HTML.
  22. Rootware's post in Critical Error Observer Olympiad was marked as the answer   
    If you want to fix it, then you need to get aCis source and compare olympiad system on both sources. Or replace fully this system from aCis.
  23. Rootware's post in L2Text Files was marked as the answer   
    L2 File Editor opens this files perfect. Use 111 encoding and UTF encoding.
  24. Rootware's post in Editing Community Board Frame was marked as the answer   
    BoardWnd.
  25. Rootware's post in Interlude S80 was marked as the answer   
    Use The Kamael client as basis for your Interlude server.
×
×
  • Create New...