Author Topic: SMFPets is Finally Here (0.1 out)  (Read 107381 times)

Offline inkstains

Re: SMFPets is Finally Here (0.1 out)
« Reply #120 on: March 23, 2007, 10:24:47 am »
by feeding them and it gets reset/topped up every 24hrs or something like that i believe

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #121 on: March 24, 2007, 01:54:01 pm »
is it normal for the use skill area to disappear?

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #122 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.


Offline inkstains

Re: SMFPets is Finally Here (0.1 out)
« Reply #123 on: March 25, 2007, 09:46:04 am »
is it just that pet or all of them? i'd check your pets php file and make sure everything is right and the skill cnt is correct

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #124 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!";
}
}
}
?>

Offline inkstains

Re: SMFPets is Finally Here (0.1 out)
« Reply #125 on: March 25, 2007, 10:19:21 am »
your pet looks fine

i'd check whatever other modifications to code you might have made in pet_engine.php or anywhere else but i'd start there otherwise wait till feeble or Basil Beard see this they'll know what's happening

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #126 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"';
}
}
?>

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #127 on: March 25, 2007, 01:26:46 pm »
I donno why the skills are not showing up. Everything looks fine to me. Sorry. Try uploading the basic pet and seeing if that has skills...
Arrrrr!

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #128 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

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #129 on: March 25, 2007, 09:17:33 pm »
You could always download the 0.0 version. But seriously... it shouldn't be doing this. It should show all skills that you have the power to use and the level to use. So you should see some skills. o_0 The fact that you do not even get the "no skills" message is equally troubling.
Arrrrr!

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #130 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?

Offline littleone

Re: SMFPets is Finally Here (0.1 out)
« Reply #131 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>

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #132 on: March 26, 2007, 02:23:29 am »
Yeah. I know. I just donno what is causing said error. $cnt should be non-zero(because you have skills) so everything should work.

Is anyone else having a problem with 0.1?
Arrrrr!

Offline GhostWriter

Re: SMFPets is Finally Here (0.1 out)
« Reply #133 on: March 26, 2007, 02:51:44 am »
My permissions are my only problem...I can't do anthing with pets...

Offline Lady Ambrosia

Re: SMFPets is Finally Here (0.1 out)
« Reply #134 on: March 26, 2007, 03:02:32 am »
I'm not having any troubles with skills, I used one on my pet, and it came up like it was supposed to.  So far so good in my neck of the woods.
Ambrosia's Castle - My Personal Site
The Dark Castle - My Forum
Avatar by:  Me