logo
Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Gray  
#1 Posted : Friday, June 7, 2013 6:33:11 PM(UTC)
Gray

Rank: Advanced Member

Groups: Gray, Registered
Joined: 2/13/2011(UTC)
Posts: 637

Thanks: 42 times
Was thanked: 35 time(s) in 23 post(s)
You know, salvage.cs has a proc (LootWrecks(), by default) which loops over opened wrecks around and attempts to loot them. With Odyssey out, there seems to be a problem with this proc - it depends on the method used to separate opened and unopened wrecks.

1) A method I've been using before Odyssey:
Quote:

var containers = Cache.Instance.UnlootedContainers.Where(c => Cache.Instance.DirectEve.GetContainer(c.Id) != null && Cache.Instance.DirectEve.GetContainer(c.Id).Capacity > 0 && c.Distance < 2000);
foreach (var containerEntity in containers)
{
var container = Cache.Instance.DirectEve.GetContainer(containerEntity.Id);
...
}

There is a problem with it now: it generates a red exception every time you try to use DirectEve.GetContainer on a container which wasn't open yet. Wich a lot of wrecks around it might generate dozens of exceptions per tick, which could ultimately bring GM attention - with obvious consequences for the whole farm. It works, though.

2) A method I was adviced to use:
Code:

            DirectContainerWindow lootWindows = Cache.Instance.DirectEve.Windows.OfType<DirectContainerWindow>().FirstOrDefault(w => w.Type == "form.InventoryPrimary" && w.IsPrimary());
            List<long> ContainersID = new List<long>();
            if (lootWindows != null)
                ContainersID = lootWindows.GetIdsFromTree();
            foreach (long ContainerID in ContainersID)
            {
                var containerEntity = Cache.Instance.EntityById(ContainerID);

                if (containerEntity == null || containerEntity.Distance > 2000 || Cache.Instance.LootedContainers.Contains(containerEntity.Id))
                    continue;

                var container = Cache.Instance.DirectEve.GetContainer(ContainerID);
                ...
            }

This method doesn't generate any exceptions, but it has a drawback: every now and then, at average once per 2-4 hours, it hangs the whole EVE window up. It starts to occupy a CPU core totally, it doesn't redraw EVE window, it doesn't exit this dead loop ever - you can't even close the window manually, you have to kill it using Task Manager. It's impossible to reproduce it on will (at least, I didn't find any logic in its appearance).

3) A crappy method of creating a list of opened containers:
Quote:

var containers = Cache.Instance.UnlootedContainers.Where(c => OpenedContainers.ContainsKey(c.Id) && c.Distance < 2000);
foreach (var containerEntity in containers)
{
var container = Cache.Instance.DirectEve.GetContainer(containerEntity.Id);
...
}

Basically, it "remembers" each container we've tried to open before, and attempts to loot it. Though, we know that certain missions (WC, as a most know example) have got guarded containers. You try to open it, it's added to "opened", yet it is not actually open and is not added to inventory tree (because it's guarded). This basically falls into the problem #1 with generating red exceptions - just for several missions, though. Not sure if it hangs up the window - I don't really feel like testing it.

4) An ancient method of opening a separate loot window for every container, and assume that "window have not popped up = container is guarded". This method is [still] used in ISeeDedPpl fork (?). Not sure if it actually works...

What would you advice to use? The questions goes for coders only, of course.

P.S. Sorry for using quotes instead of code blocks - for some reason either this forum or my browser doesn't let to use more than one code tag in the same message.

Edited by user Friday, June 7, 2013 6:34:09 PM(UTC)  | Reason: Not specified

Sponsor

Wanna join the discussion?! Login to your forum account. New Registrations are disabled.

Gray  
#2 Posted : Tuesday, June 11, 2013 2:46:30 AM(UTC)
Gray

Rank: Advanced Member

Groups: Gray, Registered
Joined: 2/13/2011(UTC)
Posts: 637

Thanks: 42 times
Was thanked: 35 time(s) in 23 post(s)
Well, more tests have shown more problems... The problem is indeed in DirectEve.GetContainer. According to debug output, DE just hangs up EVE instance when you try to loot a container by getting its items via this method. The more time have passed since container was opened, the less is chance of hangup. The method you use to cycle through containers doesn't matter - be it list of opened containers, or inventory tree, or whatever... I've added an aritificial delay between opening a given container and looting it, increasing it gradually up to 3 seconds. Chance of freezing has reduced significally - now one of 6 windows freezes once per 6 hours, at average. I think tomorrow I increase it up to 5 seconds, even though it would hurt performance of looting. I'd say something has to be done at the side of DE, as delays are not real solution. There HAS to be a check is container is ready to be looted! I think it freezes at the moment when you open a container, it's added to inventory but its contents are not loaded yet (rotating strokes in the center of window - I think everyone knows what am I speaking about). So there should be a way to check if it's still rotating... or something - this is just an assumption, as this bug is very hard to reproduce.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.