Esempio n. 1
0
        private void OnTQCommand(Client client, string command, string[] args)
        {
            TeleportState state = _states[client];

            if (state.QuestId != -1 && state.QuestLocation != null)
            {
                float minDistance = state.QuestLocation.DistanceSquaredTo(client.PlayerData.Pos);
                int   target      = client.ObjectId;

                foreach (var pair in state.PlayerLocations)
                {
                    float distance = pair.Value.DistanceSquaredTo(state.QuestLocation);
                    if (distance < minDistance)
                    {
                        minDistance = distance;
                        target      = pair.Key;
                    }
                }

                if (target != client.ObjectId)
                {
                    TeleportPacket teleport = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                    teleport.ObjectId = target;
                    client.SendToServer(teleport);
                    client.SendToClient(PluginUtils.CreateNotification(
                                            client.ObjectId, "Teleported to " + state.PlayerNames[target]));
                }
                else
                {
                    client.SendToClient(PluginUtils.CreateNotification(
                                            client.ObjectId, "You're the closest to your quest!"));
                }
            }
        }
Esempio n. 2
0
        private void OnTPCommand(Client client, string command, string[] args)
        {
            TeleportState state = _states[client];

            if (args.Length == 0)
            {
                return;
            }

            foreach (var pair in state.PlayerNames)
            {
                if (pair.Value.ToLower().Contains(args[0].ToLower()))
                {
                    TeleportPacket teleport = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                    teleport.ObjectId = pair.Key;
                    client.SendToServer(teleport);
                    client.SendToClient(PluginUtils.CreateNotification(
                                            client.ObjectId, "Teleported to " + pair.Value));
                    return;;
                }
            }

            client.SendToClient(PluginUtils.CreateNotification(
                                    client.ObjectId, "Player with \"" + args[0] + "\" in their name was not found!"));
        }
Esempio n. 3
0
        public void Teleport(TeleportPacket teleportPacket)
        {
            var session =
                ServerManager.Instance.Sessions.Values.FirstOrDefault(s =>
                                                                      s.Character.Name == teleportPacket.TeleportArgument);

            if (!short.TryParse(teleportPacket.TeleportArgument, out var mapId))
            {
                if (session == null)
                {
                    Logger.Log.Error(Language.Instance.GetMessageFromKey(LanguageKey.USER_NOT_CONNECTED,
                                                                         Session.Account.Language));
                    return;
                }

                Session.ChangeMap(session.Character.MapId, session.Character.MapX, session.Character.MapY);
                return;
            }

            var mapInstance = _mapInstanceAccessService.GetBaseMapById(mapId);

            if (mapInstance == null)
            {
                Logger.Log.Error(
                    Language.Instance.GetMessageFromKey(LanguageKey.MAP_DONT_EXIST, Session.Account.Language));
                return;
            }

            Session.ChangeMap(mapId, teleportPacket.MapX, teleportPacket.MapY);
        }
Esempio n. 4
0
        public void Teleport(TeleportPacket teleportPacket)
        {
            var session =
                Broadcaster.Instance.GetCharacter(s =>
                                                  s.Name == teleportPacket.TeleportArgument); //TODO setter to protect

            if (!short.TryParse(teleportPacket.TeleportArgument, out var mapId))
            {
                if (session == null)
                {
                    _logger.Error(Language.Instance.GetMessageFromKey(LanguageKey.USER_NOT_CONNECTED,
                                                                      Session.Account.Language));
                    return;
                }

                Session.ChangeMapInstance(session.MapInstanceId, session.MapX, session.MapY);
                return;
            }

            var mapInstance = _mapInstanceAccessService.GetBaseMapById(mapId);

            if (mapInstance == null)
            {
                _logger.Error(
                    Language.Instance.GetMessageFromKey(LanguageKey.MAP_DONT_EXIST, Session.Account.Language));
                return;
            }

            Session.ChangeMap(mapId, teleportPacket.MapX, teleportPacket.MapY);
        }
Esempio n. 5
0
        public void Teleport(RealmTime time, TeleportPacket pkt)
        {
            var obj = Owner.GetEntity(pkt.ObjectId);

            if (obj == null)
            {
                return;
            }
            Move(obj.X, obj.Y);
            fames.Teleport();
            SetNewbiePeriod();
            UpdateCount++;
            Owner.BroadcastPacket(new GotoPacket()
            {
                ObjectId = Id,
                Position = new Position()
                {
                    X = X,
                    Y = Y
                }
            }, null);
            Owner.BroadcastPacket(new ShowEffectPacket()
            {
                EffectType = EffectType.Teleport,
                TargetId   = Id,
                PosA       = new Position()
                {
                    X = X,
                    Y = Y
                },
                Color = new ARGB(0xFFFFFFFF)
            }, null);
        }
Esempio n. 6
0
 // Token: 0x060004E4 RID: 1252 RVA: 0x0001C634 File Offset: 0x0001A834
 public void Teleport(TeleportPacket teleport)
 {
     if (!Settings.Default.EnableFameTools)
     {
         return;
     }
     if (Settings.Default.FameBlockTeleports)
     {
         teleport.Send = false;
         this.client.CreateOryxNotification("Fame Block", "Teleport blocked for Boots on the Ground!");
         //TextPacket.CreateOryxNotification("Fame Block", "Teleport blocked for Boots on the Ground!");
     }
 }
Esempio n. 7
0
 public void Teleport(RealmTime time, TeleportPacket pkt)
 {
     Teleport(time, pkt.ObjectId);
 }
