public static void Remove() { if (!Game1.IsMasterGame) { return; } if (Game1.getLocationFromName("DeepWoods") is DeepWoods rootDeepWoods) { DeepWoodsManager.rootDeepWoodsBackup = rootDeepWoods; } List <DeepWoods> toBeRemoved = new List <DeepWoods>(); foreach (var location in Game1.locations) { if (location is DeepWoods deepWoods) { toBeRemoved.Add(deepWoods); } } foreach (var deepWoods in toBeRemoved) { DeepWoodsManager.RemoveDeepWoodsFromGameLocations(deepWoods); } }
private void InitGameIfNecessary() { ModEntry.Log("InitGameIfNecessary(" + isDeepWoodsGameRunning + ")", StardewModdingAPI.LogLevel.Trace); // Make sure our interceptor is set. // E.g. MTN overrides Game1.multiplayer instead of wrapping. Game1MultiplayerAccessProvider.InterceptMultiplayerIfNecessary(); if (isDeepWoodsGameRunning) { return; } if (Game1.IsMasterGame) { DeepWoodsSettings.DoLoad(); DeepWoodsManager.Add(); EasterEggFunctions.RestoreAllEasterEggsInGame(); WoodsObelisk.RestoreAllInGame(); isDeepWoodsGameRunning = true; } else { DeepWoodsManager.Remove(); hasRequestedInitMessageFromServer = true; Game1.MasterPlayer.queueMessage(Settings.Network.DeepWoodsMessageId, Game1.player, new object[] { NETWORK_MESSAGE_DEEPWOODS_INIT }); } }
private void SaveEvents_BeforeSave(object sender, EventArgs args) { ModEntry.Log("SaveEvents_BeforeSave", StardewModdingAPI.LogLevel.Trace); isBeforeSaveCount++; if (isBeforeSaveCount > 1) { ModEntry.Log("BeforeSave event was called twice in a row. Ignoring second call.", StardewModdingAPI.LogLevel.Warn); return; } DeepWoodsManager.Remove(); EasterEggFunctions.RemoveAllEasterEggsFromGame(); WoodsObelisk.RemoveAllFromGame(); DeepWoodsSettings.DoSave(); foreach (var who in Game1.getAllFarmers()) { if (who.currentLocation is DeepWoods) { who.currentLocation = Game1.getLocationFromName("Woods"); who.Position = new Vector2(WOODS_WARP_LOCATION.X * 64, WOODS_WARP_LOCATION.Y * 64); } } }
public void ValidateAndIfNecessaryCreateExitChildren() { if (!Game1.IsMasterGame) { return; } if (this.playerCount.Value <= 0) { return; } if (this.level.Value > 1 && this.Parent == null && !this.HasExit(CastEnterDirToExitDir(this.EnterDir))) { // this.abandonedByParentTime = Game1.timeOfDay; this.exits.Add(new DeepWoodsExit(this, CastEnterDirToExitDir(this.EnterDir), this.EnterLocation)); } foreach (var exit in this.exits) { DeepWoods exitDeepWoods = Game1.getLocationFromName(exit.TargetLocationName) as DeepWoods; if (exitDeepWoods == null) { exitDeepWoods = new DeepWoods(this, this.level.Value + 1, ExitDirToEnterDir(exit.ExitDir)); DeepWoodsManager.AddDeepWoodsToGameLocations(exitDeepWoods); } exit.TargetLocationName = exitDeepWoods.Name; exit.TargetLocation = exitDeepWoods.EnterLocation; } }
public static void AddAll(string[] deepWoodsLevelNames) { DeepWoodsManager.Remove(); foreach (string name in deepWoodsLevelNames) { AddBlankDeepWoodsToGameLocations(name); } }
private void TimeEvents_TimeOfDayChanged(object sender, EventArgs args) { if (!isDeepWoodsGameRunning) { return; } DeepWoodsManager.LocalTimeUpdate(Game1.timeOfDay); }
// Called whenever a player warps, both from and to may be null public static void PlayerWarped(Farmer who, GameLocation rawFrom, GameLocation rawTo) { DeepWoods from = rawFrom as DeepWoods; DeepWoods to = rawTo as DeepWoods; if (from != null && to != null && from.Name == to.Name) { return; } ModEntry.Log("PlayerWarped from: " + rawFrom?.Name + ", to: " + rawTo?.Name, LogLevel.Trace); from?.RemovePlayer(who); to?.AddPlayer(who); if (from != null && to == null) { // We left the deepwoods, fix lighting DeepWoodsManager.FixLighting(); // Stop music Game1.changeMusicTrack("none"); Game1.updateMusic(); // Workaround for bug where players are warped to [0,0] for some reason if (rawTo is Woods && who == Game1.player) { who.Position = new Vector2(WOODS_WARP_LOCATION.X * 64, WOODS_WARP_LOCATION.Y * 64); } } if (who == Game1.player && from != null && to != null && from.Parent == null && to.Parent == from && !lostMessageDisplayedToday && !to.spawnedFromObelisk.Value && ExitDirToEnterDir(CastEnterDirToExitDir(from.EnterDir)) == to.EnterDir) { Game1.addHUDMessage(new HUDMessage(I18N.LostMessage) { noIcon = true }); lostMessageDisplayedToday = true; } if (who == Game1.player && to != null && to.level.Value >= Settings.Level.MinLevelForWoodsObelisk && !Game1.player.hasOrWillReceiveMail(WOODS_OBELISK_WIZARD_MAIL_ID) && (Game1.player.mailReceived.Contains("hasPickedUpMagicInk") || Game1.player.hasMagicInk)) { Game1.addMailForTomorrow(WOODS_OBELISK_WIZARD_MAIL_ID); } }
private void GameEvents_UpdateTick(object sender, EventArgs args) { if (!isDeepWoodsGameRunning) { return; } WorkErrorMessageQueue(); Dictionary <long, GameLocation> newPlayerLocations = new Dictionary <long, GameLocation>(); foreach (Farmer farmer in Game1.getOnlineFarmers()) { newPlayerLocations.Add(farmer.UniqueMultiplayerID, farmer.currentLocation); } // Detect any farmer who left, joined or changed location. foreach (var playerLocation in playerLocations) { if (!newPlayerLocations.ContainsKey(playerLocation.Key)) { // player left PlayerWarped(Game1.getFarmer(playerLocation.Key), playerLocation.Value, null); } else if (playerLocation.Value?.Name != newPlayerLocations[playerLocation.Key]?.Name) { // player warped PlayerWarped(Game1.getFarmer(playerLocation.Key), playerLocation.Value, newPlayerLocations[playerLocation.Key]); } } foreach (var newPlayerLocation in newPlayerLocations) { if (!playerLocations.ContainsKey(newPlayerLocation.Key)) { // player joined PlayerWarped(Game1.getFarmer(newPlayerLocation.Key), null, newPlayerLocation.Value); } } // Update cache playerLocations = newPlayerLocations; // DeepWoodsManager.LocalTick(); // Fix lighting in Woods and DeepWoods DeepWoodsManager.FixLighting(); // Add woods obelisk to wizard shop if possible and necessary, // intercept Building.obeliskWarpForReal() calls. WoodsObelisk.InjectWoodsObeliskIntoGame(); }
private static void CheckValid() { if (!Game1.IsMasterGame) { return; } if (!IsValidForThisGame()) { Remove(); DeepWoodsManager.AddDeepWoodsToGameLocations(new DeepWoods(null, 1, EnterDirection.FROM_TOP)); } }
private void TimeEvents_AfterDayStarted(object sender, EventArgs args) { ModEntry.Log("TimeEvents_AfterDayStarted", StardewModdingAPI.LogLevel.Trace); InitGameIfNecessary(); if (!isDeepWoodsGameRunning) { return; } DeepWoodsManager.LocalDayUpdate(Game1.dayOfMonth); EasterEggFunctions.InterceptIncubatorEggs(); }
public static void DeepWoodsInitServerAnswerReceived(List <string> deepWoodsLevelNames) { if (Game1.IsMasterGame) { return; } ModEntry.Log("DeepWoodsInitServerAnswerReceived", StardewModdingAPI.LogLevel.Debug); DeepWoodsManager.AddAll(deepWoodsLevelNames); EasterEggFunctions.RestoreAllEasterEggsInGame(); // WoodsObelisk.RestoreAllInGame(); <- Not needed, server already sends correct building mod.isDeepWoodsGameRunning = true; }
public static void Restore() { if (!Game1.IsMasterGame) { return; } if (DeepWoodsManager.rootDeepWoodsBackup != null) { DeepWoodsManager.AddDeepWoodsToGameLocations(DeepWoodsManager.rootDeepWoodsBackup); } DeepWoodsManager.rootDeepWoodsBackup = null; CheckValid(); }
public bool TryRemove() { if (!Game1.IsMasterGame) { throw new ApplicationException("Illegal call to DeepWoods.TryRemove() in client."); } if (this.level.Value == 1) { return(false); } if (this.playerCount.Value > 0) { return(false); } if ((this.Parent?.playerCount ?? 0) > 0 && Game1.timeOfDay <= (this.abandonedByParentTime.Value + TIME_BEFORE_DELETION_ALLOWED)) { return(false); } if (Game1.timeOfDay <= (this.spawnTime.Value + TIME_BEFORE_DELETION_ALLOWED)) { return(false); } foreach (var exit in this.exits) { if (Game1.getLocationFromName(exit.TargetLocationName) is DeepWoods exitDeepWoods) { exitDeepWoods.parentName.Value = null; exitDeepWoods.parentExitLocation.Value = Point.Zero; } } this.parentName.Value = null; this.parentExitLocation.Value = Point.Zero; this.exits.Clear(); this.characters.Clear(); this.terrainFeatures.Clear(); this.largeTerrainFeatures.Clear(); this.resourceClumps.Clear(); DeepWoodsManager.RemoveDeepWoodsFromGameLocations(this); return(true); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (this.isWithinBounds(x, y)) { foreach (ClickableComponent levelButton in this.levelButtons) { if (levelButton.containsPoint(x, y)) { Game1.playSound("smallSelect"); Game1.changeMusicTrack("none"); this.exitThisMenu(false); DeepWoodsManager.WarpFarmerIntoDeepWoods(Convert.ToInt32(levelButton.name)); } } base.receiveLeftClick(x, y, true); } else { this.exitThisMenu(false); } }
protected override void resetLocalState() { base.resetLocalState(); // TODO: Better critter spawning in forest this.tryToAddCritters(false); ModEntry.GetAPI().CallBeforeDebrisCreation(this); if (!ModEntry.GetAPI().CallOverrideDebrisCreation(this)) { DeepWoodsDebris.Initialize(this); } ModEntry.GetAPI().CallAfterDebrisCreation(this); foreach (Vector2 lightSource in this.lightSources) { Game1.currentLightSources.Add(new LightSource(LightSource.indoorWindowLight, lightSource * 64f, 1.0f)); } DeepWoodsManager.FixLighting(); }
public static DeepWoods AddDeepWoodsFromObelisk(int level) { if (!Game1.IsMasterGame) { throw new ApplicationException("Illegal call to DeepWoodsManager.AddDeepWoodsFromObelisk in client."); } // First check if a level already exists and use that. foreach (GameLocation gameLocation in Game1.locations) { if (gameLocation is DeepWoods && (gameLocation as DeepWoods).level.Value == level) { return(gameLocation as DeepWoods); } } // Otherwise create a new level. DeepWoods deepWoods = new DeepWoods(level); DeepWoodsManager.AddDeepWoodsToGameLocations(deepWoods); return(deepWoods); }
private void SaveEvents_AfterSave(object sender, EventArgs args) { ModEntry.Log("SaveEvents_AfterSave", StardewModdingAPI.LogLevel.Trace); isBeforeSaveCount--; if (isBeforeSaveCount > 0) { ModEntry.Log("AfterSave event was called before save has finished. Ignoring.", StardewModdingAPI.LogLevel.Warn); return; } if (isBeforeSaveCount < 0) { ModEntry.Log("AfterSave event was called without previous BeforeSave call. Mod is now in unknown state, all hell might break lose.", StardewModdingAPI.LogLevel.Error); return; } DeepWoodsManager.Restore(); EasterEggFunctions.RestoreAllEasterEggsInGame(); WoodsObelisk.RestoreAllInGame(); }
private void InitGameIfNecessary() { ModEntry.Log("InitGameIfNecessary(" + isDeepWoodsGameRunning + ")", StardewModdingAPI.LogLevel.Trace); if (isDeepWoodsGameRunning) { return; } if (Game1.IsMasterGame) { DeepWoodsSettings.DoLoad(); DeepWoodsManager.Add(); EasterEggFunctions.RestoreAllEasterEggsInGame(); WoodsObelisk.RestoreAllInGame(); isDeepWoodsGameRunning = true; } else { DeepWoodsManager.Remove(); ModEntry.SendMessage(MessageId.RequestMetadata, Game1.MasterPlayer.UniqueMultiplayerID); } }
private void PlayerWarped(Farmer who, GameLocation prevLocation, GameLocation newLocation) { if (!isDeepWoodsGameRunning) { return; } if (prevLocation is DeepWoods dw1 && newLocation is DeepWoods dw2 && dw1.Name == dw2.Name) { return; } if (newLocation is Woods woods) { OpenPassageInSecretWoods(woods); } DeepWoodsManager.PlayerWarped(who, prevLocation as DeepWoods, newLocation as DeepWoods, newLocation); if (newLocation is AnimalHouse animalHouse) { EasterEggFunctions.CheckEggHatched(who, animalHouse); } }
// This method is also called by the patch in DeepWoodsMTNCompatibilityMod. // We return false when we handled this message, so Harmony will cancel the original MTN handler. private static bool InternalProcessIncomingMessage(IncomingMessage msg) { if (msg.MessageType == Settings.Network.DeepWoodsMessageId) { int deepwoodsMessageType = msg.Reader.ReadInt32(); int randId = Game1.random.Next(); ModEntry.Log("InterceptProcessIncomingMessage[" + randId + "], master id: " + Game1.MasterPlayer.UniqueMultiplayerID + ", local id: " + Game1.player.UniqueMultiplayerID + ", msg.FarmerID: " + msg.FarmerID + ", deepwoodsMessageType: " + deepwoodsMessageType, StardewModdingAPI.LogLevel.Debug); Farmer who = Game1.getFarmer(msg.FarmerID); if (who == null || who == Game1.player) { ModEntry.Log(" who is null or local!", StardewModdingAPI.LogLevel.Warn); return(true); // execute original } if (deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_INIT) { ModEntry.Log(" [" + randId + "] deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_INIT", StardewModdingAPI.LogLevel.Debug); if (Game1.IsMasterGame) { // Client requests settings and state, send it: List <string> deepWoodsLevelNames = new List <string>(); foreach (var location in Game1.locations) { if (location is DeepWoods deepWoods) { deepWoodsLevelNames.Add(deepWoods.Name); } } object[] data = new object[deepWoodsLevelNames.Count + 4]; data[0] = NETWORK_MESSAGE_DEEPWOODS_INIT; data[1] = JsonConvert.SerializeObject(Settings); data[2] = JsonConvert.SerializeObject(DeepWoodsState); data[3] = (int)deepWoodsLevelNames.Count; for (int i = 0; i < deepWoodsLevelNames.Count; i++) { data[i + 4] = deepWoodsLevelNames[i]; } ModEntry.Log(" [" + randId + "] Client requests settings and state, deepWoodsLevelNames.Count: " + deepWoodsLevelNames.Count + ", deepWoodsLevelNames: " + String.Join(", ", deepWoodsLevelNames.ToArray()), StardewModdingAPI.LogLevel.Debug); who.queueMessage(Settings.Network.DeepWoodsMessageId, Game1.MasterPlayer, data); } else { // Server sent us settings and state! Settings = JsonConvert.DeserializeObject <DeepWoodsSettings>(msg.Reader.ReadString()); DeepWoodsState = JsonConvert.DeserializeObject <DeepWoodsStateData>(msg.Reader.ReadString()); int numDeepWoodsLevelNames = msg.Reader.ReadInt32(); List <string> deepWoodsLevelNames = new List <string>(); for (int i = 0; i < numDeepWoodsLevelNames; i++) { deepWoodsLevelNames.Add(msg.Reader.ReadString()); } ModEntry.Log(" [" + randId + "] Server sent us settings and state, deepWoodsLevelNames.Count: " + deepWoodsLevelNames.Count + ", deepWoodsLevelNames: " + String.Join(", ", deepWoodsLevelNames.ToArray()), StardewModdingAPI.LogLevel.Debug); ModEntry.DeepWoodsInitServerAnswerReceived(deepWoodsLevelNames); } } else { if (!Game1.IsMasterGame && !ModEntry.IsDeepWoodsGameRunning) { if (ModEntry.HasRequestedInitMessageFromServer) { ModEntry.Log("Got message from server before init message!", StardewModdingAPI.LogLevel.Warn); } else { ModEntry.Log("Got message from server before init message, never sent init message request!", StardewModdingAPI.LogLevel.Warn); } } if (deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_WARP) { ModEntry.Log(" [" + randId + "] deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_WARP", StardewModdingAPI.LogLevel.Debug); DeepWoodsWarpMessageData data = ReadDeepWoodsWarpMessage(msg.Reader); if (Game1.IsMasterGame) { // Client requests that we load and activate a specific DeepWoods level they want to warp into. DeepWoods deepWoods = DeepWoodsManager.AddDeepWoodsFromObelisk(data.Level); // Send message to client telling them we have the level ready. ModEntry.Log(" [" + randId + "] Client requests that we load and activate a specific DeepWoods level they want to warp into: data.Level:" + data.Level, StardewModdingAPI.LogLevel.Debug); who.queueMessage(Settings.Network.DeepWoodsMessageId, Game1.MasterPlayer, new object[] { NETWORK_MESSAGE_DEEPWOODS_WARP, deepWoods.level.Value, deepWoods.Name, new Vector2(deepWoods.enterLocation.Value.X, deepWoods.enterLocation.Value.Y) }); } else { // Server informs us that we can warp now! ModEntry.Log(" [" + randId + "] Server informs us that we can warp now: data.Level:" + data.Level + ", data.Name:" + data.Name, StardewModdingAPI.LogLevel.Debug); DeepWoodsManager.AddBlankDeepWoodsToGameLocations(data.Name); DeepWoodsManager.WarpFarmerIntoDeepWoodsFromServerObelisk(data.Name, data.EnterLocation); } } else if (deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_LEVEL) { ModEntry.Log(" [" + randId + "] deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_LEVEL", StardewModdingAPI.LogLevel.Debug); if (!Game1.IsMasterGame && who == Game1.MasterPlayer) { DeepWoodsState.LowestLevelReached = msg.Reader.ReadInt32(); ModEntry.Log(" [" + randId + "] DeepWoodsState.LowestLevelReached: " + DeepWoodsState.LowestLevelReached, StardewModdingAPI.LogLevel.Debug); } } else if (deepwoodsMessageType == NETWORK_MESSAGE_RCVD_STARDROP_FROM_UNICORN) { ModEntry.Log(" [" + randId + "] deepwoodsMessageType == NETWORK_MESSAGE_RCVD_STARDROP_FROM_UNICORN", StardewModdingAPI.LogLevel.Debug); if (Game1.IsMasterGame) { DeepWoodsState.PlayersWhoGotStardropFromUnicorn.Add(who.UniqueMultiplayerID); } } else if (deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_ADDREMOVE) { ModEntry.Log(" [" + randId + "] deepwoodsMessageType == NETWORK_MESSAGE_DEEPWOODS_ADDREMOVE", StardewModdingAPI.LogLevel.Debug); if (!Game1.IsMasterGame) { bool added = msg.Reader.ReadByte() != 0; string name = msg.Reader.ReadString(); ModEntry.Log(" [" + randId + "] added: " + added + ", name: " + name, StardewModdingAPI.LogLevel.Debug); if (added) { DeepWoodsManager.AddBlankDeepWoodsToGameLocations(name); } else { DeepWoodsManager.RemoveDeepWoodsFromGameLocations(name); } } } else { ModEntry.Log(" [" + randId + "] unknown deepwoodsMessageType: " + deepwoodsMessageType + "!", StardewModdingAPI.LogLevel.Warn); return(true); // execute original } } return(false); // don't execute original } return(true); // execute original }
private void Warp(ExitDirection exitDir) { if (Game1.locationRequest == null) { bool warped = false; string targetDeepWoodsName = null; Location?targetLocationWrapper = null; if (level.Value == 1 && exitDir == ExitDirection.TOP) { targetDeepWoodsName = "Woods"; targetLocationWrapper = WOODS_WARP_LOCATION; } else if (GetExit(exitDir) is DeepWoodsExit exit) { targetDeepWoodsName = exit.TargetLocationName; if (exit.TargetLocation.X == 0 && exit.TargetLocation.Y == 0) { if (Game1.getLocationFromName(targetDeepWoodsName) is DeepWoods exitDeepWoods) { exit.TargetLocation = new Location(exitDeepWoods.enterLocation.X, exitDeepWoods.enterLocation.Y); } } targetLocationWrapper = exit.TargetLocation; } else if (CastEnterDirToExitDir(EnterDir) == exitDir) { targetDeepWoodsName = parentName.Value; if (ParentExitLocation.X == 0 && ParentExitLocation.Y == 0) { if (Game1.getLocationFromName(targetDeepWoodsName) is DeepWoods parentDeepWoods) { ParentExitLocation = parentDeepWoods.GetExit(EnterDirToExitDir(EnterDir)).Location; } } targetLocationWrapper = ParentExitLocation; } ModEntry.Log($"Trying to warp from {this.Name}: (ExitDir: {exitDir}, Position: {Game1.player.Position.X}, {Game1.player.Position.Y}, targetDeepWoodsName: {targetDeepWoodsName}, targetLocation: {(targetLocationWrapper?.X ?? -1)}, {(targetLocationWrapper?.Y ?? -1)})", LogLevel.Trace); if (targetLocationWrapper.HasValue && targetDeepWoodsName != null) { Location targetLocation = targetLocationWrapper.Value; if (!(targetLocation.X == 0 && targetLocation.Y == 0)) { if (exitDir == ExitDirection.LEFT) { targetLocation.X += 1; } else if (exitDir == ExitDirection.BOTTOM) { targetLocation.Y += 1; } if (targetDeepWoodsName != "Woods") { DeepWoodsManager.currentWarpRequestName = targetDeepWoodsName; DeepWoodsManager.currentWarpRequestLocation = new Vector2(targetLocation.X * 64, targetLocation.Y * 64); if (!Game1.IsMasterGame) { DeepWoodsManager.AddBlankDeepWoodsToGameLocations(targetDeepWoodsName); } } Game1.warpFarmer(targetDeepWoodsName, targetLocation.X, targetLocation.Y, false); warped = true; } } if (!warped) { ModEntry.Log("Warp from " + this.Name + " failed. (ExitDir: " + exitDir + ")", LogLevel.Warn); } } }
private void OnModMessageReceived(object sender, ModMessageReceivedEventArgs e) { if (e.FromModID != this.ModManifest.UniqueID) { return; } ModEntry.Log($"[{(Context.IsMainPlayer ? "host" : "farmhand")}] Received {e.Type} from {e.FromPlayerID}.", LogLevel.Trace); switch (e.Type) { // farmhand requested metadata case MessageId.RequestMetadata: if (Context.IsMainPlayer) { // client requests settings and state, send it: InitResponseMessage response = new InitResponseMessage { Settings = DeepWoodsSettings.Settings, State = DeepWoodsSettings.DeepWoodsState, LevelNames = Game1.locations.OfType <DeepWoods>().Select(p => p.Name).ToArray() }; ModEntry.SendMessage(response, MessageId.Metadata, e.FromPlayerID); } break; // host sent metadata case MessageId.Metadata: if (!Context.IsMainPlayer) { InitResponseMessage response = e.ReadAs <InitResponseMessage>(); DeepWoodsSettings.Settings = response.Settings; DeepWoodsSettings.DeepWoodsState = response.State; ModEntry.DeepWoodsInitServerAnswerReceived(response.LevelNames); } break; // farmhand requested that we load and activate a DeepWoods level case MessageId.RequestWarp: if (Context.IsMainPlayer) { // load level int level = e.ReadAs <int>(); DeepWoods deepWoods = DeepWoodsManager.AddDeepWoodsFromObelisk(level); // send response WarpMessage response = new WarpMessage { Level = deepWoods.Level, Name = deepWoods.Name, EnterLocation = new Vector2(deepWoods.enterLocation.Value.X, deepWoods.enterLocation.Value.Y) }; ModEntry.SendMessage(response, MessageId.Warp, e.FromPlayerID); } break; // host loaded area for warp case MessageId.Warp: if (!Context.IsMainPlayer) { WarpMessage data = e.ReadAs <WarpMessage>(); DeepWoodsManager.AddBlankDeepWoodsToGameLocations(data.Name); DeepWoodsManager.WarpFarmerIntoDeepWoodsFromServerObelisk(data.Name, data.EnterLocation); } break; // host sent 'lowest level reached' update case MessageId.SetLowestLevelReached: if (!Context.IsMainPlayer) { DeepWoodsState.LowestLevelReached = e.ReadAs <int>(); } break; // host sent 'received stardrop from unicorn' update case MessageId.SetUnicornStardropReceived: if (Context.IsMainPlayer) { DeepWoodsState.PlayersWhoGotStardropFromUnicorn.Add(e.FromPlayerID); } break; // host added/removed location case MessageId.AddLocation: if (!Context.IsMainPlayer) { string name = e.ReadAs <string>(); DeepWoodsManager.AddBlankDeepWoodsToGameLocations(name); } break; case MessageId.RemoveLocation: if (!Context.IsMainPlayer) { string name = e.ReadAs <string>(); DeepWoodsManager.RemoveDeepWoodsFromGameLocations(name); } break; default: ModEntry.Log(" ignored unknown type.", LogLevel.Trace); break; } }