public override void SendClientChanges(ModPlayer clientPlayer) { MrPlagueRacesPlayer clone = clientPlayer as MrPlagueRacesPlayer; if (clone.MrPlagueRacesNonStopParty != MrPlagueRacesNonStopParty) { var packet = mod.GetPacket(); packet.Write((byte)MrPlagueRacesMessageType.MrPlagueRacesNonStopPartyChanged); packet.Write((byte)player.whoAmI); packet.Write(MrPlagueRacesNonStopParty); packet.Send(); } }
// Proper initialization function that defines everything. In theory. public override void Initialize(Player player) { ShaggyAddonRaces.Logger.Info("Initializing..."); globalPlayer = player; ShaggyAddonRaces.Logger.Info("Defining modplayer..."); modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); Item familiarshirt = new Item(); Item familiarpants = new Item(); familiarshirt.SetDefaults(ItemID.FamiliarShirt); familiarpants.SetDefaults(ItemID.FamiliarPants); ShaggyAddonRaces.Logger.Info("Defining tails..."); texture_Tail = ShaggyAddonRaces.GetTexture("Content/RaceTextures/Kitsune/Tail/Kitsune_Tail" + tailCount); texture_Color = ShaggyAddonRaces.GetTexture("Content/RaceTextures/Kitsune/Tail/Kitsune_Tail" + tailCount + "_Color"); }
public override void ModifyDrawInfo(Player player, Mod mod, ref PlayerDrawInfo drawInfo) { if (player == null) { player = globalPlayer; ShaggyAddonRaces.Logger.Warn("Player undefined, assigned globalPlayer value."); } modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); // Have to fetch the modplayer again for character screen shenanigans if (modPlayer.resetDefaultColors && Main.gameMenu) { modPlayer.resetDefaultColors = false; player.hairColor = new Color(232, 101, 54); player.skinColor = new Color(255, 255, 255); player.eyeColor = new Color(50, 50, 50); player.skinVariant = 0; } }
private void Init(Player player) { // Redundant initialize every frame. if (modPlayer == null) { ShaggyAddonRaces.Logger.Info("Modplayer Null, defining..."); globalPlayer = player; modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); Item familiarshirt = new Item(); Item familiarpants = new Item(); familiarshirt.SetDefaults(ItemID.FamiliarShirt); familiarpants.SetDefaults(ItemID.FamiliarPants); } if (texture_Color == null || texture_Tail == null) { FetchTails(); } }
public override void ModifyDrawLayers(Player player, List <PlayerLayer> layers) { try { if (player == null) { player = globalPlayer; ShaggyAddonRaces.Logger.Warn("Player undefined, assigned globalPlayer value."); } if (layers == null) { ShaggyAddonRaces.Logger.Warn("LAYERS IS NULL"); } modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); if (texture_Color == null || texture_Tail == null) { ShaggyAddonRaces.Logger.Info("Tails are null... Acquiring."); FetchTails(); } if (texture_Color.IsDisposed || texture_Tail.IsDisposed) { // catch to make absolutely sure stuff isn't broken ShaggyAddonRaces.Logger.Info("Tails are disposed... re-acquiring."); FetchTails(); } if (modPlayer != null && player != null && layers != null) { int tailLayer = layers.IndexOf(PlayerLayer.Legs) - 1; layers.Insert(tailLayer, KitsuneTail); layers.Insert(tailLayer + 1, KitsuneTail_Color); base.ModifyDrawLayers(player, layers); bool hideChestplate = modPlayer.hideChestplate; bool hideLeggings = modPlayer.hideLeggings; modPlayer.updatePlayerSprites("ShaggyAddonRaces/Content/RaceTextures/", "ShaggyAddonRaces/Content/RaceTextures/Kitsune/", hideChestplate, hideLeggings, 4, 0, "Kitsune", false, false, false); } } catch (System.Exception e) { // Literally just pipe all errors to the log file rather than crash immediately and hope for the best. ShaggyAddonRaces.Logger.Error("Error in ModifyDraw Layers! Now printing error to log..."); ShaggyAddonRaces.Logger.Error(e); } }
public override void OnEnterWorld(Player player) { modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); Main.NewText("Shaggy's Addon Races: ''Racial ability can toggle'' is set to true by default. (It's located in Mod Configuration if you want to change it!)"); }
public override void clientClone(ModPlayer clientClone) { MrPlagueRacesPlayer clone = clientClone as MrPlagueRacesPlayer; clone.MrPlagueRacesNonStopParty = MrPlagueRacesNonStopParty; }