//handles reading current player json file and loading them into memory private void InitializePlayerData() { // save is loaded if (Context.IsWorldReady) { //fetch the alchemy save for this game file. if (!Game1.IsMultiplayer || Game1.IsMasterGame) { PlayerData = Helper.ReadJsonFile <SaveDataModel>(Path.Combine(Constants.CurrentSavePath, $"{Game1.uniqueIDForThisGame.ToString()}.json")) ?? new SaveDataModel(); } // if we are the player/host and we don't have a profile, let's make one for ourselves. var farmerId = Game1.player.uniqueMultiplayerID; if (!PlayerData.AlchemyLevel.ContainsKey(farmerId)) { PlayerData.AlchemyLevel[farmerId] = 0; } if (!PlayerData.AlchemyExperience.ContainsKey(farmerId)) { PlayerData.AlchemyExperience[farmerId] = 0; } // sync old experience values into the new system if (Game1.player.GetCustomSkillExperience(skill) < PlayerData.AlchemyExperience[farmerId]) { AddAlchemyExperience(PlayerData.AlchemyExperience[farmerId] - Game1.player.GetCustomSkillExperience(skill)); } if (!PlayerData.AlkahestryCurrentEnergy.ContainsKey(farmerId)) { PlayerData.AlkahestryCurrentEnergy[farmerId] = 0F; } if (!PlayerData.AlkahestryMaxEnergy.ContainsKey(farmerId)) { PlayerData.AlkahestryMaxEnergy[farmerId] = 0F; } if (!PlayerData.TotalValueTransmuted.ContainsKey(farmerId)) { PlayerData.TotalValueTransmuted[farmerId] = 0; } if (!PlayerData.IsSlimeGivenToWizard.ContainsKey(farmerId)) { PlayerData.IsSlimeGivenToWizard[farmerId] = false; } // clean up deprecated profession data and use the new profession hooks ProfessionHelper.CleanDeprecatedProfessions(); } Log.info("Player data loaded."); }
public AlchemySkill() : base("EquivalentExchange.Alchemy") { Name = "Alchemy"; Icon = DrawingUtil.alchemySkillIconBordered; SkillsPageIcon = DrawingUtil.alchemySkillIcon; ExperienceCurve = Alchemy.alchemyExperienceNeededPerLevel; ExperienceBarColor = new Microsoft.Xna.Framework.Color(255, 35, 165); // Level 5 ProfessionShaper = new Profession(this, ProfessionHelper.GetProfessionInternalName(ProfessionHelper.OldShaperId)) { Icon = DrawingUtil.alchemyShaperIcon, Name = ProfessionHelper.GetProfessionTitleFromNumber(ProfessionHelper.OldShaperId), Description = ProfessionHelper.GetProfessionDescription(ProfessionHelper.OldShaperId) }; Professions.Add(ProfessionShaper); ProfessionSage = new Profession(this, ProfessionHelper.GetProfessionInternalName(ProfessionHelper.OldSageId)) { Icon = DrawingUtil.alchemySageIcon, Name = ProfessionHelper.GetProfessionTitleFromNumber(ProfessionHelper.OldSageId), Description = ProfessionHelper.GetProfessionDescription(ProfessionHelper.OldSageId) }; Professions.Add(ProfessionSage); ProfessionsForLevels.Add(new ProfessionPair(5, ProfessionShaper, ProfessionSage)); // Level 10 - track A ProfessionTransmuter = new Profession(this, ProfessionHelper.GetProfessionInternalName(ProfessionHelper.OldTransmuterId)) { Icon = DrawingUtil.alchemyTransmuterIcon, Name = ProfessionHelper.GetProfessionTitleFromNumber(ProfessionHelper.OldTransmuterId), Description = ProfessionHelper.GetProfessionDescription(ProfessionHelper.OldTransmuterId) }; Professions.Add(ProfessionTransmuter); ProfessionAdept = new Profession(this, ProfessionHelper.GetProfessionInternalName(ProfessionHelper.OldAdeptId)) { Icon = DrawingUtil.alchemyAdeptIcon, Name = ProfessionHelper.GetProfessionTitleFromNumber(ProfessionHelper.OldAdeptId), Description = ProfessionHelper.GetProfessionDescription(ProfessionHelper.OldAdeptId) }; Professions.Add(ProfessionAdept); ProfessionsForLevels.Add(new ProfessionPair(10, ProfessionTransmuter, ProfessionAdept, ProfessionShaper)); // Level 10 - track B ProfessionAurumancer = new Profession(this, ProfessionHelper.GetProfessionInternalName(ProfessionHelper.OldAurumancerId)) { Icon = DrawingUtil.alchemyAurumancerIcon, Name = ProfessionHelper.GetProfessionTitleFromNumber(ProfessionHelper.OldAurumancerId), Description = ProfessionHelper.GetProfessionDescription(ProfessionHelper.OldAurumancerId) }; Professions.Add(ProfessionAurumancer); ProfessionConduit = new Profession(this, ProfessionHelper.GetProfessionInternalName(ProfessionHelper.OldConduitId)) { Icon = DrawingUtil.alchemyConduitIcon, Name = ProfessionHelper.GetProfessionTitleFromNumber(ProfessionHelper.OldConduitId), Description = ProfessionHelper.GetProfessionDescription(ProfessionHelper.OldConduitId) }; Professions.Add(ProfessionConduit); ProfessionsForLevels.Add(new ProfessionPair(10, ProfessionAurumancer, ProfessionConduit, ProfessionSage)); }