Beispiel #1
0
        private void TeleportPlayer_POS(string[] args, int length, string full, Client client)
        {
            var foundPlayer = false;
            var id          = 0;

            if (client != null)
            {
                id          = client.User.PlayerId;
                foundPlayer = true;
            }
            else
            {
                var name = args[4].Trim('\"');

                Helper.FindPlayerByUsername(name);
                if (id != -1)
                {
                    foundPlayer = true;
                }

                client = PolarisApp.Instance.Server.Clients[id];
            }


            // Couldn't find the username
            if (!foundPlayer)
            {
                Logger.WriteError("[CMD] Could not find user.");
                return;
            }

            PSOLocation destination = new PSOLocation(0f, 1f, 0f, 0f,
                                                      float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3]));


            client.SendPacket(new TeleportTransferPacket(ObjectManager.Instance.getObjectByID("lobby", 443), destination));
        }
Beispiel #2
0
 public static void WriteClient(Client client, string text, params object[] args)
 {
     var message = string.Format(text, args).Replace('\\', '/');
     var packet = new SystemMessagePacket(message, SystemMessagePacket.MessageType.SystemMessage);
     client.SendPacket(packet);
 }
Beispiel #3
0
        private void SpawnClone(string[] args, int length, string full, Client client)
        {
            // Temporary haxifications to pull your own connection
            string name       = args[1].Trim('\"');
            string playerName = args[2].Trim('\"');
            float  x          = float.Parse(args[3]);
            float  y          = float.Parse(args[4]);
            float  z          = float.Parse(args[5]);

            if (client == null)
            {
                int  ID          = 0;
                bool foundPlayer = false;

                // Find the player
                ID = Helper.FindPlayerByUsername(name);
                if (ID != -1)
                {
                    foundPlayer = true;
                }

                // Couldn't find the username
                if (!foundPlayer)
                {
                    Logger.WriteError("[CMD] Could not find user " + name);
                    return;
                }

                client = PolarisApp.Instance.server.Clients[ID];
            }

            // Default coordinates
            if (x == 0)
            {
                x = -0.417969f;
            }
            if (y == 0)
            {
                y = 0.000031f;
            }
            if (z == 0)
            {
                z = 134.375f;
            }

            var fakePlayer = new Database.Player();

            fakePlayer.Username = name;
            fakePlayer.Nickname = playerName;
            fakePlayer.PlayerID = 12345678 + new Random().Next();

            var fakeChar = new Character();

            fakeChar.CharacterID = 12345678 + new Random().Next();
            fakeChar.Player      = fakePlayer;
            fakeChar.Name        = playerName;

            fakeChar.Looks = client.Character.Looks;
            fakeChar.Jobs  = client.Character.Jobs;

            var fakePacket = new Packets.CharacterSpawnPacket(fakeChar);

            fakePacket.Position.facingAngle = 0f;
            fakePacket.Position.x           = x;
            fakePacket.Position.y           = y;
            fakePacket.Position.z           = z;
            fakePacket.IsItMe = false;
            client.SendPacket(fakePacket);

            Logger.WriteCommand(client, "[CMD] Spawned a clone of {0} named {1}", name, playerName);
        }
        private void RunLUA(string[] args, int length, string full, Client client)
        {
            if (client == null)
            {
                var id = Helper.FindPlayerByUsername(args[1]);
                if (id == -1)
                    return;

                client = PolarisApp.Instance.Server.Clients[id];
            }
            else
            {
                string[] newargs = new string[args.Length + 1];
                newargs[0] = "";
                newargs[1] = "";
                Array.Copy(args, 1, newargs, 2, args.Length - 1);
                args = newargs;
            }

            PacketWriter luaPacket = new PacketWriter();
            luaPacket.Write((UInt16)1);
            luaPacket.Write((UInt16)1);
            luaPacket.WriteAscii(String.Join(" ", args, 2, args.Length - 2), 0xD975, 0x2F);

            client.SendPacket(0x10, 0x3, 0x4, luaPacket.ToArray());
        }
        private void TeleportPlayer_POS(string[] args, int length, string full, Client client)
        {
            var foundPlayer = false;
            var id = 0;
            if (client != null)
            {
                id = client.User.PlayerId;
                foundPlayer = true;
            }
            else
            {
                var name = args[4].Trim('\"');

                Helper.FindPlayerByUsername(name);
                if (id != -1)
                    foundPlayer = true;

                client = PolarisApp.Instance.Server.Clients[id];
            }

            // Couldn't find the username
            if (!foundPlayer)
            {
                Logger.WriteError("[CMD] Could not find user.");
                return;
            }

            PSOLocation destination = new PSOLocation(0f, 1f, 0f, 0f,
                float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3]));

            client.SendPacket(new TeleportTransferPacket(ObjectManager.Instance.getObjectByID("lobby", 443), destination));
        }
        private void SpawnObject(string[] args, int length, string full, Client client)
        {
            if(client == null)
            {
                var id = Helper.FindPlayerByUsername(args[1]);
                if (id == -1)
                    return;

                client = PolarisApp.Instance.Server.Clients[id];
            }
            else
            {
                string[] newargs = new string[args.Length + 1];
                newargs[0] = "";
                newargs[1] = "";
                Array.Copy(args, 1, newargs, 2, 9);
                args = newargs;
            }
            PSOObject obj = new PSOObject();
            obj.Name = args[2];
            obj.Header = new ObjectHeader((uint)Int32.Parse(args[3]), EntityType.Object);
            obj.Position = new PSOLocation(float.Parse(args[4]), float.Parse(args[5]), float.Parse(args[6]), float.Parse(args[7]), float.Parse(args[8]), float.Parse(args[9]), float.Parse(args[10]));
            obj.Things = new PSOObject.PSOObjectThing[0];

            client.SendPacket(0x8, 0xB, 0x0, obj.GenerateSpawnBlob());
        }
        private void SpawnClone(string[] args, int length, string full, Client client)
        {
            // Temporary haxifications to pull your own connection
            var name = args[1].Trim('\"');
            var playerName = args[2].Trim('\"');
            var x = float.Parse(args[3]);
            var y = float.Parse(args[4]);
            var z = float.Parse(args[5]);

            if (client == null)
            {
                var foundPlayer = false;

                // Find the player
                var id = Helper.FindPlayerByUsername(name);
                if (id != -1)
                    foundPlayer = true;

                // Couldn't find the username
                if (!foundPlayer)
                {
                    Logger.WriteError("[CMD] Could not find user " + name);
                    return;
                }

                client = PolarisApp.Instance.Server.Clients[id];
            }

            // Default coordinates
            if (x == 0)
                x = -0.417969f;
            if (y == 0)
                y = 0.000031f;
            if (z == 0)
                z = 134.375f;

            var fakePlayer = new Player
            {
                Username = name,
                Nickname = playerName,
                PlayerId = (12345678 + new Random().Next())
            };

            var fakeChar = new Character
            {
                CharacterId = 12345678 + new Random().Next(),
                Player = fakePlayer,
                Name = playerName,
                Looks = client.Character.Looks,
                Jobs = client.Character.Jobs
            };

            var fakePacket = new CharacterSpawnPacket(fakeChar, new PSOLocation(0f, 1f, 0f, 0f, x, y, z))
            {
                IsItMe = false
            };
            client.SendPacket(fakePacket);

            Logger.WriteCommand(client, "[CMD] Spawned a clone of {0} named {1}", name, playerName);
        }
