Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Untradeable Single Species: How? (http://www.mysidiaadoptables.com/forum/showthread.php?t=4715)

Kyttias 11-19-2014 12:37 PM

Untradeable Single Species: How?
 
How would I go about making a species be untradeable? Basically, I'm going to give the user a free pet at the start, they only get one of this special kind, and it needs to be untradeable and unable to be pounded, because I'll be calculating their progression (for story-driven events) based on the level of that one, special pet. If they were to lose it... my system crumbles.

Do I just add a column in the database to hold a marker saying if its the starter pet? And when its first adopted from the special page, it will get that marker? I could always set it to 'not for trade' on its creation, right? And then check if its the starter pet, and disappear away the option to change its trade status, and the link to pound it, from the pet management page?

Or is there a better way?

IntoRain 11-19-2014 01:54 PM

Yup, it's like that yes ^^ If you add a column to check if it's the starter pet, you can use just that variable to prevent the pet from leaving. Basically in every function that might try to change its trade status, pound it, etc. you need to check if it's the starter pet. Don't just make the options disappear btw, some people might try to access the link manually, so the verification has to be there before the database updates too

ilrak 11-30-2014 02:25 PM

Ooh this is a cool idea! If you're adding the column to the database, would it be INT or VARCHAR? I think I want to use something like this on my site too (since you start out with two fish to start your school).

IntoRain 11-30-2014 04:49 PM

Quote:

Originally Posted by ilrak (Post 31579)
Ooh this is a cool idea! If you're adding the column to the database, would it be INT or VARCHAR? I think I want to use something like this on my site too (since you start out with two fish to start your school).

Anything works, but I woudn't use varchar. If you don't want/can't use boolean, I'd go with an enum of true and false or an int (1 or 0)

Hall of Famer 12-01-2014 03:50 AM

Well an easier way is to do something similar to the items. For items they may be tradable or untradable depending on a value set in the database column 'tradable' in table prefix.items. The trade machine will scan for items that are not tradable, and block trade if this happens. Look for the code at trade.php and related class files such as class_trade.php and class_tradevalidator.php. They can give you some hint.


All times are GMT -5. The time now is 05:07 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.