Jump to content

Recommended Posts

Posted (edited)

Nice idea!

 

BUT the implementation is not that nice..

Why didn't u wrote that as a DP sided script..

Also u're using thread-safe classes where u don't need to, and not thread-safe where u had to..

Using public variables to access from outside and methods to access inner vars is not so nice either.

Btw we use to add '_' (underscore) prefix to global variables not to local ones so you don't have to use explicit 'this.var = var'

Also we stopped using e.printStackTrace() because in windows it doesn't gets logged on log files, we use Logger for that (Same goes for System.out.println())

(new Thread(new RankPvpSystemPvpTask(player, target))).start();

 Why don't u simply use that instead.

ThreadPoolManager.getInstance().executeTask(new RankPvpSystemPvpTask(player, target));

It also executes the task in another thread without having to create new thread because there is already created a pool of threads used by the whole server.

 

Actually the code is really messed up (That's what we call spaghetti  code) that's why u have 20 pages of typo reports, i think u should start writing a bit more cleaner & safe.

Here i attach similar script i started some time ago, it doesn't supports most of the things u did but count it as an example of how i write things.

Note: This is an alpha version, totally not ready for use version, it may work but it still needs work to be done to consider it as a final version.

PvP.zip

Edited by UnAfraid
Posted (edited)

Thanks for this post UnAfraid, but like i sad some time ago i still learn java. I will try apply your clues in my system ;)

 

 

Why didn't u wrote that as a DP sided script

It is better for debug for me if it is in Core packages.

 

 

Also u're using thread-safe classes where u don't need to, and not thread-safe where u had to..

So where i should use thread-safe?

 

 

Using public variables to access from outside and methods to access inner vars is not so nice either.

I use that public variable only in L2PcInstance, reason: I don't want change original code too much (adding getter and setter will add too much code)

 

I use inner methods for obtain inner fields, because i think it's look better, and cleaner :)



_killersList.add(killer);
// or
getKillerList().add(killer);

...but now i think the first line looks better than third line.

 

 

 

ThreadPoolManager.getInstance().executeTask(new RankPvpSystemPvpTask(player, target));

It is applied right now.

 

About _ (underscore), yes i know this rule ;) but some code is auto-generated in eclipse, so mostly i don't look into this methods.

 

About e.printStackTrace(), it will be changed for Logger.

 

 

 

that's why u have 20 pages of typo reports,

Can you explain what do you mean?

 

 

i think u should start writing a bit more cleaner & safe

What mean safe?

 

 

Finally, thanks for check my work. I am really glad :)

Edited by matthewmaster04
Posted (edited)

Every time u need some Map/List which will be used only once to add and then only to read doesn't have to be FastMap/FastList (Javolution) they are thread-safe use HashMap (When order is not important LinkedHashMap when u need insert order) and ArrayList.

 

In case you have to use a Map/List to add/remove entries during run-time then u have to use thread-safe Map/List i'd rather use ConcurrentHashMap/CopyOnWriteArrayList (In case when insert order matters only then FastMap)

 

If you like to leave little fingerprints over the source i'd implement some event listeners.

With that you can create some interface bridge between your engine and every other l2j based server.

 

Debugging is easy within Core or DP it doesn't really matters eclipse's debugger works well on both sides equally.

Edited by UnAfraid
Posted (edited)

So in this case, standard Map/List will be correct and i can remove FastMap from this pack, i think.

 

ConcurrentHashMap & CopyOnWriteArrayList can be useful but now i am little confused what will be better for me (i need more knowledge).

 

Anyway thanks for help ;)

Edited by matthewmaster04
Posted (edited)

Codding safer means you should make sure your code is not going to cause any problems like exceptions (Mostly nulls), exploits..  as you write it.

Edited by UnAfraid
Posted (edited)

U also could do that 

for (Entry<Integer, KillerPvpStats> entry = getKillerPvpTable().entrySet())

instead of 

for (FastMap.Entry<Integer, KillerPvpStats> e = getKillerPvpTable().head(), end = getKillerPvpTable().tail(); (e = e.getNext()) != end;)

It looks way more cleaner and understandable also when u change the underlying implementation you'll not have to worry about rewriting all the loops u did in that way.

 

Also i'd use a bit more java 7 features like the ARM (Auto resource management), mostly for database queries look at current l2j sources to see how we handled them

Edited by UnAfraid
Posted (edited)

Thanks again, i will apply it in next rev. ;)

 

It should be like:

for (Map.Entry<Integer, Rank> e : rankList.entrySet())

And btw, is exist a Map what allows you add value on selected position?

Example:



_map.insert(position, key, value);
Edited by matthewmaster04
Posted

 

Thanks again, i will apply it in next rev. ;)

 

It should be like:

for (Map.Entry<Integer, Rank> e : rankList.entrySet())

And btw, is exist a Map what allows you add value on selected position?

Example:



_map.insert(position, key, value);

No, you must use comparator.

  • 2 weeks later...
Posted

i suggest you create one more file to show diffs in eclipse so ppl dont have to remove and re-add patches ;) ofc if you have time for that is just a suggestion ;) btw is one of the best features here!

Posted

i have a problem  

 

Buildfile: C:\workspace\L2J_Server\build.xml
checkRequirements:
getChangelogDateVersion:
     [exec] Result: 1
     [exec] Result: 1
