Example #1
0
        /// <summary>
        /// Called when [respect].
        /// </summary>
        internal void OnRespect()
        {
            {
                Respect++;
                var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RespectPetMessageComposer"));
                serverMessage.AppendInteger(VirtualId);
                serverMessage.AppendBool(true);
                Room.SendMessage(serverMessage);

                serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("PetRespectNotificationMessageComposer"));
                serverMessage.AppendInteger(1);
                serverMessage.AppendInteger(VirtualId);
                SerializeInventory(serverMessage);
                Room.SendMessage(serverMessage);

                if (DbState != DatabaseUpdateState.NeedsInsert)
                {
                    DbState = DatabaseUpdateState.NeedsUpdate;
                }
                if (Type != 16 && Experience <= 51900)
                {
                    AddExperience(10);
                }
                if (Type == 16)
                {
                    Energy = 100;
                }
                LastHealth = DateTime.Now.AddSeconds(129600.0);
            }
        }
Example #2
0
 public Pet(int PetId, int OwnerId, int RoomId, string Name, int Type, string Race, string Color, int experience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, int Saddle, int Anyonecanride, int Dye, int PetHer, string GnomeClothing)
 {
     this.PetId         = PetId;
     this.OwnerId       = OwnerId;
     this.RoomId        = RoomId;
     this.Name          = Name;
     this.Type          = Type;
     this.Race          = Race;
     this.Color         = Color;
     this.experience    = experience;
     this.Energy        = Energy;
     this.Nutrition     = Nutrition;
     this.Respect       = Respect;
     this.CreationStamp = CreationStamp;
     this.X             = X;
     this.Y             = Y;
     this.Z             = Z;
     this.PlacedInRoom  = false;
     this.DBState       = DatabaseUpdateState.Updated;
     this.Saddle        = Saddle;
     this.AnyoneCanRide = Anyonecanride;
     this.PetHair       = PetHer;
     this.HairDye       = Dye;
     this.GnomeClothing = GnomeClothing;
 }
Example #3
0
        public void Addexperience(int amount)
        {
            Experience = Experience + amount;
            if (Experience > 150000)
            {
                Experience = 150000;
                if (Room != null)
                {
                    Room.SendPacket(new AddExperiencePointsComposer(PetId, VirtualId, amount));
                }
                return;
            }

            if (DbState != DatabaseUpdateState.NeedsInsert)
            {
                DbState = DatabaseUpdateState.NeedsUpdate;
            }
            if (Room != null)
            {
                Room.SendPacket(new AddExperiencePointsComposer(PetId, VirtualId, amount));
                if (Experience >= ExperienceGoal)
                {
                    Room.SendPacket(new ChatComposer(VirtualId, "*leveled up to level " + Level + " *", 0, 0));
                }
            }
        }
Example #4
0
        internal void OnRespect()
        {
            checked
            {
                this.Respect++;
                ServerMessage serverMessage = new ServerMessage(Outgoing.RespectPetMessageComposer);
                serverMessage.AppendInt32(this.VirtualId);
                serverMessage.AppendBoolean(true);
                this.Room.SendMessage(serverMessage);

                serverMessage = new ServerMessage(Outgoing.PetRespectNotificationMessageComposer);
                serverMessage.AppendInt32(1);
                serverMessage.AppendInt32(this.VirtualId);
                this.SerializeInventory(serverMessage);
                this.Room.SendMessage(serverMessage);

                if (this.DBState != DatabaseUpdateState.NeedsInsert)
                {
                    this.DBState = DatabaseUpdateState.NeedsUpdate;
                }
                if (Type != 16 && this.Experience <= 51900)
                {
                    this.AddExperience(10);
                }
                if (Type == 16)
                {
                    Energy = 100;
                }
                this.LastHealth = DateTime.Now.AddSeconds(129600.0);
            }
        }
Example #5
0
        internal void OnRespect()
        {
            Respect++;


            ServerMessage Message = new ServerMessage(606);

            Message.AppendInt32(Respect);
            Message.AppendUInt(OwnerId);
            Message.AppendUInt(PetId);
            Message.AppendStringWithBreak(Name);
            Message.AppendBoolean(false);
            Message.AppendInt32(10);
            Message.AppendBoolean(false);
            Message.AppendInt32(-2);
            Message.AppendBoolean(true);
            Message.AppendStringWithBreak("281");
            Room.SendMessage(Message);

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }


            if (Expirience <= 51900)
            {
                AddExpirience(10);
            }
        }
Example #6
0
        public void PetEnergy(bool addEnergy)
        {
            if (this.Energy >= 100)
            {
                return;
            }

            int randomUsage = ButterflyEnvironment.GetRandomNumber(4, 15);

            if (!addEnergy)
            {
                this.Energy -= randomUsage;

                if (this.Energy < 0)
                {
                    this.Energy = 1;
                    randomUsage = 1;
                }
            }
            else
            {
                this.Energy = (this.Energy + randomUsage) % 100;
            }
            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }
        }
Example #7
0
 public Pet(int PetId, int OwnerId, int RoomId, string Name, int Type, string Race, string Color, int Expirience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, int havesaddle, int hairdye, int PetHair, bool CanMountAllPeople)
 {
     this.PetId         = PetId;
     this.OwnerId       = OwnerId;
     this.RoomId        = RoomId;
     this.Name          = Name;
     this.Type          = Type;
     this.Race          = Race;
     this.Color         = Color;
     this.Expirience    = Expirience;
     this.Energy        = Energy;
     this.Nutrition     = Nutrition;
     this.Respect       = Respect;
     this.CreationStamp = CreationStamp;
     this.X             = X;
     this.Y             = Y;
     this.Z             = Z;
     this.PlacedInRoom  = false;
     this.DBState       = DatabaseUpdateState.Updated;
     this.Saddle        = (havesaddle == 1) ? 9 : (havesaddle == 2) ? 10 : 0;
     this.HairDye       = hairdye;
     this.PetHair       = PetHair;
     this.AnyoneCanRide = CanMountAllPeople;
     this.PetCommands   = GetPetCommands();
 }