Esempio n. 8
0
        public void Teleport(RealmTime time, TeleportPacket packet)
        {
            var obj = Client.Player.Owner.GetEntity(packet.ObjectId);

            try
            {
                if (obj == null)
                {
                    return;
                }
                if (!TpCooledDown())
                {
                    SendError("Player.teleportCoolDown");
                    return;
                }
                if (obj.HasConditionEffect(ConditionEffectIndex.Invisible))
                {
                    SendError("server.no_teleport_to_invisible");
                    return;
                }
                if (obj.HasConditionEffect(ConditionEffectIndex.Paused))
                {
                    SendError("server.no_teleport_to_paused");
                    return;
                }
                var player = obj as Player;
                if (player != null && !player.NameChosen)
                {
                    SendError("server.teleport_needs_name");
                    return;
                }
                if (obj.Id == Id)
                {
                    SendError("server.teleport_to_self");
                    return;
                }
                if (player.Client.Account.Rank < 1)
                {
                    if (!Owner.AllowTeleport)
                    {
                        SendError(GetLanguageString("server.no_teleport_in_realm", new KeyValuePair <string, object>("realm", Owner.Name)));
                        return;
                    }
                }

                SetTpDisabledPeriod();
                Move(obj.X, obj.Y);
                Pet?.Move(obj.X, obj.X);
                FameCounter.Teleport();
                SetNewbiePeriod();
                detectGodExploit = 7000;
                ApplyConditionEffect(new ConditionEffect
                {
                    Effect     = ConditionEffectIndex.Invulnerable,
                    DurationMS = 5 * 1000
                });
                UpdateCount++;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                SendError("player.cannotTeleportTo");
                return;
            }
            Owner.BroadcastPacket(new GotoPacket
            {
                ObjectId = Id,
                Position = new Position
                {
                    X = X,
                    Y = Y
                }
            }, null);
            Owner.BroadcastPacket(new ShowEffectPacket
            {
                EffectType = EffectType.Teleport,
                TargetId   = Id,
                PosA       = new Position
                {
                    X = X,
                    Y = Y
                },
                Color = new ARGB(0xFFFFFFFF)
            }, null);
        }
Esempio n. 9
0
        private void proxy_Move(Client client, Packet real_packet)
        {
            MovePacket packet = (MovePacket)real_packet;

            if (Master == null)
            {
                Time[client] = packet.Time;

                return;
            }

            if (Master != client)
            {
                if (client.PlayerData.Pos.DistanceTo(Master.PlayerData.Pos) > 2)
                {
                    if (TeleportState[client] > 1)
                    {
                        TeleportState[client]--;
                    }
                    else if (TeleportState[client] == 0)
                    {
                        TeleportPacket tp = (TeleportPacket)TeleportPacket.Create(PacketType.TELEPORT);

                        tp.ObjectId = Master.ObjectId;

                        client.SendToServer(tp);

                        TeleportState[client] = 10000 / 200;
                    }

                    /*Master.SendToClient(
                     *  PluginUtils.CreateNotification(Master.ObjectId,
                     *  "Player " + client.PlayerData.Name +
                     *  " is too far away from you to reposition!")
                     *  );*/

                    return;
                }

                // TODO: fix?

                /*
                 * if (packet.Records.Length == 0)
                 *  return;
                 *
                 * double angle = 180 / Math.PI * Math.Atan2(packet.NewPosition.Y - packet.Records[0].Y,
                 *  packet.NewPosition.X - packet.Records[0].X);
                 * if (angle % 90 == 0)
                 * {
                 */

                if (packet.Records.Length > 0 &&
                    packet.Records[0].X == packet.NewPosition.X &&
                    packet.Records[0].Y == packet.NewPosition.Y)
                {
                    GotoQueue.Add(client);
                }
            }
            else
            {
                while (GotoQueue.Count > 0)
                {
                    Client c = GotoQueue[0];
                    GotoQueue.RemoveAt(0);

                    GotoPacket gotop = (GotoPacket)GotoPacket.Create(PacketType.GOTO);

                    gotop.Location = new Location();

                    gotop.Location.X = Master.PlayerData.Pos.X;
                    gotop.Location.Y = Master.PlayerData.Pos.Y;

                    /*
                     * {
                     *  double rads = Math.PI / 180 * angle;
                     *
                     *  Location MasterRotated = RotateVector(Master.PlayerData.Pos, -rads);
                     *  Location MeRotated = RotateVector(packet.NewPosition, -rads);
                     *  MasterRotated.X -= MeRotated.X;
                     *  MasterRotated.Y = 0;
                     *
                     *  Location Rotated = RotateVector(MasterRotated, rads);
                     *
                     *  if (Math.Abs(Rotated.X + Rotated.Y) < 0.04)
                     *      return;
                     *
                     *  gotop.Location.X = packet.NewPosition.X - Rotated.X;
                     *  gotop.Location.Y = packet.NewPosition.Y - Rotated.Y;
                     * }
                     */
                    gotop.ObjectId = c.ObjectId;

                    c.SendToClient(gotop);


                    GotoSkipList[c].Add(1);
                }
            }
        }
