Example #1
0
        public static Pet CreatePet(int UserId, string Name, int Type, string Race, string Color)
        {
            Pet Pet = new Pet(0, UserId, 0, Name, Type, Race, Color, 0, 100, 100, 0, ProjectHub.GetUnixTimestamp(), 0, 0, 0.0, 0, 0, 0, -1, "-1");

            using (IQueryAdapter DbClient = ProjectHub.GetDatabaseManager().GetQueryReactor())
            {
                DbClient.SetQuery("INSERT INTO " + ProjectHub.DbPrefix + "bots (user_id,name, ai_type) VALUES (" + Pet.OwnerId + ",@" + Pet.PetId + "name, 'pet')");
                DbClient.AddParameter(Pet.PetId + "name", Pet.Name);
                Pet.PetId = Convert.ToInt32(DbClient.InsertQuery());

                DbClient.SetQuery("INSERT INTO " + ProjectHub.DbPrefix + "bots_petdata (id,type,race,color,experience,energy,createstamp) VALUES (" + Pet.PetId + ", " + Pet.Type + ",@" + Pet.PetId + "race,@" + Pet.PetId + "color,0,100,UNIX_TIMESTAMP())");
                DbClient.AddParameter(Pet.PetId + "race", Pet.Race);
                DbClient.AddParameter(Pet.PetId + "color", Pet.Color);
                DbClient.RunQuery();
            }

            return(Pet);
        }
Example #2
0
 public double FormatTimestamp()
 {
     return(ProjectHub.GetUnixTimestamp() - 172800.0);
 }