SMF Shop

SMFShop => Coding => Topic started by: Kalimas on November 01, 2006, 10:13:53 am

Title: Bonus points for Topic Starter
Post by: Kalimas on November 01, 2006, 10:13:53 am
Hey everyone.

Just installed the shop mod, and everything works great, but I have a feature request. I don't believe it would be too difficult, but I know almost nothing about PHP.

I was wondering if there is any way I can have it so a topic starter gets x amounts of points for each reply in his topic. The value can be static, we'll use 3 points for the example.

So, essentially, "Bob" would get 10 points when he post a new topic, and he would also get an extra 3 points every time someone replies to that topic.

Like I said, I don't know anything of PHP, but from my research, it looks like I'd need to change something here:

Code: [Select]
                    //For a new topic, you get...
                    if ($newTopic)
                        $result_shop = db_query("UPDATE {$db_prefix}members
                                                 SET money = money + {$modSettings['shopPointsPerTopic']}
                                                 WHERE ID_MEMBER = {$ID_MEMBER}
                                                 LIMIT 1", __FILE__, __LINE__);
                    else
                        $result_shop = db_query("UPDATE {$db_prefix}members
                                                 SET money = money + {$modSettings['shopPointsPerPost']}
                                                 WHERE ID_MEMBER = {$ID_MEMBER}
                                                 LIMIT 1", __FILE__, __LINE__);
                }
                //End Shop MOD

Maybe something after the else?

Any help would be greatly appreciated
Title: Re: Bonus points for Topic Starter
Post by: matkins70 on November 01, 2006, 11:14:46 am
Yeah, I like that idea.  Though I was doing some financial forecasting for my shop today. At the moment, i have around $60,000 credits in my shop, and with an interest rate of 2% a day, i'm gonna have $110,000 in a months time, and then more worryingly, in 6 months, im gonna have around 2.1 Million.  This is at current cash flows, without the thousands I make from the random items i have made, like scratchcards that can give 8000 credits.
The worrying thing is that i have several keen users, who have around 10,000 to 20,000 in the bank, and its not gonna take them long to catch up.

Recently I've been trying to get rid of credits, mainly by doing competitions, and paying them out of my own pocket, but all this does is shift the bulk amount of credits to another user.

I think i may be taking my unit in economics a little too seriously, especially when you have created an excel cash predictor to show what sort of figures i could be at in the next few months, years etc...
Title: Re: Bonus points for Topic Starter
Post by: chadk on November 03, 2006, 08:23:56 pm
Well the problem is the bank calculates 2% DAILY not annual like a real bank. 
Title: Re: Bonus points for Topic Starter
Post by: TechnoDragon on November 03, 2006, 09:31:52 pm
it actually could be an easy thing to change (sort of)

Just decide on the annual interest you want and then calculate what that would translate into as a daily interest rate.
Title: Re: Bonus points for Topic Starter
Post by: chinatown on November 17, 2006, 08:24:24 am
but the shop does not allow floating point interest right.. that's the problem
Title: Re: Bonus points for Topic Starter
Post by: TechnoDragon on November 17, 2006, 01:11:08 pm
it does with the latest version
Title: Re: Bonus points for Topic Starter
Post by: chinatown on November 17, 2006, 04:37:52 pm
i am using the latest version.. 2.3 right? whenever i set 0.something interest it becomes 0%.. how to make it work?
Title: Re: Bonus points for Topic Starter
Post by: Daniel15 on November 17, 2006, 07:44:16 pm
Hi,
 Yeah, it doesn't allow floating point interest values. Try doing this patch (link) (http://server.daniel15.com/cgi-bin/viewvc.cgi/smfshop/trunk/shop/ShopAdmin.php?r1=24&r2=32) to your ShopAdmin.php file, and it should work properly.
Title: Re: Bonus points for Topic Starter
Post by: chinatown on November 18, 2006, 02:44:42 pm
Hi,
 Yeah, it doesn't allow floating point interest values. Try doing this patch (link) (http://server.daniel15.com/cgi-bin/viewvc.cgi/smfshop/trunk/shop/ShopAdmin.php?r1=24&r2=32) to your ShopAdmin.php file, and it should work properly.

thanks so much.. i think it works.. at least it displays well..
Title: Re: Bonus points for Topic Starter
Post by: Conrad123 on May 23, 2017, 06:59:58 pm
This needs to determine your desired annual interest rate and then figure out what this will translate into daily interest rates.