This commit is contained in:
Joshua Navarro 2017-01-30 22:51:50 -08:00
parent 749bfdb24a
commit e0a69e5f7a
14 changed files with 1444 additions and 12 deletions

View File

@ -107,7 +107,7 @@ namespace Revitalize
mouseAction = true;
string s = Game1.player.ActiveObject.getCategoryName();
// Log.AsyncC(s);
if (Dictionaries.interactionTypes.ContainsKey(s))
{
Dictionaries.interactFunction f;
@ -262,6 +262,7 @@ namespace Revitalize
objShopList.Add(new GiftPackage(1120, Vector2.Zero,newInventory));
// my_shop_list.Add((new Decoration(1120, Vector2.Zero)));
objShopList.Add(new ExtraSeeds(1, Vector2.Zero));
Game1.activeClickableMenu = new StardewValley.Menus.ShopMenu(objShopList, 0, null);
if (Game1.player == null) return;

View File

@ -1356,7 +1356,7 @@ public override bool isPlaceable()
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
{
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize, SpriteEffects.None, layerDepth);
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize), (float)(Game1.tileSize)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height)), 1f * this.getScaleSize() * scaleSize *.5f, SpriteEffects.None, layerDepth);
}
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Revitalize.Resources.DataNodes
{
class SeedDataNode
{
public int parentIndex;
public int cropIndex;
public SeedDataNode(int parentInt, int cropInt)
{
parentIndex = parentInt;
cropIndex = cropInt;
}
}
}

View File

@ -19,7 +19,7 @@ namespace Revitalize.Resources
public static Dictionary<string, SerializerDataNode> acceptedTypes;
public static Dictionary<string, interactFunction> interactionTypes;
public static Dictionary<string, QuarryDataNode> quarryList;
public static Dictionary<string, SeedDataNode> seedList;
public static void initializeDictionaries()
@ -27,6 +27,7 @@ namespace Revitalize.Resources
acceptedTypes = new Dictionary<string, SerializerDataNode>();
quarryList = new Dictionary<string, QuarryDataNode>();
interactionTypes = new Dictionary<string, interactFunction>();
seedList = new Dictionary<string, SeedDataNode>();
fillAllDictionaries();
}
@ -35,6 +36,7 @@ namespace Revitalize.Resources
addAllAcceptedTypes();
addAllInteractionTypes();
fillQuaryList();
fillSeedList();
}
@ -46,12 +48,15 @@ namespace Revitalize.Resources
acceptedTypes.Add("Revitalize.Objects.Machines.Quarry", new SerializerDataNode(new ser(Serialize.serializeQuarry), new par(Serialize.parseQuarry)));
acceptedTypes.Add("Revitalize.Objects.Machines.Spawner", new SerializerDataNode(new ser(Serialize.serializeSpawner), new par(Serialize.parseSpawner)));
acceptedTypes.Add("Revitalize.Objects.GiftPackage", new SerializerDataNode(new ser(Serialize.serializeGiftPackage), new par(Serialize.parseGiftPackage)));
acceptedTypes.Add("Revitalize.Objects.ExtraSeeds", new SerializerDataNode(new ser(Serialize.serializeExtraSeeds), new par(Serialize.parseExtraSeeds)));
}
public static void addAllInteractionTypes()
{
interactionTypes.Add("Seed", Util.plantCropHere);
interactionTypes.Add("Seed", Util.plantCropHere); //for generic stardew seeds
interactionTypes.Add("Seeds", Util.plantExtraCropHere); //for modded stardew seeds
interactionTypes.Add("Gift Package", Util.getGiftPackageContents);
}
@ -68,7 +73,13 @@ namespace Revitalize.Resources
}
public static void fillSeedList()
{
//crop row number is actually counts row 0 on upper left and row right on upper right.
//parentsheetindex,actualCropNumber
seedList.Add("Pink Turnip Seeds", new SeedDataNode(1,1)); //new potato seeds. Need to make actual thing.
}
}

View File

