Ir para conteúdo
  • Cadastre-se
  • 0

Mudando código simples do Mod


AikoN~

Pergunta

Oiiiee, estou com um evento aqui onde existe DOIS times, um ataca uma bandeira enquanto o outro defende essa bandeira. 

Se o time atacante destrói as 3 bandeiras ele ganha e se não destruir o defensor ganha... 

Queria mudar esse código para que os dois times atacassem a bandeira do inimigo. Cada time tem suas próprias 3 bandeiras para defender e a proposta é destruir as 3 do adversário. 

Código UM:  head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java

 

                  if (getNpcId() == 36006)


                        {
                            if(!CastleWars.isFinished)
                            {
                                CastleWars.flagskilled++;
                                CastleWars.attackersWin();
                            }
                            
                        }
           

Eu tentei multiplicar ele pondo o mesmo código embaixo e mudando o ID para 36007 e o flags para flags2.. mais deu error ao compilar. 

O código principal seria esse: head-src/com/l2jfrozen/gameserver/model/entity/event/CastleWars.java

 

 +  */


+ /**
+  * @author Boorinio
+  */
+ package com.l2jfrozen.gameserver.model.entity.event;

+ import java.util.List;

+ import com.l2jfrozen.gameserver.model.entity.Announcements;
+ import com.l2jfrozen.gameserver.datatables.csv.DoorTable;
+ import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
+ import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
+ import com.l2jfrozen.gameserver.model.L2World;
+ import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
+ import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+ import com.l2jfrozen.gameserver.templates.L2NpcTemplate;

+ import javolution.util.FastList;
+ import javolution.util.FastSet;

