Skip to content

Commit 314b070

Browse files
committed
1.3.7
1 parent 02f3441 commit 314b070

File tree

6 files changed

+52
-7
lines changed

6 files changed

+52
-7
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ CakeBuild
33
Releases
44
LevelUP/bin
55
LevelUP/obj
6+
LevelUP/Properties
67
LevelUP.sln
7-
build.ps1
8-
build.sh
8+
build.ps1

LevelUP/Server/LevelVitality.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,17 @@ private void PlayerJoin(IServerPlayer player)
111111
playerStats.UpdateMaxHealth();
112112

113113
if (Configuration.enableExtendedLog)
114+
{
114115
Debug.Log($"{player.PlayerName} joined the world with max: {playerStats.MaxHealth} health and {playerStats.Health} actual health");
116+
Debug.Log($"VITALITY Calculation Variables: {playerMaxHealth}:{playerRegen}, Level: {Configuration.VitalityGetLevelByEXP(playerExp)}");
117+
}
115118
}
116119

117120
private void PlayerDisconnect(IServerPlayer player)
118121
{
119122
// Disconnected during the loading
120123
if (player == null) return;
121-
124+
122125
// Get stats
123126
EntityBehaviorHealth playerStats = player.Entity.GetBehavior<EntityBehaviorHealth>();
124127
if (playerStats == null) { Debug.Log($"ERROR SAVING PLAYER STATE: Player Stats is null, caused by {player.PlayerName}"); return; }

LevelUP/Shared/OverrideBlockBreak.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,42 @@ public static float GetMiningSpeedModifier(float __result, IWorldAccessor world,
7070
return __result;
7171
}
7272

73+
[HarmonyPostfix]
74+
[HarmonyPatch(typeof(CollectibleObject), "GetMiningSpeed")]
75+
public static float GetMiningSpeed(float __result, IItemStack itemstack, BlockSelection blockSel, Block block, IPlayer forPlayer)
76+
{
77+
float miningSpeedCompatibility = forPlayer.Entity.Attributes.GetFloat("LevelUP_BlockBreak_ExtendMiningSpeed_GetMiningSpeedModifier");
78+
forPlayer.Entity.Attributes.RemoveAttribute("LevelUP_BlockBreak_ExtendMiningSpeed_GetMiningSpeedModifier");
79+
switch (forPlayer.InventoryManager.ActiveTool)
80+
{
81+
case EnumTool.Axe:
82+
if (block.BlockMaterial == EnumBlockMaterial.Wood)
83+
return Configuration.enableLevelAxe ? __result * forPlayer.Entity.WatchedAttributes.GetFloat("LevelUP_Axe_MiningSpeed", 1.0f) + miningSpeedCompatibility : __result;
84+
else return 1.0f;
85+
case EnumTool.Pickaxe:
86+
if (block.BlockMaterial == EnumBlockMaterial.Brick ||
87+
block.BlockMaterial == EnumBlockMaterial.Ceramic ||
88+
block.BlockMaterial == EnumBlockMaterial.Metal ||
89+
block.BlockMaterial == EnumBlockMaterial.Ore ||
90+
block.BlockMaterial == EnumBlockMaterial.Stone)
91+
return Configuration.enableLevelPickaxe ? __result * forPlayer.Entity.WatchedAttributes.GetFloat("LevelUP_Pickaxe_MiningSpeed", 1.0f) + miningSpeedCompatibility : __result;
92+
else return 1.0f;
93+
case EnumTool.Shovel:
94+
if (block.BlockMaterial == EnumBlockMaterial.Soil ||
95+
block.BlockMaterial == EnumBlockMaterial.Gravel ||
96+
block.BlockMaterial == EnumBlockMaterial.Sand ||
97+
block.BlockMaterial == EnumBlockMaterial.Snow)
98+
return Configuration.enableLevelShovel ? __result * forPlayer.Entity.WatchedAttributes.GetFloat("LevelUP_Shovel_MiningSpeed", 1.0f) + miningSpeedCompatibility : __result;
99+
else return 1.0f;
100+
case EnumTool.Knife:
101+
if (block.BlockMaterial == EnumBlockMaterial.Plant ||
102+
block.BlockMaterial == EnumBlockMaterial.Leaves)
103+
return Configuration.enableLevelKnife ? __result * forPlayer.Entity.WatchedAttributes.GetFloat("LevelUP_Knife_MiningSpeed", 1.0f) + miningSpeedCompatibility : __result;
104+
else return 1.0f;
105+
}
106+
return __result;
107+
}
108+
73109
// Overwrite Wood Axe Breaking
74110
[HarmonyPrefix]
75111
[HarmonyPatch(typeof(ItemAxe), "OnBlockBrokenWith")]
@@ -139,7 +175,7 @@ public static ItemStack[] GetDrops(ItemStack[] __result, BlockCrop __instance, I
139175
}
140176
index++;
141177
}
142-
178+
143179
// Add harvest experience
144180
if (exp != null)
145181
{

LevelUP/Shared/OverrideDamageInteraction.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public static void ReceiveDamageStart(Entity __instance, DamageSource damageSour
6161
// Damage bug treatment
6262
if (damage > 0 && __instance.ShouldReceiveDamage(damageSource, damage))
6363
{
64-
6564
// Player Does Damage
6665
// Checking if damage sources is from a player and from a server and if entity is alive
6766
if (damageSource.SourceEntity is EntityPlayer || damageSource.GetCauseEntity() is EntityPlayer && __instance.World.Side == EnumAppSide.Server && __instance.Alive)
@@ -212,7 +211,11 @@ public static void ReceiveDamageStart(Entity __instance, DamageSource damageSour
212211

213212
}
214213
// Ranged Action
215-
else if (damageSource.GetCauseEntity() is EntityPlayer && damageSource.SourceEntity is EntityProjectile)
214+
// Native Game: damageSource.SourceEntity is EntityProjectile
215+
// Combat Overhaul compatibility: damageSource.SourceEntity.GetType().ToString() == "CombatOverhaul.RangedSystems.ProjectileEntity")
216+
else if (damageSource.GetCauseEntity() is EntityPlayer &&
217+
(damageSource.SourceEntity is EntityProjectile ||
218+
damageSource.SourceEntity.GetType().ToString() == "CombatOverhaul.RangedSystems.ProjectileEntity"))
216219
{
217220

218221
// Get entities

LevelUP/modinfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"BoboDev"
77
],
88
"description": "Add level system to your character",
9-
"version": "1.3.7-pre.1",
9+
"version": "1.3.7",
1010
"dependencies": {
1111
"game": ""
1212
}

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dotnet run --project ./CakeBuild/CakeBuild.csproj -- "$@"
2+
rm -rf "$VINTAGE_STORY/Mods/levelup"
3+
cp -r ./Releases/levelup "$VINTAGE_STORY/Mods/levelup"

0 commit comments

Comments
 (0)