-
Posts
46 -
Credits
0 -
Joined
-
Last visited
-
Feedback
0%
About Ο Χάρος
Profile Information
-
Current Mood
Angry
-
Gender
Not Telling
-
Country
Greece
Recent Profile Visitors
Ο Χάρος's Achievements
Newbie (1/16)
0
Reputation
-
Discussion Java switch anytime
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
Οχι ετσι για να στη σπασω :3 -
Discussion Java switch anytime
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
Να πας να αυνανιστεις :'( δεν ξεκιναω τιποτα. -
Discussion Java switch anytime
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
[GR] Πολλες ωρες για να κανεις το project convert σε java 8 [/GR] -
Discussion Java switch anytime
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
I would date you for that smart answer you wrote but i know u engaged -
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?
-
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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. -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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. -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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. -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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 ? -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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); } } -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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. -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
public final L2Skill[] getAllSkills() { if (_skills == null) { return new L2Skill[0]; } return _skills.values().toArray(new L2Skill[_skills.values().size()]); } Map to array -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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. -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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. -
Discussion Reason of delay?
Ο Χάρος replied to Ο Χάρος's topic in Server Development Discussion [L2J]
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 ?