Example #1
0
        bool Proxy_ReceivedTileAddThingIncomingPacket(Tibia.Packets.IncomingPacket packet)
        {
            TileAddThingPacket p = (TileAddThingPacket)packet;

            if (Enabled && Looting && OpenBodies != OpenBodyRule.None)
            {
                if (p.Item != null && (OpenDistantBodies || p.Location.IsAdjacent()))
                {
                    if (p.Item.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer) && p.Item.GetFlag(Tibia.Addresses.DatItem.Flag.IsCorpse) && p.Location.Z == Core.Player.Z)
                    {
                        if (OpenBodies == OpenBodyRule.All)
                        {
                            LootBodies.Add(p.Location);
                        }
                        else
                        {
                            if (lastBody.IsValid())
                            {
                                LootBodies.Add(lastBody);
                                lastBody = Location.Invalid;
                            }

                            lastBody = p.Location;
                        }
                    }
                }
            }

            return(true);
        }
Example #2
0
        private bool Proxy_ReceivedSelfAppearIncomingPacket(IncomingPacket packet)
        {
            connected = true;

            if (ReceivedSelfAppearIncomingPacket != null)
                ReceivedSelfAppearIncomingPacket.BeginInvoke(packet, null, null);

            if (PlayerLogin != null)
                Util.Scheduler.AddTask(PlayerLogin, new object[] { this, new EventArgs() }, 1000);

            return true;
        }
Example #3
0
        bool _proxy_ReceivedTileAddThingIncomingPacket(Tibia.Packets.IncomingPacket packet)
        {
            if (_autoOpenBodys)
            {
                TileAddThingPacket p = (TileAddThingPacket)packet;

                if (p.Item != null && p.Location.DistanceTo(_client.GetPlayer().Location) <= 3)
                {
                    if (p.Item.GetFlag(Tibia.Addresses.DatItem.Flag.IsContainer) &&
                        p.Item.GetFlag(Tibia.Addresses.DatItem.Flag.IsCorpse))
                    {
                        p.Item.OpenAsContainer((byte)_client.Inventory.GetContainers().Count());
                    }
                }
            }

            return(true);
        }
Example #4
0
        bool Proxy_ReceivedTextMessageIncomingPacket(Tibia.Packets.IncomingPacket packet)
        {
            if (Enabled && Looting && lastBody.IsValid())
            {
                TextMessagePacket p = (TextMessagePacket)packet;

                if (OpenBodies == OpenBodyRule.Allowed)
                {
                    LootBodies.Add(lastBody);
                    lastBody = Location.Invalid;
                }
                else
                {
                    if (EatFromMonsters)
                    {
                        foreach (var item in ItemLists.Foods)
                        {
                            if (p.Message.ToLower().Contains(item.Value.Name.ToLower()))
                            {
                                LootBodies.Add(lastBody);
                                lastBody = Location.Invalid;
                                return(true);
                            }
                        }
                    }

                    foreach (LootItem item in LootItems)
                    {
                        if (p.Message.ToLower().Contains(item.Description.ToLower()))
                        {
                            LootBodies.Add(lastBody);
                            lastBody = Location.Invalid;
                            return(true);
                        }
                    }
                }

                lastBody = Location.Invalid;
            }

            return(true);
        }
Example #5
0
        bool Proxy_ReceivedContainerOpenIncomingPacket(IncomingPacket packet)
        {
            if (_autoLoot && _lootItems.Count > 0)
            {
                ContainerOpenPacket p = (ContainerOpenPacket)packet;

                bool lootContainer = isLootContainer(p.Id);

                if (lootContainer && !Tibia.Constants.ItemLists.Container.ContainsKey(p.ItemId))
                    Scheduler.AddTask(new Action(autoLoot), null, 200);
                else if (!lootContainer)
                {
                    p.Name = "Container " + (p.Id + 1);

                    if (_autoLootWait == AutoLootWait_t.OPEN_NEW_LOOT_CONTAINER)
                    {
                        _autoLootWait = AutoLootWait_t.STOP;
                        Scheduler.AddTask(new Action(autoLoot), null, 100);
                    }
                }
            }

            return true;
        }
Example #6
0
        private bool Proxy_ReceivedContainerOpenIncomingPacket(IncomingPacket packet)
        {
            if (OpenSmall)
            {
                ContainerOpenPacket p = (ContainerOpenPacket)packet;
                List<Item> items = p.Items;
                p.Items = new List<Item>();
                p.Send();
                p.Items = items;
            }

            return true;
        }
Example #7
0
 bool ReceivedSelfAppearIncomingPacket(IncomingPacket packet)
 {
     player = client.GetPlayer();
     Tibia.Packets.Incoming.ChannelOpenPacket.Send(client, ChatChannel.Custom, "TT+");
     System.Threading.Thread.Sleep(100);
     OutWhite("Console started.");
     return true;
 }
Example #8
0
        private bool Proxy_ReceivedContainerOpenIncomingPacket(IncomingPacket packet)
        {
            if (Enabled && Looting && LootItems.Count > 0)
            {
                ContainerOpenPacket p = (ContainerOpenPacket)packet;
                Thread handler = new Thread(new ThreadStart(delegate()
                {
                    AutoResetEvent ev = new AutoResetEvent(false);
                    Thread thread = new Thread(new ThreadStart(delegate()
                    {
                        IsLooting = true;
                        Core.Player.Stop();
                        Thread.Sleep(100);
                        Loot(p.Id);
                    }));

                    thread.Priority = ThreadPriority.AboveNormal;
                    thread.Start();

                    if (!ev.WaitOne(2000))
                    {
                        thread.Abort();
                    }

                    IsLooting = false;
                }));
                handler.Start();
            }

            return true;
        }
