Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #41  
Old 08-15-2014, 11:09 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 45,891
Missy Master is an unknown quantity at this point
Default

In class_ownedadoptable, you can see where the items are designated.


The only reason I can think for an item -- any item-- to work and work and then cut off, is that some barrier is being reached.


Code:
<?php



class OwnedAdoptable extends Adoptable{



    protected $aid;

	protected $name;

	protected $owner;

	protected $currentlevel;

	protected $totalclicks;

	protected $code;

	protected $imageurl;

	protected $usealternates;

	protected $tradestatus;

	protected $isfrozen;  

    protected $gender;

	protected $offsprings;

    protected $lastbred;

	protected $nextlevel;

	protected $voters;

        protected $statname;

protected $mother;

protected $father;

	
protected $toy_1;

protected $toy_2;

protected $toy_3;

protected $toy_4;

protected $toy_5;



protected $unique;


protected $adoptablepersonality;

  

    public function __construct($aid, $owner = ""){	  

	    $mysidia = Registry::get("mysidia");

		$whereClause = "aid ='{$aid}'";

		if(!empty($owner)) $whereClause .= " and owner = '{$owner}'";

	    $row = $mysidia->db->select("owned_adoptables", array(), $whereClause)->fetchObject();

        if(!is_object($row)) throw new AdoptNotfoundException("Pet{$adoptinfo} does not exist or does not belong to the owner specified...");

		

		parent::__construct($row->type);

        foreach($row as $key => $val){

            $this->$key = $val;     		 

        }	  

    }



    public function getAdoptID(){

        return $this->aid;

    }



    public function getName(){

        return $this->name;

    }

	
public function getAdoptstatname(){

return $this->statname;

}



public function getAdoptPersonality(){

return $this->personality;
}




	public function setName($name, $assignMode = ""){

		if($assignMode == Model::UPDATE) $this->save("name", $name);

	    $this->name = $name;

	}



    public function getOwner($fetchMode = ""){

	    if($fetchMode == Model::MODEL) return new Member($this->owner);

        else return $this->owner;

    }

	

	public function setOwner($owner, $assignMode = ""){

		if($assignMode == Model::UPDATE) $this->save("owner", $owner);

	    $this->owner = $owner;

	}

  

    public function getCurrentLevel($fetchMode = ""){

	    if($fetchMode == Model::MODEL) return new AdoptLevel($this->type, $this->currentlevel);

        else return $this->currentlevel;

    }

	

	public function setCurrentLevel($level, $assignMode = ""){

		if($assignMode == Model::UPDATE){

		    $this->save("currentlevel", $level);

			if($this->getAltStatus() == "yes") $this->save("usealternates", "yes");

		}

		$this->currentlevel = $level;

	}

	

	public function getTotalClicks(){

	    return $this->totalclicks;

	}

	

	public function setTotalClicks($clicks, $assignMode = ""){

		if($assignMode == Model::UPDATE) $this->save("totalclicks", $clicks);

		$this->totalclicks = $clicks;

	}

	

	public function getCode(){

	    return $this->code;

	}

	

	public function getImageURL($fetchMode = ""){

        if($fetchMode == Model::GUI) return new Image($this->imageurl);

	    else return $this->imageurl;

	}

	

	public function useAlternates(){

	    return $this->usealternates;

	}

	

	public function getTradeStatus(){

	    return $this->tradestatus;

	}

	

	public function getUnique(){

	    return $this->unique;

	}




	public function getMother(){

	    return $this->mother;

	}



	public function getFather(){

	    return $this->father;

	}




	public function getToy_1(){

	    return $this->toy_1;

	}

public function getToy_2(){

	    return $this->toy_2;

	}


public function getToy_3(){

	    return $this->toy_3;

	}



public function getToy_4(){

	    return $this->toy_4;

	}


public function getToy_5(){

	    return $this->toy_5;

	}



	public function setTradeStatus($status, $assignMode = ""){

		if($assignMode == Model::UPDATE) $this->save("tradestatus", $status);

	    $this->tradestatus = $status;

	}

	

	public function isFrozen(){

	    return $this->isfrozen;

	}

	

