public virtual void Dispose(bool silent) { if (Victim != null && Victim.Map != null) { if (!silent) { Victim.Map.BroadcastPacket(GetRemovePacket()); } Victim.RemoveStatusEffect(this); } Victim = null; Scheduler.DisposeTimer(RemoveSchedule); }
public static PacketWriter SpawnMob(int objectId, MapleMonster mob, bool newSpawn = false) //updated v158 { PacketWriter pw = new PacketWriter(); //[81 5C 11 00] [01] [F6 76 12 00] pw.WriteHeader(SendHeader.SpawnMonster); pw.WriteByte(0); //RED, no idea pw.WriteInt(objectId); pw.WriteBool(true); //No idea pw.WriteInt(mob.WzInfo.MobId); pw.WriteBool(true); //No idea pw.WriteInt(mob.WzInfo.HP); pw.WriteInt(mob.WzInfo.MP); pw.WriteInt(mob.WzInfo.Exp); pw.WriteInt(mob.WzInfo.PAD); pw.WriteInt(mob.WzInfo.MAD); pw.WriteInt(mob.WzInfo.PDRate); pw.WriteInt(mob.WzInfo.MDRate); pw.WriteInt(mob.WzInfo.Acc); pw.WriteInt(mob.WzInfo.Eva); pw.WriteInt(mob.WzInfo.Kb); pw.WriteInt(0); //? pw.WriteInt(mob.WzInfo.Level); pw.WriteInt(0); //? pw.WriteHexString("BF 02 00 60 00 00 00 FC 00 00 00 00 00 00 00 00"); AddMobStatus(pw, mob); //[7C 01] [61 FE] [02] [84 00] [87 00] pw.WriteShort((short)mob.Position.X); pw.WriteShort((short)(mob.Position.Y - 1)); //pw.WritePoint(Mob.Position); pw.WriteByte(mob.Stance); pw.WriteShort(0); //current fh aka leave 0 else it looks they go back to respawn pw.WriteShort(mob.Fh); //initial fh pw.WriteByte(newSpawn ? (byte)0xFE : (byte)0xFF); //-1 = instant, -2 = fade in pw.WriteByte(0xFF); //carnival team pw.WriteByte(0x7D); pw.WriteZeroBytes(24); pw.WriteInt(-1); pw.WriteByte(0); pw.WriteZeroBytes(8); pw.WriteInt(-1); pw.WriteInt(0); return(pw); }
public MonsterBuff(int ownerId, int skillId, int durationMS, BuffStat buffStat, int buffValue, MapleMonster victim, byte stacks = 0) { OwnerId = ownerId; SkillId = skillId; Duration = durationMS; BuffStat = buffStat; BuffValue = buffValue; Victim = victim; Stacks = stacks; if (buffStat != MonsterBuffStat.POISON) //Poison will remove itself after all ticks { RemoveSchedule = Scheduler.ScheduleRemoveMonsterStatusEffect(this, (uint)durationMS); } }
public static PacketWriter SetMobControl(int objectId, MapleMonster mob, bool newSpawn = false) //updated v142 { PacketWriter pw = new PacketWriter(); //[01] [EE 5B 11 00] [01] [F6 76 12 00] pw.WriteHeader(SendHeader.ControlMonster); pw.WriteByte((byte)(mob.ControllerHasAggro ? 2 : 1)); pw.WriteInt(objectId); pw.WriteBool(true); //No idea pw.WriteInt(mob.WzInfo.MobId); pw.WriteBool(true); //No idea pw.WriteInt(mob.WzInfo.HP); pw.WriteInt(mob.WzInfo.MP); pw.WriteInt(mob.WzInfo.Exp); pw.WriteInt(mob.WzInfo.PAD); pw.WriteInt(mob.WzInfo.MAD); pw.WriteInt(mob.WzInfo.PDRate); pw.WriteInt(mob.WzInfo.MDRate); pw.WriteInt(mob.WzInfo.Acc); pw.WriteInt(mob.WzInfo.Eva); pw.WriteInt(mob.WzInfo.Kb); pw.WriteInt(0); //? pw.WriteInt(mob.WzInfo.Level); pw.WriteInt(0); //? //pw.WriteZeroBytes(3); pw.WriteHexString("BF 02 00 60 00 00 00 FC 00 00 00 00 00 00 00 00"); AddMobStatus(pw, mob); pw.WritePoint(mob.Position); //DF 01 C7 01 [02] [A1 00] [9C 00] [FF] [FF] [7D] [00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00] [FF FF FF FF] [00 00 00 00 00 00 00 00 00 00 00 00 00] [FF] pw.WriteByte(mob.Stance); pw.WriteShort(0); pw.WriteShort(mob.Fh); pw.WriteByte(newSpawn ? (byte)0xFE : (byte)0xFF); pw.WriteByte(0xFF); //carnival team pw.WriteByte(0x7D); pw.WriteZeroBytes(24); pw.WriteInt(-1); pw.WriteByte(3); pw.WriteZeroBytes(12); pw.WriteByte(0xFF); return(pw); }
public Poison(int skillId, int durationMS, MapleMonster victim, int damage, int intervalMS, MapleCharacter applicant) : base(applicant.Id, skillId, durationMS, MonsterBuffStat.POISON, 0, victim) { Interval = intervalMS; ElapsedTicks = 0; TotalTicks = durationMS / intervalMS; Applicant = applicant; Damage = damage; if (TotalTicks > 0) { PoisonSchedule = Scheduler.ScheduleRepeatingAction(() => { if (ElapsedTicks < TotalTicks && victim != null && applicant != null) { victim.Damage(applicant, Damage, true, true); ElapsedTicks++; } else { Dispose(false); } }, 1000); } }
private static void AddMobStatus(PacketWriter pw, MapleMonster mob) //updated 158 { pw.WriteHexString("58 03 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); //pw.WriteHexString("BF 02 00 60 00 00 00 FC 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); }
public void Kill(MapleCharacter killer, bool dropItems = true) { lock (MobLock) { //killer.Client.CheatTracker.KillTrigger(this); Alive = false; int exp = WzInfo.Exp * ServerConstants.ExpRate; MapleCharacter dropOwner = killer; int HighestExp = 0; foreach (KeyValuePair <int, long> kvp in AttackerDamageList) { MapleCharacter attacker = Map.GetCharacter(kvp.Key); if (attacker != null) { double expPercent = ((double)Math.Min(kvp.Value, WzInfo.HP) / (double)WzInfo.HP); int expToGive = (int)((expPercent * exp) * (attacker.Stats.ExpR / 100.0)); //Drops go to the person who did the most damage if (expToGive > HighestExp) { HighestExp = expToGive; dropOwner = attacker; } attacker.GainExp(expToGive, true, true); } } if (dropItems) { Map.SpawnMapItemsFromMonster(this, this.Position, dropOwner); } dropOwner.UpdateQuestKills(WzInfo.MobId); //TODO: whole party on map Map.BroadcastPacket(MapleMonster.KillMob(ObjectId)); Map.RemoveMob(ObjectId); #region Final Pact if (dropOwner.Job == JobConstants.DARKKNIGHT) { Buff buff = dropOwner.GetBuff(DarkKnight.FINAL_PACT2); if (buff != null) { buff.Stacks--; if (buff.Stacks <= 0) { dropOwner.Client.SendPacket(Skill.ShowBuffEffect(DarkKnight.FINAL_PACT2, dropOwner.Level, null, false)); dropOwner.CancelBuff(DarkKnight.FINAL_PACT2); } else { uint remainingTimeMS = buff.Duration - (uint)DateTime.UtcNow.Subtract(buff.StartTime).TotalMilliseconds; dropOwner.Client.SendPacket(Buff.UpdateFinalPactKillCount(buff.Stacks, remainingTimeMS)); } } } #endregion Map = null; foreach (MonsterBuff effect in Buffs) { effect.Dispose(true); } } }