public static void HandleMessage(Packet packet, IClient client, bool fromQueue) { Packet reply = new Packet(PacketFamily.Welcome, PacketAction.Reply); client.EnterGame(); client.Character.Map.Enter(client.Character, WarpAnimation.Admin); reply.AddShort((short)WelcomeReply.WorldInfo); reply.AddBreak(); for (int i = 0; i < 9; ++i) { reply.AddBreakString("A"); } reply.AddChar(client.Character.Weight); // Weight reply.AddChar(client.Character.MaxWeight); // Max Weight // Inventory foreach (ItemStack item in client.Character.Items) { reply.AddShort(item.Id); reply.AddInt(item.Amount); } reply.AddBreak(); // Spells reply.AddBreak(); IEnumerable<Character> characters = client.Character.GetInRange<Character>(); IEnumerable<NPC> npcs = client.Character.GetInRange<NPC>(); IEnumerable<MapItem> items = client.Character.GetInRange<MapItem>(); reply.AddChar((byte)characters.Count()); reply.AddBreak(); // Characters // { foreach (Character character in characters) { character.InfoBuilder(ref reply); reply.AddBreak(); } // } // NPCs foreach (NPC npc in npcs) { npc.InfoBuilder(ref reply); } reply.AddBreak(); // Items foreach (MapItem item in items) { item.InfoBuilder(ref reply); } client.Send(reply); }
public bool DoorOpen(byte x, byte y) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet builder = new Packet(PacketFamily.Door, PacketAction.Open); builder.AddChar(x); builder.AddChar(y); return m_client.SendPacket(builder); }
/// <summary> /// Opens a locker at X/Y coordinates /// </summary> public bool OpenLocker(byte x, byte y) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Locker, PacketAction.Open); pkt.AddChar(x); pkt.AddChar(y); return m_client.SendPacket(pkt); }
public bool ChestOpen(byte x, byte y) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet toSend = new Packet(PacketFamily.Chest, PacketAction.Open); toSend.AddChar(x); toSend.AddChar(y); return m_client.SendPacket(toSend); }
/// <summary> /// Withdraw an item from your private locker /// </summary> public bool LockerTakeItem(byte x, byte y, short id) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Locker, PacketAction.Take); pkt.AddChar(x); pkt.AddChar(y); pkt.AddShort(id); return m_client.SendPacket(pkt); }
public bool ChestAddItem(byte x, byte y, short itemID, int amount) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Chest, PacketAction.Add); pkt.AddChar(x); pkt.AddChar(y); pkt.AddShort(itemID); pkt.AddThree(amount); return m_client.SendPacket(pkt); }
public bool PlayerWalk(EODirection dir, byte destX, byte destY, bool admin = false) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet builder = new Packet(PacketFamily.Walk, admin ? PacketAction.Admin : PacketAction.Player); //change family/action builder.AddChar((byte) dir); builder.AddThree(DateTime.Now.ToEOTimeStamp()); builder.AddChar(destX); builder.AddChar(destY); return m_client.SendPacket(builder); }
public static void HandleAgree(Packet packet, IClient client, bool fromQueue) { FileType fileType = (FileType)packet.GetChar(); string fileName; InitReply replyCode; switch (fileType) { case FileType.Map: fileName = client.Character.Map.Data.GetPubFile("./tmp/"); replyCode = InitReply.FileMap; break; case FileType.Item: fileName = "./data/dat001.eif"; replyCode = InitReply.FileEIF; break; case FileType.NPC: fileName = "./data/dtn001.enf"; replyCode = InitReply.FileENF; break; case FileType.Spell: fileName = "./data/dsl001.esf"; replyCode = InitReply.FileESF; break; case FileType.Class: fileName = "./data/dat001.ecf"; replyCode = InitReply.FileECF; break; default: throw new ArgumentOutOfRangeException("Invalid file type request"); } Packet reply = new Packet(PacketFamily.Init, PacketAction.Init); reply.AddChar((byte)replyCode); if (fileType != FileType.Map) reply.AddChar(1); // File ID reply.AddBytes(File.ReadAllBytes(fileName)); client.Send(reply); }
public bool AttackUse(EODirection direction) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Attack, PacketAction.Use); pkt.AddChar((byte)direction); pkt.AddThree(DateTime.Now.ToEOTimeStamp()); return m_client.SendPacket(pkt); }
/// <summary> /// Set the agree flag for a pending trade offer /// </summary> /// <param name="agree">True to agree, false to un-agree</param> public bool TradeAgree(bool agree) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Trade, PacketAction.Agree); pkt.AddChar((byte)(agree ? 1 : 0)); return m_client.SendPacket(pkt); }
/// <summary> /// Change the direction of the currently logged in player /// </summary> /// <param name="dir">Direction to face the currently logged in player</param> /// <returns>True on successful send, false otherwise</returns> public bool FacePlayer(EODirection dir) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Face, PacketAction.Player); pkt.AddChar((byte)dir); return m_client.SendPacket(pkt); }
/// <summary> /// Accept another players request for trade /// </summary> /// <param name="characterID">ID of the other player's character</param> public bool TradeAcceptRequest(short characterID) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Trade, PacketAction.Accept); pkt.AddChar(123); //? pkt.AddShort(characterID); return m_client.SendPacket(pkt); }
/// <summary> /// Opens a locker at X/Y coordinates /// </summary> public static bool OpenLocker(byte x, byte y) { if (EOLockerDialog.Instance == null) { return(true); } EOClient client = (EOClient)World.Instance.Client; if (!client.ConnectedAndInitialized) { return(false); } Packet pkt = new Packet(PacketFamily.Locker, PacketAction.Open); pkt.AddChar(x); pkt.AddChar(y); return(client.SendPacket(pkt)); }
/// <summary> /// Withdraw an item from your private locker /// </summary> public static bool TakeItem(short id) { if (EOLockerDialog.Instance == null) { return(true); } EOClient client = (EOClient)World.Instance.Client; if (!client.ConnectedAndInitialized) { return(false); } Packet pkt = new Packet(PacketFamily.Locker, PacketAction.Take); pkt.AddChar(EOLockerDialog.Instance.X); pkt.AddChar(EOLockerDialog.Instance.Y); pkt.AddShort(id); return(client.SendPacket(pkt)); }
public static void HandleRequest(Packet packet, IClient client, bool fromQueue) { short count = (short)client.Server.Characters.Count; // TODO: Don't list hidden admins Packet reply = new Packet(PacketFamily.Init, PacketAction.Init); reply.AddChar((byte)EO.InitReply.Players); reply.AddShort(count); reply.AddBreak(); foreach (Character character in client.Server.Characters) { reply.AddBreakString(character.Name); reply.AddBreakString(character.Title ?? ""); reply.AddChar(0); // What's this? reply.AddChar((byte)EO.PaperdollIcon.HGM); reply.AddChar((byte)character.ClassId); reply.AddString("TAG"); reply.AddBreak(); } client.Send(reply); }
public bool ReportEmote(Emote emote) { //trade/level up happen differently if (emote == Emote.Trade || emote == Emote.LevelUp) return false; //signal error client-side if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Emote, PacketAction.Report); pkt.AddChar((byte)emote); return m_client.SendPacket(pkt); }
public static bool AddStatPoint(short statID) { EOClient client = (EOClient)World.Instance.Client; if (client == null || !client.ConnectedAndInitialized) { return(false); } Packet pkt = new Packet(PacketFamily.StatSkill, PacketAction.Add); pkt.AddChar((byte)TrainType.Stat); pkt.AddShort(statID); return(client.SendPacket(pkt)); }
public void SetSelectedTab(ChatTabs tabToSelect) { if ((ChatTabs)currentSelTab == ChatTabs.Global && tabToSelect != ChatTabs.Global) { Packet pkt = new Packet(PacketFamily.Global, PacketAction.Close); pkt.AddChar((byte)'n'); World.Instance.Client.SendPacket(pkt); } else if (tabToSelect == ChatTabs.Global && (ChatTabs)currentSelTab != ChatTabs.Global) { Packet pkt = new Packet(PacketFamily.Global, PacketAction.Open); pkt.AddChar((byte)'y'); World.Instance.Client.SendPacket(pkt); } tabs[currentSelTab].Selected = false; tabs[currentSelTab = (int)tabToSelect].Selected = true; }
public static bool ReportEmote(EndlessClient.Emote emote) { //trade/level up happen differently if (emote == EndlessClient.Emote.Trade || emote == EndlessClient.Emote.LevelUp) { return(false); //signal error client-side } EOClient client = (EOClient)World.Instance.Client; if (!client.ConnectedAndInitialized) { return(false); } Packet pkt = new Packet(PacketFamily.Emote, PacketAction.Report); pkt.AddChar((byte)emote); return(client.SendPacket(pkt)); }
public void HelloHax0r() { Packet packet = new Packet(PacketFamily.StatSkill, PacketAction.Player); for (int i = 0; i < 32; ++i) { packet.AddChar(0xFF); } Send(packet); }
public static void HandleRequest(Packet packet, IClient client, bool fromQueue) { int id = packet.GetInt(); if (id < 0 || id > client.Account.Characters.Count) throw new ArgumentOutOfRangeException("Login character ID out of range"); client.SelectCharacter(client.Account.Characters[id]); Packet reply = new Packet(PacketFamily.Welcome, PacketAction.Reply); reply.AddShort((short)WelcomeReply.CharacterInfo); reply.AddShort((short)client.Id); reply.AddInt(id); reply.AddShort((short)client.Character.Map.Data.Id); reply.AddBytes(client.Character.Map.Data.RevisionID); reply.AddThree((int)client.Character.Map.Data.PubFileLength); reply.AddBytes(client.Server.ItemData.revisionId); reply.AddShort((short)client.Server.ItemData.Count); reply.AddBytes(client.Server.NpcData.revisionId); reply.AddShort((short)client.Server.NpcData.Count); reply.AddBytes(client.Server.SpellData.revisionId); reply.AddShort((short)client.Server.SpellData.Count); reply.AddBytes(client.Server.ClassData.revisionId); reply.AddShort((short)client.Server.ClassData.Count); reply.AddBreakString(client.Character.Name); reply.AddBreakString(client.Character.Title ?? ""); reply.AddBreakString("Guild Name"); reply.AddBreakString("Guild Rank"); reply.AddChar(0); // Class reply.AddString("TAG"); // Guild tag reply.AddChar((byte)client.Character.Admin); reply.AddChar(client.Character.Level); // Level reply.AddInt(client.Character.Exp); // Exp reply.AddInt(client.Character.Usage); // Usage reply.AddShort(client.Character.Hp); // HP reply.AddShort(client.Character.MaxHp); // MaxHP reply.AddShort(client.Character.Tp); // TP reply.AddShort(client.Character.MaxTp); // MaxTP reply.AddShort(client.Character.MaxSp); // MaxSP reply.AddShort(client.Character.StatPoints); // StatPts reply.AddShort(client.Character.SkillPoints); // SkillPts reply.AddShort(client.Character.Karma); // Karma reply.AddShort(client.Character.MinDamage); // MinDam reply.AddShort(client.Character.MaxDamage); // MaxDam reply.AddShort(client.Character.Accuracy); // Accuracy reply.AddShort(client.Character.Evade); // Evade reply.AddShort(client.Character.Defence); // Armor reply.AddShort(client.Character.Strength); // Str reply.AddShort(client.Character.Wisdom); // Wis reply.AddShort(client.Character.Intelligence); // Int reply.AddShort(client.Character.Agility); // Agi reply.AddShort(client.Character.Constitution); // Con reply.AddShort(client.Character.Charisma); // Cha // Inventory reply.AddBreak(); reply.AddChar(1); // Guild Rank reply.AddShort(2); // Jail map reply.AddShort(4); // ? reply.AddChar(24); // ? reply.AddChar(24); // ? reply.AddShort(10); // ? reply.AddShort(10); // ? reply.AddShort(0); // Admin command flood rate reply.AddShort(2); // ? reply.AddChar(0); // Login warning message reply.AddBreak(); client.Send(reply); }
private void PingClients(Object stateInfo) { Program.Logger.LogDebug("Pinging clients."); Packet packet = new Packet(PacketFamily.Connection, PacketAction.Player); packet.AddShort(0); packet.AddChar(0); foreach (KeyValuePair<ushort, IClient> client in clients) { if (client.Value.Pinged) { Program.Logger.LogError("Client ping timed out."); RemoveClient(client.Value); } else { client.Value.Send(packet); client.Value.Pinged = true; } } }
public bool RequestFile(InitFileType file, short mapID = -1) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; if (file == InitFileType.Map && mapID <= 0) return false; Packet builder = new Packet(PacketFamily.Welcome, PacketAction.Agree); builder.AddChar((byte)file); m_client.ExpectingFile = true; m_init_requestedMap = mapID; if (!m_client.SendPacket(builder) || !m_init_responseEvent.WaitOne(Constants.ResponseFileTimeout)) return false; return true; }
private bool _trainStatShared(short id, TrainType type) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.StatSkill, PacketAction.Add); pkt.AddChar((byte)type); pkt.AddShort(id); return m_client.SendPacket(pkt); }
public static void HandleCreate(Packet packet, IClient client, bool fromQueue) { short createId = packet.GetShort(); Gender gender = (Gender)packet.GetShort(); short hairStyle = packet.GetShort(); short hairColor = packet.GetShort(); Skin skin = (Skin)packet.GetShort(); packet.GetByte(); string name = packet.GetBreakString().ToLower(); if (!Enum.IsDefined(typeof(Gender), gender)) throw new ArgumentOutOfRangeException("Invalid gender on character creation (" + gender + ")"); // TODO: Make these configurable if (hairStyle < 1 || hairStyle > 20 || hairColor < 0 || hairColor > 9) throw new ArgumentOutOfRangeException("Hair parameters out of range on character creation (" + hairStyle + ", " + hairColor + ")"); if (!Enum.IsDefined(typeof(Skin), skin)) throw new ArgumentOutOfRangeException("Invalid skin on character creation (" + skin + ")"); Packet reply = new Packet(PacketFamily.Character, PacketAction.Reply); // TODO: Make this configurable if (client.Account.Characters.Count >= 3) { reply.AddShort((short)CharacterReply.Full); client.Send(reply); return; } if (!Character.ValidName(name)) { reply.AddShort((short)CharacterReply.NotApproved); client.Send(reply); return; } // TODO: Make a CharacterExists function var checkCharacter = from Character c in client.Server.Database.Container where c.name == name select 1; if (checkCharacter.Count() != 0) { reply.AddShort((short)CharacterReply.Exists); client.Send(reply); return; } Character newCharacter = new Character(client.Server, client, name, gender, (byte)hairStyle, (byte)hairColor, skin); client.Account.Characters.Add(newCharacter); newCharacter.Store(); client.Account.Store(); client.Server.Database.Commit(); reply.AddShort((short)CharacterReply.OK); reply.AddChar((byte)client.Account.Characters.Count); reply.AddByte(1); // TODO: What is this? reply.AddBreak(); // TODO: Some kind of character list packet builder int i = 0; foreach (Character character in client.Account.Characters) { reply.AddBreakString(character.Name); reply.AddInt(i++); reply.AddChar(character.Level); reply.AddChar((byte)character.Gender); reply.AddChar(character.HairStyle); reply.AddChar(character.HairColor); reply.AddChar((byte)character.Skin); reply.AddChar((byte)character.Admin); reply.AddShort((short)(character.Boots != null ? character.Boots.Data.special1 : 0)); reply.AddShort((short)(character.Armor != null ? character.Armor.Data.special1 : 0)); reply.AddShort((short)(character.Hat != null ? character.Hat.Data.special1 : 0)); reply.AddShort((short)(character.Shield != null ? character.Shield.Data.special1 : 0)); reply.AddShort((short)(character.Weapon != null ? character.Weapon.Data.special1 : 0)); reply.AddBreak(); } client.Send(reply); }
private bool Initialize(byte[] versionNumber, string hdSerialNum, out InitData data) { Initialized = false; data = new InitData(); if (!m_client.ConnectedAndInitialized || versionNumber.Length != 3 || hdSerialNum.Length == 0) { return false; } Packet builder = new Packet(PacketFamily.Init, PacketAction.Init); builder.AddThree(Hashes.stupid_hash(new Random().Next(6, 12))); builder.AddChar(versionNumber[0]); builder.AddChar(versionNumber[1]); builder.AddChar(versionNumber[2]); //client version builder.AddChar(112); //unknown builder.AddChar((byte)hdSerialNum.Length); builder.AddString(hdSerialNum); if (!m_client.SendRaw(builder)) return false; if (!m_init_responseEvent.WaitOne(Constants.ResponseTimeout)) return false; data = m_init_initData; return true; }
public bool RespondToQuestDialog(QuestState state, DialogReply reply, byte action = 0) { if (!Initialized || !m_client.ConnectedAndInitialized) return false; Packet pkt = new Packet(PacketFamily.Quest, PacketAction.Accept); pkt.AddShort(state.SessionID); //session ID - ignored by default EOSERV pkt.AddShort(state.DialogID); //dialog ID - ignored by default EOSERV pkt.AddShort(state.QuestID); pkt.AddShort(state.NPCIndex); //npc index - ignored by default EOSERV pkt.AddChar((byte) reply); if (reply == DialogReply.Link) pkt.AddChar(action); return m_client.SendPacket(pkt); }
//255 means use character's current location public bool DropItem(short id, int amount, byte x = 255, byte y = 255) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Item, PacketAction.Drop); pkt.AddShort(id); pkt.AddInt(amount); if (x == 255 && y == 255) { pkt.AddByte(x); pkt.AddByte(y); } else { pkt.AddChar(x); pkt.AddChar(y); } return m_client.SendPacket(pkt); }
private void _settingChange(object sender, EventArgs e) { if (sender == m_buttons[0]) { if (!m_soundChanged && !w.SoundEnabled) { EODialog.Show(DATCONST1.SETTINGS_SOUND_DISABLED, XNADialogButtons.OkCancel, EODialogStyle.SmallDialogSmallHeader, (o, args) => { if (args.Result == XNADialogResult.OK) { m_soundChanged = true; w.SoundEnabled = !w.SoundEnabled; World.Instance.ActiveMapRenderer.PlayOrStopAmbientNoise(); m_leftSide[0].Text = World.GetString(w.SoundEnabled ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } }); } else { if (!m_soundChanged) { m_soundChanged = true; } w.SoundEnabled = !w.SoundEnabled; World.Instance.ActiveMapRenderer.PlayOrStopAmbientNoise(); m_leftSide[0].Text = World.GetString(w.SoundEnabled ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } } else if (sender == m_buttons[1]) { if (!m_musicChanged && !w.MusicEnabled) { EODialog.Show(DATCONST1.SETTINGS_MUSIC_DISABLED, XNADialogButtons.OkCancel, EODialogStyle.SmallDialogSmallHeader, (o, args) => { if (args.Result == XNADialogResult.OK) { m_musicChanged = true; w.MusicEnabled = !w.MusicEnabled; World.Instance.ActiveMapRenderer.PlayOrStopBackgroundMusic(); m_leftSide[1].Text = World.GetString(w.MusicEnabled ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } }); } else { if (!m_musicChanged) { m_musicChanged = true; } w.MusicEnabled = !w.MusicEnabled; World.Instance.ActiveMapRenderer.PlayOrStopBackgroundMusic(); m_leftSide[1].Text = World.GetString(w.MusicEnabled ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } } else if (sender == m_buttons[2]) { m_keyboard++; if (m_keyboard > KeyLayout.Azerty) { m_keyboard = 0; } m_leftSide[2].Text = World.GetString(DATCONST2.SETTING_KEYBOARD_ENGLISH + (int)m_keyboard); } else if (sender == m_buttons[3]) { if (w.Language != EOLanguage.Portuguese) { w.Language++; } else { w.Language = 0; } _setTextForLanguage(); //need to reset all strings when language changes } else if (sender == m_buttons[4]) { w.HearWhispers = !w.HearWhispers; m_leftSide[4].Text = World.GetString(w.HearWhispers ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); Packet pkt = new Packet(PacketFamily.Global, w.HearWhispers ? PacketAction.Remove : PacketAction.Player); pkt.AddChar(w.HearWhispers ? (byte)'n' : (byte)'y'); w.Client.SendPacket(pkt); } else if (sender == m_buttons[5]) { w.ShowChatBubbles = !w.ShowChatBubbles; m_rightSide[0].Text = World.GetString(w.ShowChatBubbles ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } else if (sender == m_buttons[6]) { w.ShowShadows = !w.ShowShadows; m_rightSide[1].Text = World.GetString(w.ShowShadows ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } else if (sender == m_buttons[7]) { DATCONST2 str; if (w.StrictFilterEnabled) { w.StrictFilterEnabled = false; str = DATCONST2.SETTING_DISABLED; } else if (w.CurseFilterEnabled) { w.CurseFilterEnabled = false; w.StrictFilterEnabled = true; str = DATCONST2.SETTING_EXCLUSIVE; } else { w.CurseFilterEnabled = true; str = DATCONST2.SETTING_NORMAL; } m_rightSide[2].Text = World.GetString(str); } else if (sender == m_buttons[8]) { w.LogChatToFile = !w.LogChatToFile; m_rightSide[3].Text = World.GetString(w.LogChatToFile ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } else if (sender == m_buttons[9]) { w.Interaction = !w.Interaction; m_rightSide[4].Text = World.GetString(w.Interaction ? DATCONST2.SETTING_ENABLED : DATCONST2.SETTING_DISABLED); } }
public static void HandleRemove(Packet packet, IClient client, bool fromQueue) { /*short deleteId = */packet.GetShort(); int id = packet.GetShort(); if (id < 0 || id > client.Account.Characters.Count) throw new ArgumentOutOfRangeException("Login character ID out of range"); Character deleteMe = client.Account.Characters[id]; client.Account.Characters.Remove(deleteMe); deleteMe.Delete(); client.Account.Store(); client.Server.Database.Commit(); Packet reply = new Packet(PacketFamily.Character, PacketAction.Reply); reply.AddShort((short)CharacterReply.Deleted); reply.AddChar((byte)client.Account.Characters.Count); reply.AddByte(1); // TODO: What is this? reply.AddBreak(); // TODO: Some kind of character list packet builder int i = 0; foreach (Character character in client.Account.Characters) { reply.AddBreakString(character.Name); reply.AddInt(i++); reply.AddChar(character.Level); reply.AddChar((byte)character.Gender); reply.AddChar(character.HairStyle); reply.AddChar(character.HairColor); reply.AddChar((byte)character.Skin); reply.AddChar((byte)character.Admin); reply.AddShort((short)(character.Boots != null ? character.Boots.Data.special1 : 0)); reply.AddShort((short)(character.Armor != null ? character.Armor.Data.special1 : 0)); reply.AddShort((short)(character.Hat != null ? character.Hat.Data.special1 : 0)); reply.AddShort((short)(character.Shield != null ? character.Shield.Data.special1 : 0)); reply.AddShort((short)(character.Weapon != null ? character.Weapon.Data.special1 : 0)); reply.AddBreak(); } client.Send(reply); }
public bool DoCastSelfSpell(short spellID) { if (spellID < 0) return false; if (!Initialized || !m_client.ConnectedAndInitialized) return false; Packet pkt = new Packet(PacketFamily.Spell, PacketAction.TargetSelf); pkt.AddChar(1); //target type pkt.AddShort(spellID); pkt.AddInt(DateTime.Now.ToEOTimeStamp()); return m_client.SendPacket(pkt); }
public bool DoCastTargetSpell(short spellID, bool targetIsNPC, short targetID) { if (spellID < 0 || targetID < 0) return false; if (!Initialized || !m_client.ConnectedAndInitialized) return false; Packet pkt = new Packet(PacketFamily.Spell, PacketAction.TargetOther); pkt.AddChar((byte)(targetIsNPC ? 2 : 1)); pkt.AddChar(1); //unknown value pkt.AddShort(1); //unknown value pkt.AddShort(spellID); pkt.AddShort(targetID); pkt.AddThree(DateTime.Now.ToEOTimeStamp()); return m_client.SendPacket(pkt); }
public bool RequestQuestHistory(QuestPage page) { if (!Initialized || !m_client.ConnectedAndInitialized) return false; Packet pkt = new Packet(PacketFamily.Quest, PacketAction.List); pkt.AddChar((byte) page); return m_client.SendPacket(pkt); }
/// <summary> /// Cancel a pending trade /// </summary> public bool TradeClose() { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Trade, PacketAction.Close); pkt.AddChar(123); //? return m_client.SendPacket(pkt); }
public bool UnequipItem(short id, byte subLoc = 0) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.PaperDoll, PacketAction.Remove); pkt.AddShort(id); pkt.AddChar(subLoc); return m_client.SendPacket(pkt); }
/// <summary> /// Send a party request to another player /// </summary> /// <param name="type">Either Join or Invite</param> /// <param name="otherCharID">ID of the other character</param> /// <returns>True on successful send operation, false otherwise</returns> public bool PartyRequest(PartyRequestType type, short otherCharID) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.Party, PacketAction.Request); pkt.AddChar((byte)type); pkt.AddShort(otherCharID); return m_client.SendPacket(pkt); }