melron

L2J Developer
  • Content count

    689
  • Joined

  • Last visited

  • Days Won

    13
  • Feedback

    0%

melron last won the day on January 4

melron had the most liked content!

Community Reputation

38 Excellent

About melron

  • Rank
    Baron

Contact Methods

  • Skype
    than.gkin

Profile Information

  • Current Mood
    Happy
  • Gender
    Male
  • Country
    Greece
  • Location
    Valley of Saints

Recent Profile Visitors

7,279 profile views
  1. can you show us what exactly you did?
  2. Help Drops

    You just have to calculate item count / players. If you are using acis : Take a look in method distributeItem in Party.java and then check distributeAdena method. public void distributeAdena(Player player, int adena, Creature target) { // We will hold here the players that will be rewarded List<Player> toReward = new ArrayList<>(_members.size()); // We are looping each player in the party for (Player member : _members) { // Checking the maximum range that allowed and the player's adena if (!MathUtil.checkIfInRange(Config.PARTY_RANGE, target, member, true) || member.getAdena() == Integer.MAX_VALUE) continue; // Pass the check so will be rewarded. toReward.add(member); } // After all playes checked we got them in the list // Avoid divisions by 0. so checking for atleast 1 member if (toReward.isEmpty()) return; //lets say we got 4 people that must be rewarded // Calculation for drop in example of 1kk adena's. 1kk / 4 = 250k final int count = adena / toReward.size(); //250k // Adding 250k for each player for (Player member : toReward) member.addAdena("Party", count, player, true); } You can actually c/p that and create your own method. just change this member.getAdena() == Integer.MAX_VALUE and this member.addAdena("Party", count, player, true); with the proper methods. How and where you have to put your new custom method? Party.java method distributeItem. if (item.getId() == 57) { distributeAdena(player, item.getValue(), target); return; } add your own after that something like if (item.getId() == XX) { distributeCustomItem(player, item.getValue(), target); return; }
  3. About the coding style you can just add after the null activechar check the following: if (activeChar.getKnownList().getKnownCharactersInRadius(400).stream().filter(obj -> obj instanceof L2WarehouseInstance).findFirst()) { activeChar.sendMessage("You cannot enchant near warehouse."); return; } About the results.. In order someone to use this code must have old sources that missing important fixes
  4. How many times did you test it? I mean how many kills did you got? As you didnt understood my last suggestion i will explain you: You have to meet 4 conditions in order the party member to get pvp point too. Be in party Config got the user class id user is in combat And 90% chance. Are you sure for all these conditions ? Why you do not simply add debugs to check it? if (getParty() != null) { for (Player player : getParty().getMembers()) { final int rnd = Rnd.get(100); System.out.println("Checking for " + player.getName() + " Conditions..."); System.out.println(Config.Synergy_Class.contains(player.getClassId().getId()) ? "Config missing player's class ID!" : " Config got player's ID!"); System.out.println(player.isInCombat() ? " Player is in combat!" : " Player is not in combat!"); System.out.println(rnd <= 90 ? " Chance is OK!" : " Chance is not OK! ( " + rnd + ""); System.out.println(Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (rnd <= 90) ? " Reward can be given!" : " Cannot give the reward!"); if (Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (rnd <= 90)) { player.sendMessage("You have earned a pvp by supporting " + target.getName()); player.setPvpKills(player.getPvpKills() + 1); } } } else System.out.println("No party found.");
  5. then the location of your code is wrong or you do not meet the conditions. add debugs for each boolean for all these 'if' and check out whats going on
  6. 1) You have to create your own item handler 2) You need somewhere to save the value after the server restart. So add one more field in your items table in db to store the sp 3) if you are using acis , at restore() method of class Inventory add one more field in the statement where is loading the informations of items like : "SELECT object_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, mana_left, time, SP FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data 4) restoreFromDb() method add one more int 'sp' and handle it. example: public static ItemInstance restoreFromDb(int ownerId, ResultSet rs) { ItemInstance inst = null; - int objectId, item_id, loc_data, enchant_level, custom_type1, custom_type2, manaLeft, count; + int objectId, item_id, loc_data, enchant_level, custom_type1, custom_type2, manaLeft, count, sp; long time; ItemLocation loc; try @@ -878,6 +878,7 @@ custom_type2 = rs.getInt("custom_type2"); manaLeft = rs.getInt("mana_left"); time = rs.getLong("time"); + sp = rs.getInt("sp"); } catch (Exception e) { @@ -902,6 +903,7 @@ inst._locData = loc_data; inst._existsInDb = true; inst._storedInDb = true; + inst.setSP(sp, false); // Setup life time for shadow weapons inst._mana = manaLeft; @@ -1262,4 +1264,41 @@ return Integer.compare(item.getObjectId(), getObjectId()); } + + private int SP = 0; + + public int getSP() + { + return SP; + } + + public void setSP(int sp, boolean store) + { + SP = sp; + if (store) + try (Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE items SET sp=? WHERE object_id=?")) + { + ps.setInt(1, getSP()); + ps.setInt(2, getObjectId()); + ps.executeUpdate(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } \ No newline at end of file 5) add the above methods and complete your request in your item handler something like that: @Override public void useItem(Playable playable, ItemInstance item, boolean forceUse) { if (!(playable instanceof Player)) return; Player activeChar = (Player) playable; if (item.getSP() > 0) { activeChar.addExpAndSp(0, item.getSP()); item.setSP(0, true); activeChar.destroyItem("SP", item, null, true); } else if (activeChar.getSp() > 0) { final int charSP = activeChar.getSp(); activeChar.removeExpAndSp(0, charSP); item.setSP(charSP, true); activeChar.sendMessage(charSP + " saved!"); } else activeChar.sendMessage("You do not have enough SP!"); } p.s i didnt test it
  7. what this one supposed to do? Increase pvp in supporter class? if yes replace p.getPvpKills(); with this p.setPvpKills(p.getPvpKills() +1);
  8. L2 Market

    I totally agree. If each user have 1 topic then the title could be as it is in order to write whats the sell stuff
  9. [L2J] L2Devil

    Mate, imagine all the servers everyday posting videos without any update instead of bumping... Bump button stands there for a reason. Note : All BUMP posts (any posts like "bump", "up", videos, etc.) are not allowed anymore and they will be DELETED(To avoid post hunting through this kind of topics). We will warn you & remove your bump replies except if they're referring on updates of your server. If you continue bumping you might get punished by locking/junking your thread. You didnt update any thing. You just posting videos instead of bump. The only bad thing in this case that is good for you is that the mod didnt warned you because look carefully -> We will warn you & remove your bump replies No delay , Both are instant
  10. [L2J] L2Devil

    Well here we are , Dheva.. You are saying that you posted one video every one day instead of bump. Guess what. Bump is there for this reason. By your words, You posted videos to 'bump' your topic with update. Ok . 1st) there wasnt update but a simple video 2) Why you care so much from the momment that the 'posting video' fact - update was successfully made from your side and all the MXC users saw your video at exactly the time you 'bumped' the your topic? Bump is there to pretend ppl to spam like you and increasing post counts and some other reason that you dont have to know. Please take a look in all these servers what they are doing and what they dont. All you have to do is Bump button OR have a post if you dont want the main post, and add there all your updates . When you adding a new update you can use bump button in order ppl can see your update-post updated.
  11. A nice-different feature :) Good to bring back some old shares. About the code use elfo,nightwolf update will be better ;) also you can add 1 null check in elfos code for the item . something like that L2ItemInstance itemToEnchant = activeChar.getInventory().getPaperdollItem(randomInventorySlot); +if (itemToEnchant == null) + return; itemToEnchant.setEnchantLevel(itemToEnchant.getEnchantLevel() + 1); and update the line sendMessage("Your " + ItemTable.getInstance().getTemplate(itemToEnchant.getItemId()).getName() + " has been enchanted by +1 due to your pvp kills"); to sendMessage("Your " + itemToEnchant.getItem().getName() + " has been enchanted by +1 due to your pvp kills");
  12. Help Npc Arrows

    You should look again this guide.. if your chronicle is interlude you need to edit your client. Otherwise <html noscrollbar>