Jump to content

melron

Legendary Member
  • Posts

    1,399
  • Credits

  • Joined

  • Last visited

  • Days Won

    28
  • Feedback

    0%

Community Answers

  1. melron's post in help geticon was marked as the answer   
    IconTable.getInstance().getIcon(<item-id>);  
  2. melron's post in help only in pvp zone reward was marked as the answer   
    if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CustomPvPZone)) pvpReward();  
     
    Go ahead
  3. melron's post in Most akward problem. was marked as the answer   
    You are not probably looking at the right table. The thing that the code is using a specific table, doesn't mean you have to look only there. And again, does your sql query contains any 'join' word or does it run another instance of "select from where" as a parameter to run a query?
     
  4. melron's post in check if player.isDead() method was marked as the answer   
    You don't have to code anything inside the zone's method since the feature is about the player instance. You could make a manager to handle all these actions but this is just another case.
     
    Lets begin about the basics. The zone, should only call a method in the player instance without any check for dead/alive since this call will be executed inside of Zone#onDieInside.
    So,
    @Override protected void onDieInside(final L2Character character) { + final L2PcInstance player = character.getActingPlayer(); + if (player == null) + return; + + if (!Config.revive) + return; + + player.startAutoReviveTask(); } @Override  
     
    The player instance now will handle the next actions by itself.
    The concept is:
    Before start the task scheduler, you should check if the speficic scheudler is already running. When the scheduler fires the runnable, you should just check if the player is dead or not. If the player will be revived without the auto revive task, just cancel the auto revive. So,
     
    Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== @@ -15415,6 +15469,7 @@ public void doRevive() { super.doRevive(); + resetAutoReviveTask(); updateEffectIcons(); sendPacket(new EtcStatusUpdate(this)); _reviveRequested = 0; @@ -19644,4 +19705,41 @@ _currentPetSkill = new SkillDat(currentSkill, ctrlPressed, shiftPressed); } + // The task + private ScheduledFuture<?> _autoReviveTask = null; + + public void startAutoReviveTask() + { + // Before initiate the auto revive task, check if another scheduler is active + resetAutoReviveTask(); + + // Start the task + _autoReviveTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> doAutoRevive(), TimeUnit.SECONDS.toMillis(Config.revive_delay)); + } + + private void resetAutoReviveTask() + { + // If is not running, do nothing + if (_autoReviveTask == null) + return; + + _autoReviveTask.cancel(true); + _autoReviveTask = null; + } + + private void doAutoRevive() + { + // Check for any possible scenario if the player is alive + if (!isDead()) + return; + + doRevive(); + heal(); + teleToLocation(Rnd.get(Config.spawn_loc), false); + } + + private void heal() + { + // Heal the instance + }  
     
    And the last thing, get the Rnd#get which is generic from aCis sources which is returning a random element of the given list class as parameter.
     
    Index: head-src/com/l2jfrozen/util/random/Rnd.java =================================================================== --- head-src/com/l2jfrozen/util/random/Rnd.java (revision 1118) +++ head-src/com/l2jfrozen/util/random/Rnd.java (working copy) @@ -23,7 +23,19 @@ */ public final class Rnd { + + /** + * Returns a randomly selected element taken from the given array. + * @param <T> type of array elements. + * @param array an array. + * @return a randomly selected element. + */ + public static final <T> T get(T[] array) + { + return array[get(array.length)]; + } +  
    With this version of Rnd#get, you can do this:
    teleToLocation(Rnd.get(Config.spawn_loc), false); instead of 
    int[] loc = Config.spawn_loc[Rnd.get(Config.spawn_loc.length)]; teleToLocation(loc[0]+Rnd.get(-Config.radius,Config.radius), loc[1]+Rnd.get(-Config.radius,Config.radius), loc[2]);  
  5. melron's post in mass create per ip was marked as the answer   
    That was it.
    No, create the next method
    private boolean isClientOk(L2PcInstance player) { try { player.getClient().getConnection().getInetAddress().getHostAddress(); } catch (Exception e) { return false; } return true; }  
    and then, change this line
    final Collection<L2PcInstance> players = L2World.getInstance().getAllPlayers();  
    to
    final Collection<L2PcInstance> players = L2World.getInstance().getAllPlayers().stream().filter(p -> isClientOk(p)).collect(Collectors.toList());  
  6. melron's post in Error with java L2j Acis was marked as the answer   
    you tried to compile with Java 11 and tried to run it with Java 8.
     
    45 = Java 1.1 46 = Java 1.2 47 = Java 1.3 48 = Java 1.4 49 = Java 5 50 = Java 6 51 = Java 7 52 = Java 8 53 = Java 9 54 = Java 10 55 = Java 11 56 = Java 12 57 = Java 13  
  7. melron's post in extra " was marked as the answer   
    "<tr><td align=center><button value=\"" + category.getName() + "\" action=\"bypass -h npc_" + getObjectId() + "_category " + category.getId() + "\" width=204 height=20 back=\"Button.but1\" fore=\"Button.but2\"></td></tr>"  
  8. melron's post in Query SQL was marked as the answer   
    if in table characters the field name is 'account_name'
    and in table accounts the field name is 'login':
     
    UPDATE characters c, accounts a SET c.botprev_fail_account = a.botprev_fail_account WHERE c.account_name = ? and c.account_name = a.login;  
    Else, edit the query and set the right field names
  9. melron's post in FENCING was marked as the answer   
    if you are using aCis:
     
    pastebin
     
    log with your gm and spawn fences , they will be stored to db.
    (in case of delete some of them use //listfence and click the fence you want)
  10. melron's post in Remaining Time on Screen/ Event countdown was marked as the answer   
    code
     
     
     
    take what you need and make it work
     
    edit: I made it in town zone for example... you dont have to c/p that for your event
  11. melron's post in gameserver error on killing pk was marked as the answer   
  12. melron's post in ArmorSets 16 question code was marked as the answer   
    Well, like @Solomun said you could test it wihtout write your finally code. 
     
    onTopic:
    It wont work because your checks about enchant value are wrong.
    If you can see for method isEnchanted6() the checks are 
    item.getEnchantLevel() > 5 by default, when you have a set 6,6,6,6 or 7,8,6,10 is the same and the method isEnchanted6() will return true.
     
    Your check is > 15 (if you let this method as the last one is ok , but if you will add more like isEnchanted20() , isEnchanted25() you have to edit your checks ) for example if the method is isEnchanted15() and there is another method isEnchanted20() you could code it like:
    if (legsItem != null && legsItem.getEnchantLevel() > 15 && legsItem.getEnchantLevel() < 20)  
    i believe you got my point
  13. melron's post in Base Stats was marked as the answer   
    my eyes are bleeding with all those answers.
     
    @InFocus
    DO NOT COPY THE VALUES. read first.
     
    This value will increase your Attack Speed by 5%
    <mul order="0x30" stat="pAtkSpd" val="1.05" />  
    This value will increase your Attack Speed by 105%
    <mul order="0x30" stat="pAtkSpd" val="2.05" />  
     
    This value will increase your Attack Speed by 205%
    <mul order="0x30" stat="pAtkSpd" val="3.05" />  
    Guess what you have to put to get 250%.
  14. melron's post in help on import javolution.text.TypeFormat; l2jacis was marked as the answer   
    Im not sure about what TypeFormat does, but i think stands there to catch NumberFormatException ...
    in example:
     
    public static void main(String[] args) { String one = "1f"; System.out.println("TypeFormat : " + TypeFormat.parseInt(one)); System.out.println("Integer : " + Integer.parseInt(one)); } static class TypeFormat { public static int parseInt(String val) { try { return Integer.parseInt(val); } catch (NumberFormatException e) { return 0; } } }  

  15. melron's post in Droplist was marked as the answer   
    Select your database, Click on the icon:

     
    then press 'New Query' tool,
    make sure the new tab of the query will have your database name after the @ like this

    (sys is my db)
     
    run the command by clicking Run tool , be happy
  16. melron's post in Update Kill in Title aCis was marked as the answer   
    it is not a bug. You are missing broadcastUserInfo() when you increase the event kills.
     
    .... .... activeChar.increaseTvTKills(); +activeChar.broadcastUserInfo(); .... ....  
  17. melron's post in Problem in code was marked as the answer   
    you had 2 font colors while closing only 1
    if (delay <= System.currentTimeMillis()) sb.append(name + ": <font color=\"00ff00\">Is Alive!</font><br1>"); else { sb.append(name + ": <font color=\"FF0000\">" + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(delay) + "</font><br1>"); }  
  18. melron's post in L2 ro team fandc help!! was marked as the answer   
    You can't fix anything with just saying please help. You have to find what they did and get these stats. What was the last thing? It can be even in arcane power bug with subclasses or another 2762526 cases..
     
    Check what custom you have edited about stats , check armorsets , check malaria and about 62627 things... You don't help like that
  19. melron's post in Error in instances was marked as the answer   
    c/p an existing one and edit the important parts. there is something wrong with your structure there
  20. melron's post in Προβλημα με Eclipse was marked as the answer   
    right click in build.xml -> run as -> external tools configurations -> select the tab 'JRE' -> do the same thing there (jdk not jre)
  21. melron's post in frozen isInsideZone() was marked as the answer   
    it is 'hardcoded'. for better performance change it by urself.
     
    8 |= 2 is like 8 = 8 | 2 .  = 10 (see that like 8+= 2)
     
    it means
       1000 (binary)
    |  0010 (binary)
      ----------
       1010 (binary)= 10 (decimal)
     
    | is bitwise OR
     
    possible results: 0,1 . return 1 as result if either of its inputs are 1 and will produce a 0 output if both of its inputs are 0.
     
    see this
     
    0     0     =     0
    0     1     =     1
    1     0     =     1
    1     1     =     1
     
     
     
    8 & 2 = 0 .
    it means
        1000 (binary)
    &  0010 (binary)
        ---------
        0000 (binary)= 0 (decimal)
     
    & is bitwise AND.
     
    possible results : 0,1. to get 1 as result both of the bits must be 1. otherwise the result will be 0.
     
    see this:
     
    0     0     =     0
    0     1     =     0
    1     0     =     0
    1     1     =     1
     
     
     
     
    8 ^= 2  is like 8 = 8 ^ 2 . = 10
    it means
       1000 (binary)
    ^  0010 (binary)
       ---------
        1010 (binary) = 10 (decimal)
     
    ^ is a bitwise XOR
     
    results 0,1. to get 1 as result must have only 1 of the bits the value 1.
     
    see this:
     
     
    0     0     =     0
    0     1     =     1
    1     0     =     1
    1     1     =     0
     
    One live example:
     
    you are entering in oly zone.
     
    setIsInsideZone(ZONE_OLY);
    _currentZones from 0 will be 1000000000000
     
    isInsideZone(ZONE_MOTHERTREE) 
    ZONE_MOTHERTREE = 0000000001000
     
    so... to get the result 1 of every pair , must both bits have value 1...  the result :
     
         4096
     &         8
    ---------------
    0
     
     
         1000000000000 (binary) = 4096 (dec)
    &   0000000001000 (binary) = 8 (dec)
    ------------------------------------
          0000000000000 (binary) = 0 (dec) 
     
    isInsideZone:
    return (_currentZones & zone) != 0;  
  22. melron's post in Back Button was marked as the answer   
    convert all html from java into files (for many reasons) and then create your own method to handle byasses. see onBypassFeedBack of your instance how it works and make your own
    else if (command.startsWith("chat") then add your html . there are many examples for this one.
     
    in case you dont want to convert htmls you have to create methods that returning the html as a String. getHtml("data/donate/shop/dshop.htm")
     
    and on this getHtml() you have to create your own html via string builder and finally return it as string (sb.toString()). 
  23. melron's post in Random Respawn loc of monster but check how was marked as the answer   
    Spawn.java edit the line where the spawn is getting x,y and add your values.
    ... + (Rnd.nextBoolean() ? value : 0) is enough
  24. melron's post in L2OFF Like autopickup was marked as the answer   
    Well probably you did a mistake. its exactly 2 new lines and 2 booleans in doPickupItem superclass + pickupMe :D
     
    @HowardStern
     
    try this one:
    ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/model/actor/Attackable.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/Attackable.java (revision 3) +++ java/net/sf/l2j/gameserver/model/actor/Attackable.java (working copy) @@ -1084,7 +1084,11 @@ { // Check if the autoLoot mode is active if ((isRaid() && Config.AUTO_LOOT_RAID) || (!isRaid() && Config.AUTO_LOOT)) - player.doAutoLoot(this, item); // Give this or these Item(s) to the Player that has killed the L2Attackable + { + ItemInstance itemInfo = dropItem(player, item); + ThreadPool.schedule(() -> player.doPickupItem(itemInfo, true), 350); + } + else dropItem(player, item); // drop the item on the ground ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java (revision 3) +++ java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java (working copy) @@ -972,10 +972,12 @@ * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _objects of World.</B></FONT><BR> * <BR> * @param player Player that pick up the item + * @param ignorePackets TODO */ - public final void pickupMe(Creature player) + public final void pickupMe(Creature player, boolean ignorePackets) { - player.broadcastPacket(new GetItem(this, player.getObjectId())); + if (!ignorePackets) + player.broadcastPacket(new GetItem(this, player.getObjectId())); // Unregister dropped ticket from castle, if that item is on a castle area and is a valid ticket. final Castle castle = CastleManager.getInstance().getCastle(player);  
    ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/model/actor/instance/Player.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/Player.java (revision 5) +++ java/net/sf/l2j/gameserver/model/actor/instance/Player.java (working copy) @@ -3212,7 +3210,7 @@ * @param object The ItemInstance to pick up */ @Override - public void doPickupItem(WorldObject object) + public void doPickupItem(WorldObject object, boolean ignorePackets) { if (isAlikeDead() || isFakeDeath()) return; @@ -3231,9 +3229,11 @@ ItemInstance item = (ItemInstance) object; // Send ActionFailed to this Player - sendPacket(ActionFailed.STATIC_PACKET); - sendPacket(new StopMove(this)); - + if (!ignorePackets) + { + sendPacket(ActionFailed.STATIC_PACKET); + sendPacket(new StopMove(this)); + } synchronized (item) { if (!item.isVisible()) @@ -3276,7 +3276,7 @@ item.removeDropProtection(); // Remove the ItemInstance from the world and send GetItem packets - item.pickupMe(this); + item.pickupMe(this,ignorePackets); // item must be removed from ItemsOnGroundManager if is active ItemsOnGroundTaskManager.getInstance().remove(item); @@ -3323,10 +3323,12 @@ else addItem("Pickup", item, null, true); } - - // Schedule a paralyzed task to wait for the animation to finish - ThreadPool.schedule(() -> setIsParalyzed(false), (int) (700 / getStat().getMovementSpeedMultiplier())); - setIsParalyzed(true); + if (!ignorePackets) + { + // Schedule a paralyzed task to wait for the animation to finish + ThreadPool.schedule(() -> setIsParalyzed(false), (int) (700 / getStat().getMovementSpeedMultiplier())); + setIsParalyzed(true); + } } @Override  
    You will have some errors because you need to change some things
    Do the next things:
     
    go at Player.java and find this line. Just click it in it's name until the background color will become grey @Override public void doPickupItem(WorldObject object) then at eclipse tools click at Refactor -> Change Method Signature (a message will pop up that this method overrides bla bla ... ignore it and continue) then click at Add button in Type box add boolean in Name box add for example ignorePackets and as Default Value add false now go inside of this method (doPickUpMe scroll down until you find item.pickupMe and do exactly the same thing i said above with the refactor by clicking on pickUpMe word..  

  25. melron's post in help was marked as the answer   
    anoikse weapongrp kai me vash to ID tou weapon vres to icon...
×
×
  • Create New...