Ejemplo n.º 1
0
 internal static bool LoadMaps(Land land)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Map_Select", conn);
             sp.AddParameter("@landID", SqlDbType.SmallInt, 2, ParameterDirection.Input, land.LandID);
             DataTable dtMaps = sp.ExecuteDataTable();
             foreach (DataRow dr in dtMaps.Rows)
             {
                 //if (dr["name"].ToString() != "Innkadi")
                 //{
                 land.Add(new Map(land.FacetID, dr));
                 Utils.Log("Loaded Map: " + dr["name"].ToString(), Utils.LogType.SystemGo);
                 //}
             }
             return(true);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(false);
         }
     }
 }
Ejemplo n.º 2
0
 internal static int SaveAccount(Account account)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Update", conn);
             sp.AddParameter("@accountID", SqlDbType.Int, 4, ParameterDirection.Input, account.accountID);
             sp.AddParameter("@notes", SqlDbType.Text, System.Int32.MaxValue, ParameterDirection.Input, account.notes);
             sp.AddParameter("@account", SqlDbType.NVarChar, 20, ParameterDirection.Input, account.accountName);
             sp.AddParameter("@password", SqlDbType.NVarChar, 100, ParameterDirection.Input, account.password);
             sp.AddParameter("@currentMarks", SqlDbType.Int, 4, ParameterDirection.Input, account.currentMarks);
             sp.AddParameter("@email", SqlDbType.NVarChar, 50, ParameterDirection.Input, account.email);
             DataTable dtPlayerStats = sp.ExecuteDataTable();
             if (dtPlayerStats == null)
             {
                 return(-1);
             }
             else
             {
                 return(1);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 3
0
 internal static int SaveLottery(Land land)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Land_Update_Lottery", conn);
             sp.AddParameter("@landID", SqlDbType.Int, 4, ParameterDirection.Input, land.LandID);
             sp.AddParameter("@lottery", SqlDbType.BigInt, 8, ParameterDirection.Input, land.Lottery);
             sp.AddParameter("@lotteryParticipants", SqlDbType.VarChar, 255, ParameterDirection.Input, Utils.ConvertListToString(land.LotteryParticipants).Trim());
             DataTable dtLand = sp.ExecuteDataTable();
             if (dtLand == null)
             {
                 return(-1);
             }
             else
             {
                 return(1);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 4
0
 internal static int UpdateStoreItem(int stockID, int stocked) // set a new stocked amount for this stockID
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Stores_Update", conn);
             sp.AddParameter("@stockID", SqlDbType.Int, 4, ParameterDirection.Input, stockID);
             sp.AddParameter("@stocked", SqlDbType.Int, 4, ParameterDirection.Input, stocked);
             DataTable dtStockItem = sp.ExecuteDataTable();
             if (dtStockItem == null)
             {
                 return(-1);
             }
             else
             {
                 return(1);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 5
0
 internal static List <Cell> GetCellList(string name)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             List <Cell>        cellsList = new List <Cell>();
             SqlStoredProcedure sp        = new SqlStoredProcedure("prApp_Cell_Select_By_Map", conn);
             sp.AddParameter("@mapName", SqlDbType.NVarChar, 50, ParameterDirection.Input, name);
             DataTable dtCellsInfo = sp.ExecuteDataTable();
             if (dtCellsInfo != null)
             {
                 foreach (DataRow dr in dtCellsInfo.Rows)
                 {
                     cellsList.Add(new Cell(dr));
                 }
                 Utils.Log("Loaded Cells: " + name, Utils.LogType.SystemGo);
                 return(cellsList);
             }
             else
             {
                 Utils.Log("DBWorld.GetCellsList returned null for map " + name, Utils.LogType.SystemFailure);
                 return(null);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(null);
         }
     }
 }
Ejemplo n.º 6
0
 internal static bool AccountExists(string account) // searches DB to see if account exists
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Check", conn);
             sp.AddParameter("@account", SqlDbType.NVarChar, 20, ParameterDirection.Input, account);
             DataTable dtAccountItem = sp.ExecuteDataTable();
             if (dtAccountItem == null || dtAccountItem.Rows.Count < 1)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(false);
         }
     }
 }
