(1.6.14) EventSystem Added Reagent to reward
This commit is contained in:
@@ -122,6 +122,7 @@ namespace MxValheim.EventSystem
|
||||
Reward.GiveEpicLootDust();
|
||||
Reward.GiveEpicLootShard();
|
||||
Reward.GiveEpicLootEssence();
|
||||
Reward.GiveEpicLootReagent();
|
||||
Reward.GiveEpicLootRune();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,30 @@ namespace MxValheim.EventSystem
|
||||
}
|
||||
}
|
||||
|
||||
public static void GiveEpicLootReagent()
|
||||
{
|
||||
System.Random rand = new System.Random();
|
||||
|
||||
int qty = rand.Next(1, Profiles.serverLevel);
|
||||
|
||||
string[] rarity = GetRarityList(Watcher.eventPoints);
|
||||
|
||||
string itemName = $"Reagent{globalRarity}";
|
||||
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
GameObject prefab = ObjectDB.instance.GetItemPrefab(itemName);
|
||||
if (prefab != null)
|
||||
{
|
||||
GiveItemSafe(itemName, player, qty);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"Item {itemName} not found in ObjectDB!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void GiveEpicLootRune()
|
||||
{
|
||||
System.Random rand = new System.Random();
|
||||
@@ -289,6 +313,7 @@ namespace MxValheim.EventSystem
|
||||
{ "Ghost", 100 },
|
||||
{ "Skeleton", 60 },
|
||||
{ "Skeleton_NoArcher", 60 }, // Melee only variant
|
||||
{ "Skeleton_Poison", 60 },
|
||||
|
||||
// --- Swamp ---
|
||||
{ "Blob", 50 },
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using TMPro;
|
||||
@@ -33,7 +34,7 @@ public class MxValheimMod : BaseUnityPlugin
|
||||
|
||||
private const string ModGUID = "ovh.mxdev.mxvalheim";
|
||||
private const string ModName = "MxValheim";
|
||||
private const string ModVersion = "1.6.13";
|
||||
private const string ModVersion = "1.6.14";
|
||||
|
||||
public static ConfigEntry<bool> Config_DebugRandomEventInterval;
|
||||
public static ConfigEntry<float> Config_bowDrawSpeedBonusPerLevel;
|
||||
@@ -44,6 +45,10 @@ public class MxValheimMod : BaseUnityPlugin
|
||||
public static string internalDataEventSystem = Path.Combine(internalDataPath, "EventSystem.json");
|
||||
public static string DropConfigPath => Path.Combine(internalConfigsPath, "items_drop.json");
|
||||
public static string WeightConfigPath => Path.Combine(internalConfigsPath, "items_weight.json");
|
||||
public static string EnemyExpConfigPath => Path.Combine(internalConfigsPath, "enemies_expvalue.mx");
|
||||
public static Dictionary<string, int> EnemyExpSettings = new Dictionary<string, int>();
|
||||
public static string EnemyRewardConfigPath => Path.Combine(internalConfigsPath, "enemies_rewardvalue.mx");
|
||||
public static Dictionary<string, int> EnemyRewardSettings = new Dictionary<string, int>();
|
||||
public static string AutoDoorConfigPath => Path.Combine(internalConfigsPath, "auto_doors.json");
|
||||
public static DoorRoot CachedConfig;
|
||||
public static Dictionary<string, float> WeightSettings = new Dictionary<string, float>();
|
||||
@@ -376,9 +381,21 @@ public class MxValheimMod : BaseUnityPlugin
|
||||
File.WriteAllText(DropConfigPath, JsonConvert.SerializeObject(DropSettings, Newtonsoft.Json.Formatting.Indented));
|
||||
}
|
||||
|
||||
byte[] jsonEncryptedB64 = null;
|
||||
|
||||
json = File.ReadAllText(DropConfigPath);
|
||||
DropSettings = JsonConvert.DeserializeObject<Dictionary<string, int>>(json);
|
||||
Logger.LogInfo($"Successfully parsed {DropSettings.Count} items.");
|
||||
|
||||
/*jsonEncryptedB64 = Convert.FromBase64String(File.ReadAllText(EnemyRewardConfigPath));
|
||||
json = Encoding.UTF8.GetString(jsonEncryptedB64);
|
||||
EnemyRewardSettings = JsonConvert.DeserializeObject<Dictionary<string, int>>(json);
|
||||
Logger.LogInfo($"Successfully parsed {EnemyRewardSettings.Count} enemy reward value.");
|
||||
|
||||
jsonEncryptedB64 = Convert.FromBase64String(File.ReadAllText(EnemyExpConfigPath));
|
||||
json = Encoding.UTF8.GetString(jsonEncryptedB64);
|
||||
EnemyExpSettings = JsonConvert.DeserializeObject<Dictionary<string, int>>(json);
|
||||
Logger.LogInfo($"Successfully parsed {EnemyExpSettings.Count} enemy exp value.");*/
|
||||
}
|
||||
|
||||
public void LoadDoorConfig()
|
||||
|
||||
Reference in New Issue
Block a user