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
  #1  
Old 11-30-2014, 04:12 PM
ilrak ilrak is offline
Goldfish Fanatic
 
Join Date: Aug 2014
Location: Utah
Posts: 57
Gender: Female
Credits: 11,620
ilrak is on a distinguished road
Default Secondary currency questions

So, I think I've done pretty well with creating a secondary currency, but I'm still having a few issues.

First off, I can get the currency to display in the sidebar and drop when I level up an adoptable, but it drops at the same rate as the main currency, even though (I thought) I set it to drop at a lower rate.

I also can't get the currency to be differentiated in the shops. For example, I want a shop to only take once currency and another that takes the other.

I'm wondering where in the script I can go to edit these things (and prefferably un-link the two currencies so that they are independent of each other - When I went to test buy an item, it displayed that I only spent the one currency but both currencies decreased by the same amount).

Eventually, I'll want three currencies (one that can be purchased for RL money), but I need to fix these issues before I do anything with that.

Hopefully I'm making sense!
Reply With Quote
  #2  
Old 12-14-2014, 09:00 PM
ilrak ilrak is offline
Goldfish Fanatic
 
Join Date: Aug 2014
Location: Utah
Posts: 57
Gender: Female
Credits: 11,620
ilrak is on a distinguished road
Default

bumping this up. ^v^;
Reply With Quote
  #3  
Old 12-15-2014, 01:14 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,242
Kyttias is on a distinguished road
Default

Let me think... first, I would make a column in the shops table of the database to tell which shops which currency to use. Then, I would have to add a variable representing this new column at the top of classes/class_itemshop.php and classes/class_adoptshop.php. Next, in the same files, I would have to modify the public function purchase and check which currency the shop is using and reduce only the currency that shop is using. (It would be much harder to make a shop that utilizes both currencies at once, and even harder to have it so the same item can be bought with either. So let's just not go down that road right now, as it would involve making columns in the items table, then running running some sort of check or another when display the item buy form...)

As for the drop rate - the amount of currency dropped when visiting a pet is determined by the value column on the reward row of table levels_settings in the database. I would suggest making another row for your other currency to determine the drop rate for it. You'll need to reference to it in classes/class_levelsetting.php by creating a variable for it at the top. In the public function __construct, imitate what's going on with $this->reward with the name of your new variable. In levelup.php, at the end of public function click, imitate what's going on here for the original currency's $reward, one line at a time, each after the last. And finally, in view/levelupview.php, after $reward variable is set, do so with your second, new one as well.

I think that's all you should need to do. I hope that's enough hints. ^^
__________________
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; 12-15-2014 at 01:21 AM.
Reply With Quote
  #4  
Old 12-15-2014, 02:53 PM
ilrak ilrak is offline
Goldfish Fanatic
 
Join Date: Aug 2014
Location: Utah
Posts: 57
Gender: Female
Credits: 11,620
ilrak is on a distinguished road
Default

Thanks so much! When adding the currency options in the shop table, is it an INT type or something else? I'm going to play around with it, but I'm excited!
Reply With Quote
  #5  
Old 12-15-2014, 04:04 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,242
Kyttias is on a distinguished road
Default

INT is short for Integer values. Integer is a mathematical term and is just a fancy word for numbers. VARCHAR is short for Variable Character values, and can hold both numbers and letters. I'd go for VARCHAR with a length of 10 or so, unless your currency names are longer than 10 letters.
__________________
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.
Reply With Quote
  #6  
Old 12-15-2014, 04:09 PM
ilrak ilrak is offline
Goldfish Fanatic
 
Join Date: Aug 2014
Location: Utah
Posts: 57
Gender: Female
Credits: 11,620
ilrak is on a distinguished road
Default

Ok!

Also, how do I write the code to check which currency to use? I tried a couple of things that I thought would work (like a switch case) and failed (I'm a noob). Other than that, everything else seems to be working and easy!
Reply With Quote
  #7  
Old 12-15-2014, 04:41 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,242
Kyttias is on a distinguished road
Default

What are:
  • the names of both your currencies? (VAR_A, VAR_B)
  • the name of the column you added to the shop table (which would be the same as the variable name you added to the top of the page)? (VAR_C)
  • the name of the column in the users table that holds the amount of the secondary currency? (VAR_D)

I was thinking it'd be something vaguely like this?
public function purchase(Item $item){
$mysidia = Registry::get("mysidia");
if($item->owner != $mysidia->user->username) Throw new NoPermissionException('Something is very very wrong, please contact an admin asap.');
else{

if ($VAR_C == "VAR_A") {
$item->quantity = $mysidia->input->post("quantity");
$cost = $item->getcost($this->salestax, $item->quantity);
$moneyleft = $mysidia->user->money - $cost;
if($moneyleft >= 0 and $item->quantity > 0){
$purchase = $item->append($item->quantity, $item->owner);
$mysidia->db->update("users", array("money" => $moneyleft), "username = '{$item->owner}'");
$status = TRUE;
}
else throw new InvalidActionException($mysidia->lang->money);
}
if ($VAR_C == "VAR_B") {
$item->quantity = $mysidia->input->post("quantity");
$cost = $item->getcost($this->salestax, $item->quantity);
$moneyleft = $mysidia->user->VAR_D - $cost;
if($moneyleft >= 0 and $item->quantity > 0){
$purchase = $item->append($item->quantity, $item->owner);
$mysidia->db->update("users", array("money" => $moneyleft), "username = '{$item->owner}'");
$status = TRUE;
}
else throw new InvalidActionException($mysidia->lang->money);
}

}
return $status;
}
__________________
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.
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
Second Currency and Currency icon Rovick Suggestions and Feature Requests 14 11-11-2014 05:29 PM
Secondary "RARE" cash option? Tequila Questions and Supports 4 09-17-2012 09:18 AM
secondary cash.. maximillion Questions and Supports 2 07-04-2011 09:42 PM
Mod: Currency Magnie Addons/Mods Graveyard 12 06-05-2010 10:05 AM
Currency Mod Killgore Questions and Supports 1 04-10-2009 08:04 PM


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

Currently Active Users: 1580 (0 members and 1580 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