+ public class CastleWars
+ {
+     private static List<L2PcInstance> _defenders = new FastList<L2PcInstance>();
+     private static List<L2PcInstance> _attackers = new FastList<L2PcInstance>();
+     private static FastSet<L2NpcInstance> _flags = new FastSet<L2NpcInstance>();
+     public static boolean isFinished;
+     public static boolean CastleRegi;
+     public static boolean isRunning;
+     private static boolean alaksokolies = false;
+     private static int i;
+     public static int flagskilled = 0;
+     public static int defendersx = 77566;
+     public static int defendersy = -152128;
+     public static int defendersz = -545;
+     public static int attackersx = 84303;
+     public static int attackersy = -140727;
+     public static int attackersz = -1568;
+     public static int[] flagslocx =
+     {
+     77545, 76663, 78446,
+     };
+     private static int[] flagslocy =
+     {
+     -149937, -154522, -154524,
+     };
+     private static int[] flagslocz =
+     {
+     345, 128, 235,
+     };
+     
+     public static void openRegi()
+     {
+         Announcements.getInstance().announceToAll("Castle Wars Event has Started!");
+         Announcements.getInstance().announceToAll("Type .join to enter or .leave to leave!");
+         Announcements.getInstance().announceToAll("You have 5 minutes to register!");
+         isRunning = true;
+         isFinished = false;
+         CastleRegi = true;
+         waitSecs(300);
+         stopRegi();
+         preparecastle();
+         shufflePlayers();
+         teleportThem();
+         Announcements.getInstance().announceToAll("You have 10 minutes till the event is finished!");
+         waitSecs(600);
+         if (!isFinished)
+         {
+             defendersWin();
+             
+         }
+         
+     }
+     
+     public static void preparecastle()
+     {
+         DoorTable.getInstance().getDoor(22130001).openMe();
+         DoorTable.getInstance().getDoor(22130002).openMe();
+         DoorTable.getInstance().getDoor(22130003).openMe();
+         DoorTable.getInstance().getDoor(22130004).openMe();
+         DoorTable.getInstance().getDoor(22130005).openMe();
+         DoorTable.getInstance().getDoor(22130010).openMe();
+         DoorTable.getInstance().getDoor(22130007).openMe();
+         DoorTable.getInstance().getDoor(22130011).openMe();
+         DoorTable.getInstance().getDoor(22130009).openMe();
+         DoorTable.getInstance().getDoor(22130008).openMe();
+         DoorTable.getInstance().getDoor(22130010).openMe();
+         DoorTable.getInstance().getDoor(22130006).openMe();
+         L2NpcInstance flags = null;
+         for (i = 0; i < 3; i++)
+         {
+             flags = addSpawn(36006, flagslocx, flagslocy, flagslocz);
+             _flags.add(flags);
+         }
+     }
+     
+     public static void cleanevent()
+     {
+         for (L2PcInstance defender : _defenders)
+         {
+             defender.getAppearance().setNameColor(0xFFFFFF);
+             defender.setTitle("");
+             defender.broadcastUserInfo();
+             defender.teleToLocation(82724, 148307, -3469);
+             defender.isinCastleWars = false;
+             defender.isDefender=false;
+         }
+         for (L2PcInstance attacker : _attackers)
+         {
+             attacker.getAppearance().setNameColor(0xFFFFFF);
+             attacker.setTitle("");
+             attacker.broadcastUserInfo();
+             attacker.teleToLocation(82724, 148307, -3469);
+             attacker.isinCastleWars = false;
+             attacker.isAttacker=false;
+         }
+         for (L2NpcInstance flags : _flags)
+         {
+             flags.deleteMe();
+             
+         }
+         flagskilled = 0;
+         _flags.clear();
+         _defenders.clear();
+         _attackers.clear();
+         DoorTable.getInstance().getDoor(22130001).closeMe();
+         DoorTable.getInstance().getDoor(22130002).closeMe();
+         DoorTable.getInstance().getDoor(22130003).closeMe();
+         DoorTable.getInstance().getDoor(22130004).closeMe();
+         DoorTable.getInstance().getDoor(22130005).closeMe();
+         DoorTable.getInstance().getDoor(22130010).closeMe();
+         DoorTable.getInstance().getDoor(22130007).closeMe();
+         DoorTable.getInstance().getDoor(22130011).closeMe();
+         DoorTable.getInstance().getDoor(22130009).closeMe();
+         DoorTable.getInstance().getDoor(22130008).closeMe();
+         DoorTable.getInstance().getDoor(22130010).closeMe();
+         DoorTable.getInstance().getDoor(22130006).closeMe();
+     }
+     
+     public static void defendersWin()
+     {
+         Announcements.getInstance().announceToAll("Defenders Won the event they protected the flags!");
+         for (L2PcInstance defender : _defenders)
+         {
+             defender.sendMessage("Congratulations! Here is a reward for your effort!");
+             defender.addItem("Reward", 3470, 1, defender, true);
+         }
+         isFinished = true;
+         cleanevent();
+     }
+     
+     public static void attackersWin()
+     {
+         if (flagskilled == 3)
+         {
+             Announcements.getInstance().announceToAll("Attackers Won the event they killed all the flags!");
+             for (L2PcInstance attacker : _attackers)
+             {
+                 attacker.sendMessage("Congratulations! Here is a reward for your effort!");
+                 attacker.addItem("Reward", 3470, 1, attacker, true);
+             }
+             isFinished = true;
+             cleanevent();
+         }
+     }
+     
+     public static void teleportThem()
+     {
+         for (L2PcInstance defender : _defenders)
+         {
+             defender.teleToLocation(defendersx, defendersy, defendersz);
+         }
+         for (L2PcInstance attacker : _attackers)
+         {
+             attacker.teleToLocation(attackersx, attackersy, attackersz);
+         }
+     }
+     
+     public static void stopRegi()
+     {
+         Announcements.getInstance().announceToAll("Registrations are now over!");
+         CastleRegi = false;
+     }
+     
+     public static void shufflePlayers()
+     {
+         for (L2PcInstance player : L2World.getInstance().getAllPlayers())
+         {
+             if (player.isinCastleWars)
+             {
+                 if (alaksokolies)
+                 {
+                     _defenders.add(player);
+                     player.getAppearance().setNameColor(0xFF0000);
+                     player.setTitle("Defender");
+                     player.broadcastUserInfo();
+                     player.isDefender=true;
+                     alaksokolies = false;
+                 }
+                 else
+                 {
+                     _attackers.add(player);
+                     player.getAppearance().setNameColor(0x0000FF);
+                     player.setTitle("Attacker");
+                     player.broadcastUserInfo();
+                     player.isAttacker=true;
+                     alaksokolies = true;
+                 }
+             }
+         }
+     }
+     
+     public static void waitSecs(int i)
+     {
+         try
+         {
+             Thread.sleep(i * 1000);
+         }
+         catch (InterruptedException ie)
+         {
+             ie.printStackTrace();
+         }
+     }
+     
+     private static L2NpcInstance addSpawn(int npcId, int x, int y, int z)
+     {
+         L2NpcInstance result = null;
+         try
+         {
+             L2NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
+             if (template != null)
+             {
+                 L2Spawn spawn = new L2Spawn(template);
+                 spawn.setInstanceId(0);
+                 spawn.setHeading(1);
+                 spawn.setLocx(x);
+                 spawn.setLocy(y);
+                 spawn.setLocz(z);
+                 spawn.stopRespawn();
+                 result = spawn.spawnOne();
+                 return result;
+             }
+         }
+         catch (Exception e1)
+         {
+         }
+         return null;
+     }
+ }

 

Esse aqui eu não estou conseguindo por a opção dos 2 times tanto atacarem como defenderem suas bandeiras... Me ajudaaaaaaaaaaaaaaaaaaaaa pufavo

alguém adapta isso pra mim? 

 

//RESOLVIDO, CONSEGUI... :)

Editado por Psiu
Topico Resolvido

spacer.png

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts recomendados

Até agora não há respostas para essa pergunta

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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  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.

Processando...
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.





×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.