Jump to content

melron

Legendary Member
  • Posts

    1,403
  • Credits

  • Joined

  • Last visited

  • Days Won

    32
  • Feedback

    0%

Everything posted by melron

  1. You can add this one in method onEnter of L2TownZone 'instance'.setInsideZone(ZoneId.NO_STORE, true); and in method onExit turn it to false. just add your checks for the specific town via config probably
  2. You need client modification to do that. Java cant get any info about hwid. If the client will give u the hwid then its simple , its like a string compare .equals(hwid)
  3. npc_%objectId%_exc_multisell is enough ... Reported.
  4. yea thats corerct . i mentioned the wrong Evie's code
  5. he wants the vesper +5 but not as constant. He wants the dynasty enchant
  6. If you think that the next cases are the same well yeah we are saying the same :D exchange X weapon for Z weapon with constant enchant value (Ex. +5) exchange X weapon with Y enchant value for Z weapon with the Y enchant value of the X's enchant
  7. Melrons gonna love! Paranoic asked for a code that will exchange a db into AM but the AM is gonna take the db's enchantment value. not the visual thing or any other parameter in the xml
  8. @Evie Frye Take a look again what code you paste then sit down, take a beer, and start realize if your code is the code that paranoic asked for p.s Haters gonna hate!
  9. @Evie Frye the guy didnt ask for new assist system but asked for a fix in this one (even if it is not good) so i answered to this one. Feel free to sell your services to him :D kisses
  10. Check the method setPvpKills and getPvpKills maybe you forgot to delete some custom things inside Add a check for same player like if (partymate == this) continue; Remove break, you dont need this about the pvp value issue, probably when you compiled your code was like this if (Rnd.nextInt(100) < 100) { partymate.setPvpKills(getPvpKills() + 1); break; }
  11. // Send messages to other party members about reward if (item.getCount() > 1) broadcastToPartyMembers(target, SystemMessage.getSystemMessage(SystemMessageId.S1_OBTAINED_S3_S2).addPcName(target).addItemName(item).addItemNumber(item.getCount())); else if (item.getEnchantLevel() > 0) broadcastToPartyMembers(target, SystemMessage.getSystemMessage(SystemMessageId.S1_OBTAINED_S2_S3).addPcName(target).addNumber(item.getEnchantLevel()).addItemName(item)); else broadcastToPartyMembers(target, SystemMessage.getSystemMessage(SystemMessageId.S1_OBTAINED_S2).addPcName(target).addItemName(item));
  12. can you show us what exactly you did?
  13. 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; }
  14. 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
  15. 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.");
  16. 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
  17. 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
  18. what this one supposed to do? Increase pvp in supporter class? if yes replace p.getPvpKills(); with this p.setPvpKills(p.getPvpKills() +1);
  19. melron

    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
  20. 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
  21. 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.
  22. 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");
×
×
  • Create New...