コード例 #1
0
        public virtual async Task SpawnMeAsync(bool notifyOthers = true)
        {
            Region = L2World.GetRegion(new Location(X, Y, Z));

            L2World.AddObject(this);
            await OnSpawnAsync(notifyOthers);
        }
コード例 #2
0
ファイル: BypassUserCmd.cs プロジェクト: LFBRxD/L2dotNET
        public override async Task RunImpl()
        {
            await Task.Run(() =>
            {
                L2Player player = _client.CurrentPlayer;

                switch (_command)
                {
                case 0:            // [loc]
                    int regId = 0; //MapRegionTable.getInstance().getRegionSysId(player.X, player.Y);
                    if (regId > 0)
                    {
                        player.SendPacketAsync(new SystemMessage((SystemMessageId)regId).AddNumber(player.X).AddNumber(player.Y).AddNumber(player.Z));
                    }
                    else
                    {
                        player.SendPacketAsync(new SystemMessage(SystemMessageId.NotImplementedYet2361).AddString("Nowhere"));
                    }

                    int x = (player.X >> 15) + 9 + 8;
                    int y = (player.Y >> 15) + 10 + 11;
                    player.SendMessageAsync($"Current loc is X:{player.X} Y:{player.Y} Z:{player.Z}");
                    player.BroadcastUserInfoAsync();     //for debug reasons
                    break;

                case 52:     // /unstuck

                    L2WorldRegion worldRegion = L2World.GetRegion(player.X, player.Y);
                    player.SetRegion(worldRegion);
                    List <L2Player> knowns = player.GetKnownPlayers();
                    //player.SpawnMeAsync();
                    player.SendMessageAsync("Unstuck not implemented yet.");
                    //player.knownObjects;
                    break;

                case 62:     // /dismount
                    player.SendMessageAsync("Dismount not implemented yet.");
                    break;

                case 77:     // [time]
                    GameTime.ShowInfoAsync(player);
                    break;

                default:
                    player.SendMessageAsync($"cmd alias {_command}");
                    break;
                }
            });
        }
コード例 #3
0
ファイル: L2Zone.cs プロジェクト: LFBRxD/L2dotNET
        private void DesctructTime(object sender, ElapsedEventArgs e)
        {
            _selfDestruct.Enabled = false;

            NpcCenter.DecayMe();

            foreach (L2Object o in ObjectsInside.Values)
            {
                OnExit(o, false);
            }

            ObjectsInside.Clear();

            L2WorldRegion region = L2World.GetRegion(CylinderCenter[0], CylinderCenter[1]);

            if (region != null)
            {
                // region._zoneManager.remZone(this);
            }
        }
コード例 #4
0
ファイル: ValidatePosition.cs プロジェクト: LFBRxD/L2dotNET
        public override async Task RunImpl()
        {
            L2Player      player  = _client.CurrentPlayer;
            L2WorldRegion prevReg = player.Region;

            int realX = player.X;
            int realY = player.Y;
            int realZ = player.Z;

            int dx = _x - realX;
            int dy = _y - realY;
            int dz = _z - realZ;

            double diffSq = Math.Sqrt(dx * dx + dy * dy);

            player.SendMessageAsync($"diff: {(int) diffSq}");

            player.CharMovement.UpdatePosition(_x, _y, _z);

            if (diffSq > 600)
            {
                Log.Error($"User {player.ObjectId}:{player.Account.Login}:{player.Name} coord is unsync with server");
            }

            L2WorldRegion NewRegion = L2World.GetRegion(new Location(player.X, player.Y, player.Z));

            if (prevReg != NewRegion)
            {
                player.SetRegion(NewRegion);
                player.SetupKnowsAsync();

                //Add objects from surrounding regions into knows, this is a hack to prevent
                //objects from popping into view as soon as you enter a new region
                //TODO: Proper region transition
                player.SetupKnowsAsync(NewRegion);
            }
            //Log.Info($"Current client position: X:{_x}, Y:{_y}, Z:{_z}"); //debug
            player.BroadcastUserInfoAsync();
            player.ValidateVisibleObjects(realX, realY, true);
        }