Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Mys v1.3.4 Health and mood system + progress bars (http://www.mysidiaadoptables.com/forum/showthread.php?t=5263)

KatFennec 05-03-2017 04:47 AM

Quote:

Originally Posted by ffsharriet (Post 35602)
Can items be used to increase health or mood?

OK, so I'm trying to get this to work, and I would REALLY APPRECIATE if anyone in here could share whatever magic trick it takes to use an item to restore health. All I get is a white screen, every time.

Abronsyth 05-03-2017 09:37 AM

Ok, I made my own health system so I cannot garauntee that this will work, but here is my item function for health increasing items:
PHP Code:

 function items_health($item$adopt){
  
$mysidia Registry::get("mysidia");
  
$health $mysidia->db->select("owned_adoptables", array("health"), "aid ='{$adopt->aid}'")->fetchObject();
  
$addHealth $adopt->health $item->value;
      
//Check if the adoptable's health is already at maximum.    
  
if($adopt->health >= 100){
    
$note "Your pet is already fully healed! The {$item->itemname} was not used.";
  }
  
//Not at maximum, but don't go overboard!
  
elseif($addHealth 100){
    
$mysidia->db->update("owned_adoptables", array("health" => 100), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
    
$note "The {$item->itemname} fully healed your pet!";
    
$delitem $item->remove();
  }
  
//Not at maximum, won't go overboard. Proceed.
  
else{
    
$mysidia->db->update("owned_adoptables", array("health" => $addHealth), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
    
$note "The {$item->itemname} raised your pet's health by {$item->value}! Their health is now at {$addHealth}.";
    
$delitem $item->remove();
  }
  return 
$note;


(also need to edit classes/class_privateitem, and add the function in the database)

kristhasirah 05-16-2017 11:29 AM

just want to point out that the progress bar dont work in all the browsers, specially old ones, to "fix" this you need to create a div like progress bar :
https://css-tricks.com/html5-progress-element/ <-- there you will find the "fix" for that =)
in short you just need to add the css codes to your style.css and call them with the div:
PHP Code:

<progress max='100' value='{$health}'>
    <
div class="progress-bar">
        <
span style='width: 80%;'>Progress80%</span>
    </
div>
</
progress

just replace the 80% with the {$health} or the status you created and you need to add max-width: 100px(or the max value of the status); to the .progress-bar > span {

you might need to remove 1 or 2px from the max-width... sometimes the filled bar gets out of the container by that.

Missy Master 07-19-2020 10:05 PM

Epic Mod.

Thanks to all who worked so hard on this. I have it installed, so far so good, will make goodies to bring mood and health up tonight or tomorrow!


All times are GMT -5. The time now is 01:51 AM.

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