Jump to content
Eternal Lands Official Forums
bluap

Bug fixes for counters

Recommended Posts

I've just submitted a bug fix patch for a couple of old counters bugs:

 

1) First bug (mentioned in this thread) is where double exp for mixing in a school is counted against the last thing you mixed outside. The solution is to just not increment the item counter. The XP is still counted. This is OK IMHO as you have not actually made an item, just gained XP :P

 

2) The second bug (described in this thread) is when your first spell (this session) of a particular type is not counted. This bug happens because the client does not have the spell name, it requests the name but receives it later. I have put some extra checking code around my first stab at the fix to protect from getting rogue counts due to spell names being looked up elsewhere.

 

Both fixes are very small and simple but I understand if you don't want to commit them this close to a client release. They are only bug fixes however...

Share this post


Link to post
Share on other sites

well, I'll have a quick play before I commit, but I can't see how these could go wrong beyond that (ie: they're simple enough to be obviously correct, small enough to be a few lines, and fix a real bug. which some people may notice are (paraphrases) of rules for patches in the linux kernel during rc time :P )

 

if I don't see a bug during play-time, it'll go in

 

ed: well, first 4 casts weren't counted at all, but those were restore on full health, so I guess that's probably a different bug (mutter mutter). shield spell was counted from the start... still investigating

ed2: okay, done... didn't see any problems other than restore never being added with full health (which is a separate issue, I tested with an old client... normal heal, on the other hand, did work as expected, despite full health), so it'll be in CVS shortly, thanks :)

Edited by ttlanhil

Share this post


Link to post
Share on other sites

I've just submitted a bug fix patch for a couple of old counters bugs:

 

1) First bug (mentioned in this thread) is where double exp for mixing in a school is counted against the last thing you mixed outside. The solution is to just not increment the item counter. The XP is still counted. This is OK IMHO as you have not actually made an item, just gained XP :blush:

 

2) The second bug (described in this thread) is when your first spell (this session) of a particular type is not counted. This bug happens because the client does not have the spell name, it requests the name but receives it later. I have put some extra checking code around my first stab at the fix to protect from getting rogue counts due to spell names being looked up elsewhere.

 

Both fixes are very small and simple but I understand if you don't want to commit them this close to a client release. They are only bug fixes however...

 

I do not like this fix. Sure it prevents the mess up of adding wrong item to wrong place...

 

BUT I'm totally against not adding the item to the counter at all! I want all that I make to be added, no matter if it happens to dissappear right after creation + I get double exp in return.

 

Some items I always make in schools, like Leather Helmets and Polished Sapphires... I need to keep track of those amounts to keep track of my goals and alike, also I like these kind of statistics... So Please go through this again and make it so that it also adds the one that is called "Double Exp" but to the right place.

 

The counters are suppose to be "for fun" stuff for the users to look at and those who likes numbers, not from a "real view" as in "No item really created so no counter adding."... that's wrong.

 

But to make my "wish" come true. I guess server has to send a string containing the item you made... Since currently you only extract the item from "You successfully made "... But if this fix goes through I rather change it back to the old way.

What would be good to make is a program that you can use to clean up your Counter instead, that read the HEX values and made them all into readable/editable code. (I have looked at the counter with a Hex editor and it's possible to change values but hard to deterimine if some change will corrupt something else.)

Edited by Beaverhunter

Share this post


Link to post
Share on other sites

if you think it's possible, go right ahead. if you come up with a working patch that's simple enough to be free of bugs, it can be put in

 

I'm also not too keen on the attitude you display, that seems to be "your way is wrong, because I want it to be this way, so change it". please remember that people who work on EL are all volunteers... bluap isn't even on the list of official client developers, though he is a frequent contributer, saying what he's done is wrong when what you want isn't possible (AFAIK) is quite rude

 

and, more relevantly, for bluap; I'm still not seeing restoration in counters, even when not at full health... do you have time to look into that?

Edited by ttlanhil

Share this post


Link to post
Share on other sites

if you think it's possible, go right ahead. if you come up with a working patch that's simple enough to be free of bugs, it can be put in

The problem as you both probably know is that the "double exp." message the server sends does not contain the name of the thing that you "made". Again, IMHO, that's OK with me because you do not end up with the item. Opinions may vary on whether we should, but its not possible to count the actual item unless the server message is changed. That leaves it clearly in Entropy's hands, lobby him as you wish Beaverhunter :)

 

