public static Bitmap Render_Message_Window(UserInfoFields account) { int template_width = 320; int template_height = 240; Bitmap base_template = new Bitmap(template_width, template_height); Bitmap window_frame = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//frame.png"); Bitmap wallpaper = new Bitmap(template_width, template_height); switch (account.P2EP_PSX_TS_Wallpaper) { case "Blue Tone": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//1.png"); break; case "Sepia Tone": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//2.png"); break; case "Purple Tone": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//3.png"); break; case "Seventh": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//4.png"); break; case "Baofu": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//5.png"); break; case "NWO": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//6.png"); break; case "Dragon": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//7.png"); break; case "Jack Frost": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//8.png"); break; case "Grid": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//9.png"); break; case "Star": wallpaper = (Bitmap)System.Drawing.Image.FromFile($@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//P2EP-PS1//Wallpaper//10.png"); break; } using (Graphics graphics = Graphics.FromImage(base_template)) { graphics.DrawImage(wallpaper, 0, 0, wallpaper.Width, wallpaper.Height); graphics.DrawImage(window_frame, 0, 0, window_frame.Width, window_frame.Height); } return(base_template); }
public void SetFieldErrorToolTip(UserInfoFields field, string message) { switch (field) { case UserInfoFields.UserName: this.pbUserNameTip.Visible = true; this.wrongTip.SetToolTip(this.pbUserNameTip, message); break; case UserInfoFields.FullName: this.pbFullNameTip.Visible = true; this.wrongTip.SetToolTip(this.pbFullNameTip, message); break; case UserInfoFields.Password: this.pbPasswordTip.Visible = true; this.wrongTip.SetToolTip(this.pbPasswordTip, message); break; case UserInfoFields.ConfirmPassword: this.pbConfirmPasswordTip.Visible = true; this.wrongTip.SetToolTip(this.pbConfirmPasswordTip, message); break; case UserInfoFields.Role: this.pbRoleTip.Visible = true; this.wrongTip.SetToolTip(this.pbRoleTip, message); break; default: break; } }
public static Bitmap CombineSocialStatRankBitmaps(UserInfoFields account) { Bitmap base_bitmap = new Bitmap(template_width, template_height); System.Drawing.Color tms_yellow = System.Drawing.Color.FromArgb(255, 255, 3); int area_x = 357; int area_y = 824; int area_width = 488; int area_height = 859; using (Graphics graphics = Graphics.FromImage(base_bitmap)) { graphics.DrawImage(RenderRankBarLayer(account), 0, 0, template_width, template_height); graphics.DrawImage(RenderRankProgressBar(account, "Proficiency", 357, 589), 0, 0, template_width, template_height); graphics.DrawImage(RenderRankProgressBar(account, "Diligence", 357, 743), 0, 0, template_width, template_height); graphics.DrawImage(RenderRankProgressBar(account, "Expression", 357, 897), 0, 0, template_width, template_height); graphics.DrawImage(KeepOverlapWithMatchedColor(base_bitmap, CreateMaxRankShineBitmap("Proficiency"), tms_yellow, area_x, area_y, area_width, area_height), 0, 0, template_width, template_height); graphics.DrawImage(KeepOverlapWithMatchedColor(base_bitmap, CreateMaxRankShineBitmap("Diligence"), tms_yellow, area_x, area_y, area_width, area_height), 0, 0, template_width, template_height); graphics.DrawImage(KeepOverlapWithMatchedColor(base_bitmap, CreateMaxRankShineBitmap("Expression"), tms_yellow, area_x, area_y, area_width, area_height), 0, 0, template_width, template_height); } return(base_bitmap); }
public static BustupData Get_Bustup_Data(UserInfoFields account, OfficialSetData set_data, MakerCommandData command_data) { // Create variables for the folder and JSON that contains the data for the set. string data_folder = $@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Data//Template_Data//{set_data.Origin}//Bustup//{set_data.ID}"; string data_sheet = "bustup_data.json"; // If the file folder doesn't exist, create it. if (!Directory.Exists(data_folder)) { Directory.CreateDirectory(data_folder); } // If the file exists at the specified directory, load its contents. if (File.Exists(data_folder + "/" + data_sheet)) { // Load the data sheet for the selected sprite set. bustup_data_list = Load_Bustup_Data_List(data_folder + "/" + data_sheet).ToList(); // START /* Console.WriteLine("Copying data..."); * * string data_path = $@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Data//Template_Data//{set_data.Origin}//Bustup//{set_data.ID}//bustup_data.json"; * * foreach (BustupData s in bustup_data_list) * { * s.P5S_Coord_X = s.P5R_Coord_X; * s.P5S_Coord_Y = s.P5R_Coord_Y; * s.P5S_Scale_Width = s.P5R_Scale_Width; * s.P5S_Scale_Height = s.P5R_Scale_Height; * } * * try * { * string json = JsonConvert.SerializeObject(bustup_data_list, Formatting.Indented); * File.WriteAllText(data_path, json); * } * catch (Exception e) * { * Console.WriteLine($"'{e}'"); * } * * Console.WriteLine("Copy complete!"); */ // END // Find the filename of the bustup that the user has selected. string bustup_filename = Get_Bustup_Filename(account, set_data, command_data); // Return the bustup data info by using its filename to search for its entry. return(Bustup_Data_From_Filename(bustup_filename)); } else { Create_Bustup_Data_List(set_data); return(Get_Bustup_Data(account, set_data, command_data)); } }
public static List <string> ParseContentFilter(UserInfoFields account) { //Create a list variable to return List <string> input_substring; //Specify the characters to divide the incoming string by char[] delimiterChars = { ';' }; //Assign the return value to the input account's content filter string with its entries split into a list input_substring = account.Content_Filter.Split(delimiterChars).ToList(); return(input_substring); }
public static List <string> ParseContentFilter(UserInfoFields account) { //Create a list variable to return List <string> input_substring; //Specify the characters to divide the incoming string by char[] delimiterChars = { ';' }; //Assign the return value to the input account's content filter string with its entries split into a list input_substring = account.Content_Filter.Split(delimiterChars).ToList(); // There may be times when an empty string is parsed into the list, so make sure they are removed before returning. input_substring.RemoveAll(s => s == ""); return(input_substring); }
public static string Get_Profile_Config_Thumbnail(UserInfoFields account) { // Based on the account's settings, return a thumbnail to be used on embedded menu messages. switch (account.Profile_Theme) { case "P3": return("https://i.imgur.com/7xnoaQ7.png"); case "P4": return("https://i.imgur.com/4vtG4On.png"); case "P5": return("https://i.imgur.com/bVSsGsA.png"); default: return(""); } }
public static string Get_Profile_Help_Thumbnail(UserInfoFields account) { // Based on the account's settings, return a thumbnail to be used on embedded menu messages. switch (account.Profile_Theme) { case "P3": return("https://i.imgur.com/CguM1ql.png"); case "P4": return("https://i.imgur.com/PW7VtuB.png"); case "P5": return("https://i.imgur.com/tubdL8K.png"); default: return(""); } }
//Misc public static Color Get_Profile_Embed_Color(UserInfoFields account) { // Based on the account's settings, return a color to be used on embedded menu messages. switch (account.Profile_Theme) { case "P3": return(new Color(37, 149, 255)); case "P4": return(new Color(255, 229, 49)); case "P5": return(new Color(213, 27, 4)); default: return(new Color(0, 0, 0)); } }
public static Bitmap Render_Bustup(UserInfoFields account, BustupData bustup_data, Bitmap bustup) { int template_width = 320; int template_height = 240; Bitmap base_template = new Bitmap(template_width, template_height); using (Graphics graphics = Graphics.FromImage(base_template)) { switch (account.P2EP_PSX_TS_Position) { case "Default": switch (bustup_data.P2EP_PSX_Default_Position) { case "Left": graphics.DrawImage(bustup, bustup_data.P2EP_PSX_Left_Coord_X, bustup_data.P2EP_PSX_Left_Coord_Y, bustup_data.P2EP_PSX_Scale_Width, bustup_data.P2EP_PSX_Scale_Height); break; case "Center": graphics.DrawImage(bustup, bustup_data.P2EP_PSX_Center_Coord_X, bustup_data.P2EP_PSX_Center_Coord_Y, bustup_data.P2EP_PSX_Scale_Width, bustup_data.P2EP_PSX_Scale_Height); break; case "Right": graphics.DrawImage(bustup, bustup_data.P2EP_PSX_Right_Coord_X, bustup_data.P2EP_PSX_Right_Coord_Y, bustup_data.P2EP_PSX_Scale_Width, bustup_data.P2EP_PSX_Scale_Height); break; } break; case "Negotiation": graphics.DrawImage(bustup, bustup_data.P2EP_PSX_Right_Coord_X, bustup_data.P2EP_PSX_Right_Coord_Y, bustup_data.P2EP_PSX_Scale_Width, bustup_data.P2EP_PSX_Scale_Height); break; } } return(base_template); }
public static string Get_Loading_Icon(string title, UserInfoFields account) { // Return a thumbnail to be used on embedded menu messages. switch (title) { case "P1-PS1": return("https://i.imgur.com/Lv794ze.png"); case "P1-PSP": return("https://i.imgur.com/Czvm3H6.gif"); case "P2IS-PS1": return(""); case "P2IS-PSP": return("https://i.imgur.com/FrGz5rP.gif"); case "P2EP-PS1": return(""); case "P2EP-PSP": return(""); case "P3F": return("https://i.imgur.com/VwI3i20.gif"); case "P3P": switch (account.P3P_TS_Color) { case "Male Protagonist": return("https://i.imgur.com/VwI3i20.gif"); case "Female Protagonist": return("https://i.imgur.com/pkb4OJa.gif"); default: return("https://i.imgur.com/VwI3i20.gif"); } case "P4-PS2": return("https://i.imgur.com/Nr5mEap.gif"); case "P4G": return("https://i.imgur.com/8FOF81K.gif"); case "P4AU": return("https://i.imgur.com/fHHawut.gif"); case "P4D": return(Randomize_P4D_Gif()); case "P5-PS4": return("https://i.imgur.com/PYMB6XG.gif"); case "P5R": return("https://i.imgur.com/PYMB6XG.gif"); case "P5S": return("https://i.imgur.com/IkrlV0c.gif"); case "BBTAG": return("https://i.imgur.com/f6dSxc1.gif"); default: return("https://i.imgur.com/NtqQju4.gif"); } }
public static Bitmap RenderFont(SocketUser user, UserInfoFields account) { Bitmap base_bitmap = new Bitmap(template_width, template_height); System.Drawing.Color tms_text_green = System.Drawing.Color.FromArgb(152, 254, 30); SolidBrush tms_text_green_brush = new SolidBrush(tms_text_green); System.Drawing.Color tms_text_yellow = System.Drawing.Color.FromArgb(255, 255, 3); SolidBrush tms_text_yellow_brush = new SolidBrush(tms_text_yellow); using (Graphics graphics = Graphics.FromImage(base_bitmap)) { graphics.TextRenderingHint = TextRenderingHint.AntiAlias; StringFormat stringFormat = new StringFormat(); Rectangle class_title_window = new Rectangle(52, 30, 700, 41); Rectangle level_window = new Rectangle(1785, 109, 117, 82); Rectangle username_window = new Rectangle(221, 1012, 1450, 40); Rectangle remaining_exp_window = new Rectangle(85, 236, 268, 48); Rectangle pmedal_window = new Rectangle(113, 375, 529, 54); Rectangle proficiency_rank_window = new Rectangle(268, 522, 85, 44); Rectangle proficiency_next_window = new Rectangle(218, 567, 135, 44); Rectangle diligence_rank_window = new Rectangle(268, 676, 85, 44); Rectangle diligence_next_window = new Rectangle(238, 721, 115, 44); Rectangle expression_rank_window = new Rectangle(268, 830, 85, 44); Rectangle expression_next_window = new Rectangle(218, 875, 135, 44); using (Font neology_deco = new Font("NeologyDecoW03-Regular", 23)) { stringFormat.Alignment = StringAlignment.Near; graphics.DrawString($"{user.Username}'s status.", neology_deco, Brushes.White, username_window, stringFormat); } Font arial_bold = new Font("Arial", 64, FontStyle.Bold); if (account.Level < 10) { arial_bold = new Font("Arial", 64, FontStyle.Bold); } else { arial_bold = new Font("Arial", 58, FontStyle.Bold); } using (arial_bold) { stringFormat.Alignment = StringAlignment.Center; graphics.DrawString($"{account.Level}", arial_bold, tms_text_green_brush, level_window, stringFormat); } int next_level_total_exp_required = LevelSystem.Leveling.CalculateExp(account.Level + 1); int required_exp = next_level_total_exp_required - account.Total_Exp; using (Font lucida_sans = new Font("Lucida Sans Unicode", 30)) { stringFormat.Alignment = StringAlignment.Far; graphics.DrawString($"{required_exp}", lucida_sans, Brushes.White, remaining_exp_window, stringFormat); } using (Font lucida_sans = new Font("Lucida Sans Unicode", 30)) { stringFormat.Alignment = StringAlignment.Near; graphics.DrawString($"{account.P_Medals}", lucida_sans, Brushes.White, pmedal_window, stringFormat); } // Social stats int proficiency_rank = LevelSystem.SocialStats.CalculateProficiencyRank(account.Proficiency); int diligence_rank = LevelSystem.SocialStats.CalculateDiligenceRank(account.Diligence); int expression_rank = LevelSystem.SocialStats.CalculateExpressionRank(account.Expression); int proficiency_left_to_rank_up = Get_Base_Proficiency_Of_Next_Rank(proficiency_rank) - account.Proficiency; int diligence_left_to_rank_up = Get_Base_Diligence_Of_Next_Rank(diligence_rank) - account.Diligence; int expression_left_to_rank_up = Get_Base_Expression_Of_Next_Rank(expression_rank) - account.Expression; using (Font neology_deco = new Font("NeologyDecoW03-Regular", 21)) { stringFormat.Alignment = StringAlignment.Near; graphics.DrawString($"{Get_Class_Title(proficiency_rank, diligence_rank, expression_rank)}", neology_deco, Brushes.Black, class_title_window, stringFormat); } using (Font lucida_sans = new Font("Lucida Sans Unicode", 30)) { stringFormat.Alignment = StringAlignment.Far; // Draw text to screen if (proficiency_rank == 5) { graphics.DrawString($"{proficiency_rank}", lucida_sans, tms_text_yellow_brush, proficiency_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(proficiency_left_to_rank_up)}", lucida_sans, tms_text_yellow_brush, proficiency_next_window, stringFormat); } else { graphics.DrawString($"{proficiency_rank}", lucida_sans, Brushes.White, proficiency_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(proficiency_left_to_rank_up)}", lucida_sans, Brushes.White, proficiency_next_window, stringFormat); } if (diligence_rank == 5) { graphics.DrawString($"{diligence_rank}", lucida_sans, tms_text_yellow_brush, diligence_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(diligence_left_to_rank_up)}", lucida_sans, tms_text_yellow_brush, diligence_next_window, stringFormat); } else { graphics.DrawString($"{diligence_rank}", lucida_sans, Brushes.White, diligence_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(diligence_left_to_rank_up)}", lucida_sans, Brushes.White, diligence_next_window, stringFormat); } if (expression_rank == 5) { graphics.DrawString($"{expression_rank}", lucida_sans, tms_text_yellow_brush, expression_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(expression_left_to_rank_up)}", lucida_sans, tms_text_yellow_brush, expression_next_window, stringFormat); } else { graphics.DrawString($"{expression_rank}", lucida_sans, Brushes.White, expression_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(expression_left_to_rank_up)}", lucida_sans, Brushes.White, expression_next_window, stringFormat); } } } return(base_bitmap); }
public static Color Get_Game_Color(string title, UserInfoFields account) { // Return a color to be used on embedded menu messages. switch (title) { case "P1-PS1": return(new Color(141, 61, 182)); case "P1-PSP": return(new Color(141, 61, 182)); case "P2IS-PS1": return(new Color(242, 55, 0)); case "P2IS-PSP": return(new Color(242, 55, 0)); case "P2EP-PS1": return(new Color(229, 217, 212)); case "P2EP-PSP": return(new Color(229, 217, 212)); case "P3F": return(new Color(0, 195, 243)); case "P3P": switch (account.P3P_TS_Color) { case "Male Protagonist": return(new Color(0, 195, 243)); case "Female Protagonist": return(new Color(255, 117, 154)); default: return(new Color(0, 195, 243)); } case "P4-PS2": return(new Color(241, 233, 0)); case "P4G": return(new Color(241, 233, 0)); case "P4AU": return(new Color(241, 233, 0)); case "P4D": return(new Color(228, 0, 126)); case "P5-PS4": return(new Color(212, 0, 12)); case "P5R": return(new Color(212, 0, 12)); case "P5S": return(new Color(212, 0, 12)); case "BBTAG": // Assign an embed color based on the user's episode header setting for the BBTAG template. switch (account.BBTAG_TS_Header) { case "Episode P4A": return(new Color(241, 233, 0)); case "Episode Under Night In-Birth": return(new Color(141, 72, 249)); case "Episode RWBY": return(new Color(250, 50, 85)); // If the episode header is set to BlazBlue, Prologue, or Extra, default to a blue color. default: return(new Color(66, 119, 255)); } default: return(new Color(0, 0, 0)); } }
public static Bitmap RenderRankProgressBar(UserInfoFields account, string social_stat, int x, int y) { // Create a working space bitmap Bitmap new_bitmap = new Bitmap(template_width, template_height); int bar_max_value = 0; int bar_filled_value = 0; Rectangle main_bar = new Rectangle(x, y, 352, 18); Rectangle shadow_bar = new Rectangle(x, y + 16, 352, 2); System.Drawing.Color tms_white = System.Drawing.Color.White; SolidBrush tms_white_brush = new SolidBrush(tms_white); System.Drawing.Color tms_yellow = System.Drawing.Color.FromArgb(255, 255, 3); SolidBrush tms_yellow_brush = new SolidBrush(tms_yellow); System.Drawing.Color tms_yellow_shadow = System.Drawing.Color.FromArgb(117, 112, 21); SolidBrush tms_yellow_shadow_brush = new SolidBrush(tms_yellow_shadow); int total_points = 0; int next_rank_points_required = 0; int current_rank_points_required = 0; int account_proficiency_rank = LevelSystem.SocialStats.CalculateProficiencyRank(account.Proficiency); int account_diligence_rank = LevelSystem.SocialStats.CalculateDiligenceRank(account.Diligence); int account_expression_rank = LevelSystem.SocialStats.CalculateExpressionRank(account.Expression); switch (social_stat) { case "Proficiency": total_points = account.Proficiency; current_rank_points_required = Get_Base_Proficiency_Of_Current_Rank(account_proficiency_rank); next_rank_points_required = Get_Base_Proficiency_Of_Next_Rank(account_proficiency_rank); break; case "Diligence": total_points = account.Diligence; current_rank_points_required = Get_Base_Diligence_Of_Current_Rank(account_diligence_rank); next_rank_points_required = Get_Base_Diligence_Of_Next_Rank(account_diligence_rank); break; case "Expression": total_points = account.Expression; current_rank_points_required = Get_Base_Expression_Of_Current_Rank(account_expression_rank); next_rank_points_required = Get_Base_Expression_Of_Next_Rank(account_expression_rank); break; } bar_max_value = next_rank_points_required - current_rank_points_required; // Draw a progress bar that has a max value set to the minimum total EXP requirement of the next level minus the minimum total EXP requirement of the current level ProgressBar progress_bar = new ProgressBar(tms_white_brush, main_bar, bar_max_value); if ((social_stat == "Proficiency" && account_proficiency_rank >= 5) || (social_stat == "Diligence" && account_diligence_rank >= 5) || (social_stat == "Expression" && account_expression_rank >= 5)) { //If the user's rank is 5, set the progress bar's max value to 1 progress_bar = new ProgressBar(tms_yellow_brush, main_bar, 1); // Fill the progress bar completely up bar_filled_value = 1; progress_bar.SetCurrent(bar_filled_value); } else { // If the rank is below 5, fill the progress bar by subtracting the total points the user has by the minimum total point requirement of the current rank bar_filled_value = total_points - current_rank_points_required; progress_bar.SetCurrent(bar_filled_value); } // Use a graphics object to edit the bitmap using (Graphics graphics = Graphics.FromImage(new_bitmap)) { // Draw the progress bar to the bitmap graphics.DrawImage(progress_bar.GiveGraphic(), progress_bar.GiveCorner()); } return(new_bitmap); }
public static Bitmap RenderRankBarLayer(UserInfoFields account) { Bitmap new_bitmap = new Bitmap(template_width, template_height); System.Drawing.Color tms_white = System.Drawing.Color.White; System.Drawing.Color tms_yellow = System.Drawing.Color.FromArgb(255, 255, 3); System.Drawing.Color tms_white_shadow = System.Drawing.Color.FromArgb(93, 93, 93); System.Drawing.Color tms_yellow_shadow = System.Drawing.Color.FromArgb(117, 112, 20); int proficiency_rank = LevelSystem.SocialStats.CalculateProficiencyRank(account.Proficiency); int diligence_rank = LevelSystem.SocialStats.CalculateDiligenceRank(account.Diligence); int expression_rank = LevelSystem.SocialStats.CalculateExpressionRank(account.Expression); int initial_x_value = 357; int initial_y_value = 548; int shadow_y_value = 0; int x = 0; int y = 0; int bar_width = 60; int bar_height = 18; int bar_shadow_height = 2; int bar_width_distance = 73; int bar_height_distance = 154; using (Graphics graphics = Graphics.FromImage(new_bitmap)) { for (int i = 0; i < proficiency_rank; i++) { x = initial_x_value + (bar_width_distance * i); y = initial_y_value; shadow_y_value = y + 16; if (proficiency_rank == 5) { graphics.DrawImage(CreateRankBar(bar_width, bar_height, tms_yellow), x, y, bar_width, bar_height); graphics.DrawImage(CreateRankBar(bar_width, bar_shadow_height, tms_yellow_shadow), x, shadow_y_value, bar_width, bar_shadow_height); } else { graphics.DrawImage(CreateRankBar(bar_width, bar_height, tms_white), x, y, bar_width, bar_height); graphics.DrawImage(CreateRankBar(bar_width, bar_shadow_height, tms_white_shadow), x, shadow_y_value, bar_width, bar_shadow_height); } } for (int i = 0; i < diligence_rank; i++) { x = initial_x_value + (bar_width_distance * i); y = initial_y_value + bar_height_distance; shadow_y_value = y + 16; if (diligence_rank == 5) { graphics.DrawImage(CreateRankBar(bar_width, bar_height, tms_yellow), x, y, bar_width, bar_height); graphics.DrawImage(CreateRankBar(bar_width, bar_shadow_height, tms_yellow_shadow), x, shadow_y_value, bar_width, bar_shadow_height); } else { graphics.DrawImage(CreateRankBar(bar_width, bar_height, tms_white), x, y, bar_width, bar_height); graphics.DrawImage(CreateRankBar(bar_width, bar_shadow_height, tms_white_shadow), x, shadow_y_value, bar_width, bar_shadow_height); } } for (int i = 0; i < expression_rank; i++) { x = initial_x_value + (bar_width_distance * i); y = initial_y_value + bar_height_distance + bar_height_distance; shadow_y_value = y + 16; if (expression_rank == 5) { graphics.DrawImage(CreateRankBar(bar_width, bar_height, tms_yellow), x, y, bar_width, bar_height); graphics.DrawImage(CreateRankBar(bar_width, bar_shadow_height, tms_yellow_shadow), x, shadow_y_value, bar_width, bar_shadow_height); } else { graphics.DrawImage(CreateRankBar(bar_width, bar_height, tms_white), x, y, bar_width, bar_height); graphics.DrawImage(CreateRankBar(bar_width, bar_shadow_height, tms_white_shadow), x, shadow_y_value, bar_width, bar_shadow_height); } } } return(new_bitmap); }
public static Bitmap RenderFont(SocketUser user, ISocketMessageChannel channel, UserInfoFields account) { Bitmap base_bitmap = new Bitmap(template_width, template_height); System.Drawing.Color tms_text_green = System.Drawing.Color.FromArgb(152, 254, 30); SolidBrush tms_text_green_brush = new SolidBrush(tms_text_green); System.Drawing.Color tms_text_yellow = System.Drawing.Color.FromArgb(255, 255, 3); SolidBrush tms_text_yellow_brush = new SolidBrush(tms_text_yellow); using (Graphics graphics = Graphics.FromImage(base_bitmap)) { graphics.TextRenderingHint = TextRenderingHint.AntiAlias; StringFormat stringFormat = new StringFormat(); string role_name = (user as SocketGuildUser).Roles.Last().Name; Rectangle username_window = new Rectangle(822, 8, 775, 71); Rectangle channel_name_window = new Rectangle(896, 494, 810, 50); Rectangle role_name_window = new Rectangle(1160, 104, 390, 53); Rectangle level_window = new Rectangle(1539, 231, 117, 82); Rectangle remaining_exp_window = new Rectangle(140, 176, 268, 48); Rectangle pmedal_window = new Rectangle(168, 315, 529, 54); Rectangle proficiency_rank_window = new Rectangle(323, 462, 85, 44); Rectangle proficiency_next_window = new Rectangle(303, 507, 105, 44); Rectangle diligence_rank_window = new Rectangle(323, 616, 85, 44); Rectangle diligence_next_window = new Rectangle(323, 661, 85, 44); Rectangle expression_rank_window = new Rectangle(323, 770, 85, 44); Rectangle expression_next_window = new Rectangle(303, 815, 105, 44); using (Font neology_deco = new Font("NeologyDecoW03-Regular", 40)) { stringFormat.Alignment = StringAlignment.Far; graphics.DrawString(user.Username, neology_deco, Brushes.White, username_window, stringFormat); } using (Font neology_deco = new Font("NeologyDecoW03-Regular", 31)) { stringFormat.Alignment = StringAlignment.Near; graphics.DrawString($"#{Shorten_Long_Strings(channel.Name, 38)}", neology_deco, Brushes.White, channel_name_window, stringFormat); } using (Font neology_deco = new Font("NeologyDecoW03-Regular", 29)) { stringFormat.Alignment = StringAlignment.Near; if (role_name == "@everyone") { graphics.DrawString("-----", neology_deco, Brushes.White, role_name_window, stringFormat); } else { graphics.DrawString(role_name, neology_deco, Brushes.White, role_name_window, stringFormat); } } Font arial_bold = new Font("Arial", 64, FontStyle.Bold); if (account.Level < 10) { arial_bold = new Font("Arial", 64, FontStyle.Bold); } else { arial_bold = new Font("Arial", 58, FontStyle.Bold); } using (arial_bold) { stringFormat.Alignment = StringAlignment.Center; graphics.DrawString($"{account.Level}", arial_bold, tms_text_green_brush, level_window, stringFormat); } int next_level_total_exp_required = LevelSystem.Leveling.CalculateExp(account.Level + 1); int required_exp = next_level_total_exp_required - account.Total_Exp; using (Font lucida_sans = new Font("Lucida Sans Unicode", 30)) { stringFormat.Alignment = StringAlignment.Far; graphics.DrawString($"{required_exp}", lucida_sans, Brushes.White, remaining_exp_window, stringFormat); } using (Font lucida_sans = new Font("Lucida Sans Unicode", 30)) { stringFormat.Alignment = StringAlignment.Near; graphics.DrawString($"{account.P_Medals}", lucida_sans, Brushes.White, pmedal_window, stringFormat); } // Social stats int proficiency_rank = LevelSystem.SocialStats.CalculateProficiencyRank(account.Proficiency); int diligence_rank = LevelSystem.SocialStats.CalculateDiligenceRank(account.Diligence); int expression_rank = LevelSystem.SocialStats.CalculateExpressionRank(account.Expression); int proficiency_left_to_rank_up = Get_Base_Proficiency_Of_Next_Rank(proficiency_rank) - account.Proficiency; int diligence_left_to_rank_up = Get_Base_Diligence_Of_Next_Rank(diligence_rank) - account.Diligence; int expression_left_to_rank_up = Get_Base_Expression_Of_Next_Rank(expression_rank) - account.Expression; using (Font lucida_sans = new Font("Lucida Sans Unicode", 30)) { stringFormat.Alignment = StringAlignment.Far; // Draw text to screen if (proficiency_rank == 5) { graphics.DrawString($"{proficiency_rank}", lucida_sans, tms_text_yellow_brush, proficiency_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(proficiency_left_to_rank_up)}", lucida_sans, tms_text_yellow_brush, proficiency_next_window, stringFormat); } else { graphics.DrawString($"{proficiency_rank}", lucida_sans, Brushes.White, proficiency_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(proficiency_left_to_rank_up)}", lucida_sans, Brushes.White, proficiency_next_window, stringFormat); } if (diligence_rank == 5) { graphics.DrawString($"{diligence_rank}", lucida_sans, tms_text_yellow_brush, diligence_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(diligence_left_to_rank_up)}", lucida_sans, tms_text_yellow_brush, diligence_next_window, stringFormat); } else { graphics.DrawString($"{diligence_rank}", lucida_sans, Brushes.White, diligence_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(diligence_left_to_rank_up)}", lucida_sans, Brushes.White, diligence_next_window, stringFormat); } if (expression_rank == 5) { graphics.DrawString($"{expression_rank}", lucida_sans, tms_text_yellow_brush, expression_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(expression_left_to_rank_up)}", lucida_sans, tms_text_yellow_brush, expression_next_window, stringFormat); } else { graphics.DrawString($"{expression_rank}", lucida_sans, Brushes.White, expression_rank_window, stringFormat); graphics.DrawString($"{LevelSystem.SocialStats.SocialStatToDecimal(expression_left_to_rank_up)}", lucida_sans, Brushes.White, expression_next_window, stringFormat); } } } return(base_bitmap); }
public static string Get_Bustup_Filename(UserInfoFields account, OfficialSetData set_data, MakerCommandData command_data) { // Establish the directory of the specified sprite set. string set_path = $@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//{set_data.Origin}//Bustup//{set_data.ID}"; // Get a count of how many files are in the sprite set's directory. int filecount = OfficialSetMethods.AttachmentCountItemDirectory(set_path); // Create a variable for the base sprite's filename. We'll go searching for it in a few moments. string base_sprite_filename = ""; // Create variables that keep track of how many frames of each frame type are present for the base sprite. // This will help us perform the math needed to form the sprite sheet. //int eye_frame_count = 0; //int mouth_frame_count = 0; // Check if the sprite set's directory exists. if (Directory.Exists(set_path)) { // If so, it's time to find the filename for the user's selected sprite so we can retrieve the frames associated with it. // We can do this by creating a counter starting from zero that will increment by one until it reaches the sprite numer the user specified. // Once it reaches that number, the iterated filename will be saved and we can use that to find its associated frames. int counter = 0; int base_sprite_number = command_data.Base_Sprite; // The manner of iteration will change based on the user's settings. // First, Order by Outfit. if (account.Setting_Sheet_Order == "Order by Outfit") { // Create a loop starting at 1 meant to iterate though every file in the directory. // Outfit numbers always start at 1, so we'll begin there. for (int outfit = 1; outfit <= filecount; outfit++) { // Inside, create a secondary loop also meant to iterate though every file in the directory. // This loop is searching for expressions, which start at 1. for (int expression = 1; expression <= filecount; expression++) { // Here, we're going to create a file path that could potentially exist given the combination of expression and outfit numbers. // Check if the created file path string exists. if (File.Exists($"{set_path}//{set_data.ID.ToLower()}_{expression}_{outfit}.png")) { // If the file does exist, increment the counter by one. counter++; // Check if the counter matches the same number of the chosen sprite number. if (counter == base_sprite_number) { // If it does, we found our sprite! Save the filename to the variable created earlier so we can reference it later. base_sprite_filename = $"{set_data.ID.ToLower()}_{expression}_{outfit}"; // Break out of the current loop. break; } } } // Check if the filename variable for the base sprite is not empty. if (base_sprite_filename != "") { // If so, we already found our filename! Break out of the outer loop. break; } } } // Second case, Order by Expression. else if (account.Setting_Sheet_Order == "Order by Expression") { // Create a loop starting at 1 meant to iterate though every file in the directory. // Expression numbers always start at 1, so we'll begin there. for (int expression = 1; expression <= filecount; expression++) { // Inside, create a secondary loop also meant to iterate though every file in the directory. // This loop is searching for outfits, which start at 1. for (int outfit = 1; outfit <= filecount; outfit++) { // Here, we're going to create a file path that could potentially exist given the combination of expression and outfit numbers. // Check if the created file path string exists. if (File.Exists($"{set_path}//{set_data.ID.ToLower()}_{expression}_{outfit}.png")) { // If the file does exist, increment the counter by one. counter++; // Check if the counter matches the same number of the chosen sprite number. if (counter == base_sprite_number) { // If it does, we found our sprite! Save the filename to the variable created earlier so we can reference it later. base_sprite_filename = $"{set_data.ID.ToLower()}_{expression}_{outfit}"; // Break out of the current loop. break; } } } // Check if the filename variable for the base sprite is not empty. if (base_sprite_filename != "") { // If so, we already found our filename! Break out of the outer loop. break; } } } } return($"{base_sprite_filename}.png"); }
public static async void ErrorTimer_Elapsed(object sender, ElapsedEventArgs e, RestUserMessage error_message, UserInfoFields account) { // If the user has their auto-delete settings for error messages set to on, attempt deleting the message if it hasn't been deleted by the user yet. // If it has, catch the exception and return. if (account.Auto_Delete_Error_Messages == "On") { try { // Delete the current message from the channel. await error_message.DeleteAsync(); } catch (Exception ex) { Console.WriteLine(ex); return; } } }