Ejemplo n.º 7
0
 internal static int GetAccountID(string account) // get an account ID (generated by db) using account name
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             int i = 0;
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Select", conn);
             sp.AddParameter("@account", SqlDbType.NVarChar, 20, ParameterDirection.Input, account);
             DataTable dtAccountItem = sp.ExecuteDataTable();
             if (dtAccountItem == null || dtAccountItem.Rows.Count < 1)
             {
                 return(-1);
             }
             foreach (DataRow dr in dtAccountItem.Rows)
             {
                 i = Convert.ToInt16(dr["AccountID"]);
                 return(i);
             }
             return(-1);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 8
0
        internal static bool QuestIDExists(int questID)
        {
            if (!GameQuest.QuestDictionary.ContainsKey(questID))
            {
                using (var conn = DataAccess.GetSQLConnection())
                {
                    try
                    {
                        var       sp            = new SqlStoredProcedure("prApp_Quest_Select", conn);
                        DataTable dtCatalogItem = sp.ExecuteDataTable();
                        foreach (DataRow dr in dtCatalogItem.Rows)
                        {
                            if (questID == Convert.ToInt32(dr["questID"]))
                            {
                                return(true);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Utils.LogException(e);
                        return(true);
                    }
                }

                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
 internal static int GetLastPlayed(int accountID) // get last played finds the last player saved on an account
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             int i = 0;
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Player_Select_By_Account", conn);
             sp.AddParameter("@accountID", SqlDbType.Int, 4, ParameterDirection.Input, accountID);
             DataTable dtPlayerItem = sp.ExecuteDataTable();
             if (dtPlayerItem == null || dtPlayerItem.Rows.Count < 1)
             {
                 return(-1);
             }
             DateTime db = DateTime.MinValue;
             DateTime dt = DateTime.MinValue;
             foreach (DataRow dr in dtPlayerItem.Rows)
             {
                 dt = Convert.ToDateTime(dr["lastOnline"]);
                 if (DateTime.Compare(dt, db) > 0)  // In Compare, > 0 means param 1 > param 2
                 {
                     db = dt;
                     i  = Convert.ToInt32(dr["playerID"]);
                 }
             }
             return(i);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 10
0
        internal static bool LoadNPCDictionary()
        {
            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    SqlStoredProcedure sp     = new SqlStoredProcedure("prApp_NPC_Select_All", conn);
                    DataTable          dtNPCs = sp.ExecuteDataTable();
                    foreach (DataRow dr in dtNPCs.Rows)
                    {
                        int npcID = Convert.ToInt32(dr["npcID"]);

                        if (!NPC.NPCDictionary.ContainsKey(npcID))
                        {
                            NPC.NPCDictionary.Add(npcID, dr);
                        }
                        else
                        {
                            Utils.Log("DAL.DBNPC.LoadNPCDictionary attempted to add an NPC ID that already exists. NPCID: " + npcID, Utils.LogType.SystemWarning);
                        }
                    }
                    Utils.Log("Loaded NPCs (" + NPC.NPCDictionary.Count.ToString() + ")", Utils.LogType.SystemGo);
                    return(true);
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(false);
                }
            }
        }
Ejemplo n.º 11
0
 internal static GameMailAttachment GetMailAttachment(long mailID)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_MailAttachment_Select_By_MailID", conn);
             sp.AddParameter("@mailID", SqlDbType.BigInt, 8, ParameterDirection.Input, mailID);
             DataTable dtMailAtt = sp.ExecuteDataTable();
             if (dtMailAtt.Rows.Count > 0)
             {
                 return(new GameMailAttachment(dtMailAtt.Rows[0]));
             }
             else
             {
                 return(null);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(null);
         }
     }
 }
Ejemplo n.º 12
0
        internal static ArrayList p_getScores()
        {
            ArrayList scoresList = new ArrayList();

            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    PC score = new PC();
                    SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Scores_Select", conn);
                    sp.AddParameter("@devRequest", SqlDbType.Bit, 1, ParameterDirection.Input, true);
                    sp.AddParameter("@classType", SqlDbType.Int, 4, ParameterDirection.Input, 0);
                    DataTable dtScores = sp.ExecuteDataTable();
                    int       max      = ProtocolYuusha.MAX_SCORES;
                    foreach (DataRow dr in dtScores.Rows)
                    {
                        if (max <= 0)
                        {
                            return(scoresList);
                        }
                        score             = new PC();
                        score             = ConvertRowToScore(score, dr, true);
                        score.UniqueID    = Convert.ToInt32(dr["playerID"]);
                        score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null);
                        scoresList.Add(score);
                        max--;
                    }
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                }
            }
            return(scoresList);
        }
