Initial commit
This commit is contained in:
commit
98cb63b6fb
|
@ -0,0 +1,254 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
packages/
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
**/*.vshistory/
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29911.84
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomToolEffect", "CustomToolEffect\CustomToolEffect.csproj", "{62DD1937-1AFD-4EB9-B5E6-F1C0A9860A33}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{62DD1937-1AFD-4EB9-B5E6-F1C0A9860A33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{62DD1937-1AFD-4EB9-B5E6-F1C0A9860A33}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{62DD1937-1AFD-4EB9-B5E6-F1C0A9860A33}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{62DD1937-1AFD-4EB9-B5E6-F1C0A9860A33}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4CC46A6E-AED6-4BEF-AF97-D50E81BE8A37}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" 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>{62DD1937-1AFD-4EB9-B5E6-F1C0A9860A33}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CustomToolEffect</RootNamespace>
|
||||
<AssemblyName>CustomToolEffect</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\libs\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<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="ModConfig.cs" />
|
||||
<Compile Include="ModEntry.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Rewrites\ResourceClumpRewrites.cs" />
|
||||
<Compile Include="Rewrites\PickaxeRewrites.cs" />
|
||||
<Compile Include="Rewrites\FruitTreeRewrites.cs" />
|
||||
<Compile Include="Rewrites\TreeRewrites.cs" />
|
||||
<Compile Include="Rewrites\ToolRewrites.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0-beta.7" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,68 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CustomToolEffect
|
||||
{
|
||||
public class ModConfig
|
||||
{
|
||||
public Dictionary<int, PowerDefine> AxeDefine { get; set; } = new Dictionary<int, PowerDefine> {
|
||||
{0, new PowerDefine(1.4f) },
|
||||
{1, new PowerDefine(1.4f) },
|
||||
{2, new PowerDefine(1.4f) },
|
||||
{3, new PowerDefine(1.4f) },
|
||||
{4, new PowerDefine(1.4f) }
|
||||
};
|
||||
public Dictionary<int, PowerDefine> PickaxeDefine { get; set; } = new Dictionary<int, PowerDefine>
|
||||
{
|
||||
{0, new PowerDefine(1.4f) },
|
||||
{1, new PowerDefine(1.4f) },
|
||||
{2, new PowerDefine(1.4f) },
|
||||
{3, new PowerDefine(1.4f) },
|
||||
{4, new PowerDefine(1.8f) }
|
||||
};
|
||||
public Dictionary<int, RangeDefine> HoeDefine { get; set; } = new Dictionary<int, RangeDefine>
|
||||
{
|
||||
{0, new RangeDefine(new Range(1, 1)) },
|
||||
{1, new RangeDefine(new Range(1, 3)) },
|
||||
{2, new RangeDefine(new Range(1, 5)) },
|
||||
{3, new RangeDefine(new Range(3, 3)) },
|
||||
{4, new RangeDefine(new Range(5, 5)) }
|
||||
};
|
||||
public Dictionary<int, RangeDefine> WateringCanDefine { get; set; } = new Dictionary<int, RangeDefine>
|
||||
{
|
||||
{0, new RangeDefine(new Range(1, 1)) },
|
||||
{1, new RangeDefine(new Range(1, 3)) },
|
||||
{2, new RangeDefine(new Range(1, 5)) },
|
||||
{3, new RangeDefine(new Range(3, 3)) },
|
||||
{4, new RangeDefine(new Range(5, 5)) }
|
||||
};
|
||||
public class PowerDefine
|
||||
{
|
||||
public PowerDefine(float power)
|
||||
{
|
||||
Power = power;
|
||||
}
|
||||
public float Power { get; set; }
|
||||
}
|
||||
|
||||
public class RangeDefine
|
||||
{
|
||||
public RangeDefine(Range range)
|
||||
{
|
||||
Range = range;
|
||||
}
|
||||
public Range Range { get; set; }
|
||||
}
|
||||
public class Range
|
||||
{
|
||||
public Range(int width, int length)
|
||||
{
|
||||
Width = width;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
public int Length { get; set; }
|
||||
public int Width { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using Harmony;
|
||||
using StardewModdingAPI;
|
||||
using StardewModdingAPI.Mods.CustomLocalization.Rewrites;
|
||||
using StardewValley;
|
||||
using StardewValley.TerrainFeatures;
|
||||
using StardewValley.Tools;
|
||||
|
||||
namespace CustomToolEffect
|
||||
{
|
||||
public class ModEntry : Mod
|
||||
{
|
||||
public static ModConfig ModConfig;
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModConfig = helper.ReadConfig<ModConfig>();
|
||||
helper.WriteConfig(ModConfig);
|
||||
HarmonyInstance harmony = HarmonyInstance.Create("zaneyork.CustomToolEffect");
|
||||
harmony.Patch(
|
||||
original: AccessTools.DeclaredMethod(typeof(Tree), "performToolAction"),
|
||||
prefix: new HarmonyMethod(typeof(TreeRewrites.PerformToolActionRewrite), nameof(TreeRewrites.PerformToolActionRewrite.Prefix))
|
||||
);
|
||||
harmony.Patch(
|
||||
original: AccessTools.DeclaredMethod(typeof(FruitTree), "performToolAction"),
|
||||
prefix: new HarmonyMethod(typeof(FruitTreeRewrites.PerformToolActionRewrite), nameof(FruitTreeRewrites.PerformToolActionRewrite.Prefix))
|
||||
);
|
||||
harmony.Patch(
|
||||
original: AccessTools.DeclaredMethod(typeof(ResourceClump), "performToolAction"),
|
||||
prefix: new HarmonyMethod(typeof(ResourceClumpRewrites.PerformToolActionRewrite), nameof(ResourceClumpRewrites.PerformToolActionRewrite.Prefix))
|
||||
);
|
||||
harmony.Patch(
|
||||
original: AccessTools.DeclaredMethod(typeof(Pickaxe), "DoFunction"),
|
||||
prefix: new HarmonyMethod(typeof(PickaxeRewrites.DoFunctionRewrite), nameof(PickaxeRewrites.DoFunctionRewrite.Prefix))
|
||||
);
|
||||
harmony.Patch(
|
||||
original: AccessTools.DeclaredMethod(typeof(Tool), "tilesAffected"),
|
||||
prefix: new HarmonyMethod(typeof(ToolRewrites.TilesAffectedRewrite), nameof(ToolRewrites.TilesAffectedRewrite.Prefix))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
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("CustomToolEffect")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CustomToolEffect")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("bb1441d3-a7e3-48e3-9c86-34798cd71313")]
|
||||
|
||||
// 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.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
|
@ -0,0 +1,51 @@
|
|||
using CustomToolEffect;
|
||||
using Harmony;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.TerrainFeatures;
|
||||
using StardewValley.Tools;
|
||||
|
||||
namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites
|
||||
{
|
||||
public class TreeRewrites
|
||||
{
|
||||
public class PerformToolActionRewrite
|
||||
{
|
||||
public static bool Prefix(Tree __instance, Tool t, int explosion, Vector2 tileLocation)
|
||||
{
|
||||
if (t == null || !(t is Axe) || explosion > 0)
|
||||
return true;
|
||||
float num;
|
||||
switch (t.UpgradeLevel)
|
||||
{
|
||||
case 0:
|
||||
num = 1f;
|
||||
break;
|
||||
case 1:
|
||||
num = 1.25f;
|
||||
break;
|
||||
case 2:
|
||||
num = 1.67f;
|
||||
break;
|
||||
case 3:
|
||||
num = 2.5f;
|
||||
break;
|
||||
case 4:
|
||||
num = 5f;
|
||||
break;
|
||||
default:
|
||||
num = 5f;
|
||||
break;
|
||||
}
|
||||
if (__instance.growthStage.Value >= 3) {
|
||||
num *= 2;
|
||||
}
|
||||
if(ModEntry.ModConfig.AxeDefine.TryGetValue(t.UpgradeLevel, out ModConfig.ToolDefine define))
|
||||
{
|
||||
__instance.health.Value -= num + define.Power;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using CustomToolEffect;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.TerrainFeatures;
|
||||
using StardewValley.Tools;
|
||||
|
||||
namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites
|
||||
{
|
||||
public class FruitTreeRewrites
|
||||
{
|
||||
public class PerformToolActionRewrite
|
||||
{
|
||||
public static void Prefix(FruitTree __instance, Tool t, int explosion, Vector2 tileLocation)
|
||||
{
|
||||
if (t == null || !(t is Axe) || explosion > 0)
|
||||
return;
|
||||
float num;
|
||||
switch (t.UpgradeLevel)
|
||||
{
|
||||
case 0:
|
||||
num = 1f;
|
||||
break;
|
||||
case 1:
|
||||
num = 1.25f;
|
||||
break;
|
||||
case 2:
|
||||
num = 1.67f;
|
||||
break;
|
||||
case 3:
|
||||
num = 2.5f;
|
||||
break;
|
||||
case 4:
|
||||
num = 5f;
|
||||
break;
|
||||
default:
|
||||
num = 5f;
|
||||
break;
|
||||
}
|
||||
if (__instance.growthStage.Value >= 3) {
|
||||
num *= 2;
|
||||
}
|
||||
if(ModEntry.ModConfig.AxeDefine.TryGetValue(t.UpgradeLevel, out ModConfig.PowerDefine define))
|
||||
{
|
||||
if (define.Power < 0)
|
||||
{
|
||||
define.Power = 1f;
|
||||
}
|
||||
__instance.health.Value -= num * (define.Power - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using CustomToolEffect;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.Tools;
|
||||
using System;
|
||||
using SObject = StardewValley.Object;
|
||||
|
||||
namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites
|
||||
{
|
||||
public class PickaxeRewrites
|
||||
{
|
||||
public class DoFunctionRewrite
|
||||
{
|
||||
public static void Prefix(Pickaxe __instance, GameLocation location, int x, int y, int power, Farmer who)
|
||||
{
|
||||
if (!ModEntry.ModConfig.PickaxeDefine.TryGetValue(__instance.UpgradeLevel, out ModConfig.PowerDefine define)) {
|
||||
return;
|
||||
}
|
||||
if (location.Objects.TryGetValue(new Vector2(x / 0x40, y / 0x40), out SObject obj))
|
||||
{
|
||||
if (obj.Name == "Stone")
|
||||
{
|
||||
int num = Math.Max(1, __instance.UpgradeLevel + 1);
|
||||
obj.MinutesUntilReady -= (int)(num * (define.Power - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
using CustomToolEffect;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.TerrainFeatures;
|
||||
using StardewValley.Tools;
|
||||
using System;
|
||||
|
||||
namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites
|
||||
{
|
||||
public class ResourceClumpRewrites
|
||||
{
|
||||
public class PerformToolActionRewrite
|
||||
{
|
||||
public static void Prefix(ResourceClump __instance, Tool t, int damage, Vector2 tileLocation, GameLocation location)
|
||||
{
|
||||
if (t == null || !(t is Axe || t is Pickaxe))
|
||||
return;;
|
||||
switch (__instance.parentSheetIndex.Value)
|
||||
{
|
||||
case 0x2f0:
|
||||
case 0x2f2:
|
||||
case 0x2f4:
|
||||
case 0x2f6:
|
||||
if (t is Pickaxe)
|
||||
{
|
||||
break;
|
||||
}
|
||||
return;;
|
||||
|
||||
case 0x2a0:
|
||||
if ((t is Pickaxe) && (t.UpgradeLevel < 2))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
if (!(t is Pickaxe))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x26e:
|
||||
if ((t is Pickaxe) && (t.UpgradeLevel < 3))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
if (!(t is Pickaxe))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
break;
|
||||
|
||||
case 600:
|
||||
if ((t is Axe) && (t.UpgradeLevel < 1))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
if (!(t is Axe))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x25a:
|
||||
if ((t is Axe) && (t.UpgradeLevel < 2))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
if (!(t is Axe))
|
||||
{
|
||||
return;;
|
||||
}
|
||||
break;
|
||||
}
|
||||
float num = Math.Max((float)1f, (float)(((float)(t.UpgradeLevel + 1)) * 0.75f));
|
||||
if(ModEntry.ModConfig.AxeDefine.TryGetValue(t.UpgradeLevel, out ModConfig.PowerDefine define))
|
||||
{
|
||||
if (define.Power < 0)
|
||||
{
|
||||
define.Power = 1f;
|
||||
}
|
||||
__instance.health.Value -= num * (define.Power - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CustomToolEffect;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.Tools;
|
||||
using static CustomToolEffect.ModConfig;
|
||||
|
||||
namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites
|
||||
{
|
||||
public class ToolRewrites
|
||||
{
|
||||
public class TilesAffectedRewrite
|
||||
{
|
||||
public static bool Prefix(Tool __instance, Vector2 tileLocation, int power, Farmer who, ref List<Vector2> __result)
|
||||
{
|
||||
ModConfig.RangeDefine define = null;
|
||||
if (__instance is Hoe)
|
||||
{
|
||||
ModEntry.ModConfig.HoeDefine.TryGetValue(power, out define);
|
||||
}
|
||||
else if (__instance is WateringCan)
|
||||
{
|
||||
ModEntry.ModConfig.WateringCanDefine.TryGetValue(power, out define);
|
||||
}
|
||||
if (define == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Range range = define.Range;
|
||||
__result = new List<Vector2> {
|
||||
tileLocation
|
||||
};
|
||||
Vector2 directionLength, directionWidth;
|
||||
switch (who.FacingDirection)
|
||||
{
|
||||
case 0:
|
||||
directionLength = new Vector2(0f, -1f);
|
||||
directionWidth = new Vector2(1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
directionLength = new Vector2(1f, 0f);
|
||||
directionWidth = new Vector2(0f, 1f);
|
||||
break;
|
||||
case 2:
|
||||
directionLength = new Vector2(0f, 1f);
|
||||
directionWidth = new Vector2(-1f, 0f);
|
||||
break;
|
||||
default:
|
||||
directionLength = new Vector2(-1f, 0f);
|
||||
directionWidth = new Vector2(0f, -1f);
|
||||
break;
|
||||
}
|
||||
int rangeWidthStart = (int)Math.Ceiling(range.Width / -2.0f);
|
||||
int rangeWidthEnd = (int)Math.Ceiling(range.Width / 2.0f);
|
||||
for (int offsetWidth = rangeWidthStart; offsetWidth < rangeWidthEnd; offsetWidth++)
|
||||
{
|
||||
for (int offsetLength = 0; offsetLength < range.Length; offsetLength++)
|
||||
{
|
||||
__result.Add(directionWidth * offsetWidth + directionLength * offsetLength + tileLocation);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using CustomToolEffect;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.TerrainFeatures;
|
||||
using StardewValley.Tools;
|
||||
|
||||
namespace StardewModdingAPI.Mods.CustomLocalization.Rewrites
|
||||
{
|
||||
public class TreeRewrites
|
||||
{
|
||||
public class PerformToolActionRewrite
|
||||
{
|
||||
public static void Prefix(Tree __instance, Tool t, int explosion, Vector2 tileLocation)
|
||||
{
|
||||
if (t == null || !(t is Axe) || explosion > 0)
|
||||
return;
|
||||
float num;
|
||||
switch (t.UpgradeLevel)
|
||||
{
|
||||
case 0:
|
||||
num = 1f;
|
||||
break;
|
||||
case 1:
|
||||
num = 1.25f;
|
||||
break;
|
||||
case 2:
|
||||
num = 1.67f;
|
||||
break;
|
||||
case 3:
|
||||
num = 2.5f;
|
||||
break;
|
||||
case 4:
|
||||
num = 5f;
|
||||
break;
|
||||
default:
|
||||
num = 5f;
|
||||
break;
|
||||
}
|
||||
if (__instance.growthStage.Value >= 3) {
|
||||
num *= 2;
|
||||
}
|
||||
if(ModEntry.ModConfig.AxeDefine.TryGetValue(t.UpgradeLevel, out ModConfig.PowerDefine define))
|
||||
{
|
||||
if(define.Power < 0)
|
||||
{
|
||||
define.Power = 1f;
|
||||
}
|
||||
__instance.health.Value -= num * (define.Power - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Name": "Custom Tool Effect",
|
||||
"Author": "ZaneYork",
|
||||
"Version": "1.0.2",
|
||||
"Description": "Custom tool effect range and power",
|
||||
"UniqueID": "ZaneYork.CustomToolEffect",
|
||||
"EntryDll": "CustomToolEffect.dll",
|
||||
"MinimumApiVersion": "3.0.0",
|
||||
"UpdateKeys": [ "Nexus:5712" ]
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
|
@ -0,0 +1,16 @@
|
|||
# Custom Tool Effect #
|
||||
|
||||
Custom Tool Effect is a Mod for Stardew Valley, it allows you modify Tools effect range and power by edit mod config.
|
||||
|
||||
## Description ##
|
||||
Mod's config file instructions:
|
||||
|
||||
| Config Name | Description |
|
||||
| ------------ | ------------ |
|
||||
| AxeDefine | Define an axe's effect, key-value pair, upgrade level as key |
|
||||
| PickaxeDefine | Define an pickaxe's effect |
|
||||
| HoeDefine | Define an hoe's effect |
|
||||
| WateringCanDefine | Define an watering can's effect |
|
||||
| Power | The power of this tool when break items, 1.3 means modify to 130% of the origin power |
|
||||
| Range.Length | The length of effect range |
|
||||
| Range.Width | The width of effect range |
|
Loading…
Reference in New Issue