Esempio n. 10
0
    // Token: 0x06000232 RID: 562 RVA: 0x0000FDC0 File Offset: 0x0000DFC0
    private void HandlePacket(Packet packet)
    {
        UpdatePacket updatePacket = packet as UpdatePacket;

        if (updatePacket != null)
        {
            this._objectTracker.Update(updatePacket);
            this.SafeWalk.Update(updatePacket);
            this._autoNexus.Update(updatePacket);
            this._fameHelper.Update(updatePacket);
            this._accuracyFarm.Update(updatePacket);
            this._antiLag.Update(updatePacket);
            this._autoLoot.Update(updatePacket);
            this._mapHack.Update(updatePacket);
            this._o3Helper.Update(updatePacket);
            this._showLHPot.Update(updatePacket);
            return;
        }
        NewTickPacket newTickPacket = packet as NewTickPacket;

        if (newTickPacket != null)
        {
            this._objectTracker.NewTick(newTickPacket);
            this._antiDebuffs.NewTick(newTickPacket);
            this._autoNexus.NewTick(newTickPacket);
            this._antiDdos.NewTick();
            this._fameHelper.NewTick(newTickPacket);
            this._accuracyFarm.NewTick(newTickPacket);
            this._antiLag.NewTick(newTickPacket);
            this._o3Helper.NewTick(newTickPacket);
            this._autoNexus2.NewTick(newTickPacket);
            return;
        }
        MovePacket movePacket = packet as MovePacket;

        if (movePacket != null)
        {
            this.PreviousTime = movePacket._Nx46RcGIU0H1BCGWaJXjN1ieopt;
            this._objectTracker.move(movePacket);
            this._antiDebuffs.Move(movePacket);
            this._autoLoot.Move(movePacket);
            this.AntiAfk.move(movePacket);
            this._autoNexus.move(movePacket);
            this._autoNexus2.move(movePacket);
            return;
        }
        MapInfoPacket mapInfoPacket = packet as MapInfoPacket;

        if (mapInfoPacket != null)
        {
            Console.WriteLine("Client: Map is " + mapInfoPacket.Name);
            this._objectTracker.MapInfo(mapInfoPacket);
            this._autoNexus2.MapInfo(mapInfoPacket);
            this.SafeWalk.MapInfo(mapInfoPacket);
            this._autoNexus.MapInfo(mapInfoPacket);
            this._autoLoot.MapInfo(mapInfoPacket);
            this._fameHelper.MapInfo();
            _accuracyFarm.MapInfo();
            this._antiLag.MapInfo(mapInfoPacket);
            this._mapHack.MapInfo(mapInfoPacket);
            this._o3Helper.MapInfo(mapInfoPacket);
            this._showLHPot.MapInfo(mapInfoPacket);
            return;
        }
        PlayerTextPacket playerTextPacket = packet as PlayerTextPacket;

        if (playerTextPacket != null)
        {
            this._teleportTools.text(playerTextPacket);
            this._ipJoin.text(playerTextPacket);
            this._fameHelper._QrK9KtR4xguWgEYrBE9xnEwwcqd(playerTextPacket);
            this._antiLag.PlayerText(playerTextPacket);
            this._mapHack.text(playerTextPacket);
            this._autoNexus._QrK9KtR4xguWgEYrBE9xnEwwcqd(playerTextPacket);
            return;
        }
        _5Qyhf9ImNgkDzh4BmaDRKP646iH createSuccessPacket = packet as _5Qyhf9ImNgkDzh4BmaDRKP646iH;

        if (createSuccessPacket != null)
        {
            this.PlayerId = createSuccessPacket.ObjectId;
            this._objectTracker._1lYB9SyYVs1zUAIHgLGbUs7pmeb();
            this._bazaarTimer.CreateSuccess();
            this._autoNexus2._1lYB9SyYVs1zUAIHgLGbUs7pmeb();
            return;
        }
        FailurePacket failurePacket = packet as FailurePacket;

        if (failurePacket != null)
        {
            Console.WriteLine(string.Format("Client: Got failure {0}, {1} ({2})", failurePacket.ErrorId, failurePacket.ErrorMessage, failurePacket.ErrorPlace));
            return;
        }
        ReconnectPacket reconnectPacket = packet as ReconnectPacket;

        if (reconnectPacket != null)
        {
            this.Reconnect(reconnectPacket);
            return;
        }
        HelloPacket helloPacket = packet as HelloPacket;

        if (helloPacket != null)
        {
            this.Hello(helloPacket);
            return;
        }
        PlayerHitPacket playerHitPacket = packet as PlayerHitPacket;

        if (playerHitPacket != null)
        {
            this._autoNexus.PlayerHit(playerHitPacket);
            this._antiDebuffs.PlayerHit(playerHitPacket);
            return;
        }
        AoEPacket pqhqze9k9pObME2LmlIcbfEeSYS = packet as AoEPacket;

        if (pqhqze9k9pObME2LmlIcbfEeSYS != null)
        {
            this._autoNexus._M1PxW31jx87SGG4gvOYAwe86vjg(pqhqze9k9pObME2LmlIcbfEeSYS);
            this._antiDebuffs.AoE(pqhqze9k9pObME2LmlIcbfEeSYS);
            return;
        }
        AoEAckPacket x7UwVkbcYG7VnZWu4HCA8hCeQtS = packet as AoEAckPacket;

        if (x7UwVkbcYG7VnZWu4HCA8hCeQtS != null)
        {
            this._autoNexus._iKqf12lpU2ifSlxUxUegqEC5CVe(x7UwVkbcYG7VnZWu4HCA8hCeQtS);
            return;
        }
        GroundDamagePacket hllcDvAIxPBOvJZP4BFTFQUoryN = packet as GroundDamagePacket;

        if (hllcDvAIxPBOvJZP4BFTFQUoryN != null)
        {
            this._autoNexus._524YRDmz9HCOj575eu5oeD5ruJb(hllcDvAIxPBOvJZP4BFTFQUoryN);
            return;
        }
        _6lHFncsY9352Wg3pNnnFZ49g5xA 6lHFncsY9352Wg3pNnnFZ49g5xA = packet as QuestObjIdPacket;
        if (6lHFncsY9352Wg3pNnnFZ49g5xA != null)
        {
            this._teleportTools._FMTVFcTfzNRteqoB3XiUkaNps7l(6lHFncsY9352Wg3pNnnFZ49g5xA);
            return;
        }
        ShowEffectPacket showEffectPacket = packet as ShowEffectPacket;

        if (showEffectPacket != null)
        {
            this._antiLag.ShowEffect(showEffectPacket);
            this._autoNexus._1nwhQXngJ6rNjd7Ufx1bWeF0vhM(showEffectPacket);
            this._o3Helper._1nwhQXngJ6rNjd7Ufx1bWeF0vhM(showEffectPacket);
            return;
        }
        _4wU9AwmH67XtmNygsXuDz9DUXYm 4wU9AwmH67XtmNygsXuDz9DUXYm = packet as _4wU9AwmH67XtmNygsXuDz9DUXYm;
        if (4wU9AwmH67XtmNygsXuDz9DUXYm != null)
        {
            this._antiLag._Q1PiJQ99KBCJeLcZ0HOk3AUAjIP(4wU9AwmH67XtmNygsXuDz9DUXYm);
            return;
        }
        PlayerShootPacket fbqBESNaaIBpK5dNK9X5lWOOll = packet as PlayerShootPacket;

        if (fbqBESNaaIBpK5dNK9X5lWOOll != null)
        {
            this._autoNexus2.PlayerShoot(fbqBESNaaIBpK5dNK9X5lWOOll);
            return;
        }
        TextPacket cbwOjnzusZzuPkHfx7wuwePHqrf = packet as TextPacket;

        if (cbwOjnzusZzuPkHfx7wuwePHqrf != null)
        {
            this._antiSpam._IDtpCgDjmC1AQOcZCJSFNAYjlbH(cbwOjnzusZzuPkHfx7wuwePHqrf);
            this._antiLag.Text(cbwOjnzusZzuPkHfx7wuwePHqrf);
            this._o3Helper._IDtpCgDjmC1AQOcZCJSFNAYjlbH(cbwOjnzusZzuPkHfx7wuwePHqrf);
            return;
        }
        UseItemPacket lylWoxWrca2h31SiYiDb8gyQP0o = packet as UseItemPacket;

        if (lylWoxWrca2h31SiYiDb8gyQP0o != null)
        {
            this._autoNexus2.UseItem(lylWoxWrca2h31SiYiDb8gyQP0o);
            this._fameHelper.UseItem(lylWoxWrca2h31SiYiDb8gyQP0o);
            return;
        }
        EnemyShootPacket cbwrHXLbrCktla3qkqXNmNymbvH = packet as EnemyShootPacket;

        if (cbwrHXLbrCktla3qkqXNmNymbvH != null)
        {
            this._objectTracker._Qz49aY7UXgmnBNNMA6Q6IEQtadk(cbwrHXLbrCktla3qkqXNmNymbvH);
            return;
        }
        InvSwapPacket maJp2qic3r54gk5Eg1eeMowxvXh = packet as InvSwapPacket;

        if (maJp2qic3r54gk5Eg1eeMowxvXh != null)
        {
            this._autoLoot.InvSwap(maJp2qic3r54gk5Eg1eeMowxvXh);
            this._autoNexus._ZHfjECn2B9JJHnVF67eBaO57JUp(maJp2qic3r54gk5Eg1eeMowxvXh);
            return;
        }
        EscapePacket m74ADSrj0VfuNwRBO916gAw0Nu = packet as EscapePacket;

        if (m74ADSrj0VfuNwRBO916gAw0Nu != null)
        {
            this.Escape(m74ADSrj0VfuNwRBO916gAw0Nu);
            return;
        }
        InvitedToGuildPacket tJHGMoVf7DhHyQm8a6SCuL1cSWl = packet as InvitedToGuildPacket;

        if (tJHGMoVf7DhHyQm8a6SCuL1cSWl != null)
        {
            this._antiDdos.Invite(tJHGMoVf7DhHyQm8a6SCuL1cSWl);
            return;
        }
        TeleportPacket rvckmor8bw91EVaRfdwc25aHYbc = packet as TeleportPacket;

        if (rvckmor8bw91EVaRfdwc25aHYbc != null)
        {
            this._fameHelper.Teleport(rvckmor8bw91EVaRfdwc25aHYbc);
            this._accuracyFarm.Teleport(rvckmor8bw91EVaRfdwc25aHYbc);
            return;
        }
        _6UIiGxMChbVinHsvx5uqg8WrMRc 6UIiGxMChbVinHsvx5uqg8WrMRc = packet as InvResultPacket;
        if (6UIiGxMChbVinHsvx5uqg8WrMRc != null)
        {
            this._autoLoot._yOjSn1WKSXsXVziJpL1eH5gSoWg(6UIiGxMChbVinHsvx5uqg8WrMRc);
            return;
        }
        NotificationPacket zIBPB6zZVww7yGWtjJqRMmACh1q = packet as NotificationPacket;

        if (zIBPB6zZVww7yGWtjJqRMmACh1q != null)
        {
            this._autoNexus._4GSfC8bADOwIwOXLYze8EOUBQxJ(zIBPB6zZVww7yGWtjJqRMmACh1q);
            return;
        }
        AccountListPacket k4pBHmoGRyaE6dWf1FIvL0dcuzKA = packet as AccountListPacket;

        if (k4pBHmoGRyaE6dWf1FIvL0dcuzKA != null)
        {
            this._antiLag.AccountList(k4pBHmoGRyaE6dWf1FIvL0dcuzKA);
            return;
        }
        EditAccountListPacket co7ACSeK1WWaCGAPAqLaov37Wqdb = packet as EditAccountListPacket;

        if (co7ACSeK1WWaCGAPAqLaov37Wqdb != null)
        {
            this._antiLag.EditAccountList(co7ACSeK1WWaCGAPAqLaov37Wqdb);
            return;
        }
        _7k8aOfI7MhNrVnHioUXbsPAxkbm 7k8aOfI7MhNrVnHioUXbsPAxkbm = packet as EnemyHitPacket;
        if (7k8aOfI7MhNrVnHioUXbsPAxkbm != null)
        {
            this._o3Helper._9BgsXisaUbFFlj5HLRd76sERUUX(7k8aOfI7MhNrVnHioUXbsPAxkbm);
            return;
        }
        DeathPacket wOmvsGmaE1PheZ2fPjD9V16UEseb = packet as DeathPacket;

        if (wOmvsGmaE1PheZ2fPjD9V16UEseb != null)
        {
            this._autoNexus._qQsqaOxgCR9yg9ky7erATaKrgCC(wOmvsGmaE1PheZ2fPjD9V16UEseb);
            return;
        }
    }