Ejemplo n.º 13
0
 internal static int UpdateMailMessage(GameMailMessage mail)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Mail_Update", conn);
             sp.AddParameter("@mailID", SqlDbType.BigInt, 8, ParameterDirection.Input, mail.MailID);
             sp.AddParameter("@attachment", SqlDbType.Int, 4, ParameterDirection.Input, mail.HasAttachment);
             sp.AddParameter("@readByReceiver", SqlDbType.Int, 4, ParameterDirection.Input, mail.HasBeenReadByReceiver);
             DataTable dtMail = sp.ExecuteDataTable();
             if (dtMail == null)
             {
                 return(-1);
             }
             else
             {
                 return(1);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Ejemplo n.º 14
0
        internal static int SaveAccountField(int accountID, String field, Object var)
        {
            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Update_Field", conn);
                    sp.AddParameter("@AccountID", SqlDbType.Int, 4, ParameterDirection.Input, accountID);
                    sp.AddParameter("@field", SqlDbType.NVarChar, 50, ParameterDirection.Input, field);
                    sp.AddParameter("@type", SqlDbType.NVarChar, 50, ParameterDirection.Input, var.GetType().ToString());
                    if (var.GetType().Equals(Type.GetType("System.Int32")))
                    {
                        sp.AddParameter("@int", SqlDbType.Int, 4, ParameterDirection.Input, var);
                    }
                    else if (var.GetType().Equals(Type.GetType("System.String")))
                    {
                        sp.AddParameter("@string", SqlDbType.NVarChar, 4000, ParameterDirection.Input, var);
                    }
                    else if (var.GetType().Equals(Type.GetType("System.Boolean")))
                    {
                        sp.AddParameter("@bit", SqlDbType.Bit, 1, ParameterDirection.Input, var);
                    }
                    else if (var.GetType().Equals(Type.GetType("System.Char")))
                    {
                        sp.AddParameter("@int", SqlDbType.Char, 1, ParameterDirection.Input, var);
                    }
                    else if (var.GetType().Equals(Type.GetType("System.DateTime")))
                    {
                        sp.AddParameter("@dateTime", SqlDbType.DateTime, 8, ParameterDirection.Input, var);
                    }
                    else
                    {
                        Utils.Log("DBAccount.saveAccountProperty(" + accountID + ", " + field + ", " + var.GetType().ToString() + ") *Type Not Recognized*, " + var.GetType().ToString(), Utils.LogType.SystemFailure);
                        return(-1);
                    }

                    DataTable dtAccount = sp.ExecuteDataTable();
                    if (dtAccount == null)
                    {
                        return(-1);
                    }
                    else
                    {
                        return(1);
                    }
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(-1);
                }
            }
        }
Ejemplo n.º 15
0
 internal static List <Account> GetAllAccounts()
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         List <Account>     accounts = new List <Account>();
         SqlStoredProcedure sp       = new SqlStoredProcedure("prApp_Account_Select_All", conn);
         DataTable          dt       = sp.ExecuteDataTable();
         foreach (DataRow dr in dt.Rows)
         {
             accounts.Add(new Account(dr));
         }
         return(accounts);
     }
 }
Ejemplo n.º 16
0
 internal static Account GetAccountByName(string name)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Select", conn);
         sp.AddParameter("@account", SqlDbType.NVarChar, 20, ParameterDirection.Input, name);
         DataTable dt = sp.ExecuteDataTable();
         if (dt.Rows.Count > 0)
         {
             DataRow dr = dt.Rows[0];
             return(new Account(dr));
         }
         return(null);
     }
 }
Ejemplo n.º 17
0
        internal static ArrayList GetSpawnLinksByMap(int map)
        {
            ArrayList zones = new ArrayList();

            using (var conn = DataAccess.GetSQLConnection())
            {
                SqlStoredProcedure sp = new SqlStoredProcedure("prApp_SpawnZone_Select_By_Map", conn);
                sp.AddParameter("@map", SqlDbType.Int, 4, ParameterDirection.Input, map);
                DataTable szTable = sp.ExecuteDataTable();
                foreach (DataRow dr in szTable.Rows)
                {
                    zones.Add(new SpawnZone(dr));
                }
            }
            return(zones);
        }
