예제 #1
0
            public void Deserialize(GenericReader reader)
            {
                int version = reader.ReadInt();

                switch (version)
                {
                case 1:
                {
                    int count = reader.ReadInt();

                    for (int i = 0; i < count; i++)
                    {
                        int id = reader.ReadInt();

                        SkillRateInfo info = new SkillRateInfo();

                        info.Deserialize(reader);

                        m_SkillRates.Add(id, info);
                    }

                    m_SkillGainsCount = reader.ReadInt();
                    m_StatGainsCount  = reader.ReadInt();

                    break;
                }
                }
            }
예제 #2
0
        public static bool ForceSkillGain(Mobile from, Skill skill)
        {
            if (from.Player)
            {
                MobileRateInfo mobileInfo = MobileRateInfo.GetMobileInfo(from);
                SkillRateInfo  skillInfo  = mobileInfo.GetSkillInfo(skill);

                int[] table = null;

                if (from.Skills.Total <= 350)
                {
                    table = m_Terms350;
                }
                else if (from.Skills.Total <= 500)
                {
                    table = m_Terms500;
                }
                else
                {
                    table = m_Terms700;
                }

                int index = skill.BaseFixedPoint / 50;

                if (DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes(table[index > 23 ? 23 : index]))
                {
                    return(false);
                }

                return(true);
            }

            return(false);
        }
예제 #3
0
        public static void RegisterSkillGain(Mobile from, Skill skill)
        {
            if (from.Player)
            {
                MobileRateInfo mobileInfo = MobileRateInfo.GetMobileInfo(from);
                SkillRateInfo  skillInfo  = mobileInfo.GetSkillInfo(skill);

                skillInfo.LastGainTime = DateTime.Now;
            }
        }
예제 #4
0
            public SkillRateInfo GetSkillInfo(Skill skill)
            {
                SkillRateInfo info = null;

                if (!m_SkillRates.TryGetValue(skill.SkillID, out info))
                {
                    info = new SkillRateInfo();

                    SkillRates.Add(skill.SkillID, info);
                }

                return(info);
            }
예제 #5
0
            public void Serialize(GenericWriter writer)
            {
                writer.Write((int)1);                   // version

                writer.Write(m_SkillRates.Count);

                foreach (KeyValuePair <int, SkillRateInfo> kvp in m_SkillRates)
                {
                    writer.Write((int)kvp.Key);

                    SkillRateInfo info = (SkillRateInfo)kvp.Value;

                    info.Serialize(writer);
                }

                writer.Write(m_SkillGainsCount);
                writer.Write(m_StatGainsCount);
            }
예제 #6
0
        public static bool SkillGainAllowed(Mobile from, Skill skill)
        {
            if (from.Player)
            {
                MobileRateInfo mobileInfo = MobileRateInfo.GetMobileInfo(from);
                SkillRateInfo  skillInfo  = mobileInfo.GetSkillInfo(skill);

                // SKILL GAIN RESTRICTIONS
                // Here you can edit restrictions suitable for your needs
                if (skill.Base >= 100.0 && (mobileInfo.SkillGainsCount >= 72 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes(5.0)))
                {
                    return(false);
                }
                if (skill.Base >= 90.0 && (mobileInfo.SkillGainsCount >= 30 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes(10.0)))
                {
                    return(false);
                }
                else if (skill.Base >= 80.0 && (mobileInfo.SkillGainsCount >= 60 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes(5.0)))
                {
                    return(false);
                }
                else if (skill.Base >= 70.0 && (mobileInfo.SkillGainsCount >= 100 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes(3.0)))
                {
                    return(false);
                }
                else if (skill.Base < 70.0)
                {
                    return(true);
                }
                // End!

                mobileInfo.SkillGainsCount++;

                skillInfo.LastGainTime = DateTime.Now;
                skillInfo.GainsCount++;
            }

            return(true);
        }
			public void Deserialize( GenericReader reader )
			{
				int version = reader.ReadInt();

				switch ( version )
				{
					case 1:
					{
						int count = reader.ReadInt();

						for ( int i = 0; i < count; i++ )
						{
							int id = reader.ReadInt();

							SkillRateInfo info = new SkillRateInfo();

							info.Deserialize( reader );

							m_SkillRates.Add( id, info );
						}

						m_LastStatGainTime = reader.ReadDateTime();
						m_StatGainsCount = reader.ReadInt();

						break;
					}
				}
			}
			public SkillRateInfo GetSkillInfo( Skill skill )
			{
				SkillRateInfo info = null;

				if ( !m_SkillRates.TryGetValue( skill.SkillID, out info ) )
				{
					info = new SkillRateInfo();

					SkillRates.Add( skill.SkillID, info );
				}

				return info;
			}