Bookworm addon for Roster 1.7

The WoWRoster interface for the WoW AddOn, Bookworm

Moderator: Sahasrahla

Bookworm addon for Roster 1.7

Postby Sahasrahla » Mon Jul 10, 2006 11:34 pm

For the longest time I've seen posts about a Bookworm addon for Roster, but never actually saw any release. This is another of one those posts :roll:

If you have no idea what I'm talking about, here's the background:

Bookworm is a WoW addon similar to CharacterProfiler or PvPLog in that it writes down information from the game so you can use that info elsewhere. This particular addon writes down the text contents, location and a few other stats about the books you read in WoW. It's great for when you're in an instance (Scarlet Monastery) and your group doesn't want to wait around for you to read all the umpteen books that can be found there. You can just blow through the book pages and let Bookworm write it all down so you can read it later...

The bookworm WoW addon actually has an interface for you to read the books back in-game. This Roster addon allows you to upload the BW data to the website so you can browse the books out of game... like during weekly maintenance when your server isn't available :)

Some links of interest:
The curse-gaming listing for Bookworm WoW addon
The official Bookworm homepage
My current iteration of Bookworm for Roster 1.7

Now the reason I'm not releasing any code yet is because I had to heavily modify core Roster files (notably update.php to get it to accept the bookworm.lua file) and at the very least, I need to get a well thought-out guide together of all the modifications I made. The main reason for this post is to let people know that the project hasn't been forgotten...
User avatar
Sahasrahla
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 46
Joined: Tue Jul 04, 2006 1:53 pm
Location: Branson, MO, USA

Re: Bookworm addon for Roster 1.7

Postby Sahasrahla » Tue Jul 11, 2006 2:27 am

Ok here it is.

INSTALL THIS AT YOUR OWN RISK! YOU'VE BEEN WARNED

This addon, at present, requires some modification of a core WoWRoster file, so plz don't install this unless you know what you're doing and are prepared for the consequences if you break it or if I miss a step in this guide...

First, we need to create 2 new tables in the wowroster database:

