Example #1
0
 public string GetDespawnMessage(NPC boss, int listnum)
 {
     if (Main.player.Any(playerCheck => playerCheck.active && !playerCheck.dead))                                           // If any player is active and alive
     {
         if (Main.npc.Any(x => x.life > 0 && BossChecklist.bossTracker.SortedBosses[listnum].npcIDs.IndexOf(x.type) != -1)) // If boss is still active
         {
             if (Main.dayTime && DayDespawners.Contains(boss.type))
             {
                 return("Mods.BossChecklist.BossDespawn.Day");
             }
             else if (boss.type == NPCID.WallofFlesh)
             {
                 return("Mods.BossChecklist.BossVictory.WallofFlesh");
             }
             else
             {
                 return("Mods.BossChecklist.BossDespawn.Generic");
             }
         }
         else
         {
             return("");
         }
     }
     else if (BossChecklist.ClientConfig.DespawnMessageType == "Unique")
     {
         // Check already accounted for to get to this point
         return(BossChecklist.bossTracker.SortedBosses[NPCAssist.ListedBossNum(boss)].despawnMessage);
     }
     else
     {
         return("Mods.BossChecklist.BossVictory.Generic");
     }
 }
Example #2
0
 public override void PreUpdate()
 {
     for (int n = 0; n < Main.maxNPCs; n++)
     {
         NPC b       = Main.npc[n];
         int listNum = NPCAssist.ListedBossNum(b);
         if (listNum != -1)
         {
             if (b.active)
             {
                 for (int i = 0; i < Main.maxPlayers; i++)
                 {
                     if (!ActiveBossesList[listNum])
                     {
                         StartingPlayers[listNum][i] = Main.player[i].active;
                     }
                     else if (!Main.player[i].active)
                     {
                         StartingPlayers[listNum][i] = false;
                     }
                 }
                 ActiveBossesList[listNum] = true;
                 // if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.WorldData);
             }
             else if (ActiveBossesList[listNum])
             {
                 if (NPCAssist.TruelyDead(b))
                 {
                     string message = GetDespawnMessage(b, listNum);
                     if (message != "")
                     {
                         if (Main.netMode == NetmodeID.SinglePlayer)
                         {
                             if (BossChecklist.ClientConfig.DespawnMessageType != "Disabled")
                             {
                                 Main.NewText(Language.GetTextValue(message, b.FullName), Colors.RarityPurple);
                             }
                         }
                         else
                         {
                             NetMessage.BroadcastChatMessage(NetworkText.FromKey(message, b.FullName), Colors.RarityPurple);
                         }
                     }
                     ActiveBossesList[listNum] = false;
                     // if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.WorldData);
                 }
             }
         }
     }
 }
Example #3
0
 public override void OnHitByProjectile(Projectile proj, int damage, bool crit)
 {
     if (!BossChecklist.DebugConfig.RecordTrackingDisabled)
     {
         for (int i = 0; i < Main.maxNPCs; i++)
         {
             if (!Main.npc[i].active || NPCAssist.ListedBossNum(Main.npc[i]) == -1)
             {
                 continue;
             }
             AttackCounter[NPCAssist.ListedBossNum(Main.npc[i])]++;
             DodgeTimer[NPCAssist.ListedBossNum(Main.npc[i])] = 0;
         }
     }
 }
Example #4
0
 public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
 {
     if (!BossChecklist.DebugConfig.RecordTrackingDisabled && damage > 0)
     {
         for (int i = 0; i < Main.maxNPCs; i++)
         {
             if (!Main.npc[i].active || NPCAssist.ListedBossNum(Main.npc[i]) == -1)
             {
                 continue;
             }
             int listNum = NPCAssist.ListedBossNum(Main.npc[i]);
             if (BrinkChecker[listNum] == 0)
             {
                 BrinkChecker[listNum] = player.statLife;
             }
             AttackCounter[listNum]++;
             DodgeTimer[listNum] = 0;
         }
     }
 }
