Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - littleone

Pages: [1] 2 3
1
I got the shop from the SMF site, so its legit.

Its not just the rock, its any item.

It wasnt happening before.  I've been using this shop for probably a year or so now, and I just noticed it on the day of my original post.

2
Bump....still waiting to resolve this issue.

It should not be erasing my index.php coding!

3
I am using shop 3.0 and on smf 1.1.6

When I try to add the "Rock" item (or any item for that matter) I select it on the drop down and hit add.  It goes to a white page and then nothing.  Then I try to go to my home page and nothing....ITS WIPED MY INDEX PAGE CODE!?!?!?!

I had a backup so I reuploaded the index page and tried again.  Same thing.  Its taking my code from 18KB to 1KB everytime I tried to add an item to my shop.  What on gods green earth is going on?!

4
Requested additions / Re: Inflation?
« on: November 26, 2007, 02:11:34 am »
im on board 110% with this idea.  Its hard to price items when u have some members with 9 million tokens and others with 9 thousand.

5
Modifications / Re: SMFPets Version 0.2
« on: May 11, 2007, 04:55:02 am »
Most likely something happened where instead of copying and pasting the right file, I copied and pasted a link. Can you provide me with your profile.template.php and profile.php files?

Its hard coded into the code.  I think its in the Pet Engine but I dont remember.

6
Modifications / Re: SMFPets Version 0.2
« on: May 07, 2007, 02:07:07 pm »
8: Use of undefined constant pet_Blank_pet - assumed 'pet_Blank_pet'
File: /home/xxxxxxx/public_html/forum/Sources/shop/pets_breeds/Blank_pet.php
Line: 2

to fix this:

