[Fab] /bring Command (Mob)

Posts 1–7 of 7 · Page 1 of 1
[Fab] /bring Command (Mob)
This command brings the nearest entity to you


 
Credits
Requested by @BurgerLoverMx
Helped by @OmegaBm
Majority by Me



 
Example
/bring Medusa (Not case-sensitive)


 
Bugs
When you /bring the same entity again, it will not bring the previous entity, it will look for another near entity instead of the one you just did


 
Command
Code:
    internal class BringMobCommand : Command    {
        public BringMobCommand()
            : base("bring", 8)
        {
        }




        protected override bool Process(Player player, RealmTime time, string[] args)
        {
            if (string.IsNullOrEmpty(args[0]))
            {
                player.SendHelp("Usage: /bring <entity>");
                return false;
            }
            {
                string name = string.Join(" ", args);
                ushort objType;
                //creates a new case insensitive dictionary based on the XmlDatas
                Dictionary<string, ushort> icdatas = new Dictionary<string, ushort>(
                    player.Manager.GameData.IdToObjectType,
                    StringComparer.OrdinalIgnoreCase);
                if (!icdatas.TryGetValue(name, out objType) || !player.Manager.GameData.ObjectDescs.ContainsKey(objType))
                { }
                else
                {


                    var entity = player.GetNearestEntity(10000, objType);
                    entity.Move(player.X, player.Y);
                    player.SendInfo("Success!");
                    return true;
                }
                player.SendError("Entity does not exist!");
                return false;
            }
        }
    }
Quote Originally Posted by Desire View Post
This command brings the nearest entity to you


 
Credits
Requested by @BurgerLoverMx
Helped by @OmegaBm
Majority by Me



 
Example
/bring Medusa (Not case-sensitive)


 
Bugs
When you /bring the same entity again, it will not bring the previous entity, it will look for another near entity instead of the one you just did


 
Command
Code:
    internal class BringMobCommand : Command
    {
        public BringMobCommand()
            : base("bring", 8)
        {
        }


        protected override bool Process(Player player, RealmTime time, string[] args)
        {
            if (string.IsNullOrEmpty(args[0]))
            {
                player.SendHelp("Usage: /bring <entity>");
                return false;
            }
            {
                string name = string.Join(" ", args);
                ushort objType;
                //creates a new case insensitive dictionary based on the XmlDatas
                Dictionary<string, ushort> icdatas = new Dictionary<string, ushort>(
                    player.Manager.GameData.IdToObjectType,
                    StringComparer.OrdinalIgnoreCase);
                if (!icdatas.TryGetValue(name, out objType) || !player.Manager.GameData.ObjectDescs.ContainsKey(objType))
                { }
                else
                {
                    
                    var entity = player.GetNearestEntity(10000, objType);
                    entity.Move(player.X, player.Y);
                    player.SendInfo("Success!");
                    return true;
                }
            }
            player.SendError("Entity does not exist!");
            return false;
        }
    }
Thanks for helping me!
it just says no permission ;-; the other commands work (give, etc.)
Quote Originally Posted by lordbaconzx View Post
it just says no permission ;-; the other commands work (give, etc.)
You need to change the "8" to whatever rank you want.

Quote Originally Posted by Desire View Post
 
Command
Code:
    internal class BringMobCommand : Command    {
        public BringMobCommand()
            : base("bring", 8)
        {
        }
Thanks for the release
Thanks for the contribution, although cant really see a use for this but might help someone I guess.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?