Ejemplo n.º 1
0
        internal static void DrawQuestLog()
        {
            int i = 0;
            int y = 0;

            y = 10;

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.QuestSprite, C_Graphics.GameWindow, QuestLogX, QuestLogY, 0, 0, C_Graphics.QuestGfxInfo.Width, C_Graphics.QuestGfxInfo.Height);

            //draw quest names
            for (i = 1; i <= MaxActivequests; i++)
            {
                if (QuestNames[i].Trim().Length > 0)
                {
                    C_Text.DrawText(QuestLogX + 7, QuestLogY + y, QuestNames[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                    y = y + 20;
                }
            }

            if (SelectedQuest <= 0)
            {
                return;
            }

            //quest log text
            y = 0;
            foreach (string str in C_Text.WordWrap(QuestTaskLogText.Trim(), 35, C_Text.WrapMode.Characters, C_Text.WrapType.BreakWord, 13))
            {
                //description
                C_Text.DrawText(QuestLogX + 204, QuestLogY + 30 + y, str, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }

            y = 0;
            foreach (string str in C_Text.WordWrap(ActualTaskText.Trim(), 40, C_Text.WrapMode.Characters, C_Text.WrapType.BreakWord, 13))
            {
                //description
                C_Text.DrawText(QuestLogX + 204, QuestLogY + 147 + y, str, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }

            y = 0;
            foreach (string str in C_Text.WordWrap(QuestDialogText.Trim(), 40, C_Text.WrapMode.Characters, C_Text.WrapType.BreakWord, 13))
            {
                //description
                C_Text.DrawText(QuestLogX + 204, QuestLogY + 218 + y, str, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }
            C_Text.DrawText(QuestLogX + 280, QuestLogY + 263, QuestStatus2Text.Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

            //DrawText(QuestLogX + 285, QuestLogY + 288, Trim$(QuestRequirementsText), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, GameWindow)

            y = 0;
            for (i = 1; i <= QuestRewardsText.Length - 1; i++)
            {
                //description
                C_Text.DrawText(QuestLogX + 255, QuestLogY + 292 + y, QuestRewardsText[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }
        }
Ejemplo n.º 2
0
        public static void DrawBank()
        {
            int       i       = 0;
            int       x       = 0;
            int       y       = 0;
            int       itemnum = 0;
            string    amount  = "";
            Rectangle sRect   = new Rectangle();
            Rectangle dRect   = new Rectangle();
            int       sprite  = 0;

            SFML.Graphics.Color colour = new SFML.Graphics.Color();

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.BankPanelSprite, C_Graphics.GameWindow, C_UpdateUI.BankWindowX, C_UpdateUI.BankWindowY, 0, 0, C_Graphics.BankPanelGfxInfo.Width, C_Graphics.BankPanelGfxInfo.Height);

            //Headertext
            C_Text.DrawText(C_UpdateUI.BankWindowX + 140, C_UpdateUI.BankWindowY + 6, "Your Bank", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            //close
            C_Text.DrawText(C_UpdateUI.BankWindowX + 140, C_UpdateUI.BankWindowY + C_Graphics.BankPanelGfxInfo.Height - 20, "Close Bank", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            for (i = 1; i <= Constants.MAX_BANK; i++)
            {
                itemnum = C_GameLogic.GetBankItemNum((byte)i);
                if (itemnum > 0 && itemnum <= Constants.MAX_ITEMS)
                {
                    sprite = Types.Item[itemnum].Pic;

                    if (C_Graphics.ItemsGfxInfo[sprite].IsLoaded == false)
                    {
                        C_Graphics.LoadTexture(sprite, (byte)4);
                    }

                    //seeying we still use it, lets update timer
                    ref var with_1 = ref C_Graphics.ItemsGfxInfo[sprite];
                    with_1.TextureTimer = C_General.GetTickCount() + 100000;

                    sRect.Y      = 0;
                    sRect.Height = C_Constants.PicY;
                    sRect.X      = 0;
                    sRect.Width  = C_Constants.PicX;

                    dRect.Y      = C_UpdateUI.BankWindowY + C_UpdateUI.BankTop + ((C_UpdateUI.BankOffsetY + 32) * ((i - 1) / C_UpdateUI.BankColumns));
                    dRect.Height = C_Constants.PicY;
                    dRect.X      = C_UpdateUI.BankWindowX + C_UpdateUI.BankLeft + ((C_UpdateUI.BankOffsetX + 32) * ((i - 1) % C_UpdateUI.BankColumns));
                    dRect.Width  = C_Constants.PicX;

                    C_Graphics.RenderSprite(C_Graphics.ItemsSprite[sprite], C_Graphics.GameWindow, dRect.X, dRect.Y, sRect.X, sRect.Y, sRect.Width, sRect.Height);

                    // If item is a stack - draw the amount you have
                    if (C_GameLogic.GetBankItemValue((byte)i) > 1)
                    {
                        y = dRect.Top + 22;
                        x = dRect.Left - 4;

                        amount = System.Convert.ToString(C_GameLogic.GetBankItemValue((byte)i));
                        colour = SFML.Graphics.Color.White;
                        // Draw currency but with k, m, b etc. using a convertion function
                        if (long.Parse(amount) < 1000000)
                        {
                            colour = SFML.Graphics.Color.White;
                        }
                        else if (long.Parse(amount) > 1000000 && long.Parse(amount) < 10000000)
                        {
                            colour = SFML.Graphics.Color.Yellow;
                        }
                        else if (long.Parse(amount) > 10000000)
                        {
                            colour = SFML.Graphics.Color.Green;
                        }

                        C_Text.DrawText(x, y, C_GameLogic.ConvertCurrency(System.Convert.ToInt32(amount)), colour, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                    }
                }
            }
Ejemplo n.º 3
0
        internal static void DrawParty()
        {
            int    I         = 0;
            int    x         = 0;
            int    y         = 0;
            int    barwidth  = 0;
            int    playerNum = 0;
            string theName   = "";

            Rectangle[] rec = new Rectangle[2];

            // render the window

            // draw the bars
            if (Party.Leader > 0)             // make sure we're in a party
            {
                // draw leader
                playerNum = Party.Leader;
                // name
                theName = C_Player.GetPlayerName(playerNum).Trim();
                // draw name
                y = 100;
                x = 10;
                C_Text.DrawText(x, y, theName, SFML.Graphics.Color.Yellow, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                // draw hp
                if (C_Types.Player[playerNum].Vital[(byte)Enums.VitalType.HP] > 0)
                {
                    // calculate the width to fill
                    barwidth = System.Convert.ToInt32(C_Types.Player[playerNum].Vital[(byte)Enums.VitalType.HP] / (C_Player.GetPlayerMaxVital(playerNum, Enums.VitalType.HP)) * 64);
                    // draw bars
                    rec[1] = new Rectangle(x, y, barwidth, 6);
                    RectangleShape rectShape = new RectangleShape(new Vector2f(barwidth, 6))
                    {
                        Position  = new Vector2f(x, y + 15),
                        FillColor = SFML.Graphics.Color.Red
                    };
                    C_Graphics.GameWindow.Draw(rectShape);
                }
                // draw mp
                if (C_Types.Player[playerNum].Vital[(byte)Enums.VitalType.MP] > 0)
                {
                    // calculate the width to fill
                    barwidth = System.Convert.ToInt32(C_Types.Player[playerNum].Vital[(byte)Enums.VitalType.MP] / (C_Player.GetPlayerMaxVital(playerNum, Enums.VitalType.MP)) * 64);
                    // draw bars
                    rec[1] = new Rectangle(x, y, barwidth, 6);
                    RectangleShape rectShape2 = new RectangleShape(new Vector2f(barwidth, 6))
                    {
                        Position  = new Vector2f(x, y + 24),
                        FillColor = SFML.Graphics.Color.Blue
                    };
                    C_Graphics.GameWindow.Draw(rectShape2);
                }

                // draw members
                for (I = 1; I <= Constants.MAX_PARTY_MEMBERS; I++)
                {
                    if (Party.Member[I] > 0)
                    {
                        if (Party.Member[I] != Party.Leader)
                        {
                            // cache the index
                            playerNum = Party.Member[I];
                            // name
                            theName = C_Player.GetPlayerName(playerNum).Trim();
                            // draw name
                            y = 100 + ((I - 1) * 30);

                            C_Text.DrawText(x, y, theName, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                            // draw hp
                            y = 115 + ((I - 1) * 30);

                            // make sure we actually have the data before rendering
                            if (C_Player.GetPlayerVital(playerNum, Enums.VitalType.HP) > 0 && C_Player.GetPlayerMaxVital(playerNum, Enums.VitalType.HP) > 0)
                            {
                                barwidth = System.Convert.ToInt32(C_Types.Player[playerNum].Vital[(byte)Enums.VitalType.HP] / (C_Player.GetPlayerMaxVital(playerNum, Enums.VitalType.HP)) * 64);
                            }
                            rec[1] = new Rectangle(x, y, barwidth, 6);
                            RectangleShape rectShape = new RectangleShape(new Vector2f(barwidth, 6))
                            {
                                Position  = new Vector2f(x, y),
                                FillColor = SFML.Graphics.Color.Red
                            };
                            C_Graphics.GameWindow.Draw(rectShape);
                            // draw mp
                            y = 115 + ((I - 1) * 30);
                            // make sure we actually have the data before rendering
                            if (C_Player.GetPlayerVital(playerNum, Enums.VitalType.MP) > 0 && C_Player.GetPlayerMaxVital(playerNum, Enums.VitalType.MP) > 0)
                            {
                                barwidth = System.Convert.ToInt32(C_Types.Player[playerNum].Vital[(byte)Enums.VitalType.MP] / (C_Player.GetPlayerMaxVital(playerNum, Enums.VitalType.MP)) * 64);
                            }
                            rec[1] = new Rectangle(x, y, barwidth, 6);
                            RectangleShape rectShape2 = new RectangleShape(new Vector2f(barwidth, 6))
                            {
                                Position  = new Vector2f(x, y + 8),
                                FillColor = SFML.Graphics.Color.Blue
                            };
                            C_Graphics.GameWindow.Draw(rectShape2);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public static void DrawTrade()
        {
            int       i       = 0;
            int       x       = 0;
            int       y       = 0;
            int       itemnum = 0;
            int       itempic = 0;
            string    amount  = "";
            Rectangle rec     = new Rectangle();
            Rectangle recPos  = new Rectangle();

            SFML.Graphics.Color colour = new SFML.Graphics.Color();

            amount = System.Convert.ToString(0);
            colour = SFML.Graphics.Color.White;

            if (!C_Variables.InGame)
            {
                return;
            }

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.TradePanelSprite, C_Graphics.GameWindow, C_UpdateUI.TradeWindowX, C_UpdateUI.TradeWindowY, 0, 0, C_Graphics.TradePanelGfxInfo.Width, C_Graphics.TradePanelGfxInfo.Height);

            //Headertext
            C_Text.DrawText(C_UpdateUI.TradeWindowX + 70, C_UpdateUI.TradeWindowY + 6, "Your Offer", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            C_Text.DrawText(C_UpdateUI.TradeWindowX + 260, C_UpdateUI.TradeWindowY + 6, C_UpdateUI.Tradername + "'s Offer.", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            for (i = 1; i <= Constants.MAX_INV; i++)
            {
                // blt your own offer
                itemnum = C_Player.GetPlayerInvItemNum(C_Variables.Myindex, TradeYourOffer[i].Num);

                if (itemnum > 0 && itemnum <= Constants.MAX_ITEMS)
                {
                    itempic = Types.Item[itemnum].Pic;

                    if (itempic > 0 && itempic <= C_Graphics.NumItems)
                    {
                        if (C_Graphics.ItemsGfxInfo[itempic].IsLoaded == false)
                        {
                            C_Graphics.LoadTexture(itempic, (byte)4);
                        }

                        //seeying we still use it, lets update timer
                        ref var with_1 = ref C_Graphics.ItemsGfxInfo[itempic];
                        with_1.TextureTimer = C_General.GetTickCount() + 100000;

                        rec.Y      = 0;
                        rec.Height = C_Constants.PicY;
                        rec.X      = 0;
                        rec.Width  = C_Constants.PicX;

                        recPos.Y      = C_UpdateUI.TradeWindowY + C_UpdateUI.OurTradeY + C_UpdateUI.InvTop + ((C_UpdateUI.InvOffsetY + 32) * ((i - 1) / C_UpdateUI.InvColumns));
                        recPos.Height = C_Constants.PicY;
                        recPos.X      = C_UpdateUI.TradeWindowX + C_UpdateUI.OurTradeX + C_UpdateUI.InvLeft + ((C_UpdateUI.InvOffsetX + 32) * ((i - 1) % C_UpdateUI.InvColumns));
                        recPos.Width  = C_Constants.PicX;

                        C_Graphics.RenderSprite(C_Graphics.ItemsSprite[itempic], C_Graphics.GameWindow, recPos.X, recPos.Y, rec.X, rec.Y, rec.Width, rec.Height);

                        // If item is a stack - draw the amount you have
                        if (TradeYourOffer[i].Value >= 1)
                        {
                            y = recPos.Top + 22;
                            x = recPos.Left - 4;

                            // Draw currency but with k, m, b etc. using a convertion function
                            if (double.Parse(amount) < 1000000)
                            {
                                colour = SFML.Graphics.Color.White;
                            }
                            else if (double.Parse(amount) > 1000000 && long.Parse(amount) < 10000000)
                            {
                                colour = SFML.Graphics.Color.Yellow;
                            }
                            else if (double.Parse(amount) > 10000000)
                            {
                                colour = SFML.Graphics.Color.Green;
                            }

                            amount = System.Convert.ToString(TradeYourOffer[i].Value);
                            C_Text.DrawText(x, y, C_GameLogic.ConvertCurrency(System.Convert.ToInt32(amount)), colour, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                        }
                    }
                }
            }
Ejemplo n.º 5
0
        internal static void DrawCraftPanel()
        {
            int       i        = 0;
            int       y        = 0;
            Rectangle rec      = new Rectangle();
            int       pgbvalue = 0;

            for (i = 1; i <= Constants.MAX_RECIPE; i++)
            {
                if (RecipeNames[i] == null)
                {
                    RecipeNames[i] = "";
                }
            }

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.CraftSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX, C_UpdateUI.CraftPanelY, 0, 0, C_Graphics.CraftGfxInfo.Width, C_Graphics.CraftGfxInfo.Height);

            y = 10;

            //draw recipe names
            for (i = 1; i <= Constants.MAX_RECIPE; i++)
            {
                if (RecipeNames[i].Trim().Length > 0)
                {
                    C_Text.DrawText(C_UpdateUI.CraftPanelX + 12, C_UpdateUI.CraftPanelY + y, RecipeNames[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                    y = y + 20;
                }
            }

            //progress bar
            pgbvalue = (int)(((double)CraftProgressValue / 100) * 100);

            rec.Y      = 0;
            rec.Height = C_Graphics.ProgBarGfxInfo.Height;
            rec.X      = 0;
            rec.Width  = (int)((double)pgbvalue * C_Graphics.ProgBarGfxInfo.Width / 100);

            C_Graphics.RenderSprite(C_Graphics.ProgBarSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 410, C_UpdateUI.CraftPanelY + 417, rec.X, rec.Y, rec.Width, rec.Height);

            //amount controls
            C_Graphics.RenderSprite(C_Graphics.CharPanelMinSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 340, C_UpdateUI.CraftPanelY + 422, 0, 0, C_Graphics.CharPanelMinGfxInfo.Width, C_Graphics.CharPanelMinGfxInfo.Height);

            C_Text.DrawText(C_UpdateUI.CraftPanelX + 367, C_UpdateUI.CraftPanelY + 418, Microsoft.VisualBasic.Strings.Trim(CraftAmountValue.ToString()), SFML.Graphics.Color.Black, SFML.Graphics.Color.White, C_Graphics.GameWindow);

            C_Graphics.RenderSprite(C_Graphics.CharPanelPlusSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 392, C_UpdateUI.CraftPanelY + 422, 0, 0, C_Graphics.CharPanelPlusGfxInfo.Width, C_Graphics.CharPanelPlusGfxInfo.Height);

            if (SelectedRecipe == 0)
            {
                return;
            }

            if (PicProductindex > 0)
            {
                if (C_Graphics.ItemsGfxInfo[PicProductindex].IsLoaded == false)
                {
                    C_Graphics.LoadTexture(PicProductindex, (byte)4);
                }

                //seeying we still use it, lets update timer
                C_Graphics.ItemsGfxInfo[PicProductindex].TextureTimer = C_General.GetTickCount() + 100000;

                C_Graphics.RenderSprite(C_Graphics.ItemsSprite[PicProductindex], C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 267, C_UpdateUI.CraftPanelY + 20, 0, 0, C_Graphics.ItemsGfxInfo[PicProductindex].Width, C_Graphics.ItemsGfxInfo[PicProductindex].Height);

                C_Text.DrawText(C_UpdateUI.CraftPanelX + 310, C_UpdateUI.CraftPanelY + 20, LblProductNameText.Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                C_Text.DrawText(C_UpdateUI.CraftPanelX + 310, C_UpdateUI.CraftPanelY + 35, LblProductAmountText.Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
            }

            y = 107;

            for (i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                if (PicMaterialIndex[i] > 0)
                {
                    if (C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]].IsLoaded == false)
                    {
                        C_Graphics.LoadTexture(PicMaterialIndex[i], (byte)4);
                    }

                    //seeying we still use it, lets update timer
                    ref var with_3 = ref C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]];
                    with_3.TextureTimer = C_General.GetTickCount() + 100000;

                    C_Graphics.RenderSprite(C_Graphics.ItemsSprite[PicMaterialIndex[i]], C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 275, C_UpdateUI.CraftPanelY + y, 0, 0, C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]].Width, C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]].Height);

                    C_Text.DrawText(C_UpdateUI.CraftPanelX + 315, C_UpdateUI.CraftPanelY + y, LblMaterialName[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                    C_Text.DrawText(C_UpdateUI.CraftPanelX + 315, C_UpdateUI.CraftPanelY + y + 15, LblMaterialAmount[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                    y = y + 63;
                }
            }