Jump to content

Ο Χάρος

Members
  • Posts

    46
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Ο Χάρος

  1. Να πας να αυνανιστεις :'( δεν ξεκιναω τιποτα.
  2. [GR] Πολλες ωρες για να κανεις το project convert σε java 8 [/GR]
  3. I would date you for that smart answer you wrote but i know u engaged
  4. Let's say you have two projects. First one uses java 7 the second uses java 8. You dont want use vmware neither install and re-install java every 30 minute. What's the best option? If path at enviromental variable change would this work?
  5. So process so far. I did what i wrote. Created new Map, stored each new skill on it. Changed the addSkill from true to false so it wont store individualy at the end of the class i added the storeSkills. The method simply store all L2Skills at once without open 1000 DB con. Still in game 1.5 sec delay like i never changed anything. The method turns out to Finalize after 77 milliseconds. I refer to this method public int giveAvailableSkills(final boolean includedByFs, final boolean includeAutoGet) { long ms = System.currentTimeMillis(); int unLearnable = 0; int skillCounter = 0; List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(this, getClassId(), includedByFs, includeAutoGet); List<L2Skill> skillsForStore = new ArrayList<>(); while (skills.size() > unLearnable) { for (final L2SkillLearn s : skills) { final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel()); if (sk == null || sk.getId() == L2Skill.SKILL_DIVINE_INSPIRATION && !Config.AUTO_LEARN_DIVINE_INSPIRATION && !isGM()) { unLearnable++; continue; } if (getSkillLevel(sk.getId()) == -1) { skillCounter++; } // fix when learning toggle skills if (sk.isToggle()) { final L2Effect toggleEffect = getFirstEffect(sk.getId()); if (toggleEffect != null) { // stop old toggle skill effect, and give new toggle // skill effect back toggleEffect.exit(); sk.getEffects(this, this); } } addSkill(sk, false); //addSkill(sk, true); skillsForStore.add(sk); } skills = SkillTreesData.getInstance().getAvailableSkills(this, getClassId(), includedByFs, includeAutoGet); } storeSkills(skillsForStore, -1); if (Config.AUTO_LEARN_SKILLS && (skillCounter > 0)) { sendMessage("You have learned " + skillCounter + " new skills."); } System.out.println(System.currentTimeMillis() - ms); return skillCounter; } So either the SQL data in Freya is shit as u said or client relative... idk any suggestion or could we implement HikariCP ?B But again if it was SQL slow, it would be captured on the system.out.. it would say 3500 millisecond or something no 35... cause in this berchmark the sql con is included. So it might be client lag? But i tried rotate immidiately after i get the skill list and the L2 respond fine, it rotate perfectly just the char doesnt move and suddedly he move x10 fast to the spot i clicked.
  6. Ok i did. Ill go check in game to see the thread how much time it get sleep until db stuff finish. Thanks for ur help i wouldnt search further if u didn't say the word "DB" . I kinda liked procedures in SQL but the overal structure and coding i dont like it.
  7. I set the addSkill(skill, false); so it won't store each skill individual using DB and bellow i add the skill onto a List and at the end of the code i call this method that i added private void storeSkills(List<L2Skill> newSkills, int newClassIndex) { if (newSkills.isEmpty()) { return; } final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex; try (Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS)) { con.setAutoCommit(false); for (final L2Skill addSkill : newSkills) { ps.setInt(1, getObjectId()); ps.setInt(2, addSkill.getId()); ps.setInt(3, addSkill.getLevel()); ps.setInt(4, classIndex); ps.addBatch(); } ps.executeBatch(); con.commit(); } catch (SQLException e) { } } Which simply open 1 DB c and store all together. But how faster the HikariCP is? Can i upgrade to it? im not sql fan.
  8. I'm not the best in SQL, what u suggest? Maybe instead of open 1 connection for each skill to add all in 1 map and open 1 con and do a for e.t.c ? wouldnt this be faster? Else what ?
  9. Damn it, the addSkill(sk, true); at the code i showed you have SQL relative code pff public L2Skill addSkill(final L2Skill newSkill, final boolean store) { // Add a skill to the L2PcInstance _skills and its Func objects to the // calculator set of the L2PcInstance final L2Skill oldSkill = super.addSkill(newSkill); // Add or update a L2PcInstance skill in the character_skills table of // the database if (store) { storeSkill(newSkill, oldSkill, -1); } return oldSkill; } You were right... damn this fucking SQL. private void storeSkill(final L2Skill newSkill, final L2Skill oldSkill, final int newClassIndex) { int classIndex = _classIndex; if (newClassIndex > -1) { classIndex = newClassIndex; } Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement; if (oldSkill != null && newSkill != null) { statement = con.prepareStatement(UPDATE_CHARACTER_SKILL_LEVEL); statement.setInt(1, newSkill.getLevel()); statement.setInt(2, oldSkill.getId()); statement.setInt(3, getObjectId()); statement.setInt(4, classIndex); statement.execute(); statement.close(); } else if (newSkill != null) { statement = con.prepareStatement(ADD_NEW_SKILL); statement.setInt(1, getObjectId()); statement.setInt(2, newSkill.getId()); statement.setInt(3, newSkill.getLevel()); statement.setInt(4, classIndex); statement.execute(); statement.close(); } else { _log.warning("could not store new skill. its NULL"); } } catch (final Exception e) { _log.log(Level.WARNING, "Error could not store char skills: " + e.getMessage(), e); } finally { L2DatabaseFactory.close(con); } }
  10. This also have a method i didnt see: activeChar.sendMessage("You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName()); But the giveAvailableSkills is just this: public int giveAvailableSkills(final boolean includedByFs, final boolean includeAutoGet) { int unLearnable = 0; int skillCounter = 0; List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(this, getClassId(), includedByFs, includeAutoGet); while (skills.size() > unLearnable) { for (final L2SkillLearn s : skills) { final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel()); if (sk == null || sk.getId() == L2Skill.SKILL_DIVINE_INSPIRATION && !Config.AUTO_LEARN_DIVINE_INSPIRATION && !isGM()) { unLearnable++; continue; } if (getSkillLevel(sk.getId()) == -1) { skillCounter++; } // fix when learning toggle skills if (sk.isToggle()) { final L2Effect toggleEffect = getFirstEffect(sk.getId()); if (toggleEffect != null) { // stop old toggle skill effect, and give new toggle // skill effect back toggleEffect.exit(); sk.getEffects(this, this); } } addSkill(sk, true); } // Get new available skills, some skills depend of previous skills to be available. skills = SkillTreesData.getInstance().getAvailableSkills(this, getClassId(), includedByFs, includeAutoGet); } sendMessage("You have learned " + skillCounter + " new skills."); return skillCounter; } No db relative or flooding with sendMessage or packet flood.
  11. public final L2Skill[] getAllSkills() { if (_skills == null) { return new L2Skill[0]; } return _skills.values().toArray(new L2Skill[_skills.values().size()]); } Map to array
  12. Now im thinking it's stupid cause the method was including in berchmark so any sub-calculations wouldnt again be recorded on system out at sendSkillList.. again i tested it nothing changed.. You're right.. No there is no DB connection involved.. I double check the code. It goes from this: /** * This function will give all the skills that the target can learn at his/her level * @param activeChar: the gm char */ private void adminGiveAllSkills(final L2PcInstance activeChar, final boolean includedByFs) { final L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; } else { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INCORRECT_TARGET)); return; } //Notify player and admin activeChar.sendMessage("You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName()); player.sendSkillList(); } To this public void sendSkillList() { sendSkillList(this); } To this public void sendSkillList(final L2PcInstance player) { boolean isDisabled = false; final SkillList sl = new SkillList(); if (player != null) { for (final L2Skill s : player.getAllSkills()) { if (s == null) { continue; } if (s.getId() > 9000 && s.getId() < 9007) { continue; } if (_transformation != null && !containsAllowedTransformSkill(s.getId()) && !s.allowOnTransform()) { continue; } if (player.getClan() != null) { isDisabled = s.isClanSkill() && player.getClan().getReputationScore() < 0; } boolean isEnchantable = SkillTable.getInstance().isEnchantable(s.getId()); if (isEnchantable) { final L2EnchantSkillLearn esl = EnchantGroupsTable.getInstance().getSkillEnchantmentBySkillId(s.getId()); if (esl != null) { if (s.getLevel() < esl.getBaseLevel()) { isEnchantable = false; } } else { isEnchantable = false; } } if (getAioEndTime() > System.currentTimeMillis() && !isGM() && !isInsideZone(ZONE_TOWN)) { isDisabled = true; } sl.addSkill(s.getId(), s.getLevel(), s.isPassive(), isDisabled, isEnchantable); } } sendPacket(sl); } And stops. I use the admin command admin_give_all_skills So is not SQL relative. Even if it was i have fast disk it wouldnt downgrade so much.
  13. So basically you say that the size wouldnt change maybe the method that handle the packet is wrong. i check the H5 method SKilLIst and is this https://pastebin.com/AXws0Pgb while on freya ishttps://pastebin.com/3HzmwR49 So basically on Freya the constructor create a new FastList which is slow as fuck compare to arrayList so ill go ahead and change this cause javolution is slower by 30% as i saw I'll try my lack with this and report back.
  14. oh, true didn't think of that. If i do packet.toString().lenght(); this would return the packet size (somehow) i could compare to H5 then ?
  15. I did compare to H5 branch (cause i use freya) and the code is the same (just in H5 they added 1 more check for add the skill on holders) nothing to do with retreive or store. But in H5 it really takes 0.2 sec delay to give 45 skills while in freya it take 1.5 sec delay. I can imagine with extra skills it could take 3 sec delay.
  16. Let me get the things straight: This is the admin method that give ALl skills to players. and the method that does that is the sendSkillList ( same called in sub-class) private void adminGiveAllSkills(final L2PcInstance activeChar, final boolean includedByFs) { final L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; } else { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INCORRECT_TARGET)); return; } player.sendSkillList(); } Now in this method as u can see: public void sendSkillList(final L2PcInstance player) { boolean isDisabled = false; final SkillList sl = new SkillList(); if (player != null) { for (final L2Skill s : player.getAllSkills()) { if (s == null) { continue; } if (s.getId() > 9000 && s.getId() < 9007) { continue; } if (_transformation != null && !containsAllowedTransformSkill(s.getId()) && !s.allowOnTransform()) { continue; } if (player.getClan() != null) { isDisabled = s.isClanSkill() && player.getClan().getReputationScore() < 0; } boolean isEnchantable = SkillTable.getInstance().isEnchantable(s.getId()); if (isEnchantable) { final L2EnchantSkillLearn esl = EnchantGroupsTable.getInstance().getSkillEnchantmentBySkillId(s.getId()); if (esl != null) { if (s.getLevel() < esl.getBaseLevel()) { isEnchantable = false; } } else { isEnchantable = false; } } if (getAioEndTime() > System.currentTimeMillis() && !isGM() && !isInsideZone(ZONE_TOWN)) { isDisabled = true; } sl.addSkill(s.getId(), s.getLevel(), s.isPassive(), isDisabled, isEnchantable); } } sendPacket(sl); } All skills are gathered into a packet that is send only 1 time upon the end of code. This class takes 3500 nanoseconds to be done, aka 0 milliseconds The only method that retrieve the skills here is just this: public final L2Skill[] getAllSkills() { if (_skills == null) { return new L2Skill[0]; } return _skills.values().toArray(new L2Skill[_skills.values().size()]); } Basically a Map that is turned into array (no delay at all obviously). I did in both methods long ms = System.getNanoTime(); System.out.println(System.getNanoTime() - ms); and it show all 0 MS in total. MAX 1 ms. So the reason of 2 sec delay is not justified
  17. Wait wait.. the skillList is a packet that contains a sub-list so basically on a List you load all getPlayerAvailableSkills and u add them on SkillList packet and then at the end u send 1 time the packet. so ? It's not about fix. 1.5 sec delay is no problem is just it make me so fucking curious.. i did berchmarks and is so fast that even in nanoseconds it show 3500 to complete all giveSkillListToPlayer();
  18. What would be the reason of pause the tread of player for like 1.5 to 2 seconds upon sendSkillList? I did berchmark on the public void sendSkillList(final L2PcInstance player) code it return literally 0.06 millisecond respond time So thats no the reason. There is no other code both admin (give_all_skills) and the sub-class use the sendSkillList(player); which it really has no delay since i made it's List and it's really fast. What else would cause this 1.5 - 2 second delay upon give skill list? Give some advice
  19. Congratulations, now every stupid BR/RU will open an OFF server
  20. This guy stole 200 euro, try refund again and he is still online and no get banned?
  21. And another proof u are the same person. So basically i wish from the deep of my heart your girlfriend suffer an anal but im sure that fat bitch can handle it. Also Don't worry i got plans for you with your photos and her photos. If you lived in Athens u would see 3 BMW under ur house now and u wouldnt exist you piece of shit trust me. If u got the guts give me a call when u come in athens ill handle u in pieces :)
×
×
  • Create New...