protected override void SetCreatureStats() { Speed = 320; StsInterface.Speed = 320; MvtInterface.SetBaseSpeed(Speed); // Normal siege weapons will tank 5 cannon hits (4500, cannons hit for 1000) // Rams will tank 300 cannon hits (60000, cannons hit for 200) switch (Keep.Tier) { case 2: StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)3500 : (ushort)500); break; case 3: StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)4600 : (ushort)700); break; case 4: StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)6000 : (ushort)900); break; } StsInterface.ApplyStats(); }
protected override void SetCreatureStats() { Speed = 320; StsInterface.Speed = 320; MvtInterface.SetBaseSpeed(Speed); // Normal siege weapons will tank 5 cannon hits (4500, cannons hit for 1000) // Rams will tank 300 cannon hits (60000, cannons hit for 200) StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)6000 : (ushort)900); StsInterface.ApplyStats(); }
public override void Dispose() { ItmInterface.Stop(); CbtInterface.Stop(); StsInterface.Stop(); QtsInterface.Stop(); MvtInterface.Stop(); AbtInterface.Stop(); EvtInterface.Stop(); AiInterface.Stop(); base.Dispose(); }
public virtual void SendState(Player plr = null) { if (!IsInWorld()) { return; } MvtInterface.UpdateMovementState(plr); if (MvtInterface.IsMoving) { SendAnimation(); } }
public bool Recall() { if (!IsDead && !IsStationary && !PendingDisposal) { MvtInterface.ScaleSpeed(Owner.MountID != 0 ? 1.5f : SpeedMult); MvtInterface.Recall(Owner); FollowMode = 2; IsHeeling = true; AiInterface.Debugger?.SendClientMessage("[MR]: Ignoring enemies during heel."); SendPetUpdate(); } return(false); }
public bool Recall(Object obj, object args) { if (!IsDead && !IsStationary && !PendingDisposal) { if (Zone == null) { Log.Error("Pet", $"{Name} owned by {Owner.Name}: Not in a zone - IsDisposed: {IsDisposed}\n{Environment.StackTrace}"); return(true); } MvtInterface.ScaleSpeed(Owner.MountID != 0 ? 1.5f : SpeedMult); MvtInterface.Recall(Owner); FollowMode = 2; IsHeeling = true; AiInterface.Debugger?.SendClientMessage("[MR]: Ignoring enemies during heel."); SendPetUpdate(); } return(false); }
public override void Update() { long Tick = TCPManager.GetTimeStampMS(); UpdateHealth(Tick); UpdateActionPoints(Tick); EvtInterface.Update(Tick); CbtInterface.Update(Tick); ItmInterface.Update(Tick); StsInterface.Update(Tick); QtsInterface.Update(Tick); MvtInterface.Update(Tick); AbtInterface.Update(Tick); AiInterface.Update(Tick); if (NextSend < Tick) { NextSend = Tick + STATE_INTERVAL; SendState(null); } base.Update(); }
protected override void SendCreateMonster(Player plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER, 100 + Name.Length); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16(Heading); Out.WriteUInt16((ushort)WorldPosition.Z); Out.WriteUInt32((uint)WorldPosition.X); Out.WriteUInt32((uint)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z // 18 if (Spawn.Proto.Model2 != 0) { Out.WriteUInt16(StaticRandom.Instance.Next(0, 100) < 50 ? Spawn.Proto.Model1 : Spawn.Proto.Model2); } else { Out.WriteUInt16(Spawn.Proto.Model1); } Out.WriteByte(Scale); Out.WriteByte(Level); Out.WriteByte(Faction); Out.Fill(0, 4); Out.WriteByte(Spawn.Emote); Out.WriteByte(0); // ? Out.WriteUInt16(Spawn.Proto._Unks[1]); Out.WriteByte(0); Out.WriteUInt16(Spawn.Proto._Unks[2]); Out.WriteUInt16(Spawn.Proto._Unks[3]); Out.WriteUInt16(Spawn.Proto._Unks[4]); Out.WriteUInt16(Spawn.Proto._Unks[5]); Out.WriteUInt16(Spawn.Proto._Unks[6]); Out.WriteUInt16(Spawn.Proto.Title); // States region Out.WriteByte(1); Out.WriteByte(0x19); Out.WriteByte(0); // 47 Out.WriteCString(Name); Out.WriteUInt16(0x010A); // Fig leaf data Out.WriteByte(0); Out.WriteUInt16(Owner.Oid); // Need to write OBJECT_STATE length here long objStateLenPos = Out.Position; Out.WriteByte(0); Out.WriteByte(5); // F_PLAYER_INVENTORY length Out.WriteByte(0); // unk MvtInterface.WriteMovementState(Out); long latestPos = Out.Position; Out.Position = objStateLenPos; Out.WriteByte((byte)(latestPos - (objStateLenPos + 3))); Out.Position = latestPos; // F_PLAYER_INVENTORY Out.WriteUInt16(Oid); Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(0); plr.SendPacket(Out); }
public override void OnLoad() { InteractType = Spawn.Proto.InteractType; SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction); ItmInterface.Load(CreatureService.GetCreatureItems(Spawn.Entry)); if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel) { Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel; } if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel) { Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel; } if (Spawn.Proto.MaxLevel == 0) { Spawn.Proto.MaxLevel = 1; } if (Spawn.Proto.MinLevel == 0) { Spawn.Proto.MinLevel = 1; } if (Spawn.Level != 0) { if (Spawn.Level > 2) { Level = (byte)StaticRandom.Instance.Next(Spawn.Level - 1, Spawn.Level + 1); } else { Level = (byte)StaticRandom.Instance.Next(Spawn.Level, Spawn.Level + 1); } } else { Level = (byte)StaticRandom.Instance.Next(Spawn.Proto.MinLevel, Spawn.Proto.MaxLevel + 1); } SetCreatureStats(); Health = TotalHealth; X = Zone.CalculPin((uint)Spawn.WorldX, true); Y = Zone.CalculPin((uint)Spawn.WorldY, false); Z = (ushort)Spawn.WorldZ; // TODO : Bad Height Formula /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y); * if (Z < HeightMap) * { * Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z); * return; * }*/ Heading = (ushort)Spawn.WorldO; WorldPosition.X = Spawn.WorldX; WorldPosition.Y = Spawn.WorldY; WorldPosition.Z = Spawn.WorldZ; SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12)); ScrInterface.AddScript(Spawn.Proto.ScriptName); SaveSpawnData(); LoadInterfaces(); AiInterface.SetBrain(new DummyBrain(this)); States.Add(0x12); States.Add((byte)CreatureState.UnkOmnipresent); Speed = 350; StsInterface.Speed = 350; MvtInterface.SetBaseSpeed(Speed); MvtInterface.FollowReacquisitionInterval = 100; IsActive = true; }
protected override void SendCreateMonster(Player plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER, 110 + States.Count + (Name?.Length ?? Spawn.Proto.Name.Length)); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16(Heading); Out.WriteUInt16((ushort)WorldPosition.Z); Out.WriteUInt32((uint)WorldPosition.X); Out.WriteUInt32((uint)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z Out.WriteUInt16(Spawn.Proto.Model1); Out.WriteByte(Scale); Out.WriteByte(Level); Out.WriteByte(Faction); Out.WriteByte(0); Out.WriteByte(SiegeInterface != null && SiegeInterface.IsDeployed ? (byte)1 : (byte)0); Out.Fill(0, 2); Out.WriteByte(Spawn.Emote); Out.WriteByte(0); // ? Out.WriteUInt16(Spawn.Proto._Unks[1]); Out.WriteByte(0); Out.WriteUInt16(Spawn.Proto._Unks[2]); Out.WriteUInt16(Spawn.Proto._Unks[3]); Out.WriteUInt16(Spawn.Proto._Unks[4]); Out.WriteUInt16(Spawn.Proto._Unks[5]); Out.WriteUInt16(Spawn.Proto._Unks[6]); Out.WriteUInt16(Spawn.Proto.Title); Out.WriteByte((byte)States.Count); Out.Write(States.ToArray(), 0, States.Count); Out.WriteByte(0); Out.WriteCString(Name ?? Spawn.Proto.Name); // Fig leaf data if (Spawn.Proto.CreatureType == (byte)GameData.CreatureTypes.SIEGE) { Out.Fill(0, 3); Out.WriteByte(0x8); // Player-placed Siege Out.WriteByte(0x1); Out.WriteByte(0x0A); } // End fig leaf data Out.WriteByte(0); Out.WriteUInt16(0); // Owner OID // Need to write OBJECT_STATE length here long objStateLenPos = Out.Position; Out.WriteByte(0); Out.WriteByte(5); // F_PLAYER_INVENTORY length Out.WriteByte(0); // unk MvtInterface.WriteMovementState(Out); long latestPos = Out.Position; Out.Position = objStateLenPos; Out.WriteByte((byte)(latestPos - (objStateLenPos + 3))); Out.Position = latestPos; // F_PLAYER_INVENTORY Out.WriteUInt16(Oid); Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(0); plr.SendPacket(Out); }