Ejemplo n.º 1
0
        public static void Postfix(WaypointMapLayer __instance, byte[] data)
        {
            string currentHash = FloatyWaypointManagement.GetWaypointsHash();

            if (currentHash != null)
            {
                var    incomingWaypoints = SerializerUtil.Deserialize <List <Waypoint> >(data);
                string str = "";

                for (int i = 0; i < incomingWaypoints.Count; i++)
                {
                    str += incomingWaypoints[i].Title;
                    str += i;
                }

                string incomingHash = ExtraMath.Sha512Hash(str);

                if (currentHash == incomingHash)
                {
                    return;
                }
            }

            FloatyWaypointManagement.TriggerRepopulation();
        }
        public static void ResendWaypoints(this WorldMapManager mapManager, IServerPlayer player, WaypointMapLayer mapLayer)
        {
            //copied from WaypointMapLayer because the method is not public
            Dictionary <int, PlayerGroupMembership> memberOfGroups = player.ServerData.PlayerGroupMemberships;
            List <Waypoint> hisMarkers = new List <Waypoint>();

            foreach (Waypoint marker in mapLayer.Waypoints)
            {
                if (player.PlayerUID != marker.OwningPlayerUid && !memberOfGroups.ContainsKey(marker.OwningPlayerGroupId))
                {
                    continue;
                }
                hisMarkers.Add(marker);
            }
            mapManager.SendMapDataToClient(mapLayer, player, SerializerUtil.Serialize(hisMarkers));
        }