Example #1
0
 internal static int DeleteAccount(int accountID)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Delete", conn);
         sp.AddParameter("@accountID", SqlDbType.Int, 4, ParameterDirection.Input, accountID);
         return(sp.ExecuteNonQuery());
     }
 }
Example #2
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);
                }
            }
        }
Example #3
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);
                }
            }
        }
Example #4
0
 internal static int InsertAccount(string account, string password, string ipAddress, string email) // insert a new account
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Account_Insert", conn);
             sp.AddParameter("@account", SqlDbType.NVarChar, 20, ParameterDirection.Input, account);
             sp.AddParameter("@password", SqlDbType.NVarChar, 100, ParameterDirection.Input, password);
             sp.AddParameter("@ipAddress", SqlDbType.NVarChar, 16, ParameterDirection.Input, ipAddress);
             sp.AddParameter("@ipAddressList", SqlDbType.NVarChar, 16, ParameterDirection.Input, ipAddress); // initial IPAddressList is current IPAddress only
             sp.AddParameter("@email", SqlDbType.NVarChar, 50, ParameterDirection.Input, email);
             return(sp.ExecuteNonQuery());
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Example #5
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);
         }
     }
 }
Example #6
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);
         }
     }
 }
Example #7
0
 internal static int DeleteSpawnZone(int spawnZoneID)
 {
     try
     {
         SqlStoredProcedure sp = new SqlStoredProcedure("prApp_SpawnZone_Delete", DataAccess.GetSQLConnection());
         sp.AddParameter("@zoneID", SqlDbType.Int, 4, ParameterDirection.Input, spawnZoneID);
         return(sp.ExecuteNonQuery());
     }
     catch (Exception e)
     {
         Utils.LogException(e);
         return(-1);
     }
 }
Example #8
0
 internal static bool CellInfoExists(string MapName, int XCord, int YCord)
 {
     try
     {
         SqlStoredProcedure sp = new SqlStoredProcedure("prApp_CellsInfo_Select_One", DataAccess.GetSQLConnection());
         sp.AddParameter("@MapName", SqlDbType.NVarChar, 50, ParameterDirection.Input, MapName);
         sp.AddParameter("@XCord", SqlDbType.Int, 4, ParameterDirection.Input, XCord);
         sp.AddParameter("@YCord", SqlDbType.Int, 4, ParameterDirection.Input, YCord);
         if (sp.ExecuteNonQuery() == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         Utils.LogException(e);
         return(false);
     }
 }
Example #9
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);
     }
 }
Example #10
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);
        }
Example #11
0
 internal static int InsertSegue(int Land1, int Map1, int yCord1, int xCord1, int Land2, int Map2, int yCord2, int xCord2, int height)
 {
     try
     {
         SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Segue_Insert", DataAccess.GetSQLConnection());
         sp.AddParameter("@Land1ID", SqlDbType.Int, 4, ParameterDirection.Input, Land1);
         sp.AddParameter("@Map1ID", SqlDbType.Int, 4, ParameterDirection.Input, Map1);
         sp.AddParameter("@Ycord1", SqlDbType.Int, 4, ParameterDirection.Input, yCord1);
         sp.AddParameter("@Xcord1", SqlDbType.Int, 4, ParameterDirection.Input, xCord1);
         sp.AddParameter("@Land2ID", SqlDbType.Int, 4, ParameterDirection.Input, Land2);
         sp.AddParameter("@Map2ID", SqlDbType.Int, 4, ParameterDirection.Input, Map2);
         sp.AddParameter("@Ycord2", SqlDbType.Int, 4, ParameterDirection.Input, yCord2);
         sp.AddParameter("@Xcord2", SqlDbType.Int, 4, ParameterDirection.Input, xCord2);
         sp.AddParameter("@Height", SqlDbType.Int, 4, ParameterDirection.Input, height);
         return(sp.ExecuteNonQuery());
     }
     catch
     {
         //Log the error
         return(-1);
     }
 }
Example #12
0
 internal static int DeleteStoreItem(int stockID) // delete this stockID from a store
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Stores_Delete", conn);
             sp.AddParameter("@stockID", SqlDbType.Int, 4, ParameterDirection.Input, stockID);
             return(sp.ExecuteNonQuery());
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Example #13
0
 // Currently only one attachment per message.
 internal static int DeleteMailAttachment(long mailID)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_MailAttachment_Delete", conn);
             sp.AddParameter("@mailID", SqlDbType.BigInt, 4, ParameterDirection.Input, mailID);
             return(sp.ExecuteNonQuery());
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Example #14
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);
         }
     }
 }
Example #15
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);
     }
 }
Example #16
0
 internal static GameMailMessage GetMailByMailID(long mailID)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Mail_Select_By_MailID", conn);
             sp.AddParameter("@receiverID", SqlDbType.BigInt, 8, ParameterDirection.Input, mailID);
             DataTable dtMail = sp.ExecuteDataTable();
             if (dtMail.Rows.Count > 0)
             {
                 return(new GameMailMessage(dtMail.Rows[0]));
             }
             return(null);
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(null);
         }
     }
 }