Example #5
0
        //int lastSeenScreenWidth;
        //int lastSeenScreenHeight;
        public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers)
        {
            //if (BossChecklistUI.visible)
            //{
            //	layers.RemoveAll(x => x.Name == "Vanilla: Resource Bars" || x.Name == "Vanilla: Map / Minimap");
            //}

            int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));

            if (MouseTextIndex != -1)
            {
                layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer(
                                  "BossChecklist: Boss Checklist",
                                  delegate {
                    if (BossChecklistUI.Visible)
                    {
                        bossChecklistInterface?.Draw(Main.spriteBatch, new GameTime());

                        if (BossChecklistUI.hoverText != "")
                        {
                            float x        = Main.fontMouseText.MeasureString(BossChecklistUI.hoverText).X;
                            Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 16f);
                            if (vector.Y > (float)(Main.screenHeight - 30))
                            {
                                vector.Y = (float)(Main.screenHeight - 30);
                            }
                            if (vector.X > (float)(Main.screenWidth - x - 30))
                            {
                                vector.X = (float)(Main.screenWidth - x - 30);
                            }
                            //Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, BossChecklistUI.hoverText,
                            //	vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f);
                            //	Utils.draw

                            //ItemTagHandler.GenerateTag(item)
                            int hoveredSnippet  = -1;
                            TextSnippet[] array = ChatManager.ParseMessage(BossChecklistUI.hoverText, Color.White).ToArray();
                            ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, array,
                                                                       vector, 0f, Vector2.Zero, Vector2.One, out hoveredSnippet /*, -1f, 2f*/);

                            if (hoveredSnippet > -1)
                            {
                                array[hoveredSnippet].OnHover();
                                //if (Main.mouseLeft && Main.mouseLeftRelease)
                                //{
                                //	array[hoveredSnippet].OnClick();
                                //}
                            }
                        }
                    }
                    return(true);
                },
                                  InterfaceScaleType.UI)
                              );
            }
            // This doesn't work perfectly.
            //if (BossChecklistUI.Visible) {
            //	layers.RemoveAll(x => LayersToHideWhenChecklistVisible.Contains(x.Name));
            //}
            if (MouseTextIndex != -1)
            {
                layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer("BossChecklist: Boss Log",
                                                                           delegate {
                    BossLogInterface.Draw(Main.spriteBatch, new GameTime());
                    return(true);
                },
                                                                           InterfaceScaleType.UI)
                              );
                layers.Insert(++MouseTextIndex, new LegacyGameInterfaceLayer("BossChecklist: Boss Radar",
                                                                             delegate {
                    BossRadarUIInterface.Draw(Main.spriteBatch, new GameTime());
                    return(true);
                },
                                                                             InterfaceScaleType.UI)
                              );
            }
            if (ClientConfig.RespawnTimerEnabled)
            {
                int InventoryIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Death Text"));
                if (InventoryIndex != -1)
                {
                    layers.Insert(InventoryIndex, new LegacyGameInterfaceLayer("BossChecklist: Respawn Timer",
                                                                               delegate {
                        if (Main.LocalPlayer.dead && Main.LocalPlayer.difficulty != 2)
                        {
                            if (ClientConfig.TimerSounds)
                            {
                                if (Main.LocalPlayer.respawnTimer % 60 == 0 && Main.LocalPlayer.respawnTimer / 60 <= 3)
                                {
                                    Main.PlaySound(25);
                                }
                            }
                            string timer      = (Main.LocalPlayer.respawnTimer / 60 + 1).ToString();
                            Vector2 screenPos = new Vector2(Main.screenWidth / 2, Main.screenHeight / 2 - 75);
                            Color deathColor  = Main.player[Main.myPlayer].GetDeathAlpha(Color.Transparent);
                            DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, timer, screenPos, deathColor);
                        }
                        return(true);
                    },
                                                                               InterfaceScaleType.UI)
                                  );
                }
            }
            #region DEBUG
            int PlayerChatIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Player Chat"));
            if (PlayerChatIndex != -1)
            {
                layers.Insert(PlayerChatIndex, new LegacyGameInterfaceLayer("BossChecklist: Debug Timers and Counters",
                                                                            delegate {
                    PlayerAssist playerAssist = Main.LocalPlayer.GetModPlayer <PlayerAssist>();
                    int ConfigIndex           = NPCAssist.ListedBossNum(DebugConfig.ShowTimerOrCounter.Type, DebugConfig.ShowTimerOrCounter.mod);
                    if (ConfigIndex != -1)
                    {
                        string textKingSlime = $"{bossTracker.SortedBosses[ConfigIndex].name} (#{ConfigIndex + 1})" +
                                               $"\nTime: {playerAssist.RecordTimers[ConfigIndex]}" +
                                               $"\nDodge Timer: {playerAssist.DodgeTimer[ConfigIndex]}" +
                                               $"\nTimes Hit: {playerAssist.AttackCounter[ConfigIndex]}" +
                                               $"\nLowest Health: {playerAssist.BrinkChecker[ConfigIndex]} / {playerAssist.MaxHealth[ConfigIndex]}" +
                                               $"\nDeaths: {playerAssist.DeathTracker[ConfigIndex]}";
                        DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textKingSlime, new Vector2(20, Main.screenHeight - 175), new Color(1f, 0.388f, 0.278f), 0f, default(Vector2), 1, SpriteEffects.None, 0f);
                    }
                    return(true);
                },
                                                                            InterfaceScaleType.UI)
                              );
            }
            #endregion
        }