Example #8
0
        public void Addexperience(int Amount)
        {
            experience = experience + Amount;

            if (experience > 150000)
            {
                experience = 150000;

                if (Room != null)
                {
                    Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));
                }

                return;
            }

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Room != null)
            {
                Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));

                if (experience >= experienceGoal)
                {
                    if (RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(OwnerId) != null)
                    {
                        RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(OwnerId), "ACH_PetLevelUp", 1);
                    }
                    Room.SendMessage(new ChatComposer(VirtualId, "*leveled up to level " + Level + " *", 0, 0));
                }
            }
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pet"/> class.
 /// </summary>
 /// <param name="petId">The pet identifier.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <param name="roomId">The room identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="race">The race.</param>
 /// <param name="color">The color.</param>
 /// <param name="experience">The experience.</param>
 /// <param name="energy">The energy.</param>
 /// <param name="nutrition">The nutrition.</param>
 /// <param name="respect">The respect.</param>
 /// <param name="creationStamp">The creation stamp.</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="z">The z.</param>
 /// <param name="havesaddle">if set to <c>true</c> [havesaddle].</param>
 /// <param name="anyoneCanRide">The anyone can ride.</param>
 /// <param name="dye">The dye.</param>
 /// <param name="petHer">The pet her.</param>
 /// <param name="rarity">The rarity.</param>
 /// <param name="lastHealth">The last health.</param>
 /// <param name="untilGrown">The until grown.</param>
 /// <param name="moplaBreed">The mopla breed.</param>
 internal Pet(uint petId, uint ownerId, uint roomId, string name, uint type, string race, string color,
              int experience, int energy, int nutrition, int respect, double creationStamp, int x, int y, double z,
              bool havesaddle, int anyoneCanRide, int dye, int petHer, int rarity, DateTime lastHealth,
              DateTime untilGrown, MoplaBreed moplaBreed)
 {
     PetId              = petId;
     OwnerId            = ownerId;
     RoomId             = roomId;
     Name               = name;
     Type               = type;
     Race               = race;
     Color              = color;
     Experience         = experience;
     Energy             = energy;
     Nutrition          = nutrition;
     Respect            = respect;
     CreationStamp      = creationStamp;
     X                  = x;
     Y                  = y;
     Z                  = z;
     PlacedInRoom       = false;
     DbState            = DatabaseUpdateState.Updated;
     HaveSaddle         = havesaddle;
     AnyoneCanRide      = anyoneCanRide;
     PetHair            = petHer;
     HairDye            = dye;
     Rarity             = rarity;
     LastHealth         = lastHealth;
     UntilGrown         = untilGrown;
     MoplaBreed         = moplaBreed;
     PetCommands        = PetCommandHandler.GetPetCommands(this);
     WaitingForBreading = 0;
 }
Example #10
0
        internal void OnRespect()
        {
            Respect++;

            ServerMessage Message = new ServerMessage(Outgoing.PetRespectNotification);

            Message.AppendInt32(OwnerId); // petOwnerId
            Message.AppendInt32(1);       // respect
            SerializeInventory(Message);
            //Message.AppendUInt(PetId); // id
            //Message.AppendString(Name); // name
            //Message.AppendUInt(Type); // type
            //Message.AppendInt32(int.Parse(Race)); // breed
            //Message.AppendString(Color); // color

            Room.SendMessage(Message);

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }


            if (Expirience <= 51900)
            {
                AddExpirience(10);
            }
        }
Example #11
0
File: Pet.cs Project: BjkGkh/Boon
 public Pet(int PetId, int OwnerId, int RoomId, string Name, int Type, string Race, string Color, int experience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, int Saddle, int Anyonecanride, int Dye, int PetHer, string GnomeClothing)
 {
     this.PetId = PetId;
     this.OwnerId = OwnerId;
     this.RoomId = RoomId;
     this.Name = Name;
     this.Type = Type;
     this.Race = Race;
     this.Color = Color;
     this.experience = experience;
     this.Energy = Energy;
     this.Nutrition = Nutrition;
     this.Respect = Respect;
     this.CreationStamp = CreationStamp;
     this.X = X;
     this.Y = Y;
     this.Z = Z;
     this.PlacedInRoom = false;
     this.DBState = DatabaseUpdateState.Updated;
     this.Saddle = Saddle;
     this.AnyoneCanRide = Anyonecanride;
     this.PetHair = PetHer;
     this.HairDye = Dye;
     this.GnomeClothing = GnomeClothing;
 }
Example #12
0
        public void OnRespect()
        {
            this.Respect++;
            if (this.DBState != DatabaseUpdateState.NeedsInsert)
            {
                this.DBState = DatabaseUpdateState.NeedsUpdate;
            }
            if (this.Expirience <= 51900)
            {
                this.AddExpirience(10, 0);
            }
            ServerMessage Message = new ServerMessage(606);

            Message.AppendInt32(this.Respect);
            Message.AppendUInt(this.OwnerId);
            Message.AppendUInt(this.PetId);
            Message.AppendStringWithBreak(this.Name);
            Message.AppendBoolean(false);
            Message.AppendInt32(10);
            Message.AppendBoolean(false);
            Message.AppendInt32(-2);
            Message.AppendBoolean(true);
            Message.AppendStringWithBreak("281");
            this.Room.SendMessage(Message, null);
        }
        public void Addexperience(int Amount)
        {
            int Current = Level;

            experience = experience + Amount;

            if (experience > 150000)
            {
                experience = 150000;
            }

            if (Room != null)
            {
                Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));

                if (Level != Current)
                {
                    GameClient Session;
                    if ((Session = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(this.OwnerId)) != null)
                    {
                        QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLevelUp", 1);
                    }

                    Room.SendMessage(new ChatComposer(VirtualId, $"*leveled up to level {Level} *", 0, 0));
                }
            }

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }
        }
Example #14
0
 public void AddExpirience(int Amount, int int_9)
 {
     this.PetEnergy(int_9);
     if (this.Room != null && this.Expirience + Amount >= this.ExpirienceGoal && this.Level != this.MaxLevel)
     {
         this.Energy = this.MaxEnergy;
         ServerMessage message = new ServerMessage(24u);
         message.AppendInt32(this.VirtualId);
         message.AppendStringWithBreak("*leveled up to level " + (this.Level + 1) + "*");
         message.AppendInt32(0);
         this.Room.SendMessage(message, null);
     }
     this.Expirience += Amount;
     if (this.Expirience < 51900)
     {
         if (this.DBState != DatabaseUpdateState.NeedsInsert)
         {
             this.DBState = DatabaseUpdateState.NeedsUpdate;
         }
         if (this.Room != null)
         {
             ServerMessage message2 = new ServerMessage(609u);
             message2.AppendUInt(this.PetId);
             message2.AppendInt32(this.VirtualId);
             message2.AppendInt32(Amount);
             this.Room.SendMessage(message2, null);
         }
     }
 }
Example #15
0
 internal Pet(uint PetId, uint OwnerId, uint RoomId, string Name, uint Type, string Race, string Color, int Expirience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, bool allcanmount, int havesaddle, int hairdye, int PetHair, string Accessories)
 {
     this.PetId              = PetId;
     this.OwnerId            = OwnerId;
     this.RoomId             = RoomId;
     this.Name               = Name;
     this.Type               = Type;
     this.Race               = Race;
     this.Color              = Color;
     this.Expirience         = Expirience;
     this.Energy             = Energy;
     this.Nutrition          = Nutrition;
     this.Respect            = Respect;
     this.CreationStamp      = CreationStamp;
     this.X                  = X;
     this.Y                  = Y;
     this.Z                  = Z;
     this.PlacedInRoom       = false;
     this.DBState            = DatabaseUpdateState.Updated;
     this.AllCanMount        = allcanmount;
     this.HaveSaddle         = havesaddle;
     this.HairDye            = hairdye;
     this.PetHair            = PetHair;
     this.waitingForBreading = 0;
     this.Accessories        = Accessories;
 }