Example #17
0
 internal static long InsertMailMessage(GameMailMessage mail)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Mail_Insert", conn);
             sp.AddParameter("@senderID", SqlDbType.Int, 4, ParameterDirection.Input, mail.SenderID);
             sp.AddParameter("@receiverID", SqlDbType.Int, 4, ParameterDirection.Input, mail.ReceiverID);
             sp.AddParameter("@timeSent", SqlDbType.DateTime, 8, ParameterDirection.Input, mail.TimeSent);
             sp.AddParameter("@subject", SqlDbType.NVarChar, 50, ParameterDirection.Input, mail.Subject);
             sp.AddParameter("@body", SqlDbType.VarChar, 4000, ParameterDirection.Input, mail.Body);
             sp.AddParameter("@attachment", SqlDbType.Bit, 1, ParameterDirection.Input, mail.HasAttachment);
             sp.AddParameter("@readByReceiver", SqlDbType.Bit, 1, ParameterDirection.Input, false);
             sp.AddParameter("@mailID", SqlDbType.BigInt, 8, ParameterDirection.Output);
             return(Convert.ToInt64(sp.ExecuteScalar()));
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Example #18
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);
         }
     }
 }
Example #19
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);
                }
            }
        }
Example #20
0
        internal static int InsertNPC(bool Update,
                                      int NPCIdent,
                                      int NpcID,
                                      string Name,
                                      string MovementString,
                                      string ShortDesc,
                                      int ArmorType,
                                      string Special,
                                      int NpcTypeCode,
                                      int BaseTypeCode,
                                      int Gold,
                                      string CharacterClassCode,
                                      int Experience,
                                      int HitsMax,
                                      int AlignCode,
                                      int Stamina,
                                      int ManaMax,
                                      int Speed,
                                      int Strength,
                                      int Dexterity,
                                      int Intelligence,
                                      int Wisdom,
                                      int Constitution,
                                      int Charisma,
                                      int Unarmed,
                                      int LootVeryCommonAmount,
                                      string LootVeryCommonArray,
                                      int LootVeryCommonOdds,
                                      int LootCommonAmount,
                                      string LootCommonArray,
                                      int LootCommonOdds,
                                      int LootRareAmount,
                                      string LootRareArray,
                                      int LootRareOdds,
                                      int LootVeryRareAmount,
                                      string LootVeryRareArray,
                                      int LootVeryRareOdds,
                                      int LootLairAmount,
                                      string LootLairArray,
                                      int LootLairOdds,
                                      string LootAlwaysArray,
                                      int LootBeltAmount,
                                      string LootBeltArray,
                                      int LootBeltOdds,
                                      string SpawnArmorArray,
                                      string SpawnLeftHandArray,
                                      int SpawnLeftHandOdds,
                                      string SpawnRightHandArray,
                                      long MaceSkill,
                                      long BowSkill,
                                      long DaggerSkill,
                                      long FlailSkill,
                                      long RapierSkill,
                                      long TwohandedSkill,
                                      long StaffSkill,
                                      long ShurikenSkill,
                                      long SwordSkill,
                                      long ThreestaffSkill,
                                      long HalberdSkill,
                                      long ThieverySkill,
                                      long MagicSkill,
                                      int Difficulty,
                                      bool IsAnimal,
                                      string TanningResult,
                                      bool IsUndead,
                                      bool IsHidden,
                                      int IsPoisonous,
                                      bool CanFly,
                                      bool CanBreatheWater,
                                      bool HasNightvision,
                                      bool IsLairCritter,
                                      string LairCells,
                                      bool IsMobile,
                                      bool CanCommand,
                                      bool RandomName,
                                      int CanCast,
                                      string AttackString1,
                                      string AttackString2,
                                      string AttackString3,
                                      string AttackString4,
                                      string AttackString5,
                                      string AttackString6,
                                      string BlockString1,
                                      string BlockString2,
                                      string BlockString3,
                                      bool IsMerchant,
                                      int MerchantType,
                                      double MerchantMarkup,
                                      int TrainerType,
                                      int gender,
                                      string Race,
                                      int Age,
                                      int Poisoned,
                                      bool hasPatrol,
                                      string patrolRoute,
                                      bool ImmuneFire,
                                      bool ImmuneCold,
                                      bool ImmuneLightning,
                                      bool ImmuneCurse,
                                      bool ImmuneDeath,
                                      bool ImmuneStun,
                                      bool ImmuneFear,
                                      bool ImmuneBlind,
                                      bool ImmunePoison)
        {
            string spToUse = "prApp_NPC_Insert";

            if (Update)
            {
                spToUse = "prApp_NPC_Update";
            }
            try
            {
                SqlStoredProcedure sp = new SqlStoredProcedure(spToUse, DataAccess.GetSQLConnection());
                if (Update)
                {
                    sp.AddParameter("@NPCIdent", SqlDbType.Int, 4, ParameterDirection.Input, NPCIdent);
                }
                sp.AddParameter("@NpcID", SqlDbType.Int, 4, ParameterDirection.Input, NpcID);
                sp.AddParameter("@Name", SqlDbType.VarChar, 255, ParameterDirection.Input, Name);
                sp.AddParameter("@MovementString", SqlDbType.VarChar, 255, ParameterDirection.Input, MovementString);
                sp.AddParameter("@ShortDesc", SqlDbType.VarChar, 50, ParameterDirection.Input, ShortDesc);
                sp.AddParameter("@BaseArmorClass", SqlDbType.Int, 4, ParameterDirection.Input, ArmorType);
                sp.AddParameter("@Special", SqlDbType.VarChar, 255, ParameterDirection.Input, Special);
                sp.AddParameter("@NpcTypeCode", SqlDbType.Int, 4, ParameterDirection.Input, NpcTypeCode);
                sp.AddParameter("@BaseTypeCode", SqlDbType.Int, 4, ParameterDirection.Input, BaseTypeCode);
                sp.AddParameter("@Gold", SqlDbType.Int, 4, ParameterDirection.Input, Gold);
                sp.AddParameter("@CharacterClassCode", SqlDbType.VarChar, 255, ParameterDirection.Input, CharacterClassCode);
                sp.AddParameter("@Experience", SqlDbType.Int, 4, ParameterDirection.Input, Experience);
                sp.AddParameter("@HitsMax", SqlDbType.Int, 4, ParameterDirection.Input, HitsMax);
                sp.AddParameter("@AlignCode", SqlDbType.Int, 4, ParameterDirection.Input, AlignCode);
                sp.AddParameter("@Stamina", SqlDbType.Int, 4, ParameterDirection.Input, Stamina);
                sp.AddParameter("@ManaMax", SqlDbType.Int, 4, ParameterDirection.Input, ManaMax);
                sp.AddParameter("@Speed", SqlDbType.Int, 4, ParameterDirection.Input, Speed);
                sp.AddParameter("@Strength", SqlDbType.Int, 4, ParameterDirection.Input, Strength);
                sp.AddParameter("@Dexterity", SqlDbType.Int, 4, ParameterDirection.Input, Dexterity);
                sp.AddParameter("@Intelligence", SqlDbType.Int, 4, ParameterDirection.Input, Intelligence);
                sp.AddParameter("@Wisdom", SqlDbType.Int, 4, ParameterDirection.Input, Wisdom);
                sp.AddParameter("@Constitution", SqlDbType.Int, 4, ParameterDirection.Input, Constitution);
                sp.AddParameter("@Charisma", SqlDbType.Int, 4, ParameterDirection.Input, Charisma);
                sp.AddParameter("@Unarmed", SqlDbType.Int, 4, ParameterDirection.Input, Unarmed);
                sp.AddParameter("@LootVeryCommonAmount", SqlDbType.Int, 4, ParameterDirection.Input, LootVeryCommonAmount);
                sp.AddParameter("@LootVeryCommonArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootVeryCommonArray);
                sp.AddParameter("@LootVeryCommonOdds", SqlDbType.Int, 4, ParameterDirection.Input, LootVeryCommonOdds);
                sp.AddParameter("@LootCommonAmount", SqlDbType.Int, 4, ParameterDirection.Input, LootCommonAmount);
                sp.AddParameter("@LootCommonArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootCommonArray);
                sp.AddParameter("@LootCommonOdds", SqlDbType.Int, 4, ParameterDirection.Input, LootCommonOdds);
                sp.AddParameter("@LootRareAmount", SqlDbType.Int, 4, ParameterDirection.Input, LootRareAmount);
                sp.AddParameter("@LootRareArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootRareArray);
                sp.AddParameter("@LootRareOdds", SqlDbType.Int, 4, ParameterDirection.Input, LootRareOdds);
                sp.AddParameter("@LootVeryRareAmount", SqlDbType.Int, 4, ParameterDirection.Input, LootVeryRareAmount);
                sp.AddParameter("@LootVeryRareArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootVeryRareArray);
                sp.AddParameter("@LootVeryRareOdds", SqlDbType.Int, 4, ParameterDirection.Input, LootVeryRareOdds);
                sp.AddParameter("@LootLairAmount", SqlDbType.Int, 4, ParameterDirection.Input, LootLairAmount);
                sp.AddParameter("@LootLairArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootLairArray);
                sp.AddParameter("@LootLairOdds", SqlDbType.Int, 4, ParameterDirection.Input, LootLairOdds);
                sp.AddParameter("@LootAlwaysArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootAlwaysArray);
                sp.AddParameter("@LootBeltAmount", SqlDbType.Int, 4, ParameterDirection.Input, LootBeltAmount);
                sp.AddParameter("@LootBeltArray", SqlDbType.VarChar, 255, ParameterDirection.Input, LootBeltArray);
                sp.AddParameter("@LootBeltOdds", SqlDbType.Int, 4, ParameterDirection.Input, LootBeltOdds);
                sp.AddParameter("@SpawnArmorArray", SqlDbType.VarChar, 255, ParameterDirection.Input, SpawnArmorArray);
                sp.AddParameter("@SpawnLeftHandArray", SqlDbType.VarChar, 255, ParameterDirection.Input, SpawnLeftHandArray);
                sp.AddParameter("@SpawnLeftHandOdds", SqlDbType.Int, 4, ParameterDirection.Input, SpawnLeftHandOdds);
                sp.AddParameter("@SpawnRightHandArray", SqlDbType.VarChar, 255, ParameterDirection.Input, SpawnRightHandArray);
                sp.AddParameter("@MaceSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, MaceSkill);
                sp.AddParameter("@BowSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, BowSkill);
                sp.AddParameter("@FlailSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, FlailSkill);
                sp.AddParameter("@DaggerSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, DaggerSkill);
                sp.AddParameter("@RapierSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, RapierSkill);
                sp.AddParameter("@TwohandedSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, TwohandedSkill);
                sp.AddParameter("@StaffSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, StaffSkill);
                sp.AddParameter("@ShurikenSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, ShurikenSkill);
                sp.AddParameter("@SwordSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, SwordSkill);
                sp.AddParameter("@ThreestaffSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, ThreestaffSkill);
                sp.AddParameter("@HalberdSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, HalberdSkill);
                sp.AddParameter("@ThieverySkill", SqlDbType.BigInt, 8, ParameterDirection.Input, ThieverySkill);
                sp.AddParameter("@MagicSkill", SqlDbType.BigInt, 8, ParameterDirection.Input, MagicSkill);
                sp.AddParameter("@Difficulty", SqlDbType.Int, 4, ParameterDirection.Input, Difficulty);
                sp.AddParameter("@IsAnimal", SqlDbType.Bit, 1, ParameterDirection.Input, IsAnimal);
                sp.AddParameter("@TanningResult", SqlDbType.VarChar, 255, ParameterDirection.Input, TanningResult);
                sp.AddParameter("@IsUndead", SqlDbType.Bit, 1, ParameterDirection.Input, IsUndead);
                sp.AddParameter("@IsHidden", SqlDbType.Bit, 1, ParameterDirection.Input, IsHidden);
                sp.AddParameter("@IsPoisonous", SqlDbType.Int, 4, ParameterDirection.Input, IsPoisonous);
                sp.AddParameter("@CanFly", SqlDbType.Bit, 1, ParameterDirection.Input, CanFly);
                sp.AddParameter("@CanBreatheWater", SqlDbType.Bit, 1, ParameterDirection.Input, CanBreatheWater);
                sp.AddParameter("@HasNightvision", SqlDbType.Bit, 1, ParameterDirection.Input, HasNightvision);
                sp.AddParameter("@IsLairCritter", SqlDbType.Bit, 1, ParameterDirection.Input, IsLairCritter);
                sp.AddParameter("@LairCells", SqlDbType.VarChar, 255, ParameterDirection.Input, LairCells);
                sp.AddParameter("@Mobile", SqlDbType.Bit, 1, ParameterDirection.Input, IsMobile);
                sp.AddParameter("@CanCommand", SqlDbType.Bit, 1, ParameterDirection.Input, CanCommand);
                sp.AddParameter("@RandomName", SqlDbType.Bit, 1, ParameterDirection.Input, RandomName);
                sp.AddParameter("@CanCast", SqlDbType.Int, 4, ParameterDirection.Input, CanCast);
                sp.AddParameter("@AttackString1", SqlDbType.VarChar, 255, ParameterDirection.Input, AttackString1);
                sp.AddParameter("@AttackString2", SqlDbType.VarChar, 255, ParameterDirection.Input, AttackString2);
                sp.AddParameter("@AttackString3", SqlDbType.VarChar, 255, ParameterDirection.Input, AttackString3);
                sp.AddParameter("@AttackString4", SqlDbType.VarChar, 255, ParameterDirection.Input, AttackString4);
                sp.AddParameter("@AttackString5", SqlDbType.VarChar, 255, ParameterDirection.Input, AttackString5);
                sp.AddParameter("@AttackString6", SqlDbType.VarChar, 255, ParameterDirection.Input, AttackString6);
                sp.AddParameter("@BlockString1", SqlDbType.VarChar, 255, ParameterDirection.Input, BlockString1);
                sp.AddParameter("@BlockString2", SqlDbType.VarChar, 255, ParameterDirection.Input, BlockString2);
                sp.AddParameter("@BlockString3", SqlDbType.VarChar, 255, ParameterDirection.Input, BlockString3);
                sp.AddParameter("@IsMerchant", SqlDbType.Bit, 1, ParameterDirection.Input, IsMerchant);
                sp.AddParameter("@MerchantType", SqlDbType.Int, 4, ParameterDirection.Input, MerchantType);
                sp.AddParameter("@MerchantMarkup", SqlDbType.Float, 8, ParameterDirection.Input, MerchantMarkup);
                sp.AddParameter("@TrainerType", SqlDbType.Int, 4, ParameterDirection.Input, TrainerType);
                sp.AddParameter("@Gender", SqlDbType.Int, 4, ParameterDirection.Input, gender);
                sp.AddParameter("@Race", SqlDbType.VarChar, 255, ParameterDirection.Input, Race);
                sp.AddParameter("@Age", SqlDbType.Int, 4, ParameterDirection.Input, Age);
                sp.AddParameter("@Poisoned", SqlDbType.Int, 4, ParameterDirection.Input, Poisoned);
                sp.AddParameter("@hasPatrol", SqlDbType.Bit, 1, ParameterDirection.Input, hasPatrol);
                sp.AddParameter("@patrolRoute", SqlDbType.VarChar, 255, ParameterDirection.Input, patrolRoute);
                sp.AddParameter("@ImmuneFire", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneFire);
                sp.AddParameter("@ImmuneCold", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneCold);
                sp.AddParameter("@ImmunePoison", SqlDbType.Bit, 1, ParameterDirection.Input, ImmunePoison);
                sp.AddParameter("@ImmuneLightning", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneLightning);
                sp.AddParameter("@ImmuneCurse", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneCurse);
                sp.AddParameter("@ImmuneDeath", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneDeath);
                sp.AddParameter("@ImmuneStun", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneStun);
                sp.AddParameter("@ImmuneFear", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneFear);
                sp.AddParameter("@ImmuneBlind", SqlDbType.Bit, 1, ParameterDirection.Input, ImmuneBlind);
                return(sp.ExecuteNonQuery());
            }
            catch (Exception e)
            {
                Utils.LogException(e);
                return(-1);
            }
        }
Example #21
0
        internal static int InsertItem(bool Update,
                                       int catalogID,
                                       string Notes,
                                       int ItemID,
                                       int ItemTypeCode,
                                       int ItemBaseCode,
                                       string ItemName,
                                       string ShortDesc,
                                       string LongDesc,
                                       int WearLocationCode,
                                       int Weight,
                                       int CoinValue,
                                       int SizeCode,
                                       int BlockRankCode,
                                       string EffectTypeCode,
                                       string EffectAmount,
                                       int EffectDuration,
                                       string Special,
                                       int MinDamage,
                                       int MaxDamage,
                                       string SkillType,
                                       int NumThrowAttacks,
                                       int HeldRange,
                                       int ThrowRange,
                                       int BookTypeCode,
                                       int CurrentPage,
                                       int MaxPages,
                                       int vRandLow,
                                       int vRandHigh,
                                       string KeyName,
                                       bool IsRecall,
                                       bool WasRecall,
                                       int Venom,
                                       int Alignment,
                                       int MagicRegen,
                                       int ItemCharges,
                                       bool HasSpells,
                                       int AttackRankCode,
                                       int Resistance,
                                       string AttackTypeCode,
                                       string Enchantment,
                                       int ProcChance,
                                       bool Returning,
                                       bool willAttune,
                                       long FigurineExperience,
                                       int ArmorClass,
                                       string page1,
                                       string page2,
                                       string page3,
                                       string page4,
                                       string page5,
                                       string page6,
                                       string page7,
                                       string page8,
                                       string page9)
        {
            string spToUse = "prApp_CatalogItem_Insert";

            if (Update)
            {
                spToUse = "prApp_CatalogItem_Update";
            }
            try
            {
                SqlStoredProcedure sp = new SqlStoredProcedure(spToUse, DataAccess.GetSQLConnection());
                sp.AddParameter("@Notes", SqlDbType.NVarChar, 255, ParameterDirection.Input, Notes);
                if (Update)
                {
                    sp.AddParameter("@CatalogItemID", SqlDbType.Int, 4, ParameterDirection.Input, catalogID);
                }
                sp.AddParameter("@ItemID", SqlDbType.Int, 4, ParameterDirection.Input, ItemID);
                sp.AddParameter("@ItemTypeCode", SqlDbType.Int, 4, ParameterDirection.Input, ItemTypeCode);
                sp.AddParameter("@ItemBaseCode", SqlDbType.Int, 4, ParameterDirection.Input, ItemBaseCode);
                sp.AddParameter("@ItemName", SqlDbType.NVarChar, 255, ParameterDirection.Input, ItemName);
                sp.AddParameter("@ShortDesc", SqlDbType.NVarChar, 255, ParameterDirection.Input, ShortDesc);
                sp.AddParameter("@LongDesc", SqlDbType.NVarChar, 255, ParameterDirection.Input, LongDesc);
                sp.AddParameter("@WearLocationCode", SqlDbType.Int, 4, ParameterDirection.Input, WearLocationCode);
                sp.AddParameter("@Weight", SqlDbType.Int, 4, ParameterDirection.Input, Weight);
                sp.AddParameter("@CoinValue", SqlDbType.Int, 4, ParameterDirection.Input, CoinValue);
                sp.AddParameter("@SizeCode", SqlDbType.Int, 4, ParameterDirection.Input, SizeCode);
                sp.AddParameter("@BlockRankCode", SqlDbType.Int, 4, ParameterDirection.Input, BlockRankCode);
                sp.AddParameter("@EffectTypeCode", SqlDbType.NVarChar, 255, ParameterDirection.Input, EffectTypeCode);
                sp.AddParameter("@EffectAmount", SqlDbType.NVarChar, 255, ParameterDirection.Input, EffectAmount);
                sp.AddParameter("@EffectDuration", SqlDbType.Int, 4, ParameterDirection.Input, EffectDuration);
                sp.AddParameter("@Special", SqlDbType.VarChar, 255, ParameterDirection.Input, Special);
                sp.AddParameter("@MinDamage", SqlDbType.Int, 4, ParameterDirection.Input, MinDamage);
                sp.AddParameter("@MaxDamage", SqlDbType.Int, 4, ParameterDirection.Input, MaxDamage);
                sp.AddParameter("@SkillType", SqlDbType.NVarChar, 255, ParameterDirection.Input, SkillType);
                sp.AddParameter("@NumThrowAttacks", SqlDbType.Int, 4, ParameterDirection.Input, NumThrowAttacks);
                sp.AddParameter("@HeldRange", SqlDbType.Int, 4, ParameterDirection.Input, HeldRange);
                sp.AddParameter("@ThrowRange", SqlDbType.Int, 4, ParameterDirection.Input, ThrowRange);
                sp.AddParameter("@BookTypeCode", SqlDbType.Int, 4, ParameterDirection.Input, BookTypeCode);
                sp.AddParameter("@CurrentPage", SqlDbType.Int, 4, ParameterDirection.Input, CurrentPage);
                sp.AddParameter("@MaxPages", SqlDbType.Int, 4, ParameterDirection.Input, MaxPages);
                sp.AddParameter("@vRandLow", SqlDbType.Int, 4, ParameterDirection.Input, vRandLow);
                sp.AddParameter("@VRandHigh", SqlDbType.Int, 4, ParameterDirection.Input, vRandHigh);
                sp.AddParameter("@KeyName", SqlDbType.VarChar, 50, ParameterDirection.Input, KeyName);
                sp.AddParameter("@IsRecall", SqlDbType.Bit, 1, ParameterDirection.Input, IsRecall);
                sp.AddParameter("@WasRecall", SqlDbType.Int, 4, ParameterDirection.Input, WasRecall);
                sp.AddParameter("@Venom", SqlDbType.Int, 4, ParameterDirection.Input, Venom);
                sp.AddParameter("@Alignment", SqlDbType.Int, 4, ParameterDirection.Input, Alignment);
                sp.AddParameter("@MagicRegen", SqlDbType.Int, 4, ParameterDirection.Input, MagicRegen);
                sp.AddParameter("@ItemCharges", SqlDbType.Int, 4, ParameterDirection.Input, ItemCharges);
                sp.AddParameter("@HasSpells", SqlDbType.Bit, 1, ParameterDirection.Input, HasSpells);
                sp.AddParameter("@AttackRankCode", SqlDbType.Int, 4, ParameterDirection.Input, AttackRankCode);
                sp.AddParameter("@Resistance", SqlDbType.Int, 4, ParameterDirection.Input, Resistance);
                sp.AddParameter("@AttackTypeCode", SqlDbType.VarChar, 50, ParameterDirection.Input, AttackTypeCode);
                sp.AddParameter("@Enchantment", SqlDbType.VarChar, 50, ParameterDirection.Input, Enchantment);
                sp.AddParameter("@ProcChance", SqlDbType.Int, 4, ParameterDirection.Input, ProcChance);
                sp.AddParameter("@isReturning", SqlDbType.Bit, 1, ParameterDirection.Input, Returning);
                sp.AddParameter("@willAttune", SqlDbType.Bit, 1, ParameterDirection.Input, willAttune);
                sp.AddParameter("@FigurineExperience", SqlDbType.Int, 4, ParameterDirection.Input, FigurineExperience);
                sp.AddParameter("@ArmorClass", SqlDbType.Int, 4, ParameterDirection.Input, ArmorClass);
                sp.AddParameter("@page1", SqlDbType.VarChar, 255, ParameterDirection.Input, page1);
                sp.AddParameter("@page2", SqlDbType.VarChar, 255, ParameterDirection.Input, page2);
                sp.AddParameter("@page3", SqlDbType.VarChar, 255, ParameterDirection.Input, page3);
                sp.AddParameter("@page4", SqlDbType.VarChar, 255, ParameterDirection.Input, page4);
                sp.AddParameter("@page5", SqlDbType.VarChar, 255, ParameterDirection.Input, page5);
                sp.AddParameter("@page6", SqlDbType.VarChar, 255, ParameterDirection.Input, page6);
                sp.AddParameter("@page7", SqlDbType.VarChar, 255, ParameterDirection.Input, page7);
                sp.AddParameter("@page8", SqlDbType.VarChar, 255, ParameterDirection.Input, page8);
                sp.AddParameter("@page9", SqlDbType.VarChar, 255, ParameterDirection.Input, page9);

                return(sp.ExecuteNonQuery());
            }
            catch (Exception e)
            {
                Utils.LogException(e);
            }
            return(0);
        }
Example #22
0
        internal static int UpdateCellInfo(bool newCellInfo, int cellID, string notes, string mapName, int xCord, int yCord, int zCord, string segue, string description, string cellLock, bool portal, bool pvpEnabled, bool singleCustomer, bool teleport, bool mailbox)
        {
            try
            {
                string sptouse = "prApp_CellsInfo_Update";
                if (newCellInfo)
                {
                    sptouse = "prApp_CellsInfo_Insert";
                }

                SqlStoredProcedure sp = new SqlStoredProcedure(sptouse, DataAccess.GetSQLConnection());
                sp.AddParameter("@mapName", SqlDbType.VarChar, 50, ParameterDirection.Input, mapName);
                sp.AddParameter("@xCord", SqlDbType.Int, 4, ParameterDirection.Input, xCord);
                sp.AddParameter("@yCord", SqlDbType.Int, 4, ParameterDirection.Input, yCord);
                sp.AddParameter("@description", SqlDbType.NVarChar, 510, ParameterDirection.Input, description);
                sp.AddParameter("@lock", SqlDbType.NVarChar, 510, ParameterDirection.Input, cellLock);
                sp.AddParameter("@notes", SqlDbType.VarChar, 255, ParameterDirection.Input, notes);
                sp.AddParameter("@portal", SqlDbType.Bit, 1, ParameterDirection.Input, portal);
                sp.AddParameter("@zCord", SqlDbType.Int, 4, ParameterDirection.Input, zCord);
                sp.AddParameter("@segue", SqlDbType.VarChar, 50, ParameterDirection.Input, segue);
                sp.AddParameter("@pvpEnabled", SqlDbType.Bit, 1, ParameterDirection.Input, pvpEnabled);
                sp.AddParameter("@singleCustomer", SqlDbType.Bit, 1, ParameterDirection.Input, singleCustomer);
                sp.AddParameter("@teleport", SqlDbType.Bit, 1, ParameterDirection.Input, teleport);
                sp.AddParameter("@mailbox", SqlDbType.Bit, 1, ParameterDirection.Input, mailbox);
                sp.AddParameter("@cellID", SqlDbType.Int, 4, ParameterDirection.Input, cellID);
                return(sp.ExecuteNonQuery());
            }
            catch (Exception e)
            {
                Utils.LogException(e);
                return(-1);
            }
        }
Example #23
0
 internal static int InsertMailAttachment(GameMailAttachment attachment)
 {
     using (var conn = DataAccess.GetSQLConnection())
     {
         try
         {
             SqlStoredProcedure sp = new SqlStoredProcedure("prApp_MailAttachment_Insert", conn);
             sp.AddParameter("@mailID", SqlDbType.BigInt, 8, ParameterDirection.Input, attachment.MailID);
             sp.AddParameter("@itemID", SqlDbType.Int, 4, ParameterDirection.Input, attachment.ItemID);
             sp.AddParameter("@attunedID", SqlDbType.Int, 4, ParameterDirection.Input, attachment.AttunedID);
             sp.AddParameter("@special", SqlDbType.VarChar, 255, ParameterDirection.Input, attachment.Special);
             sp.AddParameter("@coinValue", SqlDbType.Float, 8, ParameterDirection.Input, attachment.CoinValue);
             sp.AddParameter("@charges", SqlDbType.Int, 4, ParameterDirection.Input, attachment.Charges);
             sp.AddParameter("@attuneType", SqlDbType.Int, 4, ParameterDirection.Input, (int)attachment.AttuneType);
             sp.AddParameter("@figExp", SqlDbType.BigInt, 8, ParameterDirection.Input, attachment.FigExp);
             sp.AddParameter("@timeCreated", SqlDbType.DateTime, 8, ParameterDirection.Input, attachment.TimeCreated);
             sp.AddParameter("@whoCreated", SqlDbType.NVarChar, 100, ParameterDirection.Input, attachment.WhoCreated);
             sp.AddParameter("@paymentRequested", SqlDbType.Float, 8, ParameterDirection.Input, attachment.PaymentRequested);
             return(sp.ExecuteNonQuery());
         }
         catch (Exception e)
         {
             Utils.LogException(e);
             return(-1);
         }
     }
 }
Example #24
0
        internal static List <PC> GetScores(Character.ClassType classType, int amount, bool devRequest, string playerName, bool pvp)
        {
            var scoresList = new List <PC>();
            var score      = new PC();
            int rank       = 1;

            using (var conn = DataAccess.GetSQLConnection())
            {
                try
                {
                    SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Scores_Select", conn);
                    sp.AddParameter("@devRequest", SqlDbType.Bit, 1, ParameterDirection.Input, devRequest);
                    sp.AddParameter("@classType", SqlDbType.VarChar, 50, ParameterDirection.Input, classType.ToString());
                    DataTable dtScores = sp.ExecuteDataTable();
                    foreach (DataRow dr in dtScores.Rows)
                    {
                        if (playerName != "")
                        {
                            if (dr["name"].ToString().ToLower() == playerName.ToString().ToLower())
                            {
                                score             = new PC();
                                score.UniqueID    = Convert.ToInt32(dr["playerID"]);
                                score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null);
                                if (score.IsAnonymous)
                                {
                                    if (devRequest)
                                    {
                                        score.TemporaryStorage = rank;
                                        score = ConvertRowToScore(score, dr, devRequest);
                                        scoresList.Add(score);
                                    }
                                    return(scoresList);
                                }
                                else
                                {
                                    score.TemporaryStorage = rank;
                                    score = ConvertRowToScore(score, dr, devRequest);
                                    scoresList.Add(score);
                                    return(scoresList);
                                }
                            }
                            if (Convert.ToInt32(dr["impLevel"]) == 0 || score.Name.ToLower() == playerName.ToLower())
                            {
                                rank++;
                            }
                        }
                        else
                        {
                            if (amount == 0)
                            {
                                break;
                            }
                            score             = new PC();
                            score.UniqueID    = Convert.ToInt32(dr["playerID"]);
                            score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null);
                            if (devRequest)                    // devs get to see a list of everyone
                            {
                                score.TemporaryStorage = rank; // player ID is used to store the player's rank
                                score = ConvertRowToScore(score, dr, devRequest);
                                scoresList.Add(score);
                                if (!score.IsAnonymous && score.ImpLevel == Globals.eImpLevel.USER)
                                {
                                    amount--;
                                }
                            }
                            else // only add the score to the list if they are not anonymous
                            {
                                score.TemporaryStorage = rank;
                                score = ConvertRowToScore(score, dr, devRequest);
                                scoresList.Add(score);
                                amount--;
                            }
                            rank++;
                        }
                    }
                    return(scoresList);
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(null);
                }
            }
        }
Example #25
0
        internal static int UpdateSpawnZone(bool newSZL, string notes, bool enabled, int npcID, int spawnTimer, int maxAllowedInZone, string spawnMessage, string npcList,
                                            int minZone, int maxZone, int spawnLand, int spawnMap, int spawnX, int spawnY, int spawnZ, int spawnRadius, string spawnZRange)
        {
            string sptouse = "prApp_SpawnZoneLink_Update";

            if (newSZL)
            {
                sptouse = "prApp_SpawnZoneLink_Insert";
            }

            try
            {
                SqlStoredProcedure sp = new SqlStoredProcedure(sptouse, DataAccess.GetSQLConnection());

                sp.AddParameter("@notes", SqlDbType.VarChar, 255, ParameterDirection.Input, notes);
                sp.AddParameter("@enabled", SqlDbType.Bit, 1, ParameterDirection.Input, enabled);
                sp.AddParameter("@npcID", SqlDbType.Int, 4, ParameterDirection.Input, npcID);
                sp.AddParameter("@spawnTimer", SqlDbType.Int, 4, ParameterDirection.Input, spawnTimer);
                sp.AddParameter("@maxAllowedInZone", SqlDbType.Int, 4, ParameterDirection.Input, maxAllowedInZone);
                sp.AddParameter("@spawnMessage", SqlDbType.VarChar, 255, ParameterDirection.Input, spawnMessage);
                sp.AddParameter("@npcList", SqlDbType.VarChar, 255, ParameterDirection.Input, npcList);
                sp.AddParameter("@minZone", SqlDbType.Int, 4, ParameterDirection.Input, minZone);
                sp.AddParameter("@maxZone", SqlDbType.Int, 4, ParameterDirection.Input, maxZone);
                sp.AddParameter("@spawnLand", SqlDbType.Int, 4, ParameterDirection.Input, spawnLand);
                sp.AddParameter("@spawnMap", SqlDbType.Int, 4, ParameterDirection.Input, spawnMap);
                sp.AddParameter("@spawnX", SqlDbType.Int, 4, ParameterDirection.Input, spawnX);
                sp.AddParameter("@spawnY", SqlDbType.Int, 4, ParameterDirection.Input, spawnY);
                sp.AddParameter("@spawnZ", SqlDbType.Int, 4, ParameterDirection.Input, spawnZ);
                sp.AddParameter("@spawnRadius", SqlDbType.Int, 4, ParameterDirection.Input, spawnRadius);
                sp.AddParameter("@spawnZRange", SqlDbType.VarChar, 255, ParameterDirection.Input, spawnZRange);
                return(sp.ExecuteNonQuery());
            }
            catch (Exception e)
            {
                Utils.LogException(e);
                return(-1);
            }
        }