public static bool performToolAction_Prefix(ref Woods __instance, Tool t, int tileX, int tileY, ref bool __result) { // Gotta have the original method available for mattock stand-ins. if (performToolActionOriginal == null) { return(true); } // If the tool is a mattock, perform the default functionality with a standin axe so the stumps // can be chopped properly. if (t is Mattock mattock) { Axe standinAxe = mattock.asAxe(); Point p = new Point(tileX * 64 + 32, tileY * 64 + 32); for (int i = __instance.stumps.Count - 1; i >= 0; i--) { if (!mattock.struckFeatures.Contains(__instance.stumps[i]) && __instance.stumps[i].getBoundingBox(__instance.stumps[i].tile.Get()).Contains(p)) { mattock.struckFeatures.Add(__instance.stumps[i]); if (__instance.stumps[i].performToolAction(standinAxe, 1, __instance.stumps[i].tile.Get(), __instance)) { __instance.stumps.RemoveAt(i); } __result = true; return(false); } } __result = false; return(false); } // Otherwise, just do the default functionality. return(true); }
private void TryPushLocationDialogue() { NPC c = stateMachine.companion; bool monstersInLocation = CheckForMonstersInThisLocation(c.currentLocation); // If there is combat withheld dialogue, and there are no monsters in this current location... if (combatWithheldDialogue.Count != 0 && !monstersInLocation) { PushCombatWithheldDialogueToCompanionDialogue(); } // If this is a dungeon and there are enemies, remove current dialogue MineShaft ms = c.currentLocation as MineShaft; Woods w = c.currentLocation as Woods; if ((ms != null || w != null) && monstersInLocation) { PushCompanionDialogueToCombatWithheldDialogue(); } // Else, proceed as normal! else { // If there is location-dialogue for this location... Dialogue d = stateMachine.manager.GenerateDialogue(c.currentLocation.Name, stateMachine.companion.Name, false); if (d != null) { // And it hasn't been seen yet... if (!seenDialogueForLocations.TryGetValue(c.currentLocation.Name, out bool visited) || !visited) { // If a location dialogue has already been pushed though... if (locationDialoguePushed) { // Return if it is the dialogue for this location... if (locationDialogueName != null && locationDialogueName.Equals(c.currentLocation.Name)) { return; } // Or remove it if it's from another location RemoveLocationDialogueFromCompanion(); } stateMachine.companion.CurrentDialogue.Push(d); stateMachine.locationDialogue = d; locationDialoguePushed = true; locationDialogueName = c.currentLocation.Name; seenDialogueForLocations[c.currentLocation.Name] = false; } } // If there isn't location-dialogue for this location... else { // and we're not in a mineshaft, and the companion has another location's dialogue pushed, remove it. if (ms == null && locationDialoguePushed) { RemoveLocationDialogueFromCompanion(); } } } }
public void AddNew(Woods newTrail) { using (IDbConnection dbConnection = Connection) { string query = $"INSERT INTO woods (name, length, elevation, description, latitude, longitude, created_at, updated_at) VALUES (@Name, @Length, @Elevation, @Description, @Latitude, @Longitude, NOW(), NOW())"; dbConnection.Open(); dbConnection.Execute(query, newTrail); } }
private void OpenPassageInSecretWoods(Woods woods) { // TODO: Configurable (and moddable!) locations to modify Woods // Game isn't running if (!isDeepWoodsGameRunning) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, mod not initialized.", LogLevel.Trace); return; } Layer buildingsLayer = woods.map.GetLayer("Buildings"); // Just to be sure if (buildingsLayer == null) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, invalid map (buildingsLayer is null).", LogLevel.Trace); return; } // Already patched if (buildingsLayer.Tiles[29, 25] == null) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, map incompatible or already patched.", LogLevel.Trace); return; } ModEntry.Log("OpenPassageInSecretWoods", LogLevel.Trace); TileSheet borderTileSheet = buildingsLayer.Tiles[29, 25].TileSheet; int borderTileIndex = buildingsLayer.Tiles[29, 25].TileIndex; buildingsLayer.Tiles[29, 25] = null; buildingsLayer.Tiles[29, 26] = null; for (int x = 24; x < 29; x++) { buildingsLayer.Tiles[x, 24] = new StaticTile(buildingsLayer, borderTileSheet, BlendMode.Alpha, borderTileIndex); woods.warps.Add(new Warp(x, 32, "DeepWoods", Settings.Map.RootLevelEnterLocation.X, Settings.Map.RootLevelEnterLocation.Y + 1, false)); } /* * foreach (var location in DeleteBuildingTiles) * { * } * * foreach (var location in AddBuildingTiles) * { * } * * foreach (var location in WarpLocations) * { * } */ }
public IActionResult newtrailadd(Woods newTrail) //this is the action that you add to the POST for the html file { if (ModelState.IsValid) { _woodsFactory.AddNew(newTrail); return(RedirectToAction("Index")); } else { return(View("new_trail", newTrail)); } }
private void process() { GameLocation loc = Game1.getLocationFromName(location); LocationCache cache = Multiplayer.locations[location]; if (loc is Forest) { //only the log here, sooo. ((Forest)loc).log = null; cache.prevForestLog = null; } else if (loc is Woods) { //check the stumps in the woods Woods map_woods = (Woods)loc; foreach (var clump in map_woods.stumps) { if (hashVec2(clump) == hash) { //we have found a removed stump! let's kill it :D map_woods.stumps.Remove(clump); cache.updateClumpsCache(map_woods.stumps); break; } } } else if (loc is Farm) { //check the resource clumps on the farm Farm map_farm = (Farm)loc; foreach (var clump in map_farm.resourceClumps) { if (hashVec2(clump) == hash) { //we have found a removed resource clump! let's kill it :D map_farm.resourceClumps.Remove(clump); cache.updateClumpsCache(map_farm.resourceClumps); break; } } } }
public static bool Prefix(Woods __instance, ref bool __result) { return(ModEntry.ProcessNoClipping(ref __result)); }
public override void process(Client client) { Log.Async("Got world data"); //Log.Async(xml); SaveGame mine = SaveGame.loaded; /*if ( mine.player.spouse != null && mine.player.spouse.EndsWith( "engaged" ) && * mine.countdownToWedding == 0 && !mine.weddingToday ) * { * // Not (entirely) sure why this is happening in the first place, but this should fix it. * mine.player.spouse = mine.player.spouse.Replace("engaged", ""); * mine.weddingToday = true; * }*/ SaveGame world = ( SaveGame )SaveGame.serializer.Deserialize(Util.stringStream(xml)); if (Multiplayer.COOP) { mine.player.farmName = world.player.farmName; mine.player.money = world.player.money; mine.player.clubCoins = world.player.clubCoins; mine.player.totalMoneyEarned = world.player.totalMoneyEarned; mine.player.hasRustyKey = world.player.hasRustyKey; mine.player.hasSkullKey = world.player.hasSkullKey; mine.player.hasClubCard = world.player.hasClubCard; // Should I sync dark talisman / magic ink? mine.player.dateStringForSaveGame = world.player.dateStringForSaveGame; } world.player = mine.player; foreach (string mail in Multiplayer.checkMail) { if (world.mailbox.Contains(mail) && !mine.mailbox.Contains(mail)) { mine.mailbox.Add(mail); } if (world.player.mailForTomorrow.Contains(mail) && !mine.player.mailForTomorrow.Contains(mail)) { mine.player.mailForTomorrow.Add(mail); } if (world.player.mailReceived.Contains(mail) && !mine.player.mailReceived.Contains(mail)) { mine.player.mailReceived.Add(mail); } if (world.mailbox.Contains(mail + "%&NL&%") && !mine.mailbox.Contains(mail + "%&NL&%")) { mine.mailbox.Add(mail + "%&NL&%"); } if (world.player.mailForTomorrow.Contains(mail + "%&NL&%") && !mine.player.mailForTomorrow.Contains(mail + "%&NL&%")) { mine.player.mailForTomorrow.Add(mail + "%&NL&%"); } if (world.player.mailReceived.Contains(mail + "%&NL&%") && !mine.player.mailReceived.Contains(mail + "%&NL&%")) { mine.player.mailReceived.Add(mail + "%&NL&%"); } } world.mailbox = mine.mailbox; world.samBandName = mine.samBandName; world.elliottBookName = mine.elliottBookName; // wallpaper/flooring doesn't look needed? world.countdownToWedding = mine.countdownToWedding; world.weddingToday = mine.weddingToday; world.musicVolume = mine.musicVolume; world.soundVolume = mine.soundVolume; world.options = mine.options; world.minecartHighScore = mine.minecartHighScore; if (!Multiplayer.COOP) { world.stats = mine.stats; world.incubatingEgg = mine.incubatingEgg; world.dailyLuck = mine.dailyLuck; world.whichFarm = mine.whichFarm; world.shouldSpawnMonsters = mine.shouldSpawnMonsters; } world.mine_mineLevel = mine.mine_mineLevel; world.mine_nextLevel = mine.mine_nextLevel; world.mine_lowestLevelReached = mine.mine_lowestLevelReached; world.mine_resourceClumps = mine.mine_resourceClumps; world.mine_permanentMineChanges = mine.mine_permanentMineChanges; //} fixPetMultiplication(mine, world); fixRelationships(mine, world); Multiplayer.fixLocations(world.locations, null, debugStuff); Woods woods = null; GameLocation toRemove = null; foreach (GameLocation loc in world.locations) { if (loc.name == "FarmHouse") { toRemove = loc; } else if (loc.name == "Woods") { woods = (Woods)loc; } } if (toRemove != null) { world.locations.Remove(toRemove); } foreach (GameLocation loc in mine.locations) { if (loc.name == "FarmHouse") { world.locations.Add(loc); } else if (loc.name == "Woods" && woods != null) { Woods myWoods = ( Woods )loc; woods.hasUnlockedStatue = myWoods.hasUnlockedStatue; woods.hasFoundStardrop = myWoods.hasFoundStardrop; } } // See the giant block of comments in ClientFarmerDataPacket foreach (GameLocation theirLoc in world.locations) { if (theirLoc is FarmHouse) { Log.Async("FarmHouse: " + theirLoc.name); NewSaveGame.FarmHouse_setMapForUpgradeLevel(theirLoc as FarmHouse); } } /* * findReplaceLocation("FarmHouse", world.locations, mine.locations); * if ( !Multiplayer.COOP ) * { * findReplaceLocation("Farm", world.locations, mine.locations); * findReplaceLocation("FarmCave", world.locations, mine.locations); * findReplaceLocation("Greenhouse", world.locations, mine.locations); * findReplaceLocation("ArchaeologyHouse", world.locations, mine.locations); * findReplaceLocation("CommunityCenter", world.locations, mine.locations); * // ^ How should I do rewards? The ones that affect town permanently * // Mines? * }*/ SaveGame.loaded = world; client.stage = Client.NetStage.Waiting; //client.tempStopUpdating = true; }
private static void OpenPassageInSecretWoods(Woods woods) { // Game isn't running if (!ModEntry.IsDeepWoodsGameRunning) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, mod not initialized.", LogLevel.Trace); return; } // If warps exist, the map might be patched already, but we can't be 100% sure // So we just use this as an indicator not to print any warnings about stuff already being patched we might encounter further down. var existingWarpLocations = woods.warps.Where(warp => "DeepWoods".Equals(warp.TargetName)).Select(warp => new SimpleCoord(warp.X, warp.Y)); bool possiblyPatchedAlready = existingWarpLocations.Any(); Layer buildingsLayer = woods.map.GetLayer("Buildings"); // Just to be sure if (buildingsLayer == null) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, invalid map (buildingsLayer is null).", LogLevel.Trace); return; } ModEntry.Log("OpenPassageInSecretWoods:", LogLevel.Trace); TileSheet borderTileSheet = woods.map.TileSheets.First(); int borderTileIndex = 0; int removed = 0; int added = 0; int warpsAdded = 0; foreach (var location in Settings.WoodsPassage.DeleteBuildingTiles) { if (buildingsLayer.Tiles[location.X, location.Y] == null) { if (!possiblyPatchedAlready) { ModEntry.Log($" Can't remove tile from building layer at {location.X}, {location.Y}, there is no tile here! (Custom Woods map? Please modify WoodsPassage settings in the DeepWoods config file for custom Woods maps.)", LogLevel.Trace); } } else { ModEntry.Log($" Removing tile from building layer at {location.X}, {location.Y}.", LogLevel.Trace); buildingsLayer.Tiles[location.X, location.Y] = null; removed++; } } foreach (var location in Settings.WoodsPassage.AddBuildingTiles) { if (buildingsLayer.Tiles[location.X, location.Y] == null) { ModEntry.Log($" Adding tile to building layer at {location.X}, {location.Y}.", LogLevel.Trace); buildingsLayer.Tiles[location.X, location.Y] = new StaticTile(buildingsLayer, borderTileSheet, BlendMode.Alpha, borderTileIndex); added++; } else { if (!possiblyPatchedAlready) { ModEntry.Log($" Can't add tile to building layer at {location.X}, {location.Y}, already have a tile there! (Custom Woods map? Please modify WoodsPassage settings in the DeepWoods config file for custom Woods maps.)", LogLevel.Trace); } } } foreach (var location in Settings.WoodsPassage.WarpLocations) { if (!existingWarpLocations.Contains(location)) { ModEntry.Log($" Adding warp to DeepWoods at {location.X}, {location.Y}.", LogLevel.Trace); woods.warps.Add(new Warp(location.X, location.Y, "DeepWoods", Settings.Map.RootLevelEnterLocation.X, Settings.Map.RootLevelEnterLocation.Y + 1, false)); warpsAdded++; } } if (possiblyPatchedAlready && added == 0 && removed == 0 && warpsAdded == 0) { ModEntry.Log($"OpenPassageInSecretWoods skipped. Map was already patched.", LogLevel.Trace); } else { ModEntry.Log($"OpenPassageInSecretWoods done. (Added {added}/{Settings.WoodsPassage.AddBuildingTiles.Length} tiles, removed {removed}/{Settings.WoodsPassage.DeleteBuildingTiles.Length} tiles, added {warpsAdded}/{Settings.WoodsPassage.WarpLocations.Length} warps.)", LogLevel.Trace); } }
public static GameLocation duplicateAndGenerate(GameLocation location) { bool flag = location.map == null; GameLocation result; if (flag) { bool flag2 = location is MineShaft; if (flag2) { result = new MineShaft((location as MineShaft).mineLevel); } else { result = null; } } else { bool flag3 = location.Name == null; if (flag3) { result = null; } else { bool flag4 = location is MineShaft; if (flag4) { result = new MineShaft((location as MineShaft).mineLevel); } else { bool flag5 = location is Town; if (flag5) { result = new Town(location.mapPath.Value, location.Name); } else { bool flag6 = location is Farm; if (flag6) { result = new Farm(location.mapPath.Value, location.Name); } else { bool flag7 = location is Woods; if (flag7) { Woods woods = new Woods(location.mapPath.Value, location.Name); woods.DayUpdate(Game1.dayOfMonth); result = woods; } else { bool flag8 = location is Forest; if (flag8) { result = new Forest(location.mapPath.Value, location.Name); } else { result = new GameLocation(location.mapPath.Value, location.Name); } } } } } } } return(result); }
public static void clear(GameLocation location, Type[] types = null, int[] parentSheetIndices = null) { List <Vector2> list = new List <Vector2>(); List <Vector2> list2 = new List <Vector2>(); List <LargeTerrainFeature> list3 = new List <LargeTerrainFeature>(); foreach (Vector2 vector in location.terrainFeatures.Keys) { TerrainFeature terrainFeature = location.terrainFeatures[vector]; bool flag = Generator.GeneratorOptions.ContainsKey("Crop") && Generator.GeneratorOptions["Crop"] && terrainFeature is HoeDirt; if (flag) { (terrainFeature as HoeDirt).crop = null; } bool flag2 = types == null || types.Contains(terrainFeature.GetType()) || types.Contains(typeof(TerrainFeature)); if (flag2) { list.Add(vector); } } foreach (Vector2 vector2 in location.Objects.Keys) { SObject @object = location.objects[vector2]; bool flag3 = types == null || types.Contains(@object.GetType()) || (parentSheetIndices != null && parentSheetIndices.Contains(@object.ParentSheetIndex)) || types.Contains(typeof(SObject)) || (Generator.GeneratorOptions.ContainsKey("Forage") && Generator.GeneratorOptions["Forage"] && @object.isForage(location)); if (flag3) { list2.Add(vector2); } } foreach (LargeTerrainFeature largeTerrainFeature in location.largeTerrainFeatures) { bool flag4 = types == null || types.Contains(largeTerrainFeature.GetType()); if (flag4) { list3.Add(largeTerrainFeature); } } bool flag5 = location is Farm; if (flag5) { Farm farm = location as Farm; List <ResourceClump> list4 = new List <ResourceClump>(); foreach (ResourceClump resourceClump in farm.resourceClumps) { bool flag6 = types == null || types.Contains(resourceClump.GetType()) || (parentSheetIndices != null && parentSheetIndices.Contains(resourceClump.parentSheetIndex.Value)); if (flag6) { list4.Add(resourceClump); } } foreach (ResourceClump resourceClump2 in list4) { bool flag7 = farm.resourceClumps.Contains(resourceClump2); if (flag7) { farm.resourceClumps.Remove(resourceClump2); } } } bool flag8 = location is Woods; if (flag8) { Woods woods = location as Woods; List <ResourceClump> list5 = new List <ResourceClump>(); foreach (ResourceClump resourceClump3 in woods.stumps) { bool flag9 = types == null || types.Contains(resourceClump3.GetType()) || (parentSheetIndices != null && parentSheetIndices.Contains(resourceClump3.parentSheetIndex.Value)); if (flag9) { list5.Add(resourceClump3); } } foreach (ResourceClump resourceClump4 in list5) { bool flag10 = woods.stumps.Contains(resourceClump4); if (flag10) { woods.stumps.Remove(resourceClump4); } } } bool flag11 = location is Forest; if (flag11) { Forest forest = location as Forest; bool flag12 = forest.log != null && parentSheetIndices != null && parentSheetIndices.Contains(forest.log.parentSheetIndex.Value); if (flag12) { forest.log = null; } } foreach (Vector2 vector3 in list) { bool flag13 = location.terrainFeatures.ContainsKey(vector3); if (flag13) { location.terrainFeatures.Remove(vector3); } } foreach (Vector2 vector4 in list2) { bool flag14 = location.objects.ContainsKey(vector4); if (flag14) { location.objects.Remove(vector4); } } foreach (LargeTerrainFeature largeTerrainFeature2 in list3) { bool flag15 = location.largeTerrainFeatures.Contains(largeTerrainFeature2); if (flag15) { location.largeTerrainFeatures.Remove(largeTerrainFeature2); } } }
private void OpenPassageInSecretWoods(Woods woods) { // TODO: Configurable (and moddable!) locations to modify Woods // Game isn't running if (!isDeepWoodsGameRunning) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, mod not initialized.", LogLevel.Trace); return; } // Already patched if (woods.warps.Where(warp => "DeepWoods".Equals(warp.TargetName)).Any()) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, map already patched.", LogLevel.Trace); return; } Layer buildingsLayer = woods.map.GetLayer("Buildings"); // Just to be sure if (buildingsLayer == null) { ModEntry.Log("OpenPassageInSecretWoods: Cancelled, invalid map (buildingsLayer is null).", LogLevel.Trace); return; } ModEntry.Log("OpenPassageInSecretWoods:", LogLevel.Trace); TileSheet borderTileSheet = woods.map.TileSheets.First(); int borderTileIndex = 0; int removed = 0; int added = 0; foreach (var location in Settings.WoodsPassage.DeleteBuildingTiles) { if (buildingsLayer.Tiles[location.X, location.Y] == null) { ModEntry.Log($" Can't remove tile from building layer at {location.X}, {location.Y}, there is no tile here! (Custom Woods map? Please modify WoodsPassage settings in the DeepWoods config file for custom Woods maps.)", LogLevel.Trace); } else { ModEntry.Log($" Removing tile from building layer at {location.X}, {location.Y}.", LogLevel.Trace); buildingsLayer.Tiles[location.X, location.Y] = null; removed++; } } foreach (var location in Settings.WoodsPassage.AddBuildingTiles) { if (buildingsLayer.Tiles[location.X, location.Y] == null) { ModEntry.Log($" Adding tile to building layer at {location.X}, {location.Y}.", LogLevel.Trace); buildingsLayer.Tiles[location.X, location.Y] = new StaticTile(buildingsLayer, borderTileSheet, BlendMode.Alpha, borderTileIndex); added++; } else { ModEntry.Log($" Can't add tile to building layer at {location.X}, {location.Y}, already have a tile there! (Custom Woods map? Please modify WoodsPassage settings in the DeepWoods config file for custom Woods maps.)", LogLevel.Trace); } } foreach (var location in Settings.WoodsPassage.WarpLocations) { ModEntry.Log($" Adding warp to DeepWoods at {location.X}, {location.Y}.", LogLevel.Trace); woods.warps.Add(new Warp(location.X, location.Y, "DeepWoods", Settings.Map.RootLevelEnterLocation.X, Settings.Map.RootLevelEnterLocation.Y + 1, false)); } ModEntry.Log($"OpenPassageInSecretWoods done. (Added {added}/{Settings.WoodsPassage.AddBuildingTiles.Length} tiles, removed {removed}/{Settings.WoodsPassage.DeleteBuildingTiles.Length} tiles, added {Settings.WoodsPassage.WarpLocations.Length} warps.)", LogLevel.Trace); }
public IActionResult New_Trail() { Woods newTrail = new Woods(); return(View(newTrail)); }