Example #16
0
        public void Addexperience(int Amount)
        {
            experience = experience + Amount;

            if (experience > 150000)
            {
                experience = 150000;

                if (Room != null)
                {
                    Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));
                }

                return;
            }

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Room != null)
            {
                Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));

                if (experience >= experienceGoal)
                {
                    Room.SendMessage(new ChatComposer(VirtualId, " *upou para o level " + Level + "*", 0, 0));
                }
            }
        }
Example #17
0
 internal Pet(uint PetId, uint OwnerId, uint RoomId, string Name, uint Type, string Race, string Color, int experience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, bool havesaddle, int Anyonecanride, int Dye, int PetHer, int Rarity, DateTime LastHealth, DateTime UntilGrown, MoplaBreed MoplaBreed)
 {
     this.PetId         = PetId;
     this.OwnerId       = OwnerId;
     this.RoomId        = RoomId;
     this.Name          = Name;
     this.Type          = Type;
     this.Race          = Race;
     this.Color         = Color;
     this.Experience    = experience;
     this.Energy        = Energy;
     this.Nutrition     = Nutrition;
     this.Respect       = Respect;
     this.CreationStamp = CreationStamp;
     this.X             = X;
     this.Y             = Y;
     this.Z             = Z;
     this.PlacedInRoom  = false;
     this.DBState       = DatabaseUpdateState.Updated;
     this.HaveSaddle    = havesaddle;
     this.AnyoneCanRide = Anyonecanride;
     this.PetHair       = PetHer;
     this.HairDye       = Dye;
     this.Rarity        = Rarity;
     this.LastHealth    = LastHealth;
     this.UntilGrown    = UntilGrown;
     this.MoplaBreed    = MoplaBreed;
     this.PetCommands   = PetCommandHandler.GetPetCommands(this);
 }
Example #18
0
        /// <summary>
        ///     Called when [respect].
        /// </summary>
        internal void OnRespect()
        {
            Respect++;

            GameClient ownerSession = Yupi.GetGame().GetClientManager().GetClientByUserId(OwnerId);

            if (ownerSession != null)
            {
                Yupi.GetGame()
                .GetAchievementManager()
                .ProgressUserAchievement(ownerSession, "ACH_PetRespectReceiver", 1);
            }

            RespectPetComposer.GenerateMessage(this);

            RespectPetNotificationComposer.GenerateMessage(this);

            if (DbState != DatabaseUpdateState.NeedsInsert)
            {
                DbState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Type != "pet_monster" && Experience <= 51900)
            {
                AddExperience(10);
            }

            if (Type == "pet_monster")
            {
                Energy = 100;
            }

            LastHealth = DateTime.Now.AddSeconds(129600.0);
        }
Example #19
0
File: Pet.cs Project: sgf/Yupi
        /// <summary>
        ///     Pets the energy.
        /// </summary>
        /// <param name="add">if set to <c>true</c> [add].</param>
        internal void PetEnergy(bool add)
        {
            int num;

            if (add)
            {
                if (Energy > 100)
                {
                    Energy = 100;

                    return;
                }

                if (Energy > 85)
                {
                    return;
                }

                if (Energy > 85)
                {
                    num = MaxEnergy - Energy;
                }
                else
                {
                    num = 10;
                }
            }

            else
            {
                num = 15;
            }

            if (num <= 4)
            {
                num = 15;
            }

            int randomNumber = Yupi.GetRandomNumber(4, num);

            if (!add)
            {
                Energy -= randomNumber;

                if (Energy < 0)
                {
                    Energy = 1;
                }
            }
            else
            {
                Energy += randomNumber;
            }

            if (DbState != DatabaseUpdateState.NeedsInsert)
            {
                DbState = DatabaseUpdateState.NeedsUpdate;
            }
        }
Example #20
0
        internal void AddExpirience(int Amount)
        {
            Expirience += Amount;

            if (Expirience >= 51900)
            {
                Expirience = 51900;
                return;
            }

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Room != null)
            {
                var Message = new ServerMessage(Outgoing.AddExperience);
                Message.AppendUInt(PetId);
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(Amount);
                Room.SendMessage(Message);

                if (Expirience >= ExpirienceGoal)
                {
                    var Session = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(OwnerId);

                    var NewLevel = new ServerMessage(Outgoing.PetNewLevel);
                    NewLevel.AppendUInt(PetId);
                    NewLevel.AppendString(Name);
                    NewLevel.AppendInt32(Level);
                    NewLevel.AppendUInt(Type);
                    NewLevel.AppendInt32(int.Parse(Race));
                    NewLevel.AppendString(Color);
                    NewLevel.AppendInt32(0);
                    NewLevel.AppendInt32(0);
                    if (Session != null)
                    {
                        Session.SendMessage(NewLevel);
                    }

                    var ChatMessage = new ServerMessage(Outgoing.Talk);
                    ChatMessage.AppendInt32(VirtualId);
                    ChatMessage.AppendString("*Nivel superado-¡Sabe más que tú!*");
                    ChatMessage.AppendInt32(0);
                    ChatMessage.AppendInt32(0);
                    ChatMessage.AppendInt32(0);
                    ChatMessage.AppendInt32(-1);
                    Room.SendMessage(ChatMessage);

                    OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(OwnerId, "ACH_PetLevelUp", 1);
                    if (Type == 26) // gnome
                    {
                        OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(OwnerId, "ACH_GnomeLevelUp", 1);
                    }
                }
            }
        }
Example #21
0
        internal void OnRespect()
        {
            Respect++;

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }

            AddExpirience(10);
            AddNutrition(10);
        }
Example #22
0
 internal void PetEnergy(bool Add)
 {
     checked
     {
         int num;
         if (Add)
         {
             if (this.Energy > 100)
             {
                 this.Energy = 100;
                 return;
             }
             else if (this.Energy > 85)
             {
                 return;
             }
             if (this.Energy > 85)
             {
                 num = Pet.MaxEnergy - this.Energy;
             }
             else
             {
                 num = 10;
             }
         }
         else
         {
             num = 15;
         }
         if (num <= 4)
         {
             num = 15;
         }
         int randomNumber = CyberEnvironment.GetRandomNumber(4, num);
         if (!Add)
         {
             this.Energy -= randomNumber;
             if (this.Energy < 0)
             {
                 this.Energy = 1;
             }
         }
         else
         {
             this.Energy += randomNumber;
         }
         if (this.DBState != DatabaseUpdateState.NeedsInsert)
         {
             this.DBState = DatabaseUpdateState.NeedsUpdate;
         }
     }
 }
