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

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #105 on: March 18, 2007, 10:33:53 pm »
A few other people have had problem with dirc. permissions. I dunno what causes them. A few ideas:

*Delete the old directories and then create the need directories manually.
If that doesnit work: Have the old directories pre-created and then re-install the mod.
If all else fails, install the mod by hand <_<
Arrrrr!

Offline GhostWriter

Re: SMFPets is Finally Here (0.1 out)
« Reply #106 on: March 19, 2007, 01:55:07 am »
Quote
Uninstall Actions
Uninstall Actions "SMFPets":
Installing this package will perform the following actions:  Type Action Description
1. Execute Modification ./Sources/ManagePermissions.php Test successful
2. Execute Modification ./Themes/default/Profile.template.php Test successful
3. Execute Modification ./Themes/default/languages/ManagePermissions.english.php Test successful
4. Execute Modification ./Themes/default/languages/Shop.english.php Test failed
5. Execute Modification ./Themes/default/Shop.template.php Test successful
6. Execute Modification ./Sources/shop/Shop.php Test successful
7. Execute Modification ./Sources/shop/Shop-Subs.php Test failed
8. Execute Modification ./Sources/Profile.php Test successful
9. Execute Code uninstallScript.php 
10. Delete Tree pets_breeds 
11. Delete Tree pet_images 
12. Delete File Shop-Pets.php 
13. Delete File pet_engine.php 
14. Delete File Cage.php 
15. Delete File Food.php
 

Thats the error I get when trying to uninstall the 0.0 mod....
I can't even delete the files manually.......Thpough all ans all this is an awesome mod an d I really want to get it working right......

Offline inkstains

Re: SMFPets is Finally Here (0.1 out)
« Reply #107 on: March 19, 2007, 02:15:39 am »
if you uninstall you can manually remove those entries from the ones that failed

in Shop.english.php you would need to remove this

Code: [Select]
//Text strings for pets
$txt['pets_adpot'] = 'You have adpoted a new %s... yay!';
$txt['pets_age'] = 'Age: ';
$txt['pets_breed'] = 'Breed: ';
$txt['pets_buy'] = 'Buy a %s!';
$txt['pets_central'] = 'Pet Central';
$txt['pets_cost'] = 'Cost: ';
$txt['pets_course_finish'] = 'Your pet has completed its course! It is now level %s!';
$txt['pets_course_taking'] = 'Your pet is still taking its course. Check back at %s.';
$txt['pets_days'] = '%s days.';
$txt['pets_describe'] = 'Describe your pet';
$txt['pets_description'] = 'Description ';
$txt['pets_do_stuff'] = 'Do stuff with your pet (Current Skill Points: ';
$txt['pets_find_name'] = 'Name for your new pet';
$txt['pets_happy'] = 'Happiness: ';
$txt['pets_hatchery'] = 'Pet Hatchery';
$txt['pets_hunger'] = 'Lack of Hunger: ';
$txt['pets_level'] = 'Level: ';
$txt['pets_name'] = 'Name: ';
$txt['pets_new_desc'] = 'Your pets description is now %s.';
$txt['pets_new_name'] = 'Your pet is now called %s.';
$txt['pets_no_pet'] = 'You do not have a pet right now. Head over to the <a href=%s?action=shop;do=hatchery>Hatchery</a> and adopt a pet!';
$txt['pets_no_train_money'] = 'You do not have enough money to train your pet!';
$txt['pets_not_yours'] = 'Nice try, wise guy, but that is not your pet!';
$txt['pets_place_course'] = 'You have placed your pet in the course. Check back at %s.';
$txt['pets_rename'] = 'Rename your pet';
$txt['pets_return_link'] = 'Click <a href=%s?action=shop;do=pets>here</a> to return to the pet menu';
$txt['pets_skill_fail'] = 'Try and it might, your pet fails to accomplish its skill. Try raising its level.';
$txt['pets_skill_happy'] = 'Your pet sits around doing nothing. Maybe your should cheer it up';
$txt['pets_skill_hunger'] = 'Your pet is too hungry to use that skill.';
$txt['pets_skill_no_power'] = 'You do not have enough power to use that skill.';
$txt['pets_talk_too_much'] = 'That pet costs too much!!!';
$txt['pets_too_many'] = 'You are not allowed any more pets!!!';
$txt['pets_train_pet'] = 'Level it up!';
$txt['pets_train'] = 'Train your pet';
$txt['pets_train_cost'] = 'Current training cost: ';
$txt['pets_use_skill'] = 'Use Skill';
$txt['pets_your_pets'] = 'Your pets';
$txt['pets_yourpet'] = 'Pet Central';
$txt['profile_show_pets'] = 'Show this member\'s pets';
$txt['profile_show_pets2'] = 'Member\'s Pets:';
$txt['shop_pet_page'] = 'Pet Central';

and in Shop-Subs.php remove this code

