public static MabiPacket AcquireStat(MabiCreature creature, string statName, double amount) { var p = new MabiPacket(Op.AcquireInfo, creature.Id); p.PutString("<xml type='{0}' value='{1}' simple='true' onlyLog='false' />", statName, (uint)amount); p.PutInt(3000); return p; }
public override SkillResults Ready(MabiCreature creature, MabiSkill skill) { SkillHelper.FillStack(creature, skill); Send.SkillReady(creature.Client, creature, skill.Id); return SkillResults.Okay; }
/// <summary> /// Sends GuildDonateR to creature's client. /// </summary> public static void GuildDonateR(MabiCreature creature, bool success) { var packet = new MabiPacket(Op.GuildDonateR, creature.Id); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends ConvertGpConfirmR to creature's client. /// </summary> public static void ConvertGpConfirmR(MabiCreature creature, bool success) { var packet = new MabiPacket(Op.ConvertGpConfirmR, creature.Id); packet.PutByte(success); creature.Client.Send(packet); }
public static MabiPacket AcquireAp(MabiCreature creature, uint amount) { var p = new MabiPacket(Op.AcquireInfo, creature.Id); p.PutString("<xml type='ap' value='{0}' simple='true' onlyLog='false' />", amount); p.PutInt(3000); return p; }
public override SkillResults Stop(MabiCreature creature, MabiSkill skill, MabiTags tags) { creature.State &= ~CreatureStates.SitDown; Send.StandUp(creature); if (creature.Temp.SittingProp != null) { // Effect if (creature.Temp.CurrentChair.Effect != 0) Send.Effect(Effect.CherryBlossoms, creature, false); // Update chair creature.Temp.SittingProp.ExtraData = string.Format("<xml OWNER='0' SITCHAR='0'/>"); Send.PropUpdate(creature.Temp.SittingProp); Send.AssignChair(creature, 0, 0); // Remove chair in 1s creature.Temp.SittingProp.DisappearTime = DateTime.Now.AddSeconds(1); creature.Temp.SittingProp = null; } return SkillResults.Okay; }
public List<MabiCreature> GetIceSpearLOSChain(MabiCreature attacker, MabiCreature target, uint range) { var aPos = attacker.GetPosition(); var tPos = target.GetPosition(); var minX = Math.Min(aPos.X, tPos.X) - range; var maxX = Math.Max(aPos.X, tPos.X) + range; var m = ((double)tPos.Y - aPos.Y) / ((double)tPos.X - aPos.X); var bL = (double)aPos.Y - aPos.X * m - (range / 2); var bH = bL + range; var targets = WorldManager.Instance.GetCreaturesInRange(attacker, maxX - minX); // Rough filter targets = targets.FindAll((c) => { var pos = c.GetPosition(); return !c.IsDead && c.IsAttackableBy(attacker) && (minX < pos.X && pos.X < maxX) && ((m * pos.X + bL) < pos.Y && pos.Y < (m * pos.X + bH)); }); if (!targets.Contains(target)) targets.Add(target); return targets; }
public static MabiPacket AcquireExp(MabiCreature creature, uint amount) { var p = new MabiPacket(Op.AcquireInfo, creature.Id); p.PutString("<xml type='exp' value='{0}'/>", amount); p.PutInt(3000); return p; }
private static void AddPvPInfo(this MabiPacket packet, MabiCreature creature) { var arena = creature.ArenaPvPManager != null; packet.PutByte(arena); // ArenaPvP packet.PutInt(arena ? creature.ArenaPvPManager.GetTeam(creature) : (uint)0); packet.PutByte(creature.TransPvPEnabled); packet.PutInt(arena ? creature.ArenaPvPManager.GetStars(creature) : 0); packet.PutByte(creature.EvGEnabled); packet.PutByte(creature.EvGSupportRace); packet.PutByte(1); // IsPvPMode packet.PutLong(creature.PvPWins); packet.PutLong(creature.PvPLosses); packet.PutInt(0);// PenaltyPoints packet.PutByte(1); // unk // [170300] ? { packet.PutByte(0); packet.PutInt(0); packet.PutInt(0); packet.PutInt(0); packet.PutInt(0); } }
public static void CombatTargetSet(MabiCreature creature, MabiCreature target) { var packet = new MabiPacket(Op.CombatTargetSet, creature.Id); packet.PutLong(target != null ? target.Id : 0); WorldManager.Instance.Broadcast(packet, SendTargets.Range, creature); }
/// <summary> /// Broadcasts pvp information for creature in region. /// </summary> /// <param name="creature"></param> /// <param name="region"></param> public static void PvPInformation(MabiCreature creature, uint region) { var packet = new MabiPacket(Op.PvPInformation, creature.Id); packet.AddPvPInfo(creature); WorldManager.Instance.BroadcastRegion(packet, region); }
/// <summary> /// Broadcasts pvp information for creature in range. /// </summary> /// <param name="client"></param> /// <param name="creature"></param> public static void PvPInformation(MabiCreature creature) { var packet = new MabiPacket(Op.PvPInformation, creature.Id); packet.AddPvPInfo(creature); WorldManager.Instance.Broadcast(packet, SendTargets.Range, creature); }
public static void QuestUpdate(MabiCreature creature, MabiQuest quest) { var packet = new MabiPacket(Op.QuestUpdate, creature.Id); packet.AddQuestProgress(quest); creature.Client.Send(packet); }
/// <summary> /// Simple skill cancel. /// </summary> /// <param name="client"></param> /// <param name="creature"></param> public static void SkillCancel(Client client, MabiCreature creature) { var packet = new MabiPacket(Op.SkillCancel, creature.Id); packet.PutBytes(0, 1); client.Send(packet); }
public override SkillResults Stop(MabiCreature creature, MabiSkill skill) { creature.Conditions.A &= ~CreatureConditionA.ManaShield; Send.StatusEffectUpdate(creature); return SkillResults.Okay; }
public static MabiPacket AcquireItem(MabiCreature creature, uint cls, uint amount) { var p = new MabiPacket(Op.AcquireInfo, creature.Id); p.PutString("<xml type='item' classid='{0}' value='{1}'/>", cls, amount); p.PutInt(3000); return p; }
public override SkillResults Prepare(MabiCreature creature, MabiSkill skill, MabiPacket packet, uint castTime) { Send.Flash(creature); Send.SkillPrepare(creature.Client, creature, skill.Id, castTime); return SkillResults.Okay; }
public override SkillResults Use(MabiCreature creature, MabiSkill skill, MabiPacket packet) { var targetId = packet.GetLong(); var target = WorldManager.Instance.GetCreatureById(targetId); if (target == null) return SkillResults.InvalidTarget; if (creature != target && !WorldManager.InRange(creature, target, 1000)) return SkillResults.OutOfRange; // Reduce Stamina equal to healing amount if a player // is using the skill on himself. if (creature == target && creature is MabiPC) { var amount = Math.Min(skill.RankInfo.Var1, creature.LifeInjured - creature.Life); if (creature.Stamina < amount) return SkillResults.InsufficientStamina; creature.Stamina -= amount; } target.Life += skill.RankInfo.Var1; WorldManager.Instance.CreatureStatsUpdate(target); SkillHelper.DecStack(creature, skill); WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, creature.Id).PutInt(Effect.UseMagic).PutString("healing").PutLong(target.Id), SendTargets.Range, creature); WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, creature.Id).PutInt(Effect.StackUpdate).PutString("healing_stack").PutBytes(creature.ActiveSkillStacks, 0), SendTargets.Range, creature); SkillHelper.GiveSkillExp(creature, skill, 20); Send.SkillUse(creature.Client, creature, skill.Id, targetId); return SkillResults.Okay; }
public static void ItemUpdate(Client client, MabiCreature creature, MabiItem item) { var packet = new MabiPacket(Op.ItemUpdate, creature.Id); packet.AddItemInfo(item, ItemPacketType.Private); client.Send(packet); }
public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill) { var target = WorldManager.Instance.GetCreatureById(targetId); if (target == null) return SkillResults.InvalidTarget; if (attacker.Magazine == null || attacker.Magazine.Count < 1) return SkillResults.Failure; var rnd = RandomProvider.Get(); attacker.StopMove(); var factory = new CombatFactory(); factory.SetAttackerAction(attacker, CombatActionType.RangeHit, skill.Id, targetId); factory.SetAttackerOptions(AttackerOptions.Result); factory.SetAttackerStun(AfterUseStun); bool hit = false; if (attacker.GetAimPercent(1) > rnd.NextDouble()) { target.StopMove(); factory.AddTargetAction(target, CombatActionType.TakeHit); factory.SetTargetOptions(TargetOptions.Result); factory.SetTargetStun(StunTime); hit = true; } else { factory.AddTargetAction(target, CombatActionType.None); } Send.SkillUse(attacker.Client, attacker, skill.Id, AfterUseStun, 1); SkillHelper.ClearStack(attacker, skill); attacker.Client.Send(new MabiPacket(Op.CombatTargetSet, attacker.Id).PutLong(0)); factory.ExecuteDamage(new System.Func<MabiCreature, MabiCreature, float>((a, t) => { var damage = attacker.GetRndRangeDamage(); damage *= skill.RankInfo.Var1 / 100f; return damage; })); factory.ExecuteStun(); factory.ExecuteKnockback(CombatHelper.MaxKnockBack); WorldManager.Instance.HandleCombatActionPack(factory.GetCap()); if (hit) CombatHelper.SetAggro(attacker, target); SkillHelper.GiveSkillExp(attacker, skill, 20); return SkillResults.Okay; }
public MabiParty(MabiCreature leader) { _id = NewPartyId; Members.Add(leader); _leader = leader; _leader.PartyNumber = 1; }
public override SkillResults Complete(MabiCreature creature, MabiSkill skill, MabiPacket packet) { creature.Client.Send(new MabiPacket(Op.CombatSetAimR, creature.Id).PutByte(0)); Send.SkillComplete(creature.Client, creature, skill.Id); return SkillResults.Okay; }
/// <summary> /// Sends lock for creature. /// </summary> /// <param name="client"></param> /// <param name="creature"></param> /// <param name="lockType"></param> public static void CharacterLock(WorldClient client, MabiCreature creature, uint lockType = 0xEFFFFFFE) { var p = new MabiPacket(Op.CharacterLock, creature.Id); p.PutInt(lockType); p.PutInt(0); client.Send(p); }
/// <summary> /// Sends ConvertGpR to creature's client. /// </summary> public static void ConvertGpR(MabiCreature creature, bool success, uint amount) { var packet = new MabiPacket(Op.ConvertGpR, creature.Id); packet.PutByte(success); packet.PutInt(amount); creature.Client.Send(packet); }
public override SkillResults Start(MabiCreature creature, MabiSkill skill) { creature.Activate(CreatureConditionD.SpreadWings); Send.SpreadWings(creature, true); return SkillResults.Okay; }
public override SkillResults Stop(MabiCreature creature, MabiSkill skill) { creature.Deactivate(CreatureConditionD.SpreadWings); Send.SpreadWings(creature, false); return SkillResults.Okay; }
protected void FullHeal(MabiCreature creature) { creature.Injuries = 0; creature.Hunger = 0; creature.Life = creature.LifeMax; creature.Mana = creature.ManaMax; creature.Stamina = creature.StaminaMax; }
public override SkillResults Stop(MabiCreature creature, MabiSkill skill) { creature.Deactivate(CreatureConditionB.Transparent); Send.StatusEffectUpdate(creature); return SkillResults.Okay; }
public override SkillResults Complete(MabiCreature creature, MabiSkill skill, MabiPacket packet) { Send.SkillComplete(creature.Client, creature, skill.Id); if (creature.ActiveSkillStacks > 0) Send.SkillReady(creature.Client, creature, skill.Id); return SkillResults.Okay; }
/// <summary> /// Broadcasts AssignChair in range. The packet moves the creature /// into position, to sit down on the chair. Pass 0 for the parameters /// to undo. /// </summary> public static void AssignChair(MabiCreature creature, ulong chairOId, uint unk) { var packet = new Aura.Shared.Network.MabiPacket(Op.AssignChair, creature.Id); packet.PutLong(chairOId); packet.PutInt(unk); WorldManager.Instance.Broadcast(packet, SendTargets.Range, creature); }