New Content - Implemented Grab Item ID from item description

Cool12309

Member
So, when we do "test newitem" or find a new item, we don't need to know its item ID anymore.

Why?

/hardcore
[18:24:52] Cool12309: Also item ID in item descriptions? If you did that I'd love you even more forever, Jick/CDM/whoever
[18:25:23] Jick: Just, like, in a comment, cool?
[18:26:04] Cool12309: Like how effect IDs are in effect descriptions
[18:26:14] Jick: They are?
[18:26:18] Cool12309: yes
[18:26:32] Cool12309: <!-- effectid: 1570 -->
[18:26:37] Jick: Ah.
[18:26:53] Cool12309: I think someone asked and CDM added it
[18:28:47] Cool12309: <!-- itemid: 7293 -->
[18:28:53] Cool12309: Jick. I think I'm in love with you.
[18:30:23] Jick smooches Cool12309.

In this case, it is listed at the very end of the description.
 
Last edited:

lostcalpolydude

Developer
Staff member
15741 makes it "test newitem descId", removing the itemId parameter. There are probably other places it would be worth parsing for new items now.
 

lostcalpolydude

Developer
Staff member
Also, we can see negative itemIds for NPC store items (The Gnomish Micromicrobrewery is where I currently see this). We might want to do something with that.
 

Veracity

Developer
Staff member
I look forward to looking at this later, once the computer store opens and I can buy a new display for my desktop computer.

We should certainly learn new items from display cases and shops like the one in Dreadsylvania which have item images and "rows", but no item ids. If I recall, that took weeks before someone had farmed enough freddies to buy the most expensive item, which finally revealed the item id...
 

Veracity

Developer
Staff member
Forever ago, CMD added the effect ID as an HTML comment into effect descriptions - because I asked him to. Very nice! But when I asked if he would do that for items, too, he did not respond.
[18:24:52] Cool12309: Also item ID in item descriptions? If you did that I'd love you even more forever, Jick/CDM/whoever
[18:25:23] Jick: Just, like, in a comment, cool?
[18:26:04] Cool12309: Like how effect IDs are in effect descriptions
[18:26:14] Jick: They are?
[18:26:18] Cool12309: yes
[18:26:32] Cool12309: <!-- effectid: 1570 -->
[18:26:37] Jick: Ah.
[18:26:53] Cool12309: I think someone asked and CDM added it
This is not the first time that I've noticed that you don't like giving credit to other people, eh?

Yes, indeed - "someone" asked.

Whatever. Thanks for getting Jick to do this.
 

Bale

Minion
I'm just glad that cool12309 is somehow magically able to get Jick to agree to things that other people fail interest him in.
 

Cool12309

Member
I couldn't remember who asked for it. I was going to say Veracity but then didn't want to be wrong so I just said "someone".
 

Veracity

Developer
Staff member
There are probably other places it would be worth parsing for new items now.
As far as I can tell, this is all that remains for this.

The display case is the prime example; I remember any number of times when somebody got a new item and said "I put it in my display case. Look!" and I cursed because we could not get the item ID.

People also say "Look at my profile and see me wearing this new item". That seems like another case.

Any others?
 

lostcalpolydude

Developer
Staff member
For the display case and profiles,
Code:
	private static final Pattern DESC_PATTERN = Pattern.compile( "descitem\\((\\d+)" );
	public static final boolean parseNewItems( final String urlString, final String responseText )
	{
		Matcher m = DESC_PATTERN.matcher( responseText );
		while ( m.find() )
		{
			String descId = m.group( 1 );
			if ( ItemDatabase.getItemIdFromDescription( urlString ) == -1 )
			{
				ItemDatabase.registerItem( descId );
			}
		}
		return true;
	}
should work. The complicated part is that hasResult is false, because you can't gain anything from those pages and there can be arbitrary text on those pages. (I'm pretty sure at least a few people would add stuff to their profiles specifically to create bad results, like was done with PvP messages for a while.)
 

Veracity

Developer
Staff member
The complicated part is that hasResult is false, because you can't gain anything from those pages and there can be arbitrary text on those pages.
The only thing we care about is the "worn equipment" part of the page, so we need to run a matcher to extract that part of the profile, and run the above function on the result of that match, not on the whole responseText.
 

Veracity

Developer
Staff member
Revision 15947 registers new items from user profiles, either in the Equipment section or as the Familiar item.

I notice that the profile links to "showfamiliars.php?who=XXX" if the player has their terrarium visible, which could be used to detect new familiars, I guess. But not new items, since it doesn't show current familiar equipment.
 

Veracity

Developer
Staff member
Revision 15954 registers new items from display cases.

Unless somebody comes up with another place that shows items with images that we don't look for new items in, this is done.
 
Top