DragonPrime - LoGD Resource Community

Modules, Themes and other customizations for your game => Completed Modules for version 1.x.x => Topic started by: MarcTheSlayer on May 04, 2009, 08:06:14 PM



Title: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on May 04, 2009, 08:06:14 PM
Pet Shop v4.0.1

This is a heavily modified version of the module 'petshop v3.81 by Eth. It also uses modified code from the module 'wildpets' v2.1 by Eth, and contains the pets from the modules 'wildpets' and 'extrapets' v1.2 by Eth.

Changes:
  • I've separated the module into smaller files.
  • I've made use of allprefs to store the player's pet data. The player's pet data can be easily edited with the allprefs editor.
  • Fixed bugs and improved the code.
  • Added a breed age limit setting. Once a pet reaches this there's a chance of death.
  • Added a shop owner's name and changeable breed category settings.
  • If you find a wild pet in the forest/travelling and already have a pet, you can swap.
  • Pets that can attack can have their buffs renewed with a 'pet checkup'. Just like feeding your mount. A setting sets how many checkups per day a pet can get.
  • A forest/travelling event can have your pet find something which it will then go on to swallow. When this happens, any buff it had will no longer work and a checkup is required.
  • The editor is revamped.
  • The link to install the 'contained' pets will appear if in the editor you view an empty category.
  • Made some changes to the 'pets' table structure, renamed some columns, added a few and dropped one.

Update:
10/05/09 - v4.0.1
+ Improvements to update code and elsewhere.
+ New page to show list of players with pets. Admin link in player's bio to pet editor.
+ Fixed a bug that tried to take money from you for a gift. Thanks Aura. :)

A clean install should be fine.

To update from 'petshop' v3.81, just simply upload the new files to the server, and the update should happen automatically once it's detected that the files are different.

However....

Before installing, please backup your 'pets' table!

If you wish to see it in action, then check out my sig. Feel free to send a petition asking for a demonstration pet. :)

Feedback, bugs, questions welcomed. :)

Zip file attached.


Title: Re: Pet Shop v4.0.1
Post by: MarcTheSlayer on May 10, 2009, 08:54:33 AM
New version now available. Give it a try and tell me what you think. :)

kaizerDRAGON, found a bug in "modules/petshop/run/case_finalbuy.php", a missing comma. Fixed and uploaded under the same version. v4.0.1


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: jerry on August 24, 2009, 05:43:08 AM
Small Change that'd be useful (for my server, it is)

modules/petshop/run/case_viewpets.php
Find: addnav("View Pets");
Code:
addnav('View Pets');
if( !empty($count_cats) )
{
foreach( $categories as $key => $value )
{
$sql = "SELECT petid from `pets` WHERE petcat = '$key' AND ( petrace = '{$session['user']['race']}' OR petrace = 'All' ) AND petdk <= '{$session['user']['dragonkills']}'";
$result = db_query($sql);
$count = db_num_rows($result);
if ($count > 0){
addnav(array('%s',$value),'runmodule.php?module=petshop&op=viewpets&cat='.$key);
}
}
}

This will only display the category if the cat contains the requirements set when a pet has been created. Race + Dk. otherwise, like i had.... over 15 categories, half of the cats were blank for players since they didn't meet the DK/Race requirement for all the pets in some cat. So they had to annoyingly click trough all many cats.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on August 24, 2009, 06:11:36 AM
Maybe it would be better to add a DK and Race column to the table so they can see all pets, even ones that they can't have?


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: jerry on August 24, 2009, 06:18:58 AM
yes, actually that would be better ^^ also, instead of not displaying the nav, what we can do is

addnav("Pet Name","");
then the player will know they can't have that pet because of X reason.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on August 24, 2009, 06:28:19 AM
Should a player be able to gift a pet even though they themselves don't met the requirements to buy it?

I think so, might add that in. :)

The reason it is the way it is at the moment was because I thought it best to have new pets appear to them as they progressed through the game. But maybe seeing pets they can't yet have will encourage the player to work for them more?

Or I could make it more like the stables. Show all the pets in a book, but only make available the pets that the player can actually have at that moment in time?


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: jerry on August 24, 2009, 06:48:53 AM
The reason i switched to this module from stables (completely blocked on my server) is its much easier to add + more user friendly. Making it more like the stables would make this module useless ;)

Could we perhaps add a extra 10% to the price if a player wants to gift? That's what i've modded :D since we have cheaters here too. Making alts >.>

15 cats
143 pets ;)


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on August 24, 2009, 07:07:29 AM
The buff section when editing a mount is more advanced then with the pets. When I was making the changes I still wanted pets to be secondary to mounts and therefore "not as powerful".

The next version has code that allows your pet to emote for role playing purposes. :)


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: sephy mccaw on June 30, 2011, 02:49:02 AM
I have found a problem with this module.

When trying to gift a pet and the user has more then the dk requirment, it still says the user fails to meet that requirment.

Any help appreciated
Sephy McCaw


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on June 30, 2011, 02:00:03 PM
Does the pet have a race requirement?


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: sephy mccaw on July 01, 2011, 03:46:44 AM
Nope, the pets are available to all races on the server, have tried setting it to no race and to seperate ones, they all say that the user failed the DK requirment even with pets that require 0 DKs to gift


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: RaynDarren on January 03, 2012, 02:14:33 AM
Forgive me for bringing up an old topic, but, 3 things....

1. I LOVE this new version!! GREAT job Marc!
2. It would be great to have a setting to allow a catagory to not be available for purchase by the general public.
3. Did the gift thing ever get fixed?