change:
if (!class_exists(pet_Blank_pet)) { //Make sure name matches php file

to
if (!class_exists('pet_Blank_pet')) { //Make sure name matches php file

7
Modifications / Re: SMFPets Version 0.2
« on: May 07, 2007, 02:05:49 pm »
change:
'pets' => $profile['pets'],

to
'pets' => &$profile['pets'],

8
Modifications / Re: SMFPets Version 0.2
« on: May 07, 2007, 11:00:28 am »
Got like hundreds of pages of this:

8: Undefined index: pets
File: /home/xxxxxxxxx/public_html/forum/Sources/Load.php
Line: 1160

Here are lines 1159 and 1160
//another pets modification
      'pets' => $profile['pets'],

9
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 27, 2007, 06:18:28 am »
Getting a couple of errors in my logs id like to fix:

8: Undefined index: profile_show_pets_2
File: /home/xxxxxxxxxxxxxx/public_html/forum/Themes/default/Profile.template.php
Line: 598

8: Undefined index: showPets
File: /home/xxxxxxxxxxxxx/public_html/forum/Sources/Profile.php
Line: 350

8: Undefined index: shop_buy_message
File: /home/xxxxxxxx/public_html/forum/Sources/shop/Shop-Pets.php
Line: 146

10
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 26, 2007, 02:14:58 am »
Ok I have narrowed the problem down ti this bit of code change:

Code: [Select]
<operation>
<search position="replace"><![CDATA[
for ($i = 0; $i < $this->skills_cnt; $i++) {
if ($this->skill[$i]->level_learn <= $this->level) {
$returnstring .= "<option value=".$i." selected = 'selected'>".$this->skill[$i]->name." (Cost: ".$this->skill[$i]->cost."SP)</option>";
}
}
$returnstring .= "<input type='submit' value='{$txt['pets_use_skill']}'></form>";
]]></search>
<add><![CDATA[
$cnt = 0;
for ($i = 0; $i < $this->skills_cnt; $i++) {
if ($this->skill[$i]->level_learn <= $this->level && $this->skill[$i]->cost <= $this->curap) {
$cnt++;
$returnstring .= "<option value=".$i." selected = 'selected'>".$this->skill[$i]->name." (Cost: ".$this->skill[$i]->cost."SP)</option>";
}
}
if ($cnt == 0) {
$returnstring = $txt['pets_no_skills'];
}
else {
$returnstring .= "<input type='submit' value='{$txt['pets_use_skill']}'></form>";
}
]]></add>
</operation>

11
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 26, 2007, 02:06:25 am »
Ok well I know its one of the changes that was done with 0.1.  When I put the original pet_engine from 0.0 up its perfectly fine, but as soon as I make the changes it disappears.  Would you be able to look into that and see what might be the cause?

12
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 25, 2007, 04:50:09 pm »
Like i said it was fine until I went to use it the first time.  I had just purchased the pet and went to use a skill.  It gave me a message saying something like I wasnt trained enough to use it, and it disappeared, so I went to train the animal.  Well I have purchased a couple more animals and now they come with out it to begin with.

If possible, would it be possible to get someone to give me a clean copy of the Pet-Shops and the pet_engine files?  I have done the 0.1 update, so i know that is good.  TY

13
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 25, 2007, 12:35:27 pm »
For some reason I cant attach files so i have to post my whole code.  Here is the pet_engine file:

Code: [Select]
<?php
/**********************************************************************************
* pet_engine.php&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* Backend engnie for pets&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
***********************************************************************************
* SMFPets: Pets MOD for Daniel15's Shop Mod for Simple Machines Forum&#160; &#160; &#160; &#160; &#160; &#160;  *
* =============================================================================== *
* Software Version:&#160; &#160; &#160; &#160; &#160;  SMFPets 1.0 (Build 1)&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* $Date:: 2007-02-10 8:33 PM EST (Sat, 10 Feb 2007)&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  $ *
* $Id:: pet_engine.php 79 2007-01-18 08:26:55Z basilbeard&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  $ *
* Software by:&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Basilbeard&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* Copyright&#160; &#160; &#160; 2007 by:&#160; &#160;  Basilbeard&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* Support, News, Updates at:&#160; http://www.daniel15.com/forum&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
*&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* Forum software by:&#160; &#160; &#160; &#160; &#160; Simple Machines (http://www.simplemachines.org)&#160; &#160;  *
* Copyright 2006-2007 by:&#160; &#160;  Simple Machines LLC (http://www.simplemachines.org) *
*&#160; &#160; &#160; &#160; &#160;  2001-2006 by:&#160; &#160;  Lewis Media (http://www.lewismedia.com)&#160; &#160; &#160; &#160; &#160; &#160;  *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under&#160;  *
* the terms of the provided license as published by Simple Machines LLC.&#160; &#160; &#160; &#160; &#160; *
*&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* This program is distributed in the hope that it is and will be useful, but&#160; &#160; &#160; *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY&#160; &#160; *
* or FITNESS FOR A PARTICULAR PURPOSE.&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
*&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* See the "license.txt" file for details of the Simple Machines license.&#160; &#160; &#160; &#160; &#160; *
* The latest version of the license can always be found at&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* http://www.simplemachines.org.&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
**********************************************************************************/

// Basically, this is a basic pet. All the defaults are defined here.
// So, if anything isn't defined by the pet, the defaults are inherited from here
if (!class_exists('petTemplate')) {
class 
petTemplate
{
/* 
 * All the below fields aren't in the breed files themselves. They're just defaults
 * The correct values are filled in with other functions.
 * These values are used as fallovers. If any of the variables aren't defined in the item,
 * it will use the defaults from here.
 */
//These vars depend on the pet and are set by the owner of the pet.
var $name 'No Name'; // The name of the pet
var $desc 'No Desc'//The description the user has given.
var $level 0//The level of the pet;
var $curap 0//The current number of skill points the pet has
var $maxap 0//The max number of skill points the pet has
var $age 0//How old(in days) the pet is
var $happy 0//Pets Happiness
var $hunger 0//Pets Hunger
var $id 0//Pet ID
var $training 0//Is the pet training ?
var $trainingend '00000000'//When does training end?
var $ownerid 1//Owner of the pet


//These vars depend on the breed and are loaded up in the free file.
var $breed 'No Breed'//The breed of the pet
var $breed_desc 'No Breed Desc'//The description of the breed.
&#160; &#160; var $price = 700; //The price to purchase one of these pets
&#160; &#160; var $breed_img = 'blank.jpg'; //The img file of the breed
&#160; &#160; var $skills_cnt = 0; //Number of skills owned by the pet.

// -----------------------------------------------------------------------
//Lots of functions to make life easier everywhere else


//The view function that people see on your pets profile
function view_Pet() {
global $txt$sourcesdir;
switch ($this->happy) {
case 0$happy "Very Depressed"; break;
case 1$happy "Sad"; break;
case 2$happy "Sad"; break;
case 3$happy "Gloomy"; break;
case 4$happy "Gloomy"; break;
case 5$happy "Content"; break;
case 6$happy "Content"; break;
case 7$happy "Happy"; break;
case 8$happy "Happy"; break;
case 9$happy "Joyous"; break;
case 10$happy "Joyous"; break;
case 11$happy "Joyous"; break;
case 12$happy "Gleeful"; break;
case 13$happy "Gleeful"; break;
case 14$happy "Gleeful"; break;
default: $happy "Excstatic"; break;
}
switch ($this->hunger) {
case 0$hunger "Starving"; break;
case 1$hunger "Very Hungry"; break;
case 2$hunger "Very Hungry"; break;
case 3$hunger "Hungry"; break;
case 4$hunger "Hungry"; break;
case 5$hunger "Content"; break;
case 6$hunger "Content"; break;
case 7$hunger "Happy Tummy"; break;
case 8$hunger "Happy Tummy"; break;
case 9$hunger "Full"; break;
case 10$hunger "Full"; break;
case 11$hunger "Full"; break;
case 12$hunger "Very Full"; break;
case 13$hunger "Very Full"; break;
case 14$hunger "Very Full"; break;
default: $hunger "Bloated"; break;
}
return "
<table width='85%' cellpadding='5' cellspacing='0' border='1' align='center'>
<tr class = 'titlebg2'><th colspan='6'>"
.$this->name." the ".$this->breed."</th></tr>
<tr class = 'middletext'><td colspan='1' rowspan='3' width='10%'><img border='0' src='"
.$sourcesdir."/forum/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_name']."</th>
&#160; &#160; <td colspan='1'>"
.$this->name."</td>
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_breed']."</th>
<td colspan='2'>"
.$this->breed."</td></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_happy']."</th>
<td colspan='1'>"
.$happy."</td>
<th colspan='1'>"
.$txt['pets_hunger']."</th>
<td colspan='1'>"
.$hunger."</td></tr>
<tr><th colspan='1' width='20%'>"
.$txt['pets_level']."</th>
<td colspan='1'>"
.$this->level."</td>
<th colspan='1' width='20%'>"
.$txt['pets_age']."</th>
<td colspan='2'>"
.sprintf($txt['pets_days'], $this->age)."</td></tr>
<tr><th colspan='1'>"
.$txt['pets_description']."</th>
<td colspan='5'>"
.$this->desc."</td></tr>";
}


//The view function that you see on your pets menu. Allows for skills and such.
function view_Pet_owner() {
global $txt$sourcesdir;
return "
<table width='75%' cellpadding='5' cellspacing='0' border='1' align='center'>
<tr 'titlebg2'><th colspan='6'>"
.$this->name." the ".$this->breed."</th></tr>
<tr><td colspan='1' rowspan='3' width='10%'><img border='0' src='"
.$sourcesdir."/forum/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_name']."</th>
&#160; &#160; <td colspan='1'>"
.$this->name."</td>
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_breed']."</th>
<td colspan='2'>"
.$this->breed."</td></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_happy']."</th>
<td colspan='1'>"
.$this->happy."</td>
<th colspan='1'>"
.$txt['pets_hunger']."</th>
<td colspan='1'>"
.$this->hunger."</td></tr>
<tr><th colspan='1' width='20%'>"
.$txt['pets_level']."</th>
<td colspan='1'>"
.$this->level."</td>
<th colspan='1' width='20%'>"
.$txt['pets_age']."</th>
<td colspan='2'>"
.sprintf($txt['pets_days'], $this->age)."</td></tr>
<tr><th colspan='1'>"
.$txt['pets_description']."</th>
<td colspan='5'>"
.$this->desc."</td></tr>
<tr><th colspan='6'>"
.$txt['pets_do_stuff'].$this->curap."/".$this->maxap.")</th></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_use_skill']."</th>
<td colspan='2'>"
.$this->skillsMenu()."</td>
<th colspan='1' width='10%'>"
.$txt['pets_train']."</th>
<td colspan='2'>"
.$this->trainMenu()."</td></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_rename']."</th>
<td colspan='2'>"
.$this->renameMenu()."</td>
<th colspan='1' width='10%'>"
.$txt['pets_describe']."</th>
<td colspan='2'>"
.$this->describeMenu()."</td></tr></table><br />";
}

//Skills menu. Called by avove function. Used to make things nicer.
function skillsMenu() {
global $txt$scripturl;
$this->load_breed();
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=skills;pet=".$this->id."'><select name='skill'>";
$cnt 0;
for ($i 0$i $this->skills_cnt$i++) {
if ($this->skill[$i]->level_learn <= $this->level && $this->skill[$i]->cost <= $this->curap) {
$cnt++;
$returnstring .= "<option value=".$i." selected = 'selected'>".$this->skill[$i]->name." (Cost: ".$this->skill[$i]->cost."SP)</option>";
}
}
if ($cnt == 0) {
$returnstring $txt['pets_no_skills'];
}
else {
$returnstring .= "<input type='submit' value='{$txt['pets_use_skill']}'></form>";
}
}

//Train menu. Called by avove function. Used to make things nicer.
function trainMenu() {
global $txt$scripturl;
&#160;  $date = date('z');
&#160;  if ($date < 10) {
&#160;  $date = '00'.$date;
&#160;  }
&#160;  elseif ($date < 100) {
&#160;  $date = '0'.$date;
&#160;  }
&#160;  $date = date('y').$date.date('His');
if ($this->training == 1) {
if ($date $this->trainingend){
$middlestring $txt['pets_course_finish2'];
$command $txt['pets_train_pet'];
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
else{
$middlestring sprintf($txt['pets_course_taking'], $this->training_date($this->trainingend));
$command $txt['pets_train_pet'];
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
}
}
else {
$middlestring $txt['pets_train_cost'].formatMoney($this->calcTrainCost());
$command $txt['pets_train'];
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
return $returnstring;
}

//Rename. Called by avove function. Used to make things nicer.
function renameMenu() {
global $txt$scripturl;
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=rename;pet=".$this->id."'>";
$returnstring .= "<input type='text' name='newname' value='{$this->name}'>";
$returnstring .= "<input type='submit' value='{$txt['pets_rename']}'></form>";
return $returnstring;
}

//Describe menu. Called by avove function. Used to make things nicer.
function describeMenu() {
global $txt$scripturl;
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=describe;pet=".$this->id."'>";
$returnstring .= "<input type='text' name='newname' value='{$this->desc}'>";
$returnstring .= "<input type='submit' value='{$txt['pets_describe']}'></form>";
return $returnstring;
}

//Training cost. Set to n * (n+1)*5 where n is the current level.
function calcTrainCost() {
return ($this->level) * ($this->level 1) * 4
}

//Using a skill
function use_skill($skillid 0) {
global $txt;
$this->load_breed();
$min_level $this->skill[$skillid]->level_learn;
$max $this->skill[$skillid]->level_max;
$cost $this->skill[$skillid]->cost;

if ($cost $this->curap) {
return $txt['pets_skill_no_power'];
}
elseif ($this->hunger 5) {
return $txt['pets_skill_hunger'];
}
elseif ($this->happy 5) {
return $txt['pets_skill_happy'];
}
else {
if ($this->level $min_level$chance 0;
elseif ($this->level $max$chance floor(100 * ($this->level $min_level) / ($max $min_level));
else $chance 100;
$rand mt_rand(1,100);
if ($rand $chance) {
$this->curap -= $cost;
return $txt['pets_skill_fail'];
}
else {
$this->curap -= $cost;
eval('$return = $this->use_skill_' $skillid '();');
return $return;
}
}
}

//Change a pets name
function rename_pet($newname 'No Name') {
$this->name $newname;
}

//Change a pets description
function redesc_pet($newdesc 'No Desc') {
$this->desc $newdesc;
}

//Store the values back into the database(very important)
function store_values() {
global $db_prefix;
$result db_query("UPDATE {$db_prefix}shop_pets
SET name = '
{$this->name}',
&#160; &#160; level = 
{$this->level},
&#160; &#160; curap = 
{$this->curap},
&#160; &#160; maxap = 
{$this->maxap},
&#160; &#160; happy = 
{$this->happy},
&#160; &#160; `desc` = '
{$this->desc}',
&#160; &#160; hunger = 
{$this->hunger},
&#160; &#160; age = 
{$this->age},
&#160; &#160; training = 
{$this->training},
&#160; &#160; trainingend = '
{$this->trainingend}',
&#160; &#160; ownerid = 
{$this->ownerid}
&#160; &#160; WHERE pet_id = 
{$this->id}"__FILE____LINE__);
}

//Load the values from the database(also important)
function load_values($id 0) {
global $db_prefix;
if ($id != 0) {
$result db_query("SELECT * FROM {$db_prefix}shop_pets
WHERE pet_id = 
{$id}"__FILE____LINE__);
$row mysql_fetch_assoc($result);
$this->name $row['name'];
$this->breed $row['breed'];
$this->desc $row['desc'];
$this->level $row['level'];
$this->curap $row['curap'];
$this->maxap $row['maxap'];
$this->age $row['age'];
$this->happy $row['happy'];
$this->hunger $row['hunger'];
$this->training $row['training'];
$this->trainingend $row['trainingend'];
$this->ownerid $row['ownerid'];
$this->id $row['pet_id'];
$this->load_breed();
}
}

//Advance a day(yay)
function advance_day() {
global $db_prefix;
$happy_loss mt_rand(1,4) - 1;
$hunger_loss mt_rand(1,2);
if ($this->happy $happy_loss 0$happy_loss $this->happy;
if ($this->hunger $hunger_loss 0$hunger_loss $this->hunger;
$this->happy $this->happy $happy_loss;
$this->hunger $this->hunger $hunger_loss;
$this->age++;
$this->curap $this->maxap;
}
&#160;  
&#160;  //Training a pet
&#160;  function train_pet() {
global $db_prefix$ID_MEMBER$txt;
&#160;  $date = date('z');
&#160;  if ($date < 10) {
&#160;  $date = '00'.$date;
&#160;  }
&#160;  elseif ($date < 100) {
&#160;  $date = '0'.$date;
&#160;  }
&#160;  $date = date('y').$date.date('His');
&#160;  if ($this->training != 1) {
&#160;  $cost = $this->calcTrainCost();
&#160;  $result = db_query("SELECT * from {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
&#160;  $row = mysql_fetch_assoc($result);
&#160;  if ($row['money'] < $cost) {
&#160;  return $txt['pets_no_train_money'];
&#160;  }
&#160;  else {
$result db_query("
UPDATE 
{$db_prefix}members
SET money = money - 
{$cost}
WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);
&#160;  $this->training = 1;
&#160;  $this->trainingend = $this->training_end($date);
&#160;  return sprintf($txt['pets_place_course'], $this->training_date($this->trainingend));
&#160;  }
&#160;  }
&#160;  else {
&#160;  if ($date > $this->trainingend) {
&#160;  $this->level++;
&#160;  if ($this->level == 10) $this->maxap++;
&#160;  if ($this->level == 30) $this->maxap++;
&#160;  if ($this->level == 60) $this->maxap++;
&#160;  if ($this->level == 100) $this->maxap++;
&#160;  $this->training = 0;
&#160;  return sprintf($txt['pets_course_finish'], $this->level);
&#160;  }
&#160;  else {
&#160;  return sprintf($txt['pets_course_taking'], $this->training_date($this->trainingend));
&#160;  }
&#160;  }
}

//Finding the ending training date
function training_end($date '00000000000') {
$train_hours $this->level 4;
$dates preg_split('//'$date); 
$cur_year $dates[1].$dates[2];
$cur_date $dates[3].$dates[4].$dates[5];
$cur_hour $dates[6].$dates[7];
$cur_minsec $dates[8].$dates[9].$dates[10].$dates[11];
$hour $cur_hour $train_hours;
$extra_days 0;
while ($hour >= 24) {
$hour $hour 24;
$extra_days++;
}
if ($hour 10) {
$hour "0".$hour;
}
$cur_date += $extra_days;
if (date('L') == && $cur_date >= 365) {
$cur_year++;
$cur_date $cur_date 365;
}
elseif (date('L') == && $cur_date >= 366) {
$cur_year++;
$cur_date $cur_date 366;
}
if ($cur_date 10) {
$cur_date '00'.$cur_date;
}
elseif ($cur_date 100) {
$cur_date '0'.$cur_date;
}
return $cur_year.$cur_date.$hour.$cur_minsec;
}

function training_date($date '00000000000') {
$dates preg_split('//'$date); 
$cur_year $dates[1].$dates[2];
$cur_date $dates[3].$dates[4].$dates[5];
$cur_hour $dates[6].$dates[7];
$cur_min $dates[8].$dates[9];
$cur_sec $dates[10].$dates[11];
$cur_hour++;
$month 1;
$cur_date++;
if ($cur_date 31) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 28 && date('L') == 0) {
$cur_date $cur_date 28;
$month++;
if ($cur_date 29 && date('L') == 1) {
$cur_date $cur_date 29;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 30;
$month++;
}
}
}
}
}
}
}
}
}
}
}
}
return date("H:i:s, F jS Y"mktime($cur_hour00$month$cur_date$cur_year));
}
}
}