Beispiel #8
0
        private void SpawnClone(string[] args, int length, string full, Client client)
        {
            // Temporary haxifications to pull your own connection
            var name       = args[1].Trim('\"');
            var playerName = args[2].Trim('\"');
            var x          = float.Parse(args[3]);
            var y          = float.Parse(args[4]);
            var z          = float.Parse(args[5]);

            if (client == null)
            {
                var foundPlayer = false;

                // Find the player
                var id = Helper.FindPlayerByUsername(name);
                if (id != -1)
                {
                    foundPlayer = true;
                }

                // Couldn't find the username
                if (!foundPlayer)
                {
                    Logger.WriteError("[CMD] Could not find user " + name);
                    return;
                }

                client = PolarisApp.Instance.Server.Clients[id];
            }

            // Default coordinates
            if (x == 0)
            {
                x = -0.417969f;
            }
            if (y == 0)
            {
                y = 0.000031f;
            }
            if (z == 0)
            {
                z = 134.375f;
            }

            var fakePlayer = new Player
            {
                Username = name,
                Nickname = playerName,
                PlayerID = (12345678 + new Random().Next())
            };

            var fakeChar = new Character
            {
                CharacterID = 12345678 + new Random().Next(),
                Player      = fakePlayer,
                Name        = playerName,
                Looks       = client.Character.Looks,
                Jobs        = client.Character.Jobs
            };

            var fakePacket = new CharacterSpawnPacket(fakeChar, new PSOLocation(0f, 1f, 0f, 0f, x, y, z))
            {
                IsItMe = false
            };

            client.SendPacket(fakePacket);

            Logger.WriteCommand(client, "[CMD] Spawned a clone of {0} named {1}", name, playerName);
        }
