Print Page | Close Window

Proposed Change to Notifications XML feed

Printed From: Illyriad
Category: Strategies, Guides & Help
Forum Name: Technical Support
Forum Description: Post your technical support related questions here.
URL: http://forum.illyriad.co.uk/forum_posts.asp?TID=10868
Printed Date: 28 Mar 2024 at 16:33
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: Proposed Change to Notifications XML feed
Posted By: GM Stormcrow
Subject: Proposed Change to Notifications XML feed
Date Posted: 06 Apr 2021 at 19:32
Hi everyone,

Following discussions with a few of the excellent third-party toolmakers, I have a proposed change to the Notifications XML feed, and wanted to run it by the forum before deciding on which way to go.

There's a weirdness in the Notifications XML, in that if I send harvesters out to gather things, and they succeed in their job, the front-end UI says they did a good job, but the XML gives incorrect information.

THE WEIRDNESS

As an example, here's me sending some cotters out to harvest something.

Front-end UI (in reverse order):




... which is very much a successful mission for a cotter.

However, the Notifications XML for the actual harvesting report reads:


... which certainly says - in the <notificationdetail> field that they were successful in their gathering endeavours.  But in the <notificationtype> text, reads "Harvesting - Caravans Disappointed", when clearly they should not be.

THE PROPOSAL
I don't know who, if anyone, has code that relies on a <notificationtypeid> of 45 meaning "caravans disappointed", or if anyone compiles or has compiled a lookup table based on the match between the <notificationtypeid> and the text accompanying it...

What I can do is either:

a) continue to provide a <notificationtypeid> of 45 but with different text, depending on the outcome.  This could then use the text to say (eg) "Harvesting - Caravans Disappointed Entirely" (if they got nothing) or (eg) "Harvesting - Miners Gather Minerals" (if the miners got some),

or...

b) create new notificationtype ids for different outcomes.  

The advantage of a) is that it'll be quicker to implement, and may not involve much code/parser changes for those reading the notifications XML - but give some additional information at a higher level than parsing the notification detail.  The disadvantage of a) is that notificationtypeid = 45 becomes a catch-all for "something happened with harvesting".

The advantage of b) is that it continues to provide a clear one-to-one relationship between a notificationtypeid and the accompanying text.  The disadvantage is that it adds a bunch more new notificationtypeids that may require existing tools that read from the Notifications XML to alter their codebase, and will take a bit longer for us to implement at our end.

CONCLUSION
Those of you great folk who write code that reads the APIs have probably long known that this header wasn't right!  However, in fixing it, I don't want to make you do extra work.  So, if you're a Tensmoor-type (or Tensmoor himself!) and have a preference for the way I should 'make this right', please do let me know in this thread.

Otherwise, I'll probably do a) and vary the text flexibly, essentially changing notificationtypeid = 45 to a "Something happened with harvesting" broad brush, and providing the 'what happened' in the accompanying notificationdetail text.

Thanks for your time.

SC






Replies:
Posted By: Tensmoor
Date Posted: 06 Apr 2021 at 21:28
Personally, either option would be good from my point of view.

Without delving into the code for my notifications monitoring extension I don't think it checks any of the possibly affected areas and (at present) it doesn't offer any filtering either. I do need to do some work on the extension anyway (it doesn't display the part where it tells you if there are still items for that harvester on the tile) so I may well take advantage of this to update it.

My first thoughts were that having the separate id codes would be the best as it would probably lead to cleaner code on my end but thinking about it I don't think it would really (ignoring my naturally messy code style Wink).






Posted By: GM Stormcrow
Date Posted: 07 Apr 2021 at 09:20
Originally posted by Tensmoor Tensmoor wrote:

My first thoughts were that having the separate id codes would be the best as it would probably lead to cleaner code on my end but thinking about it I don't think it would really (ignoring my naturally messy code style Wink).
That was pretty much my own thought (about my own, also naturally messy, code style Embarrassed )


Posted By: Tensmoor
Date Posted: 07 Apr 2021 at 09:27
Just had a look at some of my code in DurcTools - no idea what 90% of it is meant to be doing Shocked

I do think this will be a big help for the desktop app that DarkenedHeart is working on. I'm a bit surprised he hasn't posted...



Posted By: GM Stormcrow
Date Posted: 07 Apr 2021 at 09:37
Originally posted by Tensmoor Tensmoor wrote:

I do think this will be a big help for the desktop app that DarkenedHeart is working on. I'm a bit surprised he hasn't posted...
DarkenedHeart initially brought the "Caravans always disappointed" issue to my attention, and I've pointed him to this thread in case he has a definitive preference.

Thanks, Tens.


Posted By: DarkenedHeart
Date Posted: 07 Apr 2021 at 19:01
I've had a few busy days with work as well as interview prep for a career move soon.  My application currently pivots in the notification type id to go into different RegEx parsers of the detail.  While long term the number being different for the different types of messages whether successful or not would be the most beneficial.  How I am setup it wouldn't be a big issue to just change the wording rather than the number.  I can then do a match on the wording to determine if I need to parse for remaining resources on grid or not.  It is also beneficial for you guys so it doesn't require a larger build / development effort to resolve the issue.

Appreciate you seeking feedback on the solution.


Posted By: DarkenedHeart
Date Posted: 07 Apr 2021 at 19:53
Also I noticed in your examples you added Miners to the front of the message.  If you do add "Miners" or "Herbalists" to the message it will help me eliminate another dive into the notification detail to pick up the code and determine the type of harvester.




Posted By: DarkenedHeart
Date Posted: 27 Apr 2021 at 23:13
Good Afternoon Stormcrow.  Just wanted to check in. Will there be a notification when this change has been made?  I will need to validate the existing code works and then look at modifying my code to pick up the new title with harvester type in the name.  No rush, just wanted to make sure I didn't miss this being implemented.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net