예제 #1
0
        public void DeleteBear(UUID ID)
        {
            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("DELETE FROM `BearStatus` WHERE BearID = '" + ID.UUIDs+"'", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;
                    mySqlCommand.ExecuteNonQuery();
                }
                mySqlConnection.Close();
            }

            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("DELETE FROM `BearLocation` WHERE BearID = '" + ID.UUIDs + "'", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;
                    mySqlCommand.ExecuteNonQuery();
                }
                mySqlConnection.Close();
            }

            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("DELETE FROM `BearOwner` WHERE BearID = '" + ID.UUIDs + "'", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;
                    mySqlCommand.ExecuteNonQuery();
                }
                mySqlConnection.Close();
            }
        }
예제 #2
0
 public BearStats(BearStorage BS, int clock_minutes)
 {
     dt = DateTime.Today.Day;
     run_throughs = 0.0f;
     Clock = clock_minutes;
     __BS = BS.BearUUID;
     _BS = BS;
     ProcessThread = new Timer(new TimerCallback(ProcessThread_Elapsed), (object)BS.BearUUID.UUIDs, 120000, clock_minutes * 60 * 1000);
     _BS.Status = BearStorage.Stat.Online;
 }
예제 #3
0
 public void DeleteStorageUnit(UUID ID)
 {
     using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
     {
         mySqlConnection.Open();
         using (MySqlCommand mySqlCommand = new MySqlCommand("DELETE FROM `BearFood` WHERE StorageID = '" + ID.UUIDs + "'", mySqlConnection))
         {
             mySqlCommand.CommandType = System.Data.CommandType.Text;
             mySqlCommand.ExecuteNonQuery();
         }
         mySqlConnection.Close();
     }
 }
예제 #4
0
 public string GetAge(UUID BearID)
 {
     string retData;
     using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
     {
         mySqlConnection.Open();
         using (MySqlCommand mySqlCommand = new MySqlCommand("SELECT * FROM BearStatus WHERE BearID = '" + BearID.UUIDs + "'", mySqlConnection))
         {
             mySqlCommand.CommandType = System.Data.CommandType.Text;
             MySqlDataReader Reader = mySqlCommand.ExecuteReader();
             if (Reader.Read() == true)
             {
                 retData = Reader.GetString(Reader.GetOrdinal("Age"));
             }
             else
             {
                 retData = "ERROR:BearHack";
             }
             Reader.Dispose();
         }
         mySqlConnection.Close();
     }
     return retData;
 }
예제 #5
0
 public void SetType(UUID BearID, string value)
 {
     using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
     {
         mySqlConnection.Open();
         using (MySqlCommand mySqlCommand = new MySqlCommand("UPDATE `BearStatus` SET Type = '" + value + "' WHERE BearID = '" + BearID.UUIDs + "'", mySqlConnection))
         {
             mySqlCommand.CommandType = System.Data.CommandType.Text;
             mySqlCommand.ExecuteNonQuery();
         }
         mySqlConnection.Close();
     }
 }
예제 #6
0
 public void SetAmount(UUID ID, string value)
 {
     using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
     {
         mySqlConnection.Open();
         using (MySqlCommand mySqlCommand = new MySqlCommand("UPDATE `BearFood` SET Amount = " + value + " WHERE StorageID = '" + ID.UUIDs + "'", mySqlConnection))
         {
             mySqlCommand.CommandType = System.Data.CommandType.Text;
             mySqlCommand.ExecuteNonQuery();
         }
         mySqlConnection.Close();
     }
 }
예제 #7
0
        public UUID NewStorageUnit(string OwnerName, string OwnerKey, string StorageType, string amount, string Loss)
        {
            UUID ID = new UUID();
            ID.GenerateUUID("BearFood");
            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("INSERT INTO `BearFood` " +
            "(`StorageID`,`OwnerName`,`OwnerKey`, `StorageType`, `Amount`, `Loss`)" +
            "VALUES ('" + ID.UUIDs + "', '" + OwnerName + "', '" + OwnerKey + "', '" + StorageType + "', '" + amount + "', '" + Loss + "')", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;
                    mySqlCommand.ExecuteNonQuery();
                }
                mySqlConnection.Close();
            }

            return ID;
        }
예제 #8
0
        public UUID NewBear(string OwnerName, string OwnerKey, string Breed, string type, string Region, string Position, string Rotation)
        {
            /* OwnerName=Zayne%20Exonar&OwnerKey=faaf0c17%2D1432%2D4886%2Da17f%2D5e286324943b&Breed=&type=Grizzly%20Bear&Region=Gigli%20Portico&Position=%3C24%2E17173%2C%2037%2E28614%2C%2034%2E46193%3E&Rotation=%3C0%2E00000%2C%200%2E00000%2C%200%2E00000%2C%201%2E00000%3E&*/
            UUID ID = new UUID();
            Random r = new Random();
            Vector3D v3D = new Vector3D(Position);
            ID.GenerateUUID("BearStatus");
            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("INSERT INTO BearStatus " +
            "(`BearID`,`Hunger`,`Thirst`,`Fun`,`Health`,`Depression`,`BearName`,`Age`,`Breed`,`Gender`,`Type`,`serveraddress`)" +
            "VALUES ('"+ID.UUIDs+"', '50', '50', '50', '100', '0', 'EcoLife-Bear', '0', '"+Breed+"', '"+ (r.Next(1, 2) == 2 ? "Male" : "Female") +"', '"+type+"', 'NULL')", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;

                    mySqlCommand.ExecuteNonQuery();

                }
                mySqlConnection.Close();
            }

            //command.CommandText =
            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("INSERT INTO BearLocation " +
            "(`BearID`,`Region`,`position`,`rotation`,`slurl`)" +
            "VALUES ('" + ID.UUIDs + "','" + Region + "', '" + Position + "', '" + Rotation + "', 'http://slurl.com/secondlife/"
            + Region + "/" + v3D.X + "/" + v3D.Y + "/" + v3D.Z + "')", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;
                    mySqlCommand.ExecuteNonQuery();
                }
                mySqlConnection.Close();
            }

            using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
            {
                mySqlConnection.Open();
                using (MySqlCommand mySqlCommand = new MySqlCommand("INSERT INTO `BearOwner` " +
            "(`BearID`,`OwnerName`,`OwnerKey`)" +
            "VALUES ('" + ID.UUIDs + "', '" + OwnerName + "', '" + OwnerKey + "')", mySqlConnection))
                {
                    mySqlCommand.CommandType = System.Data.CommandType.Text;
                    mySqlCommand.ExecuteNonQuery();
                }
                mySqlConnection.Close();
            }
            return ID;
        }
예제 #9
0
 public string GetOwnerName(UUID BearID)
 {
     string StrRet = "";
     using (MySqlConnection mySqlConnection = new MySqlConnection(MyConString))
     {
         mySqlConnection.Open();
         using (MySqlCommand mySqlCommand = new MySqlCommand("SELECT * FROM `BearOwner` WHERE BearID = '" + BearID.UUIDs + "'", mySqlConnection))
         {
             mySqlCommand.CommandType = System.Data.CommandType.Text;
             MySqlDataReader Reader = mySqlCommand.ExecuteReader();
             if (Reader.Read() == true)
             {
                 StrRet = Reader.GetString(Reader.GetOrdinal("OwnerName"));
             }
             else
             {
                 StrRet = "ERROR:BearHack";
             }
             Reader.Dispose();
         }
         mySqlConnection.Close();
     }
     return StrRet;
 }
예제 #10
0
 public StorageType(string OwnerName, string OwnerKey, string StorageType, string amount, string Loss)
 {
     sID = MP.NewStorageUnit(OwnerName, OwnerKey, StorageType, amount, Loss);
 }
예제 #11
0
 public StorageType(UUID ID)
 {
     sID = ID;
 }
예제 #12
0
        internal static bool BearCheck(UUID ID)
        {
            bool RetData = true;
            string key = ID.UUIDs;
            if (BSUUID.ContainsKey(key))
            {
                RetData = (new BearStorage(ID).Status == BearStorage.Stat.Online ? false : true);
                string var = (new BearStorage(ID).Status == BearStorage.Stat.Online ? "" : BSUUID[key].Start());

            }
            else
            {
                ActiveBears.Add(ID.UUIDs, new BearStorage(ID));
                BSUUID.Add(key, new BearStats(ActiveBears[key], Status_time));
                BSUUID[key].Start();
                RetData = true;
            }
            return RetData;
        }
예제 #13
0
 public BearStorage(string OwnerName, string OwnerKey, string Breed, string type, string Region, string Position, string Rotation)
 {
     BearUUID = SP.NewBear(OwnerName, OwnerKey, Breed, type, Region, Position, Rotation);
 }
예제 #14
0
 public BearStorage(UUID BearsID)
 {
     BearUUID = BearsID;
 }