Thanks!
~Rayn


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on January 03, 2012, 03:44:02 AM
My sincerest apologies. I had fixed the gifting a pet bug back in April 2010, but because I was in the middle of making changes to the module, changes I never got around to finishing, the new version was never uploaded. :(

To fix the bug.

Code:
#
#-----[ OPEN ]-----
#
root/modules/petshop/run/case_giftpet.php

#
#-----[ FIND ]-----
#
# Line: 77
$dkreq = translate_inline('DK Requirement');

#
#-----[ REPLACE WITH ]
#
$dkrequire = translate_inline('DK Requirement');

#
#-----[ FIND ]-----
#
# Line: 83
<td align=\"center\">$dkreq</td>

#
#-----[ REPLACE WITH ]
#
<td align=\"center\">$dkrequire</td>

#
#-----[ SAVE ]-----
#

The only other bug that was fixed had to to do with the 'clues' module.
Code:
#
#-----[ OPEN ]-----
#
root/modules/petshop/run/case_.php

#
#-----[ FIND ]-----
#
if( httpget('loc') == 'village' )
{

#
#-----[ AFTER, ADD ]
#
httpset('op','entershop',TRUE); // For clues module.

#
#-----[ SAVE ]-----
#

I'll need to check over the version I was working on to fix/finish parts before I can upload it.

Rayn, thanks for the compliment. :-) There is a fixed category called storage which is where you can move pets when you don't want them to be purchased and or for testing the pets. Only superusers with the developer flag can see this category. :-)


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: RaynDarren on January 03, 2012, 04:23:22 AM
Ah wonderful! Thanks soooo much!


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: RaynDarren on January 04, 2012, 10:19:57 PM
Forgive the double post, but I found a bug and wanted it to be noticed.... and I have a question :)

First the bug:
The (editor) display table is not showing the "Attacks" field correctly. No matter what it is set to it still shows 'No'.

Now the question:
I'd love to have the default (when entering the editor) be a listing of all the pets. 

lines 229-231:
{   // Failsafe.
            addnav('Display Common',$from.'&op2=view&cat=0');
         }
What would I change the cat= to?

Thanks!
~Rayn


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: topdog2046 on September 15, 2014, 06:20:04 PM
For some reason the pet shoppe mod is displaying raw code when users save their pet name and gender.
I doubt that this is suppose to happen.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: Aeolus on September 15, 2014, 06:40:50 PM
For some reason the pet shoppe mod is displaying raw code when users save their pet name and gender.
I doubt that this is suppose to happen.

* The Doctor is confused.

Are you using this Pet Shop, or Eth's v3.81?


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: topdog2046 on September 15, 2014, 06:49:50 PM
My apologies. Using this new petshop mod. Version 4.01 direct from this topic.
The pets save fine, when users save them, but it says stuff like array, etc, and users see this.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: Aeolus on September 15, 2014, 06:52:18 PM
Can you attach a screenshot or copy the code being displayed? Also, the error for v3.81, since I've fixed it before but can't seem to remember what the error was exactly.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: topdog2046 on September 15, 2014, 07:54:15 PM
Can you attach a screenshot or copy the code being displayed? Also, the error for v3.81, since I've fixed it before but can't seem to remember what the error was exactly.

I do wish I could have the error be reproducible but, it doesn't seem to come up again.
And as far as V3.81, there was never any error for me, it just never inserted the pets into the db.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: Aeolus on September 15, 2014, 08:02:45 PM
I do wish I could have the error be reproducible but, it doesn't seem to come up again.
And as far as V3.81, there was never any error for me, it just never inserted the pets into the db.

The second error I was talking about was the modification I requested to see what was wrong.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on September 16, 2014, 05:26:42 AM
For some reason the pet shoppe mod is displaying raw code when users save their pet name and gender.
I doubt that this is suppose to happen.

Reupload the files again. Sounds like a bad file.


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: Dax on July 14, 2015, 04:50:32 PM
The (editor) display table is not showing the "Attacks" field correctly. No matter what it is set to it still shows 'No'.

Does anyone know a fix for this? I'm having the same issue, and I've searched and googled and lxquick'd to no avail.. :(


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: MarcTheSlayer on July 17, 2015, 03:21:57 PM
Sorry, I haven't look at this module or even done any coding in years. :(


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: Boris735 on July 18, 2015, 04:57:41 AM
Disclaimer: I have only looked at the code, not installed or tested it.

The (editor) display table is not showing the "Attacks" field correctly. No matter what it is set to it still shows 'No'.

This seems to be because the appropriate field is not being extracted from the database.  I would suggest trying the following:

In petshop/run/case_editor.php, find this code:

Code:
if( $op2 == 'view' )
{
$sql = "SELECT petid, pettype, petwild, petrace, petdk, valuegold, valuegems
FROM " . db_prefix('pets') . "
WHERE petcat = '$cat'
ORDER BY valuegold+0, valuegems+0 DESC, pettype DESC";

and change the first line of the $sql assignment to simply:

Code:
$sql = "SELECT *

so that the above code would now read:

Code:
if( $op2 == 'view' )
{
$sql = "SELECT *
FROM " . db_prefix('pets') . "
WHERE petcat = '$cat'
ORDER BY valuegold+0, valuegems+0 DESC, pettype DESC";


Title: Re: Pet Shop v4.0.1 (Modified)
Post by: TGTarheel on January 13, 2018, 02:25:58 PM
This works for me whereas the old Pets Shop module did not.

However, one weird thing I notice...no matter WHAT you set the attack to, No, Yes-Automatic or Yes-Manual - in the Pet Editor list they all show up as Attacks NO

Thinking they should show up as NO, Manual, Automatic.

© 2019 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines