Jump to content

Rizlaaa

Members
  • Posts

    362
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Rizlaaa

  1. Protection σημαινει προστασια οπως ξερεις , η αν δεν ξερεις το εμαθες τωρα :P Προστασια δεν ειναι ενα πραγμα να πεις το βαζεις και τελειωσες. Η προστασια στο L2 αποτελειται απο bugs,exploits,attacks. Bugs Τα bugs προκαλουνται απο κακογραμμενους κωδικες η απο κωδικες στους οποιους ο συγγραφεας εχει ξεχασει κατι. Π.χ ενα casino manager που ενω ο admin ηθελε να το βαλει 50% να κερδιζεις κατι εκανε λαθος και το εβαλε 100% θεωρειται bug στην ουσια. Exploits Τα exploits δημιουργουνται απο καποιο ειδος προγραμματων συνηθως τα οποια βρισκουν τρυπα στο συστημα , σχεδον παντα στην ιδια γλωσσα που ειναι γραμμενο το game , στη συγεκριμενη περιπτωση Java. Επισης pascal kai delphi χρησιμοποιουνται για το L2(βλεπε L2PHX) Attacks Οι επιθεσεις(attacks) γινονται με ΚΥΡΙΟ σκοπο το κλεισιμο ενος server. Υπαρχουν τα απλα attacks οπως το L2JMinikiller, L2Jkiller τα οποια φτιαχνονται ευκολα απο τι στιγμη που εχουν γινει share εδω και σε timelines απο αλλα Projects.Υπαρχουν ομως και τα DDOS που πρεπει να πληρωσεις αναγκαστικα extra για να τα αποφυγεις, βεβαια ειναι και σπανια. Ελπιζω να πηρες μια καθαρη ιδεα για το τι σημαινει Protection.
  2. Κανε request στα client section.
  3. Aha , actually i didn't know that can bypassing in admin commands classes. Anyway i don't think it's so important since it doesn't take more memory or have problems to work :P but yes it would be better like that.
  4. Ξερω ατομο που εχει gameserver στην sovahost(οχι για L2) , και δεν εχει κανενα προβλημα μεχρι στιγμης εδω και κανα 3 βδομαδες.Ισως σε ποιοτητα να μην σκιζει , αλλα δεν την λες και αχρηστη την εταιρεια , ειναι καλουτσικη και ειδικα αν σε βολευει να πληρωσεις με paysafe τοτε θα σε βοηθησει.
  5. Για να αλλαξεις τα στατς και να παρουν το effect δηλαδη οχι να φαινονται αλα να τα αλλαξεις ωστε να ισχυουν μονο τα φτιαχνεις απο τα XML των weapons/armors/skils.Για να αλλαξεις να φαινονται κιολας θα χρειαστεις Client Edit , θα ανοιξεις τα αρχεια itemname , weapongrp , armorgrp,ψαξτα και θα τα βρεις.
  6. L2J φυσικα. 1)Active 100% 2)Καθημερινα fixes και updates 3)Εμπιστο project , το εχει δειξει ολα αυτα τα χρονια. 4)Καθαρο. Για L2JFree δεν ξερω , δεν εχω δουλεψει ποτε.
  7. What exactly you mean? :P
  8. Credits iRat Read this before please I was chating with a friend in MSN and he requested this. In the beggining i told him it was a bad idea and useless but then i thought better and i changed opinion. Full Description You know all(specially if you are member in Maxcheaters lol :P) that there is Maintenance mode in forums.So that's I did, a maintenance mode in Lineage. Admin can start the maintenance by pressing //start_maintenance. A new panel opens and has opinion to start maintenance , clear maintenance messages and add a new maintenance. He first adds a new maintenance method somehow like that: Then after he adds as many messages he wants he press Main Menu to come to the starting page. And then he press Do Maintenance and players are informed. After 30 seconds all players are teleporting somewhere(default Jail), they informed with the reasons of maintenance and there they can't attack,etc , using unstuck ,blabla till maintenance mode finish. While maintenance mode admin can also add new messages pressing //add_reason and players will be informed by each message he adds automatically. Players who were offline , while server is in maintenance mod they will informed when they log in and they will also get teleported in the maintenance place.And finally he can press //end_maintenance to finish the maintenance mode and players continue playing :D Why it can be usefull 1)Players are bored to enter at server's site. 2)It's cool to have a maintenance mode in L2 and not in the site 3)Many players will leave if they see Down server status , believe me they will. And this you can fix some things and players get instant informed about your actions. ### Eclipse Workspace Patch 1.0 #P Chr.6GMS Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java =================================================================== --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (revision 5263) +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (working copy) @@ -24,6 +24,7 @@ import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.datatables.MapRegionTable; import net.sf.l2j.gameserver.handler.IUserCommandHandler; +import net.sf.l2j.gameserver.model.Maintenance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.entity.TvTEvent; import net.sf.l2j.gameserver.network.SystemMessageId; @@ -67,6 +68,9 @@ activeChar.sendMessage("You may not use an escape command in a festival."); return false; } + + if(Maintenance.isMaintenance()) + return false; // Check to see if player is in jail if (activeChar.isInJail()) Index: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 5263) +++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy) @@ -46,6 +46,7 @@ import net.sf.l2j.gameserver.model.L2Effect; import net.sf.l2j.gameserver.model.L2ItemInstance; import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.gameserver.model.Maintenance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.entity.ClanHall; import net.sf.l2j.gameserver.model.entity.Couple; @@ -254,6 +255,15 @@ Quest.playerEnter(activeChar); activeChar.sendPacket(new QuestList()); + + if(Maintenance.isMaintenance()){ + Maintenance.informPlayer(activeChar); + if(!activeChar.isInJail()) + activeChar.teleToLocation(Maintenance.x, Maintenance.y, Maintenance.z); + } + else if(Maintenance.isMaintenance() == false) + if(activeChar.isInJail()) + activeChar.teleToLocation(Maintenance.giranX, Maintenance.giranY, Maintenance.giranZ); if (Config.SERVER_NEWS) { Index: java/net/sf/l2j/gameserver/model/Maintenance.java =================================================================== --- java/net/sf/l2j/gameserver/model/Maintenance.java (revision 0) +++ java/net/sf/l2j/gameserver/model/Maintenance.java (revision 0) @@ -0,0 +1,192 @@ + +package net.sf.l2j.gameserver.model; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.LineNumberReader; +import java.util.StringTokenizer; +import java.util.logging.Logger; + +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage; + +import javolution.text.TextBuilder; +import javolution.util.FastList; + + + +/** + * + * @author iRat + */ +public class Maintenance +{ + private static Logger _log = Logger.getLogger(Maintenance.class.getName()); + + public static int giranX = 0, giranY = 0, giranZ = 0; + public static int x = -114462,y = -249619,z = -2986; + private static boolean maintenance = false; + private static FastList<String> maintenanceMessages = new FastList<String>(); + + public static void addMessage(String reason) + { + maintenanceMessages.add(reason); + } + + public static void clearAllMessages(){ + maintenanceMessages.clear(); + } + + public static FastList<String> getReasons() + { + return maintenanceMessages; + } + + public static boolean isMaintenance() + { + return maintenance; + } + + public static void setMaintenance(boolean _maintenance){ + setMaintenanceInDisk(_maintenance); + maintenance = _maintenance; + } + + private static void setMaintenanceInDisk(boolean Maintenance){ + String mode = ""; + if(Maintenance) + mode = "true"; + else + mode = "false"; + + File file = new File("data/maintenance.txt"); + FileWriter save = null; + + try + { + save = new FileWriter(file); + save.write(mode); + save.flush(); + save.close(); + save = null; + } + catch (IOException e) + { + _log.warning("Error saving maintenance value " + e); + } + } + + public static void serverStartMaintenance() + { + File file = new File("data/maintenance.txt"); + LineNumberReader lnr = null; + try + { + String line = null; + lnr = new LineNumberReader(new FileReader(file)); + if ( (line = lnr.readLine()) != null) + { + StringTokenizer st = new StringTokenizer(line); + + if (st.hasMoreTokens()) + { + String mode = st.nextToken(); + + if(mode.equals("true")) + maintenance = true; + else if(mode.equals("false")) + maintenance = false; + else + maintenance = false; + } + } + } + catch (IOException e) + { + _log.warning("Error reading maintenance mode: "+e); + } + finally + { + try + { + lnr.close(); + } + catch (Exception e1) + {} + } + } + + public static void sendHtmlAddMessagePage(L2PcInstance player) + { + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage html = new NpcHtmlMessage(1); + + tb.append("<html><head>"); + tb.append("<title>Manage Maintenance Mode</title>"); + tb.append("</head><body>"); + tb.append("<center>Here you can add new maintenance messages "+player.getName()+"</center>"); + tb.append("<br><br>"); + tb.append("<multiedit var=\"newmain\" width=240 height=30><br>"); + tb.append("<center><button value=\"Add\" action=\"bypass -h setAddMain $newmain\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>"); + tb.append("<center><button value=\"Main Menu\" action=\"bypass -h mainMain\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>"); + tb.append("</body></html>"); + + html.setHtml(tb.toString()); + player.sendPacket(html); + } + + public static void informPlayers() + { + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage html = new NpcHtmlMessage(1); + + tb.append("<html><head>"); + tb.append("<title>Maintenance Mode</title>"); + tb.append("</head><body>"); + tb.append("<br><br>"); + int i = 1; + if(getReasons().isEmpty() == false) + for(String message : getReasons()) + { + tb.append(i+":"+message+"<br>"); + i++; + } + tb.append("</body></html>"); + + html.setHtml(tb.toString()); + + for(L2PcInstance player : L2World.getInstance().getAllPlayers()){ + if(player == null) + continue; + player.sendPacket(html); + + } + } + + public static void informPlayer(L2PcInstance player) + { + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage html = new NpcHtmlMessage(1); + + tb.append("<html><head>"); + tb.append("<title>Maintenance Mode</title>"); + tb.append("</head><body>"); + tb.append("<br><br>"); + int i = 1; + if(getReasons().isEmpty() == false) + for(String message : getReasons()) + { + tb.append(i+":"+message+"<br>"); + i++; + } + tb.append("</body></html>"); + + html.setHtml(tb.toString()); + player.sendPacket(html); + + } + } + +} Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -106,6 +106,7 @@ import net.sf.l2j.gameserver.model.L2Summon; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.MacroList; +import net.sf.l2j.gameserver.model.Maintenance; import net.sf.l2j.gameserver.model.PcFreight; import net.sf.l2j.gameserver.model.PcInventory; import net.sf.l2j.gameserver.model.PcWarehouse; @@ -271,6 +272,8 @@ @Override public void doAttack(L2Character target) { + if(Maintenance.isMaintenance()) + return; super.doAttack(target); // cancel the recent fake-death protection instantly if the player attacks or casts spells @@ -283,6 +286,8 @@ @Override public void doCast(L2Skill skill) { + if(Maintenance.isMaintenance()) + return; super.doCast(skill); // cancel the recent fake-death protection instantly if the player attacks or casts spells Index: java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy) @@ -22,13 +22,17 @@ import java.util.logging.Logger; import net.sf.l2j.Config; +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.ThreadPoolManager; import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.communitybbs.CommunityBoard; import net.sf.l2j.gameserver.handler.AdminCommandHandler; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMaintenance; import net.sf.l2j.gameserver.model.L2CharPosition; import net.sf.l2j.gameserver.model.L2Object; import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.gameserver.model.Maintenance; import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.entity.L2Event; @@ -56,6 +60,22 @@ { _command = readS(); } + + private class LockAll implements Runnable{ + public void run() + { + for(L2PcInstance player : L2World.getInstance().getAllPlayers()){ + if(player == null) + continue; + + player.teleToLocation(Maintenance.x, Maintenance.y, Maintenance.z); + + } + Maintenance.informPlayers(); + } + + } + @Override protected void runImpl() @@ -81,6 +101,51 @@ else _log.warning("No handler registered for bypass '"+_command+"'"); } + else if(_command.equals("newMessage")){ + Maintenance.sendHtmlAddMessagePage(activeChar); + } + else if(_command.startsWith("setAddMain")){ + String maintenanceMessage = _command.substring(11); + + if(maintenanceMessage == "" || maintenanceMessage == null){ + Maintenance.sendHtmlAddMessagePage(activeChar); + activeChar.sendMessage("You can't add null messages"); + return; + } + + else if(maintenanceMessage.length() >= 100){ + Maintenance.sendHtmlAddMessagePage(activeChar); + activeChar.sendMessage("You can't add too big message"); + return; + } + + else + { + Maintenance.addMessage(maintenanceMessage); + if(Maintenance.isMaintenance()) + Maintenance.informPlayers(); + activeChar.sendMessage("Your maintenance message added."); + Maintenance.sendHtmlAddMessagePage(activeChar); + } + } + else if(_command.equals("mainMain")){ + + AdminMaintenance.sendHtmlToAddReasons(activeChar); + } + else if(_command.equals("clearMessage")){ + if(!Maintenance.getReasons().isEmpty()) + Maintenance.clearAllMessages(); + activeChar.sendMessage("All your maintenance messages cleared"); + + AdminMaintenance.sendHtmlToAddReasons(activeChar); + } + else if(_command.equals("doMain")){ + Maintenance.setMaintenance(true); + Announcements.getInstance().announceToAll("Server is in Maintenance Mode now , read the reasons."); + Announcements.getInstance().announceToAll("You will be locked in 30 seconds"); + + ThreadPoolManager.getInstance().scheduleGeneral(new LockAll(), 30000); + } else if (_command.equals("come_here") && activeChar.getAccessLevel() >= Config.GM_ACCESSLEVEL) { comeHere(activeChar); Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminMaintenance.java =================================================================== --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminMaintenance.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminMaintenance.java (revision 0) @@ -0,0 +1,76 @@ + +package net.sf.l2j.gameserver.handler.admincommandhandlers; + +import javolution.text.TextBuilder; +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.gameserver.model.Maintenance; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage; + +/** + * + * @author iRat + */ +public class AdminMaintenance implements IAdminCommandHandler +{ + + private final String[] commands = {"admin_start_maintenance","admin_end_maintenance","admin_add_reason"}; + + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + if(activeChar == null) return false; + + if(command.equalsIgnoreCase("admin_start_maintenance")) + { + sendHtmlToAddReasons(activeChar); + } + else if(command.equalsIgnoreCase("admin_add_reason")) + { + Maintenance.sendHtmlAddMessagePage(activeChar); + } + else if(command.equalsIgnoreCase("admin_end_maintenance")) + { + Maintenance.setMaintenance(false); + Maintenance.clearAllMessages(); + for(L2PcInstance player : L2World.getInstance().getAllPlayers()){ + if(player == null) + continue; + + player.sendMessage("Maintenance Mode finished, you telepored in giran"); + player.teleToLocation(Maintenance.giranX, Maintenance.giranZ, Maintenance.giranY); + } + Announcements.getInstance().announceToAll("Maintenance Mode finished, have a nice game"); + } + return true; + } + + public static void sendHtmlToAddReasons(L2PcInstance activeChar) + { + //no need null check since added in useAdminCommand() + + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage html = new NpcHtmlMessage(1); + + tb.append("<html><head>"); + tb.append("<title>Manage Maintenance Mode</title>"); + tb.append("</head><body>"); + tb.append("<center>Here you can manage the maintenance mode "+activeChar.getName()+"</center>"); + tb.append("<br><br>"); + tb.append("Select if you want to add a new reason or you want to remove.<br>"); + tb.append("<button value=\"Add Message\" action=\"bypass -h newMessage\" width=65 height=19>"); + tb.append("<button value=\"Clear Messages\" action=\"bypass -h clearMessage\" width=65 height=19><br><br>"); + tb.append("<center><button value=\"Do Maintenance\" action=\"bypass -h doMain\" width=65 height=19></center>"); + tb.append("</body></html>"); + + html.setHtml(tb.toString()); + activeChar.sendPacket(html); + } + + public String[] getAdminCommandList() + { + return commands; + } + +} Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -97,6 +97,7 @@ import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKill; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminLevel; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminLogin; +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMaintenance; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMammon; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminManor; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMenu; @@ -221,6 +222,7 @@ import net.sf.l2j.gameserver.model.L2Manor; import net.sf.l2j.gameserver.model.L2PetDataTable; import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.gameserver.model.Maintenance; import net.sf.l2j.gameserver.model.entity.Hero; import net.sf.l2j.gameserver.model.entity.TvTManager; import net.sf.l2j.gameserver.network.L2GameClient; @@ -351,6 +353,7 @@ NobleSkillTable.getInstance(); HeroSkillTable.getInstance(); + Maintenance.serverStartMaintenance(); //Call to load caches HtmCache.getInstance(); CrestCache.getInstance(); @@ -518,6 +521,7 @@ _adminCommandHandler = AdminCommandHandler.getInstance(); _adminCommandHandler.registerAdminCommandHandler(new AdminAdmin()); + _adminCommandHandler.registerAdminCommandHandler(new AdminMaintenance()); _adminCommandHandler.registerAdminCommandHandler(new AdminInvul()); _adminCommandHandler.registerAdminCommandHandler(new AdminDelete()); _adminCommandHandler.registerAdminCommandHandler(new AdminKill());
  9. promote fanky to Gold or L2Moderator or L2JDeveloper 1) he is very active , very very. 2) he reports. 3)he helps in L2JDeveloping sections
  10. Δεν καταλαβα τι ακριβως λες.Εξηγησε το λιγο ξανα. Για το reuse time μιλας;
  11. Ευχαριστω public static final int rewardId = 2807; public static final int rewardCount = 50;
  12. αν ειναι αγορασμενο sigmo ζητα βοηθεια απο τους owners.
  13. Good Luck σε ολους σας!
  14. δε μου ερχεται καμια ιδεα για αυτο , το μονο που μου ερχεται ειναι σε ολους τους χαρακτηρες ξερω γω ανα 1 ωρα να τους ερχεται ενα παραθυρο για να βαζουν εναν τυχαιο κωδικο. Οποιος δεν τον βαλει τον πεταει.
  15. και νομιζεις οτι θα στο δωσει αυτο καποιος τσαμπα ε;
  16. as i see , it'a simple server with no special mods.
  17. Never heard about it , what exactly you do with that?
  18. NullPointerException(NPE) check για Null λειπει προσπαθησε να βαλεις στην σειρα που σου λεει πιο πανω check για τον παιχτη. if(activeChar == null) return;
  19. Οfc. L2PcInstance method: isFalling() delete these lines: final int damage = (int)Formulas.calcFallDam(this, deltaZ); if (damage > 0) { reduceCurrentHp(Math.min(damage, getCurrentHp() - 1), null, false, true, null); sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FALL_DAMAGE_S1).addNumber(damage)); }
  20. να σαι καλα φιλε. Ναι το ειχα , 2 αντιγραφα πουληθηκαν αλλα αποφασισα να το κανω share τελικα. Αυτοι που το αγορασαν πηραν δωρο ακομα 2 event για να μην αδικηθουν.
  21. Ευχαριστω φιλε ;)
  22. Ολα ειναι αυτοματα. Καθε 2 ωρες(μπορειτε να το αλλαξετε) ενα item(μπορειτε να το αλλαξετε , default: rabbit ears) πεφτει σε μια τυχαια περιοχη(εσεις διαλεγετε ολα τα πιθανα coordinates που μπορει να πεσει) και οι παικτες ενημερωνονται οτι το event ξεκινησε και σε ποια περιοχη επεσε. Π.χ μπορει να ειναι στην Giran Town , αλλα μπορει να ειναι οπουδηποτε εκει.Εχουν 15 λεπτα(μπορειτε να το αλλαξετε) να το βρουνε αλλιως εξαφανιζεται και το event τελειωνει.Ο πρωτος που το βρει και το κανει drop κερδιζει το event και παιρνει το reward(Default: 50 gold bars, μπορειτε να το αλλαξετε). Το event αρχιζει παλι σε 2 ωρες(οπως ειπα μπορειτε να το αλλαξετε).Στην διαρκεια του event ο admin μπορει να πατησει //gohide για να παει στην περιοχη που ειναι το item ακριβως. ### Eclipse Workspace Patch 1.0 #P Chr.6GMS Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -51,6 +51,7 @@ import net.sf.l2j.gameserver.ai.L2PlayerAI; import net.sf.l2j.gameserver.cache.HtmCache; import net.sf.l2j.gameserver.cache.WarehouseCacheManager; +import net.sf.l2j.gameserver.clientpackets.Say2; import net.sf.l2j.gameserver.communitybbs.BB.Forum; import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager; import net.sf.l2j.gameserver.datatables.CharTemplateTable; @@ -82,6 +83,7 @@ import net.sf.l2j.gameserver.model.BlockList; import net.sf.l2j.gameserver.model.FishData; import net.sf.l2j.gameserver.model.ForceBuff; +import net.sf.l2j.gameserver.model.Hide; import net.sf.l2j.gameserver.model.Inventory; import net.sf.l2j.gameserver.model.ItemContainer; import net.sf.l2j.gameserver.model.L2Attackable; @@ -137,6 +139,7 @@ import net.sf.l2j.gameserver.serverpackets.ChangeWaitType; import net.sf.l2j.gameserver.serverpackets.CharInfo; import net.sf.l2j.gameserver.serverpackets.ConfirmDlg; +import net.sf.l2j.gameserver.serverpackets.CreatureSay; import net.sf.l2j.gameserver.serverpackets.EtcStatusUpdate; import net.sf.l2j.gameserver.serverpackets.ExAutoSoulShot; import net.sf.l2j.gameserver.serverpackets.ExDuelUpdateUserInfo; @@ -3826,6 +3829,16 @@ && (target.getOwnerId() == getObjectId() || isInLooterParty(target.getOwnerId()))) target.resetOwnerTimer(); + if(target.isHide()){ + + getInventory().addItem("", Hide.rewardId, Hide.rewardCount, this, null); + sendPacket(new InventoryUpdate()); + sendMessage("You won the event!"); + Hide.cleanEvent(); + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Hide Event","Winner is: "+getName()+".Event ended.")); + target.setHide(false); + return; + } // Remove the L2ItemInstance from the world and send server->client GetItem packets target.pickupMe(this); if(Config.SAVE_DROPPED_ITEM) // item must be removed from ItemsOnGroundManager if is active Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGoHide.java =================================================================== --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGoHide.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGoHide.java (revision 0) @@ -0,0 +1,59 @@ +/* This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * http://www.gnu.org/copyleft/gpl.html + */ +package net.sf.l2j.gameserver.handler.admincommandhandlers; + +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.model.Hide; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; + +/** + * + * @author Iracundus + */ +public class AdminGoHide implements IAdminCommandHandler +{ + + private static String[] ADMIN_COMMANDS = {"admin_gohide"}; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + if(command.startsWith("admin_gohide")){ + if(activeChar == null) + return false; + + if(Hide.running == false){ + activeChar.sendMessage("Event is not in progress"); + return false; + } + + int x = Hide.getX() , y = Hide.getY() , z = Hide.getZ(); + activeChar.teleToLocation(x, y, z); + } + + return true; + } + + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } + +} Index: java/net/sf/l2j/gameserver/model/L2ItemInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/L2ItemInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/L2ItemInstance.java (working copy) @@ -92,6 +92,8 @@ /** Slot where item is stored */ private int _locData; + private boolean hide; + /** Level of enchantment of the item */ private int _enchantLevel; @@ -286,6 +288,14 @@ } } + public boolean isHide(){ + return hide; + } + + public void setHide(boolean j){ + hide = j; + } + // No logging (function designed for shots only) public void changeCountWithoutTrace(String process, int count, L2PcInstance creator, L2Object reference) { Index: java/net/sf/l2j/gameserver/model/Hide.java =================================================================== --- java/net/sf/l2j/gameserver/model/Hide.java (revision 0) +++ java/net/sf/l2j/gameserver/model/Hide.java (revision 0) @@ -0,0 +1,120 @@ +package net.sf.l2j.gameserver.model; + + +import net.sf.l2j.gameserver.ThreadPoolManager; +import net.sf.l2j.gameserver.clientpackets.Say2; +import net.sf.l2j.gameserver.network.SystemMessageId; +import net.sf.l2j.gameserver.serverpackets.CreatureSay; +import net.sf.l2j.gameserver.serverpackets.SystemMessage; +import net.sf.l2j.gameserver.util.Broadcast; +import net.sf.l2j.util.Rnd; + +public class Hide{ + + public static final int rewardId = 2807; + public static final int rewardCount = 50; + private static Hide _instance; + private final int delay = 180000; + private final static int itemId = 7683; + private final static int itemCount = 1; + public static boolean running = false; + private static int x; + private static int y; + private static int z = 0; + private final int[][] teleports = { {116496,145020,-2569} , {18605,145378,-3129} , {-83083,150505,-3134} }; + static L2ItemInstance item = null; + + public static int getX(){ + return x; + } + + public static int getY(){ + return y; + } + + public static int getZ(){ + return z; + } + + public static int getItemId(){ + return itemId; + } + + public static int getItemCount(){ + return itemCount; + } + + public void startEvent(){ + running = true; + System.out.println("Automatic Hide Event started with success."); + int s = Rnd.get(teleports.length); + x = teleports[s][0]; + y = teleports[s][1]; + z = teleports[s][2]; + SystemMessage sm = new SystemMessage(SystemMessageId.S2_WAS_DROPPED_IN_THE_S1_REGION); + sm.addZoneName(getX(), getY(), getZ()); + sm.addItemName(itemId); + item = new L2ItemInstance(Rnd.get(65535),itemId); + L2World.getInstance().storeObject(item); + item.setCount(itemCount); + item.setHide(true); + item.getPosition().setWorldPosition(x, y ,z); + item.getPosition().setWorldRegion(L2World.getInstance().getRegion(item.getPosition().getWorldPosition())); + item.getPosition().getWorldRegion().addVisibleObject(item); + item.setProtected(false); + item.setIsVisible(true); + L2World.getInstance().addVisibleObject(item, item.getPosition().getWorldRegion(), null); + + + + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Hide Event","Event started, Item dropped: "+item.getItem().getName()+", find it and win!")); + Broadcast.toAllOnlinePlayers(sm); + ThreadPoolManager.getInstance().scheduleGeneral(new Check(), 60000); + } + + public void checkAfterTime(){ + if(running == false) + return; + if(item.isHide()) + item.setHide(false); + item.decayMe(); + L2World.getInstance().removeObject(item); + cleanEvent(); + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Hide Event","Unfortunately,none find the item , event finished!")); + } + + public static void cleanEvent(){ + x = 0; + y = 0; + z = 0; + running = false; + if(item != null){ + item.decayMe(); + L2World.getInstance().removeObject(item); + } + item = null; + } + + private Hide(){ + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Event(), delay, delay); + System.out.println("Automatic Hide event loaded with success."); + } + + public static Hide getInstance(){ + if(_instance == null) + _instance = new Hide(); + return _instance; + } + + public class Check implements Runnable{ + public void run(){ + checkAfterTime(); + } + } + + public class Event implements Runnable{ + public void run(){ + startEvent(); + } + } +} \ No newline at end of file Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -90,6 +90,7 @@ import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGeodata; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGm; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGmChat; +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGoHide; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHelpPage; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminInvul; @@ -218,6 +219,7 @@ import net.sf.l2j.gameserver.instancemanager.SiegeManager; import net.sf.l2j.gameserver.model.AutoChatHandler; import net.sf.l2j.gameserver.model.AutoSpawnHandler; +import net.sf.l2j.gameserver.model.Hide; import net.sf.l2j.gameserver.model.L2Manor; import net.sf.l2j.gameserver.model.L2PetDataTable; import net.sf.l2j.gameserver.model.L2World; @@ -518,6 +520,7 @@ _adminCommandHandler = AdminCommandHandler.getInstance(); _adminCommandHandler.registerAdminCommandHandler(new AdminAdmin()); + _adminCommandHandler.registerAdminCommandHandler(new AdminGoHide()); _adminCommandHandler.registerAdminCommandHandler(new AdminInvul()); _adminCommandHandler.registerAdminCommandHandler(new AdminDelete()); _adminCommandHandler.registerAdminCommandHandler(new AdminKill()); @@ -604,6 +607,7 @@ CoupleManager.getInstance(); TaskManager.getInstance(); + Hide.getInstance(); GmListTable.getInstance(); Credits me
  23. Θα βαλεις τα αρχεια απο το source (gameserver,dapack κλπ ) στο workspace. Μετα θα πας στο eclipse θα πατησεις δεξι klik , new java project και θα πας να βρεις ενα ενα τους φακελους. Ετσι θα μπορεις να εχεις το source στο eclipse σου και να προσθετεις java codes.
  24. Remove the thread.sleep and make it using threads better.
×
×
  • 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