Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d3e63ccfcf
|
|||
0e4aa1caa5
|
|||
87378aeb00
|
|||
01fb135385
|
|||
28ba14cb94
|
@ -8,9 +8,9 @@ clone:
|
||||
|
||||
pipeline:
|
||||
fetch-deps:
|
||||
image: alpine/git:latest
|
||||
image: jackbondpreston/msvb-build-env
|
||||
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
|
||||
- unzip -q tModLoader.zip -d tModLoader
|
||||
- rm tModLoader.zip
|
||||
@ -19,18 +19,26 @@ pipeline:
|
||||
echo "<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
|
||||
<Import Project=\"$CI_WORKSPACE/tModLoader/tMLMod.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
|
||||
VER=$(ls /root/.steam/steamapps/workshop/content/1281930/2563309347 | cut -c 6- | sort | head -n 1)
|
||||
YEAR=$(ls /root/.steam/steamapps/workshop/content/1281930/2563309347 | cut -c -4 | sort | 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:
|
||||
event: tag
|
||||
|
||||
build:
|
||||
image: jackbondpreston/fna-alpine
|
||||
image: jackbondpreston/msvb-build-env
|
||||
commands:
|
||||
- |
|
||||
echo "Shell: $SHELL"
|
||||
echo "CI_WORKSPACE: $CI_WORKSPACE"
|
||||
- cat tModLoader.targets
|
||||
- cd MagicStorage && dotnet build -c Release || true
|
||||
- cp bin/Release/net6.0/MagicStorage.dll .
|
||||
- cd $CI_WORKSPACE
|
||||
- cd MagicStorageVoidBag
|
||||
- rm -rf .git
|
||||
@ -54,16 +62,3 @@ pipeline:
|
||||
when:
|
||||
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
|
||||
|
@ -33,7 +33,7 @@ namespace MagicStorageVoidBag.Hooks {
|
||||
|
||||
heart.TryDeposit(returnItem);
|
||||
heart.ResetCompactStage();
|
||||
StorageGUI.modSearchBox.OnChanged();
|
||||
StorageGUI.needRefresh = true;
|
||||
|
||||
if (returnItem.stack != newItem.stack) {
|
||||
if (newItem.IsACoin) {
|
||||
|
@ -1,32 +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.IsAir && 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,21 @@
|
||||
using MagicStorage.Items;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.Creative;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
|
||||
namespace MagicStorageVoidBag.Items {
|
||||
[ExtendsFromMod("MagicStorage")]
|
||||
public class MSVoidBag : PortableAccess {
|
||||
[CloneByReference]
|
||||
internal Dictionary<string, Point16> locationsByWorld = new();
|
||||
|
||||
public override void SetStaticDefaults() {
|
||||
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
||||
@ -24,6 +30,9 @@ namespace MagicStorageVoidBag.Items {
|
||||
Item.useAnimation = 28;
|
||||
Item.useTime = 28;
|
||||
Item.value = Item.sellPrice(gold: 10);
|
||||
|
||||
location = Point16.NegativeOne;
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> lines) {
|
||||
@ -43,5 +52,55 @@ namespace MagicStorageVoidBag.Items {
|
||||
recipe.AddIngredient(ItemID.VoidLens);
|
||||
recipe.Register();
|
||||
}
|
||||
|
||||
public override void UpdateInventory(Player player) {
|
||||
if (!locationsByWorld.ContainsKey(Main.worldName) || location != locationsByWorld[Main.worldName]) {
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient) {
|
||||
int p = Array.IndexOf(Main.player, player);
|
||||
int i = Array.IndexOf(player.inventory, Item);
|
||||
if (p >= 0 && i >= 0) {
|
||||
NetMessage.SendData(MessageID.SyncEquipment, -1, -1, null, p, i, player.inventory[i].prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SaveData(TagCompound tag) {
|
||||
tag["X"] = location.X;
|
||||
tag["Y"] = location.Y;
|
||||
|
||||
tag["version"] = SAVE_VERSION;
|
||||
|
||||
tag["locations"] = locationsByWorld
|
||||
.Select(kvp => new TagCompound() {
|
||||
["world"] = kvp.Key,
|
||||
["X"] = kvp.Value.X,
|
||||
["Y"] = kvp.Value.Y
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public override void LoadData(TagCompound tag) {
|
||||
if (tag.GetInt("version") < SAVE_VERSION || tag.GetList<TagCompound>("locations") is not List<TagCompound> locations) {
|
||||
location = new Point16(tag.GetShort("X"), tag.GetShort("Y"));
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
} else {
|
||||
locationsByWorld = locations.ToDictionary(t => t.GetString("world"), t => new Point16(t.GetShort("X"), t.GetShort("Y")));
|
||||
if (locationsByWorld.ContainsKey(Main.worldName)) {
|
||||
location = locationsByWorld[Main.worldName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void NetSend(BinaryWriter writer) {
|
||||
writer.Write(location.X);
|
||||
writer.Write(location.Y);
|
||||
}
|
||||
|
||||
public override void NetReceive(BinaryReader reader) {
|
||||
location = new Point16(reader.ReadInt16(), reader.ReadInt16());
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
LICENSE
Normal file
21
LICENSE
Normal 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.
|
@ -15,7 +15,6 @@ namespace MagicStorageVoidBag {
|
||||
|
||||
On.Terraria.Player.GetItem_VoidVault += GetItemVoidVaultHook.Hook;
|
||||
On.Terraria.Player.ItemSpaceForCofveve += ItemSpaceForCofveveHook.Hook;
|
||||
On.MagicStorage.Components.StorageHeart.RightClick += StorageHeartRightClickHook.Hook;
|
||||
}
|
||||
|
||||
public override void Unload() {
|
||||
@ -23,7 +22,6 @@ namespace MagicStorageVoidBag {
|
||||
|
||||
On.Terraria.Player.GetItem_VoidVault -= GetItemVoidVaultHook.Hook;
|
||||
On.Terraria.Player.ItemSpaceForCofveve -= ItemSpaceForCofveveHook.Hook;
|
||||
On.MagicStorage.Components.StorageHeart.RightClick -= StorageHeartRightClickHook.Hook;
|
||||
|
||||
base.Unload();
|
||||
}
|
||||
|
@ -14,8 +14,5 @@
|
||||
<Reference Include="MagicStorage">
|
||||
<HintPath>..\MagicStorage\MagicStorage.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MagicStorageHooks">
|
||||
<HintPath>lib\MagicStorage_Hooks.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,8 +1,7 @@
|
||||
displayName = MagicStorage Void Bag
|
||||
author = jack
|
||||
version = 1.3
|
||||
version = 1.5
|
||||
modReferences = MagicStorage
|
||||
dllReferences = MagicStorage_Hooks
|
||||
sortAfter = MagicStorage
|
||||
includeSource = true
|
||||
homepage = https://github.com/jackbondpreston/MagicStorageVoidBag
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user