//Simple class to handle skills
if (!class_exists('skill')) {
class skill {
var $level_learn 0;
var $level_max 0;
var $cost 1;
var $name 'Skill';
var $code 'return "This skill does nothing"';
}
}
?>

14
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 25, 2007, 10:02:18 am »
Here is an example code.  This is actually the code of the pets i have shown in my Screenshot.  I own 2 pets and both pets look the same.

Code: [Select]
<?php
if (!class_exists('pet_Terrier_pet')) { //Make sure name matches php file
class pet_Terrier_pet extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Terrier Dog'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'This is a Terrier Dog'//The description of the breed.
    
$this->price 5000//The price to purchase one of these pets
    
$this->breed_img 'terrier.jpg'//The img file of the breed
    
$this->skills_cnt 4//The number of skills the pet can use
        
    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Bark";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 3;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
$this->skill[1] = new skill;
$this->skill[1]->name "Learn to Sit";
$this->skill[1]->level_learn 2;
$this->skill[1]->level_max 4;
$this->skill[1]->cost 3;
$this->skill[2] = new skill;
$this->skill[2]->name "Learn to Rollover";
$this->skill[2]->level_learn 5;
$this->skill[2]->level_max 10;
$this->skill[2]->cost 8;
$this->skill[3] = new skill;
$this->skill[3]->name "Westminster Quality";
$this->skill[3]->level_learn 10;
$this->skill[3]->level_max 20;
$this->skill[3]->cost 20;
}