Ejemplo n.º 18
0
 internal static NPC GetNPCByID(int NpcID)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_NPC_Select", conn);
             sp.AddParameter("@npcID", SqlDbType.Int, 4, ParameterDirection.Input, NpcID);
             DataTable dtNPCs = sp.ExecuteDataTable();
             return(new NPC(dtNPCs.Rows[0]));
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(null);
         }
     }
 }
Ejemplo n.º 19
0
        internal static Object GetAccountField(int accountID, String field, Type objectType)
        {
            // objectTypes: "System.Int32", "System.String", "System.Boolean", "System.Char", "System.DateTme"
            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Select_Field", conn);
                    sp.AddParameter("@accountID", SqlDbType.Int, 4, ParameterDirection.Input, accountID);
                    sp.AddParameter("@field", SqlDbType.NVarChar, 50, ParameterDirection.Input, field);
                    DataTable dtAccount = sp.ExecuteDataTable();
                    if (dtAccount == null || dtAccount.Rows.Count < 1)
                    {
                        return(null);
                    }
                    foreach (DataRow dr in dtAccount.Rows)
                    {
                        switch (objectType.ToString())
                        {
                        case "System.Int32":
                            return(Convert.ToInt32(dr[field]));

                        case "System.String":
                            return(dr[field].ToString());

                        case "System.Boolean":
                            return(Convert.ToBoolean(dr[field]));

                        case "System.Char":
                            return(Convert.ToChar(dr[field]));

                        case "System.DateTime":
                            return(Convert.ToDateTime(dr[field]));
                        }
                    }
                    return(null);
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(null);
                }
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Deprecated as of 10/16/2015. -Eb
 /// </summary>
 /// <param name="diff"></param>
 /// <returns></returns>
 internal static ArrayList GetRandomNPCs(int diff)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         ArrayList          mylist  = new ArrayList();
         int                num     = 6;
         SqlStoredProcedure sp      = new SqlStoredProcedure("prApp_NPC_Select_Random", conn);
         ArrayList          npclist = new ArrayList();
         sp.AddParameter("@difficulty", SqlDbType.Int, 8, ParameterDirection.Input, diff);
         DataTable dtNPCs = sp.ExecuteDataTable();
         foreach (DataRow dr in dtNPCs.Rows)
         {
             npclist.Add(new NPC(dr));
         }
         for (int x = 0; x < num; x++)
         {
             mylist.Add(npclist[Rules.Dice.Next(npclist.Count)]);
         }
         return(mylist);
     }
 }
Ejemplo n.º 21
0
 internal static void SetupNewCharacter(Character ch)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_CharGen_Select", conn);
             sp.AddParameter("@race", SqlDbType.VarChar, 20, ParameterDirection.Input, ch.race);
             sp.AddParameter("@classType", SqlDbType.Int, 4, ParameterDirection.Input, (int)ch.BaseProfession);
             DataTable dtSetupNewChar = sp.ExecuteDataTable();
             foreach (DataRow dr in dtSetupNewChar.Rows)
             {
                 ConvertRowToNewCharacter(ch, dr);
             }
         }
         catch (Exception e)
         {
             Utils.LogException(e);
         }
     }
 }
Ejemplo n.º 22
0
 internal static bool LoadFacets()
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp       = new SqlStoredProcedure("prApp_Facet_Select_All", conn);
             DataTable          dtFacets = sp.ExecuteDataTable();
             foreach (DataRow dr in dtFacets.Rows)
             {
                 World.Add(new Facet(dr));
                 Utils.Log("Added Facet: " + dr["Name"].ToString(), Utils.LogType.SystemGo);
             }
             return(true);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(false);
         }
     }
 }
Ejemplo n.º 23
0
 internal static bool LoadQuests()
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp      = new SqlStoredProcedure("prApp_Quest_Select", conn);
             DataTable          dtQuest = sp.ExecuteDataTable();
             foreach (DataRow dr in dtQuest.Rows)
             {
                 GameQuest.Add(new GameQuest(dr));
                 //Utils.Log("Loaded Quest: " + dr["name"].ToString(), Utils.LogType.SystemGo);
             }
             return(true);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(false);
         }
     }
 }
