Esempio n. 1
0
        public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers)
        {
            PlayerInput.SetZoom_Unscaled();
            PlayerInput.SetZoom_MouseInWorld();
            Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.mouseX + (double)Main.screenPosition.X), (int)((double)Main.mouseY + (double)Main.screenPosition.Y), 1, 1);
            if ((double)Main.player[Main.myPlayer].gravDir == -1.0)
            {
                rectangle1.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY;
            }
            PlayerInput.SetZoom_UI();
            IngameOptions.MouseOver();
            IngameFancyUI.MouseOver();

            for (int index1 = 0; index1 < 200; ++index1)
            {
                if (Main.npc[index1].active)
                {
                    Rectangle rectangle2 = new Rectangle((int)Main.npc[index1].Bottom.X - Main.npc[index1].frame.Width / 2,
                                                         (int)Main.npc[index1].Bottom.Y - Main.npc[index1].frame.Height,
                                                         Main.npc[index1].frame.Width,
                                                         Main.npc[index1].frame.Height);
                    if (Main.npc[index1].type >= 87 && Main.npc[index1].type <= 92)
                    {
                        rectangle2 = new Rectangle((int)((double)Main.npc[index1].position.X + (double)Main.npc[index1].width * 0.5 - 32.0),
                                                   (int)((double)Main.npc[index1].position.Y + (double)Main.npc[index1].height * 0.5 - 32.0),
                                                   64,
                                                   64);
                    }
                    bool flag1 = rectangle1.Intersects(rectangle2);
                    bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1;
                    if (flag2 && (
                            Main.npc[index1].type != 85 &&
                            Main.npc[index1].type != 341 &&
                            Main.npc[index1].aiStyle != 87 ||
                            Main.npc[index1].ai[0] != 0.0) &&
                        Main.npc[index1].type != 488)
                    {
                        if (flag1)
                        {
                            ElementHelper elementHelper = new ElementHelper();

                            float buffer = 4 * Main.UIScale;
                            float prev   = 0;

                            Element Primary    = elementHelper.Primary(Main.npc[index1]);
                            Element Secondary  = elementHelper.Secondary(Main.npc[index1]);
                            Element Tertiary   = elementHelper.Tertiary(Main.npc[index1]);
                            Element Quatrinary = elementHelper.Quatrinary(Main.npc[index1]);

                            var icon1 = GetTexture("Types/" + Formal.Name[Primary]);
                            var icon2 = GetTexture("Types/" + Formal.Name[Secondary]);
                            var icon3 = GetTexture("Types/" + Formal.Name[Tertiary]);
                            var icon4 = GetTexture("Types/" + Formal.Name[Quatrinary]);

                            int yOffset = 38;
                            int xOffset = 12;
                            Main.spriteBatch.Begin();
                            int x = (int)((Main.mouseX + xOffset) * Main.UIScale);
                            int y = (int)((Main.mouseY + yOffset) * Main.UIScale);
                            if (Primary != Element.none && Primary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon1, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                                prev += icon1.Width * Main.UIScale + buffer;
                            }
                            if (Secondary != Element.none && Secondary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon2, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                                prev += icon2.Width * Main.UIScale + buffer;
                            }
                            if (Tertiary != Element.none && Tertiary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon3, new Vector2(Main.mouseX + prev, Main.mouseY), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                            }
                            if (Quatrinary != Element.none && Quatrinary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon4, new Vector2(x, y + icon1.Width * Main.UIScale + buffer), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                            }
                            Main.spriteBatch.End();
                            break;
                        }
                        break;
                    }
                }
            }

            //PlayerInput.SetZoom_UI();
            base.ModifyInterfaceLayers(layers);
        }
