using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; using System.Diagnostics; namespace Item_Creator { public partial class Main : Form { public static string LocalPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\"; public static string SQLInformation = ""; private string DatabaseName = ""; private string SelectedName = ""; private string SelectedType = ""; private string Login = ""; private string TevaName = ""; private string ApolineName = ""; private string ItemKey = ""; private string CharacterName = ""; private string RewardName = ""; private int CharacterID = 0; private int StorageType = 0; private int ItemID = 0; private int UpEffect = 0; private int Slot = 0; private int Amount = 0; private int STR = 0; private int END = 0; private int DEX = 0; private int INT = 0; private int SPR = 0; public Main() { InitializeComponent(); } private void Main_Load(object sender, EventArgs e) { Files.Exist(); SetupConfig(); } private void Go_Click(object sender, EventArgs Args) { try { if (CheckBoxes() == false) { return; } if (SelectedType == "Armor") { StorageType = 2; Slot = SQL.AvailableSlot(CharacterID, StorageType); Item.Create(ItemKey, CharacterID, Slot, StorageType, ItemID); Item.InsertArmorStats(ItemKey, UpEffect, STR, END, DEX, INT, SPR); } else if (SelectedType == "Weapon") { StorageType = 2; Slot = SQL.AvailableSlot(CharacterID, StorageType); Item.Create(ItemKey, CharacterID, Slot, StorageType, ItemID); Item.InsertWeaponStats(ItemKey, UpEffect, STR, END, DEX, INT, SPR); } else if (SelectedType == "Shield") { StorageType = 2; Slot = SQL.AvailableSlot(CharacterID, StorageType); Item.Create(ItemKey, CharacterID, Slot, StorageType, ItemID); Item.InsertShieldStats(ItemKey, UpEffect, STR, END, DEX, INT, SPR); } else if (SelectedType == "Jewel") { StorageType = 2; Slot = SQL.AvailableSlot(CharacterID, StorageType); Item.Create(ItemKey, CharacterID, Slot, StorageType, ItemID); Item.InsertJewelStats(ItemKey, UpEffect, STR, END, DEX, INT, SPR); } else if (SelectedType == "Item") { StorageType = 2; Slot = SQL.AvailableSlot(CharacterID, StorageType); Item.Create(ItemKey, CharacterID, Slot, StorageType, ItemID); Item.InsertAmountValue(ItemKey, Amount); } if (StorageType == 2) { RewardName = "Reward Inventory"; } else if (StorageType == 9) { RewardName = "Main Inventory"; } Utility.Message(CharacterName + " Has Been Given A " + SelectedType + ", ID: " + ItemID + ", Please Tell Them To Check Their Reward Inventory", "Item Added"); SQL.Slot = 0; } catch (Exception Excep) { MessageBox.Show(Excep.ToString(), Excep.Source); } ResetComponents(); } private void SetupConfig() { Login = Files.GetValue("Login: "); TevaName = Files.GetValue("Teva: "); ApolineName = Files.GetValue("Apoline: "); } private bool CheckBoxes() { if (string.IsNullOrEmpty(CharacterText.Text)) { Utility.Message("Please Enter A Character Name", "Character Name"); return false; } CharacterName = CharacterText.Text; if (string.IsNullOrEmpty(TypeList.SelectedItem.ToString())) { Utility.Message("You Must Select A Type", "Type Select"); return false; } SelectedType = TypeList.SelectedItem.ToString(); if (!TevaSelect.Checked && !ApolineSelect.Checked) { Utility.Message("You Must Select A Server", "Server Select"); return false; } if (TevaSelect.Checked) { SelectedName = "Teva"; DatabaseName = TevaName; } else if (ApolineSelect.Checked) { SelectedName = "Apoline"; DatabaseName = ApolineName; } SQLInformation = @"Data Source=" + Login + ";Initial Catalog=" + DatabaseName + ";Integrated Security=SSPI"; if (SQL.CheckCharacterExist(CharacterName) == false) { Utility.Message(CharacterName + " Does Not Exist On " + SelectedName, "Character Not Exist"); return false; } if (Utility.CheckIntValid(ItemIDText.Text) == false) { Utility.Message(ItemIDText.Text + " Is Not A Number", "Item ID Invalid"); return false; } ItemKey = SQL.CreateKey(); CharacterID = int.Parse(SQL.CharacterData(CharacterName, "nCharNo")); ItemID = int.Parse(ItemIDText.Text); UpEffect = Convert.ToInt32(UpEffectAmount.Value); Amount = Convert.ToInt32(AmountAmount.Value); STR = Convert.ToInt32(STRAmount.Value); END = Convert.ToInt32(ENDAmount.Value); DEX = Convert.ToInt32(DEXAmount.Value); INT = Convert.ToInt32(INTAmount.Value); SPR = Convert.ToInt32(SPRAmount.Value); return true; } private void ResetComponents() { SelectedType = ""; CharacterText.Text = ""; TypeList.SelectedValue = ""; ItemIDText.Text = ""; UpEffectAmount.Value = 0; AmountAmount.Value = 0; TevaSelect.Checked = false; ApolineSelect.Checked = false; STRAmount.Value = 0; ENDAmount.Value = 0; DEXAmount.Value = 0; INTAmount.Value = 0; SPRAmount.Value = 0; ItemKey = ""; CharacterName = ""; RewardName = ""; CharacterID = 0; StorageType = 0; ItemID = 0; Slot = 0; Amount = 0; STR = 0; END = 0; DEX = 0; INT = 0; SPR = 0; } private void StatsVisible(bool Answer) { STRLabel.Visible = Answer; STRAmount.Visible = Answer; ENDLabel.Visible = Answer; ENDAmount.Visible = Answer; DEXLabel.Visible = Answer; DEXAmount.Visible = Answer; INTLabel.Visible = Answer; INTAmount.Visible = Answer; SPRLabel.Visible = Answer; SPRAmount.Visible = Answer; } private void ItemIDVisible(bool Answer) { ItemIDLabel.Visible = Answer; ItemIDText.Visible = Answer; } private void UpEffectVisible(bool Answer) { UpEffectLabel.Visible = Answer; UpEffectAmount.Visible = Answer; } private void AmountVisible(bool Answer) { AmountLabel.Visible = Answer; AmountAmount.Visible = Answer; } private void TypeList_Changed(object sender, EventArgs e) { if (TypeList.SelectedItem.ToString() == "Armor" || TypeList.SelectedItem.ToString() == "Weapon" || TypeList.SelectedItem.ToString() == "Shield" || TypeList.SelectedItem.ToString() == "Jewel") { ItemIDVisible(true); StatsVisible(true); UpEffectVisible(true); AmountVisible(false); } else if (TypeList.SelectedItem.ToString() == "Item") { ItemIDVisible(true); StatsVisible(false); UpEffectVisible(false); AmountVisible(true); } else { ItemIDVisible(false); StatsVisible(false); UpEffectVisible(false); AmountVisible(false); } } } }