Exemplo n.º 1
0
        public static bool BankWithdraw(int amount)
        {
            EOClient client = (EOClient)World.Instance.Client;

            if (!client.ConnectedAndInitialized || amount < 0)
            {
                return(false);
            }

            Packet pkt = new Packet(PacketFamily.Bank, PacketAction.Take);

            pkt.AddInt(amount);

            return(client.SendPacket(pkt));
        }
Exemplo n.º 2
0
        public static bool BankOpen(short npcIndex)
        {
            EOClient client = (EOClient)World.Instance.Client;

            if (!client.ConnectedAndInitialized || npcIndex < 0)
            {
                return(false);
            }

            Packet pkt = new Packet(PacketFamily.Bank, PacketAction.Open);

            pkt.AddShort(npcIndex);

            return(client.SendPacket(pkt));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sends SHOP_OPEN to server, opening a "Shop" dialog
        /// </summary>
        /// <returns>false on connection problems, true otherwise</returns>
        public static bool RequestShop(short NpcID)
        {
            EOClient client = (EOClient)World.Instance.Client;

            if (!client.ConnectedAndInitialized)
            {
                return(false);
            }

            Packet pkt = new Packet(PacketFamily.Shop, PacketAction.Open);

            pkt.AddShort(NpcID);

            return(client.SendPacket(pkt));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Craft an item with a shopkeeper
        /// </summary>
        public static bool CraftItem(short ItemID)
        {
            EOClient client = (EOClient)World.Instance.Client;

            if (!client.ConnectedAndInitialized)
            {
                return(false);
            }

            Packet pkt = new Packet(PacketFamily.Shop, PacketAction.Create);

            pkt.AddShort(ItemID);

            return(client.SendPacket(pkt));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        /// <summary>
        /// sends all different types of Talk packets to server based on which chat type we're doing
        /// </summary>
        /// <param name="chatType">Which type of chat message is being sent</param>
        /// <param name="message">The message being sent</param>
        /// <param name="character">The character (required for TalkType.PM)</param>
        /// <returns></returns>
        public static bool Speak(TalkType chatType, string message, string character = null)
        {
            EOClient client = (EOClient)World.Instance.Client;

            if (!client.ConnectedAndInitialized)
            {
                return(false);
            }

            Packet builder;

            switch (chatType)
            {
            case TalkType.Local:
                builder = new Packet(PacketFamily.Talk, PacketAction.Report);
                break;

            case TalkType.PM:
                builder = new Packet(PacketFamily.Talk, PacketAction.Tell);
                if (string.IsNullOrWhiteSpace(character))
                {
                    return(false);
                }
                builder.AddBreakString(character);
                break;

            case TalkType.Global:
                builder = new Packet(PacketFamily.Talk, PacketAction.Message);
                break;

            case TalkType.Guild:
                builder = new Packet(PacketFamily.Talk, PacketAction.Request);
                break;

            case TalkType.Party:
                builder = new Packet(PacketFamily.Talk, PacketAction.Open);
                break;

            default: throw new NotImplementedException();
            }

            builder.AddString(message);

            return(client.SendPacket(builder));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        /// <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));
        }
Exemplo n.º 9
0
        /// <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));
        }