/// <summary> /// Updates game object stats and attributes /// </summary> /// <param name="player">the target</param> /// <param name="stat">stats</param> /// <param name="attribute">attributes</param> /// <param name="isBonus">are these bonus stats (green)</param> internal void StatInfo(Player player, CreatureStat stat, CreatureAttribute attribute, bool isBonus) { PacketStream stream = new PacketStream(0x03E8); stream.WriteUInt32(player.Handle); // Creature Stat stream.WriteInt16(stat.StatId); stream.WriteInt16(stat.STR); stream.WriteInt16(stat.VIT); stream.WriteInt16(stat.DEX); stream.WriteInt16(stat.AGI); stream.WriteInt16(stat.INT); stream.WriteInt16(stat.MEN); stream.WriteInt16(stat.LUK); // Creature Attributes stream.WriteInt16(attribute.Critical); stream.WriteInt16(attribute.CriticalPower); stream.WriteInt16(attribute.PAttackRight); stream.WriteInt16(attribute.PAttackLeft); stream.WriteInt16(attribute.Defense); stream.WriteInt16(attribute.BlockDefense); stream.WriteInt16(attribute.MAttack); stream.WriteInt16(attribute.MDefense); stream.WriteInt16(attribute.AccuracyRight); stream.WriteInt16(attribute.AccuracyLeft); stream.WriteInt16(attribute.MagicAccuracy); stream.WriteInt16(attribute.Evasion); stream.WriteInt16(attribute.MagicEvasion); stream.WriteInt16(attribute.BlockChance); stream.WriteInt16(attribute.MoveSpeed); stream.WriteInt16(attribute.AttackSpeed); stream.WriteInt16(attribute.AttackRange); stream.WriteInt16(attribute.MaxWeight); stream.WriteInt16(attribute.CastingSpeed); stream.WriteInt16(attribute.CoolTimeSpeed); stream.WriteInt16(attribute.ItemChance); stream.WriteInt16(attribute.HPRegenPercentage); stream.WriteInt16(attribute.HPRegenPoint); stream.WriteInt16(attribute.MPRegenPercentage); stream.WriteInt16(attribute.MPRegenPoint); stream.WriteBool(isBonus); ClientManager.Instance.Send(player, stream, BroadcastArea.Self); }
/// <summary> /// Calculates attributes /// </summary> /// <param name="stat"></param> /// <param name="jobId"></param> public void Calculate(CreatureStat stat, int level, bool isRanged = false, int jobId = 0) { // TODO : Calculate for left hand and apply equip/skill/buff bonus if (isRanged) this.PAttackLeft = (short)((6 / 5f) * stat.AGI + (11 / 5f) * stat.DEX + level);// + equip; else this.PAttackLeft = (short)((14 / 5f) * stat.STR + level + 9); // + equip; this.AccuracyLeft = (short)((1 / 2f) * stat.DEX + level); // + equip; this.MAttack = (short)(2 * stat.INT + level); // + equip; this.Defense = (short)((5 / 3f) * stat.VIT + level); // +equip; this.Evasion = (short)((1 / 2f) * stat.AGI + level); // +equip; this.AttackSpeed = (short)(100 + (1 / 10f) * stat.AGI); //+equip this.MagicAccuracy = (short)((4 / 10f) * stat.MEN + (1 / 10f) * stat.DEX + level); // +equip this.MDefense = (short)(2 * stat.MEN + level); // + equip //this.MRes this.MoveSpeed = (short)(120); // + equip this.HPRegenPercentage = (short)(5); // + equip this.MPRegenPercentage = (short)(5); // + equip this.BlockChance = 0; // +equip this.Critical = (short)((1 / 5f) * stat.LUK + 3); this.CastingSpeed = (short)(100); this.HPRegenPoint = (short)(2 * level + 48); this.MPRegenPoint = (short)(4.1f * stat.MEN + 2 * level + 48); this.BlockDefense = (short)(0); this.CriticalPower = (short)(80); this.CoolTimeSpeed = (short)(100); this.MaxWeight = (short)(10 * stat.STR + 10 * level); }