예제 #1
0
        protected override void Draw(SpriteBatch spriteBatch)
        {
            int num  = -1;
            int num2 = 11;

            for (int i = 0; i < 22; i++)
            {
                if (Player.buffType[i] > 0)
                {
                    int b    = Player.buffType[i];
                    int x    = 320 + i * 38;
                    int num3 = 8;
                    if (i >= num2)
                    {
                        x     = 32 + (i - num2) * 38;
                        num3 += 50;
                    }
                    num = (int)DrawBuffIcon.Invoke(null, new object[] { num, i, b, x, num3 }); // Main.DrawBuffIcon(num, i, b, x, num3);
                }
                else
                {
                    Main.buffAlpha[i] = 0.4f;
                }
            }
            if (num >= 0)
            {
                int num4 = Player.buffType[num];
                if (num4 > 0)
                {
                    Main.buffString = Lang.GetBuffDescription(num4);
                    int itemRarity = 0;
                    if (num4 == 26 && Main.expertMode)
                    {
                        Main.buffString = Language.GetTextValue("BuffDescription.WellFed_Expert");
                    }
                    if (num4 == 147)
                    {
                        Main.bannerMouseOver = true;
                    }
                    if (num4 == 94)
                    {
                        int num5 = (int)(Player.manaSickReduction * 100f) + 1;
                        Main.buffString = Main.buffString + num5 + "%";
                    }
                    if (Main.meleeBuff[num4])
                    {
                        itemRarity = -10;
                    }
                    BuffLoader.ModifyBuffTip(num4, ref Main.buffString, ref itemRarity);
                    Main.instance.MouseTextHackZoom(Lang.GetBuffName(num4), itemRarity, 0);
                }
            }
        }
예제 #2
0
        internal void SetInfo(int buffid, string name, string effect, Texture2D texture)
        {
            costPanel.children.Clear();
            this.buffName.SetText(name);
            this.buffIcon.SetImage(texture);


            var buffdesc = Lang.GetBuffDescription(buffid);

            int itemRarity = 0;

            if (Main.meleeBuff[buffid])
            {
                itemRarity = -10;
            }

            BuffLoader.ModifyBuffTip(buffid, ref buffdesc, ref itemRarity);
            this.buffEffect.SetText(buffdesc);
            lv.Recalculate();
        }
예제 #3
0
파일: StatusBar.cs 프로젝트: TNTftw21/kRPG
        public static void DrawBuffs()
        {
            const int leftOffset = 320;
            const int iconWidth  = 38;
            const int maxSlots   = 21;

            int       buffTypeId = -1;
            const int secondRowOfBuffsStartIndex = 11;

            for (int buffSlot = 0; buffSlot <= maxSlots; buffSlot++)
            {
                if (Main.player[Main.myPlayer].buffType[buffSlot] > 0)
                {
                    int buff      = Main.player[Main.myPlayer].buffType[buffSlot];
                    int xPosition = leftOffset + buffSlot * iconWidth;

                    int yPosition = 8; //The y offset for the first row...

                    if (buffSlot >= secondRowOfBuffsStartIndex)
                    {
                        xPosition  = 32 + (buffSlot - secondRowOfBuffsStartIndex) * iconWidth;
                        yPosition += 50; //put icon on second row.
                    }

                    buffTypeId = (int)DrawBuffIcon.Invoke(null,
                                                          new object[] { buffTypeId, buffSlot, buff, xPosition, yPosition }); // Main.DrawBuffIcon(num, i, b, x, num3);
                }
                else
                {
                    Main.buffAlpha[buffSlot] = 0.4f;
                }
            }

            if (buffTypeId < 0)
            {
                return;
            }

            int buffId = Main.player[Main.myPlayer].buffType[buffTypeId];

            if (buffId <= 0)
            {
                return;
            }

            Main.buffString = Lang.GetBuffDescription(buffId);

            int itemRarity = 0;

            switch ((VanillaBuffId)buffId)
            {
            case VanillaBuffId.WellFed when Main.expertMode:
                Main.buffString = Language.GetTextValue("BuffDescription.WellFed_Expert");
                break;

            case VanillaBuffId.MonsterBanner:
                Main.bannerMouseOver = true;
                break;

            case VanillaBuffId.ManaSickness:
            {
                int percent = (int)(Main.player[Main.myPlayer].manaSickReduction * 100f) + 1;
                Main.buffString = Main.buffString + percent + "%";
                break;
            }
            }

            if (Main.meleeBuff[buffId])
            {
                itemRarity = -10;
            }

            BuffLoader.ModifyBuffTip(buffId, ref Main.buffString, ref itemRarity);

            Main.instance.MouseTextHackZoom(Lang.GetBuffName(buffId), itemRarity);
        }
예제 #4
0
        internal void SetInfo(CostValue[] cost, int buffid, string name, string effect, Texture2D texture)
        {
            costPanel.children.Clear();
            var costtopLabel = new UIText("Cost");

            costtopLabel.TextColor = new Color(232, 181, 16);
            costPanel.children.Add(new LayoutElementWrapperUIElement(costtopLabel));

            foreach (var v in cost)
            {
                if (v.GetType() == typeof(ItemCostValue))
                {
                    var ll       = new Layout(0, 0, 0, 0, 10, new LayoutHorizontal());
                    var costIcon = new UIImage(Main.itemTexture[((ItemCostValue)v).itemid]);
                    costIcon.Height.Set(20, 0);
                    ll.children.Add(new LayoutElementWrapperUIElement(costIcon));

                    var costcountLabel = new UIText("x" + ((ItemCostValue)v).count);
                    costcountLabel.TextColor = new Color(232, 181, 16);
                    ll.children.Add(new LayoutElementWrapperUIElement(costcountLabel));

                    var costnamelabel = new UIText(((ItemCostValue)v).itemname);
                    costnamelabel.TextColor = new Color(232, 181, 16);
                    ll.children.Add(new LayoutElementWrapperUIElement(costnamelabel));

                    costPanel.children.Add(ll);
                }
                else if (v.GetType() == typeof(MoneyCostValue))
                {
                    var ll    = new Layout(0, 0, 0, 0, 10, new LayoutHorizontal());
                    var money = ((MoneyCostValue)v).cost;
                    for (int i = 4; i >= 1; i--)
                    {
                        int mcount = (int)(money / Math.Pow(100, i - 1));
                        money = (money % ((int)Math.Pow(100, i - 1)));
                        if (mcount > 0)
                        {
                            var costIcon = new UIImage(Main.itemTexture[70 + i]);
                            costIcon.Height.Set(20, 0);
                            ll.children.Add(new LayoutElementWrapperUIElement(costIcon));

                            var costcountLabel = new UIText("x" + mcount);
                            costcountLabel.TextColor = new Color(232, 181, 16);
                            ll.children.Add(new LayoutElementWrapperUIElement(costcountLabel));
                        }
                    }
                    costPanel.children.Add(ll);
                }
            }



            this.buffName.SetText(name);
            this.buffIcon.SetImage(texture);
            var buffdesc = Lang.GetBuffDescription(buffid);

            int itemRarity = 0;

            if (Main.meleeBuff[buffid])
            {
                itemRarity = -10;
            }

            BuffLoader.ModifyBuffTip(buffid, ref buffdesc, ref itemRarity);
            this.buffEffect.SetText(buffdesc);
            lv.Recalculate();
        }
예제 #5
0
        private void DrawInterface_Resources_Buffs()
        {
            int BuffID = -1;
            int num2   = 11;

            for (int i = 0; i < 22; i++)
            {
                if (Main.player[Main.myPlayer].buffType[i] > 0)
                {
                    int b    = Main.player[Main.myPlayer].buffType[i];
                    int x    = 32 + i * 38;
                    int num3 = 76;
                    if (i >= num2)
                    {
                        x     = 32 + (i - num2) * 38;
                        num3 += 50;
                    }
                    BuffID = DrawBuffIcon(BuffID, i, b, x, num3);
                }
                else
                {
                    Main.buffAlpha[i] = 0.4f;
                }
            }
            if (BuffID >= 0)
            {
                int num4 = Main.player[Main.myPlayer].buffType[BuffID];
                if (num4 > 0)
                {
                    Main.buffString = Lang.GetBuffDescription(num4);
                    int itemRarity = 0;
                    if (num4 == 26 && Main.expertMode)
                    {
                        Main.buffString = Language.GetTextValue("BuffDescription.WellFed_Expert");
                    }
                    if (num4 == 147)
                    {
                        Main.bannerMouseOver = true;
                    }
                    if (num4 == 94)
                    {
                        int num5 = (int)(Main.player[Main.myPlayer].manaSickReduction * 100f) + 1;
                        Main.buffString = Main.buffString + num5 + "%";
                    }
                    if (Main.meleeBuff[num4])
                    {
                        itemRarity = -10;
                    }
                    BuffLoader.ModifyBuffTip(num4, ref Main.buffString, ref itemRarity);
                }
            }



            int DrawBuffIcon(int drawBuffText, int i, int b, int x, int y)
            {
                //IL_011b: Unknown result type (might be due to invalid IL or missing references)
                if (b == 0)
                {
                    return(drawBuffText);
                }
                Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(Main.buffAlpha[i], Main.buffAlpha[i], Main.buffAlpha[i], Main.buffAlpha[i]);
                Main.spriteBatch.Draw(Main.buffTexture[b], new Vector2((float)x, (float)y), new Microsoft.Xna.Framework.Rectangle(0, 0, Main.buffTexture[b].Width, Main.buffTexture[b].Height), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                if (!Main.vanityPet[b] && !Main.lightPet[b] && !Main.buffNoTimeDisplay[b] && (!Main.player[Main.myPlayer].honeyWet || b != 48) && (!Main.player[Main.myPlayer].wet || !Main.expertMode || b != 46) && Main.player[Main.myPlayer].buffTime[i] > 2)
                {
                    string text = Lang.LocalizedDuration(new TimeSpan(0, 0, Main.player[Main.myPlayer].buffTime[i] / 60), true, false);
                    DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontItemStack, text, new Vector2((float)x, (float)(y + Main.buffTexture[b].Height)), color, 0f, default(Vector2), 0.8f, SpriteEffects.None, 0f);
                }
                if (Main.mouseX < x + Main.buffTexture[b].Width && Main.mouseY <y + Main.buffTexture[b].Height && Main.mouseX> x && Main.mouseY > y)
                {
                    drawBuffText       = i;
                    Main.buffAlpha[i] += 0.1f;
                    bool flag = Main.mouseRight && Main.mouseRightRelease;
                    if (PlayerInput.UsingGamepad)
                    {
                        flag = (Main.mouseLeft && Main.mouseLeftRelease && Main.playerInventory);
                        if (Main.playerInventory)
                        {
                            Main.player[Main.myPlayer].mouseInterface = true;
                        }
                    }
                    else
                    {
                        Main.player[Main.myPlayer].mouseInterface = true;
                    }
                    if (flag)
                    {
                        TryRemovingBuff(i, b);
                    }
                }
                else
                {
                    Main.buffAlpha[i] -= 0.05f;
                }
                if (Main.buffAlpha[i] > 1f)
                {
                    Main.buffAlpha[i] = 1f;
                }
                else if ((double)Main.buffAlpha[i] < 0.4)
                {
                    Main.buffAlpha[i] = 0.4f;
                }
                if (PlayerInput.UsingGamepad && !Main.playerInventory)
                {
                    drawBuffText = -1;
                }
                return(drawBuffText);
            }

            void TryRemovingBuff(int i, int b)
            {
                bool flag = false;

                if (!Main.debuff[b] && b != 60 && b != 151)
                {
                    if (Main.player[Main.myPlayer].mount.Active && Main.player[Main.myPlayer].mount.CheckBuff(b))
                    {
                        Main.player[Main.myPlayer].mount.Dismount(Main.player[Main.myPlayer]);
                        flag = true;
                    }
                    if (Main.player[Main.myPlayer].miscEquips[0].buffType == b && !Main.player[Main.myPlayer].hideMisc[0])
                    {
                        Main.player[Main.myPlayer].hideMisc[0] = true;
                    }
                    if (Main.player[Main.myPlayer].miscEquips[1].buffType == b && !Main.player[Main.myPlayer].hideMisc[1])
                    {
                        Main.player[Main.myPlayer].hideMisc[1] = true;
                    }
                    Main.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f);
                    if (!flag)
                    {
                        Main.player[Main.myPlayer].DelBuff(i);
                    }
                }
            }
        }
        // Decompiled code
        public static void DrawInterface_Resources_Buffs()
        {
            Main.recBigList = false;
            int num  = -1;
            int num2 = 11;

            int offsetCount = 0;

            for (int i = 0; i < Player.MaxBuffs; i++)
            {
                var buffType = Main.player[Main.myPlayer].buffType[i];


                if (buffType > 0)
                {
                    if (!BuffIsToggable(buffType))
                    {
                        int b    = buffType;
                        int x    = 32 + offsetCount * 38;
                        int num3 = 76;
                        if (offsetCount >= num2)
                        {
                            x     = 32 + Math.Abs(offsetCount % 11) * 38;
                            num3 += 50 * (offsetCount / 11);
                        }

                        num = DrawBuffIcon(num, i, b, x, num3);

                        offsetCount++;
                    }
                }
                else
                {
                    Main.buffAlpha[i] = 0.4f;
                }
            }

            if (num < 0)
            {
                return;
            }

            int num4 = Main.player[Main.myPlayer].buffType[num];

            if (num4 > 0)
            {
                Main.buffString = Lang.GetBuffDescription(num4);
                if (num4 == 26 && Main.expertMode)
                {
                    Main.buffString = Language.GetTextValue("BuffDescription.WellFed_Expert");
                }

                if (num4 == 147)
                {
                    Main.bannerMouseOver = true;
                }

                if (num4 == 94)
                {
                    int num5 = (int)(Main.player[Main.myPlayer].manaSickReduction * 100f) + 1;
                    Main.buffString = Main.buffString + num5 + "%";
                }

                int rare = Main.meleeBuff[num4] ? -10 : 0;
                BuffLoader.ModifyBuffTip(num4, ref Main.buffString, ref rare);
                Main.instance.MouseTextHackZoom(Lang.GetBuffName(num4), rare);
            }
        }