Beispiel #9
0
        private void ChangeArea(string[] args, int length, string full, Client client)
        {
            var name        = args[1].Trim('\"');
            var foundPlayer = false;


            var id = Helper.FindPlayerByUsername(name);

            if (id != -1)
            {
                foundPlayer = true;
            }

            // Couldn't find the username
            if (!foundPlayer)
            {
                Logger.WriteError("[CMD] Could not find user " + name);
                return;
            }

            Client context = PolarisApp.Instance.Server.Clients[id];

            Map dstMap = null;

            if (!ZoneManager.Instance.InstanceExists(String.Format("tpinstance_{0}_{1}", Int32.Parse(args[3]), Int32.Parse(args[8]))))
            {
                dstMap = new Map("tpmap", Int32.Parse(args[3]), Int32.Parse(args[8]), (Map.MapType)Int32.Parse(args[2]), (Map.MapFlags)Int32.Parse(args[4]))
                {
                    GenerationArgs = new Map.GenParam()
                    {
                        seed = UInt32.Parse(args[5]), xsize = UInt32.Parse(args[6]), ysize = UInt32.Parse(args[7])
                    }
                };
                ZoneManager.Instance.NewInstance(String.Format("tpinstance_{0}", Int32.Parse(args[3])), dstMap);
            }
            else
            {
                dstMap = ZoneManager.Instance.MapFromInstance("tpmap", String.Format("tpinstance_{0}_{1}", Int32.Parse(args[3]), Int32.Parse(args[8])));
            }

            dstMap.SpawnClient(context, dstMap.GetDefaultLocation());



            //PSOLocation destination = new PSOLocation(float.Parse(args[2]), float.Parse(args[3]), float.Parse(args[4]), float.Parse(args[5]),float.Parse(args[6]), float.Parse(args[7]), float.Parse(args[8]));


            //PolarisApp.Instance.Server.Clients[id].SendPacket(new TeleportTransferPacket(ObjectManager.Instance.getObjectByID("lobby", 443), destination));

            context.SendPacket(0x8, 0xB, 0x0, ObjectManager.Instance.getObjectByID(443).GenerateSpawnBlob());

            //var objects = ObjectManager.Instance.getObjectsForZone("casino").Values;
            //foreach (var obj in objects)
            //{
            //    context.SendPacket(0x8, 0xB, 0x0, obj.GenerateSpawnBlob());
            //}



            context.SendPacket(new NoPayloadPacket(0x03, 0x2B));
        }