Skip to content

Commit

Permalink
Merge pull request #77 from Vapok/vapok/r1.6.9
Browse files Browse the repository at this point in the history
Release 1.6.9
  • Loading branch information
Vapok authored Feb 28, 2023
2 parents 647d7f8 + 90de14b commit f737cc1
Show file tree
Hide file tree
Showing 21 changed files with 162 additions and 4 deletions.
1 change: 1 addition & 0 deletions AdventureBackpacks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Translations", "Translation
Translations\AdventureBackpacks.Japanese.json = Translations\AdventureBackpacks.Japanese.json
Translations\AdventureBackpacks.Portuguese_Brazilian.json = Translations\AdventureBackpacks.Portuguese_Brazilian.json
Translations\AdventureBackpacks.Chinese_Trad.json = Translations\AdventureBackpacks.Chinese_Trad.json
Translations\AdventureBackpacks.Chinese.json = Translations\AdventureBackpacks.Chinese.json
EndProjectSection
EndProject
Global
Expand Down
2 changes: 1 addition & 1 deletion AdventureBackpacks/AdventureBackpacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class AdventureBackpacks : BaseUnityPlugin, IPluginInfo
//Module Constants
private const string _pluginId = "vapok.mods.adventurebackpacks";
private const string _displayName = "Adventure Backpacks";
private const string _version = "1.6.8";
private const string _version = "1.6.9";

//Interface Properties
public string PluginId => _pluginId;
Expand Down
74 changes: 74 additions & 0 deletions AdventureBackpacks/Extensions/InventoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,78 @@ public static bool IsBackPackInventory(this Inventory inventory)
{
return inventory.m_name.Contains("$vapok_mod_level");
}

public static bool ContainsBackpack(this Inventory inventory, ItemDrop.ItemData backpackItem)
{
//This is a special contains method to prevent other extended inventory mods from checking other inventories
//by prefixing Inventory.Contains() method.

bool IsBackpackItemAt(int x, int y)
{
if (x < 0)
{
x = inventory.m_width - 1;
y--;
}

if (y < 0)
return false;

var itemAt = inventory.GetItemAt(x, y);

if (itemAt != null && itemAt == backpackItem)
return true;

return IsBackpackItemAt(x-1, y);
}

return IsBackpackItemAt(inventory.m_width - 1, inventory.m_height - 1);
}
public static bool HasEmptySlot(this Inventory inventory)
{
bool IsBackpackItemAt(int x, int y)
{
if (x < 0)
{
x = inventory.m_width - 1;
y--;
}

if (y < 0)
return false;

var itemAt = inventory.GetItemAt(x, y);

if (itemAt == null)
return true;

return IsBackpackItemAt(x-1, y);
}

return IsBackpackItemAt(inventory.m_width - 1, inventory.m_height - 1);
}
public static ItemDrop.ItemData FindNonBackpackItem(this Inventory inventory)
{

ItemDrop.ItemData GetNonBackpackItem(int x, int y)
{
if (x < 0)
{
x = inventory.m_width - 1;
y--;
}

if (y < 0)
return null;

var itemAt = inventory.GetItemAt(x, y);

if (itemAt != null && itemAt.IsBackpack())
itemAt = GetNonBackpackItem(x-1, y);

return itemAt;
}

return GetNonBackpackItem(inventory.m_width - 1, inventory.m_height - 1);
}
}
20 changes: 20 additions & 0 deletions AdventureBackpacks/Extensions/PlayerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ public static void QuickDropBackpack(this Player player)
if (backpack == null)
return;

ItemDrop.ItemData tempItemRemoval = null;
var swapItemActivated = false;
var playerInventory = player.GetInventory();

if (!playerInventory.ContainsBackpack(backpack.Item) && !playerInventory.HasEmptySlot())
{
tempItemRemoval = playerInventory.FindNonBackpackItem();

if (tempItemRemoval != null && playerInventory.RemoveItem(tempItemRemoval))
swapItemActivated = true;
else
{
player.Message(MessageHud.MessageType.Center, "$vapok_mod_quick_drop_unavailable");
return;
}
}

AdventureBackpacks.QuickDropping = true;
AdventureBackpacks.Log.Message("Quick dropping backpack.");
// Unequip and remove backpack from player's back
Expand All @@ -83,6 +100,9 @@ public static void QuickDropBackpack(this Player player)
var itemDrop = ItemDrop.DropItem(backpack.Item, 1, player.transform.position - player.transform.up - player.transform.up, player.transform.rotation);
itemDrop.Save();

