Пример #1
0
 public void Interact(Client Commander, PetInfo Pet, string Command)
 {
     if (Interactions.ContainsKey(Command.ToLower()))
     {
         Interactions[Command.ToLower()].Invoke(Commander, Pet);
     }
 }
Пример #2
0
        private void Down(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 9 && Pet.Level >= 2)
            {
                Pet.Energy -= 9;

                Pet.GiveExpirience(30);

                Pet.GetRoomUser().AddStatus("lay", string.Empty);
                Pet.GetRoomUser().UpdateStatus(true);

                Pet.UpdateEnergy();
            }
        }
Пример #3
0
        private void Beg(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 12 && Pet.Level >= 4)
            {
                Pet.Energy -= 12;

                Pet.GiveExpirience(45);

                Pet.GetRoomUser().AddStatus("beg", string.Empty);
                Pet.GetRoomUser().UpdateStatus(true);

                Pet.UpdateEnergy();
            }
        }
Пример #4
0
        public int GeneratePet(int UserId, int Type, int Race, string Color, string Name)
        {
            Dictionary<int, Object> Row = new Dictionary<int, object>();

            Row[0] = PetIdCounter.Next;
            Row[1] = UserId;
            Row[2] = -1;
            Row[3] = Name;
            Row[4] = Type;
            Row[5] = Race;
            Row[6] = Color;
            Row[7] = 100;
            Row[8] = 0;
            Row[9] = 120;
            Row[10] = 0;
            Row[11] = DateTime.Now;
            Row[12] = -1;
            Row[13] = -1;
            Row[14] = 0;

            PetInfo Pet = new PetInfo(Row);

            Pets.Add(Pet.Id, Pet);

            BrickEngine.GetItemReactor().AddNewUpdate(Pet.Id, 3, UserId);

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("INSERT INTO user_pets (id, user_id, name, type, race, color, created) VALUES (@id, @user_id, @name, @type, @race, @color, @created)");
                Reactor.AddParam("id", Pet.Id);
                Reactor.AddParam("user_id", UserId);
                Reactor.AddParam("name", Name);
                Reactor.AddParam("type", Type);
                Reactor.AddParam("race", Race);
                Reactor.AddParam("color", Color);
                Reactor.AddParam("created", Pet.Created);
                Reactor.ExcuteQuery();
            }

            return Pet.Id;
        }
Пример #5
0
        public void LoadPets()
        {
            Pets = new Dictionary<int, PetInfo>();

            DataTable Table = null;

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("SELECT MAX(id) FROM user_pets LIMIT 1");

                int MaxId = Reactor.GetInt32();

                if (MaxId <= 0)
                {
                    MaxId += 1000000;
                }

                PetIdCounter = new SecurityCounter(MaxId);
            }

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("SELECT * FROM user_pets");
                Table = Reactor.GetTable();
            }

            foreach (DataRow Row in Table.Rows)
            {
                PetInfo Pet = new PetInfo(Row);

                Pets.Add(Pet.Id, Pet);
            }

            BrickEngine.GetScreenWriter().ScretchLine(string.Format("[{0}] Pet(s) cached.", Pets.Count),IO.WriteType.Outgoing);
        }
Пример #6
0
        private void Stay(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 10 && Pet.Level >= 6)
            {
                Pet.Energy -= 10;

                Pet.GiveExpirience(30);

                Pet.UpdateEnergy();
            }
        }
Пример #7
0
        private void Speak(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 10 && Pet.Level >= 10)
            {
                Pet.Energy -= 10;

                Pet.GiveExpirience(150);

                Pet.GetRoomUser().Talk("Waaaaw , gelawaaa!", Rooms.Virtual.Units.SpeechType.Shout, 0, string.Empty);

                Pet.UpdateEnergy();
            }
        }
Пример #8
0
        private void Stand(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 15 && Pet.Level >= 8)
            {
                Pet.Energy -= 15;

                Pet.GiveExpirience(80);

                Pet.GetRoomUser().AddStatus("std", string.Empty);
                Pet.GetRoomUser().UpdateStatus(true);

                Pet.UpdateEnergy();
            }
        }
Пример #9
0
        private void Sit(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 7 && Pet.Level >= 1)
            {
                Pet.Energy -= 7;

                Pet.GiveExpirience(20);

                Pet.GetRoomUser().AddStatus("sit", string.Empty);
                Pet.GetRoomUser().UpdateStatus(true);

                Pet.UpdateEnergy();
            }
        }
Пример #10
0
        private void Silent(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 10 && Pet.Level >= 12)
            {
                Pet.Energy -= 10;

                Pet.GiveExpirience(100);

                Pet.MutedDateTime = DateTime.Now;

                Pet.UpdateEnergy();
            }
        }
Пример #11
0
        private void Play(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 15 && Pet.Level >= 11)
            {
                Pet.Energy -= 15;

                Pet.GiveExpirience(200);

                if (Pet.GetRoom().GetRoomEngine().GetPetToys().Count > 0)
                {
                    Pet.GetRoomUser().AddStatus("gst", "plf");
                    Pet.GetRoomUser().UpdateStatus(true);

                    Pet.GetRoomUser().UnhandledGoalPoint = Pet.GetRoom().GetRoomEngine().GetPetToys()[Pet.Random.Next(0, Pet.GetRoom().GetRoomEngine().GetPetToys().Count - 1)].Point;
                    Pet.DoActions(PetInterAction.Progressing, Pet.GetRoomUser());
                }
                else
                {
                    Pet.DoActions(PetInterAction.Playing, Pet.GetRoomUser());
                    Pet.GetRoomUser().UpdateStatus(true);
                }

                Pet.UpdateEnergy();
            }
        }
Пример #12
0
        private void Here(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 12 && Pet.Level >= 3)
            {
                Pet.Energy -= 12;

                Pet.GiveExpirience(40);

                Pet.GetRoomUser().UnhandledGoalPoint = Client.GetUser().GetRoomUser().FontPoint;

                Pet.UpdateEnergy();
            }
        }
Пример #13
0
        private void Free(Client Client, PetInfo Pet)
        {
            if (Pet.Sleeping)
            {
                return;
            }

            if (Pet.Energy >= 5 && Pet.Level >= 0)
            {
                Pet.Energy -= 5;

                Pet.GiveExpirience(10);

                Pet.DoActions(PetInterAction.Walking, Pet.GetRoomUser());

                Pet.UpdateEnergy();
            }
        }