Thread: Novul
View Single Post
  #17  
Old 11-11-2014, 02:44 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,567
Kyttias is on a distinguished road
Default

screenshots:
I've gotten quite a bit of work done the last few days~

I'm currently using this personality mod to display unique quirks about adoptables, generated from a random list at their creation. Thanks Wallie!

pet manage page (owner side):


changing adoptable trade status (rename similarly formatted):


clicking adoptable for the first time each day (everyone):


after you've visit an adoptable once (everyone):


shop - Crossed Roads (will display quest text if user has an adoptable above a set level)


shop - Spectrum (will display quest text if user owns a specific item)


When the requirements are not met to start the above quests, a random phrase is said instead, based on a supplied list for each shop. Different art/character expressions can be displayed based on the case context, too (currently during quests, but normal phrases could change the npc image as well, if desired). Because I'm generous, and it could prove useful, you're welcome to study the source code a little bit (just for the NPC display, nothing to do with how I have items displaying... and I don't even provide css, but perhaps you get the jist?).
PHP Code:
            #This changes the npc based on the current shop
            
switch ($this->shopname) {
                case 
"Crossed Roads"
                    
#Check if user has an adoptable at least lvl 1
                    
$mysidia Registry::get("mysidia");
                    
$req_lvl 1;
                    
$req_lvl_adopts $mysidia->db->select("owned_adoptables", array("aid"), "owner='{$mysidia->user->username}' and currentlevel >= {$req_lvl}")->rowCount();
                    
$strongest $mysidia->db->select("owned_adoptables", array(), "owner='{$mysidia->user->username}' and currentlevel >= {$req_lvl} limit 1")->fetchObject();
                    if (
$req_lvl_adopts) {  
                        
$catchphrase "Woah, your {$strongest->name} looks amazing at level {$strongest->currentlevel}! Say, could you do me a favor, {$mysidia->user->username}?";
                        
$npc_img "http://fc00.deviantart.net/fs71/f/2014/262/a/2/base_npc_60_by_kyttias-d7zqrnf.png";
                    }

                    else { 
#Normal visit
                    
$npc_img "http://fc00.deviantart.net/fs71/f/2014/262/a/2/base_npc_60_by_kyttias-d7zqrnf.png";
                    
#Based on the random number, sets a quote for $catchphrase
                    
$num Rand (1,6);   
                    switch (
$num) { 
                        case 
1$catchphrase "Time is money."; break; 
                        case 
2$catchphrase "Isn't icecream super?"; break; 
                        case 
3$catchphrase "Welcome to {$this->shopname}!"; break; 
                        case 
4$catchphrase "Off to see the wizard?"; break; 
                        case 
5$catchphrase "Tomorrow is another day..."; break; 
                        case 
6$catchphrase "PHP is cool!"; }
                    }    
                    break;
                case 
"Spectrum"
                    
#Check if have quest item
                    
$q_item_1 = new PrivateItem("Beta Icecream"$mysidia->user->username);
                    if (
$item->iid == or $q_item_1->quantity 1) {
                        
$catchphrase "You have Beta Icecream? <br/>Can I have some?";
                        
$npc_img "http://fc03.deviantart.net/fs71/f/2014/314/5/1/base_npc_2_60_2_by_kyttias-d85ygfs.png";
                    }

                    else { 
#Normal visit
                        
$npc_img "http://fc00.deviantart.net/fs70/f/2014/313/a/c/base_npc_2_60_by_kyttias-d85ww5k.png";    
                        
#Based on the random number, sets a quote for $catchphrase
                        
$num Rand (1,6);   
                        switch (
$num) { 
                            case 
1$catchphrase "What are you waiting for?"; break; 
                            case 
2$catchphrase "I bet half of these don't work."; break; 
                            case 
3$catchphrase "Welcome to {$this->shopname}."; break; 
                            case 
4$catchphrase "Are you going to buy something?"; break; 
                            case 
5$catchphrase "(Window shopping?)"; break; 
                            case 
6$catchphrase "..."; }
                    }
                    break;
                default: 
$npc_img "http://placekitten.com/g/200/500"$catchphrase "Welcome to {$this->shopname}";
            }
            
            
#This is the npc and their shop (typically random) catchphrase 
            
$document->add(new Comment("
                <div class='shop_npc'>
                    <div class='popover fade top in' id='npc_popover'>
                    <div class='arrow'></div><div class='popover-content' style='width: 220px; text-align: center;'>
                        
{$catchphrase}
                    </div></div>
                    <img src='
{$npc_img}'/>
                </div>"
$linebreak FALSE)); 
I'm rather proud of myself in regards to my placement of the shopkeeper npcs. Screens all the way down to 1024 widths, such as 10" and 12" Netbooks, and many decent size tablets in horizontal mode (Kindle Fire HD, Samsung Galaxy Tab, and all Apple iPads) will still display shopkeepers, albeit at a reduced size. Below these widths, shopkeepers and their text will simply not display.

__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 11-11-2014 at 03:29 AM.
Reply With Quote