public static void SetSecondaryAbility() { Item right = World.Player.GetItemOnLayer(Layer.RightHand); Item left = World.Player.GetItemOnLayer(Layer.LeftHand); AOSAbility a = AOSAbility.Invalid; if (right != null) { a = GetAbility(right.ItemID.Value, m_Secondary); } if (a == AOSAbility.Invalid && left != null) { a = GetAbility(left.ItemID.Value, m_Secondary); } if (a == AOSAbility.Invalid) { a = GetAbility(FistsID[0], m_Secondary); } if (a != AOSAbility.Invalid) { ClientCommunication.SendToServer(new UseAbility(a)); ClientCommunication.SendToClient(ClearAbility.Instance); World.Player.SendMessage(LocString.SettingAOSAb, a); } }
public static void MiniHealOrCureSelf() { Spell s = null; if (!ClientCommunication.AllowBit(FeatureBit.BlockHealPoisoned)) { s = Get(1, 4); // mini heal } else { if (World.Player.Poisoned) { s = Get(2, 3); // cure } else { s = Get(1, 4); // mini heal } } if (s != null) { if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax) { Targeting.TargetSelf(true); } ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID())); s.Cast(); } }
public bool Perform() { ClientCommunication.SendToClient(new CloseGump(World.Player.CurrentGumpI)); ClientCommunication.SendToServer(new GumpResponse(World.Player.CurrentGumpS, World.Player.CurrentGumpI, m_ButtonID, m_Switches, m_TextEntries)); World.Player.HasGump = false; return(true); }
private static void AttackLastComb() { if (m_LastCombatant.IsMobile) { ClientCommunication.SendToServer(new AttackReq(m_LastCombatant)); } }
private static void AttackLastTarg() { if (m_LastTarget != null && m_LastTarget.Serial.IsMobile) { ClientCommunication.SendToServer(new AttackReq(m_LastTarget.Serial)); } }
internal static void HealOrCureSelfChiva() { Spell s = null; s = Get(20, World.Player.Poisoned ? 1 : 2); if (RazorEnhanced.Settings.General.ReadBool("BlockChivalryHealCheckBox")) { if (World.Player.Hits < World.Player.HitsMax || World.Player.Poisoned) { if (s != null) { if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax) { Targeting.TargetSelf(true); } ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID())); s.Cast(); } } } else { if (s != null) { if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax) { Targeting.TargetSelf(true); } ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID())); s.Cast(); } } }
internal static void ClearAbilities() { World.Player.HasSpecial = false; ClientCommunication.SendToServer(new UseAbility(AOSAbility.Clear)); ClientCommunication.SendToClient(ClearAbility.Instance); World.Player.SendMessage(LocString.AOSAbCleared); }
protected override void OnTick() { ArrayList requeue = null; m_LastTick = DateTime.UtcNow; if (m_Queue != null && m_Queue.Count > 0) { this.Interval = TimeSpan.FromMilliseconds(Config.GetInt("ObjectDelay")); while (m_Queue.Count > 0) { Serial s = (Serial)m_Queue.Peek(); if (s == Serial.Zero) // dragdrop action { DragDropManager.ProcStatus status = DragDropManager.ProcessNext(m_Queue.Count - 1); if (status != DragDropManager.ProcStatus.KeepWaiting) { m_Queue.Dequeue(); // if not waiting then dequeue it if (status == DragDropManager.ProcStatus.ReQueue) { m_Queue.Enqueue(s); } } if (status == DragDropManager.ProcStatus.KeepWaiting || status == DragDropManager.ProcStatus.Success) { break; // don't process more if we're waiting or we just processed something } } else { m_Queue.Dequeue(); ClientCommunication.SendToServer(new DoubleClick(s)); break; } } if (requeue != null) { for (int i = 0; i < requeue.Count; i++) { m_Queue.Enqueue(requeue[i]); } } } else { Stop(); if (m_Total > 1 && World.Player != null) { World.Player.SendMessage(LocString.QueueFinished, m_Total, ((DateTime.UtcNow - m_StartTime) - this.Interval).TotalSeconds); } m_Last = Serial.Zero; m_Total = 0; } }
private static void OpenDoor() { if (World.Player != null) { ClientCommunication.SendToServer(new OpenDoorMacro()); } }
internal static void HealOrCureSelf() { Spell s = null; if (World.Player.Poisoned) { s = Get(2, 3); // cure } else if (World.Player.Hits + 2 < World.Player.HitsMax) { if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12) { s = Get(4, 5); // greater heal } else { s = Get(1, 4); // mini heal } } else { if (World.Player.Mana >= 12) { s = Get(4, 5); // greater heal } else { s = Get(1, 4); // mini heal } } if (RazorEnhanced.Settings.General.ReadBool("BlockBigHealCheckBox")) { if (World.Player.Hits < World.Player.HitsMax || World.Player.Poisoned) { if (s != null) { if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax) { Targeting.TargetSelf(true); } ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID())); s.Cast(); } } } else { if (s != null) { if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax) { Targeting.TargetSelf(true); } ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID())); s.Cast(); } } }
internal static void OnStun() { if (m_LastToggle + TimeSpan.FromSeconds(0.5) < DateTime.Now) { m_LastToggle = DateTime.Now; ClientCommunication.SendToServer(new StunRequest()); } }
private static void OnDisarm() { if (m_LastToggle + TimeSpan.FromSeconds(0.5) < DateTime.Now) { m_LastToggle = DateTime.Now; ClientCommunication.SendToServer(new DisarmRequest()); } }
public static void Interrupt() { Item item = FindUsedLayer(); if (item != null) { ClientCommunication.SendToServer(new LiftRequest(item, 1)); // unequip ClientCommunication.SendToServer(new EquipRequest(item.Serial, World.Player, item.Layer)); // Equip } }
private static void CancelTarget() { OnClearQueue(); CancelClientTarget(); if (m_HasTarget) { ClientCommunication.SendToServer(new TargetCancelResponse(m_CurrentID)); m_HasTarget = false; } }
public static void Target(TargetInfo info) { if (m_Intercept) { OneTimeResponse(info); } else if (m_HasTarget) { info.TargID = m_CurrentID; m_LastGroundTarg = m_LastTarget = info; ClientCommunication.SendToServer(new TargetResponse(info)); } CancelClientTarget(); m_HasTarget = false; }
private static void Resync(string[] param) { if (DateTime.UtcNow - m_LastSync > TimeSpan.FromSeconds(1.0)) { m_LastSync = DateTime.UtcNow; ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3, Language.CliLocName, "System", "Updating and resyncing with server")); ClientCommunication.SendToClient(new MobileUpdate(World.Player)); ClientCommunication.SendToServer(new ResyncReq()); World.Player.Resync(); ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3, Language.CliLocName, "System", "Done..")); } }
private static void DropCurrent() { Log("Drop current requested on {0}", m_Holding); if (m_Holding.IsItem) { if (World.Player.Backpack != null) { ClientCommunication.SendToServer(new DropRequest(m_Holding, Point3D.MinusOne, World.Player.Backpack.Serial)); } else { ClientCommunication.SendToServer(new DropRequest(m_Holding, World.Player.Position, Serial.Zero)); } } Clear(); }
internal static void SetSecondaryAbility() { Item right = World.Player.GetItemOnLayer(Layer.RightHand); Item left = World.Player.GetItemOnLayer(Layer.LeftHand); AOSAbility a = AOSAbility.Invalid; if (right != null) { a = GetAbility(right.ItemID.Value, m_Secondary); } if (a == AOSAbility.Invalid && left != null) { a = GetAbility(left.ItemID.Value, m_Secondary); } if (a == AOSAbility.Invalid) { a = GetAbility(FistsID[0], m_Secondary); } if (a != AOSAbility.Invalid) { if (right != null) // Fix per arma con special differente se in volo o meno gargoyle { if (right.ItemID == 0x0901 || right.ItemID == 0x406C) { if (World.Player.Flying) { a = AOSAbility.ParalyzingBlow; } else { a = AOSAbility.Dismount; } } } World.Player.HasSpecial = true; ClientCommunication.SendToServer(new UseAbility(a)); ClientCommunication.SendToClient(ClearAbility.Instance); World.Player.SendMessage(LocString.SettingAOSAb, a); } }
public static void HealOrCureSelf() { Spell s = null; { if (World.Player.Poisoned) { s = Get(2, 3); // cure } else if (World.Player.Hits + 2 < World.Player.HitsMax) { if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12) { s = Get(4, 5); // greater heal } else { s = Get(1, 4); // mini heal } } else { if (World.Player.Mana >= 12) { s = Get(4, 5); // greater heal } else { s = Get(1, 4); // mini heal } } } if (s != null) { if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax) { Targeting.TargetSelf(true); } ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID())); s.Cast(); } }
internal static bool Drop(Item i, Serial dest, Point3D pt) { if (m_Pending == i.Serial) { Log("Dropping {0} to {1} (@{2})", i, dest, pt); ClientCommunication.SendToServer(new DropRequest(i.Serial, pt, dest)); m_Pending = Serial.Zero; m_Lifted = DateTime.MinValue; return(true); } else { bool add = false; for (byte j = m_Front; j != m_Back && !add; j++) { if (m_LiftReqs[j] != null && m_LiftReqs[j].Serial == i.Serial) { add = true; break; } } if (add) { Log("Queuing Drop {0} (to {1} (@{2}))", i, dest, pt); if (!m_DropReqs.ContainsKey(i.Serial)) { m_DropReqs.Add(i.Serial, new Queue <DropReq>()); } Queue <DropReq> q = m_DropReqs[i.Serial]; q.Enqueue(new DropReq(dest, pt)); return(true); } else { Log("Drop for {0} (to {1} (@{2})) not found, skipped", i, dest, pt); return(false); } } }
public static bool Drop(Item i, Mobile to, Layer layer) { if (m_Pending == i.Serial) { Log("Equipping {0} to {1} (@{2})", i, to.Serial, layer); ClientCommunication.SendToServer(new EquipRequest(i.Serial, to, layer)); m_Pending = Serial.Zero; m_Lifted = DateTime.MinValue; return(true); } else { bool add = false; for (byte j = m_Front; j != m_Back && !add; j++) { if (m_LiftReqs[j] != null && m_LiftReqs[j].Serial == i.Serial) { add = true; break; } } if (add) { Log("Queuing Equip {0} to {1} (@{2})", i, to.Serial, layer); if (!m_DropReqs.TryGetValue(i.Serial, out var q) || q == null) { m_DropReqs[i.Serial] = q = new Queue <DropReq>(); } q.Enqueue(new DropReq(to == null ? Serial.Zero : to.Serial, layer)); return(true); } else { Log("Drop/Equip for {0} (to {1} (@{2})) not found, skipped", i, to == null ? Serial.Zero : to.Serial, layer); return(false); } } }
private static void EndPlayback() { m_PlayTimer = null; m_Playing = false; ClientCommunication.SetAllowDisconn(true); //ClientCommunication.SetDeathMsg( "You are dead." ); PlayerData player; using (BinaryReader reader = new BinaryReader(m_TempWriter.BaseStream)) { reader.BaseStream.Seek(0, SeekOrigin.Begin); player = World.Player = new PlayerData(reader, PlayerVersion); } m_TempWriter.Close(); player.Contains.Clear(); World.AddMobile(player); DoLogin(player); tbPos.Enabled = btnClose.Enabled = btnPlay.Enabled = btnStop.Enabled = btnRec.Enabled = true; tbPos.Value = tbPos.Minimum; m_Elapsed = TimeSpan.Zero; UpdateTimeText(); ClientCommunication.SendToClient(new MoveReject(World.Player.WalkSequence, World.Player)); ClientCommunication.SendToServer(new ResyncReq()); World.Player.Resync(); ClientCommunication.RequestTitlebarUpdate(); if (ClientCommunication.AllowBit(FeatureBit.LightFilter) && World.Player != null) { World.Player.LocalLightLevel = 0; ClientCommunication.SendToClient(new GlobalLightLevel(0)); ClientCommunication.SendToClient(new PersonalLightLevel(World.Player)); } }
public static void Pwnx0r(string[] args) { int count = 0x7FFFFFFF; try { count = Utility.ToInt32(args[0], 0x7FFFFFFF); } catch { } World.Player.SendMessage(MsgLevel.Force, "Pwning... {0}", count); for (int i = 0; i < count; i++) { ClientCommunication.SendToServer(new ResyncReq()); } World.Player.SendMessage(MsgLevel.Force, "Done."); }
private void AutoOpenDoors() { if (Body != 0x03DB && !IsGhost && ((int)(Direction & Direction.Mask)) % 2 == 0 && Config.GetBool("AutoOpenDoors")) { int x = Position.X, y = Position.Y, z = Position.Z; /* Check if one more tile in the direction we just moved is a door */ Utility.Offset(Direction, ref x, ref y); foreach (Item i in World.Items.Values) { if (i.IsDoor && i.Position.X == x && i.Position.Y == y && i.Position.Z - 15 <= z && i.Position.Z + 15 >= z) { ClientCommunication.SendToServer(new OpenDoorMacro()); break; } } } }
public static bool DoTargetSelf() { if (World.Player == null) { return(false); } if (CheckHealPoisonTarg(m_CurrentID, World.Player.Serial)) { return(false); } CancelClientTarget(); m_HasTarget = false; if (m_Intercept) { TargetInfo targ = new TargetInfo(); targ.Serial = World.Player.Serial; targ.Gfx = World.Player.Body; targ.Type = 0; targ.X = World.Player.Position.X; targ.Y = World.Player.Position.Y; targ.Z = World.Player.Position.Z; targ.TargID = LocalTargID; targ.Flags = 0; OneTimeResponse(targ); } else { ClientCommunication.SendToServer(new TargetResponse(m_CurrentID, m_CurFlags, World.Player)); } return(true); }
private static void Pwn(string[] args) { if (World.Player == null) { return; } int count = 1000; if (args.Length > 0) { count = Utility.ToInt32(args[0], 1000); } Packet p = new Packet(0x22, 3 * count + 3); p.Write((short)0); for (int i = 0; i < count; i++) { p.Write((byte)0x22); p.Write((short)0); } ClientCommunication.SendToServer(p); }
private static void DoPing() { m_Seq = (byte)Utility.Random(256); m_Start = DateTime.Now; ClientCommunication.SendToServer(new PingPacket(m_Seq)); }
internal void OnCast(Packet p) { Cast(); ClientCommunication.SendToServer(p); }
public void OnCast(PacketReader p) { Cast(); ClientCommunication.SendToServer(p); }
public static void ClearAbilities() { ClientCommunication.SendToServer(new UseAbility(AOSAbility.Clear)); ClientCommunication.SendToClient(ClearAbility.Instance); World.Player.SendMessage(LocString.AOSAbCleared); }