Example #9
0
        bool Proxy_ReceivedTextMessageIncomingPacket(IncomingPacket packet)
        {

            if (_autoLootWait == AutoLootWait_t.EAT_FOOD)
            {
                TextMessagePacket p = (TextMessagePacket)packet;

                if (p.Message == "You are full.")
                {
                    _autoLootWait = AutoLootWait_t.STOP;
                    _autoLootAutoEvent.Set();
                }
            }

            return true;
        }
Example #10
0
        bool Proxy_ReceivedContainerRemoveItemIncomingPacket(IncomingPacket packet)
        {
            if (_autoLootWait == AutoLootWait_t.EAT_FOOD)
            {
                ContainerRemoveItemPacket p = (ContainerRemoveItemPacket)packet;

                if (p.Container == _container)
                {
                    _autoLootWait = AutoLootWait_t.STOP;
                    _autoLootAutoEvent.Set();
                }
            }

            return true;
        }
Example #11
0
        bool Proxy_ReceivedContainerAddItemIncomingPacket(IncomingPacket packet)
        {
            if (_autoLootWait == AutoLootWait_t.MOVE_ITEM)
            {
                ContainerAddItemPacket p = (ContainerAddItemPacket)packet;
                if (p.Container == _container)
                {
                    _autoLootWait = AutoLootWait_t.STOP;
                    _autoLootAutoEvent.Set();
                }
            }

            return true;
        }
Example #12
0
        bool Proxy_ReceivedTextMessageIncomingPacket(IncomingPacket packet)
        {
            Tibia.Packets.Incoming.TextMessagePacket p = (Tibia.Packets.Incoming.TextMessagePacket)packet;
            
            if (p.Color == TextMessageColor.GreenCenterGameWindow && p.Message.StartsWith("You see "))
                p.Message = p.Message + " [" + client.Memory.ReadInt32(Tibia.Addresses.Client.SeeId) + "]";

            return true;
        }
Example #13
0
        private bool ReceivedMapPacket(IncomingPacket packet)
        {
            bool trackMovable = uxTrackMovable.Checked;
            bool trackSplashes = uxTrackSplashes.Checked;
            bool trackCurrentFloor = uxTrackCurrentFloor.Checked;
            bool enableRetracking = uxEnableRetracking.Checked;


            lock (this)
            {
                MapPacket p = (MapPacket)packet;

                foreach (PacketCreature creature in p.Creatures)
                {
                    if (creature.Type == PacketCreatureType.Unknown)
                    {
                        if (trackCurrentFloor && creature.Location.Z 
                            != client.PlayerLocation.Z)
                            continue;

                        if (enableRetracking || !mapCreatures.ContainsKey(creature.Location))
                        {
                            mapCreatures[creature.Location] = creature;
                            trackedCreatureCount++;
                        }
                    }
                }

                foreach (Tile tile in p.Tiles)
                {
                    if (trackCurrentFloor && tile.Location.Z
                        != client.PlayerLocation.Z)
                        continue;

                    OtMapTile existingMapTile = null;
                    bool isExisting = mapTiles.TryGetValue(tile.Location, out existingMapTile);

                    if (!enableRetracking && isExisting)
                        continue;

                    SetNewMapBounds(tile.Location);
                    OtMapTile mapTile = new OtMapTile();
                    mapTile.Location = tile.Location;
                    mapTile.MapColor = Tibia.Misc.GetAutomapColor(tile.Ground.AutomapColor);

                    if (MapTracker.Properties.Settings.Default.ReverseItemOrder)
                        tile.Items.Reverse();

                    tile.Items.Insert(0, tile.Ground);

                    foreach (Item item in tile.Items)
                    {
                        if (item == null)
                            continue;

                        Color color = Tibia.Misc.GetAutomapColor(item.AutomapColor);
                        if (color != Color.Black)
                            mapTile.MapColor = color;

                        ItemInfo info = ItemInfo.GetItemInfo((ushort)item.Id);

                        if (info == null)
                        {
                            Log("ClientId not in items.otb: " + item.Id.ToString());
                            continue;
                        }

                        if (!trackMovable && !item.GetFlag(Tibia.Addresses.DatItem.Flag.IsImmovable))
                            continue;
                        if (!trackSplashes && item.GetFlag(Tibia.Addresses.DatItem.Flag.IsSplash))
                            continue;

                        if (info.Group == ItemGroup.Ground)
                        {
                            mapTile.TileId = info.Id;
                            continue;
                        }
                        
                        OtMapItem mapItem = new OtMapItem();
                        mapItem.AttrType = AttrType.None;

                        mapItem.ItemId = info.Id;

                        if (item.HasExtraByte)
                        {
                            byte extra = item.Count;
                            if (item.GetFlag(Tibia.Addresses.DatItem.Flag.IsRune))
                            {
                                mapItem.AttrType = AttrType.Charges;
                                mapItem.Extra = extra;
                            }
                            else if (item.GetFlag(Tibia.Addresses.DatItem.Flag.IsStackable) ||
                                item.GetFlag(Tibia.Addresses.DatItem.Flag.IsSplash))
                            {
                                mapItem.AttrType = AttrType.Count;
                                mapItem.Extra = extra;
                            }
                        }
                        mapTile.Items.Add(mapItem);
                    }

                    if (isExisting)
                    {
                        trackedItemCount -= existingMapTile.Items.Count;
                    }
                    else
                    {
                        trackedTileCount++;
                    }

                    trackedItemCount += mapTile.Items.Count;
                    mapTiles[tile.Location] = mapTile;

                    if (!mapCreatures.ContainsKey(tile.Location))
                    {
                        mapCreatures.Add(tile.Location, null);
                    }
                }
                UpdateStats();
            }
            return true;
        }