Esempio n. 11
0
 // Token: 0x06000520 RID: 1312 RVA: 0x0001E84C File Offset: 0x0001CA4C
 public void text(PlayerTextPacket playerText)
 {
     if (!string.IsNullOrEmpty(playerText.Text))
     {
         if (playerText.Text[0] == '/')
         {
             string[] array = playerText.Text.Split(new char[]
             {
                 ' '
             });
             if (array.Length != 0)
             {
                 if (array[0] == "/tp")
                 {
                     if (!Settings.Default.EnableTeleportToPlayerCommand || Settings.Default.FameBlockTeleports)
                     {
                         return;
                     }
                     playerText.Send = false;
                     if (array.Length == 1)
                     {
                         if (Settings.Default.EnableTeleportToSelf)
                         {
                             this.client.SendToClient("Teleporting to self!");
                             TeleportPacket teleportPacket = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                             teleportPacket.ObjectId = this.client.Player.ObjectId;
                             this.client.SendToServer(teleportPacket);
                             return;
                         }
                     }
                     if (array.Length == 2)
                     {
                         string text = array[1].ToLower();
                         foreach (GameObject gameObject in this.client.Players.Values)
                         {
                             if (!gameObject.isInvisible() && gameObject.Name.ToLower().Contains(text))
                             {
                                 this.client.SendToClient("Teleporting to " + gameObject.Name + "!");
                                 TeleportPacket teleportPacket = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                                 teleportPacket.ObjectId = gameObject.ObjectId;
                                 this.client.SendToServer(teleportPacket);
                                 return;
                             }
                         }
                         this.client.SendToClient("Player with the name similar to " + text + " not found!");
                         return;
                     }
                     this.client.SendToClient("Usage: /tp [partial or full player name]");
                     return;
                 }
                 else if (array[0] == "/tpq")
                 {
                     if (!Settings.Default.EnableTeleportToPlayerClosestToQuestCommand || Settings.Default.FameBlockTeleports)
                     {
                         return;
                     }
                     playerText.Send = false;
                     IEnumerable <GameObject> source = from enemy in this.client.Enemies.Values
                                                       where enemy.ObjectId == this._lastQuest
                                                       select enemy;
                     if (!source.Any <GameObject>())
                     {
                         this.client.SendToClient("Quest not found!");
                         return;
                     }
                     GameObject gameObject2 = null;
                     double     num         = 0.0;
                     GameObject gameObject3 = source.First <GameObject>();
                     foreach (GameObject gameObject4 in this.client.Players.Values)
                     {
                         if (gameObject4 != this.client.Player && !gameObject4.isInvisible() && (gameObject2 == null || gameObject4.ClientPosition.DistanceSquaredTo(gameObject3.ClientPosition) < num))
                         {
                             gameObject2 = gameObject4;
                             num         = gameObject4.ClientPosition.DistanceSquaredTo(gameObject3.ClientPosition);
                         }
                     }
                     if (gameObject2 == null)
                     {
                         this.client.SendToClient("No players found to teleport to!");
                         return;
                     }
                     this.client.SendToClient("Teleporting to " + gameObject2.Name + "!");
                     TeleportPacket teleportPacket2 = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                     teleportPacket2.ObjectId = gameObject2.ObjectId;
                     this.client.SendToServer(teleportPacket2);
                     return;
                 }
                 else if (array[0] == "/c" || array[0] == "/con" || array[0] == "/connect")
                 {
                     if (!Settings.Default.EnableConnectCommand)
                     {
                         return;
                     }
                     playerText.Send = false;
                     if (array.Length != 2)
                     {
                         this.client.SendToClient("Usage: /connect [server name]");
                     }
                     else
                     {
                         string text2;
                         if (!ServerParser.ServerAbbreviations.TryGetValue(array[1].ToLower(), out text2))
                         {
                             this.client.SendToClient("Unknown server!");
                             return;
                         }
                         ReconnectPacket reconnectPacket = (ReconnectPacket)Packet.Create(PacketType.RECONNECT);
                         reconnectPacket.GameId         = -2;
                         reconnectPacket.Host           = "127.0.0.1";
                         reconnectPacket.Port           = 2050;
                         reconnectPacket.isFromArena    = false;
                         reconnectPacket.Key            = new byte[0];
                         reconnectPacket.KeyTime        = -1;
                         reconnectPacket.Name           = text2 + " Nexus";
                         reconnectPacket.State          = string.Empty;
                         Settings.Default.CurrentServer = text2;
                         this.client.SendToClient("Connecting to: " + text2);
                         this.client.SendToClient(reconnectPacket);
                         return;
                     }
                 }
             }
             return;
         }
     }
 }
