示例#1
0
 internal static MoplaBreed CreateMonsterplantBreed(Pet Pet)
 {
     MoplaBreed breed = null;
     if (Pet.Type == 16)
     {
         Tuple<string, string> tuple = GeneratePlantData(Pet.Rarity);
         breed = new MoplaBreed(Pet, Pet.PetId, Pet.Rarity, tuple.Item1, tuple.Item2, 0, 1);
         using (IQueryAdapter adapter = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
         {
             adapter.setQuery("INSERT INTO bots_monsterplants (pet_id, rarity, plant_name, plant_data) VALUES (@petid , @rarity , @plantname , @plantdata)");
             adapter.addParameter("petid", Pet.PetId);
             adapter.addParameter("rarity", Pet.Rarity);
             adapter.addParameter("plantname", tuple.Item1);
             adapter.addParameter("plantdata", tuple.Item2);
             adapter.runQuery();
         }
     }
     return breed;
 }
示例#2
0
文件: Catalog.cs 项目: BjkGkh/Mercury
 internal static Pet GeneratePetFromRow(DataRow Row, DataRow mRow)
 {
     if (Row == null)
     {
         return null;
     }
     MoplaBreed moplaBreed = null;
     if (Convert.ToUInt32(mRow["type"]) == 16u)
     {
         using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
         {
             queryreactor.setQuery("SELECT * FROM bots_monsterplants WHERE pet_id = " + Convert.ToUInt32(Row["id"]));
             DataRow row = queryreactor.getRow();
             moplaBreed = new MoplaBreed(row);
         }
     }
     return new Pet(Convert.ToUInt32(Row["id"]), Convert.ToUInt32(Row["user_id"]), Convert.ToUInt32(Row["room_id"]), (string)Row["name"], Convert.ToUInt32(mRow["type"]), (string)mRow["race"], (string)mRow["color"], (int)mRow["experience"], (int)mRow["energy"], (int)mRow["nutrition"], (int)mRow["respect"], Convert.ToDouble(mRow["createstamp"]), (int)Row["x"], (int)Row["y"], Convert.ToDouble(Row["z"]), (int)mRow["have_saddle"] == 1, (int)mRow["anyone_ride"], (int)mRow["hairdye"], (int)mRow["pethair"], (int)mRow["rarity"], MercuryEnvironment.UnixToDateTime((double)((int)mRow["lasthealth_stamp"])), MercuryEnvironment.UnixToDateTime((double)((int)mRow["untilgrown_stamp"])), moplaBreed);
 }