Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tibialyzer counts loot multiple times if other chat windows shows server messages #3

Open
gurka opened this issue Feb 9, 2016 · 17 comments

Comments

@gurka
Copy link

gurka commented Feb 9, 2016

As title. Easy to reproduce, just open a new chat window (either a private channel or a whisper channel) and set it to show server messages. Tibialyzer will now count loot multiple times, once for each chat window that shows server messages. I'm pretty sure that it also counts exp and damage multiple times.

@gurka
Copy link
Author

gurka commented Feb 10, 2016

This might be difficult to fix. I assume (I haven't looked at the code yet) that you just scan the entire Tibia.exe memory and look for server messages. If that is the case then there are no way to distinguish two messages that were "posted" in two different chat windows (but originates from the same "event"), and two messages that were "posted" in the same chat window (but originates from two different "events").

So, a solution that just discards duplicate server messages each scan iteration wouldn't work. If it scans the memory and finds two "You gain 420 experience" it can't know if you only gained 420 experience once but it was posted to two different chat windows, or if you actually killed two monsters and gained 420 * 2 experience and it was posted to only one chat window.

@Mytherin
Copy link
Owner

Yes, actually fixing this issue will be impossible without changing the way Tibialyzer obtains its data. I don't think it's a very crucial bug either since you can simply not enable this option. I will add a warning notifying users not to do this, but that's about all I can do.

@gurka
Copy link
Author

gurka commented Feb 10, 2016

Yeah it's maybe not a bug per se, but a user can get confused when their loot picture show double amount of loot and double notification each time a rare drops. At least I got confused :-)

I guess this can be a more serious problem for people that play like this:

Press the "M" in the channel settings when you are hunting so you can see server log messages (loot) in private chat.

Another solution can be an option in Tibialyzer that can be used to set the number of "server log messages"-chat windows that will be open during a hunt. If Tibialyzer collects data during a hunt with 1kk XP, 2x MPA and 2x Demon Helmet (or whatever), it halves everything when displaying the hunt statistics / picture if the user has selected that he/she will have 2 chat windows with server log messages opened during the hunt.

@sossoh555
Copy link

I solved it doing the following:

look for the function public IEnumerable IterateLogMessages()

it is in the folder Managers -> HuntManager -> Hunt -> IterateLogMessages()

after the code "strings.reverse" add the following code:
strings = strings.Distinct().ToList() [I believe strings.Distinct().ToList() may work as well, idk]

it stopped to show multiple times the pop up and the log message just counts one single time.

@EricArndt
Copy link
Contributor

This will be an issue if there are legitimate duplicate server messages. This problem is discussed in previous posts.

@sossoh555
Copy link

I thought about it. However, what's the chance of having the same loot at the same time?
Like, it is necessary to match, the loot, the monster AND the time, isnt it? I believe there is small chance. Actually, It would only solve for the loot and not experience (How I don't use the experience messages I did not think about it).

Let me ask you one thing: do u experience a huge lag because of that? is this related to how it collects data?

@EricArndt
Copy link
Contributor

With your approach, all server messages with identical text will be treated as a single occurrence. How often this would be an issue depends on the the likelihood that a creature's loot will be the same and the rate at which they are killed. For now, I would just suggest disabling server log messages in other channels and relying on Tibialyzer to notify you when something interesting happens.

I'm not sure I understand your question. What huge lag are you referring to?

@Mytherin
Copy link
Owner

I will add an option for eliminating duplicate loot messages soon.

I have thought about the issue of duplicate experience messages, and I think it can be resolved by not using them to compute the experience gain. Instead, we can periodically sample the players' current experience (by reading it from memory, as discussed in #16) and then taking the difference between the current and previous experience.

The remaining duplicate messages are duplicate damage messages, duplicate command messages and duplicate look messages.

Duplicate damage messages are not very significant because the damage is displayed as a percentage, so as long as every message is duplicated an equal amount of times the percentages will not change. All that will differ is the absolute DPS and Total Damage of each player, which is not very important.

As for the command and look messages, these (mostly) simply open a window. The window will open multiple times if the same message is read multiple times, but this (in my experience) happens so quickly after one another that it is not very significant.

There will still be issues after you eliminate duplicate loot messages (especially when hunting low level creatures that do not drop a lot of items), which is why I will make it an option that users can toggle on/off. It's by no means a perfect solution, but it will solve several issues.

@sossoh555
Copy link

@EricArndt, because the program gives me a huge lag while running and I thought it was the reading process.

@Mytherin, at least for me, it is not exactly "duplicated" it's more like "multiplied", because it can accounts 5 ou more times the same loot.

By the way, you are awesome @Mytherin. hahahaha

@EricArndt
Copy link
Contributor

Which client do you use?
On Mar 14, 2016 1:10 PM, "Bruno Prado" [email protected] wrote:

@EricArndt https://github.com/EricArndt, because the program gives me a
huge lag while running and I thought it was the reading process.

@Mytherin https://github.com/Mytherin, at least for me, it is not
exactly "duplicated" it's more like "multiplied", because it can accounts 5
ou more times the same loot.

By the way, you are awesome @Mytherin https://github.com/Mytherin.
hahahaha


Reply to this email directly or view it on GitHub
#3 (comment).

@sossoh555
Copy link

@EricArndt, Flash Client.

@adgonz90
Copy link

@Mytherin Take a look at the test code I committed in 3c6e5f1. It shows how to read tabs and their messages for the C client. You can test is by running the app and selecting the tibia proccess, it will print all the tabs and messages you have. Ill leave it up to you, if you want to use this, to do the modifications to the code.

@EricArndt
Copy link
Contributor

@tony902304 I'm very interested in trying out those changes. This looks like it has the potential to solve a lot of issues for the C client. Could you explain how you went about finding the correct offsets?

One concern I do have is how this will behave across client updates. I assume the offsets will need to be updated?

@adgonz90
Copy link

@EricArndt CheatEngine + Long Nights. Lol... Took me two days of analysis of memory and code to figure out all the necessary pointers and offsets.

You are correct, an update may cause these offsets to change (probably only a few, if any).

@gurka
Copy link
Author

gurka commented Mar 18, 2016

The offsets (e.g. 0x30 or whatever) are not going to change unless they rewrite how chat messages, chat channels, etc work. But they addresses (e.g. 0x5432FF, etc) are going to change in each update (in 99 cases of 100).

@Mytherin
Copy link
Owner

@tony902304 Crazy stuff man, thanks a lot for the effort! I've done some quick testing and it looks like it works extremely well. I will have to do some work to adapt it to fit the current processing model, but this should definitely fix a lot of issues. I will look into it some more tomorrow.

Mytherin added a commit that referenced this issue Mar 21, 2016
instead of scanning the memory and trying to find this structure.

This eliminates reading duplicate messages (as in Issues #3, #21) and
fixes the copy bug. In addition, it speeds up the scanning and reduces CPU
usage of Tibialyzer.

BIG thanks to tony902304 for putting in the work of reverse engineering
this structure and providing us with all the memory offsets!
@vonlol
Copy link

vonlol commented Apr 9, 2016

@sossoh555 I have the exakt same issue, have you found a solution for the Flash client?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants