[FIX] [QUERY CHUNK] User_pets

Results 1 to 7 of 7
  1. #1
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    [FIX] [QUERY CHUNK] User_pets

    hi all,

    Had some major issues with user_pets, had this fixed a while ago.. But remembered it breaks the room_save because of the try { } function.

    So meaning if you have the bug, some rooms won't save when you are having pets.

    Search for AppendPetsUpdateString, replace entire function with;
    Code:
    internal void AppendPetsUpdateString(IQueryAdapter dbClient)
            {
                List<uint> list = new List<uint>();
    
                foreach (Pet pet in this.GetPets())
                {
                    if (!list.Contains(pet.PetId))
                    {
                        list.Add(pet.PetId);
    
                        if (pet.DBState == DatabaseUpdateState.NeedsInsert)
                        {
    
                            QueryChunk chunk = new QueryChunk("INSERT INTO user_pets (id,user_id,room_id,name,type,race,color,expirience,energy,createstamp,nutrition,respect,z,y,z) VALUES ");
                            chunk.AddParameter("name", pet.Name);
                            chunk.AddParameter("race", pet.Race);
                            chunk.AddParameter("color", pet.Color);
                            chunk.AddQuery(string.Concat(new object[] { 
                                "(", pet.PetId, ",", pet.OwnerId, ",", pet.RoomId, ",@name,", pet.Type, ",@race,@color,0,100,'", pet.CreationStamp, 
                                "',0,0,0,0,0)"
                             }));
                            chunk.Execute(dbClient);
                            chunk.Dispose();
    
                            if (chunk != null)
                                chunk = null;
    
                        }
    
                        else if (pet.DBState == DatabaseUpdateState.NeedsUpdate)
                        {
                            QueryChunk chunk2 = new QueryChunk();
    
                            chunk2.AddQuery(string.Concat(new object[] { 
                                "UPDATE user_pets SET room_id = ", pet.RoomId, ", name = @name, race = @race, color = @color, type = ", pet.Type, ", expirience = ", pet.Expirience, ", energy = ", pet.Energy, ", nutrition = ", pet.Nutrition, 
                                ", respect = ", pet.Respect, ", createstamp = '", pet.CreationStamp, "', x = ", pet.X, ", Y = ", pet.Y, ", Z = ", pet.Z, " WHERE id = ", pet.PetId
                             }));
                            chunk2.AddParameter("name", pet.Name);
                            chunk2.AddParameter("race", pet.Race);
                            chunk2.AddParameter("color", pet.Color);
    
                            chunk2.Execute(dbClient);
                            chunk2.Dispose();
    
                            if (chunk2 != null)
                                chunk2 = null;
                        }
    
                        pet.DBState = DatabaseUpdateState.Updated;
                    }
                }
            }

    Fixes the following;
    Code:
    TokenID: 0Error during saving furniture for room ID?!. Stack: System.NullReferenceException: Object reference not set to an instance of an object.
       at Butterfly.Util.QueryChunk.AddParameter(String parameterName, Object value) in
    ;; I don't ask for your flaming, post it somewhere else.
    ;; Just sharing.
    ;; If it was released, then sorry?! =D

    ;; this is a fix for BcStorm or the emulator Leenster released.

    ;; Mikey


  2. #2
    Zephyr Studios PRIZM is offline
    MemberRank
    Feb 2012 Join Date
    DenmarkLocation
    2,291Posts

    Re: [FIX] [QUERY CHUNK] User_pets

    Very useful, thanks mate I love your releases :)

  3. #3
    Not so spooky... MrSpooks is offline
    MemberRank
    May 2010 Join Date
    Under a rockLocation
    1,068Posts

    Re: [FIX] [QUERY CHUNK] User_pets

    ohh sexy release, I noticed this the other day when I set up an edit! thanks mate you saved me a lot of time!

  4. #4
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    Re: [FIX] [QUERY CHUNK] User_pets

    Thanks for the very positive reactions. :) Nice to see a community not flaming.

    --
    Mikey

  5. #5
    Say whaaat pLEDGE is offline
    MemberRank
    Jun 2010 Join Date
    NorwayLocation
    299Posts

    Re: [FIX] [QUERY CHUNK] User_pets

    Could be useful for people using bcstorm?

  6. #6
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    Re: [FIX] [QUERY CHUNK] User_pets

    Quote Originally Posted by pLEDGE View Post
    Could be useful for people using bcstorm?
    Like me and the most people reading this thread, yes!

  7. #7
    Run, but I'll find you. Ddos Attack is offline
    MemberRank
    Jan 2011 Join Date
    AustraliaLocation
    908Posts

    Re: [FIX] [QUERY CHUNK] User_pets

    Great job! Going to implement this, thanks :D



Advertisement