Code: Select all
CREATE TABLE `bookworm_books` (
  `book_id` int(10) unsigned NOT NULL auto_increment,
  `hash` varchar(15) NOT NULL default '',
  `title` tinytext NOT NULL,
  `num_pages` tinyint(3) unsigned NOT NULL default '0',
  `material` tinytext NOT NULL,
  `found_by` tinytext NOT NULL,
  `zone` tinytext NOT NULL,
  `subzone` tinytext NOT NULL,
  `x` int(11) NOT NULL default '0',
  `y` int(11) NOT NULL default '0',
  PRIMARY KEY  (`book_id`),
  UNIQUE KEY `noDUPES` (`hash`,`found_by`(254))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=44 ;

CREATE TABLE `bookworm_pages` (
  `page_id` int(10) unsigned NOT NULL auto_increment,
  `book_hash` varchar(15) NOT NULL default '',
  `page_num` tinyint(4) unsigned NOT NULL default '0',
  `text` text NOT NULL,
  PRIMARY KEY  (`page_id`),
  UNIQUE KEY `noDUPES` (`book_hash`,`page_num`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=237 ;


I plan to work that into the addon later, similar to siggen asking you about installing the neccessary tables... Anyway, on to the update.php modification.

Open /admin/update.php and here's a long list of modifications to allow it to accept a new file...

Search for:
Code: Select all
// Files that we accept for upload
$filefields[] = 'CharacterProfiler.lua';
$filefields[] = 'PvPLog.lua'

Add after:
Code: Select all
$filefields[] = 'Bookworm.lua'


Search for:
Code: Select all
                // If pvp data is there, assign it to $uploadData['PvpLogData']
                
if( isset($data['PurgeLogData']) )
                {
                    
$uploadData['PvpLogData'] = $data;
                }

                
// If CP data is there, assign it to $uploadData['myProfile']
                
if( isset($data['myProfile']) )
                {
                    
$uploadData['myProfile'] = $data['myProfile'];
                } 

Add after:
Code: Select all
                // If Bookworm data is there, assign it to $uploadData['Bookworm']
                
if( isset($data['BookwormBooks']) )
                {
                    
$uploadData['BookwormBooks'] = $data['BookwormBooks'];
                } 


Search for:
Code: Select all
if( is_array($uploadData['myProfile']) )
{
    
$updateMessages processMyProfile($uploadData['myProfile']);
}

if( 
is_array($uploadData['PvpLogData']) )
{
    
$updatePvPMessages processPvP($uploadData['PvpLogData']);

Add after:
Code: Select all
if( is_array($uploadData['BookwormBooks']) )
{
    
$updateBookwormMessages processBookworm($uploadData['BookwormBooks']);


Insert this function:
Code: Select all
function processBookworm($bookwormdata)
{
    global 
$wowdb$roster_conf$wordings;

    
$wowdb->resetMessages();

    foreach (
$bookwormdata['bookList'] as $bookTitle => $bookData)
    {
        foreach (
$bookData as $sightingCount => $bookVars)
        {
            
$hash $bookVars['hash'];
            
$num_pages $bookVars['pages'];
            
$material $bookVars['material'];
            foreach (
$bookVars as $varName => $value)
            {
                if(
substr($varName,0,3) == "loc"){
                    
$found_by $value[1];
                    
$zone substr($varName,4);
                    
$subzone $value[5];
                    
$x $value[3];
                    
$y $value[4];
                }
            }
            for(
$i=1;$i<=$num_pages;$i++){
                
$page_num $i;
                
$page_text $bookVars["page$i"];
                
$query "INSERT INTO `bookworm_pages` (book_hash, page_num, text) VALUES ('".addslashes($hash)."', '".addslashes($i)."', '".addslashes($page_text)."');";
                
$result $wowdb->query$query );
            }
        }
        
$query "INSERT INTO `bookworm_books` (hash, title, num_pages, material, found_by, zone, subzone, x, y) VALUES ('".addslashes($hash)."', '".addslashes($bookTitle)."', '".addslashes($num_pages)."', '".addslashes($material)."', '".addslashes($found_by)."', '".addslashes($zone)."', '".addslashes($subzone)."', '".addslashes($x)."', '".addslashes($y)."');";
        
$result $wowdb->query$query );

        
$output .= "\"$bookTitle\" has been processed.<br />\n";
    }

    return 
$output;


Search for:
Code: Select all
                $updateMessages.
                
$updatePvPMessages

Add after:
Code: Select all
                $updateBookwormMessages


Search for:
Code: Select all
        print '<input type="hidden" name="data" value="'.htmlspecialchars(stripAllHtml($updateMessages.$updatePvPMessages.$rosterUpdateMessages)).'" />'."\n"

Replace with:
Code: Select all
        print '<input type="hidden" name="data" value="'.htmlspecialchars(stripAllHtml($updateMessages.$updatePvPMessages.$updateBookwormMessages.$rosterUpdateMessages)).'" />'."\n"


Search for:
Code: Select all
                $auth_message.
                
$updateMessages.
                
$updatePvPMessages

Add after:
Code: Select all
                $updateBookwormMessages


Now update.php should be ready to accept the new file. The only thing I DIDN'T do was add the actual html form input to upload the file. Right now you can either upload bookworm.lua in the "PvPLog" slot on the webpage and the code will sort it out, or you can upload bookworm.lua using UniUploader.


That should be all the prep work needed. Now just install the attached addon like you would any other addon and you're all set!
Attachments
bookworm.zip
(3.72 KiB) Downloaded 493 times
User avatar
Sahasrahla
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 46
Joined: Tue Jul 04, 2006 1:53 pm
Location: Branson, MO, USA

Re: Bookworm addon for Roster 1.7

Postby johnegan » Wed Jul 12, 2006 5:17 am

Okay got it installed and modded just like you said. Works fine except for the text isnt showing up on the pages on the roster. Here is what i am seeing. Let me know what i can do to fix this. Thanks.

http://www.knightsofroundtable.com/rost ... e=bookworm

Also attached the sql file i used to update mysql.
johnegan
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 10:35 am

Re: Bookworm addon for Roster 1.7

Postby johnegan » Wed Jul 12, 2006 6:49 am

here are the files i modified. Forgot to add in last post.
Attachments
bookworm.lua
bookworm lua file
(2.91 KiB) Downloaded 440 times
johnegan
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 10:35 am

Re: Bookworm addon for Roster 1.7

Postby johnegan » Wed Jul 12, 2006 6:51 am

Update file
johnegan
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 10:35 am

Bookworm addon for Roster 1.7

Postby orloph » Wed Jul 12, 2006 2:29 pm

I inspected your bookworm update function. I can't see any check for the guild members.
Does it accept data from foreign people too ?
Last edited by orloph on Thu Jul 13, 2006 6:33 pm, edited 2 times in total.
User avatar
orloph
WR.net Apprentice
WR.net Apprentice
 
Posts: 10
Joined: Tue Jul 04, 2006 1:34 pm
Location: Dreanor's Ashes (soon Outland)

Re: Bookworm addon for Roster 1.7

Postby PoloDude » Wed Jul 12, 2006 6:03 pm

johnegan wrote:Okay got it installed and modded just like you said. Works fine except for the text isnt showing up on the pages on the roster. Here is what i am seeing. Let me know what i can do to fix this. Thanks.

http://www.knightsofroundtable.com/rost ... e=bookworm

Also attached the sql file i used to update mysql.


The bookworm addon ingame isn't configured right i think, as my file looks like the one attached
Attachments
bookworm.lua
(117.43 KiB) Downloaded 485 times
[url=http://eu.wowarmory.com/character-sheet.xml?r=Emerald+Dream&n=Calaglin]Calaglin @ Emerald Dream [EU]
User avatar
PoloDude
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 134
Joined: Tue Jul 04, 2006 3:17 pm
Location: Belgium - Gent

Re: Bookworm addon for Roster 1.7

Postby Sahasrahla » Wed Jul 12, 2006 7:08 pm

johnegan wrote:Okay got it installed and modded just like you said. Works fine except for the text isnt showing up on the pages on the roster. Here is what i am seeing. Let me know what i can do to fix this. Thanks.

http://www.knightsofroundtable.com/rost ... e=bookworm

Also attached the sql file i used to update mysql.


Polodude's right, for some reason the guy who wrote the Bookworm WoW addon has it setup to NOT write down the page content by default. It just writes down the books. To make it store the page content you have to do some command-line thing in game, I think it's like /bookworm store all

Beats me why he'd make the default settings like that...

orloph wrote:I checked your bookworm update function. I can't see any control for the guild members.
Does it accept data from foreign people too ?


And that's correct, it will currently accept books from anybody. I told you this was a work-in-progress :P
User avatar
Sahasrahla
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 46
Joined: Tue Jul 04, 2006 1:53 pm
Location: Branson, MO, USA

Re: Bookworm addon for Roster 1.7

Postby silencer-ch-au » Thu Jul 13, 2006 11:20 am

Nice work! I guess I'll just drop mine as yours already does everything except categories..

Oh and do something about duplicates..

:thumleft:
Last edited by silencer-ch-au on Thu Jul 13, 2006 11:21 am, edited 1 time in total.
User avatar
silencer-ch-au
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 41
Joined: Tue Jul 04, 2006 9:22 pm

Re: Bookworm addon for Roster 1.7

Postby johnegan » Thu Jul 13, 2006 6:28 pm

Hey guys tried to upload again after do that /bookworm store all in game with the mod. And im still getting blank pages. Wish i was a coder id help ya all fix it. But i do love testing stuff. Glad to see everyone respond to this as well. Was hoping to see this mod come out for some time now. We are almost there :) If you all figure anything out let me know ill be happy to test it. Glad to see your posting here too Silencer-ch-au you make some great mods.

John
johnegan
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 10:35 am

Re: Bookworm addon for Roster 1.7

Postby orloph » Thu Jul 13, 2006 6:46 pm

johnegan wrote:Hey guys tried to upload again after do that /bookworm store all in game with the mod. And im still getting blank pages. Wish i was a coder id help ya all fix it. But i do love testing stuff. Glad to see everyone respond to this as well. Was hoping to see this mod come out for some time now. We are almost there :) If you all figure anything out let me know ill be happy to test it. Glad to see your posting here too Silencer-ch-au you make some great mods.

John


The book pages need to be all turned to be saved.
When pages will be turned, a proper save message will appears in the chat.
You can automatize this process with "/bw auto" command. it will turn pages automatically when you open the books then.
To restore the empty books, try the "/bw browse" command and check what books got "no data".

Hope this works.
Byez
Last edited by orloph on Thu Jul 13, 2006 6:50 pm, edited 1 time in total.
User avatar
orloph
WR.net Apprentice
WR.net Apprentice
 
Posts: 10
Joined: Tue Jul 04, 2006 1:34 pm
Location: Dreanor's Ashes (soon Outland)

Re: Bookworm addon for Roster 1.7

Postby Sahasrahla » Thu Jul 13, 2006 8:14 pm

silencer-ch-au wrote:Nice work! I guess I'll just drop mine as yours already does everything except categories..

Oh and do something about duplicates..

:thumleft:


Duplicates should be taken care of by the way the database tables are setup. There might be duplicates in the books database, because I allow each person to upload all their books. I might later want to make the "Found By" column be everybody in the guild who has found that book (similar to the MadeBy page listing all the people who can make a particular item).
Code: Select all
UNIQUE KEY `noDUPES` (`hash`,`found_by`(254))


The pages are unique for each book hash/page number. So for each Bookworm book listed in the database, there can only be one page1, one page2, etc.
Code: Select all
UNIQUE KEY `noDUPES` (`book_hash`,`page_num`)
User avatar
Sahasrahla
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 46
Joined: Tue Jul 04, 2006 1:53 pm
Location: Branson, MO, USA

Re: Bookworm addon for Roster 1.7

Postby silencer-ch-au » Sat Jul 15, 2006 3:40 pm

I dont know if its a bug in bookworm (wow addon) but sometimes it doesnt save all the pages of a long book. It seems fairly random so an update process would be a good idea, incase someone else might have a more complete version of the book.
User avatar
silencer-ch-au
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 41
Joined: Tue Jul 04, 2006 9:22 pm

Bookworm addon for Roster 1.7

Postby SethDeBlade » Sat Jul 15, 2006 11:52 pm

Code: Select all
$wordings['deDE']['bookworm_addon'] = 'Bücherwurm';
$wordings['deDE']['booklist'] = 'Wähle ein Buch aus:';
$wordings['deDE']['back_to_booklist'] = 'Zurück zur Buchliste';
$wordings['deDE']['book_title'] = 'Titel';
$wordings['deDE']['found_by'] = 'Gefunden durch';
$wordings['deDE']['location'] = 'Fundort';
$wordings['deDE']['num_pages'] = '# Seiten';


here the german translation. Do the stecialchars need uft-8 coding or is html-coding ok?

btw works great. but some book have /n in every beginning of a new line. is this an "error" bei wow-addon or rosteraddon??
User avatar
SethDeBlade
WR.net Expert
WR.net Expert
 
Posts: 192
Joined: Thu Jul 06, 2006 1:02 am
Location: Germany

Bookworm addon for Roster 1.7

Postby Averen » Mon Jul 24, 2006 5:18 am

In the file /admin/update.php in the function processBookworm($bookwormdata){} change the following line.

Code: Select all
$page_text = $bookVars["page$i"];


to

Code: Select all
$page_text = preg_replace(array("/\\\\n/","/\\n/"), "<br />", $bookVars["page$i"]);


Hope this helps.
Last edited by Averen on Mon Jul 24, 2006 10:30 pm, edited 3 times in total.
User avatar
Averen
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 152
Joined: Thu Jul 20, 2006 5:18 am

Next

Return to Bookworm

Who is online

Users browsing this forum: No registered users and 0 guests

cron