Code: [Select]
function check_Pets() {
global $db_prefix, $sourcedir, $modSettings;
$date = date('z');
if ($modSettings['shop_pets_date'] != $date) {
require($sourcedir . '/shop/pet_engine.php');
if ($handle = opendir($sourcedir . "/shop/pets_breeds/")) {
while (false !== ($file = readdir($handle))) {
if (substr($file, -4) == '.php')
{
// Get the breed name (file name without .php extension)
require($sourcedir . '/shop/pets_breeds/' . $file);
}
}
}
$result = db_query("SELECT * FROM {$db_prefix}shop_pets", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result)) {
eval('$temp = new pet_' . $row['breed'] . ';');
$temp->load_values($row['pet_id']);
$temp->advance_day();
$temp->store_values();
}
$result = db_query("UPDATE {$db_prefix}settings SET value = {$date} WHERE variable = 'shop_pets_date'", __FILE__, __LINE__);
}
}

thats if you feel confident to edit the files just make backups of them before you do so you can quickly recover if something goes awry


EDIT: Removing the above bits of code might not even be necessary but if it were me i would do it just in case
« Last Edit: March 19, 2007, 02:17:51 am by inkstains »

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #108 on: March 19, 2007, 02:46:29 am »
the package uninstalls fine for me. Did you apply any other changes to the code? o_0
Arrrrr!

Offline GhostWriter

Re: SMFPets is Finally Here (0.1 out)
« Reply #109 on: March 19, 2007, 04:39:14 am »
No other changes at all..Just installed them as you said and tried to add pets to them and couldn't upload anything, delete anything and then tried to uninstall and got that error. So I will try to uninstall and then manually uninstall the rest and maybe try a new install and if that don't work, I will manually install it to see if it works any better.

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #110 on: March 19, 2007, 05:36:13 am »
yeah. Sorry. I donno why it isn't uninstalling. =(
Arrrrr!

Offline TechnoDragon

