public void SendMapsToWorld(string playerid) { SelectedWorld.AddMaps(ImportingMapPreviews.ToDictionary(x => x.ID, x => x.Map)); var ids = ImportingMapPreviews.Select(x => x.ID); AddChests(ids, playerid); ExistingMapPreviews.AddRange(ImportingMapPreviews); UI.ExistingZone.Controls.AddRange(ImportingMapPreviews.ToArray()); ImportingMapPreviews.Clear(); UI.ImportZone.Controls.Clear(); }
// returns number of conflicts, does nothing if there is at least one public int SendMapsToWorld(IEnumerable <MapIDControl> maps, MapReplaceOption option, string playerid = NOBODY_IDENTIFIER) { var writemaps = maps.ToList(); var conflictids = new List <long>(); // check for conflicts foreach (var map in maps) { if (map.Conflicted) { conflictids.Add(map.ID); if (option == MapReplaceOption.Skip) { writemaps.Remove(map); } } } if (option == MapReplaceOption.Info) { return(conflictids.Count); } if (option == MapReplaceOption.ChangeExisting) { foreach (var conflict in conflictids) { var currentholder = GetMapByID(conflict, MapStatus.Existing); currentholder.SetID(GetSafeID()); writemaps.Add(currentholder); } } SelectedWorld.AddMaps(writemaps.ToDictionary(x => x.ID, x => x.Map)); var ids = writemaps.Select(x => x.ID); AddChests(ids, playerid); foreach (var box in writemaps.ToArray()) { var exists = GetMapByID(box.ID, MapStatus.Existing); if (exists != null && exists != box) { RemoveFromZone(exists, MapStatus.Existing); } SendToZone(box, MapStatus.Existing); } DetermineTransferConflicts(); return(conflictids.Count); }