Mysidia Adoptables Support Forum  

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

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-12-2014, 05:06 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 23,156
IntoRain is on a distinguished road
Default

Interesting! I will try to answer what I can!

Quote:
Originally Posted by Kyttias View Post
Things I need help with now:

1 - I want more complicated requirements than just hitting a daily threshold that expires at midnight. I need to find the total number of interactions in a range of dates, between $timestamp and $today, for an effect that builds over several days worth of interactions until a threshold is finally met. Help constructing a database query that's a Mysidia equivalent to this query format would be nice.
The 'where' part of that query goes to the last argument of mysidia's query function, you can do it like this:

PHP Code:
$timestamp='2014-09-17';
$now = new DateTime(); 
$today $now->format('Y-m-d');
$total_interacts $mysidia->db->select("vote_voters", array(), "date between '{$timestamp}' and '{$today}'")->rowCount(); 
Quote:
Originally Posted by Kyttias View Post
2 - I also want effects to dismiss themselves if it is past exactly 24 hours from their creation, not just if it is the next day/past midnight. So I will need to change how I am storing the date format. Would anyone be willing to test this out for me?
If you want them to disappear after 24 hours from their creation, you have to store the date and the time when the effect turned on, not just the date

PHP Code:
$now = new DateTime();  
$effect_turned_on_at $now->format('Y-m-d H:i:s');//date + time                 
//add 24 hours: http://php.net/manual/en/dateinterval.construct.php        
$now->add(new DateInterval('PT24H'));  
$expires_at $now->format('Y-m-d H:i:s'); 
Quote:
Originally Posted by Kyttias View Post
3 - No function actually takes place, currently, but the possibilities could include temporary boosts such as increased currency yield from visiting adoptables, and for adoptables have an increased click (exp) rate from visits. More complex implementations might feature shop discounts or everyone receiving a bit of additional currency/an item. I would love some direction on how to make these happen, to speed this along into becoming an actual mod.
Since you store if the effect is on or off, you can select the value from the database in those pages and use it to apply your desired effect. For example, the boost to money yield and clicks:

levelup.php - click()

PHP Code:
/* Conditions for boosts below */

$bonus_clicks 0;
$bonus_money 0;
$effect $mysidia->db->select("levels_settings", array("value"), "name = 'ts'")->fetchColumn();
        
if(
$effect == 'on'){
    
$bonus_clicks 3;
    
$bonus_money 500;
}
/* Conditions for boosts above */

//these lines already exist in the function:
$newClicks $this->adopt->getTotalClicks() + $bonus_clicks
(...)
$reward $mysidia->user->clickreward($this->settings->reward) + $bonus_money
Quote:
Originally Posted by Kyttias View Post
4 - I would love some general feedback on how to improve and optimize my existing code. Where it's stored, if it should all be in a giant function, and other tips and such.
I think it looks fine. Regarding giant functions:
Since this will take a few lines, I'd move the code you already have in assignTemplateVars() to a separate private function but in the same file and call that function somewhere inside assignTemplateVars(). This is just for organization though, separating big functions into smaller ones makes the code more readable (Code Refactoring - Method Extraction)

I'd also use && instead of 'and' xD

Number 5, you can create a new settings page just for those or add those settings to an existing page too. Add the fields you want (range of days? bonuses?) to a form then after submiting it update the database with those values
If it gets to a point where you want to define many different bonuses (money, clicks, discounts...), maybe create a new table just for those bonuses?

Number 6, I can't really help with sorry :/
__________________


asp.net stole my soul.

Last edited by IntoRain; 11-12-2014 at 05:11 AM.
Reply With Quote
 

Tags
bonus, clicks, community, interaction, mod


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
The community here is brilliant! CallumCharlton Newcomer Center 3 03-11-2015 10:29 AM
Opinions on Progress RoconzaArt Art Gallery 9 01-20-2011 10:38 PM
Which is best open source community software? chriskrich878 Other Chat 3 11-23-2010 09:06 PM
Still a work in Progress MyBBSkinz Adoptables Sites Showcase 7 08-31-2008 08:13 AM
Urm Yeah mybb community forums Ajof Other Chat 5 06-29-2008 04:12 PM


All times are GMT -5. The time now is 07:25 PM.

Currently Active Users: 3436 (0 members and 3436 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636