@ -55,6 +55,7 @@
<Compile Include="Menus\GameMenu.cs" />
<Compile Include="Menus\InventoryPage.cs" />
<Compile Include="Objects\Decoration.cs" />
<Compile Include="Objects\ExtraSeeds.cs" />
<Compile Include="Objects\GiftPackage.cs" />
<Compile Include="Objects\Light.cs" />
<Compile Include="Objects\Machines\Machine.cs" />
@ -63,6 +64,7 @@
<Compile Include="Menus\LightCustomizer.cs" />
<Compile Include="Objects\shopObject.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\DataNodes\SeedDataNode.cs" />
<Compile Include="Resources\DataNodes\SerializerDataNode.cs" />
<Compile Include="Resources\DataNodes\TrackedTerrainDataNode.cs" />
<Compile Include="Resources\DataNodes\TrackedTerrainDummyDataNode.cs" />
@ -73,6 +75,9 @@
<Compile Include="Serialize.cs" />
<Compile Include="Util.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="TerrainFeatures\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.1.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.1.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -36,7 +36,7 @@ namespace Revitalize
InvPath = Path.Combine(PlayerDataPath, "Inventory");
Log.AsyncC(TrackedTerrainDataPath);
// Log.AsyncC(TrackedTerrainDataPath);
if (!Directory.Exists(DataDirectoryPath))
{
@ -131,7 +131,7 @@ namespace Revitalize
string[] ehh = File.ReadAllLines(path);
string data = ehh[0];
Log.AsyncC(data);
// Log.AsyncC(data);
dynamic obj = JObject.Parse(data);
@ -330,7 +330,7 @@ namespace Revitalize
}
catch(Exception e)
{
Log.AsyncM(e);
// Log.AsyncM(e);
return null;
}
@ -426,7 +426,7 @@ namespace Revitalize
}
catch (Exception e)
{
Log.AsyncM(e);
// Log.AsyncM(e);
return null;
}
@ -522,7 +522,7 @@ namespace Revitalize
}
catch (Exception e)
{
Log.AsyncM(e);
// Log.AsyncM(e);
return null;
}
@ -535,6 +535,101 @@ namespace Revitalize
Serialize.WriteToJsonFile(Path.Combine(InvPath, d.Name + ".json"), (GiftPackage)d);
}
public static ExtraSeeds parseExtraSeeds(string data)
{
dynamic obj = JObject.Parse(data);
// Log.AsyncC(obj.thisType);
ExtraSeeds d = new ExtraSeeds(false);
d.price = obj.price;
d.Decoration_type = obj.Decoration_type;
d.rotations = obj.rotations;
d.currentRotation = obj.currentRotation;
string s1 = Convert.ToString(obj.sourceRect);
d.sourceRect = Util.parseRectFromJson(s1);
string s2 = Convert.ToString(obj.defaultSourceRect);
d.defaultSourceRect = Util.parseRectFromJson(s2);
string s3 = Convert.ToString(obj.defaultBoundingBox);
d.defaultBoundingBox = Util.parseRectFromJson(s3);
d.description = obj.description;
d.flipped = obj.flipped;
d.flaggedForPickUp = obj.flaggedForPickUp;
d.tileLocation = obj.tileLocation;
d.parentSheetIndex = obj.parentSheetIndex;
d.owner = obj.owner;
d.name = obj.name;
d.type = obj.type;
d.canBeSetDown = obj.canBeSetDown;
d.canBeGrabbed = obj.canBeGrabbed;
d.isHoedirt = obj.isHoedirt;
d.isSpawnedObject = obj.isSpawnedObject;
d.questItem = obj.questItem;
d.isOn = obj.isOn;
d.fragility = obj.fragility;
d.edibility = obj.edibility;
d.stack = obj.stack;
d.quality = obj.quality;
d.bigCraftable = obj.bigCraftable;
d.setOutdoors = obj.setOutdoors;
d.setIndoors = obj.setIndoors;
d.readyForHarvest = obj.readyForHarvest;
d.showNextIndex = obj.showNextIndex;
d.hasBeenPickedUpByFarmer = obj.hasBeenPickedUpByFarmer;
d.isRecipe = obj.isRecipe;
d.isLamp = obj.isLamp;
d.heldObject = obj.heldObject;
d.minutesUntilReady = obj.minutesUntilReady;
string s4 = Convert.ToString(obj.boundingBox);
d.boundingBox = Util.parseRectFromJson(s4);
d.scale = obj.scale;
d.lightSource = obj.lightSource;
d.shakeTimer = obj.shakeTimer;
d.internalSound = obj.internalSound;
d.specialVariable = obj.specialVariable;
d.category = obj.category;
d.specialItem = obj.specialItem;
d.hasBeenInInventory = obj.hasBeenInInventory;
string t = obj.texturePath;
d.TextureSheet = Game1.content.Load<Texture2D>(t);
d.texturePath = t;
JArray array = obj.inventory;
d.inventory = array.ToObject<List<Item>>();
d.inventoryMaxSize = obj.inventoryMaxSize;
d.itemReadyForHarvest = obj.itemReadyForHarvest;
d.lightsOn = obj.lightsOn;
d.thisLocation = obj.thisLocation;
d.lightColor = obj.lightColor;
d.thisType = obj.thisType;
d.removable = obj.removable;
try
{
return d;
}
catch (Exception e)
{
// Log.AsyncM(e);
return null;
}
}
public static void serializeExtraSeeds(Item d)
{
Serialize.WriteToJsonFile(Path.Combine(InvPath, d.Name + ".json"), (ExtraSeeds)d);
}
public static Light parseLight(string data)
@ -714,7 +809,7 @@ namespace Revitalize
}
catch (Exception e)
{
Log.AsyncM(e);
// Log.AsyncM(e);
return null;
}
@ -810,7 +905,7 @@ namespace Revitalize
}
catch (Exception e)
{
Log.AsyncM(e);
//Log.AsyncM(e);
return null;
}
@ -838,7 +933,7 @@ namespace Revitalize
if (t == null)
{
Log.AsyncC("BOOOOO");
// Log.AsyncC("BOOOOO");
}
Lists.trackedTerrainFeatures.Add(new TrackedTerrainDataNode(location, (HoeDirt)t, position));

