Thread: Help with alts
View Single Post
  #1  
Old 04-11-2012, 01:03 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 113,256
SilverDragonTears is on a distinguished road
Default Help with alts

I use the altimage field for female images and the primary for male images so for the item alts1 to work, I added altm and altf into the levels table. Now I need to change this part of the code to work with it . I'll use one function for males and the other for females.

Code:
function items_alts1($item, $adopt){
  // First lets check if alternative image exists for an adoptable at this level.
  $lev = $GLOBALS['adopts']->select("levels", array(), "adoptiename='{$adopt->type}' and thisislevel ='{$adopt->currentlevel}'")->fetchObject();
  if($lev->altm == ""){
      // The alternate image does not exist, cannot convert adoptable into its alternate form
    $note = "It appears that your dragon does not have an alternate image at its given level...<br>";
  }
  else{
      // The alternate image exists, conversion between primary and alternate image is possible.
    switch($adopt->imageurl){
      case "yes": 
        $GLOBALS['adopts']->update("owned_adoptables", array("imageurl" => ''), "aid ='{$adopt->aid}' and owner='{$item->owner}'");		
        $note = "Your dragon has assumed the species primary form.";
        break;
      default:
        $GLOBALS['adopts']->update("owned_adoptables", array("imageurl" => '{$levels->altm}'), "aid ='{$adopt->aid}' and owner='{$item->owner}'");	   
        $note = "Your dragon {$adopt->name} has assume the species alternate form.";
    }
      //Update item quantity...
      $delitem = $item->removeitem(1, $item->owner);    
  }
  return $note;    
}
__________________

Check out SilvaTales
Reply With Quote