public static PartyData LoadCharacterParty(PMDCP.DatabaseConnector.MySql.MySql database, string charID) { PartyData partyData = new PartyData(); string query = "SELECT parties.PartyID " + "FROM parties " + "WHERE parties.CharID = \'" + charID + "\';"; List <DataColumnCollection> rows = database.RetrieveRows(query); if (rows != null) { for (int i = 0; i < rows.Count; i++) { partyData.PartyID = rows[i]["PartyID"].ValueString; } } else { return(null); } query = "SELECT parties.CharID " + "FROM parties " + "WHERE parties.PartyID = \'" + partyData.PartyID + "\';"; rows = database.RetrieveRows(query); if (rows != null) { for (int i = 0; i < rows.Count; i++) { partyData.Members.Add(rows[i]["CharID"].ValueString); } } return(partyData); }
public static void AddMissionEnemyData(PMDCP.DatabaseConnector.MySql.MySql database, int difficulty, int index, MissionEnemyData data) { database.AddRow("mission_enemy", new IDataColumn[] { database.CreateColumn(false, "Rank", difficulty.ToString()), database.CreateColumn(false, "EnemyIndex", index.ToString()), database.CreateColumn(false, "NpcNum", data.NpcNum.ToString()) }); }
public static void AddMissionClientData(PMDCP.DatabaseConnector.MySql.MySql database, int difficulty, int index, MissionClientData data) { database.AddRow("mission_client", new IDataColumn[] { database.CreateColumn(false, "Rank", difficulty.ToString()), database.CreateColumn(false, "ClientIndex", index.ToString()), database.CreateColumn(false, "DexNum", data.DexNum.ToString()), database.CreateColumn(false, "FormNum", data.FormNum.ToString()) }); }
public static void AddMissionRewardData(PMDCP.DatabaseConnector.MySql.MySql database, int difficulty, int index, MissionRewardData data) { database.AddRow("mission_reward", new IDataColumn[] { database.CreateColumn(false, "Rank", difficulty.ToString()), database.CreateColumn(false, "RewardIndex", index.ToString()), database.CreateColumn(false, "ItemNum", data.ItemNum.ToString()), database.CreateColumn(false, "ItemAmount", data.ItemAmount.ToString()), database.CreateColumn(false, "ItemTag", data.ItemTag) }); }
public static List <string> LoadPendingZonedMaps(PMDCP.DatabaseConnector.MySql.MySql database, int quantity) { var results = new List <string>(); var query = "SELECT MapID FROM map_data WHERE ((ZoneID = 0 OR ZoneID IS NULL) AND MapID LIKE 's%') ORDER BY CONVERT(SUBSTRING(MapID, 2, CHARACTER_LENGTH(MapID)), SIGNED INTEGER) LIMIT " + quantity; foreach (var row in database.RetrieveRowsEnumerable(query)) { results.Add(row["MapID"].ValueString); } return(results); }
public static void SaveParty(PMDCP.DatabaseConnector.MySql.MySql database, Party partyData) { database.ExecuteNonQuery("DELETE FROM parties WHERE PartyID = \'" + partyData.PartyID + "\'"); //database.DeleteRow("friends", "CharID = \'" + playerData.CharID + "\'"); for (int i = 0; i < partyData.Members.Count; i++) { database.UpdateOrInsert("parties", new IDataColumn[] { database.CreateColumn(false, "PartyID", partyData.PartyID), database.CreateColumn(false, "PartySlot", i.ToString()), database.CreateColumn(false, "CharID", partyData.Members[i]) }); } }
public static IEnumerable <MissionEnemyData> LoadMissionEnemyData(PMDCP.DatabaseConnector.MySql.MySql database, int difficulty) { string query = "SELECT mission_enemy.NpcNum " + "FROM mission_enemy " + "WHERE mission_enemy.Rank = \'" + difficulty + "\' " + "ORDER BY mission_enemy.EnemyIndex"; foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query)) { MissionEnemyData data = new MissionEnemyData(); data.NpcNum = column["NpcNum"].ValueString.ToInt(); yield return(data); } }
public static void LoadParty(PMDCP.DatabaseConnector.MySql.MySql database, Party partyData) { string query = "SELECT parties.CharID " + "FROM parties " + "WHERE parties.PartyID = \'" + partyData.PartyID + "\';"; List <DataColumnCollection> rows = database.RetrieveRows(query); if (rows != null) { for (int i = 0; i < rows.Count; i++) { partyData.Members.Add(rows[i]["CharID"].ValueString); } } }
public static IEnumerable <MissionRewardData> LoadMissionRewardData(PMDCP.DatabaseConnector.MySql.MySql database, int difficulty) { string query = "SELECT mission_reward.ItemNum, mission_reward.ItemAmount, mission_reward.ItemTag " + "FROM mission_reward " + "WHERE mission_reward.Rank = \'" + difficulty + "\' " + "ORDER BY mission_reward.RewardIndex"; foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query)) { MissionRewardData data = new MissionRewardData(); data.ItemNum = column["ItemNum"].ValueString.ToInt(); data.ItemAmount = column["ItemAmount"].ValueString.ToInt(); data.ItemTag = column["ItemTag"].ValueString; yield return(data); } }
public static List <ZoneResource> LoadZoneResources(PMDCP.DatabaseConnector.MySql.MySql database, int zoneID) { var results = new List <ZoneResource>(); var query = "SELECT MapID, Name FROM map_data WHERE ZoneID = " + zoneID + " AND MapID LIKE 's%'"; foreach (var row in database.RetrieveRowsEnumerable(query)) { results.Add(new ZoneResource() { Num = row["MapID"].ValueString.Trim('s').ToInt(), Name = row["Name"].ValueString, Type = ZoneResourceType.Maps }); } return(results); }
public static List <ZoneResource> LoadZoneResources(PMDCP.DatabaseConnector.MySql.MySql database, int zoneID) { var results = new List <ZoneResource>(); var query = "SELECT num, name FROM npc WHERE zone_id = " + zoneID; foreach (var row in database.RetrieveRowsEnumerable(query)) { results.Add(new ZoneResource() { Num = row["num"].ValueString.ToInt(), Name = row["name"].ValueString, Type = ZoneResourceType.NPCs }); } return(results); }
public static void LoadEvo(int evoNum, PMDCP.DatabaseConnector.MySql.MySql database) { if (evolution.Evolutions.ContainsKey(evoNum) == false) { evolution.Evolutions.Add(evoNum, new Evolution()); } string query = "SELECT name, " + "species, " + "is_sandboxed " + "FROM evolution WHERE evolution.num = \'" + evoNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { evolution[evoNum].Name = row["name"].ValueString; evolution[evoNum].Species = row["species"].ValueString.ToInt(); evolution[evoNum].IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); } query = "SELECT branch, " + "name, " + "species, " + "req_script, " + "data1, " + "data2, " + "data3 " + "FROM evolution_branch WHERE evolution_branch.num = \'" + evoNum + "\'"; foreach (DataColumnCollection columnCollection in database.RetrieveRowsEnumerable(query)) { int tradeNum = columnCollection["branch"].ValueString.ToInt(); EvolutionBranch newBranch = new EvolutionBranch(); newBranch.Name = columnCollection["name"].ValueString; newBranch.NewSpecies = columnCollection["species"].ValueString.ToInt(); newBranch.ReqScript = columnCollection["req_script"].ValueString.ToInt(); newBranch.Data1 = columnCollection["data1"].ValueString.ToInt(); newBranch.Data2 = columnCollection["data2"].ValueString.ToInt(); newBranch.Data3 = columnCollection["data3"].ValueString.ToInt(); evolution[evoNum].Branches.Add(newBranch); } }
public DatabaseConnection(DatabaseID databaseID, bool openConnection) { this.databaseID = databaseID; string databaseName = DetermineDatabaseName(databaseID); if (!string.IsNullOrEmpty(databaseName)) { #if !DEBUG database = new PMDCP.DatabaseConnector.MySql.MySql(Settings.DatabaseIP, Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword); #else database = new PMDCP.DatabaseConnector.MySql.MySql("localhost", Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword); #endif } if (openConnection) { database.OpenConnection(); } }
public static List <string> LoadPartyIDList(PMDCP.DatabaseConnector.MySql.MySql database) { List <string> idList = new List <string>(); string query = "SELECT parties.PartyID " + "FROM parties;"; List <DataColumnCollection> rows = database.RetrieveRows(query); if (rows != null) { for (int i = 0; i < rows.Count; i++) { if (!idList.Contains(rows[i]["PartyID"].ValueString)) { idList.Add(rows[i]["PartyID"].ValueString); } } } return(idList); }
/// <summary> /// Removes a friend based on name. Return codes are as follows: /// <list type="number"> /// <item> /// 0 - Success /// </item> /// <item> /// 1 - Friend not found /// </item> /// </list> /// </summary> /// <param name="name"></param> /// <returns></returns> public int RemoveFriend(PMDCP.DatabaseConnector.MySql.MySql database, string name) { int error = 0; int friendIndex = friends.IndexOf(name); if (friendIndex > -1) { QuickRemove(friendIndex); if (UpdateOnDemand && database != null) { database.DeleteRow("friends", "CharID = @CharID AND FriendName = @FriendName", new { CharID = ownerCharID, FriendName = name }); } } else { error = 1; } return(error); }
public static void LoadShop(int shopNum, PMDCP.DatabaseConnector.MySql.MySql database) { if (shops.Shops.ContainsKey(shopNum) == false) { shops.Shops.Add(shopNum, new Shop()); } string query = "SELECT name, " + "greeting, " + "farewell, " + "is_sandboxed, " + "zone_id " + "FROM shop WHERE shop.num = \'" + shopNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { shops[shopNum].Name = row["name"].ValueString; shops[shopNum].JoinSay = row["greeting"].ValueString; shops[shopNum].LeaveSay = row["farewell"].ValueString; shops[shopNum].IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); shops[shopNum].ZoneID = row["zone_id"].ValueString.ToInt(); } query = "SELECT trade_num, " + "item, " + "cost_num, " + "cost_val " + "FROM shop_trade WHERE shop_trade.num = \'" + shopNum + "\'"; foreach (DataColumnCollection columnCollection in database.RetrieveRowsEnumerable(query)) { int tradeNum = columnCollection["trade_num"].ValueString.ToInt(); shops[shopNum].Items[tradeNum].GetItem = columnCollection["item"].ValueString.ToInt(); shops[shopNum].Items[tradeNum].GiveItem = columnCollection["cost_num"].ValueString.ToInt(); shops[shopNum].Items[tradeNum].GiveValue = columnCollection["cost_val"].ValueString.ToInt(); } }
/// <summary> /// Adds a new friend. Return codes are as follows: /// <list type="table"> /// <item> /// 0 - Success /// </item> /// <item> /// 1 - Friend is already on list /// </item> /// </list> /// </summary> /// <param name="name"></param> public int AddFriend(PMDCP.DatabaseConnector.MySql.MySql database, string name) { int error = 0; if (friends.Contains(name) == false) { QuickAdd(name); if (UpdateOnDemand && database != null) { database.UpdateOrInsert("friends", new IDataColumn[] { database.CreateColumn(false, "CharID", ownerCharID), database.CreateColumn(false, "FriendListSlot", (friends.Count - 1).ToString()), database.CreateColumn(false, "FriendName", name) }); } } else { error = 1; } return(error); }
public static void LoadNpc(int npcNum, PMDCP.DatabaseConnector.MySql.MySql database) { if (npcs.Npcs.ContainsKey(npcNum) == false) { npcs.Npcs.Add(npcNum, new Npc()); } string query = "SELECT name, " + "attack_say, " + "attack_say_2, " + "attack_say_3, " + "species, " + "form, " + "behavior, " + "shiny_chance, " + "dawn_spawn, " + "day_spawn, " + "dusk_spawn, " + "night_spawn, " + "ai_script, " + "recruit_rate, " + "move1, " + "move2, " + "move3, " + "move4, " + "is_sandboxed, " + "zone_id, " + "spawn_direction, " + "spawn_weather, " + "story, " + "shop, " + "death_story " + "FROM npc WHERE npc.num = \'" + npcNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { npcs[npcNum].Name = row["name"].ValueString; npcs[npcNum].AttackSay = row["attack_say"].ValueString; npcs[npcNum].AttackSay2 = row["attack_say_2"].ValueString; npcs[npcNum].AttackSay3 = row["attack_say_3"].ValueString; npcs[npcNum].Species = row["species"].ValueString.ToInt(); npcs[npcNum].Form = row["form"].ValueString.ToInt(); npcs[npcNum].Behavior = (Enums.NpcBehavior)row["behavior"].ValueString.ToInt(); npcs[npcNum].ShinyChance = row["shiny_chance"].ValueString.ToInt(); npcs[npcNum].SpawnsAtDawn = row["dawn_spawn"].ValueString.ToBool(); npcs[npcNum].SpawnsAtDay = row["day_spawn"].ValueString.ToBool(); npcs[npcNum].SpawnsAtDusk = row["dusk_spawn"].ValueString.ToBool(); npcs[npcNum].SpawnsAtNight = row["night_spawn"].ValueString.ToBool(); npcs[npcNum].AIScript = row["ai_script"].ValueString; npcs[npcNum].RecruitRate = row["recruit_rate"].ValueString.ToInt(); npcs[npcNum].Moves[0] = row["move1"].ValueString.ToInt(); npcs[npcNum].Moves[1] = row["move2"].ValueString.ToInt(); npcs[npcNum].Moves[2] = row["move3"].ValueString.ToInt(); npcs[npcNum].Moves[3] = row["move4"].ValueString.ToInt(); npcs[npcNum].IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); npcs[npcNum].ZoneID = row["zone_id"].ValueString.ToInt(); npcs[npcNum].SpawnDirection = (Enums.Direction)row["spawn_direction"].ValueString.ToInt(); npcs[npcNum].SpawnWeather = (Enums.Weather)row["spawn_weather"].ValueString.ToInt(); npcs[npcNum].Story = row["story"].ValueString.ToInt(); npcs[npcNum].Shop = row["shop"].ValueString.ToInt(); npcs[npcNum].DeathStory = row["death_story"].ValueString.ToInt(); } query = "SELECT drop_num, " + "item_num, " + "item_val, " + "tag, " + "chance " + "FROM npc_drop WHERE npc_drop.npc_num = \'" + npcNum + "\'"; foreach (DataColumnCollection columnCollection in database.RetrieveRowsEnumerable(query)) { int dropNum = columnCollection["drop_num"].ValueString.ToInt(); npcs[npcNum].Drops[dropNum].ItemNum = columnCollection["item_num"].ValueString.ToInt(); npcs[npcNum].Drops[dropNum].ItemValue = columnCollection["item_val"].ValueString.ToInt(); npcs[npcNum].Drops[dropNum].Tag = columnCollection["tag"].ValueString; npcs[npcNum].Drops[dropNum].Chance = columnCollection["chance"].ValueString.ToInt(); } }
public static void LoadMove(int moveNum, PMDCP.DatabaseConnector.MySql.MySql database) { if (moves.Moves.ContainsKey(moveNum) == false) { moves.Moves.Add(moveNum, new Move()); } string query = "SELECT name, " + "max_pp, " + "effect_type, " + "element, " + "category, " + "range_type, " + "range_dist, " + "target, " + "data1, " + "data2, " + "data3, " + "effect_data1, " + "effect_data2, " + "effect_data3, " + "accuracy, " + "hit_time, " + "hit_freeze, " + "per_player, " + "key_effect, " + "sound, " + "attack_anim_type, " + "attack_anim_index, " + "attack_anim_speed, " + "attack_anim_cycle, " + "travel_anim_type, " + "travel_anim_index, " + "travel_anim_speed, " + "travel_anim_cycle, " + "landed_anim_type, " + "landed_anim_index, " + "landed_anim_speed, " + "landed_anim_cycle, " + "is_sandboxed " + "FROM move WHERE move.num = \'" + moveNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { moves[moveNum].Name = row["name"].ValueString; moves[moveNum].MaxPP = row["max_pp"].ValueString.ToInt(); moves[moveNum].EffectType = (Enums.MoveType)row["effect_type"].ValueString.ToInt(); moves[moveNum].Element = (Enums.PokemonType)row["element"].ValueString.ToInt(); moves[moveNum].MoveCategory = (Enums.MoveCategory)row["category"].ValueString.ToInt(); moves[moveNum].RangeType = (Enums.MoveRange)row["range_type"].ValueString.ToInt(); moves[moveNum].Range = row["range_dist"].ValueString.ToInt(); moves[moveNum].TargetType = (Enums.MoveTarget)row["target"].ValueString.ToInt(); moves[moveNum].Data1 = row["data1"].ValueString.ToInt(); moves[moveNum].Data2 = row["data2"].ValueString.ToInt(); moves[moveNum].Data3 = row["data3"].ValueString.ToInt(); moves[moveNum].AdditionalEffectData1 = row["effect_data1"].ValueString.ToInt(); moves[moveNum].AdditionalEffectData2 = row["effect_data2"].ValueString.ToInt(); moves[moveNum].AdditionalEffectData3 = row["effect_data3"].ValueString.ToInt(); moves[moveNum].Accuracy = row["accuracy"].ValueString.ToInt(); moves[moveNum].HitTime = row["hit_time"].ValueString.ToInt(); moves[moveNum].HitFreeze = row["hit_freeze"].ValueString.ToBool(); moves[moveNum].PerPlayer = row["per_player"].ValueString.ToBool(); moves[moveNum].KeyItem = row["key_effect"].ValueString.ToInt(); moves[moveNum].Sound = row["sound"].ValueString.ToInt(); moves[moveNum].AttackerAnim.AnimationType = (Enums.MoveAnimationType)row["attack_anim_type"].ValueString.ToInt(); moves[moveNum].AttackerAnim.AnimationIndex = row["attack_anim_index"].ValueString.ToInt(); moves[moveNum].AttackerAnim.FrameSpeed = row["attack_anim_speed"].ValueString.ToInt(); moves[moveNum].AttackerAnim.Repetitions = row["attack_anim_cycle"].ValueString.ToInt(); moves[moveNum].TravelingAnim.AnimationType = (Enums.MoveAnimationType)row["travel_anim_type"].ValueString.ToInt(); moves[moveNum].TravelingAnim.AnimationIndex = row["travel_anim_index"].ValueString.ToInt(); moves[moveNum].TravelingAnim.FrameSpeed = row["travel_anim_speed"].ValueString.ToInt(); moves[moveNum].TravelingAnim.Repetitions = row["travel_anim_cycle"].ValueString.ToInt(); moves[moveNum].DefenderAnim.AnimationType = (Enums.MoveAnimationType)row["landed_anim_type"].ValueString.ToInt(); moves[moveNum].DefenderAnim.AnimationIndex = row["landed_anim_index"].ValueString.ToInt(); moves[moveNum].DefenderAnim.FrameSpeed = row["landed_anim_speed"].ValueString.ToInt(); moves[moveNum].DefenderAnim.Repetitions = row["landed_anim_cycle"].ValueString.ToInt(); moves[moveNum].IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); } }
public static void LoadStory(int storyNum, PMDCP.DatabaseConnector.MySql.MySql database) { if (stories.Stories.ContainsKey(storyNum) == false) { stories.Stories.Add(storyNum, new Story(storyNum.ToString())); } Story story = new Story(storyNum.ToString()); string query = "SELECT revision, " + "name, " + "story_start, " + "is_sandboxed, " + "zone_id " + "FROM story WHERE story.num = \'" + storyNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { story.Revision = row["revision"].ValueString.ToInt(); story.Name = row["name"].ValueString; story.StoryStart = row["story_start"].ValueString.ToInt(); story.IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); story.ZoneID = row["zone_id"].ValueString.ToInt(); } query = "SELECT segment, " + "action, " + "checkpoint " + "FROM story_segment WHERE story_segment.num = \'" + storyNum + "\'"; List <DataColumnCollection> columnCollections = database.RetrieveRows(query); if (columnCollections == null) { columnCollections = new List <DataColumnCollection>(); } foreach (DataColumnCollection columnCollection in columnCollections) { StorySegment segment = new StorySegment(); int segmentNum = columnCollection["segment"].ValueString.ToInt(); segment.Action = (Enums.StoryAction)columnCollection["action"].ValueString.ToInt(); bool isCheckpoint = columnCollection["checkpoint"].ValueString.ToBool(); string query2 = "SELECT param_key, " + "param_val " + "FROM story_param WHERE story_param.num = \'" + storyNum + "\' AND story_param.segment = \'" + segmentNum + "\'"; List <DataColumnCollection> columnCollections2 = database.RetrieveRows(query2); if (columnCollections2 == null) { columnCollections2 = new List <DataColumnCollection>(); } foreach (DataColumnCollection columnCollection2 in columnCollections2) { string paramKey = columnCollection2["param_key"].ValueString; string paramVal = columnCollection2["param_val"].ValueString; segment.Parameters.Add(paramKey, paramVal); } story.Segments.Add(segment); if (isCheckpoint) { story.ExitAndContinue.Add(segmentNum); } } stories.Stories[storyNum] = story; }
public static void LoadDungeon(int dungeonNum, PMDCP.DatabaseConnector.MySql.MySql database) { Dungeon dungeon = new Dungeon(); string query = "SELECT name, " + "rescue, " + "is_sandboxed, " + "zone_id " + "FROM dungeon WHERE dungeon.num = \'" + dungeonNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { dungeon.Name = row["name"].ValueString; dungeon.AllowsRescue = row["rescue"].ValueString.ToBool(); dungeon.IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); dungeon.ZoneID = row["zone_id"].ValueString.ToInt(); } query = "SELECT map_id, " + "difficulty, " + "boss_map " + "FROM dungeon_smap WHERE dungeon_smap.num = \'" + dungeonNum + "\'"; foreach (DataColumnCollection columnCollection in database.RetrieveRowsEnumerable(query)) { int mapID = columnCollection["map_id"].ValueString.ToInt(); StandardDungeonMap sMap = new StandardDungeonMap(); sMap.MapNum = mapID; sMap.Difficulty = (Enums.JobDifficulty)columnCollection["difficulty"].ValueString.ToInt(); sMap.IsBadGoalMap = columnCollection["boss_map"].ValueString.ToBool(); dungeon.StandardMaps.Add(sMap); } query = "SELECT rdungeon_num, " + "rdungeon_floor, " + "difficulty, " + "boss_map " + "FROM dungeon_rmap WHERE dungeon_rmap.num = \'" + dungeonNum + "\'"; foreach (DataColumnCollection columnCollection in database.RetrieveRowsEnumerable(query)) { int dungeonIndex = columnCollection["rdungeon_num"].ValueString.ToInt(); int dungeonFloor = columnCollection["rdungeon_floor"].ValueString.ToInt(); RandomDungeonMap rMap = new RandomDungeonMap(); rMap.RDungeonIndex = dungeonIndex; rMap.RDungeonFloor = dungeonFloor; rMap.Difficulty = (Enums.JobDifficulty)columnCollection["difficulty"].ValueString.ToInt(); rMap.IsBadGoalMap = columnCollection["boss_map"].ValueString.ToBool(); dungeon.RandomMaps.Add(rMap); } query = "SELECT script_key, " + "script_args " + "FROM dungeon_script WHERE dungeon_script.num = \'" + dungeonNum + "\'"; foreach (DataColumnCollection columnCollection in database.RetrieveRowsEnumerable(query)) { int scriptKey = columnCollection["script_key"].ValueString.ToInt(); string scriptArgs = columnCollection["script_args"].ValueString; dungeon.ScriptList.Add(scriptKey, scriptArgs); } dungeons.Dungeons.Add(dungeonNum, dungeon); }
public static void ClearMissionEnemyData(PMDCP.DatabaseConnector.MySql.MySql database, int difficulty) { database.ExecuteNonQuery("DELETE FROM mission_enemy WHERE Rank = \'" + difficulty + "\'"); }
public static void DeleteParty(PMDCP.DatabaseConnector.MySql.MySql database, Party partyData) { database.ExecuteNonQuery("DELETE FROM parties WHERE PartyID = \'" + partyData.PartyID + "\'"); }
public static void LoadItem(int itemNum, PMDCP.DatabaseConnector.MySql.MySql database) { if (items.Items.ContainsKey(itemNum) == false) { items.Items.Add(itemNum, new Item()); } string query = "SELECT name, " + "info, " + "pic, " + "item_type, " + "data1, " + "data2, " + "data3, " + "price, " + "stack_cap, " + "bound, " + "loseable, " + "rarity, " + "req_data1, " + "req_data2, " + "req_data3, " + "req_data4, " + "req_data5, " + "scripted_req, " + "add_hp, " + "add_pp, " + "add_atk, " + "add_def, " + "add_spatk, " + "add_spdef, " + "add_speed, " + "add_exp, " + "attack_speed, " + "recruit_bonus, " + "is_sandboxed, " + "zone_id " + "FROM item WHERE item.num = \'" + itemNum + "\'"; DataColumnCollection row = database.RetrieveRow(query); if (row != null) { items[itemNum].Name = row["name"].ValueString; items[itemNum].Desc = row["info"].ValueString; items[itemNum].Pic = row["pic"].ValueString.ToInt(); items[itemNum].Type = (Enums.ItemType)row["item_type"].ValueString.ToInt(); items[itemNum].Data1 = row["data1"].ValueString.ToInt(); items[itemNum].Data2 = row["data2"].ValueString.ToInt(); items[itemNum].Data3 = row["data3"].ValueString.ToInt(); items[itemNum].Price = row["price"].ValueString.ToInt(); items[itemNum].StackCap = row["stack_cap"].ValueString.ToInt(); items[itemNum].Bound = row["bound"].ValueString.ToBool(); items[itemNum].Loseable = row["loseable"].ValueString.ToBool(); items[itemNum].Rarity = row["rarity"].ValueString.ToInt(); items[itemNum].ReqData1 = row["req_data1"].ValueString.ToInt(); items[itemNum].ReqData2 = row["req_data2"].ValueString.ToInt(); items[itemNum].ReqData3 = row["req_data3"].ValueString.ToInt(); items[itemNum].ReqData4 = row["req_data4"].ValueString.ToInt(); items[itemNum].ReqData5 = row["req_data5"].ValueString.ToInt(); items[itemNum].ScriptedReq = row["scripted_req"].ValueString.ToInt(); items[itemNum].AddHP = row["add_hp"].ValueString.ToInt(); items[itemNum].AddPP = row["add_pp"].ValueString.ToInt(); items[itemNum].AddAttack = row["add_atk"].ValueString.ToInt(); items[itemNum].AddDefense = row["add_def"].ValueString.ToInt(); items[itemNum].AddSpAtk = row["add_spatk"].ValueString.ToInt(); items[itemNum].AddSpDef = row["add_spdef"].ValueString.ToInt(); items[itemNum].AddSpeed = row["add_speed"].ValueString.ToInt(); items[itemNum].AddEXP = row["add_exp"].ValueString.ToInt(); items[itemNum].AttackSpeed = row["attack_speed"].ValueString.ToInt(); items[itemNum].RecruitBonus = row["recruit_bonus"].ValueString.ToInt(); items[itemNum].IsSandboxed = row["is_sandboxed"].ValueString.ToBool(); items[itemNum].ZoneID = row["zone_id"].ValueString.ToInt(); } }