Esempio n. 2
0
        public void GetDetails()
        {
            PlayerInput.SetZoom_Unscaled();
            PlayerInput.SetZoom_MouseInWorld();
            Rectangle mouseRectangle = new Rectangle((int)((float)Main.mouseX + Main.screenPosition.X), (int)((float)Main.mouseY + Main.screenPosition.Y), 1, 1);

            if (Main.player[Main.myPlayer].gravDir == -1f)
            {
                mouseRectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY;
            }
            Rectangle screenRectangle = new Rectangle((int)(Main.screenPosition.X), (int)(Main.screenPosition.Y), Main.screenWidth, Main.screenHeight);

            PlayerInput.SetZoom_UI();
            IngameOptions.MouseOver();
            IngameFancyUI.MouseOver();

            Main.HoveringOverAnNPC = false;
            NPC    ActualNPC;
            string TempText = "";
            UIText panel;

            for (int k = 0; k < 200; k++)
            {
                ActualNPC = Main.npc[k];
                if (ActualNPC.active && !ActualNPC.dontCountMe)
                {
                    int       type   = Main.npc[k].type;
                    Rectangle NPCPos = new Rectangle((int)ActualNPC.Bottom.X - ActualNPC.frame.Width / 2, (int)ActualNPC.Bottom.Y - ActualNPC.frame.Height, ActualNPC.frame.Width, ActualNPC.frame.Height);
                    if (ActualNPC.type >= 87 && ActualNPC.type <= 92)
                    {
                        NPCPos = new Rectangle((int)(ActualNPC.position.X + ActualNPC.width * 0.5 - 32.0), (int)(ActualNPC.position.Y + ActualNPC.height * 0.5 - 32.0), 64, 64);
                    }
                    bool IsMouseOver = mouseRectangle.Intersects(NPCPos);
                    bool IsOnScreen  = screenRectangle.Intersects(NPCPos);
                    if (IsMouseOver)
                    {
                        Main.player[Main.myPlayer].showItemIcon = false;

                        ARPGGlobalNPC Rnpc   = ActualNPC.GetGlobalNPC <ARPGGlobalNPC>();
                        string        preFix = "";
                        if (Rnpc.getLevel >= 0 && ActualNPC.damage > 0)
                        {
                            preFix = "Level : " + (Rnpc.getLevel + Rnpc.getTier) + "\n";

                            //  if (NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) > 0)
                            //      preFix += "World bonus level : +" + NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) + "\n";
                        }
                        TempText = "";

                        if (Main.npc[k].lifeMax > 1 && !Main.npc[k].dontTakeDamage)
                        {
                            TempText = string.Concat(new object[]
                            {
                                preFix,
                                "Rank : ",
                                (NPCRank)Rnpc.getRank,
                                "\nDamage : ",
                                Main.npc[k].damage,
                                "\nDef : ",
                                Main.npc[k].defense
                            });
                        }
                        panel = new UIText(TempText);


                        NPCDetails = new NPCInfoUI(TempText, Color.White, new Vector2(Main.mouseX, Main.mouseY));
                    }
                    else if (IsOnScreen && ((Config.vConfig.DisplayNpcName && !ActualNPC.townNPC) || (Config.vConfig.DisplayTownName && ActualNPC.townNPC)))
                    {
                        Main.player[Main.myPlayer].showItemIcon = false;
                        TempText = ActualNPC.GivenOrTypeName;
                        RPGModule.Entities.ARPGGlobalNPC Rnpc = ActualNPC.GetGlobalNPC <RPGModule.Entities.ARPGGlobalNPC>();
                        string preFix = "";
                        if (Rnpc.getLevel >= 0 && ActualNPC.damage > 0)
                        {
                            preFix = "Lvl." + (Rnpc.getLevel + Rnpc.getTier);

                            /*
                             * if (NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) > 0)
                             *  preFix += "( + " + RPGModule.Entities.NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) + " )";
                             */
                        }

                        TempText = "";

                        if (Main.npc[k].lifeMax > 1 && !Main.npc[k].dontTakeDamage)
                        {
                            TempText = string.Concat(new object[]
                            {
                                preFix,
                                " | ",
                                //ActualNPC.GivenOrTypeName,
                                //": ",
                                Main.npc[k].life,
                                "/",
                                Main.npc[k].lifeMax
                            });
                        }
                        int NpcColor    = 0;
                        int LevelOffSet = (ActualNPC.GetGlobalNPC <ARPGGlobalNPC>().getLevel + ActualNPC.GetGlobalNPC <RPGModule.Entities.ARPGGlobalNPC>().getTier) - Main.LocalPlayer.GetModPlayer <RPGModule.Entities.RPGPlayer>().GetLevel();
                        if (LevelOffSet < -100)
                        {
                            NpcColor = 0;
                        }
                        else if (LevelOffSet < -50)
                        {
                            NpcColor = 1;
                        }
                        else if (LevelOffSet < -15)
                        {
                            NpcColor = 2;
                        }
                        else if (LevelOffSet < -5)
                        {
                            NpcColor = 3;
                        }
                        else if (LevelOffSet < 5)
                        {
                            NpcColor = 4;
                        }
                        else if (LevelOffSet < 20)
                        {
                            NpcColor = 5;
                        }
                        else if (LevelOffSet < 40)
                        {
                            NpcColor = 6;
                        }
                        else if (LevelOffSet < 75)
                        {
                            NpcColor = 7;
                        }
                        else if (LevelOffSet < 100)
                        {
                            NpcColor = 8;
                        }
                        else
                        {
                            NpcColor = 9;
                        }

                        switch (ActualNPC.GetGlobalNPC <ARPGGlobalNPC>().getRank)
                        {
                        case 0:
                            NpcColor--;
                            break;

                        case 2:
                        case 3:
                            NpcColor++;
                            break;

                        case 4:
                        case 5:
                            NpcColor += 2;
                            break;

                        case 6:
                        case 7:
                            NpcColor += 3;
                            break;
                        }

                        if (ActualNPC.townNPC)
                        {
                            NpcColor = 0;
                        }
                        NPCName.Add(new NPCInfoUI(TempText, ColorDic[NpcColor], new Vector2(ActualNPC.Bottom.X - Main.screenPosition.X, ActualNPC.Bottom.Y - Main.screenPosition.Y)));
                    }
                }
            }
        }