	public function setFrozen($frozen = TRUE, $assignMode = ""){

		if($assignMode == Model::UPDATE) $this->save("isfrozen", $frozen);

		$this->isfrozen = $frozen;

	}

	

	public function getGender($fetchMode = ""){

	    if($fetchMode == Model::GUI) return new Image("picuploads/{$this->gender}.png");

	    else return $this->gender;

	}

	

	public function getOffsprings(){

	    return $this->offsprings;

	}

	

	public function setOffsprings($offsprings = 1, $assignMode = ""){

		$this->offsprings = $offsprings; 

	    if($assignMode == Model::UPDATE) $this->save("offsprings", $this->offsprings);

	}

	

	public function getLastBred($fetchMode = ""){

	    if($fetchMode == Model::OBJ) return new DateTime($this->lastbred);

	    return $this->lastbred;

	}

	

	public function setLastBred($lastBred = 0, $assignMode = ""){

		if($assignMode == Model::UPDATE) $this->save("lastbred", $lastBred);

		$this->lastbred = $lastBred;    

	}

  

    public function getAltStatus(){

		if($this->alternates == "enabled" and $this->currentlevel == $this->altoutlevel){

			$rand = mt_rand(1, $this->altchance);

			if($rand == 1) return "yes";			

		}

		return "no";

    }

	

	public function getImage($fetchMode = ""){

		if($this->imageurl and $this->currentlevel >= 3) return $this->getImageUrl($fetchMode);

		if($this->currentlevel == 0) return $this->getEggImage($fetchMode);

		

		$mysidia = Registry::get("mysidia");		

        $level = $this->getCurrentLevel("model");

		if($this->useAlternates() == "yes") return $level->getAlternateImage($fetchMode);

        else return $level->getPrimaryImage($fetchMode);			

    }

  

  	public function hasNextLevel(){

	    try{

			$this->nextlevel = new AdoptLevel($this->type, $this->currentlevel + 1);

			return TRUE;

		}

		catch(LevelNotfoundException $lne){

		    return FALSE;

		}

	}

	

	public function getNextLevel(){

	    if(!$this->nextlevel) return FALSE;

	    return $this->nextlevel;

	}

	

	public function getLevelupClicks(){

	    if(!$this->nextlevel) return FALSE;

		return $this->nextlevel->getRequiredClicks() - $this->totalclicks;

	}

	

	public function getStats(){

		$mysidia = Registry::get("mysidia");

		$document = $mysidia->frame->getDocument();	

	    $stats = new Division("adoptstats");

		
		
        $stats->add(new Image("picuploads/{$this->toy_1}.png"));

        $stats->add(new Image("picuploads/{$this->toy_2}.png"));;

        $stats->add(new Image("picuploads/{$this->toy_3}.png"));;
  
        $stats->add(new Image("picuploads/{$this->toy_4}.png"));;

        $stats->add(new Image("picuploads/{$this->toy_5}.gif"));;





		$stats->add(new Comment("<br><br><b>Total Boosts: {$this->totalclicks}"));


		if($this->hasNextLevel()){

		    $level = $this->getNextLevel();

			$levelupClicks = $this->getLevelupClicks();

			$nextLevel = $level->getLevel().$mysidia->lang->clicks.$levelupClicks; 

		}

		else $nextLevel = $mysidia->lang->maximum;


$stats->add(new Comment("Gender: ", FALSE));

        $stats->add(new Image("picuploads/{$this->gender}.png"));
		

		$adoptStats =      "<br>Trade Status: {$this->tradestatus}<br>

                                        Father: {$this->father}<br>

                                        Mother: {$this->mother}<br>

                                        Value: {$this->statname}<br>

                                        Unique: {$this->unique}<br>
                                       

				        Current Status: {$this->currentlevel}<br>Next Status: {$nextLevel}</b>";

		$stats->add(new Comment($adoptStats));

        return $stats;		

	}

	

