Player_UpToHorse() public static method

public static Player_UpToHorse ( int ownerID, bool type, int petID ) : byte[]
ownerID int
type bool
petID int
return byte[]
Example #1
0
 /////////////////////////////////////////////////////////////////////////////////
 // Load transport if needed
 /////////////////////////////////////////////////////////////////////////////////
 #region Transport
 void LoadTransport()
 {
     //Wrap our function inside a catcher
     try
     {
         //If the player has an active transport
         if (Character.Transport.Right)
         {
             //Set pet object information
             pet_obj o = Character.Transport.Horse;
             //Set bools for transport
             Character.Transport.Spawned           = true;
             Character.Transport.Horse.Information = true;
             //Send packet for detailed transport information
             client.Send(Packet.Pet_Information(o.UniqueID, o.Model, o.Hp, Character.Information.CharacterID, o));
             //Send player visual onto horse
             Send(Packet.Player_UpToHorse(this.Character.Information.UniqueID, true, o.UniqueID));
             //Set speed state
             Character.Transport.Horse.Speedsend();
             Character.Transport.Horse.statussend();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Load transport error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
Example #2
0
        //###########################################################################################
        // Data
        //###########################################################################################
        void Teleport_Data()
        {
            try
            {
                if (Character.Teleport)
                {
                    StopBerserkTimer();
                    CheckCharStats(Character);
                    client.Send(Packet.StartPlayerLoad());
                    client.Send(Packet.Load(Character));
                    client.Send(Packet.EndPlayerLoad());

                    //snowflake event packet no need
                    //client.Send(Packet.PlayerUnknowPack(Character.Information.UniqueID));
                    //client.Send(Packet.UnknownPacket());
                    SavePlayerPosition();


                    if (Character.Action.MonsterID.Count > 0)
                    {
                        Character.Action.MonsterID.Clear();
                    }
                    if (Character.Transport.Right)
                    {
                        pet_obj o = Character.Transport.Horse;
                        Character.Transport.Spawned           = true;
                        Character.Transport.Horse.Information = true;
                        Send(Packet.Player_UpToHorse(this.Character.Information.UniqueID, true, o.UniqueID));
                    }
                    if (Character.Attackpet.Active)
                    {
                        pet_obj o = Character.Attackpet.Details;
                        //Global.slotItem item =
                        //client.Send(Packet.Pet_Information_grab(o, slot));
                    }
                    if (Character.Grabpet.Active)
                    {
                        //pet_obj o = Character.Grabpet.Details;
                        //client.Send(Packet.Pet_Information_grab(o, slot));
                    }
                    ObjectSpawnCheck();
                    Character.Teleport = false;
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
                Console.WriteLine(ex);
            }
        }
Example #3
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Special Transports / Unicorns etc
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        bool HandleSpecialTrans(int ItemID)
        {
            try
            {
                int model = Global.objectdata.GetItem(Data.ItemBase[ItemID].ObjectName);
                if (this.Character.Information.Level < Data.ItemBase[ItemID].Level)
                {
                    return(true);
                }

                {
                    model = Global.objectdata.GetItem(Data.ItemBase[ItemID].ObjectName);
                    if (model == 0)
                    {
                        return(true);
                    }
                }
                pet_obj o = new pet_obj();
                o.Model    = model;
                o.Ids      = new Global.ID(Global.ID.IDS.Object);
                o.UniqueID = o.Ids.GetUniqueID;
                o.x        = Character.Position.x;
                o.z        = Character.Position.z;
                o.y        = Character.Position.y;
                o.xSec     = Character.Position.xSec;
                o.ySec     = Character.Position.ySec;
                o.Hp       = Data.ObjectBase[model].HP;
                o.OwnerID  = this.Character.Information.UniqueID;

                this.Character.Transport.Right = true;

                List <int> S = o.SpawnMe();
                o.Information = true;
                client.Send(Packet.Pet_Information(o.UniqueID, o.Model, o.Hp, Character.Information.CharacterID, o));
                Send(S, Packet.Player_UpToHorse(this.Character.Information.UniqueID, true, o.UniqueID));
                Systems.HelperObject.Add(o);
                this.Character.Transport.Horse = o;
                return(false);
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
            return(false);
        }
Example #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Close Horse Type
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        protected void HandleClosePet()
        {
            try
            {
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                int          petid  = Reader.Int32();

                if (petid == Character.Transport.Horse.UniqueID)
                {
                    Send(Packet.Player_UpToHorse(this.Character.Information.UniqueID, false, petid));
                    client.Send(Packet.PetSpawn(petid, 1, Character.Transport.Horse));
                    Character.Transport.Horse.DeSpawnMe();
                    Character.Transport.Right = false;
                    if (Character.Position.Walking)
                    {
                        Timer.Movement.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
Example #5
0
        /////////////////////////////////////////////////////////////////////////////////
        // Spawn system
        /////////////////////////////////////////////////////////////////////////////////
        public void ObjectSpawnCheck()
        {
            try
            {
                if (this.Character.deSpawning)
                {
                    return;
                }
                int spawnrange = 80;
                lock (this)
                {
                    //Make sure character info is not null or not spawning yet allready.
                    if (this.Character != null && !this.Character.Spawning)
                    {
                        //Set spawn state to true so cannot be doubled
                        this.Character.Spawning = true;

                        //Repeat for each client ingame
                        #region Clients
                        for (int i = 0; i < Systems.clients.Count; i++)
                        {
                            //Get defined information for the client
                            Systems playerspawn = Systems.clients[i];
                            //Make sure that the spawning case is not ourselfs, or not spawned yet and not null
                            if (playerspawn != null && playerspawn != this && !Character.Spawned(playerspawn.Character.Information.UniqueID) && playerspawn.Character.Information.Name != this.Character.Information.Name)
                            {
                                //If our position is lower or higher then 50 + spawnrange of that of the player
                                if (playerspawn.Character.Position.x >= (Character.Position.x - 50) && playerspawn.Character.Position.x <= ((Character.Position.x - 50) + spawnrange) && playerspawn.Character.Position.y >= (Character.Position.y - 50) && playerspawn.Character.Position.y <= ((Character.Position.y - 50) + spawnrange))
                                {
                                    //Make sure the unique id is not null
                                    if (playerspawn.Character.Information.UniqueID != 0)
                                    {
                                        Character.Spawn.Add(playerspawn.Character.Information.UniqueID);
                                        client.Send(Packet.ObjectSpawn(playerspawn.Character));
                                    }
                                    //Spawn ourselfs to the other players currently in spawn range.
                                    ObjectPlayerSpawn(playerspawn);
                                }
                            }
                        }
                        #endregion
                        //Repeat for each helper object
                        #region Helper objects
                        for (int i = 0; i < Systems.HelperObject.Count; i++)
                        {
                            //If the helper object is not null , or not spawned for us yet and the unique id is not null
                            if (Systems.HelperObject[i] != null && !Systems.HelperObject[i].Spawned(this.Character.Information.UniqueID))
                            {
                                //If our position is lower or higher then 50 + spawnrange of that of the object
                                if (this.Character.Position.x >= (Systems.HelperObject[i].x - 50) && this.Character.Position.x <= ((Systems.HelperObject[i].x - 50) + spawnrange) && this.Character.Position.y >= (Systems.HelperObject[i].y - 50) && this.Character.Position.y <= ((Systems.HelperObject[i].y - 50) + spawnrange))
                                {
                                    if (Systems.HelperObject[i].UniqueID != 0)
                                    {
                                        //Add our spawn
                                        Systems.HelperObject[i].Spawn.Add(this.Character.Information.UniqueID);
                                        //Send visual packet
                                        this.client.Send(Packet.ObjectSpawn(Systems.HelperObject[i]));
                                    }
                                }
                            }
                        }
                        #endregion

                        /*
                         #region Special objects
                         * for (int i = 0; i < Systems.SpecialObjects.Count; i++)
                         * {
                         *  //If the special object is not null , or not spawned for us yet and the unique id is not null
                         *  if (Systems.SpecialObjects[i] != null && !Systems.SpecialObjects[i].Spawned(this.Character.Information.UniqueID))
                         *  {
                         *      //If our position is lower or higher then 50 + spawnrange of that of the object
                         *      if (this.Character.Position.x >= (Systems.SpecialObjects[i].x - 50) && this.Character.Position.x <= ((Systems.SpecialObjects[i].x - 50) + spawnrange) && this.Character.Position.y >= (Systems.SpecialObjects[i].y - 50) && this.Character.Position.y <= ((Systems.SpecialObjects[i].y - 50) + spawnrange))
                         *      {
                         *          if (Systems.SpecialObjects[i].UniqueID != 0)
                         *          {
                         *              //Add our spawn
                         *              Systems.SpecialObjects[i].Spawn.Add(this.Character.Information.UniqueID);
                         *              //Send visual packet
                         *              client.Send(Packet.ObjectSpawn(Systems.SpecialObjects[i]));
                         *              //Console.WriteLine("Spawning {0}", Data.ObjectBase[Systems.Objects[i].ID].Name);
                         *          }
                         *      }
                         *  }
                         * }
                         #endregion
                         */
                        //Repeat for each object
                        #region Objects
                        for (int i = 0; i < Systems.Objects.Count; i++)
                        {
                            //If the helper object is not null , or not spawned for us yet and the unique id is not null
                            if (Systems.Objects[i] != null && !Systems.Objects[i].Spawned(this.Character.Information.UniqueID))
                            {
                                //If our position is lower or higher then 50 + spawnrange of that of the object
                                if (this.Character.Position.x >= (Systems.Objects[i].x - 50) && this.Character.Position.x <= ((Systems.Objects[i].x - 50) + spawnrange) && this.Character.Position.y >= (Systems.Objects[i].y - 50) && this.Character.Position.y <= ((Systems.Objects[i].y - 50) + spawnrange))
                                {
                                    if (Systems.Objects[i].UniqueID != 0 && !Systems.Objects[i].Die)
                                    {
                                        //Add our spawn
                                        Systems.Objects[i].Spawn.Add(this.Character.Information.UniqueID);
                                        //Send visual packet
                                        client.Send(Packet.ObjectSpawn(Systems.Objects[i]));
                                        //Console.WriteLine("Spawning {0}", Data.ObjectBase[Systems.Objects[i].ID].Name);
                                    }
                                }
                            }
                        }
                        #endregion
                        //Repeat for each world item
                        #region Helper objects
                        for (int i = 0; i < Systems.WorldItem.Count; i++)
                        {
                            //If the helper object is not null , or not spawned for us yet and the unique id is not null
                            if (Systems.WorldItem[i] != null && !Systems.WorldItem[i].Spawned(this.Character.Information.UniqueID))
                            {
                                //If our position is lower or higher then 50 + spawnrange of that of the object
                                if (this.Character.Position.x >= (Systems.WorldItem[i].x - 50) && this.Character.Position.x <= ((Systems.WorldItem[i].x - 50) + spawnrange) && this.Character.Position.y >= (Systems.WorldItem[i].y - 50) && this.Character.Position.y <= ((Systems.WorldItem[i].y - 50) + spawnrange))
                                {
                                    if (Systems.WorldItem[i].UniqueID != 0)
                                    {
                                        //Add our spawn
                                        Systems.WorldItem[i].Spawn.Add(this.Character.Information.UniqueID);
                                        //Send visual packet
                                        this.client.Send(Packet.ObjectSpawn(Systems.WorldItem[i]));
                                    }
                                }
                            }
                        }
                        #endregion
                        //If we are riding a horse and its not spawned to the player yet
                        #region Transports
                        if (Character.Transport.Right)
                        {
                            //If not spawned
                            if (!Character.Transport.Spawned)
                            {
                                //Set bool true
                                Character.Transport.Spawned = true;
                                //Spawn horse object
                                Character.Transport.Horse.SpawnMe();
                                //Send visual update player riding horse
                                Character.Transport.Horse.Send(Packet.Player_UpToHorse(this.Character.Information.UniqueID, true, Character.Transport.Horse.UniqueID));
                            }
                        }
                        #endregion
                        //Reset bool to false so we can re-loop the function
                        this.Character.Spawning = false;
                        ObjectDeSpawnCheck();
                    }
                    //If something wrong happened and we are null, we set our bool false as well.
                    this.Character.Spawning = false;
                }
            }
            catch (Exception ex)
            {
                //If any exception happens we disable the loop bool for re-use
                this.Character.Spawning = false;
                Console.WriteLine("Spawn check error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Example #6
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Normal Transport
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        bool HandleHorseScroll(int ItemID)
        {
            try
            {
                int model = Global.objectdata.GetItem(Data.ItemBase[ItemID].ObjectName);
                if (model == 0)
                {
                    string extrapath = null;
                    if (this.Character.Information.Level >= 1 && this.Character.Information.Level <= 5)
                    {
                        extrapath = "_5";
                    }
                    else if (this.Character.Information.Level >= 6 && this.Character.Information.Level <= 10)
                    {
                        extrapath = "_10";
                    }
                    else if (this.Character.Information.Level >= 11 && this.Character.Information.Level <= 20)
                    {
                        extrapath = "_20";
                    }
                    else if (this.Character.Information.Level >= 21 && this.Character.Information.Level <= 30)
                    {
                        extrapath = "_30";
                    }
                    else if (this.Character.Information.Level >= 31 && this.Character.Information.Level <= 45)
                    {
                        extrapath = "_45";
                    }
                    else if (this.Character.Information.Level >= 46 && this.Character.Information.Level <= 60)
                    {
                        extrapath = "_60";
                    }
                    else if (this.Character.Information.Level >= 61 && this.Character.Information.Level <= 75)
                    {
                        extrapath = "_75";
                    }
                    else if (this.Character.Information.Level >= 76 && this.Character.Information.Level <= 90)
                    {
                        extrapath = "_90";
                    }
                    else if (this.Character.Information.Level >= 91 && this.Character.Information.Level <= 105)
                    {
                        extrapath = "_105";
                    }
                    else if (this.Character.Information.Level >= 106 && this.Character.Information.Level <= 120)
                    {
                        extrapath = "_120";
                    }
                    model = Global.objectdata.GetItem(Data.ItemBase[ItemID].ObjectName + extrapath);
                    if (model == 0)
                    {
                        return(true);
                    }
                }
                pet_obj o = new pet_obj();
                o.Model    = model;
                o.Ids      = new Global.ID(Global.ID.IDS.Object);
                o.UniqueID = o.Ids.GetUniqueID;
                o.x        = Character.Position.x;
                o.z        = Character.Position.z;
                o.y        = Character.Position.y;
                o.xSec     = Character.Position.xSec;
                o.ySec     = Character.Position.ySec;
                o.Hp       = Data.ObjectBase[model].HP;
                o.OwnerID  = this.Character.Information.UniqueID;
                o.Speed1   = Data.ObjectBase[model].Speed1;
                o.Speed2   = Data.ObjectBase[model].Speed2;
                this.Character.Transport.Right = true;

                List <int> S = o.SpawnMe();
                o.Information = true;
                client.Send(Packet.Pet_Information(o.UniqueID, o.Model, o.Hp, Character.Information.CharacterID, o));
                Send(Packet.SetSpeed(o.UniqueID, o.Speed1, o.Speed2)); //Global Speed Update
                Send(Packet.ChangeStatus(o.UniqueID, 3, 0));           // Global Status
                Send(S, Packet.Player_UpToHorse(this.Character.Information.UniqueID, true, o.UniqueID));

                Systems.HelperObject.Add(o);
                this.Character.Transport.Horse = o;
                return(false);
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
            return(false);
        }