init:
   [delete] Deleting directory C:\workspace\L2J_Server\build\bin
    [mkdir] Created dir: C:\workspace\L2J_Server\build\bin
dist:
     [sync] Removed 2 dangling files from C:\workspace\L2J_Server\build\dist
compile:
    [javac] Compiling 1692 source files to C:\workspace\L2J_Server\build\bin
    [javac] C:\workspace\L2J_Server\java\com\l2jserver\gameserver\handler\UserCommandHandler.java:24: error: cannot find symbol
    [javac] import com.l2jserver.gameserver.masteriopack.rankpvpsystem.IUserCommandHandlerPvpInfo;
    [javac]                                                           ^
    [javac]   symbol:   class IUserCommandHandlerPvpInfo
    [javac]   location: package com.l2jserver.gameserver.masteriopack.rankpvpsystem
    [javac] C:\workspace\L2J_Server\java\com\l2jserver\gameserver\handler\VoicedCommandHandler.java:24: error: cannot find symbol
    [javac] import com.l2jserver.gameserver.masteriopack.rankpvpsystem.IVoicedCommandHandlerPvpInfo;
    [javac]                                                           ^
    [javac]   symbol:   class IVoicedCommandHandlerPvpInfo
    [javac]   location: package com.l2jserver.gameserver.masteriopack.rankpvpsystem
    [javac] C:\workspace\L2J_Server\java\com\l2jserver\gameserver\GameServer.java:317: error: load() has private access in ServerSideImage
    [javac] ServerSideImage.getInstance().load();
    [javac]                             ^
    [javac] C:\workspace\L2J_Server\java\com\l2jserver\gameserver\handler\UserCommandHandler.java:41: error: cannot find symbol
    [javac] registerHandler(new IUserCommandHandlerPvpInfo());
    [javac]                    ^
    [javac]   symbol:   class IUserCommandHandlerPvpInfo
    [javac]   location: class UserCommandHandler
    [javac] C:\workspace\L2J_Server\java\com\l2jserver\gameserver\handler\VoicedCommandHandler.java:41: error: cannot find symbol
    [javac] registerHandler(new IVoicedCommandHandlerPvpInfo());
    [javac]                    ^
    [javac]   symbol:   class IVoicedCommandHandlerPvpInfo
    [javac]   location: class VoicedCommandHandler
    [javac] 5 errors
 
BUILD FAILED
C:\workspace\L2J_Server\build.xml:64: Compile failed; see the compiler error output for details.
 
Total time: 7 seconds
Posted (edited)

marik20001

Probably you try add this diff files into lower chronicle than H5 or other l2jserver.

 

You should check methods names and parameters what are overrided in command handlers.

 

IUserCommandHandlerPvpInfo should be correctly implemented from IUserCommandHandler interface.

 

valanths1990

You can restore the oryginal class from repo and then apply my patch. THat way is faster i think. (BTW I am too lazy ... ;))

Edited by >Masterio<
Posted (edited)

I will apply concurrent hashmap. do not download 3.7.5, new revision today.

 

PS. I will fit this code when I will finish H5 version. (soon)

Edited by >Masterio<
Guest
This topic is now closed to further replies.



  • Posts

    • interlude: l2acis uber alles
    • New Dragon-Network Server – Vote Now!   We’re launching a new Dragon-Network (Multiskill) server under a new domain, created by the original Classic-Interlude team. We no longer have access to the old domain, but this is the official continuation — not a scam, just a new home. The new domain will host: A main migrated server (nothing lost – all chars/items kept) Plus seasonal servers (voted by players) All seasonal progress will be merged into the main realm Help shape the new server – vote now: https://dragon-network.eu/   Let’s build the future of DN – together.
    • Hello there, Im beyond confused and dont know what path to take. I want to start working on a L2 server, changing some stuff here and there and finally in the future if  im happy with the results, to launch the server, but... L2j or L2off? After all this years, is there a Interlude L2j close to off?   Ive spent some time lookin over this forum, searching what would be better and what files to take but I ain't near to a clear answer.  Most of the time everyone is trowing stones at everyone, "your filles are trash, my filles are good" and viceversa. Therefore, Im reaching out to a knowledge guy, hopefully from a neutral position to all this drama, that can pin point me in a direction.    To explain what I want for a base start is an Interlude with a classic interface (features), low rate. Mostly what this guy TravorJ is describing in his post TravorJ post , and to do some reworks on it, ex: mobs drop, rethink the augment system/interface, rethink learning skills/enchant skills, create some custom potions/buff effects, siege mechanics... Is that possible on off files? or is better to go with L2j? I also want to mention that I have little to none L2 dev experince (13-15yrs ago I had an L2j server running  for a month where I made some basics changes), but I have coding background so Im used to that and more than willing to learn.   So in conclusion, I dont want to get some free shared files without any support, that I need to wrap my head around and fix stuff for long time to make them work, stuff thats already fixed buy someone else. Instead im looking to buy something thats more updated and start working from there. Question is what and from whom? Kinda sux when you go and buy something and u dont know what the hell are you buying (need some guidance here)   Is L2j Orion a good choice? I saw that is regularly updated. Lucera2 I dont think is something that I want cuz they dont sell soruce, prefer to have control and not to be dependent on someone to much...   Big thanks in advance!   
    • L2 INSIDE - HTML DESIGN     Portfolio - protojahdesigns.com You can also join Protojah Designs Discord
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock