示例#1
0
        public static void Packet_Time(ref byte[] data)
        {
            ByteStream buffer = new ByteStream(data);

            Time.Instance.TimeOfDay = (TimeOfDay)buffer.ReadByte();

            if (Time.Instance.TimeOfDay == TimeOfDay.Dawn)
            {
                C_Text.AddText("A chilling, refreshing, breeze has come with the morning.", (System.Int32)Enums.ColorType.BrightBlue);
            }
            else if (Time.Instance.TimeOfDay == TimeOfDay.Day)
            {
                C_Text.AddText("Day has dawned in this region.", (System.Int32)Enums.ColorType.Yellow);
            }
            else if (Time.Instance.TimeOfDay == TimeOfDay.Dusk)
            {
                C_Text.AddText("Dusk has begun darkening the skies...", (System.Int32)Enums.ColorType.BrightRed);
            }
            else
            {
                C_Text.AddText("Night has fallen upon the weary travelers.", (System.Int32)Enums.ColorType.DarkGray);
            }

            buffer.Dispose();
        }
示例#2
0
 public void BtnMapReport_Click(object sender, EventArgs e)
 {
     if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Mapper)
     {
         C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
         return;
     }
     C_NetworkSend.SendRequestMapreport();
 }
示例#3
0
        public void BtnSpawnItem_Click(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Creator)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            C_NetworkSend.SendSpawnItem(System.Convert.ToInt32(cmbSpawnItem.SelectedIndex + 1), System.Convert.ToInt32(nudSpawnItemAmount.Value));
        }
示例#4
0
        public void BtnALoc_Click(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Mapper)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            C_Variables.BLoc = !C_Variables.BLoc;
        }
示例#5
0
        internal static void SendCraftIt(string recipeName, int amount)
        {
            ByteStream buffer      = new ByteStream(4);
            int        i           = 0;
            int        recipeindex = 0;

            recipeindex = GetRecipeIndex(recipeName);

            if (recipeindex <= 0)
            {
                return;
            }

            //check,check, double check

            //we dont even know the damn recipe xD
            if (C_Types.Player[C_Variables.Myindex].RecipeLearned[recipeindex] == 0)
            {
                return;
            }

            //enough ingredients
            for (i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                if (Recipe[recipeindex].Ingredients[i].ItemNum > 0 && C_Quest.HasItem(C_Variables.Myindex, Recipe[recipeindex].Ingredients[i].ItemNum) < (amount * Recipe[recipeindex].Ingredients[i].Value))
                {
                    C_Text.AddText(Strings.Get("crafting", "notenough"), (System.Int32)Enums.ColorType.Red);
                    return;
                }
            }

            //all seems fine...

            buffer.WriteInt32((System.Int32)Packets.ClientPackets.CStartCraft);

            buffer.WriteInt32(recipeindex);
            buffer.WriteInt32(amount);

            C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);

            buffer.Dispose();

            CraftTimer        = C_General.GetTickCount();
            CraftTimerEnabled = true;

            BtnCraftEnabled       = false;
            BtnCraftStopEnabled   = false;
            BtnCraftStopEnabled   = false;
            NudCraftAmountEnabled = false;
            LstRecipeEnabled      = false;
            ChkKnownOnlyEnabled   = false;
        }
示例#6
0
        public void BtnAdminBan_Click(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Mapper)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            if (Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(txtAdminName.Text)).Length < 1)
            {
                return;
            }

            C_NetworkSend.SendBan(Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(txtAdminName.Text)));
        }
示例#7
0
        public void BtnAdminSetSprite_Click(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Mapper)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            if (nudAdminSprite.Value < 1)
            {
                return;
            }

            C_NetworkSend.SendSetSprite(System.Convert.ToInt32(nudAdminSprite.Value));
        }
示例#8
0
        public void BtnAdminWarpTo_Click(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Mapper)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            // Check to make sure its a valid map #
            if (nudAdminMap.Value > 0 && nudAdminMap.Value <= Constants.MAX_MAPS)
            {
                C_NetworkSend.WarpTo(System.Convert.ToInt32(nudAdminMap.Value));
            }
            else
            {
                C_Text.AddText("Invalid map number.", (System.Int32)Enums.ColorType.BrightRed);
            }
        }
示例#9
0
        public void LstMaps_DoubleClick(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Mapper)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            // Check to make sure its a valid map #
            if (lstMaps.FocusedItem.Index + 1 > 0 && lstMaps.FocusedItem.Index + 1 <= Constants.MAX_MAPS)
            {
                C_NetworkSend.WarpTo(System.Convert.ToInt32(lstMaps.FocusedItem.Index + 1));
            }
            else
            {
                C_Text.AddText("Invalid map number: " + (lstMaps.FocusedItem.Index + 1), (System.Int32)Enums.QColorType.AlertColor);
            }
        }
示例#10
0
        public void BtnAdminSetAccess_Click(object sender, EventArgs e)
        {
            if (C_Player.GetPlayerAccess(C_Variables.Myindex) < (int)Enums.AdminType.Creator)
            {
                C_Text.AddText("You need to be a high enough staff member to do this!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            if (Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(txtAdminName.Text)).Length < 2)
            {
                return;
            }

            if (Information.IsNumeric(Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(txtAdminName.Text))) || cmbAccess.SelectedIndex < 0)
            {
                return;
            }

            C_NetworkSend.SendSetAccess(Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(txtAdminName.Text)), System.Convert.ToByte(cmbAccess.SelectedIndex));
        }
示例#11
0
        internal static void ForgetSkill(int skillslot)
        {
            ByteStream buffer = new ByteStream(4);

            // Check for subscript out of range
            if (skillslot < 1 || skillslot > Constants.MAX_PLAYER_SKILLS)
            {
                return;
            }

            // dont let them forget a skill which is in CD
            if (C_Variables.SkillCd[skillslot] > 0)
            {
                C_Text.AddText("Cannot forget a skill which is cooling down!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            // dont let them forget a skill which is buffered
            if (C_Variables.SkillBuffer == skillslot)
            {
                C_Text.AddText("Cannot forget a skill which you are casting!", (System.Int32)Enums.QColorType.AlertColor);
                return;
            }

            if (C_Variables.PlayerSkills[skillslot] > 0)
            {
                buffer.WriteInt32((System.Int32)Packets.ClientPackets.CForgetSkill);
                buffer.WriteInt32(skillslot);
                C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);
            }
            else
            {
                C_Text.AddText("No skill found.", (System.Int32)Enums.QColorType.AlertColor);
            }

            buffer.Dispose();
        }
示例#12
0
        public static void Packet_TradeStatus(ref byte[] data)
        {
            int        tradestatus = 0;
            ByteStream buffer      = new ByteStream(data);

            tradestatus = buffer.ReadInt32();

            switch (tradestatus)
            {
            case 0:                     // clear
                break;

            //frmMainGame.lblTradeStatus.Text = ""
            case 1:                     // they've accepted
                C_Text.AddText(Strings.Get("trade", "tradestatusok"), (System.Int32)Enums.ColorType.White);
                break;

            case 2:                     // you've accepted
                C_Text.AddText(Strings.Get("trade", "tradestatuswait"), (System.Int32)Enums.ColorType.White);
                break;
            }

            buffer.Dispose();
        }
示例#13
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;
            }
        }
示例#14
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);
                        }
                    }
                }
            }
        }
示例#15
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;
                }
            }
示例#16
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);
                    }
                }
            }
示例#17
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);
                        }
                    }
                }
            }