Jump to content

[Share]League of Elo (InComplete)


marwan

Recommended Posts

hey guys , I stoped coding this of lack of time (exams) so decided to share

 

I took the idea from here http://l2jesios.org/index.php?topic=2210.0

 

the code is totally in complete i just finished the 5vs5 solo match , need 10 players to register there is 2 teams blue and red

event area in coliseum  , once event start there are 2 turrets in each team and 1 nexus spawned

if you get inside radius 400 from the turrets you will get -1000 hp , if all enemy teams are dead turret wont do anything

 

you need to kill nexus in order to win

 

there are 2 ranks (ranked , unranked)

 

 

for each  match you win you get +15 points in order to be ranked you need to have 100 pionts

 

the code is messy and there may be  bugs

 

Patch :

You will ned to add new column in character and name it rank text and allow null

and excute this in your db

INSERT INTO `npc` VALUES
('10201', '29006', 'Blue Nexus', '1', '', '1', 'LineageMonster4.Divine_Rogue', '140', '75.00', '80', 'male', 'L2Npc', '40', '523', '87238', '378378', '378', '40', '43', '30', '21', '20', '20', '0', '0', null, null, null, null, '230', '1', '333', '0', '0', '0', '60', '120', '0', '0');
('10202', '29006', 'Red Nexus', '1', '', '1', 'LineageMonster4.Divine_Rogue', '140', '75.00', '80', 'male', 'L2Npc', '40', '523', '87238', '378378', '378', '40', '43', '30', '21', '20', '20', '0', '0', null, null, null, null, '230', '1', '333', '0', '0', '0', '60', '120', '0', '0')
('10203', '31690', 'Turret', '1', '', '1', 'LineageMonster4.Divine_Rogue', '24', '69', '80', 'male', 'L2Npc', '40', '523', '87238', '378378', '378', '40', '43', '30', '21', '20', '20', '0', '0', null, null, null, null, '230', '1', '333', '0', '0', '0', '60', '120', '0', '0')
('10204', '31690', 'Turret', '1', '', '1', 'LineageMonster4.Divine_Rogue', '24', '69', '80', 'male', 'L2Npc', '40', '523', '87238', '378378', '378', '40', '43', '30', '21', '20', '20', '0', '0', null, null, null, null, '230', '1', '333', '0', '0', '0', '60', '120', '0', '0')

 

and the code

 

http://pastebin.com/r28zP7m2

 

Link to comment
Share on other sites

ugliest thing i ever seen.

 

I stoped reading after i saw this: rset.getString("rank") == ""

nex time try using String.isEmpty()

Hahaha..

 

I don't even think == works for String objects.. I've had several errors in the past with this. You need to use equals(another string) or what Setekh said if you want to check that it's equal to nothing.

 

