Jump to content

Recommended Posts

Posted

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

 

Posted

ugliest thing i ever seen.

 

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

nex time try using String.isEmpty()

Posted

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

Posted

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.

Posted

Also, did you take some parts from raid engine?

 

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

Posted

Also, did you take some parts from raid engine?

 

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

yes i did

Posted

The bottom line is he shared something, thanks for the share marwan nice job i might pm you with reported errors or even patches for fixes!

Posted

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

 

LeagueOfElo league = new LeagueOfElo();

+                       league.vs5reg(player);

Posted

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

Posted

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)

+       {

+              

+       }

Posted

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

 

 

 

 

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Yes, just keep this post=)
  • 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