Ejemplo n.º 24
0
 internal static ArrayList loadBannedIPList()
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             ArrayList          bannedIPList   = new ArrayList();
             SqlStoredProcedure sp             = new SqlStoredProcedure("prApp_BannedIP_Select", conn);
             DataTable          dtBannedIPList = sp.ExecuteDataTable();
             foreach (DataRow dr in dtBannedIPList.Rows)
             {
                 bannedIPList.Add(dr["bannedIP"].ToString());
             }
             return(bannedIPList);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(null);
         }
     }
 }
Ejemplo n.º 25
0
 internal static bool LoadLands(Facet facet) // return true if lands were loaded correctly
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp      = new SqlStoredProcedure("prApp_Land_Select", conn);
             DataTable          dtLands = sp.ExecuteDataTable();
             foreach (DataRow dr in dtLands.Rows)
             {
                 facet.Add(new Land(facet.FacetID, dr));
                 Utils.Log("Added Land: " + dr["Name"].ToString() + " to Facet: " + facet.Name, Utils.LogType.SystemGo);
             }
             return(true);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(false);
         }
     }
 }
Ejemplo n.º 26
0
 internal static bool LoadSpawnZones()
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp            = new SqlStoredProcedure("prApp_SpawnZone_Select_All", conn);
             DataTable          dtCatalogItem = sp.ExecuteDataTable();
             foreach (DataRow dr in dtCatalogItem.Rows)
             {
                 SpawnZone.Add(new SpawnZone(dr));
             }
             Utils.Log("Loaded SpawnZones (" + SpawnZone.Spawns.Count + ")", Utils.LogType.SystemGo);
             return(true);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(false);
         }
     }
 }
Ejemplo n.º 27
0
        internal static List <int> GetQuestIDList()
        {
            using (var conn = DataAccess.GetSQLConnection())
            {
                List <int> idList = new List <int>();

                try
                {
                    var       sp            = new SqlStoredProcedure("prApp_Quest_Select", conn);
                    DataTable dtCatalogItem = sp.ExecuteDataTable();
                    foreach (DataRow dr in dtCatalogItem.Rows)
                    {
                        idList.Add(Convert.ToInt32(dr["questID"]));
                    }
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                }

                return(idList);
            }
        }
Ejemplo n.º 28
0
 internal static List <GameMailMessage> GetMailBySenderID(int senderID) // retrieves locker record from PlayerLocker table
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             List <GameMailMessage> mailList = new List <GameMailMessage>();
             SqlStoredProcedure     sp       = new SqlStoredProcedure("prApp_Mail_Select_By_SenderID", conn);
             sp.AddParameter("@senderID", SqlDbType.Int, 4, ParameterDirection.Input, senderID);
             DataTable dtMail = sp.ExecuteDataTable();
             foreach (DataRow dr in dtMail.Rows)
             {
                 mailList.Add(new GameMailMessage(dr));
             }
             return(mailList);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(null);
         }
     }
 }
