Jump to content
  • 0

Save the place before teleportation aCis


l2jkain

Question

Hello, I wanted to know how I can save a coordinate, because on my tvt when the event ends I'm teleported to giran I would like to know how I can get where I was

 

This instead of putting me where I was, leaves me in the same place after the event ends.

 


int[] playerCoordinates = new int[]
                        {
                        player.getPosition().getX(),
                        player.getPosition().getY(),
                        player.getPosition().getZ(),
                        player.getPosition().getHeading()
                        };
                    
                    new EventTeleporter(player, playerCoordinates, false);
 

                   

Link to comment
Share on other sites

Recommended Posts

  • 0
1 hour ago, Nightw0lf said:

newbie approach, if they get dc this info is lost xD

That's why I said later to change return into teleport to town. There is no real need to store place they were, just fancy crap. So, if it exists teleport to the same place, otherwise tele to town. It's enough :p

 

It's bad code, but WORKS! :D

Link to comment
Share on other sites

  • 0
3 hours ago, l2jkain said:

 

no matter what place it does not work

 

I removed all restriction of the same only let the tvt and the npc register does not always work that message should be aCis bug

No Isn't acis bug. It works for me. Players teleporting on their saved location normally. Use eclipse search for this error. Probably something goes wrong on Player.java
By default, while you use observer in game (Observer or oly maches) you cannot target/hit players etc. That's your "bug", when you try to save the location the player automatic get _observerMode = true;

Link to comment
Share on other sites

  • 0

He had there an (new class, which is lol) teleportation method. Probably that's the issue. Anyway, we can't help him when he fail with provided, working, code.

Link to comment
Share on other sites

  • 0
5 horas atrás, 'Baggos' disse:

Não é um bug acis. Funciona para mim. Jogadores que se teletransportam em sua localização salva normalmente. Use a pesquisa do eclipse para este erro. Provavelmente algo dá errado no Player.java
Por padrão, enquanto você usa o observador no jogo (Observer ou oly maches) você não pode mirar / acertar jogadores, etc. Esse é o seu "bug", quando você tenta salvar a localização automática do player _observerMode = verdade;

 

5 horas atrás, SweeTs disse:

Ele tinha lá um método de teletransporte (nova classe, que é lol). Provavelmente é esse o problema. De qualquer forma, não podemos ajudá-lo quando ele falha com o código fornecido, funcionando.

 

plMrr1E.png

 

Meu código, eu não consigo encontrar o erro de qualquer maneira eu vou remover o teleport e fazer alguns testes para ver o que eu posso fazer melhor.

 

https://pastebin.com/raw/x9GwZugx

 

não há nada errado com o erro Player.java é gerado por

 

player.getSavedLocation (). set (player.getPosition ());

 

// / implementa Runnable e inicia-se no construtor
+ new EventTeleport (player, team.getCoordinates (), false, false); << --- está salvando o local desde o início, mas entra no modo de exibição

 

There is nothing wrong here Player.java that gives this error

 


Index: java/net/sf/l2j/gameserver/model/actor/instance/Player.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/Player.java    (revision 2)
+++ java/net/sf/l2j/gameserver/model/actor/instance/Player.java    (working copy)
@@ -105,6 +105,7 @@
 import net.sf.l2j.gameserver.model.entity.Hero;
 import net.sf.l2j.gameserver.model.entity.Siege;
 import net.sf.l2j.gameserver.model.entity.Siege.SiegeSide;
+import net.sf.l2j.gameserver.model.entity.engine.TeamVsTeam;
 import net.sf.l2j.gameserver.model.group.CommandChannel;
 import net.sf.l2j.gameserver.model.group.Party;
 import net.sf.l2j.gameserver.model.group.Party.LootRule;
@@ -578,6 +579,9 @@
     
     private Door _requestedGate;
     
+    private int _eventkills;
+    private short _points = 0;
+    
     /**
      * Constructor of Player (use Creature constructor).
      * <ul>
@@ -2897,6 +2901,13 @@
     @Override
     public void onAction(Player player)
     {
+        // Check if this Player is in an event
+        if (!TeamVsTeam.onAction(player.getName(), getName())) 
+        {
+            player.sendPacket(ActionFailed.STATIC_PACKET);
+            return;
+        }
+        
         // Set the target of the player
         if (player.getTarget() != this)
             player.setTarget(this);
@@ -2908,7 +2919,7 @@
                 player.getAI().setIntention(CtrlIntention.INTERACT, this);
                 return;
             }
-            
+    
             // Check if this Player is autoAttackable
             if (isAutoAttackable(player))
             {
@@ -2941,6 +2952,13 @@
     {
         if (player.isGM())
             AdminEditChar.showCharacterInfo(player, this);
+
+        // Check if this Player is in an event
+        if (!TeamVsTeam.onAction(player.getName(), getName())) 
+        {
+            player.sendPacket(ActionFailed.STATIC_PACKET);
+            return;
+        }
         
         super.onActionShift(player);
     }
@@ -3649,16 +3667,21 @@
         if (isMounted())
             stopFeed();
         
+        // kill the player in event
+        getEventKills();
+        
         synchronized (this)
         {
             if (isFakeDeath())
                 stopFakeDeath(true);
         }
         
+        TeamVsTeam.onKill(killer, this);
+        
         if (killer != null)
         {
             Player pk = killer.getActingPlayer();
-            
+
             // Clear resurrect xp calculation
             setExpBeforeDeath(0);
             
@@ -3896,6 +3919,9 @@
         if (player == null)
             return;
         
+        if (isInFunEvent() == false)
+            return;
+        
         if (isInDuel() && player.getDuelId() == getDuelId())
             return;
         
@@ -6296,6 +6322,10 @@
         if (attacker instanceof Monster)
             return true;
         
+        // Check if the attacker is in events started
+        if (isInFunEvent())
+            return true;
+        
         // Check if the attacker is not in the same party
         if (_party != null && _party.containsPlayer(attacker))
             return false;
@@ -9278,6 +9308,9 @@
                 
                 if (OlympiadManager.getInstance().isRegisteredInComp(this))
                     OlympiadManager.getInstance().removeDisconnectedCompetitor(this);
+
+                if (isInFunEvent())
+                    TeamVsTeam.removeParticipant(getName());
                 
                 // Open a Html message to inform the player
                 final NpcHtmlMessage html = new NpcHtmlMessage(0);
@@ -9425,7 +9458,7 @@
         if (_deathPenaltyBuffLevel >= 15) // maximum level reached
             return;
         
-        if ((getKarma() > 0 || Rnd.get(1, 100) <= Config.DEATH_PENALTY_CHANCE) && !(killer instanceof Player) && !isGM() && !(getCharmOfLuck() && (killer == null || killer.isRaid())) && !isPhoenixBlessed() && !(isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.SIEGE)))
+        if ((getKarma() > 0 || Rnd.get(1, 100) <= Config.DEATH_PENALTY_CHANCE) && !(killer instanceof Player) && !isGM() && !(getCharmOfLuck() && (killer == null || killer.isRaid())) && !isPhoenixBlessed() && !(isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.SIEGE)) && isInFunEvent())
         {
             if (_deathPenaltyBuffLevel != 0)
                 removeSkill(5076, false);
@@ -9808,7 +9841,7 @@
         if (summonerChar == null)
             return false;
         
-        if (summonerChar.isInOlympiadMode() || summonerChar.isInObserverMode() || summonerChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || summonerChar.isMounted())
+        if (summonerChar.isInFunEvent() || summonerChar.isInOlympiadMode() || summonerChar.isInObserverMode() || summonerChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || summonerChar.isMounted())
             return false;
         
         return true;
@@ -9845,7 +9878,7 @@
             return false;
         }
         
-        if (targetChar.isFestivalParticipant() || targetChar.isMounted())
+        if (targetChar.isFestivalParticipant() || targetChar.isMounted() || targetChar.isInFunEvent())
         {
             summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
             return false;
@@ -10237,4 +10270,34 @@
             }
         }
     }
+
+    public int getEventKills()
+    {
+        return _eventkills;
+    }
+
+    public void increaseKills()
+    {
+        _eventkills++;
+    }
+    
+    public short getScore()
+    {
+        return _points;
+    }
+
+    public void clearPoints()
+    {
+        _points = 0;
+    }
+    
+    public void increaseScore()
+    {
+        _points++;
+    }
+    
+    public boolean isInFunEvent()
+    {
+        return ((TeamVsTeam.isStarted() && TeamVsTeam.isPlayerParticipant(getName())) && !isGM());
+    }
 }

Edited by l2jkain
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...