internal void Save(HamstarHelpersMod mymod, TagCompound tags) { var modworld = mymod.GetModWorld <HamstarHelpersWorld>(); tags.Set("world_mod_lock_count", this.WorldModLocks.Count); int i = 0; foreach (var kv in this.WorldModLocks) { string world_uid = kv.Key; ISet <string> mod_names = kv.Value; tags.Set("world_mod_lock_uid_" + i, world_uid); tags.Set("world_mod_lock_mods_" + i + "_count", mod_names.Count); int j = 0; foreach (string mod_name in mod_names) { //LogHelpers.Log( "Save world_mod_lock_mods_" + i + "_" + j +": "+mod_name ); tags.Set("world_mod_lock_mods_" + i + "_" + j, mod_name); j++; } i++; } }
//////////////// internal void LoadFromData(HamstarHelpersMod mymod, int half_days, string world_id) { var myworld = mymod.GetModWorld <HamstarHelpersWorld>(); this.HalfDaysElapsed = half_days; myworld.ObsoleteID = world_id; }
//////////////// internal void Load(HamstarHelpersMod mymod, TagCompound tags) { var myworld = mymod.GetModWorld <HamstarHelpersWorld>(); if (tags.ContainsKey("world_id")) { this.HalfDaysElapsed = tags.GetInt("half_days_elapsed_" + myworld.ObsoleteID); } }
public void PreUpdateServer(HamstarHelpersMod mymod, Player player) { if (player.whoAmI == Main.myPlayer) // Current player { var modworld = mymod.GetModWorld <HamstarHelpersWorld>(); mymod.LoadHelpers.HasServerBegunHavingPlayers = true; } foreach (int buff_id in this.PermaBuffsById) { player.AddBuff(buff_id, 3); } this.UpdateTml(mymod, player); }
public void PreUpdateClient(HamstarHelpersMod mymod, Player player) { this.PreUpdatePlayer(mymod, player); if (player.whoAmI == Main.myPlayer) // Current player { var myworld = mymod.GetModWorld <HamstarHelpersWorld>(); myworld.WorldLogic.PreUpdateClient(mymod); } // Update ping every 15 seconds if (mymod.Config.IsServerGaugingAveragePing && this.TestPing++ > (60 * 15)) { PacketProtocol.QuickSendToServer <PingProtocol>(); this.TestPing = 0; } }
private void PreUpdatePlayer(HamstarHelpersMod mymod, Player player) { if (player.whoAmI == Main.myPlayer) // Current player { var modworld = mymod.GetModWorld <HamstarHelpersWorld>(); SimpleMessage.UpdateMessage(); mymod.PlayerMessages.Update(); this.DialogManager.Update(mymod); this.OldDialogManager.Update(mymod); } foreach (int buff_id in this.PermaBuffsById) { player.AddBuff(buff_id, 3); } this.UpdateTml(mymod, player); }
//////////////// internal void Load(HamstarHelpersMod mymod, TagCompound tags) { var modworld = mymod.GetModWorld <HamstarHelpersWorld>(); if (tags.ContainsKey("world_mod_lock_count")) { int world_count = tags.GetInt("world_mod_lock_count"); for (int i = 0; i < world_count; i++) { string world_uid = tags.GetString("world_mod_lock_uid_" + i); int mod_count = tags.GetInt("world_mod_lock_mods_" + i + "_count"); this.WorldModLocks[world_uid] = new HashSet <string>(); for (int j = 0; j < mod_count; j++) { string mod_name = tags.GetString("world_mod_lock_mods_" + i + "_" + j); //LogHelpers.Log( "Load world_mod_lock_mods_" + i + "_" + j +": "+mod_name ); this.WorldModLocks[world_uid].Add(mod_name); } } } }
internal void Save(HamstarHelpersMod mymod, TagCompound tags) { var myworld = mymod.GetModWorld <HamstarHelpersWorld>(); tags.Set("half_days_elapsed_" + myworld.ObsoleteID, (int)this.HalfDaysElapsed); }