Example #23
0
        public void PetEnergy(bool Add)
        {
            int MaxE;

            if (Add)
            {
                if (Energy == 100) // If Energy is 100, no point.
                {
                    return;
                }

                if (Energy > 85)
                {
                    MaxE = MaxEnergy - Energy;
                }
                else
                {
                    MaxE = 10;
                }
            }
            else
            {
                MaxE = 15; // Remove Max Energy as 15
            }
            if (MaxE <= 4)
            {
                MaxE = 15;
            }

            int r = PlusEnvironment.GetRandomNumber(4, MaxE);

            if (!Add)
            {
                Energy = Energy - r;

                if (Energy < 0)
                {
                    Energy = 1;
                    r      = 1;
                }
            }
            else
            {
                Energy = Energy + r;
            }


            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }
        }
Example #24
0
        public void PetEnergy(int Add)
        {
            this.Energy += Add;
            if (this.Energy < 0)
            {
                this.Energy = 0;
            }

            if (this.DBState != DatabaseUpdateState.NeedsInsert)
            {
                this.DBState = DatabaseUpdateState.NeedsUpdate;
            }
        }
Example #25
0
 public void OnRespect()
 {
     ++this.Respect;
     if (this.DBState != DatabaseUpdateState.NeedsInsert)
     {
         this.DBState = DatabaseUpdateState.NeedsUpdate;
     }
     if (this.Expirience > 51900)
     {
         return;
     }
     this.AddExpirience(10);
 }
Example #26
0
 public void OnRespect()
 {
     Respect++;
     Room.SendPacket(new RespectPetNotificationMessageComposer(this));
     if (DbState != DatabaseUpdateState.NeedsInsert)
     {
         DbState = DatabaseUpdateState.NeedsUpdate;
     }
     if (Experience <= 150000)
     {
         Addexperience(10);
     }
 }
Example #27
0
 public UserBot(uint BotId, uint OwnerId, string Look, string Name, bool PlacedInRoom, int RoomId, int x, int y, string botType, string wm)
 {
     this.BotId = BotId;
     this.OwnerId = OwnerId;
     this.Look = Look;
     this.Name = Name;
     this.DBState = DatabaseUpdateState.Updated;
     this.PlacedInRoom = PlacedInRoom;
     this.RoomId = RoomId;
     this.X = x;
     this.Y = y;
     this.BotType = botType;
     this.walkmode = wm;
 }
Example #28
0
 public UserBot(uint BotId, uint OwnerId, string Look, string Name, bool PlacedInRoom, int RoomId, int x, int y, string botType, string wm)
 {
     this.BotId        = BotId;
     this.OwnerId      = OwnerId;
     this.Look         = Look;
     this.Name         = Name;
     this.DBState      = DatabaseUpdateState.Updated;
     this.PlacedInRoom = PlacedInRoom;
     this.RoomId       = RoomId;
     this.X            = x;
     this.Y            = y;
     this.BotType      = botType;
     this.walkmode     = wm;
 }
Example #29
0
        public void AddExpirience(int Amount, int int_9)
        {
            this.PetEnergy(-int_9);

            bool LevelUp = false;

            if (this.Expirience < 51900)
            {
                if (this.Expirience + Amount >= this.ExpirienceGoal && this.Level != this.MaxLevel)
                {
                    LevelUp = true;
                }

                if (this.Expirience + Amount > 51900)
                {
                    this.Expirience = 51900;
                }
                else
                {
                    this.Expirience += Amount;
                }

                if (this.DBState != DatabaseUpdateState.NeedsInsert)
                {
                    this.DBState = DatabaseUpdateState.NeedsUpdate;
                }
                if (this.Room != null)
                {
                    ServerMessage message2 = new ServerMessage(Outgoing.AddExperience); // Updated
                    message2.AppendUInt(this.PetId);
                    message2.AppendInt32(this.VirtualId);
                    message2.AppendInt32(Amount);
                    this.Room.SendMessage(message2, null);
                }

                if (this.Room != null && LevelUp)
                {
                    this.Energy = this.MaxEnergy;
                    ServerMessage message = new ServerMessage(Outgoing.Talk); // Updated
                    message.AppendInt32(this.VirtualId);
                    message.AppendStringWithBreak("*Ist jetzt im Level " + (this.Level) + "*");
                    message.AppendInt32(0);
                    message.AppendInt32(0);
                    message.AppendInt32(0);
                    message.AppendInt32(-1);
                    this.Room.SendMessage(message, null);
                    //this.Room.SendMessage(this.SerializePetCommands(), null);
                }
            }
        }
Example #30
0
        internal void AddNutrition(int Amount)
        {
            Nutrition = Nutrition + 10;

            if (Nutrition > 100)
            {
                Nutrition = 100;
            }

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }
        }
Example #31
0
        public void OnRespect()
        {
            Respect++;
            Room.SendMessage(new RespectPetNotificationMessageComposer(this));

            if (DBState != DatabaseUpdateState.NeedsInsert)
            {
                DBState = DatabaseUpdateState.NeedsUpdate;
            }

            if (experience <= 150000)
            {
                Addexperience(10);
            }
            Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, 10));
        }
Example #32
0
        /// <summary>
        ///     Adds the experience.
        /// </summary>
        /// <param name="amount">The amount.</param>
        internal void AddExperience(uint amount)
        {
            int oldExperienceGoal = ExperienceGoal;

            Experience += amount;

            if (Experience >= 51900)
            {
                return;
            }

            if (DbState != DatabaseUpdateState.NeedsInsert)
            {
                DbState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Room == null)
            {
                return;
            }

            PetExperienceComposer.GenerateMessage(this, amount);

            if (Experience < oldExperienceGoal)
            {
                return;
            }

            GameClient ownerSession = Yupi.GetGame().GetClientManager().GetClientByUserId(OwnerId);

            Dictionary <uint, PetCommand> totalPetCommands = PetCommandHandler.GetAllPetCommands();

            Dictionary <uint, PetCommand> petCommands = PetCommandHandler.GetPetCommandByPetType(Type);

            if (ownerSession == null)
            {
                return;
            }

            ServerMessage levelNotify = new ServerMessage(LibraryParser.OutgoingRequest("NotifyNewPetLevelMessageComposer"));

            SerializeInventory(levelNotify, true);

            ownerSession.SendMessage(levelNotify);

            PetCommandPanelComposer.GenerateMessage(this, totalPetCommands, petCommands, ownerSession);
        }
Example #33
0
 public Pet(uint PetId, uint OwnerId, uint RoomId, string Name, uint Type, string Race, string Color, int Expirience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z)
 {
     this.PetId = PetId;
     this.OwnerId = OwnerId;
     this.RoomId = RoomId;
     this.Name = Name;
     this.Type = Type;
     this.Race = Race;
     this.Color = Color;
     this.Expirience = Expirience;
     this.Energy = Energy;
     this.Nutrition = Nutrition;
     this.Respect = Respect;
     this.CreationStamp = CreationStamp;
     this.X = X;
     this.Y = Y;
     this.Z = Z;
     this.PlacedInRoom = false;
     this.DBState = DatabaseUpdateState.Updated;
 }