	public function hasVoter($user, $date = ""){

	    if(!$date) $date = new DateTime;		

		$mysidia = Registry::get("mysidia");

		

		if($user instanceof Member){		    

			$whereClause = "adoptableid='{$this->aid}' and username = '{$user->username}' and date = '{$date->format('Y-m-d')}'";

		}

		else{

		    $ip = secure($_SERVER['REMOTE_ADDR']);

		    $whereClause = "adoptableid='{$mysidia->input->get("aid")}' and ip = '{$ip}' and date = '{$date->format('Y-m-d')}'";

		}	

		

	    $void = $mysidia->db->select("vote_voters", array("void"), $whereClause)->fetchColumn();

        if(is_numeric($void)) return TRUE;

        else return FALSE;		

	}

	

	protected function save($field, $value){

		$mysidia = Registry::get("mysidia");

		$mysidia->db->update("owned_adoptables", array($field => $value), "aid='{$this->aid}'");

	}

}

?>
Reply With Quote
  #42  
Old 08-15-2014, 11:09 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,965
Abronsyth is on a distinguished road
Default

Here's my inventory.php;
PHP Code:
<?php

class InventoryController extends AppController{

    const 
PARAM "confirm";
    private 
$view;
    private 
$subController;

    public function 
__construct(){
        
parent::__construct("member");
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$document->setTitle($mysidia->lang->inventory);
        
        
$inventory = new Inventory($mysidia->user);
        if(
$inventory->gettotal() == 0) throw new InvalidIDException($mysidia->lang->inventory_empty);
        
$inventory->display();
    }
            
    public function 
uses(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$item = new PrivateItem($mysidia->input->post("itemname"), $mysidia->user->username);   
        if(
$item->iid == 0) throw new InvalidIDException("It appears that you do not have this item in your inventory.");
        
        if(
$mysidia->input->post("aid")){
            if(!
$item->checktarget($mysidia->input->post("aid")) or $mysidia->input->post("validation") != "valid"){
                
$document->setTitle($mysidia->lang->use_title);
                
$document->addLangvar($mysidia->lang->use_fail);
            }
            elseif(!
$item->randomchance()){
                
$item->remove();
                
$document->setTitle($mysidia->lang->badluck);
                
$document->addLangvar($mysidia->lang->effect);
            }
            else 
$item->apply($mysidia->input->post("aid")); 
            return;            
        }
        
        
$document->setTitle($mysidia->lang->select_title);
        
$document->addLangvar($mysidia->lang->select);
        
        
$chooseFrom = new Form("chooseform""uses""post");
        
$adoptable = new DropdownList("aid");
        
        
$ids $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}'")->fetchAll(PDO::FETCH_COLUMN);    
        
$names $mysidia->db->select("owned_adoptables", array("name"), "owner = '{$mysidia->user->username}'")->fetchAll(PDO::FETCH_COLUMN);
        
$adoptable->add(new Option("None Selected""none"));
        
$adoptable->fill($names$ids);
        
        
$chooseFrom->add($adoptable);
        
$chooseFrom->add(new PasswordField("hidden""itemname"$mysidia->input->post("itemname")));
        
$chooseFrom->add(new PasswordField("hidden""validation""valid"));
        
$chooseFrom->add(new Button("Choose this Adopt""submit""submit"));
        
$document->add($chooseFrom);
    }
    
    public function 
sell(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$item = new PrivateItem($mysidia->input->post("itemname"), $mysidia->user->username);   
        if(
$item->iid == 0) throw new InvalidIDException("It appears that you do not have this item in your inventory.");
        
        if(!
$mysidia->input->post("quantity")){
            
$document->setTitle($mysidia->lang->global_action_title);
            
$document->addLangvar($mysidia->lang->sell_empty);
        }
        elseif(
$item->quantity $mysidia->input->post("quantity")){
            
$document->setTitle($mysidia->lang->global_action_title);
            
$document->addLangvar($mysidia->lang->sell_quantity);
        }
        else{
            
$item->sell($mysidia->input->post("quantity"));
            
$document->setTitle("Transaction Completed");
            
$document->addLangvar("{$mysidia->lang->sell}{$mysidia->input->post("quantity")} {$mysidia->input->post("itemname")} {$mysidia->lang->sell2}");
        }    
    }
    
    public function 