//Sample skill function. A different function is needed for each skill. Skill function should be named "use_skill_i" where i is that skills index.
//Code these skills like you would code the action part of items. Currently input cannot be given into skills. Sorry.
function use_skill_0() {
global $db_prefix$ID_MEMBER;
return "{$this->name} has learned to Bark on Command!";
}
function use_skill_1() {
global $db_prefix$ID_MEMBER;
$value mt_rand(30,600);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} has learned to sit and earned you ".formatMoney($value)." tokens!";
        }
        function 
use_skill_2() {
global $db_prefix$ID_MEMBER;
$value mt_rand(80,1600);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} has learned to rollover and earned you ".formatMoney($value)." tokens!";
}
function use_skill_3() {
global $db_prefix$ID_MEMBER;
$value mt_rand(200,4000);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} place in a Westminster Dog Show and earned you ".formatMoney($value)." tokens!";
}
}
}
?>

15
General SMFShop Discussion / Re: SMFPets is Finally Here (0.1 out)
« on: March 25, 2007, 07:48:50 am »
I am not one Level 3 as the picture shows, and I still dont have a Skills button for either of my pets and I dont understand why.  I had it when I first purchased my pet, i went to use it and it gave me a message saying it wasnt ready for it, so I went to train it.  I then purchased another pet, and it didnt come with a skill button at all.  The both look the same as my screenshot shows in the Use skills area.


Pages: [1] 2 3