Ejemplo n.º 1
0
        public GameobjectParameter(IDatabaseProvider database,
                                   IServerIntegration serverIntegration,
                                   IItemFromListProvider itemFromListProvider)
        {
            this.database  = database;
            SpecialCommand = async() =>
            {
                var entry = await serverIntegration.GetNearestGameObjects();

                if (entry == null || entry.Count == 0)
                {
                    return(null);
                }

                var options = entry.GroupBy(e => e.Entry)
                              .OrderBy(group => group.Key)
                              .ToDictionary(g => (long)g.Key,
                                            g => new SelectOption(database.GetGameObjectTemplate(g.Key)?.Name ?? "Unknown name",
                                                                  $"{g.First().Distance} yd away"));

                if (options.Count == 1)
                {
                    return((uint)options.Keys.First());
                }

                var pick = await itemFromListProvider.GetItemFromList(options, false);

                if (pick.HasValue)
                {
                    return((uint)pick.Value);
                }

                return(null);
            };
        }
Ejemplo n.º 2
0
        public ServerConnection(int port, IServerIntegration serverIntegration)
        {
            this.port = port;
            this.serverIntegration = serverIntegration;
            listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

            serverIntegration.Init(this);
        }
Ejemplo n.º 3
0
        public ServerConnection(int port, IServerIntegration serverIntegration)
        {
            this.port = port;
            this.serverIntegration = serverIntegration;
            listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

            serverIntegration.Init(this);
        }
Ejemplo n.º 4
0
        public CreatureParameter(IDatabaseProvider database, IServerIntegration serverIntegration)
        {
            Items          = new Dictionary <long, SelectOption>();
            this.database  = database;
            SpecialCommand = async() =>
            {
                var entry = await serverIntegration.GetSelectedEntry();

                if (entry.HasValue)
                {
                    return(entry);
                }
                return(null);
            };
        }