Example #34
0
		public void AddExpirience(int Amount, int int_9)
		{
			this.PetEnergy(int_9);
			if (this.Room != null && this.Expirience + Amount >= this.ExpirienceGoal && this.Level != this.MaxLevel)
			{
				this.Energy = this.MaxEnergy;
				ServerMessage message = new ServerMessage(24u);
				message.AppendInt32(this.VirtualId);
				message.AppendStringWithBreak("*leveled up to level " + (this.Level + 1) + "*");
				message.AppendInt32(0);
				this.Room.SendMessage(message, null);
			}
			this.Expirience += Amount;
			if (this.Expirience < 51900)
			{
				if (this.DBState != DatabaseUpdateState.NeedsInsert)
				{
					this.DBState = DatabaseUpdateState.NeedsUpdate;
				}
				if (this.Room != null)
				{
					ServerMessage message2 = new ServerMessage(609u);
					message2.AppendUInt(this.PetId);
					message2.AppendInt32(this.VirtualId);
					message2.AppendInt32(Amount);
					this.Room.SendMessage(message2, null);
				}
			}
		}
Example #35
0
		public void OnRespect()
		{
			this.Respect++;
			if (this.DBState != DatabaseUpdateState.NeedsInsert)
			{
				this.DBState = DatabaseUpdateState.NeedsUpdate;
			}
			if (this.Expirience <= 51900)
			{
				this.AddExpirience(10, 0);
			}
			ServerMessage Message = new ServerMessage(606);
			Message.AppendInt32(this.Respect);
			Message.AppendUInt(this.OwnerId);
			Message.AppendUInt(this.PetId);
			Message.AppendStringWithBreak(this.Name);
			Message.AppendBoolean(false);
			Message.AppendInt32(10);
			Message.AppendBoolean(false);
			Message.AppendInt32(-2);
			Message.AppendBoolean(true);
			Message.AppendStringWithBreak("281");
			this.Room.SendMessage(Message, null);
		}
Example #36
0
File: Pet.cs Project: BjkGkh/Azure2
 /// <summary>
 /// Pets the energy.
 /// </summary>
 /// <param name="add">if set to <c>true</c> [add].</param>
 internal void PetEnergy(bool add)
 {
     {
         int num;
         if (add)
         {
             if (Energy > 100)
             {
                 Energy = 100;
                 return;
             }
             if (Energy > 85)
                 return;
             if (Energy > 85)
                 num = MaxEnergy - Energy;
             else
                 num = 10;
         }
         else
             num = 15;
         if (num <= 4)
             num = 15;
         var randomNumber = AzureEmulator.GetRandomNumber(4, num);
         if (!add)
         {
             Energy -= randomNumber;
             if (Energy < 0)
                 Energy = 1;
         }
         else
             Energy += randomNumber;
         if (DbState != DatabaseUpdateState.NeedsInsert)
             DbState = DatabaseUpdateState.NeedsUpdate;
     }
 }
Example #37
0
File: Pet.cs Project: habb0/Bfly
        internal void OnRespect()
        {
            Respect++;

            ServerMessage Message = new ServerMessage(606);
            Message.AppendInt32(Respect);
            Message.AppendUInt(OwnerId);
            Message.AppendUInt(PetId);
            Message.AppendStringWithBreak(Name);
            Message.AppendBoolean(false);
            Message.AppendInt32(10);
            Message.AppendBoolean(false);
            Message.AppendInt32(-2);
            Message.AppendBoolean(true);
            Message.AppendStringWithBreak("281");
            Room.SendMessage(Message);

            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (Expirience <= 51900)
            {
                AddExpirience(10);
            }
        }
Example #38
0
        /// <summary>
        ///     Called when [respect].
        /// </summary>
        internal void OnRespect()
        {
            Respect++;

            GameClient ownerSession = Yupi.GetGame().GetClientManager().GetClientByUserId(OwnerId);

            if (ownerSession != null)
                Yupi.GetGame()
                    .GetAchievementManager()
                    .ProgressUserAchievement(ownerSession, "ACH_PetRespectReceiver", 1);

            RespectPetComposer.GenerateMessage(this);

            RespectPetNotificationComposer.GenerateMessage(this);

            if (DbState != DatabaseUpdateState.NeedsInsert)
                DbState = DatabaseUpdateState.NeedsUpdate;

            if (Type != "pet_monster" && Experience <= 51900)
                AddExperience(10);

            if (Type == "pet_monster")
                Energy = 100;

            LastHealth = DateTime.Now.AddSeconds(129600.0);
        }
Example #39
0
        /// <summary>
        ///     Pets the energy.
        /// </summary>
        /// <param name="add">if set to <c>true</c> [add].</param>
        internal void PetEnergy(bool add)
        {
            uint num;

            if (add)
            {
                if (Energy > 100)
                {
                    Energy = 100;

                    return;
                }

                if (Energy > 85)
                    return;

                if (Energy > 85)
                    num = MaxEnergy - Energy;
                else
                    num = 10;
            }

            else
                num = 15;

            if (num <= 4)
                num = 15;

            uint randomNumber = (uint) Yupi.GetRandomNumber(4, (int) num);

            if (!add)
            {
                Energy -= randomNumber;

                if (Energy == 0)
                    Energy = 1;
            }
            else
                Energy += randomNumber;

            if (DbState != DatabaseUpdateState.NeedsInsert)
                DbState = DatabaseUpdateState.NeedsUpdate;
        }
Example #40
0
File: Pet.cs Project: BjkGkh/Boon
        public void PetEnergy(bool Add)
        {
            int MaxE;
            if (Add)
            {
                if (Energy == 100) // If Energy is 100, no point.
                    return;

                if (Energy > 85)
                    MaxE = MaxEnergy - Energy;
                else
                    MaxE = 10;

            }
            else
                MaxE = 15; // Remove Max Energy as 15

            if (MaxE <= 4)
                MaxE = 15;

            int r = PlusEnvironment.GetRandomNumber(4, MaxE);

            if (!Add)
            {
                Energy = Energy - r;

                if (Energy < 0)
                {
                    Energy = 1;
                    r = 1;
                }
            }
            else

                Energy = Energy + r;

            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;
        }
Example #41
0
File: Pet.cs Project: BjkGkh/R106
        internal void OnRespect()
        {
            ServerMessage Message = PacketHandelingManager.GetRecycledItem(OutputCode.PetRespectNotificationEvent);
            Message.AddInt32(respect);
            Message.AddUInt32(ownerID);
            Message.AddUInt32(petID);
            Message.AddString(name);
            Message.AddInt32(1);
            Message.AddInt32(0);
            Message.AddString(string.Empty);
            Message.AddInt32(0);
            Message.AddInt32(0);
            Message.AddInt32(5);

            if (databaseState != DatabaseUpdateState.PendingInsert)
                databaseState = DatabaseUpdateState.PendingUpdate;

            if (experience <= 51900)
                AddExpirience(10);

            respect++;
        }
