9 Commits
v1.2 ... v1.6

10 changed files with 44 additions and 68 deletions

View File

@ -8,9 +8,9 @@ clone:
pipeline: pipeline:
fetch-deps: fetch-deps:
image: alpine/git:latest image: jackbondpreston/msvb-build-env
commands: commands:
- git clone https://github.com/blushiemagic/MagicStorage.git - steamcmd "+login anonymous" "+workshop_download_item 1281930 2563309347" "+quit"
- wget https://github.com/tModLoader/tModLoader/releases/latest/download/tModLoader.zip - wget https://github.com/tModLoader/tModLoader/releases/latest/download/tModLoader.zip
- unzip -q tModLoader.zip -d tModLoader - unzip -q tModLoader.zip -d tModLoader
- rm tModLoader.zip - rm tModLoader.zip
@ -19,18 +19,26 @@ pipeline:
echo "<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"> echo "<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
<Import Project=\"$CI_WORKSPACE/tModLoader/tMLMod.targets\" /> <Import Project=\"$CI_WORKSPACE/tModLoader/tMLMod.targets\" />
</Project>" > tModLoader.targets </Project>" > tModLoader.targets
- |
wget https://github.com/steviegt6/tml-patcher/releases/latest/download/TML.Patcher.zip
unzip -q TML.Patcher.zip -d TMLPatcher
- |
rm -f /root/.steam/steamapps/workshop/content/1281930/2563309347/workshop.json
YEAR=$(ls /root/.steam/steamapps/workshop/content/1281930/2563309347 | cut -c -4 | sort -nr | head -n 1)
VER=$(find /root/.steam/steamapps/workshop/content/1281930/2563309347/ -type d -name "$YEAR.*" -printf "%f\n" | cut -c 6- | sort -nr | head -n 1)
cp /root/.steam/steamapps/workshop/content/1281930/2563309347/$YEAR.$VER/MagicStorage.tmod ./
- dotnet TMLPatcher/TML.Patcher.dll extract MagicStorage.tmod
- cp MagicStorage/MagicStorage.dll $CI_WORKSPACE/
when: when:
event: tag event: tag
build: build:
image: jackbondpreston/fna-alpine image: jackbondpreston/msvb-build-env
commands: commands:
- | - |
echo "Shell: $SHELL" echo "Shell: $SHELL"
echo "CI_WORKSPACE: $CI_WORKSPACE" echo "CI_WORKSPACE: $CI_WORKSPACE"
- cat tModLoader.targets - cat tModLoader.targets
- cd MagicStorage && dotnet build -c Release || true
- cp bin/Release/net6.0/MagicStorage.dll .
- cd $CI_WORKSPACE - cd $CI_WORKSPACE
- cd MagicStorageVoidBag - cd MagicStorageVoidBag
- rm -rf .git - rm -rf .git
@ -54,16 +62,3 @@ pipeline:
when: when:
event: tag event: tag
github-release:
image: plugins/github-release
settings:
api_key:
from_secret: github-api-key
base_url: https://github.com/api/v3/
upload_url: https://github.com/api/uploads
files: release/*
environment:
- DRONE_REPO_OWNER=jackbondpreston
- CI_REPO_OWNER=jackbondpreston
when:
event: tag

View File

@ -21,19 +21,19 @@ namespace MagicStorageVoidBag.Hooks {
var bag = (MSVoidBag)i.ModItem; var bag = (MSVoidBag)i.ModItem;
if (bag.location.X < 0 || bag.location.Y < 0) goto original; if (bag.Location.X < 0 || bag.Location.Y < 0) goto original;
Tile tile = Main.tile[bag.location.X, bag.location.Y]; Tile tile = Main.tile[bag.Location.X, bag.Location.Y];
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original; if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original;
if (!TileEntity.ByPosition.TryGetValue(bag.location, out TileEntity te)) goto original; if (!TileEntity.ByPosition.TryGetValue(bag.Location, out TileEntity te)) goto original;
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original; if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original;
TEStorageHeart heart = (TEStorageHeart)te; TEStorageHeart heart = (TEStorageHeart)te;
heart.TryDeposit(returnItem); heart.TryDeposit(returnItem);
heart.ResetCompactStage(); heart.ResetCompactStage();
StorageGUI.modSearchBox.OnChanged(); StorageGUI.needRefresh = true;
if (returnItem.stack != newItem.stack) { if (returnItem.stack != newItem.stack) {
if (newItem.IsACoin) { if (newItem.IsACoin) {

View File

@ -24,12 +24,12 @@ namespace MagicStorageVoidBag.Hooks {
var bag = (MSVoidBag)i.ModItem; var bag = (MSVoidBag)i.ModItem;
if (bag.location.X < 0 || bag.location.Y < 0) goto original; if (bag.Location.X < 0 || bag.Location.Y < 0) goto original;
Tile tile = Main.tile[bag.location.X, bag.location.Y]; Tile tile = Main.tile[bag.Location.X, bag.Location.Y];
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original; if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original;
if (!TileEntity.ByPosition.TryGetValue(bag.location, out TileEntity te)) goto original; if (!TileEntity.ByPosition.TryGetValue(bag.Location, out TileEntity te)) goto original;
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original; if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original;
if (Utility.HeartHasSpaceFor(newItem, (TEStorageHeart)te)) return true; if (Utility.HeartHasSpaceFor(newItem, (TEStorageHeart)te)) return true;

View File

@ -1,34 +0,0 @@
using MagicStorage.Components;
using MagicStorage.Items;
using Terraria;
using Terraria.DataStructures;
using Terraria.Localization;
namespace MagicStorageVoidBag.Hooks {
internal class StorageHeartRightClickHook {
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
public static bool Hook(On.MagicStorage.Components.StorageHeart.orig_RightClick orig, MagicStorage.Components.StorageHeart heart, int i, int j) {
// https://github.com/blushiemagic/MagicStorage/blob/1.4-stable/Components/StorageHeart.cs#L23
Player player = Main.LocalPlayer;
Item item = player.HeldItem;
if (item.ModItem == null) return false;
if (item.ModItem is Locator locator) {
if (Main.tile[i, j].TileFrameX % 36 == 18) i--;
if (Main.tile[i, j].TileFrameY % 36 == 18) j--;
locator.location = new Point16(i, j);
if (player.selectedItem == 58) {
Main.mouseItem = item.Clone();
}
Main.NewText(Language.GetTextValue("Mods.MagicStorage.LocatorSet", i, j));
return true;
}
return orig(heart, i, j);
}
}
}

View File

@ -27,10 +27,10 @@ namespace MagicStorageVoidBag.Items {
} }
public override void ModifyTooltips(List<TooltipLine> lines) { public override void ModifyTooltips(List<TooltipLine> lines) {
bool isSet = location.X >= 0 && location.Y >= 0; bool isSet = Location.X >= 0 && Location.Y >= 0;
for (int k = 0; k < lines.Count; k++) for (int k = 0; k < lines.Count; k++)
if (isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip1") { if (isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip1") {
lines[k].Text = Language.GetTextValue("Mods.MagicStorage.SetTo", location.X, location.Y); lines[k].Text = Language.GetTextValue("Mods.MagicStorage.SetTo", Location.X, Location.Y);
} else if (!isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip2") { } else if (!isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip2") {
lines.RemoveAt(k); lines.RemoveAt(k);
k--; k--;

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Jack Bond-Preston
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -15,7 +15,6 @@ namespace MagicStorageVoidBag {
On.Terraria.Player.GetItem_VoidVault += GetItemVoidVaultHook.Hook; On.Terraria.Player.GetItem_VoidVault += GetItemVoidVaultHook.Hook;
On.Terraria.Player.ItemSpaceForCofveve += ItemSpaceForCofveveHook.Hook; On.Terraria.Player.ItemSpaceForCofveve += ItemSpaceForCofveveHook.Hook;
On.MagicStorage.Components.StorageHeart.RightClick += StorageHeartRightClickHook.Hook;
} }
public override void Unload() { public override void Unload() {
@ -23,7 +22,6 @@ namespace MagicStorageVoidBag {
On.Terraria.Player.GetItem_VoidVault -= GetItemVoidVaultHook.Hook; On.Terraria.Player.GetItem_VoidVault -= GetItemVoidVaultHook.Hook;
On.Terraria.Player.ItemSpaceForCofveve -= ItemSpaceForCofveveHook.Hook; On.Terraria.Player.ItemSpaceForCofveve -= ItemSpaceForCofveveHook.Hook;
On.MagicStorage.Components.StorageHeart.RightClick -= StorageHeartRightClickHook.Hook;
base.Unload(); base.Unload();
} }

View File

@ -14,8 +14,5 @@
<Reference Include="MagicStorage"> <Reference Include="MagicStorage">
<HintPath>..\MagicStorage\MagicStorage.dll</HintPath> <HintPath>..\MagicStorage\MagicStorage.dll</HintPath>
</Reference> </Reference>
<Reference Include="MagicStorageHooks">
<HintPath>lib\MagicStorage_Hooks.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,8 +1,7 @@
displayName = MagicStorage Void Bag displayName = MagicStorage Void Bag
author = jack author = jack
version = 1.2 version = 1.6
modReferences = MagicStorage modReferences = MagicStorage
dllReferences = MagicStorage_Hooks
sortAfter = MagicStorage sortAfter = MagicStorage
includeSource = true includeSource = true
homepage = https://github.com/jackbondpreston/MagicStorageVoidBag homepage = https://github.com/jackbondpreston/MagicStorageVoidBag

Binary file not shown.