コード例 #1
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);
 }
コード例 #2
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);
                        }
                    }
                }
            }
        }