Author Topic: SMFShop vs. SMFArcade vs. Guests  (Read 4583 times)

Offline SneakyWho_am_i

SMFShop vs. SMFArcade vs. Guests
« on: September 19, 2007, 02:22:26 pm »
I'm too lazy to do a forum search, so sue me.
I have some requests/suggestions. They involve SMFShop and SMFArcade.... But that's not so bad as I bring code with me and therefore it should be easy to implement for someone who can be bothered making SMF Packages.

I sent a copy of this to a user at Ericsworld but got no reply so instead I'll post it publicly somewhere on the other side of the fence.

Please forgive me if these things have already been done/considered/implemented/discussed.

This is only relevant if you're running the shop and the arcade, and if you've tied them in to each other. Please note that the text following this sentence is effectively a quote and some of it may seem a little ... out of context.

Anyway, I'm very new to all of this php and whatnot, but I've been tinkering a bit, roaming in wider and wider circles.
Screw the story. After writing it.. It's too long, just skip down to the code and if you can't see the point, THEN read the story
Looked like C at first. Or some foreign set of glyphs.

But hey, the Arcade proves to be a great way to drive traffic to my forum. Trouble is keeping the participation level up once they get sick of winning/losing the games.

Good medicine for the participation issue is the arcade pass and a tiny fee for each game... But enabling either of these things locks out guests and then I run into high participation with low registration.

Inspired me to look deeper into it and try to track down a way to get the best of both worlds. I did. And I was proud of myself for finding all the answers. This is all as much to do with SMFShop as the Arcade but TrueSatan suggested I bring what I had done over to you.


The idea: Guests can play for free without a pass, but can't save their scores or comments (and can't earn trophies). Registered users have to have the pass AND pay (a little) to compete. If registered users want to play NON-competitively, they need only log out and they can play for free.
The reward for getting a trophy or posting in the forum far outweighs the cost of a game, it's all worthwhile.

at signup, I give them the pass, AND the cost of the pass (and the pass is worth as much as 100 games)

In Subs-Members.php (File 1 of 3)
(Change 1 of 1 - Add 90 day arcade pass to 'member profile on registration' array)

Find:
Code: [Select]
// Begin SMFShop 2.3 (Build 11) code
'money' => $modSettings['shopRegAmount'],
// End SMFShop code
Replace:         
Code: [Select]
// Begin SMFShop 2.3 (Build 11) code
'money' => $modSettings['shopRegAmount'],
// End SMFShop code
// Begin SneakyWho_am_i
'arcadePass' => time() + 90 * 86400,
// End SneakyWho_am_i
      
            
In Arcade.php (File 2 of 3)
(Change 1 of 1 - Guests can play without arcade pass)

Find:
Code: [Select]
//Added for shop mod
if (isset($modSettings['shopEnableArcadePass']) && $modSettings['shopEnableArcadePass'] > 0)
Replace:
Code: [Select]
//Added for shop mod SneakyWho_am_i disables pass check for guests
if (isset($modSettings['shopEnableArcadePass']) && (!$user_info['is_guest']) && $modSettings['shopEnableArcadePass'] > 0)


In ArcadePlay.php (File 3 of 3)
(Change 1 of 1 - Guests can play without $money)

Find:
Code: [Select]
//Added for shop mod
if(isset($modSettings['shopCostPerPlay']) && $modSettings['shopCostPerPlay'] > 0)
Replace:
Code: [Select]
//Added for shop mod SneakyWho_am_i's guests play for nothing
if(isset($modSettings['shopCostPerPlay']) && (!$user_info['is_guest']) && $modSettings['shopCostPerPlay'] > 0)

Offline inkstains

Re: SMFShop vs. SMFArcade vs. Guests
« Reply #1 on: September 19, 2007, 03:04:33 pm »
which version of arcade is this for? i'm thinking the modified eric one yeh?

have you checked this link?
http://www.daniel15.com/forum/index.php/topic,668.0.html

the only reason i haven't used it yet is because i haven't had time to find a way to have the pass only apply to a certain category of games (paid) and have the other category (free) games for everyone.

nice work though props

 O0

Offline SneakyWho_am_i

Re: SMFShop vs. SMFArcade vs. Guests
« Reply #2 on: September 19, 2007, 03:16:16 pm »
Yeah, I'm talking about E2.3.3 I think. I notice there's a new version available now, I may move to that. Maybe. I sent him the details of what I'd done before that version came out and he didn't even say to go to the SMFShop developers instead. No reply at all, nothing. So maybe it got buried under arcade notifications or something.

Cheers for the props.

There's a way to make some games available to only people with a certain post count. If you (or I) can find the hook (or the code) for that, then I think it would probably be a good starting point for what you're talking about -  Paid games vs. Free games. It sounds like a good idea :)

I won't make any promises cause I'm not very good with this sort of thing but if I find the tiem I'll have a look for it and if I can make it do that thing you're talking about, I'll come back and show you what I did to it to make it do the thing.

I'm gonna shut up now as I don't think I'm making a lot of sense.

which version of arcade is this for? i'm thinking the modified eric one yeh?

have you checked this link?
http://www.daniel15.com/forum/index.php/topic,668.0.html

the only reason i haven't used it yet is because i haven't had time to find a way to have the pass only apply to a certain category of games (paid) and have the other category (free) games for everyone.

nice work though props

 O0

Offline inkstains

Re: SMFShop vs. SMFArcade vs. Guests
« Reply #3 on: September 19, 2007, 03:59:50 pm »
to easy.

i haven't had a chance to look yet but i was thinking make the arcade pass only apply to a certain membergroup and that membergroup would be given access to the paid category games but yeh like i said haven't really had a look..

Offline SneakyWho_am_i

Re: SMFShop vs. SMFArcade vs. Guests
« Reply #4 on: January 01, 2008, 04:09:48 pm »
Well I still haven't tried to do what you were talking about but I'm having some issues with the arcade right now. Basically I'm planning on changing it so that arcade comments increment the user's post count. If you use updateprofile() or whatever the function is called, you can increase their post count but then there is an unread topic notification forever until you delete the comment tied to that (don't understand why, yet)
At the moment the arcade comments are made into posts by simply directly updating the database. I wonder if it might not be more complete to use the createpost() function (again, or whatever it's called). I'm in no position to question it though :) I didn't make it and don't really understand what is going on - something will have to change though for my wishlist.

Anyway, in ArcadePlay.php I find these things:
function ArcadePlay()
{
 
	
global 
$scripturl$txt$db_prefix$context$arcSettings$modSettings$ID_MEMBER$user_info;
	

	
//Added for shop mod SneakyWho_am_i disables all rules for guests
	
if(isset(
$modSettings['shopCostPerPlay']) && (!$user_info['is_guest']) && $modSettings['shopCostPerPlay'] > 0)
	
{
	
	
$credit checkShopCredits();
	
	

	
	
if(
$credit $modSettings['shopCostPerPlay'])
	
	
{
	
	
	
//cant play
	
	
	
fatal_lang_error('cannot_arcade_play_credit');
	
	
}
	
}
	
// end shop mod


And:

function checkShopCredits()
{
	
//function added for shop mod to check members credit
	
	
global 
$scripturl$txt$db_prefix$ID_MEMBER;
	

	
	
$result db_query("
	
	
SELECT
	
	
	
money
	
	
FROM  
{$db_prefix}members
	
	
WHERE ID_MEMBER = 
$ID_MEMBER"__FILE____LINE__);

	
$cash mysql_fetch_assoc($result);
	

	
return 
$cash['money'];
}


Looking good so far. We can abuse smf's permissions system to make some membergroups exempt from paying using the admin panel - which is far better in my opinion than hardcoding which groups should be charged or not charged.
So combining this information with the stuff from my first post, we can make any membergourps able or unable to play/pay, and make some of them exempt from having to.

This is one step from being what you are talking about. I haven't gone through it properly but I think we would have to create another column in the database for the paid/free switch, and draw that into the admin template to let it be controlled. The code might start to resemble something like this:
function ArcadePlay()
{
 global 
$scripturl$txt$db_prefix$context$arcSettings$modSettings$ID_MEMBER$user_info;
//Added for shop mod SneakyWho_am_i uses custom permissions......
ifallowedTo('pay_for_games')
{
if(isset(
$context['arcade']['game']['non_free'//REMEMBER WE GOT THIS FROM OUR EXTRA DB COLUMN
{
if(isset(
$modSettings['shopCostPerPlay'])&& $modSettings['shopCostPerPlay'] > 0)
{
$credit checkShopCredits();
if(
$credit $modSettings['shopCostPerPlay'])
//cant play
fatal_lang_error('cannot_arcade_play_credit');
}
}
}
}
// end shop mod


Somebody else could probably make that a lot prettier and I'm not sure I named the function properly, blah blah blah. but that's how I see it. You'dd apply this sort of thing to the bit where it charges you, and the bit where it checks for the pass. The fun part would be getting the info in and out of the database (admin template adjustment in games admin screen)

I hope I'm making sense.
The reason I want comments to increment the post count is, I use post counts to measure activity. Seems like the quickest and easiest way. Arcade users might be very active (arcade plays should be considered contributions) but they don't seem active when I count posts, so I think that their post count should increase if the arcade comments are made to become posts.

EDIT: Permissions of course are easy to create in SMF as I learned to my joy this week. ManagePermissions.php, add the permission to the array and then add the language strings for it (should be three) @ the language file and you're away laughing.

EDIT2:
Arcade.php:
	
	
	
else

	
	
	
{
	
	
	
//sneaky says guests can have posts after all
	
	
	
/*

	
	
	
	
$post = 0;

	
	
	
	
$postPerDay = 0;
	
	
	
	
*/
	
	
	
	
$post 100;

	
	
	
	
$postPerDay 100;

	
	
	
}

	
	
	


My guests can play even if they don't have any posts per day...
« Last Edit: January 01, 2008, 05:07:35 pm by SneakyWho_am_i »