and, more relevantly, for bluap; I'm still not seeing restoration in counters, even when not at full health... do you have time to look into that?

Thanks for your support ttlanhil :blush:

 

This is weird, I get the restoration spell counted just fine, so long as I have some hp to restore. When you have full hp and cast the spell, the server does not send the SPELL_CAST message. Therefore, there is no way to count it unless the server is changed to send the SPELL_CAST message.

 

May be you could add a few lines of debug to help resolve this? This should do the trick:

Index: counters.c
===================================================================
RCS file: /cvsroot/elc/elc/counters.c,v
retrieving revision 1.17
diff -a -u -r1.17 counters.c
--- counters.c	8 May 2007 18:35:31 -0000	1.17
+++ counters.c	9 May 2007 11:55:25 -0000
@@ -640,12 +640,16 @@
		{
			increment_counter(SPELLS, spell_names[spell_id+1], 1, spell_id);
			requested_spell_id = -1;
+			printf("delayed increment_counter() called id %d name[%s]\n",
+				spell_id, (spell_names[spell_id+1])?spell_names[spell_id+1]:"Unknown");
		}
	}
}

void increment_spell_counter(int spell_id)
{
+	printf("increment_spell_counter() called id %d name[%s]\n",
+		spell_id, (spell_names[spell_id+1])?spell_names[spell_id+1]:"Unknown");
	if (!spell_names[spell_id+1]) {
		Uint8 str[2];

Index: multiplayer.c
===================================================================
RCS file: /cvsroot/elc/elc/multiplayer.c,v
retrieving revision 1.225
diff -a -u -r1.225 multiplayer.c
--- multiplayer.c	8 May 2007 18:35:31 -0000	1.225
+++ multiplayer.c	9 May 2007 11:55:27 -0000
@@ -1528,6 +1528,10 @@
			break;
 		case SPELL_CAST:
 			{
+				char *spell_cast_type[] = {"S_SUCCES","S_FAILED","S_INVALID",
+					"S_SELECT_TARGET","S_SELECT_TELE_LOCATION","S_NAME"};
+				printf("Spell cast type %d [%s]\n", in_data[3],
+					 (in_data[3]<=S_NAME)?spell_cast_type[in_data[3]-1]:"unknown" );
				if (data_length <= 3)
				{
				  log_error("CAUTION: Possibly forged SPELL_CAST packet received.\n");

Share this post


Link to post
Share on other sites

whoops, sorry, just got myself poisoned to test, and it was a bit different to what I said...

casting from quickbar, several times in a row, while injured, does not increase in counters. casting from spell window does. after that, so does the quickbar

 

do you still want me to play with the above debugging code, or does this point in another direction? :blush:

Share this post


Link to post
Share on other sites

The problem as you both probably know is that the "double exp." message the server sends does not contain the name of the thing that you "made". Again, IMHO, that's OK with me because you do not end up with the item. Opinions may vary on whether we should, but its not possible to count the actual item unless the server message is changed. That leaves it clearly in Entropy's hands, lobby him as you wish Beaverhunter :blush:

 

It is not impossible to do it now, but it would take a lot of work: when we receive 'double exp' message we can

increase counter for item that we sent in last MANUFACTURE_THIS request. Though it requires to have file with all recipes and

code for parsing it and searching for current recipe.

 

So, Beaverhunter, if you really want it feel free to try it :)

Share this post


Link to post
Share on other sites

do you still want me to play with the above debugging code, or does this point in another direction? :blush:

If you don't mind, that would be useful. I've tried various combinations of spell window and quick bar but have had no luck reproducing your problem. Will study the code some more...

Share this post


Link to post
Share on other sites
It is not impossible to do it now, but it would take a lot of work: when we receive 'double exp' message we can increase counter for item that we sent in last MANUFACTURE_THIS request. Though it requires to have file with all recipes and code for parsing it and searching for current recipe.
guess what. it's worse than that. because the client only knows image IDs, and those aren't unique (some items have the same image as others)

so the client would also have to check the name of everything, which wouldn't go over well

plus updating the file and all, manually.

and remembering that the chances of this being in the official client are pretty low

 

as for the debugging, I'll have a look

Share this post


Link to post
Share on other sites

Well I'm sorry if my attitude/opinion in the post got abit "rude"... but I'm _very_ keen of my counter, I even back it up! then and then so that I cannot lose it as easy or it can go corrupted in some way... Also I take screenshots of it then and then to keep a history of my char. It's actually quite fun to go back and see how the char developed, also taking screenshots of rostogols,binding,extra manas and so on... Sometimes including the counter to see how much of what I harvested to get a stone or alike.

 

But basicly we have come down to that we need a server message that isn't for display but that countains the product name... that shouldn't be hard to make for Ent? Or are there any problems or exploits that could be done? I see none, at least since we allready have most products parsed out of the "You successfully made ....". So if this is used in some kind of macro or what ever then well, it could allready be done.

 

I'm not going for the solutions you have mentioned since they are as ttlanhil pretty much said impossible, especially for the one pretty much least experienced with EL code.

 

So how to proceed in this? Should I/we contact radu or what? There are more players than me who like counters and keep statistics of their progress.

 

But btw:

Why not just parse the recipes from the manufacturing.html or what ever its called on the site? It could be auto parsed every week or more often, then put into a file in EL folder. But the problem is with the IDs. But this solution is inferior to having a server message actually telling what we made.

And if bandwidth is an issue then couldn't the server message be stored and compared to the manufactur_this and if they are equal there's no need to send the string again. If it changes it sends a new updated string.

Edited by Beaverhunter

Share this post


Link to post
Share on other sites

bluap:

well... I added that, tested, and it worked... removed it, to clean CVS, and it still worked... false alarm, sorry :blush:

 

although... is it needed to ask the server for the name if we have it (as a tooltip) in the side-bar? not that it matters much, of course

 

 

beaverhunter:

have you tried parsing a page like that before? I've done it for vakana (hence why she knows recipes in her encyc) but that's not exactly a one-liner, even in perl, which is bred for that sort of job.

doing it in C? no thanks

 

anyway, the counters currently measure how many you've made, so it's not that inaccurate as-is

Edited by ttlanhil

Share this post


Link to post
Share on other sites

have you tried parsing a page like that before? I've done it for vakana (hence why she knows recipes in her encyc) but that's not exactly a one-liner, even in perl, which is bred for that sort of job.

doing it in C? no thanks

 

Parsing itself is not so hard, much more work is to match item's names from manufacture.htm to their id's and as you

said non-uniqness of id's is a nightmare :/

Share this post


Link to post
Share on other sites

bluap:

well... I added that, tested, and it worked... removed it, to clean CVS, and it still worked... false alarm, sorry :P

Great, it has certainly been playing on my mind what could be wrong :hiya:

 

although... is it needed to ask the server for the name if we have it (as a tooltip) in the side-bar? not that it matters much, of course

Well the spells quick bar stores the name in the spells_*.dat file. I guess we could pass that file... no scratch that last :)

Share this post


Link to post
Share on other sites

As you're playing with this, is there any quick/clean way to flush the counters to disk when your char is saved? I've lost entire days because the counters are only saved on client exit and not on segfaults or abort traps :bow_arrow:

Share this post


Link to post
Share on other sites

As you're playing with this, is there any quick/clean way to flush the counters to disk when your char is saved? I've lost entire days because the counters are only saved on client exit and not on segfaults or abort traps :hug:

I support this idea :bow_arrow: its annoying to lose kill counters :)

Share this post


Link to post
Share on other sites

they already are saved to disk when you use #save (along with your settings)... just not when the server saves based on trading

Share this post


Link to post
Share on other sites

yes. it was added to CVS "Mon May 15 06:19:48 2006 UTC (11 months, 3 weeks ago) by ttlanhil" according to berlios.

only when you type in #save, not when the server saves you, and if you actually lose counters it can't help (since that means something got corrupted), but it's there

Share this post


Link to post
Share on other sites

yes, i ran the #save command after i had done ~1200 mana drains, didn't want to lose them from counter :bow_arrow: nevertheless game crashed and i don't have them there..

Share this post


Link to post
Share on other sites

well, unless it was before that change happened (shortly after then if you use CVS, a while after if you use ent's releases, which are generally a few months apart), then there must be another problem... the routine to save the counters is called when you use #save, though other bugs are possible (especially back when counters were new)

Share this post


Link to post
Share on other sites

pretty sure i was only mana draining in past ~2 months, somewhere in april. might want to look into a possible bug then :laugh:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×