Esempio n. 12
0
    public void _CgwO1K8tgdyKPdKvCtJupNhapLD(PlayerTextPacket playerText)
    {
        if (string.IsNullOrEmpty(playerText._Message))
        {
            return;
        }
        string[]   array = default(string[]);
        PlayerData jI4Bueou7dItYp5S7QML5vyC6Rc       = default(PlayerData);
        IEnumerable <PlayerData> source              = default(IEnumerable <PlayerData>);
        PlayerData      jI4Bueou7dItYp5S7QML5vyC6Rc2 = default(PlayerData);
        double          num14    = default(double);
        PlayerData      current2 = default(PlayerData);
        TeleportPacket  gXkgDctfNPN0Xyz8qvjQDIS73of2 = default(TeleportPacket);
        ReconnectPacket reconnectPacket = default(ReconnectPacket);
        string          value           = default(string);
        string          text            = default(string);
        PlayerData      current         = default(PlayerData);

        while (true)
        {
            int num = -1750270187;
            while (true)
            {
                uint num2;
                switch ((num2 = (uint)num ^ 0xA67D4B79u) % 17u)
                {
                case 7u:
                    break;

                case 2u:
                {
                    int num9;
                    int num10;
                    if (playerText._Message[0] != '/')
                    {
                        num9  = 806781121;
                        num10 = num9;
                    }
                    else
                    {
                        num9  = 532765268;
                        num10 = num9;
                    }
                    num = num9 ^ (int)(num2 * 1164389951);
                    continue;
                }

                case 15u:
                {
                    int num41;
                    int num42;
                    if (Settings.Default.EnableTeleportToSelf)
                    {
                        num41 = -264259780;
                        num42 = num41;
                    }
                    else
                    {
                        num41 = -2010866462;
                        num42 = num41;
                    }
                    num = num41 ^ (int)(num2 * 1334473406);
                    continue;
                }

                case 14u:
                    return;

                case 1u:
                    if (array[0] == "/tp")
                    {
                        num = ((int)num2 * -919367479) ^ -648364078;
                        continue;
                    }
                    while (true)
                    {
                        if (array[0] == "/tpq")
                        {
                            int num11 = -788484004;
                            while (true)
                            {
                                switch ((num2 = (uint)num11 ^ 0xA67D4B79u) % 11u)
                                {
                                case 10u:
                                    num11 = -1591089261;
                                    continue;

                                case 1u:
                                    break;

                                case 8u:
                                    jI4Bueou7dItYp5S7QML5vyC6Rc = source.First();
                                    num11 = ((int)num2 * -185312111) ^ 0x5721D1B0;
                                    continue;

                                case 3u:
                                    return;

                                case 6u:
                                    playerText._Send = false;
                                    num11            = -773015358;
                                    continue;

                                case 4u:
                                {
                                    int num15;
                                    int num16;
                                    if (!source.Any())
                                    {
                                        num15 = 1964101611;
                                        num16 = num15;
                                    }
                                    else
                                    {
                                        num15 = 351924091;
                                        num16 = num15;
                                    }
                                    num11 = num15 ^ ((int)num2 * -907251790);
                                    continue;
                                }

                                case 5u:
                                    jI4Bueou7dItYp5S7QML5vyC6Rc2 = null;
                                    num14 = 0.0;
                                    num11 = -896664423;
                                    continue;

                                case 2u:
                                {
                                    int num12;
                                    int num13;
                                    if (Settings.Default.EnableTeleportToPlayerClosestToQuestCommand)
                                    {
                                        num12 = -1733244460;
                                        num13 = num12;
                                    }
                                    else
                                    {
                                        num12 = -1906903748;
                                        num13 = num12;
                                    }
                                    num11 = num12 ^ (int)(num2 * 1657868672);
                                    continue;
                                }

                                case 9u:
                                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Quest not found!");
                                    return;

                                case 0u:
                                    source = _50w8wVuv8bL5nhKaR2EHxjrTamB._Aq9hW2NyDqEkITmxzYm6OCQLaDB.Values.Where((PlayerData enemy) => enemy._fn2CRnBpjyTWHR9K8SU4iOwhDtK == _EeeRzHBDOL9AqYJ8CIuFvkR3Qlz);
                                    num11  = (int)(num2 * 23163576) ^ -1930811091;
                                    continue;

                                default:
                                    goto IL_052b;
                                }
                                break;
                            }
                            continue;
                        }
                        goto IL_0a15;
IL_0a6b:
                        _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Teleporting to " + jI4Bueou7dItYp5S7QML5vyC6Rc2._WL2DOBxBuX9DARzf2KPoaJbgZiCb + "!");
                        int num17 = -770781531;
                        goto IL_0695;
IL_0690:
                        num17 = -1589234120;
                        goto IL_0695;
IL_052b:
                        using (Dictionary <int, PlayerData> .ValueCollection.Enumerator enumerator = _50w8wVuv8bL5nhKaR2EHxjrTamB._naDcMlPfaanTh6qrJ3cOuO4HNwz.Values.GetEnumerator())
                        {
                            while (true)
                            {
                                int num18;
                                int num19;
                                if (!enumerator.MoveNext())
                                {
                                    num18 = -193042290;
                                    num19 = num18;
                                }
                                else
                                {
                                    num18 = -1985374203;
                                    num19 = num18;
                                }
                                while (true)
                                {
                                    switch ((num2 = (uint)num18 ^ 0xA67D4B79u) % 9u)
                                    {
                                    case 3u:
                                        num18 = -1985374203;
                                        continue;

                                    default:
                                        goto end_IL_0541;

                                    case 6u:
                                        current2 = enumerator.Current;
                                        num18    = -125787301;
                                        continue;

                                    case 5u:
                                        jI4Bueou7dItYp5S7QML5vyC6Rc2 = current2;
                                        num14 = current2._Position.GetDistance(jI4Bueou7dItYp5S7QML5vyC6Rc._Position);
                                        num18 = -2029029138;
                                        continue;

                                    case 8u:
                                    {
                                        int num26;
                                        int num27;
                                        if (!current2._NNgacHsIcOUlk6tnbwwxK7FDsff())
                                        {
                                            num26 = 1621638204;
                                            num27 = num26;
                                        }
                                        else
                                        {
                                            num26 = 1013029468;
                                            num27 = num26;
                                        }
                                        num18 = num26 ^ ((int)num2 * -99043881);
                                        continue;
                                    }

                                    case 2u:
                                    {
                                        int num22;
                                        int num23;
                                        if (current2._Position.GetDistance(jI4Bueou7dItYp5S7QML5vyC6Rc._Position) >= num14)
                                        {
                                            num22 = -2076566562;
                                            num23 = num22;
                                        }
                                        else
                                        {
                                            num22 = -799362313;
                                            num23 = num22;
                                        }
                                        num18 = num22 ^ ((int)num2 * -1129373452);
                                        continue;
                                    }

                                    case 7u:
                                        break;

                                    case 0u:
                                    {
                                        int num24;
                                        int num25;
                                        if (jI4Bueou7dItYp5S7QML5vyC6Rc2 != null)
                                        {
                                            num24 = -1864538543;
                                            num25 = num24;
                                        }
                                        else
                                        {
                                            num24 = -1042825133;
                                            num25 = num24;
                                        }
                                        num18 = num24 ^ ((int)num2 * -342833652);
                                        continue;
                                    }

                                    case 1u:
                                    {
                                        int num20;
                                        int num21;
                                        if (current2 == _50w8wVuv8bL5nhKaR2EHxjrTamB._PlayerData)
                                        {
                                            num20 = -1385695744;
                                            num21 = num20;
                                        }
                                        else
                                        {
                                            num20 = -457941751;
                                            num21 = num20;
                                        }
                                        num18 = num20 ^ ((int)num2 * -1011815673);
                                        continue;
                                    }

                                    case 4u:
                                        goto end_IL_0541;
                                    }
                                    break;
                                }
                            }
                            end_IL_0541 :;
                        }
                        if (jI4Bueou7dItYp5S7QML5vyC6Rc2 == null)
                        {
                            goto IL_0690;
                        }
                        goto IL_0a6b;
IL_0695:
                        while (true)
                        {
                            switch ((num2 = (uint)num17 ^ 0xA67D4B79u) % 34u)
                            {
                            case 21u:
                                break;

                            default:
                                return;

                            case 28u:
                                goto IL_0733;

                            case 26u:
                                goto IL_0753;

                            case 10u:
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendToServer(gXkgDctfNPN0Xyz8qvjQDIS73of2);
                                num17 = (int)(num2 * 1686821117) ^ -2054065793;
                                continue;

                            case 32u:
                                reconnectPacket = (ReconnectPacket)Packet.CreatePacketFromType(PacketType.RECONNECT);
                                num17           = ((int)num2 * -1436860093) ^ -1342146281;
                                continue;

                            case 22u:
                                playerText._Send = false;
                                num17            = -13505546;
                                continue;

                            case 8u:
                                return;

                            case 7u:
                                Settings.Default.CurrentServer = value;
                                num17 = (int)((num2 * 1561157505) ^ 0x25CB793E);
                                continue;

                            case 2u:
                                return;

                            case 1u:
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("No players found to teleport to!");
                                num17 = (int)(num2 * 2096922046) ^ -125483602;
                                continue;

                            case 30u:
                            {
                                int num32;
                                int num33;
                                if (array[0] == "/loc")
                                {
                                    num32 = -712487546;
                                    num33 = num32;
                                }
                                else
                                {
                                    num32 = -1310431336;
                                    num33 = num32;
                                }
                                num17 = num32 ^ ((int)num2 * -292526049);
                                continue;
                            }

                            case 24u:
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Usage: /connect [server name]");
                                num17 = -2142874341;
                                continue;

                            case 6u:
                                gXkgDctfNPN0Xyz8qvjQDIS73of2           = (TeleportPacket)Packet.CreatePacketFromType(PacketType.TELEPORT);
                                gXkgDctfNPN0Xyz8qvjQDIS73of2._ObjectId = jI4Bueou7dItYp5S7QML5vyC6Rc2._fn2CRnBpjyTWHR9K8SU4iOwhDtK;
                                num17 = (int)(num2 * 931766000) ^ -1673800875;
                                continue;

                            case 27u:
                                reconnectPacket._IsFromArena = false;
                                reconnectPacket._Key         = new byte[0];
                                num17 = ((int)num2 * -96955804) ^ -1988870985;
                                continue;

                            case 31u:
                            {
                                int num34;
                                int num35;
                                if (!(array[0] == "/connect"))
                                {
                                    num34 = 684173617;
                                    num35 = num34;
                                }
                                else
                                {
                                    num34 = 719580645;
                                    num35 = num34;
                                }
                                num17 = num34 ^ (int)(num2 * 696526382);
                                continue;
                            }

                            case 12u:
                                reconnectPacket._KeyTime = -1;
                                num17 = (int)((num2 * 62081320) ^ 0x76031676);
                                continue;

                            case 4u:
                                return;

                            case 33u:
                                reconnectPacket._MapName = value + " Nexus";
                                num17 = (int)((num2 * 2115272512) ^ 0x344C60BE);
                                continue;

                            case 16u:
                                reconnectPacket._GameId = -2;
                                num17 = (int)(num2 * 948123561) ^ -2127748574;
                                continue;

                            case 9u:
                            {
                                int num30;
                                int num31;
                                if (array.Length != 2)
                                {
                                    num30 = 534559486;
                                    num31 = num30;
                                }
                                else
                                {
                                    num30 = 516844265;
                                    num31 = num30;
                                }
                                num17 = num30 ^ ((int)num2 * -157206137);
                                continue;
                            }

                            case 19u:
                                goto IL_098f;

                            case 5u:
                                playerText._Send = false;
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage($"Current location: {Math.Round(_50w8wVuv8bL5nhKaR2EHxjrTamB._PlayerData._Position._PositionX, 1)}, {Math.Round(_50w8wVuv8bL5nhKaR2EHxjrTamB._PlayerData._Position._PositionY, 1)}");
                                num17 = -1483513078;
                                continue;

                            case 23u:
                                goto IL_0a15;

                            case 15u:
                            {
                                int num28;
                                int num29;
                                if (ServerList._aCrqUtEobC4JELAJ9SKdNpyMHvF.TryGetValue(array[1].ToLower(), out value))
                                {
                                    num28 = -229036871;
                                    num29 = num28;
                                }
                                else
                                {
                                    num28 = -182536418;
                                    num29 = num28;
                                }
                                num17 = num28 ^ (int)(num2 * 1156014646);
                                continue;
                            }

                            case 25u:
                                goto IL_0a6b;

                            case 20u:
                                Settings.Default.Change();
                                num17 = ((int)num2 * -1527675920) ^ 0x3050A16A;
                                continue;

                            case 14u:
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendToClient(reconnectPacket);
                                return;

                            case 0u:
                                reconnectPacket._Port = 2050;
                                num17 = (int)(num2 * 916855739) ^ -357830690;
                                continue;

                            case 13u:
                                reconnectPacket._Hostname = "127.0.0.1";
                                num17 = (int)(num2 * 611952939) ^ -184346516;
                                continue;

                            case 17u:
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Unknown server!");
                                return;

                            case 29u:
                                return;

                            case 18u:
                                return;

                            case 11u:
                                _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Connecting to: " + value);
                                num17 = (int)(num2 * 1732984103) ^ -347248346;
                                continue;

                            case 3u:
                                return;
                            }
                            break;
IL_098f:
                            int num36;
                            if (Settings.Default.EnableLocCommand)
                            {
                                num17 = -1503005708;
                                num36 = num17;
                            }
                            else
                            {
                                num17 = -154957677;
                                num36 = num17;
                            }
                            continue;
IL_0753:
                            int num37;
                            if (!(array[0] == "/l"))
                            {
                                num17 = -564094377;
                                num37 = num17;
                            }
                            else
                            {
                                num17 = -1006679788;
                                num37 = num17;
                            }
                            continue;
IL_0733:
                            int num38;
                            if (!Settings.Default.EnableConnectCommand)
                            {
                                num17 = -1712388317;
                                num38 = num17;
                            }
                            else
                            {
                                num17 = -351010149;
                                num38 = num17;
                            }
                        }
                        goto IL_0690;
IL_0a15:
                        int num39;
                        if (!(array[0] == "/con"))
                        {
                            num17 = -1361958442;
                            num39 = num17;
                        }
                        else
                        {
                            num17 = -1417258857;
                            num39 = num17;
                        }
                        goto IL_0695;
                    }

                case 0u:
                    return;

                case 5u:
                {
                    int num43;
                    int num44;
                    if (array.Length == 1)
                    {
                        num43 = -636101856;
                        num44 = num43;
                    }
                    else
                    {
                        num43 = -1018051115;
                        num44 = num43;
                    }
                    num = num43 ^ (int)(num2 * 1919184901);
                    continue;
                }

                case 9u:
                    return;

                case 4u:
                {
                    int num45;
                    int num46;
                    if (Settings.Default.EnableTeleportToPlayerCommand)
                    {
                        num45 = 808092347;
                        num46 = num45;
                    }
                    else
                    {
                        num45 = 767592542;
                        num46 = num45;
                    }
                    num = num45 ^ (int)(num2 * 998309261);
                    continue;
                }

                case 12u:
                {
                    int num40;
                    if (array.Length != 2)
                    {
                        num   = -1265570669;
                        num40 = num;
                    }
                    else
                    {
                        num   = -672276365;
                        num40 = num;
                    }
                    continue;
                }

                case 11u:
                    return;

                case 13u:
                    text = array[1].ToLower();
                    num  = -1164419516;
                    continue;

                case 8u:
                {
                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Teleporting to self!");
                    TeleportPacket gXkgDctfNPN0Xyz8qvjQDIS73of3 = (TeleportPacket)Packet.CreatePacketFromType(PacketType.TELEPORT);
                    gXkgDctfNPN0Xyz8qvjQDIS73of3._ObjectId = _50w8wVuv8bL5nhKaR2EHxjrTamB._PlayerData._fn2CRnBpjyTWHR9K8SU4iOwhDtK;
                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendToServer(gXkgDctfNPN0Xyz8qvjQDIS73of3);
                    num = ((int)num2 * -247600723) ^ -171822290;
                    continue;
                }

                case 3u:
                    playerText._Send = false;
                    num = -852138602;
                    continue;

                case 6u:
                    array = playerText._Message.Split(' ');
                    if (array.Length != 0)
                    {
                        num = -225100984;
                        continue;
                    }
                    return;

                case 10u:
                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Usage: /tp [partial or full player name]");
                    num = (int)(num2 * 215014787) ^ -718363310;
                    continue;

                default:
                {
                    using (Dictionary <int, PlayerData> .ValueCollection.Enumerator enumerator = _50w8wVuv8bL5nhKaR2EHxjrTamB._naDcMlPfaanTh6qrJ3cOuO4HNwz.Values.GetEnumerator())
                    {
                        while (true)
                        {
                            int num3;
                            int num4;
                            if (enumerator.MoveNext())
                            {
                                num3 = -383970670;
                                num4 = num3;
                            }
                            else
                            {
                                num3 = -74179290;
                                num4 = num3;
                            }
                            while (true)
                            {
                                switch ((num2 = (uint)num3 ^ 0xA67D4B79u) % 8u)
                                {
                                case 6u:
                                    num3 = -383970670;
                                    continue;

                                default:
                                    goto end_IL_026e;

                                case 3u:
                                    current = enumerator.Current;
                                    num3    = -222315011;
                                    continue;

                                case 0u:
                                    break;

                                case 5u:
                                {
                                    int num7;
                                    int num8;
                                    if (!current._WL2DOBxBuX9DARzf2KPoaJbgZiCb.ToLower().Contains(text))
                                    {
                                        num7 = -1300799904;
                                        num8 = num7;
                                    }
                                    else
                                    {
                                        num7 = -1187543807;
                                        num8 = num7;
                                    }
                                    num3 = num7 ^ ((int)num2 * -127224387);
                                    continue;
                                }

                                case 4u:
                                {
                                    int num5;
                                    int num6;
                                    if (current._NNgacHsIcOUlk6tnbwwxK7FDsff())
                                    {
                                        num5 = -2025665199;
                                        num6 = num5;
                                    }
                                    else
                                    {
                                        num5 = -1298686500;
                                        num6 = num5;
                                    }
                                    num3 = num5 ^ (int)(num2 * 1212507724);
                                    continue;
                                }

                                case 1u:
                                {
                                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Teleporting to " + current._WL2DOBxBuX9DARzf2KPoaJbgZiCb + "!");
                                    TeleportPacket teleportPacket = (TeleportPacket)Packet.CreatePacketFromType(PacketType.TELEPORT);
                                    teleportPacket._ObjectId = current._fn2CRnBpjyTWHR9K8SU4iOwhDtK;
                                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendToServer(teleportPacket);
                                    num3 = (int)((num2 * 2016917650) ^ 0x3A7C32A1);
                                    continue;
                                }

                                case 2u:
                                    return;

                                case 7u:
                                    goto end_IL_026e;
                                }
                                break;
                            }
                        }
                        end_IL_026e :;
                    }
                    _50w8wVuv8bL5nhKaR2EHxjrTamB.SendInfoMessage("Player with the name similar to " + text + " not found!");
                    return;
                }
                }
                break;
            }
        }
    }
Esempio n. 13
0
 // Token: 0x06000469 RID: 1129 RVA: 0x00017688 File Offset: 0x00015888
 public void Teleport(TeleportPacket teleport)
 {
 }
Esempio n. 14
0
        public void Teleport(RealmTime time, TeleportPacket packet)
        {
            var obj = Client.Player.Owner.GetEntity(packet.ObjectId);

            try
            {
                if (obj == null)
                {
                    return;
                }
                if (!TPCooledDown())
                {
                    SendError("Player.teleportCoolDown");
                    return;
                }
                if (obj.HasConditionEffect(ConditionEffectIndex.Invisible))
                {
                    SendError("server.no_teleport_to_invisible");
                    return;
                }
                if (obj.HasConditionEffect(ConditionEffectIndex.Paused))
                {
                    SendError("server.no_teleport_to_paused");
                    return;
                }
                var player = obj as Player;

                /*if (player != null && (!player.NameChosen || player.NameChosen))
                 * {
                 *  SendError("server.teleport_needs_name");
                 *  return;
                 * }*/
                if (obj.Id == Id)
                {
                    SendError("server.teleport_to_self");
                    return;
                }
                if (!Owner.AllowTeleport)
                {
                    SendError(GetLanguageString("server.no_teleport_in_realm", new KeyValuePair <string, object>("realm", Owner.Name)));
                    return;
                }

                SetTPDisabledPeriod();
                Move(obj.X, obj.Y);
                Pet?.Move(obj.X, obj.X);
                FameCounter.Teleport();
                SetNewbiePeriod();
                UpdateCount++;
            }
            catch// (Exception ex)
            {
                //log.Error(ex);
                //SendError("player.cannotTeleportTo");
                return;
            }
            Owner.BroadcastPacket(new GotoPacket
            {
                ObjectId = Id,
                Position = new Position
                {
                    X = X,
                    Y = Y
                }
            }, null);
            Owner.BroadcastPacket(new ShowEffectPacket
            {
                EffectType = EffectType.Teleport,
                TargetId   = Id,
                PosA       = new Position
                {
                    X = X,
                    Y = Y
                },
                Color = new ARGB(0xFFFFFFFF)
            }, null);
        }