Ejemplo n.º 29
0
        //insertItem = new SqlStoredProcedure("prApp_CatalogItem_Insert", conn);
        //insertItem.Parameters.AddWithValue("@notes", notes);
        //insertItem.Parameters.AddWithValue("@combatAdds", combatAdds);
        //insertItem.Parameters.AddWithValue("@itemID", itemID);
        //insertItem.Parameters.AddWithValue("@itemType", itemType);
        //insertItem.Parameters.AddWithValue("@baseType", baseType);
        //insertItem.Parameters.AddWithValue("@name", name);
        //insertItem.Parameters.AddWithValue("@visualKey", visualKey);
        //insertItem.Parameters.AddWithValue("@unidentifiedName", unidentifiedName);
        //insertItem.Parameters.AddWithValue("@identifiedName", identifiedName);
        //insertItem.Parameters.AddWithValue("@shortDesc", shortDesc);
        //insertItem.Parameters.AddWithValue("@longDesc", longDesc);
        //insertItem.Parameters.AddWithValue("@wearLocation", wearLocation);
        //insertItem.Parameters.AddWithValue("@weight", weight);
        //insertItem.Parameters.AddWithValue("@coinValue", coinValue);
        //insertItem.Parameters.AddWithValue("@size", size);
        //insertItem.Parameters.AddWithValue("@effectType", effectType);
        //insertItem.Parameters.AddWithValue("@effectAmount", effectAmount);
        //insertItem.Parameters.AddWithValue("@effectDuration", effectDuration);
        //insertItem.Parameters.AddWithValue("@special", special);
        //insertItem.Parameters.AddWithValue("@minDamage", minDamage);
        //insertItem.Parameters.AddWithValue("@maxDamage", maxDamage);
        //insertItem.Parameters.AddWithValue("@skillType", skillType);
        //insertItem.Parameters.AddWithValue("@vRandLow", vRandLow);
        //insertItem.Parameters.AddWithValue("@vRandHigh", vRandHigh);
        //insertItem.Parameters.AddWithValue("@key", key);
        //insertItem.Parameters.AddWithValue("@recall", recall);
        //insertItem.Parameters.AddWithValue("@alignment", alignment);
        //insertItem.Parameters.AddWithValue("@spell", spell);
        //insertItem.Parameters.AddWithValue("@spellPower", spellPower);
        //insertItem.Parameters.AddWithValue("@charges", charges);
        //insertItem.Parameters.AddWithValue("@attackType", attackType);
        //insertItem.Parameters.AddWithValue("@blueglow", blueglow);
        //insertItem.Parameters.AddWithValue("@flammable", flammable);
        //insertItem.Parameters.AddWithValue("@fragile", fragile);
        //insertItem.Parameters.AddWithValue("@lightning", lightning);
        //insertItem.Parameters.AddWithValue("@returning", returning);
        //insertItem.Parameters.AddWithValue("@silver", silver);
        //insertItem.Parameters.AddWithValue("@attuneType", attuneType);
        //insertItem.Parameters.AddWithValue("@figExp", figExp);
        //insertItem.Parameters.AddWithValue("@armorClass", armorClass);
        //insertItem.Parameters.AddWithValue("@armorType", armorType);
        //insertItem.Parameters.AddWithValue("@bookType", bookType);
        //insertItem.Parameters.AddWithValue("@maxPages", maxPages);
        //insertItem.Parameters.AddWithValue("@pages", pages);
        //insertItem.Parameters.AddWithValue("@drinkDesc", drinkDesc);
        //insertItem.Parameters.AddWithValue("@fluidDesc", fluidDesc);
        //insertItem.Parameters.AddWithValue("@lootTable", lootTable);

        /// <summary>
        /// All items in the database are loaded into the Item Dictionary.
        /// </summary>
        /// <returns></returns>
        internal static bool LoadItems()
        {
            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    var       sp            = new SqlStoredProcedure("prApp_CatalogItem_Select_All", conn);
                    DataTable dtCatalogItem = sp.ExecuteDataTable();
                    foreach (DataRow dr in dtCatalogItem.Rows)
                    {
                        int itemID = Convert.ToInt32(dr["itemID"]);

                        if (!Item.ItemDictionary.ContainsKey(itemID))
                        {
                            if (dr["notes"].ToString() != Autonomy.ItemBuilding.ItemGenerationManager.ITEM_INSERT_NOTES_DEFAULT)
                            {
                                Item.ItemDictionary.Add(itemID, dr);
                            }
                            else
                            {
                                Utils.Log("Failed to add Item ID " + itemID + " to Item Dictionary. Item is a default item and the notes have not been modified.", Utils.LogType.SystemFailure);
                            }
                        }
                        else
                        {
                            Utils.Log("Failed to add Item ID " + itemID + " to Item Dictionary. Item ID already exists.", Utils.LogType.SystemFailure);
                        }
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(false);
                }
            }
        }
Ejemplo n.º 30
0
        internal static List <StoreItem> LoadStoreItems(int spawnZoneID)
        {
            List <StoreItem> store = new List <StoreItem>();

            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Stores_Select", conn);
                    sp.AddParameter("@spawnZoneID", SqlDbType.Int, 4, ParameterDirection.Input, spawnZoneID);
                    DataTable dtScoresItem = sp.ExecuteDataTable();
                    foreach (DataRow dr in dtScoresItem.Rows)
                    {
                        store.Add(new StoreItem(dr));
                    }
                    return(store);
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(null);
                }
            }
        }