nb Core Community
February 09, 2012, 10:05:29 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: 1.2.3 +nb is now final and released

@new registrations. I will not allow any new registrations here as there are more (real person) spambots here than ever.... captcha proved to be ineffective.

After your registration, mail me at ( admin AT shinobilegends.com ) from the mail address you want to register. Provide some text about you and possibly your game.
 
   Home   Help Search Calendar Downloads Login Register  
Pages: [1]
  Print  
Author Topic: Dynamic streets module - adaptation to nb core  (Read 1045 times)
Alchemion
Guest
« on: February 21, 2009, 07:54:05 pm »

Hi,

I have run into a useful module from Aelia (on DP) : the Dynamic streets...

There is a small incompatibility issue with the actual nb+ 1.2.2. core engine: the module needed modified output.php lib.rary, in its first release... it comes bundled with a modified output.php lib file, yet the file is rather old and has no knowledge of the class output_collector...

the module is very simple made:

Code:
<?php
require_once("lib/http.php");

function 
dynstreets_getmoduleinfo(){
$info = array(
"name"=>"Dynamic Streets",
"author"=>"Aelia",
"version"=>"1.0",
"category"=>"Village",
"download"=>"http://dragonprime.net",
"description"=>"This enables city streets.",
"prefs"=>array(
"location"=>"Last place visited|gate",
),
);
return $info;
}

function 
dynstreets_install(){
module_addhook("header-village");
module_addhook("village");
return true;
}

function 
dynstreets_uninstall(){
return true;
}

function 
dynstreets_dohook($hookname$args){
switch($hookname){
case "header-village":
addnav("Go-To");
break;
case "village":
$place=httpget('place');
addnav("Go-To");
addnav($args['gatenav'],"village.php?place=gate&refresh=1");
addnav($args['fightnav'],"village.php?place=fight&refresh=1");
addnav($args['marketnav'],"village.php?place=market&refresh=1");
addnav($args['tavernnav'],"village.php?place=tavern&refresh=1");
blocknavcat($args['gatenav']);
blocknavcat($args['fightnav']);
blocknavcat($args['marketnav']);
blocknavcat($args['tavernnav']);
blocknav("login.php?op=logout");
addnav("Info");
addnav("Q?`%Quit`0 to the fields","login.php?op=logout&refresh=1",true);
if ($place==""$place=get_module_pref("location");
switch ($place) {
case "gate":
blocknav("village.php?place=gate&refresh=1");
unblocknavcat($args['gatenav']);
set_module_pref("location",$place);
break;
case "fight":
blocknav("village.php?place=fight&refresh=1");
unblocknavcat($args['fightnav']);
set_module_pref("location",$place);
break;
case "market":
blocknav("village.php?place=market&refresh=1");
unblocknavcat($args['marketnav']);
set_module_pref("location",$place);
break;
case "tavern":
blocknav("village.php?place=tavern&refresh=1");
unblocknavcat($args['tavernnav']);
set_module_pref("location",$place);
break;
}
break;
}
return $args;
}

?>


Simple for Aelia ...  Roll Eyes

The error, when installed, it is shown here:

Code:
Fatal error: Call to undefined function blocknavcat() in /mounted-storage/home113a/sub007/sc41001-XJFO/nb.net/modules/dynstreets.php on line 41


Please, have a glance over it and see if the called functions need to be modified or what else would need updating... i looked into the nav.php library and hoped no core edit is needed to make the module valid...

Thank you very much.


Attached there is the original module and modified output lib and output.dif from Aelia.
« Last Edit: February 21, 2009, 10:10:37 pm by Alchemion » Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 306



View Profile WWW
« Reply #1 on: February 22, 2009, 05:39:17 pm »

I am very positive that the "modified" version simply adds new libraries.

Here is my advice: rewrite the module to make it core compliant =)

It's totally useless to have a modified core file along with a module.

Also, the streets module is rather trivial.
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Alchemion
Guest
« Reply #2 on: February 22, 2009, 09:22:00 pm »

that seems the only way Aelia thought of it... to have a module and a library to assist it...  Roll Eyes

of course, it is logical to have only a good module, rather than 2 not very sure made files...

is there a function available on the actual nb core engine that compensates or does the same as the aelia's intended "blocknavcat" ?...

EDIT: it appears there isn't any...

So, after seing Aelia is no longer active on DP and Nightborn having too little spare time... I gathered myself and identified the missing functions from the nb nav library.

This is the new nav.php library, that strictly completes, not alters anything in the old library file, and permits to the dynamic streets module to work very nice on servers that have a lot of village modules that take up a lot of the players's front page...  Cheesy
« Last Edit: February 22, 2009, 11:34:41 pm by Alchemion » Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 306



View Profile WWW
« Reply #3 on: February 23, 2009, 10:22:40 am »

^^ good, that's what I wanted to point you to.

She only adds her own functions - so you can do the same with just an added file.

If she hacks in there (directly modifying $navs strings) it might break in the future as I will rewrite the nav system at some point - and then clean up functions and have a class like the current output.

Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!