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.



×
×
  • Create New...