View File

@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Revitalize.Objects;
using Revitalize.Resources;
using Revitalize.Resources.DataNodes;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
@ -690,6 +691,30 @@ namespace Revitalize
}
}
public static void plantExtraCropHere()
{
//Log.AsyncC("HELLO");
HoeDirt t;
TerrainFeature r;
bool plant = Game1.player.currentLocation.terrainFeatures.TryGetValue(Game1.currentCursorTile, out r);
t = (r as HoeDirt);
if (t is HoeDirt)
{
if ((t as HoeDirt).crop == null)
{
// Log.AsyncG("BOOP");
SeedDataNode f;
bool g =Dictionaries.seedList.TryGetValue(((ExtraSeeds)Game1.player.ActiveObject).name, out f);
(t as HoeDirt).crop = new Crop(f.cropIndex, (int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y);
Game1.player.reduceActiveItemByOne();
Game1.playSound("dirtyHit");
Revitalize.Resources.Lists.trackedTerrainFeatures.Add(new Resources.DataNodes.TrackedTerrainDataNode(Game1.player.currentLocation, t, new Vector2((int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y)));
}
}
}
/// <summary>
/// Static wrapper;
/// </summary>

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 14 for Windows Desktop
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zip27Zip", "Zip27Zip\Zip27Zip.csproj", "{84B87D16-1B5B-41C7-BE30-168AA1F182A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{84B87D16-1B5B-41C7-BE30-168AA1F182A7}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{84B87D16-1B5B-41C7-BE30-168AA1F182A7}.Debug|Any CPU.Build.0 = Release|Any CPU
{84B87D16-1B5B-41C7-BE30-168AA1F182A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84B87D16-1B5B-41C7-BE30-168AA1F182A7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1 @@
Hello!

View File

@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;
class Program
{
static void Main()
{
string sourceName;
string targetName;
/*
// 1
// Initialize process information.
//
ProcessStartInfo p = new ProcessStartInfo();
p.FileName = "7za.exe";
// 2
// Use 7-zip
// specify a=archive and -tgzip=gzip
// and then target file in quotes followed by source file in quotes
//
p.Arguments = "a \"" + targetName + "\" \"" +
sourceName + "\" ";
p.WindowStyle = ProcessWindowStyle.Maximized;
// 3.
// Start process and wait for it to exit
//
Process x = Process.Start(p);
x.WaitForExit();
ProcessStartInfo P = new ProcessStartInfo();
P.FileName = "7za.exe";
P.Arguments = "e Example.7z -oc:\\Users\\owner\\Downloads -y";
P.WindowStyle = ProcessWindowStyle.Maximized;
Process X = Process.Start(P);
X.WaitForExit();
*/
string[] fileContents = File.ReadAllLines("SearchDirectories.txt");
List<string> directoryList = new List<string>();
List<string> allZipFiles = new List<string>();
foreach(var v in fileContents)
{
directoryList.Add(v);
}
foreach (var v in directoryList)
{
Console.WriteLine("Searching " + v + " for .zip files");
string Path = v;
string[] zipsInDirectory = Directory.GetFiles(Path, "*.zip", SearchOption.AllDirectories);
int count2 = zipsInDirectory.Length;
int count3 = 1;
foreach(var q in zipsInDirectory)
{
Console.WriteLine("Adding in zip number " + count3 + " of " + count2 + " to the archival list.");
Console.WriteLine("Adding in zip " + q + " to the archival list.");
allZipFiles.Add(q);
count3++;
}
}
int maxCount = allZipFiles.Count;
int count = 1;
List<string> removalList = new List<string>();
foreach(var v in allZipFiles)
{
Console.WriteLine("Compressing File "+ count +" of "+ maxCount);
// Console.WriteLine(v.ToString());
// FileInfo fInfo = new FileInfo(v);
// Console.WriteLine( fInfo.FullName);
/*
string s = v.Remove(v.Length - 4, 4);
Console.WriteLine("Compressing " +s);
sourceName = v.ToString();
targetName = s + ".7z";
ProcessStartInfo process = new ProcessStartInfo();
process.FileName = "7za.exe";
process.Arguments = "a \"" + targetName + "\" \"" +
sourceName + "\" -y";
process.WindowStyle = ProcessWindowStyle.Minimized;
Process processRun = Process.Start(process);
count++;
processRun.WaitForExit();
Console.WriteLine("Sucessfully compressed "+ s +" to .7zip format.");
*/
removalList.Add(v);
}
System.Threading.Thread.Sleep(1000);
foreach (var v in removalList)
{
Console.WriteLine("Deleting " + v);
File.Delete(v);
}
System.Threading.Thread.Sleep(1000);
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Zip27Zip")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zip27Zip")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("84b87d16-1b5b-41c7-be30-168aa1f182a7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{84B87D16-1B5B-41C7-BE30-168AA1F182A7}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Zip27Zip</RootNamespace>
<AssemblyName>Zip27Zip</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="7za.exe" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>