Item linking filter module in the works

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
professorbikeybike's picture

Edit: There is now an offical project page on d.o. The module is nearly ready for a beta release, so the more people that test it, the better.

I have created a filter module for 6.x that in it's current state will allow posts containing:

[item]1234[/item]

-or-

[item]Earthwarden[/item] (for example)

to be converted to WoW DB links. The javascript for mouseover popups is embedded, and results are cached for performance.

The module is designed as a filter engine, so if somebody wants to use Wowhead or Thottbot instead of WoW DB, they simply need to copy the wowdb.inc file, and modify the hooks to work for the desired item database.

Edit: There is now an offical project page on d.o. Stay tuned there for the latest changes. The original is still here for a few more days, until I can get a release branched on d.o.: http://senduit.com/e988d9

Cheers

Comments

Why is this post marked as

professorbikeybike's picture

Why is this post marked as private? I can't seem to set it to public...

Hm. Not sure.

webchick's picture

I fixed it now. If it happens again, maybe post to http://groups.drupal.org/maintenance

Great Work

ajax1022's picture

I downloaded this and am using it on my own website. I did notice one problem and took the liberty to fix it:

While searching for some items by name on WoWDB, the actual item page will come up and this is what your module reads. Other items, however, return a search page even when there is only one match. The fix is rather simple. I just changed the function lootz_wowdb_id_lookup as such:

function lootz_wowdb_id_lookup($name) {

  $url = WOWDB_BASE_URL . '/' . WOWDB_SEARCH_NAME . drupal_urlencode($name);

  $page = drupal_http_request($url);
  if ($page->code == '200') {
    // find id via this redirect tag: <script>self.location="item.aspx?id=29171";</script>
    if (preg_match('/self.location="'. preg_quote(WOWDB_SEARCH_ID) . '([0-9]+)";/', $page->data, $m)) {
      return check_plain($m[1]);
}

//We got a search page instead  !!This is the block I added!!
  if (preg_match('/addEntityResults("([0-9]+)/', $page->data, $m)) {
         
       return check_plain($m[1]);
}

}
  return false;

}

Now if the id lookup encounters a search page, it should link the first returned item. Of course this now allows for the linking of anything, say "boots" and it will link to whatever first turns up. We don't want the text "boots" to point to "Arcanist Boots", that would look trashy. So I modified the function lootz_link_item as follows:

function _lootz_link_item($id) {

  if (is_numeric($id)) {
    // find the name
    $name = _lootz_name_lookup($id);
  }
  else {

    // find id
    $name = $id;
    $id = _lootz_id_lookup($name);
    //make the name match  !!This is the line I added!!
    $name = _lootz_name_lookup($id);
  }
  return _lootz_invoke_hook('link_item', $name, $id);
}

Now, if we simply link "boots" it will still point to Arcanist Boots, but the link text will be changed to read "Arcanist Boots" as well.

I know these are simple changes, but I just thought I'd share what I did in case it might be useful to you. I think this module should be easily extensible to link to the spells, quests, etc on WoWDB as well. I might work on that when I have time, assuming you don't beat me to it. Cheers and keep up the good work!

cool. I'll try to

professorbikeybike's picture

cool. I'll try to incorporate this into the next version I release.

coolness

sepeck's picture

So we decided to form a dedicated raider guild and I volunteered to set up an interim site. This module is coolness. I shall have to put it on my site as well.

Hey that's module is way

davapava's picture

Hey that's module is way cool.. I will use it on one of my site soon.. Great work!


Visit my WoW leveling guide website and get tips on how to level up faster.


Visit my WoW leveling guide website and get tips on how to level up faster.

Ported to 5.x...

mcaden's picture

I'm disappointed how there's no real action here in over a month as drupal is extremely powerful for making a guild website. However, I figure if I just sit around and gripe about it then I'm kind of a hypocrite seeing as I'm a programmer. Soooooo...I'm submitting some work!

I'm running 5.x for the signup module and all it's different prerequisites and really wanted the item links so I ported this module.

Along the way I ran into some big problems. I don't know what bugs were simply from porting backwards from 6.x to 5.x, or if it was things that had to deal with versions of my other things but as far as I know it's fully working and bug-free (based on what limited testing I could do myself). This includes the feature that ajax1022 mentioned even though his code also was bugged based on my setup (I suspect that wowdb changed how they present the search pages so it's not that the code was buggy exactly, but maybe outdated).

It fully works with text and item ids.

The biggest thanks go to professorbikeybike for the majority of the work. Honestly I haven't worked with drupal enough that I could do this from scratch without a TON of research. But because of this I was able to learn a lot about drupal AND do something good for the drupal/wow community.

My guild site for those working on a wow site can be found at http://iiv.katalyststudios.com and for those that want the 5.x module with the bugfixes can find it at http://mcaden.katalyststudios.com/projects/lootz.zip.

~Mcaden
mcaden at gmail.com

Hey Mcaden,That's awesome.

professorbikeybike's picture

Hey Mcaden,

That's awesome. If you are able to, it would be super cool if you could post your patch to http://drupal.org/project/lootz, or post it here. Either way, I'll apply it and commit it back to cvs so other people running 5.x can benefit.

Cheers

Edit: Sorry, I didn't see that you'd attached a link to the zip. I'll download this and commit it back to cvs when I get a chance. Thanks again

Glad you like it

mcaden's picture

You may have to edit the .info file and all the other tags at the top...I honestly didn't know what I was doing in regards to those.

I'd offer to join the project and work more on it, but honestly I couldn't find any bugs, nor can I think of any way to improve it.

As far as I know, it does exactly what it's supposed to do and even tells you when there's no items matching the one you've listed (link says "no item found") so I don't know how else I'd contribute.

I am however wanting to work with incorporating armory data into my user profiles.

What I'm wanting is that when a user signs up and has a certain status (specifically once we've tagged them as a member of the guild). Whenever their user profile is accessed by another guild member, the module activates and updates their armory info (cached, expiring like...24 hours after a view). I know there are others working on such a module although maybe not with those statistics. However, none of the links are active (wowcan link comes up with nothing and the houseofbob site comes up with nothing).

Heck, I'd settle for a simple list automatically put in/updated on their profile page.

Main Character Name: Mcaden
Class: Druid
Main Hand = [item]Cudgel of Consecration[/item]
Offhand = [item]Fetish of the Primal Gods[/item
...
Str 82
Sta 306
Int 456
...
Bonus spell damage: 1008
Bonus Healing 1096
...
etc...(stats I've listed are not from my actual character, just off the top of my head)

But it looks like as things currently are I'm going to have to do it myself...I just hate that I'd basically be reinventing the wheel if somebody else has already done these and knows drupal better than I do.

~Aaron Moore
Mcaden

wow armory

mcaden's picture

I started on that armory stuff

http://mcaden.katalyststudios.com/projects/WoWarmory.zip

It's set up as a filter just like the lootz module, and requires lootz to be there. I haven't set it up to cache things yet.

There's some things I haven't been able to do yet/don't know how to do.

I want it to check user roles like some of the other mods. Can only view others if you have certain roles, and an armory profile only shows on yours if you have a certain role (ie, don't try to show armory info for users who don't play WoW or you don't know their char name/guild/realm, etc...). I also want to change it from being a filter, to just automatically showing on user profiles.

I want it to also be able to simply show a list of guildies and their race/class. This is simple and I now know exactly how to do this, it's just not in yet.

I also want it to look better. I can come up with a table layout pretty easily, but not sure how to get just the icons.

All these things are doable for me, just many I know will take a while. I'm not familiar with drupal at all so like I said before I'm not sure how to set up the .info file, exactly how the hooks should be in order to be 'proper'. My code should be readable although it probably needs a bit of optimization and I may still have a little debugging code in there. Anybody interested in collaborating with me on this? It's not near as pretty or tested as the code I posted previously for the lootz module.

Also, I've found that in both modules it looks like the module is including the .js and all the css files, even if there's not an item link on the page.

Nice with one hitch

Sota's picture

Thanks for the very nice mod. I might suggest adding a note that it must be enabled in one of the input formats under Admin > Site Configuration > Input formats.

Bug?

logos-gdo's picture

Hello, what I am doing bad? I am installed this mod, but web is wery slow now and window with requested item is not properly viewed. Look at http://tlegie.com/?q=test

Re: suggestions/bugs

mcaden's picture

Sota - Thanks for the comment, you're right. I've moved on to doing another module that I will release as a beta very soon for WoW guild websites but if I ever get back to it I'll definitely add that to the ported version I've made. I haven't seen any updates from Professorbikeybike lately.

Logos - What version are you using? Bike's 6.x version or my 5.x version? I can't check your site b/c it's blank which would probably signify some sort of uncaught php error.

Re: bug

logos-gdo's picture

I am using 5.x version, 6.x version totaly not work for me. Look at http://img208.imageshack.us/img208/2237/beznzvuxx2.jpg

css?

mcaden's picture

Looks like it could be a problem with the CSS.

Honestly I haven't seen the problem before, so I don't know what to tell you.

That's definitely a css bug.

professorbikeybike's picture

That's definitely a css bug. The included css file attempts to fix that issue (and I had fixed it on 6)...the problem is a conflict with some core drupal css. When I get a chance to work on the 5.x patch commit to cvs, I'll see if I can duplicate the issue.

Update please, and wowhead support.

manorton's picture

Hey progessorbikeybike (man that is a mouth full)

Thanks for the mod. Sadly I am not using right now as I prefer wowhead over wowdb (Mainly final site preference as wowdb is pretty bloated, just my opinion BTW) Right now wowhead provides a script to do this automatically, BUT you have to enter your url's pointing to the wowhead page. This works great for those of us that know about this, but for a noob Id love to have it parsed using [item]

On top of that having the parser do the search and replace would be more than welcome. I attempted to hack the parser but hit a brick wall as I am not as familiar with it. Im more a design and layout guy.

IF anyone is able to put together a quick parser we will need one option untill the 3.0.2 patch goes live. A way to let users pick a wotlk item. So I was thinking if it was a wotlk item use [witem] that would then search wotlk.wowhead.com instead of wow.wowhead.com. Of course the content patch is highly speculated to come out the 13 or 14 of this month to coincide with the end of season 4, at that point I suspect wowhead, and others will roll the wotlk database into the main database since the skills, and talents will be in the system then.

Oh, and yes, skills, and talents. Need a parser for those as well. :) More coffee!

Thanks all.

Hey manorton, Adding a

professorbikeybike's picture

Hey manorton,

Adding a wowhead include file would be relatively straight-forward. If you look at the wowdb.inc file, there are a few urls defined, and some patterns, but the module was written to be easily extensible. I will gladly accept patches if you take the time to write this functionality:

http://drupal.org/project/lootz

WoWHead Now Running!

illepic's picture

Just a quick patch to Lootz that supports WoWHead: http://drupal.org/node/430496#comment-1468430. Works great! And we have rollovers for achievements, spells and quests thanks to WoWHead and andy68man. Professorbikeybike, thanks for all you do and we love the module! You can see it in action here: http://www.downfallguild.org/node/6211

World of Warcraft guild website modules

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week