Esempio n. 15
0
        public void Teleport(RealmTime time, TeleportPacket packet)
        {
            var obj = Client.Player.Owner.GetEntity(packet.ObjectId);

            try
            {
                if (obj == null)
                {
                    return;
                }
                if (!TPCooledDown())
                {
                    SendError("Player.teleportCoolDown");
                    return;
                }
                if (obj.HasConditionEffect(ConditionEffectIndex.Paused))
                {
                    SendError("server.no_teleport_to_paused");
                    return;
                }
                var player = obj as Player;
                if (player != null && !player.NameChosen)
                {
                    SendError("server.teleport_needs_name");
                    return;
                }
                if (obj.Id == Id)
                {
                    SendError("server.teleport_to_self");
                    return;
                }
                if (!Owner.AllowTeleport)
                {
                    SendError(GetLanguageString("server.no_teleport_in_realm", new KeyValuePair <string, object>("realm", Owner.Name)));
                    return;
                }

                if (CheckTeleportLowHp() && HP <= MaxHp / 2)
                {
                    ApplyConditionEffect(new ConditionEffect
                    {
                        Effect     = ConditionEffectIndex.Damaging,
                        DurationMS = 5000
                    });
                }
                else
                {
                    ApplyConditionEffect(new ConditionEffect
                    {
                        Effect     = ConditionEffectIndex.Damaging,
                        DurationMS = 0
                    });
                }


                SetTPDisabledPeriod();
                Move(obj.X, obj.Y);
                Pet?.Move(obj.X, obj.X);
                FameCounter.Teleport();
                SetNewbiePeriod();
                UpdateCount++;
            }
            catch (Exception ex)
            {
                log.Error(ex);
                SendError("player.cannotTeleportTo");
                return;
            }
            Owner.BroadcastPacket(new GotoPacket
            {
                ObjectId = Id,
                Position = new Position
                {
                    X = X,
                    Y = Y
                }
            }, null);
            if (!isNotVisible)
            {
                Owner.BroadcastPacket(new ShowEffectPacket
                {
                    EffectType = EffectType.Teleport,
                    TargetId   = Id,
                    PosA       = new Position
                    {
                        X = X,
                        Y = Y
                    },
                    Color = new ARGB(0xFFFFFFFF)
                }, null);
            }
        }