Re: SMFPets is Finally Here (0.1 out)
« Reply #111 on: March 19, 2007, 04:46:27 pm »
for the issues with the directory permissions...I have been having similar issues with a mod I have been working on with some sites and the issue has been traced to the smf package manager chown when installing packages.  For some reason (haven't been able to trace the cause yet) it changes the owner of the directories which makes them effectively unusable for he forum.
Don't tell me to get into shape...I have a shape...It is round!


Offline inkstains

Re: SMFPets is Finally Here (0.1 out)
« Reply #112 on: March 19, 2007, 05:06:54 pm »
This is an item i did up it's based on Basil Beards food item but it increases the maxap of the pet at a random amount which you set when doing the item setup. hope it's useful for someone

I've included the icon i use for this item i called it power up so this image just seemed appropriate but you can use whatever it's got a transparent background as well so you won't have a white background or anything on a different theme

to use this just save it and upload to item_images folder and select it when you set up the item




EDIT: I'm only a beginner with php I've tested this as best i can and have run into no problems but if you spot a error or something post it up please not just to fix but so i can learn. cheers.


Make sure to save this file as PowerUp.php
Code: [Select]
<?php
/**********************************************************************************
* SMFShop item                                                                    *
***********************************************************************************
* SMFShop: Shop MOD for Simple Machines Forum                                     *
* =============================================================================== *
* Software Version:           SMFShop 3.0 (Build 12)                              *
* $Date:: 2007-01-18 19:26:55 +1100 (Thu, 18 Jan 2007)                          $ *
* $Id:: Steal.php 79 2007-01-18 08:26:55Z daniel15                              $ *
* Software by:                DanSoft Australia (http://www.dansoftaustralia.net/)*
* Copyright 2005-2007 by:     DanSoft Australia (http://www.dansoftaustralia.net/)*
* Support, News, Updates at:  http://www.dansoftaustralia.net/                    *
*                                                                                 *
* Forum software by:          Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2007 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version of the license can always be found at                        *
* http://www.simplemachines.org.                                                  *
**********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');

class 
item_PowerUp extends itemTemplate
{
function getItemDetails()
{
$this->authorName 'Inkstains - Modified from Basil Beard Food Item';
$this->authorWeb 'www.nomicville.com';
$this->authorEmail 'basilbeard@nomicville.com';

$this->name 'Power Up';
$this->desc 'Power Up for your pet!';
$this->price 400;

$this->require_input true;
$this->can_use_item true;
}

function getAddInput()
{
global $item_info$db_prefix;
return 'Minimum amount to increase maxap by: <input type="text" name="info1" value="' $item_info[1]  . '" /><br />
                        Maximum amount to increase maxap by: <input type="text" name="info2" value="' 
$item_info[2] . '" /><br />';
        }

function getUseInput()
{
global $db_prefix$ID_MEMBER;
                
$result db_query("SELECT numpets FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
$row mysql_fetch_assoc($result);
if ($row['numpets'] == 0) {
return "You have no pets. Using this item will simply cause it to die and you to lose money.";
}
$string .= "<select name = 'petid'>";
$result db_query("SELECT * FROM {$db_prefix}shop_pets WHERE ownerid = {$ID_MEMBER}"__FILE____LINE__);
while ($row mysql_fetch_assoc($result)) {
$string .= "<option value = '{$row['pet_id']}'>{$row['name']}</option>";
}
$string .= "</select>";
return "Select a pet to give this item to: ".$string;
}

function onUse()
{
global $db_prefix$ID_MEMBER$item_info;

if (!isset($_POST['petid'])) {
return "I told you it would die!";
}
else {
$value mt_rand($item_info[1], $item_info[2]);
                        
$result db_query("UPDATE {$db_prefix}shop_pets SET maxap = maxap + {$value} WHERE pet_id = {$_POST['petid']} AND ownerid = {$ID_MEMBER}"__FILE____LINE__);
$result db_query("SELECT * from {$db_prefix}shop_pets WHERE pet_id = {$_POST['petid']} AND ownerid = {$ID_MEMBER}"__FILE____LINE__);
$row mysql_fetch_assoc($result);
return "{$row['name']} eats the mushroom its maxap is now {$row['maxap']}!";

}
}
}
?>

« Last Edit: March 19, 2007, 05:57:26 pm by inkstains »

Offline GhostWriter

Re: SMFPets is Finally Here (0.1 out)
« Reply #113 on: March 20, 2007, 06:02:34 am »
Alright, I finally got it to uninstall without any problems. As I said before I would really like to use this mod, since a few of my members are interested in the pets and they seem to want to post more. So any suggestions on how I could get it installed and not have to worry about the permissions thing?

How would I manually install it?

Alexander

  • Guest
Re: SMFPets is Finally Here (0.1 out)
« Reply #114 on: March 20, 2007, 06:25:32 am »
Okay, you guys are having problem deleting the folders right (I'm a bit lost)?

I have this mod installed on my forums, I've had the same problem too. I just backed up the folder's contents then deleted the folder, made a new one through my ftp (and is deletable). It's able to chmod/delete when my FTP isn't.
http://custom.simplemachines.org/mods/index.php?mod=477

Offline tamibrown

Re: SMFPets is Finally Here (0.1 out)
« Reply #115 on: March 20, 2007, 06:35:17 am »
**NEVERMIND, FIGURED IT OUT**

Ok, mod installed fine.  Put a test pet up to try out.  I can buy it and everything is fine.  I named my file goldfish.php.  Evenryting is fine until I go into Pet Central.  Then I get this error:

Quote
Fatal error: Cannot redeclare class pet_goldfish in /home/content/a/t/w/atwfd07/html/smf/Sources/shop/pets_breeds/goldfish.php on line 3

What am I doing wrong?  Here is the code in my file (and yes,  I know I havent changed breed name or description or anything....this is a test one):

Code: [Select]
<?php
if (!class_exists(pet_goldfish.php)) { //Make sure name matches php file
class pet_goldfish extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Breed Name'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'Breed descrption'//The description of the breed.
    
$this->price 1//The price to purchase one of these pets
    
$this->breed_img 'goldfish.gif'//The img file of the breed
    
$this->skills_cnt 1//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 "Skill";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 2;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
}

//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 used it's skill!";
}
}
}
?>
[/s]
« Last Edit: March 20, 2007, 11:11:44 am by tamibrown »

Offline Lady Ambrosia

Re: SMFPets is Finally Here (0.1 out)
« Reply #116 on: March 20, 2007, 08:57:25 am »
Shop Starter Pets!!  This zip file has a few pet images and breeds (Bird, Cat, Dog, Fish, Lizard, and Monkey) and they all have one skill.  You are more than welcome to change the breed name, description, and how much they are, this is just to get you all started so run with it!! ;)

You can download the zip file here:  http://www.4shared.com/file/12563346/48be8657/Starter_Pets.html

You can view what I've done on my test forum here:  http://chatho4.100webspace.net/index.php
Login:  Test
Password:  Test



If you need help with image sizes so that the images show up with their actual size here's what you need to do:

In Sources/shop/pet_engine.php find the following (you will find this twice and you need to replace both):
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
Replace it with:
Code: [Select]
<img border='0' src='".$sourcedir."/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />

Then in Sources/shop/Shop-Pets.php find the following (you will only find this once):
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />
Replace it with:
Code: [Select]
<img border='0' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />

Enjoy!!!
Ambrosia's Castle - My Personal Site
The Dark Castle - My Forum
Avatar by:  Me

Offline Basil Beard

Re: SMFPets is Finally Here (0.1 out)
« Reply #117 on: March 20, 2007, 11:37:33 am »
Very nice =). Starter pets are something I'll eventually have, but just never bothered to include yet =P
Arrrrr!

Offline Lady Ambrosia

Re: SMFPets is Finally Here (0.1 out)
« Reply #118 on: March 20, 2007, 03:19:11 pm »
You're more than welcome to use these for later versions if you want Basil Beard ;)
Ambrosia's Castle - My Personal Site
The Dark Castle - My Forum
Avatar by:  Me

Offline tamibrown

Re: SMFPets is Finally Here (0.1 out)
« Reply #119 on: March 23, 2007, 09:03:27 am »
How does a pet earn more skill points after they use them?