Esempio n. 1
0
            protected override void OnTick()
            {
                m_Count++;

                DamageEntry de           = m_Creature.FindMostRecentDamageEntry(false);
                bool        alreadyOwned = m_Creature.Owners.Contains(m_Tamer);

                if (!m_Tamer.InRange(m_Creature, 6))
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming.
                    Stop();
                }
                else if (!m_Tamer.CheckAlive())
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming.
                    Stop();
                }
                else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature))
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049654, m_Tamer.NetState); // You do not have a clear path to the animal you are taming, and must cease your attempt.
                    Stop();
                }
                else if (!m_Creature.Tamable)
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed.
                    Stop();
                }
                else if (m_Creature.Controlled)
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already.
                    Stop();
                }
                else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer))
                {
                    ;
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame.
                    Stop();
                }
                else if (MustBeSubdued(m_Creature))
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState); // You must subdue this creature before you can tame it!
                    Stop();
                }
                else if (de != null && de.LastDamage > m_StartTime)
                {
                    m_Tamer.NextSkillTime = DateTime.Now;
                    m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming.
                    Stop();
                }
                else if (m_Count < m_MaxCount)
                {
                    m_Tamer.RevealingAction();

                    switch (Utility.Random(3))
                    {
                    case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break;

                    case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break;

                    case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break;
                    }


                    //XP Gain
                    m_Tamer.GiveXP(5);

                    if (m_Creature.Paralyzed)
                    {
                        m_Paralyzed = true;
                    }
                }
                else
                {
                    m_Tamer.RevealingAction();
                    m_Tamer.NextSkillTime = DateTime.Now;

                    if (m_Creature.Paralyzed)
                    {
                        m_Paralyzed = true;
                    }


                    if (alreadyOwned || m_Tamer.Competences[CompType.Dressage].roll(m_Creature.DressageDD))
                    {
                        if (alreadyOwned)
                        {
                            m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging.
                        }
                        else
                        {
                            m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master.
                            m_Creature.Owners.Add(m_Tamer);
                        }

                        m_Creature.SetControlMaster(m_Tamer);
                        m_Creature.IsBonded = false;
                    }
                    else
                    {
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature.
                    }
                }
            }