Jump to content

adenaman

Members
  • Posts

    369
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by adenaman

  1. im using scheduleGeneral not scheduleGeneralAtFixedRate. That is a one time task, when it ends i create another. when new is created the old one is freed because since im the one inserting i know that it will be: [time1][player1][time2][player2]... and i remove it knowing that: - remove (time) - calculate delay for task - remove (player) - send message what do i modify?
  2. coded in a moment, so it may have some errors TakeBreakManager private static final TIME_EACH_BREAK = 7200000; //2h private static List<Object> queue; private static TakeBreakManager instance; private static ScheduledFuture<?> task; private TakeBreakManager(){ queue = new ArrayList<Object>(); } public static TakeBreakManager getInstance(){ if (instance == null) instance = new TakeBreakManager(); return instance; } public void addPlayer(L2PcInstance player){ queue.add(System.getTimeInMillis(), queue.length); queue.add(player, queue.length); if (task == null) start(); } private void start(){ task = ThreadPoolManager.getInstance().scheduleGeneral(new WarnUserTakeBreak(),TIME_EACH_BREAK - (System.getTimeInMillis() - (long) queue.remove[0]) ); //that is 2h - (time that passed) - here we could just use the 2h } protected class WarnUserTakeBreak implements Runnable { @Override public void run() { final L2PcInstance player = (L2PcInstance) queue.remove[0]; if (player.isOnline()) { SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.PLAYING_FOR_LONG_TIME); player.sendPacket(msg); queue.add(System.getTimeInMillis(), queue.length); queue.add(player, queue.length); } if (!queue.isEmpty) task = ThreadPoolManager.getInstance().scheduleGeneral(new WarnUserTakeBreak(), TIME_EACH_BREAK - (System.getTimeInMillis() - (long) queue.remove[0]) ); else task = null; } } the only thing that is missing is to make it syncronized and add removePlayer(), but this is tha main idea Edit: there is no need to create new WarnUserBreak each time, you can create it one time, save it and use it every time, but remove the final from final L2PcInstance player = (L2PcInstance) queue.remove[0];
  3. there might be structure changes from one server version to another that afect you, just try to remove ".values()" or remove and write a dot and press ctr - space and find any function that returns a Collection
  4. Well, what im saying are "individual tasks" but there is only 1 executing at a time, you create one, it ends you create another (the first one does not continue), so there is only 1 task at a time. so we avoid 1 sec ticks in background that each time that they are executed they need to read the whole map that they have with played registred, compare the time of each of them, and sometimes make an action, that is a lot of cpu usage, if we compare it with my idea they rentabilize only if we have 3600 players, well not even because you read the whole map , while i just need to read the first person of the queue. So, my idea uses nearly the same amount of ram than yours (you use map<L2PcInstance, long>, i use queue that it may be implemented with a List<Object> where we write it in pairs L2Pcinstance and its time [this is to avoid using other things and improve the implementation, if you want to you can use any other structure like List<NewClass> NewClass has -L2Pcinstance - long:time, but this will create more allocation because of the reference to the NewClass). Well, it uses the same ram, and much much less cpu, because -its not 1 sec tick even its not needed (a lot of cpu) -its not iterating the whole map, only remove[0] and add/put[queue.length] so it doesnt need to get every value of the map and then compare it
  5. Oh then i think i got wrong the idea, thought that you have something like this: <let thing that TakeBreakTask will announce every 1h form when he logs in to the player> you have a queue with players - empty at start when some1 log in, you add him at your queue and if it was empty before you start a Task in 1h (one time task) 20 min late another player logs in, so you add him at queue but do not modify the task 40 min late (1h for player A) task comes to the end waiting time and do - system.message.whatever."Go eat a KitKat" - add player A to the queue - program next task to the remaining time of the first playeer of the queue (player B) 20 min 20 min late (1h for player B) task execute, and do what it did before This was mine idea, you avoid sorting the map every time that you insert/ or whatever and the task is not executed each 1 sec, only when its needed
  6. DB structure changed a lot from IL to freya, but ofc, if you know what is what there is no big problem to transfer, you can allways set location of all character to the same point, to avoid errors and things like that, of course you need to know what are you doing in every moment. The big problem is all what you have done to the core of the server, because you will need to redo it again, and fix all the errors that you will cause. BTW: did you tryed "//update to Freya"?
  7. just to offtopic a bit: thats a great idea, but you should sort eachtime you add a value at PvpFlagTask map (not for TakeBreak, because they all have the same time [do they?], so is a queue) but for PvpFlag you have different times, if he hit a flaged person he has less flag time (is that true or just some l2j-custom add) so is not a simple queue, and you need to sort a map after each insertion. So i suggest you (if what i said was not wrong) to create 2 types of PvpFlagTask, one for people that hit flaged ppl, so has less time, and other for others, or something like that. PS: WaterTask, is the task that make you dmg, when you are underwhater after a time? it may also have two types, ppl with and without kiss of eva Maybe what im saying is completly wrong, but if not it may help you
  8. sad story Can you at least say what you tried to do and what are the errors. So ppl can say you what else to do
  9. + L2Party party = killer.getParty(); + L2PcInstance kill = (L2PcInstance) killer; + int pointsToAdd = (int) (_fame*0.05/party.getMemberCount()); + that will give you NPE if the killer doesnt have party
  10. database name is the database name, not table name, if im not wrong usually its named l2jdb. Also i dont know php but all this can be reduced if you execute the sql query SELECT COUNT(*) AS people FROM characters WHERE Online='1'
  11. hard disk speed is 1000 times slower than ram memory. And virtual memory means that you will have to move data from ram -> virtual -> ram, thats 2 extra moves, so i dont think is a good idea to do what you say, but you can allways try
  12. that might be the pvp farm protection, are he trying to kill the same person?
  13. If you are trying to say that it cant be done because it needs core, i dont think so. You just need to make a user command (maybe commands) and save/load in db all what you need even you can make thing easier giving only "vote coins" that can be traded in some shop
  14. the easy way to do it is extend a quest. Take this as an example: Matim GK
  15. im not sure if you are trolling or just some 12 yo kid, but we dont help lazy ppl. If you have any problem, try to fix it and fail with it to the point that you dont know what more to do then come here and ask, but if you are too lazy to doing so you can try to ask help in the marketplace not here
  16. any ls/gs error?
  17. MySqlSintaxErrorException means its db problem ... you have wrong db sturcture
  18. def checkConditions(player, new): party = player.getParty() if not party: player.sendPacket(SystemMessage.sendString("You are not currently in a party, so you cannot enter.")) return False if party and party.getMemberCount() < 2: player.sendPacket(SystemMessage.sendString("You cannot enter because there is too less people in your party. Minimum is 4 people.")) return False for partyMember in party.getPartyMembers().toArray(): if partyMember.getLevel() < 78: player.sendPacket(SystemMessage.sendString(partyMember.getName()+"s level is too low and cannot be entered.")) return False if not Util.checkIfInRange(1000, player, partyMember, True) and new: player.sendPacket(SystemMessage.sendString(partyMember.getName()+" is too far away ask him to come here.")) return False return True change that to only check if (player.getLevel < 78) for the second one i have no idea of how to do that, search for some other instances (if you find any in python) and just c/p that
  19. try to ask @ l2frozen forum, since its specific of that pack
  20. spawnlist `periodOfDay` tinyint(1) unsigned NOT NULL DEFAULT '0'
  21. you forgot http://svn.l2jdp.com/trunk/L2J_DataPack/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java and SpiritShot.java there you can see how they are used
  22. it can be done there is a flag named olympiad or something like that in the skills xml, search for it
  23. if your problem is that you dont know how to search, then we cant help you
  24. if (player.getParty().getCommandChannel() == null) if player does not have party then you are trying to do null.getCommandChannel().
  25. that is dll spread, usually you will not do more than 1 dll per system / mananger inside the l2 system (for example 1 for olympiad, 1 for connections to loginserver, ...) and when you will run the server all of them will be needed and loaded. The advantage that that gives to you are shared system dlls Also atm are you having problems with l2j ram / cpu usage? i mean do you rly find a need to increase performance?
×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..