PDA

View Full Version : Mod Template - Information for Mod Creators of the Adoptables Script


BMR777
04-10-2009, 01:06 PM
Hello All,

This topic is meant for mod writers of the Rusnak PHP Adoptables Script. This topic provides you some resources that will help you create modifications for the new release and will help you start writing mods for the new release before it is released and after it is released.

The first thing I will share with you is the blank file template. This file is a blank slate where you can write your modification code. The file is attached as blank.php below.

Now that you have the blank file template, I will list some functions (with example usage) that are available to you when writing your mod to allow you to interface with the new Rusnak PHP Adoptables Script.

Rusnak PHP Adoptables Script Functions and Example Usage:

Function grabanysetting:

Usage:

Grabs a setting from the database.

Example Code:

$result = grabanysetting("settingname");

Input Parameter: The name of a setting

Result: (stored in $result) - The value of the setting returned, or blank if error.

Function cancp:

Usage:

Determines if a user can access the site's Admin CP.

Example Code:

$result = cancp($usergroup);

Input Parameter: The user's current usergroup

Result: (stored in $result) - The string yes is returned if the user can access the Admin CP, otherwise no is returned.

Function getgroup:

Usage:

Determines the usergroup of a user.

Example Code:

$result = getgroup();

Input Parameter: NONE

Result: (stored in $result) - The user's current usergroup, as an integer. If the user is not logged in, 0 is returned.

Function getcurrentimage:

Usage:

Gets the current image of a specified owned adoptable.

Example Code:

$result = getcurrentimage($id);

Input Parameter: An adoptable's numerical ID.

Result: (stored in $result) - The full URL / filepath to the adoptable's image. If the image or adoptable ID is not found, a default image is used.

Function getcurrentlevel:

Usage:

Gets the current level of an owned adoptable.

Example Code:

$result = getcurrentlevel($id);

Input Parameter: An adoptable's numerical ID.

Result: (stored in $result) - The current numerical level of an adoptable.

Function getnextlevelexists:

Usage:

Determines if a higher level exists for a given adoptable or if it is at max level.

Example Code:

$result = getnextlevelexists($type, $currentlevel);

Input Parameters: The type of adoptable and the adoptable's current level..

Result: (stored in $result) - Value true is returned if a higler level exists, otherwise false is returned.

Function convertidtotype:

Usage:

Converts an adoptable's ID to a usable adoptable type, so you can use other functions that require an adoptable type.

Example Code:

$result = convertidtotype($id);

Input Parameters: The adoptable's numerical id.

Result: (stored in $result) - The type of adoptable.

I will post more modding information later as we get closer to a release. Mod writers can get started now on writing mods for this new release. :)

Posted in the next post is some SQL for the tables and database. :)

BMR777
04-10-2009, 01:15 PM
SQL Tables:

This post contains information about some key SQL tables that the script uses.

Settings Table Structure and Contents:

CREATE TABLE adopts_settings (name varchar(20), value varchar(350));
INSERT INTO adopts_settings (name, value) VALUES ('themeurl', 'templates/default/template.html');
INSERT INTO adopts_settings (name, value) VALUES ('browsertitle', 'This is the site title as pulled from the DB');
INSERT INTO adopts_settings (name, value) VALUES ('sitename', 'Your site name goes here.');
INSERT INTO adopts_settings (name, value) VALUES ('admincontact', 'admin@email.com');
INSERT INTO adopts_settings (name, value) VALUES ('slogan', 'Test Slogan');
INSERT INTO adopts_settings (name, value) VALUES ('gdimages', 'yes');
INSERT INTO adopts_settings (name, value) VALUES ('usealtbbcode', 'yes');
INSERT INTO adopts_settings (name, value) VALUES ('systememail', 'admin@email.com');

Users Table Structure and Contents:

CREATE TABLE adopts_users (uid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, username varchar(20) UNIQUE, password varchar(100), email varchar(60), usergroup INT, newmessagenotify varchar(10), membersince varchar(20), isbanned INT, website varchar(80), profilepic varchar(80), aim varchar(80), yahoo varchar(80), msn varchar(80));


Groups Table Structure and Contents:

CREATE TABLE adopts_groups (gid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, groupname varchar(20) UNIQUE, canadopt varchar(10), canpm varchar(10), cancp varchar(10), canmanageadopts varchar(10), canmanagecontent varchar(10), canmanageads varchar(10), canmanagesettings varchar(10), canmanageusers varchar(10));
INSERT INTO adopts_groups VALUES ('', 'rootadmins', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes');
INSERT INTO adopts_groups VALUES ('', 'admins', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes');
INSERT INTO adopts_groups VALUES ('', 'registered', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 'no');
INSERT INTO adopts_groups VALUES ('', 'artists', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'no', 'no');

Adoptables Table Structure and Contents:

CREATE TABLE adopts_adoptables (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, type varchar(40), description varchar(300), eggimage varchar(120), whenisavail varchar(50), promocode varchar(50), freqcond varchar(50), number INT, datecond varchar(50), date varchar(20), adoptscond varchar(20), moreless varchar(20), morelessnum INT, levelgrle varchar(25), grlelevel INT, alternates varchar(10), altoutlevel INT, altchance INT);


Owned Adoptables Table Structure and Contents:

CREATE TABLE adopts_owned_adoptables (aid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, type varchar(40), name varchar(40), owner varchar(40), currentlevel INT, totalclicks INT, code INT, imageurl varchar(120), usealternates varchar(10), tradestatus varchar(15), isfrozen varchar(10));


Adoptables Levels Table Structure and Contents:

CREATE TABLE adopts_levels (adoptiename varchar(50), thisislevel INT, requiredclicks INT, primaryimage varchar(120), alternateimage varchar(120), rewarduser varchar(10), promocode varchar(25));


Having the database table structure will help you create modifications for the Rusnak PHP Adoptables Script. :)

Ashje
04-10-2009, 08:00 PM
Awesome, Thanks. XD

trollis76
04-16-2009, 09:42 AM
Well, thank you.
I'm sorry to ask so many questions, but how do I change the URL of the "Blank" site? Do I change the name of the document? Or do I change something inside of these " "?

BMR777
04-16-2009, 01:40 PM
You would change blank.php to the filename where you want your mod to appear, such as www.yoursite.com/adoptables/yourmod.php or something like that. :)

The above file is just meant to be a template file for you to use. :)

trollis76
04-17-2009, 12:03 AM
Ah, OK. Thank you. Will this work for the new release?

BMR777
04-17-2009, 09:30 AM
Yeah, that's what this file is for, the new release. :)

This is just a blank file from the new release where you can write your code. It takes care of all of the required parts of the script, such as checking if the user is logged in, working with the template system, etc. :)

trollis76
04-17-2009, 09:52 AM
This is my last question ( I hope). Where do I write? On any specific spot or anything?

BMR777
04-17-2009, 09:55 AM
You can write your code anywhere you need to on the file, however most of the time you can start after:

// ************************************
// End Prepwork - Output the page to the user
// ****************************************

:)