Example #42
0
File: Pet.cs Project: BjkGkh/Boon
        public void Addexperience(int Amount)
        {
            experience = experience + Amount;

            if (experience > 150000)
            {
                experience = 150000;

                if (Room != null)
                    Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));

                return;
            }

            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (Room != null)
            {
                Room.SendMessage(new AddExperiencePointsComposer(PetId, VirtualId, Amount));

                if (experience >= experienceGoal)
                    Room.SendMessage(new ChatComposer(VirtualId, "*leveled up to level " + Level + " *", 0, 0));
            }
        }
Example #43
0
File: Pet.cs Project: BjkGkh/Boon
        public void OnRespect()
        {
            Respect++;
            Room.SendMessage(new RespectPetNotificationMessageComposer(this));

            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (experience <= 150000)
                Addexperience(10);
        }
Example #44
0
        internal void Addexperience(int Amount)
        {
            experience = experience + Amount;

            if (experience >= 51900)
                return;

            //using (DatabaseClient dbClient = SilverwaveEnvironment.GetDatabase().GetClient())
            //{
            //    dbClient.addParameter("petid", PetId);
            //    dbClient.addParameter("experience", experience);
            //    dbClient.runFastQuery("UPDATE user_pets SET experience = @experience WHERE id = @petid LIMIT 1");
            //}
            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (Room != null)
            {
                ServerMessage Message = new ServerMessage(Outgoing.AddExperience);
                Message.AppendInt32(PetId);
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(Amount);
                Room.SendMessage(Message);

                if (experience > experienceGoal)
                {
                    // Level the pet
                    Room.SendMessage(new ChatComposer(VirtualId, "*leveled up to level " + Level + " *", 0, 0,-1));
                }
            }
        }
Example #45
0
        internal void OnRespect()
        {
            Respect++;

            ServerMessage Message = new ServerMessage(Outgoing.RespectPet);
            Message.AppendInt32(VirtualId);
            Message.AppendInt32(0);
            /*
            Message.AppendInt32(Respect);
            Message.AppendUInt(OwnerId);
            Message.AppendUInt(PetId);
            Message.AppendString(Name);
            Message.AppendBoolean(false);
            Message.AppendInt32(10);
            Message.AppendBoolean(false);
            Message.AppendInt32(-2);
            Message.AppendBoolean(true);
            Message.AppendString("281");*/

            /*Message.AppendInt32(Respect);
            Message.AppendUInt(OwnerId);
            Message.AppendUInt(PetId);
            Message.AppendString(Name);
            Message.AppendBoolean(false);
            Message.AppendInt32(10);
            Message.AppendBoolean(false);
            Message.AppendInt32(-2);
            Message.AppendBoolean(true);
            Message.AppendString("281");*/

            Room.SendMessage(Message);

            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (experience <= 51900)
            {
                Addexperience(10);
            }
        }
Example #46
0
        internal void OnRespect()
        {
            Respect++;

            ServerMessage Message = new ServerMessage(Outgoing.PetRespectNotification);

            Message.AppendInt32(OwnerId); // petOwnerId
            Message.AppendInt32(1); // respect
            SerializeInventory(Message);
            //Message.AppendUInt(PetId); // id
            //Message.AppendString(Name); // name
            //Message.AppendUInt(Type); // type
            //Message.AppendInt32(int.Parse(Race)); // breed
            //Message.AppendString(Color); // color

            Room.SendMessage(Message);

            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (Expirience <= 51900)
            {
                AddExpirience(10);
            }
        }
Example #47
0
		public void PetEnergy(int Add)
		{
			this.Energy -= Add;
			if (this.Energy > 100)
			{
				this.Energy = 100;
			}
			else
			{
				if (this.Energy < 0)
				{
					this.Energy = 0;
				}
			}
			if (this.DBState != DatabaseUpdateState.NeedsInsert)
			{
				this.DBState = DatabaseUpdateState.NeedsUpdate;
			}
		}
Example #48
0
File: Pet.cs Project: BjkGkh/R106
        internal void PetEnergy(bool addEnergy)
        {
            if (this.energy >= MAX_ENERGY) // If Energy is 100, no point.
                return;

            int randomUsage = ButterflyEnvironment.GetRandomNumber(4, 15);

            if (!addEnergy)
            {
                this.energy -= randomUsage;

                if (this.energy < 0)
                {
                    this.energy = 1;
                    randomUsage = 1;
                }
            }
            else
            {
                this.energy = (this.energy + randomUsage) % MAX_ENERGY;
            }
            if (databaseState != DatabaseUpdateState.PendingInsert)
                databaseState = DatabaseUpdateState.PendingUpdate;
        }
Example #49
0
File: Pet.cs Project: BjkGkh/R106
        internal Pet(uint PetId, uint OwnerId, uint RoomId, string Name, uint Type, string Race, string Color, int Expirience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, int hairType, int hairDye)
        {
            this.petID = PetId;
            this.ownerID = OwnerId;
            this.roomID = RoomId;
            this.name = Name;
            this.petType = Type;
            this.race = Race;
            this.color = Color;
            this.experience = Expirience;
            this.energy = Energy;
            this.nutrition = Nutrition;
            this.respect = Respect;
            this.creationStamp = CreationStamp;
            this.X = X;
            this.Y = Y;
            this.Z = Z;
            this.hairType = hairType;
            this.hairDye = hairDye;

            this.isPlaced = false;
            this.databaseState = DatabaseUpdateState.Syncronized;
        }
Example #50
0
        /// <summary>
        ///     Adds the experience.
        /// </summary>
        /// <param name="amount">The amount.</param>
        internal void AddExperience(uint amount)
        {
            int oldExperienceGoal = ExperienceGoal;

            Experience += amount;

            if (Experience >= 51900)
                return;

            if (DbState != DatabaseUpdateState.NeedsInsert)
                DbState = DatabaseUpdateState.NeedsUpdate;

            if (Room == null)
                return;

            PetExperienceComposer.GenerateMessage(this, amount);

            if (Experience < oldExperienceGoal)
                return;

            GameClient ownerSession = Yupi.GetGame().GetClientManager().GetClientByUserId(OwnerId);

            Dictionary<uint, PetCommand> totalPetCommands = PetCommandHandler.GetAllPetCommands();

            Dictionary<uint, PetCommand> petCommands = PetCommandHandler.GetPetCommandByPetType(Type);

            if (ownerSession == null)
                return;

            ServerMessage levelNotify = new ServerMessage(LibraryParser.OutgoingRequest("NotifyNewPetLevelMessageComposer"));

            SerializeInventory(levelNotify, true);

            ownerSession.SendMessage(levelNotify);

            PetCommandPanelComposer.GenerateMessage(this, totalPetCommands, petCommands, ownerSession);
        }
Example #51
0
File: Pet.cs Project: BjkGkh/R106
        internal void AddExpirience(int amount)
        {
            ServerMessage message;

            experience = experience + amount;

            if (experience >= 51900)
                return;

            if (databaseState != DatabaseUpdateState.PendingInsert)
                databaseState = DatabaseUpdateState.PendingUpdate;

            if (Room != null)
            {
                message = PacketHandelingManager.GetRecycledItem(OutputCode.PetExperienceEvent);
                message.AddUInt32(petID);
                message.AddInt32(virtualID);
                message.AddInt32(amount);
                Room.SendMessage(message);

                if (experience > ExpirienceGoal)
                {
                    Room.SendMessage(message);
                }
            }

        }