if (swapItemActivated)
playerInventory.AddItem(tempItemRemoval);

InventoryGuiPatches.BackpackIsOpen = false;
AdventureBackpacks.QuickDropping = false;
}
Expand Down
4 changes: 2 additions & 2 deletions AdventureBackpacks/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// 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.6.8.0")]
[assembly: AssemblyFileVersion("1.6.8.0")]
[assembly: AssemblyVersion("1.6.9.0")]
[assembly: AssemblyFileVersion("1.6.9.0")]
1 change: 1 addition & 0 deletions AdventureBackpacks/Translations/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "You dropped a backpack!",
"vapok_mod_level": "Level",
"vapok_mod_effect": "Effect",
"vapok_mod_quick_drop_unavailable": "Quick Drop Unavailable.",

"vapok_mod_se_cold_immunity": "Cold Immunity",
"vapok_mod_se_frost_resistance": "Frost Resistance",
Expand Down
6 changes: 6 additions & 0 deletions PATCHNOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Adventure Backpacks Patchnotes

# 1.6.9.0 - Bugfixes and Chinese Translation
* Onward Mode/Quick Drop Bug
* Fixed an issue with quick drop mod when bag inventory is full, while using Extended Inventory mods
* Added Chinese Simplified Translations
* Thanks to DuDaowl for dropping me a line on Discord!

# 1.6.8.0 - Adjusting Container.TakeAll and Adding Chinese Traditional Translation
* When running some Extended Inventory Mod's, interacting with the Tombstone causes odd behavior.
* Fixed: Items dupe and "teleport" to other players.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ learn how to make your very own, Adventure Backpacks! Go forth and wander, ye w

## Currently Available Translations
* Czech / čeština
* Chinese / 简体中文
* Chinese Traditional / 繁體中文
* English
* French / Français
* German / Deutsch
Expand Down
43 changes: 43 additions & 0 deletions Translations/AdventureBackpacks.Chinese.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"vapok_mod_item_backpack_meadows": "小肩包",
"vapok_mod_item_backpack_meadows_description": "比较初始的背包,只能装少量物品,适合在青青草原使用",

"vapok_mod_item_backpack_blackforest": "耐用背包",
"vapok_mod_item_backpack_blackforest_description": "有搭扣的皮革背包,适合在黑暗林山使用",

"vapok_mod_item_backpack_swamp": "密封背包",
"vapok_mod_item_backpack_swamp_description": "用防水血袋封住的背包,适合在泥泞沼泽使用",

"vapok_mod_item_backpack_mountains": "山地背包",
"vapok_mod_item_backpack_mountains_description": "带有一块帘布的防寒背包,适合在凛冽雪山使用",

"vapok_mod_item_backpack_plains": "牛牛背包",
"vapok_mod_item_backpack_plains_description": "用牦牛皮缝制的坚固背包,适合在北境平原使用",

"vapok_mod_item_backpack_mistlands": "探险背包",
"vapok_mod_item_backpack_mistlands_description": "一款制作精良的神秘背包,它能够带你从高处缓降,适合在迷雾之地使用",

"vapok_mod_item_rugged_backpack": "小赤佬背包(弃用)",
"vapok_mod_item_rugged_backpack_description": "一个小赤佬背包,适合你装额外的东西,减轻你的负重",

"vapok_mod_item_arctic_backpack": "老毕登背包(弃用)",
"vapok_mod_item_arctic_backpack_description": "一个老毕登背包,和小赤佬背包一样的效果,但更加适合长途跋涉",

"vapok_mod_no_inception1": "别惹众神生气",
"vapok_mod_no_inception2": "你被警告了,注意点",
"vapok_mod_no_inception3": "你惹众神生气了!",
"vapok_mod_no_inception4": "呵呵... 众神很快就会收拾你的",
"vapok_mod_no_inception5": "众神夺走了你的力量!!",

"vapok_mod_thor_saves_contents": "你的背包里有东西,托尔为你保留了它",

"vapok_mod_useful_backpack": "你的背包看起很有用..",
"vapok_mod_you_droped_bag": "你的背包掉了!",
"vapok_mod_level": "等级",
"vapok_mod_effect": "效果",
"vapok_mod_quick_drop_unavailable": "快速放置不可用。",

"vapok_mod_se_cold_immunity": "耐冷",
"vapok_mod_se_frost_resistance": "抗霜",
"vapok_mod_se_wet_resistance": "防水"
}
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Chinese_Trad.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "你的背包掉了!" ,
"vapok_mod_level": "等級",
"vapok_mod_effect": "效果",
"vapok_mod_quick_drop_unavailable": "無法快速放置物品。",

