Ejemplo n.º 1
0
        private void HandleConnections(MeshTile tile)
        {
            if (tile.Header.OffMeshConCount <= 0)
            {
                return;
            }

            var count = tile.Header.OffMeshConCount;

            for (int i = 0; i < count; i++)
            {
                var con = tile.GetOffMeshConnection(i);
                if (con == null)
                {
                    continue;
                }
                var path = TaxiHelper.GetPath((int)con.UserID);
                if (path == null)
                {
                    DisableConnection(tile, i);
                    continue;
                }
                var from = TaxiHelper.GetNode(path.From);
                var to   = TaxiHelper.GetNode(path.To);
                if (from == null || to == null)
                {
                    DisableConnection(tile, i);
                    continue;
                }

                var data = new ConnectionData
                {
                    Alliance = from.IsAlliance || to.IsAlliance,
                    Horde    = from.IsHorde || to.IsHorde,
                    Cost     = path.Cost,
                    From     = from.Name,
                    To       = to.Name,
                    Id       = (int)con.UserID
                };

                if (!ConnectionHandler(data))
                {
                    DisableConnection(tile, i);
                }
            }
        }
Ejemplo n.º 2
0
        private void HandleConnections(MeshTile tile)
        {
            if (tile.Header.OffMeshConCount <= 0)
                return;

            var count = tile.Header.OffMeshConCount;
            for (int i = 0; i < count; i++)
            {
                var con = tile.GetOffMeshConnection(i);
                if (con == null)
                    continue;
                var path = TaxiHelper.GetPath((int)con.UserID);
                if (path == null)
                {
                    DisableConnection(tile, i);
                    continue;
                }
                var from = TaxiHelper.GetNode(path.From);
                var to = TaxiHelper.GetNode(path.To);
                if (from == null || to == null)
                {
                    DisableConnection(tile, i);
                    continue;
                }

                var data = new ConnectionData
                               {
                                   Alliance = from.IsAlliance || to.IsAlliance,
                                   Horde = from.IsHorde || to.IsHorde,
                                   Cost = path.Cost,
                                   From = from.Name,
                                   To = to.Name,
                                   Id = (int)con.UserID
                               };

                if (!ConnectionHandler(data))
                    DisableConnection(tile, i);
            }
        }