Example #52
0
        internal void AddExperience(int Amount)
        {
            checked
            {
                int oldExperienceGoal = this.experienceGoal;
                this.Experience += Amount;
                if (this.Experience >= 51900)
                {
                    return;
                }
                if (this.DBState != DatabaseUpdateState.NeedsInsert)
                {
                    this.DBState = DatabaseUpdateState.NeedsUpdate;
                }
                if (this.Room != null)
                {
                    ServerMessage serverMessage = new ServerMessage(Outgoing.AddPetExperienceMessageComposer);
                    serverMessage.AppendUInt(this.PetId);
                    serverMessage.AppendInt32(this.VirtualId);
                    serverMessage.AppendInt32(Amount);
                    this.Room.SendMessage(serverMessage);

                    if (this.Experience >= oldExperienceGoal)
                    {
                        GameClients.GameClient OwnerSession = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(OwnerId);

                        // Reset pet commands
                        PetCommands.Clear();
                        PetCommands = PetCommandHandler.GetPetCommands(this);

                        if (OwnerSession != null)
                        {
                            ServerMessage LevelNotify = new ServerMessage(Outgoing.NotifyNewPetLevelMessageComposer);
                            this.SerializeInventory(LevelNotify, true);
                            OwnerSession.SendMessage(LevelNotify);

                            ServerMessage TP = new ServerMessage();
                            TP.Init(Outgoing.PetTrainerPanelMessageComposer);
                            TP.AppendUInt(this.PetId);

                            List<short> AvailableCommands = new List<short>();

                            TP.AppendInt32(PetCommands.Count);
                            foreach (short Sh in PetCommands.Keys)
                            {
                                TP.AppendInt32(Sh);
                                if (PetCommands[Sh] == true)
                                {
                                    AvailableCommands.Add(Sh);
                                }
                            }

                            TP.AppendInt32(AvailableCommands.Count);
                            foreach (short Sh in AvailableCommands)
                            {
                                TP.AppendInt32(Sh);
                            }
                            OwnerSession.SendMessage(TP);
                        }

                    }
                }
            }
        }
Example #53
0
		internal void PetEnergy(bool Add)
		{
			checked
			{
                int num;
                if (Add)
                {
                    if (this.Energy > 100)
                    {
                        this.Energy = 100;
                        return;
                    }
                    else if (this.Energy > 85)
                    {
                        return;
                    }
                    if (this.Energy > 85)
                    {
                        num = Pet.MaxEnergy - this.Energy;
                    }
                    else
                    {
                        num = 10;
                    }
                }
                else
                {
                    num = 15;
                }
                if (num <= 4)
                {
                    num = 15;
                }
				int randomNumber = CyberEnvironment.GetRandomNumber(4, num);
				if (!Add)
				{
					this.Energy -= randomNumber;
					if (this.Energy < 0)
					{
						this.Energy = 1;
					}
				}
				else
				{
					this.Energy += randomNumber;
				}
				if (this.DBState != DatabaseUpdateState.NeedsInsert)
				{
					this.DBState = DatabaseUpdateState.NeedsUpdate;
				}
			}
		}
Example #54
0
		internal Pet(uint PetId, uint OwnerId, uint RoomId, string Name, uint Type, string Race, string Color, int experience, int Energy, int Nutrition, int Respect, double CreationStamp, int X, int Y, double Z, bool havesaddle, int Anyonecanride, int Dye, int PetHer, int Rarity, DateTime LastHealth, DateTime UntilGrown, MoplaBreed MoplaBreed)
		{
			this.PetId = PetId;
			this.OwnerId = OwnerId;
			this.RoomId = RoomId;
			this.Name = Name;
			this.Type = Type;
			this.Race = Race;
			this.Color = Color;
			this.Experience = experience;
			this.Energy = Energy;
			this.Nutrition = Nutrition;
			this.Respect = Respect;
			this.CreationStamp = CreationStamp;
			this.X = X;
			this.Y = Y;
			this.Z = Z;
			this.PlacedInRoom = false;
			this.DBState = DatabaseUpdateState.Updated;
			this.HaveSaddle = havesaddle;
			this.AnyoneCanRide = Anyonecanride;
			this.PetHair = PetHer;
			this.HairDye = Dye;
			this.Rarity = Rarity;
			this.LastHealth = LastHealth;
			this.UntilGrown = UntilGrown;
			this.MoplaBreed = MoplaBreed;
            this.PetCommands = PetCommandHandler.GetPetCommands(this);
		}
Example #55
0
        internal void OnRespect()
        {
            checked
            {
                this.Respect++;
                ServerMessage serverMessage = new ServerMessage(Outgoing.RespectPetMessageComposer);
                serverMessage.AppendInt32(this.VirtualId);
                serverMessage.AppendBoolean(true);
                this.Room.SendMessage(serverMessage);

                serverMessage = new ServerMessage(Outgoing.PetRespectNotificationMessageComposer);
                serverMessage.AppendInt32(1);
                serverMessage.AppendInt32(this.VirtualId);
                this.SerializeInventory(serverMessage);
                this.Room.SendMessage(serverMessage);

                if (this.DBState != DatabaseUpdateState.NeedsInsert)
                {
                    this.DBState = DatabaseUpdateState.NeedsUpdate;
                }
                if (Type != 16 && this.Experience <= 51900)
                {
                    this.AddExperience(10);
                }
                if (Type == 16)
                {
                    Energy = 100;
                }
                this.LastHealth = DateTime.Now.AddSeconds(129600.0);
            }
        }
Example #56
0
File: Pet.cs Project: BjkGkh/Azure2
 /// <summary>
 /// Initializes a new instance of the <see cref="Pet"/> class.
 /// </summary>
 /// <param name="petId">The pet identifier.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <param name="roomId">The room identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="race">The race.</param>
 /// <param name="color">The color.</param>
 /// <param name="experience">The experience.</param>
 /// <param name="energy">The energy.</param>
 /// <param name="nutrition">The nutrition.</param>
 /// <param name="respect">The respect.</param>
 /// <param name="creationStamp">The creation stamp.</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="z">The z.</param>
 /// <param name="havesaddle">if set to <c>true</c> [havesaddle].</param>
 /// <param name="anyoneCanRide">The anyone can ride.</param>
 /// <param name="dye">The dye.</param>
 /// <param name="petHer">The pet her.</param>
 /// <param name="rarity">The rarity.</param>
 /// <param name="lastHealth">The last health.</param>
 /// <param name="untilGrown">The until grown.</param>
 /// <param name="moplaBreed">The mopla breed.</param>
 internal Pet(uint petId, uint ownerId, uint roomId, string name, uint type, string race, string color,
     int experience, int energy, int nutrition, int respect, double creationStamp, int x, int y, double z,
     bool havesaddle, int anyoneCanRide, int dye, int petHer, int rarity, DateTime lastHealth,
     DateTime untilGrown, MoplaBreed moplaBreed)
 {
     PetId = petId;
     OwnerId = ownerId;
     RoomId = roomId;
     Name = name;
     Type = type;
     Race = race;
     Color = color;
     Experience = experience;
     Energy = energy;
     Nutrition = nutrition;
     Respect = respect;
     CreationStamp = creationStamp;
     X = x;
     Y = y;
     Z = z;
     PlacedInRoom = false;
     DbState = DatabaseUpdateState.Updated;
     HaveSaddle = havesaddle;
     AnyoneCanRide = anyoneCanRide;
     PetHair = petHer;
     HairDye = dye;
     Rarity = rarity;
     LastHealth = lastHealth;
     UntilGrown = untilGrown;
     MoplaBreed = moplaBreed;
     PetCommands = PetCommandHandler.GetPetCommands(this);
     WaitingForBreading = 0;
 }