"vapok_mod_se_cold_immunity": "耐寒",
"vapok_mod_se_frost_resistance": "抗凍",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Czech.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "Upustil jsi batoh na zem!",
"vapok_mod_level": "Level",
"vapok_mod_effect": "Effekt",
"vapok_mod_quick_drop_unavailable": "Rychlé odložení nedostupné.",

"vapok_mod_se_cold_immunity": "Odpovídavost proti chladu",
"vapok_mod_se_frost_resistance": "Odolnost proti mrazu",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.French.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"vapok_mod_you_droped_bag": "Vous avez laissé tomber votre sac !",
"vapok_mod_level": "Niveau",
"vapok_mod_effect": "Effet",
"vapok_mod_quick_drop_unavailable": "Dépôt rapide indisponible.",

"vapok_mod_se_cold_immunity": "Immunité au froid",
"vapok_mod_se_frost_resistance": "Résistance au gel",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.German.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "Du hast einen Rucksack fallen lassen!",
"vapok_mod_level": "Level",
"vapok_mod_effect": "Effekt",
"vapok_mod_quick_drop_unavailable": "Schnelles Ablegen nicht verfügbar.",

"vapok_mod_se_cold_immunity": "Kälteimmunität",
"vapok_mod_se_frost_resistance": "Frostwiderstand",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Japanese.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "バックパックを落としました!",
"vapok_mod_level": "レベル",
"vapok_mod_effect": "効果",
"vapok_mod_quick_drop_unavailable": "クイックドロップは利用できません。",

"vapok_mod_se_cold_immunity": "寒冷耐性",
"vapok_mod_se_frost_resistance": "凍結耐性",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Korean.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "배낭을 떨어뜨렸습니다!",
"vapok_mod_level": "레벨",
"vapok_mod_effect": "효과",
"vapok_mod_quick_drop_unavailable": "빠른 드롭을 사용할 수 없습니다.",

"vapok_mod_se_cold_immunity": "한파 면역",
"vapok_mod_se_frost_resistance": "서리 저항",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Norwegian.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "Du slapp en sekk!",
"vapok_mod_level": "Nivå",
"vapok_mod_effect": "Effekt",
"vapok_mod_quick_drop_unavailable": "Hurtigfall ikke tilgjengelig.",

"vapok_mod_se_cold_immunity": "Kuldeimmunitet",
"vapok_mod_se_frost_resistance": "Frostmotstand",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Portuguese_Brazilian.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "Você largou a mochila!",
"vapok_mod_level": "Nível",
"vapok_mod_effect": "Efeito",
"vapok_mod_quick_drop_unavailable": "Descarte rápido indisponível.",

"vapok_mod_se_cold_immunity": "Imunidade ao frio",
"vapok_mod_se_frost_resistance": "Resistência à geada",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Russian.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "Ты уронил рюкзак!",
"vapok_mod_level": "Уровень",
"vapok_mod_effect": "Эффект",
"vapok_mod_quick_drop_unavailable": "Быстрое сбрасывание недоступно.",

"vapok_mod_se_cold_immunity": "Устойчивость к холоду",
"vapok_mod_se_frost_resistance": "Сопротивление морозу",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Spanish.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"vapok_mod_you_droped_bag": "Tiraste la mochila!",
"vapok_mod_level": "Nivel",
"vapok_mod_effect": "Efecto",
"vapok_mod_quick_drop_unavailable": "Descarte rápido no disponible.",

"vapok_mod_se_cold_immunity": "Inmunidad al frío",
"vapok_mod_se_frost_resistance": "Resistencia al hielo",
Expand Down
1 change: 1 addition & 0 deletions Translations/AdventureBackpacks.Swedish.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"vapok_mod_you_droped_bag": "Du släppte en ryggsäck!",
"vapok_mod_level": "Nivå",
"vapok_mod_effect": "Effekt",
"vapok_mod_quick_drop_unavailable": "Snabbt avsläpp otillgängligt.",

"vapok_mod_se_cold_immunity": "Kyla Immunitet",
"vapok_mod_se_frost_resistance": "Frostmotstånd",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "AdventureBackpacks",
"version_number": "1.6.8",
"version_number": "1.6.9",
"website_url": "https://github.com/Vapok/AdventureBackpacks",
"description": "A Valheim Mod to add a catalogue of Adventuring Backpacks to the Game. These packs will grow and become more useful as the game progresses.",
"dependencies": [
Expand Down

0 comments on commit f737cc1

Please sign in to comment.