Jump to content

Recommended Posts

Posted

Title says it all, im looking for a script which would allow me to set maximum enchantment limit for olympiad (Chronicle - Interlude (c6)).
Yes. bla bla bla, im stupid enough and can't find the code myself. Sorry if i post in wrong section, ain't big user of this forum :<<<<
This should be not only important for me, but for those 'legit' servers, where you can't find balance in olympiad.

Posted (edited)

Title says it all, im looking for a script which would allow me to set maximum enchantment limit for olympiad (Chronicle - Interlude (c6)).

Yes. bla bla bla, im stupid enough and can't find the code myself. Sorry if i post in wrong section, ain't big user of this forum :<<<<

This should be not only important for me, but for those 'legit' servers, where you can't find balance in olympiad.

I have shared this restriction in acis share section.

But this restriction is included in a bigger much so you have to export it on your own. :P

 

//Edit

 

Code: http://www.maxcheaters.com/topic/174057-share-acis-patch-no1/

Edited by `iAndre
Posted

I got the code from iAndre and addapt in on my source (rev 300 - acis ). I'm not 100% that is works!

 

what I did is:

 

Config.java

 

ALT_OLY_DIVIDER_NON_CLASSED = events.getProperty("AltOlyDividerNonClassed", 3);
ALT_OLY_ANNOUNCE_GAMES = events.getProperty("AltOlyAnnounceGames", true);
+ALLOW_OLY_GRADE_RESTR = events.getProperty("AllowOlyGradeRestr", false);
+MAX_ENCHANT_RESTR = events.getProperty("MaxEnchantRestr", 65535);
 
 
public static int ALT_OLY_DIVIDER_CLASSED;
public static int ALT_OLY_DIVIDER_NON_CLASSED;
public static boolean ALT_OLY_ANNOUNCE_GAMES;
+public static boolean ALLOW_OLY_GRADE_RESTR;
+public static int MAX_ENCHANT_RESTR;
 
event.properties
 
# Divider for points in classed and non-classed games, default: 3, 5.
AltOlyDividerClassed = 3
AltOlyDividerNonClassed = 5
+
+# Oly Grade Restriction #
+AllowOlyGradeRestr= True
+MaxEnchantRestr = 8
 
 
l2olympiadmanagerinstance.java
 
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2Multisell;
import net.sf.l2j.gameserver.model.entity.Hero;
+import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
import net.sf.l2j.gameserver.model.olympiad.CompetitionType;
import net.sf.l2j.gameserver.model.olympiad.Olympiad;
 
 
 
case 3: // There are %points% Grand Olympiad points granted for this event.
int points = Olympiad.getInstance().getNoblePoints(player.getObjectId());
html.setFile(Olympiad.OLYMPIAD_HTML_PATH + "noble_points1.htm");
html.replace("%points%", String.valueOf(points));
html.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(html);
break;
 
case 4: // register non classed based
+                       if (meetsRequirements(player))
+                      {
+                          OlympiadManager.getInstance().registerNoble(player, CompetitionType.NON_CLASSED);
+                      }
+break;
 
+case 5: // register classed based
+if (meetsRequirements(player))
+{
+       OlympiadManager.getInstance().registerNoble(player, CompetitionType.CLASSED);
+}
+break;
 
case 6: // request tokens reward
passes = Olympiad.getInstance().getNoblessePasses(player, false);
if (passes > 0)
{
html.setFile(Olympiad.OLYMPIAD_HTML_PATH + "noble_settle.htm");
html.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(html);
}
else
{
html.setFile(Olympiad.OLYMPIAD_HTML_PATH + "noble_nopoints2.htm");
html.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(html);
}
break;
 
 
 
 
 
 
}
else
super.onBypassFeedback(player, command);
}
      
+       public boolean meetsRequirements(L2PcInstance p)
+      {
+               if (Config.ALLOW_OLY_GRADE_RESTR)
+               {
+                       // Enchant checks.
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your weapon's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your armor's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_UNDER).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your tattoo's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your necklace's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEAR).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your earring's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_REAR).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your earring's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your ring's enchant level is not the appropriate.");
+                               return false;
+                       }
+                       if (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER).getEnchantLevel() > Config.MAX_ENCHANT_RESTR)
+                       {
+                               p.sendMessage("You may not register for the Olympiad, as your ring's enchant level is not the appropriate.");
+                               return false;
+                       }
+               }
+              
               return true;
       }
}
 
I know they way I post it is a mess but I don't know how to post them correctly (lazy ass here). If you have some decent skills you can adapt it. 
Hope it works, if no correct me.
 
thank you.
 

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


×
×
  • 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