Example #57
0
File: Pet.cs Project: BjkGkh/Azure2
        /// <summary>
        /// Adds the experience.
        /// </summary>
        /// <param name="amount">The amount.</param>
        internal void AddExperience(int amount)
        {
            {
                var oldExperienceGoal = ExperienceGoal;
                Experience += amount;
                if (Experience >= 51900)
                    return;
                if (DbState != DatabaseUpdateState.NeedsInsert)
                    DbState = DatabaseUpdateState.NeedsUpdate;
                if (Room == null)
                    return;
                ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddPetExperienceMessageComposer"));
                serverMessage.AppendInteger(PetId);
                serverMessage.AppendInteger(VirtualId);
                serverMessage.AppendInteger(amount);
                Room.SendMessage(serverMessage);
                if (Experience < oldExperienceGoal)
                    return;
                var ownerSession = AzureEmulator.GetGame().GetClientManager().GetClientByUserId(OwnerId);

                // Reset pet commands
                PetCommands.Clear();
                PetCommands = PetCommandHandler.GetPetCommands(this);

                if (ownerSession == null)
                    return;
                ServerMessage levelNotify = new ServerMessage(LibraryParser.OutgoingRequest("NotifyNewPetLevelMessageComposer"));
                SerializeInventory(levelNotify, true);
                ownerSession.SendMessage(levelNotify);

                ServerMessage tp = new ServerMessage();
                tp.Init(LibraryParser.OutgoingRequest("PetTrainerPanelMessageComposer"));
                tp.AppendInteger(PetId);

                List<short> availableCommands = new List<short>();

                tp.AppendInteger(PetCommands.Count);
                foreach (short sh in PetCommands.Keys)
                {
                    tp.AppendInteger(sh);
                    if (PetCommands[sh])
                        availableCommands.Add(sh);
                }

                tp.AppendInteger(availableCommands.Count);
                foreach (short sh in availableCommands)
                    tp.AppendInteger(sh);
                ownerSession.SendMessage(tp);
            }
        }
Example #58
0
File: Pet.cs Project: BjkGkh/Azure2
        /// <summary>
        /// Called when [respect].
        /// </summary>
        internal void OnRespect()
        {
            {
                Respect++;
                GameClient OwnerSession = AzureEmulator.GetGame().GetClientManager().GetClientByUserId(OwnerId);
                if (OwnerSession != null)
                    AzureEmulator.GetGame().GetAchievementManager().ProgressUserAchievement(OwnerSession, "ACH_PetRespectReceiver", 1, false);
                ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RespectPetMessageComposer"));
                serverMessage.AppendInteger(VirtualId);
                serverMessage.AppendBool(true);
                Room.SendMessage(serverMessage);

                serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("PetRespectNotificationMessageComposer"));
                serverMessage.AppendInteger(1);
                serverMessage.AppendInteger(VirtualId);
                SerializeInventory(serverMessage);
                Room.SendMessage(serverMessage);

                if (DbState != DatabaseUpdateState.NeedsInsert)
                    DbState = DatabaseUpdateState.NeedsUpdate;
                if (Type != 16 && Experience <= 51900)
                    AddExperience(10);
                if (Type == 16)
                    Energy = 100;
                LastHealth = DateTime.Now.AddSeconds(129600.0);
            }
        }
Example #59
0
File: Pet.cs Project: habb0/Bfly
        internal void PetEnergy(bool Add)
        {
            int MaxE;

            if (Add)
            {
                if (this.Energy == 100) // If Energy is 100, no point.
                    return;

                if (this.Energy > 85) { MaxE = MaxEnergy - this.Energy; } else { MaxE = 10; }

            }
            else { MaxE = 15; } // Remove Max Energy as 15

            int r = ButterflyEnvironment.GetRandomNumber(4, MaxE);

            //using (DatabaseClient dbClient = ButterflyEnvironment.GetDatabase().GetClient())
            {
                if (!Add)
                {
                    this.Energy = this.Energy - r;

                    if (this.Energy < 0)
                    {
                        //dbClient.addParameter("pid", PetId);
                        //dbClient.runFastQuery("UPDATE user_pets SET energy = 1 WHERE id = @pid LIMIT 1");

                        this.Energy = 1;

                        r = 1;
                    }

                    //dbClient.addParameter("r", r);
                    //dbClient.addParameter("petid", PetId);
                    //dbClient.runFastQuery("UPDATE user_pets SET energy = energy - @r WHERE id = @petid LIMIT 1");

                }
                else
                {
                    //dbClient.addParameter("r", r);
                    //dbClient.addParameter("petid", PetId);
                    //dbClient.runFastQuery("UPDATE user_pets SET energy = energy + @r WHERE id = @petid LIMIT 1");

                    this.Energy = this.Energy + r;
                }
            }
            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;
        }
Example #60
0
File: Pet.cs Project: habb0/Bfly
        internal void AddExpirience(int Amount)
        {
            Expirience = Expirience + Amount;

            if (Expirience >= 51900)
                return;

            //using (DatabaseClient dbClient = ButterflyEnvironment.GetDatabase().GetClient())
            //{
            //    dbClient.addParameter("petid", PetId);
            //    dbClient.addParameter("expirience", Expirience);
            //    dbClient.runFastQuery("UPDATE user_pets SET expirience = @expirience WHERE id = @petid LIMIT 1");
            //}
            if (DBState != DatabaseUpdateState.NeedsInsert)
                DBState = DatabaseUpdateState.NeedsUpdate;

            if (Room != null)
            {
                ServerMessage Message = new ServerMessage(609);
                Message.AppendUInt(PetId);
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(Amount);
                Room.SendMessage(Message);

                if (Expirience > ExpirienceGoal)
                {
                    // Level the pet

                    ServerMessage ChatMessage = new ServerMessage(24);
                    ChatMessage.AppendInt32(VirtualId);
                    ChatMessage.AppendStringWithBreak("*leveled up to level " + Level + " *");
                    ChatMessage.AppendInt32(0);

                    Room.SendMessage(ChatMessage);
                }
            }
        }