toss(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$item = new PrivateItem($mysidia->input->post("itemname"), $mysidia->user->username);  
        if(
$item->iid == 0) throw new InvalidIDException("It appears that you do not have this item in your inventory.");
        
        if(
$mysidia->input->get("confirm")){
            
$item->toss();
            
$document->setTitle($mysidia->lang->global_action_complete);
            
$document->addLangvar($mysidia->lang->toss.$mysidia->input->post("itemname").$mysidia->lang->toss2);
            return;
        }
        
        
$warning "Are you sure you wish to toss {$mysidia->input->post("itemname")}?<br> 
                    It will be permanently removed from your inventory, and this action cannot be undone!<br>"
;
        
$document->setTitle("Confirm your Action");
        
$document->add(new Comment($warning));    

        
$confirmForm = new FormBuilder("confirmform""toss/confirm""post");
        
$confirmForm->buildPasswordField("hidden""action""toss")
                    ->
buildPasswordField("hidden""itemname"$mysidia->input->post("itemname"))
                    ->
buildButton("Please Toss""confirm""confirm");
        
$document->add($confirmForm);            
    }
}
?>
Reply With Quote
  #43  
Old 08-15-2014, 11:11 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 45,891
Missy Master is an unknown quantity at this point
Default

It's only on SIMMLAND yes .. Canis and Felis are diff scripts.

Yes I will test it on yours, on Caterpillar ?
Reply With Quote
  #44  
Old 08-15-2014, 11:16 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,903
Hwona is on a distinguished road
Default

@Annatar
Please do. :3 I've done it over 50 time on canis - that's working...
wait, are they both using mysidia?
Edit: can you post a link to simmland
__________________
Reply With Quote
  #45  
Old 08-15-2014, 11:20 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 45,891
Missy Master is an unknown quantity at this point
Default

Canis and Felis both use my own heavily modded version of the old script.

Only Simmland uses Mysidia right now, but it's going to be used for all my upcoming sites so getting this to work is critical.

So yeah, if you can do this on Simmland that would be great :)

And I am off to Caterpillar to try !
Reply With Quote
  #46  
Old 08-15-2014, 11:21 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,903
Hwona is on a distinguished road
Default

Quote:
Originally Posted by Annatar View Post
Canis and Felis both use my own heavily modded version of the old script.

Only Simmland uses Mysidia right now, but it's going to be used for all my upcoming sites so getting this to work is critical.

So yeah, if you can do this on Simmland that would be great :)

And I am off to Caterpillar to try !
Link to simmland please?
__________________
Reply With Quote
  #47  
Old 08-15-2014, 11:26 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 45,891
Missy Master is an unknown quantity at this point
Default

Wallie... you have a seriously gorgeous and well laid out site, I just had to comment :)

Just really beautifully laid out!


http://sim-life.com/Simmland
Reply With Quote
  #48  
Old 08-15-2014, 11:31 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,903
Hwona is on a distinguished road
Default

@Annater
Thank you! Umm, I'm testing right now...
__________________
Reply With Quote
  #49  
Old 08-15-2014, 11:41 AM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 45,891
Missy Master is an unknown quantity at this point
Default

It took me a good many tries, but boy, once it goes bad, there's no making it good again without making a new account D:
Reply With Quote
  #50  
Old 08-15-2014, 11:42 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,903
Hwona is on a distinguished road
Default

Quote:
Originally Posted by Annatar View Post
It took me a good many tries, but boy, once it goes bad, there's no making it good again without making a new account D:
So how did it go? I tested over 60 times on simmland...
@Abronsyth
Apparently, there IS a difference in our code.
Here:
https://www.diffchecker.com/diff
Check this out with our codes... it looks like things are in different positions.
__________________

Last edited by Hwona; 08-15-2014 at 11:45 AM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mys v1.3.4 Item Shop Mod(s): NPC + Item Display + Tooltips Kyttias Mys v1.3.x Mods 55 06-19-2020 11:21 AM
Buy X of Item A to receive X of Item B AndromedaKerova Suggestions and Feature Requests 0 11-09-2014 08:17 PM
Using Item Error Abronsyth Questions and Supports 3 03-29-2013 06:43 PM
Parse error: syntax error, unexpected T_ELSE in /home/.nyles/ Saphira Questions and Supports 11 05-26-2009 11:45 AM


All times are GMT -5. The time now is 08:27 AM.

Currently Active Users: 9599 (0 members and 9599 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636