public static void OnStatChangeByMobSkill(Character chr, MobSkillLevelData msld, short delay = 0) { // See if we can actually set the effect... int prop = 100; if (msld.Prop != 0) { prop = msld.Prop; } if (Rand32.Next() % 100 >= prop) { return; // Luck. } BuffStat setStat = null; int rValue = msld.SkillID | (msld.Level << 16); var ps = chr.PrimaryStats; int nValue = 1; switch ((Constants.MobSkills.Skills)msld.SkillID) { case Constants.MobSkills.Skills.Seal: setStat = ps.BuffSeal; break; case Constants.MobSkills.Skills.Darkness: setStat = ps.BuffDarkness; break; case Constants.MobSkills.Skills.Weakness: setStat = ps.BuffWeakness; break; case Constants.MobSkills.Skills.Stun: setStat = ps.BuffStun; break; case Constants.MobSkills.Skills.Curse: setStat = ps.BuffCurse; break; case Constants.MobSkills.Skills.Poison: setStat = ps.BuffPoison; nValue = msld.X; break; } if (setStat != null && !setStat.IsSet()) { var buffTime = msld.Time * 1000; var stat = setStat.Set(rValue, (short)nValue, BuffStat.GetTimeForBuff(buffTime + delay)); if (stat != 0) { chr.Buffs.FinalizeBuff(stat, delay); } } }
private static void ReadSkills() { short Count = Reader.ReadInt16(); for (short i = 0; i < Count; i++) { int skillid = Reader.ReadInt32(); Skills.Add(skillid, new Dictionary <byte, SkillLevelData>()); byte levels = Reader.ReadByte(); for (byte j = 0; j < levels; j++) { byte level = Reader.ReadByte(); SkillLevelData sld = new SkillLevelData(); sld.MobCount = Reader.ReadByte(); sld.HitCount = Reader.ReadByte(); sld.BuffTime = Reader.ReadInt16(); sld.Damage = Reader.ReadInt16(); sld.AttackRange = Reader.ReadInt16(); sld.Mastery = Reader.ReadByte(); sld.HPProperty = Reader.ReadInt16(); sld.MPProperty = Reader.ReadInt16(); sld.Property = Reader.ReadInt16(); sld.HPUsage = Reader.ReadInt16(); sld.MPUsage = Reader.ReadInt16(); sld.ItemIDUsage = Reader.ReadInt32(); sld.ItemAmountUsage = Reader.ReadInt16(); sld.BulletUsage = Reader.ReadInt16(); sld.MesosUsage = Reader.ReadInt16(); sld.XValue = Reader.ReadInt16(); sld.YValue = Reader.ReadInt16(); sld.Speed = Reader.ReadInt16(); sld.Jump = Reader.ReadInt16(); sld.WeaponAttack = Reader.ReadInt16(); sld.MagicAttack = Reader.ReadInt16(); sld.WeaponDefence = Reader.ReadInt16(); sld.MagicDefence = Reader.ReadInt16(); sld.Accurancy = Reader.ReadInt16(); sld.Avoidability = Reader.ReadInt16(); sld.LTX = Reader.ReadInt16(); sld.LTY = Reader.ReadInt16(); sld.RBX = Reader.ReadInt16(); sld.RBY = Reader.ReadInt16(); Skills[skillid].Add(level, sld); } } byte amount = Reader.ReadByte(); for (byte i = 0; i < amount; i++) { byte skillid = Reader.ReadByte(); MobSkills.Add(skillid, new Dictionary <byte, MobSkillLevelData>()); byte levels = Reader.ReadByte(); for (byte j = 0; j < levels; j++) { MobSkillLevelData msld = new MobSkillLevelData(); msld.SkillID = skillid; msld.Level = Reader.ReadByte(); msld.Time = Reader.ReadInt16(); msld.MPConsume = Reader.ReadInt16(); msld.X = Reader.ReadInt32(); msld.Y = Reader.ReadInt32(); msld.Prop = Reader.ReadByte(); msld.Cooldown = Reader.ReadInt16(); msld.LTX = Reader.ReadInt16(); msld.LTY = Reader.ReadInt16(); msld.RBX = Reader.ReadInt16(); msld.RBY = Reader.ReadInt16(); msld.HPLimit = Reader.ReadByte(); msld.SummonLimit = Reader.ReadByte(); msld.SummonEffect = Reader.ReadByte(); byte summons = Reader.ReadByte(); msld.Summons = new List <int>(); for (byte k = 0; k < summons; k++) { msld.Summons.Add(Reader.ReadInt32()); } MobSkills[skillid].Add(msld.Level, msld); } } }