There are more stuff that are done in the wrong way, for example creating a new object of LeagueOfElo class to call a method or a variable(i don't even know if your variables are static and you call them through objects, check below why).

 

Also i noticed that LeagueOfElo class is missing from the diff :S

Link to comment
Share on other sites

ok code update , and as i said code is messy

You shouldn't have shared it, then, because many newbies are going to use it.

 

Anyway, nice try, keep up coding.

Link to comment
Share on other sites

Also, did you take some parts from raid engine?

 

// _log.warning("Raid Engine[spawnEventNpc(" + activeChar.getName() + ")]: exception: " + e.getMessage());

Link to comment
Share on other sites

As i said, your variables are static and you call them through object:

 

LeagueOfElo league = new LeagueOfElo();

+                       league.vs5reg(player);

Link to comment
Share on other sites

As i said, your variables are static and you call them through object:

 

LeagueOfElo league = new LeagueOfElo();

+                       league.vs5reg(player);

vs5reg() is not static

I will update code later

 

Changed all non-static methods to static also added res method in dodie method in pc instance

http://pastebin.com/g7CdtnwB

Link to comment
Share on other sites

vs5reg() is not static

I will update code later

 

Changed all non-static methods to static also added res method in dodie method in pc instance

http://pastebin.com/g7CdtnwB

You didn't quite understand me..

 

For example:

+               if (command.startsWith("five"))

+               {

+                       LeagueOfElo league = new LeagueOfElo();

+                       league.vs5reg(player);

+                       player.sendMessage("Registration Successful");

+                       if (league.vs5.size() == 10)

+                       {

+                               league.pick5v5();

+                       }

+               }

 

Here, it is unnecessary to make a new object of LeagueOfElo class, you can change pick5vs5() method and vs5reg() to static, and call them like this:

LeagueOfElo.pick5vs5();

LeagueOfElo.vs5reg();

As well for vs5 variable which is static.

 

But my point is that you have not coded it in a good way. There are unused stuff in there and more.

 

You should have created for example an abstract class Match, and other classes afterwards that extend this class, to handle the 5vs5 match, 2vs2 and such. Also in Match class you should have abstract methods that all subclasses should override(must). So instead of this ugly code you would have a nice organized way to handle matches, using inheritance.

 

 

More stuff:

 

+                               ii.SetRankPts(ii.getRankPts() + 105);

+                               if (ii.getRankPts() == 100)

+                               {

+                                       ii.setRank("Ranked");

+                               }

 

if (ii.getRankPts() == 100)

This line is incorrect, you should check if it's >= 100 and if his rank is not Ranked (!ii.getRank().equals("Ranked")).

Also, here:

 

ii.SetRankPts(ii.getRankPts() + 105);

 

I think you meant 15..

 

 

Unused/Unneeded stuff:

 

+               if (isTurret())

+               {

+                      

+               }

 

+       public class Start implements Runnable

+       {

+               @Override

+               public void run()

+               {

+                      

+               }

+       }

+      

+       public void createTeam(L2PcInstance a)

+       {

+              

+       }

Link to comment
Share on other sites

You didn't quite understand me..

 

For example:

+               if (command.startsWith("five"))

+               {

+                       LeagueOfElo league = new LeagueOfElo();

+                       league.vs5reg(player);

+                       player.sendMessage("Registration Successful");

+                       if (league.vs5.size() == 10)

+                       {

+                               league.pick5v5();

+                       }

+               }

Yes I did that but didn't forget to edit the npc class

Here, it is unnecessary to make a new object of LeagueOfElo class, you can change pick5vs5() method and vs5reg() to static, and call them like this:

LeagueOfElo.pick5vs5();

LeagueOfElo.vs5reg();

As well for vs5 variable which is static.

I updated it but dont know why da -beep- it didn't change

 

about the  points  +105 because of testing

 

http://pastebin.com/r28zP7m2

 

anyway yes I sucked at this

 

 

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Thank you 😊👍 working great! 
    • MidnightSell team WTB/WTS GOLD TWW EU/US all servers Cataclysm all servers Payment Visa/Master/Btc/Eth/Trc-20/Erc-20 (all payments within 10 min) For all question pls dm Discord https://discord.gg/h8AN57qJjK Or Telegram @MidnightSell
    • GOSTEI MUITO DO VIASUAL DO SERVE COMO POSSO ADQUIRI ESSA REV PACK   
    • Helly everyone . I use L2jmobius interlude , i did everything , installed the db compiled the Build in eclipse Gameserver seems to lead OK , but it fails to connect to loginserver When i click to start the loginserver it says  "Loginserver terminated abnormally" This is wheat gameserver shows me :    [05/10 17:25:12] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:12] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:17] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:17] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:22] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:22] LoginServerThread: LoginServer not available, trying to reconnect...   And This is my login config file:   # --------------------------------------------------------------------------- # Login Server Settings # --------------------------------------------------------------------------- # This is the server configuration file. Here you can set up the connection information for your server. # This was written with the assumption that you are behind a router. # Dumbed Down Definitions... # LAN (LOCAL area network) - typically consists of computers connected to the same router as you. # WAN (WIDE area network) - typically consists of computers OUTSIDE of your router (ie. the internet). # x.x.x.x - Format of an IP address. Do not include the x'es into settings. Must be real numbers. # --------------------------------------------------------------------------- # Networking # --------------------------------------------------------------------------- # Bind ip of the LoginServer, use 0.0.0.0 to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 0.0.0.0 LoginserverHostname = 0.0.0.0 # Default: 2106 LoginserverPort = 2106 # The address on which login will listen for GameServers, use * to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 127.0.0.1 LoginHostname = 127.0.0.1 # The port on which login will listen for GameServers # Default: 9014 LoginPort = 9014 # --------------------------------------------------------------------------- # Database # --------------------------------------------------------------------------- # Specify the JDBC driver class for your database. # Default: org.mariadb.jdbc.Driver Driver = org.mariadb.jdbc.Driver # Database URL # Default: jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true URL = jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true # Database user info. Default is "root" but it's not recommended. Login = root # Database user password, leave empty for no password. Password = root # Maximum number of database connections to maintain in the pool. # Default: 5 MaximumDatabaseConnections = 5 # Determine whether database connections should be tested for availability. # Default: False TestDatabaseConnections = False # --------------------------------------------------------------------------- # Automatic Database Backup Settings # --------------------------------------------------------------------------- # Generate database backups when server restarts or shuts down.  BackupDatabase = False # Path to MySQL bin folder. Only necessary on Windows. MySqlBinLocation = C:/xampp/mysql/bin/ # Path where MySQL backups are stored. BackupPath = ../backup/ # Maximum number of days that backups will be kept. # Old files in backup folder will be deleted. # Set to 0 to disable. BackupDays = 30 # --------------------------------------------------------------------------- # Thread Configuration # --------------------------------------------------------------------------- # Defines the number of threads in the scheduled thread pool. # If set to -1, this will be determined by available processors divided by 2. ScheduledThreadPoolSize = 2 # Defines the number of threads in the instant thread pool. # If set to -1, this will be determined by available processors divided by 2. InstantThreadPoolSize = 2 # --------------------------------------------------------------------------- # Security # --------------------------------------------------------------------------- # How many times you can provide an invalid account/pass before the IP gets banned. # Default: 5 LoginTryBeforeBan = 5 # Time you won't be able to login back again after LoginTryBeforeBan tries to login. # Default: 900 (15 minutes) LoginBlockAfterBan = 900 # If set to True any GameServer can register on your login's free slots # Default: True AcceptNewGameServer = True # Flood Protection. All values are in milliseconds. # Default: True EnableFloodProtection = True # Default: 15 FastConnectionLimit = 15 # Default: 700 NormalConnectionTime = 700 # Default: 350 FastConnectionTime = 350 # Default: 50 MaxConnectionPerIP = 50 # --------------------------------------------------------------------------- # Misc Login Settings # --------------------------------------------------------------------------- # If False, the license (after the login) will not be shown. # Default: True ShowLicence = True # Default: True AutoCreateAccounts = True # Datapack root directory. # Defaults to current directory from which the server is started. DatapackRoot = . # --------------------------------------------------------------------------- # Scheduled Login Restart # --------------------------------------------------------------------------- # Enable disable scheduled login restart. # Default: False LoginRestartSchedule = False # Time in hours. # Default: 24 LoginRestartTime = 24    
  • Topics

×
×
  • Create New...