Author Topic: Max Points Value for Viewers  (Read 3076 times)

0 Members and 1 Guest are viewing this topic.

CouchTalkWithGamerGirls

  • Youngling
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
  • Twitch Name: ctwgg
Max Points Value for Viewers
« on: November 25, 2013, 07:08:46 PM »
Just an idea,
I thought it would be useful if the point system had a MAX value variable so that no viewer could earn more than a set amount of points.
Uses:
To keep things fair for new viewers
To match any kind of future integration with a website CAP (eg MyCred)
btw, here's the code for anyone who uses MyCred on their wordpress website who wants a point cap, just add to your functions.php file for your theme in use (just replace 500000000 with whatever you want your cap set at) provided that the author doesn't include this on an update sometime in the future:
Code: [Select]
/************************************************************************
* MyCred Balance Cap
*************************************************************************/
add_filter( 'mycred_add', 'enforce_points_cap', 10, 3 );
function enforce_points_cap( $reply, $request, $mycred ) {
if ( $reply !== true ) return $reply;

// Cap
$cap = 500000000;
// Get user id from the request
$user_id = (int) $request['user_id'];

// Get current balance
$current_balance = $mycred->get_users_cred( $user_id, $request['type'] );

// If we have reached the cap deny this transaction
if ( $current_balance >= $cap ) return false;

// The amount the user would gain in this transaction
$amount = $reqest['amount'];

// get what the new balance would be
$new_balance = $current_balance + $amount;

// if this bring us over the cap, only add enough to reach the cap
if ( $new_balance > $cap ) {
$over = $new_balance - $cap;
// Add points now
$mycred->update_user_balance( $user_id, $over );
// Returns "done"
return 'done';
}

// Transaction is ok, let myCRED add
return true;
}

And just because it'd be another feature that no one else is doing for their Twitch.TV chat bot loyalty point system.

:D

DeepBot is the best Twitch.TV bot on the planet. If you landed here, you landed in the right place!

woodydaocas

  • Padawan
  • **
  • Posts: 96
  • Karma: +3/-0
    • View Profile
  • Twitch Name: woodydaocas
Re: Max Points Value for Viewers
« Reply #1 on: November 27, 2013, 10:51:41 PM »
Sorry, that is probably just me, but I want everything in DeepBot, I already have couple things around the stream :)

Also, the cap to points is not very motivating for regulars ("why would I go there, I am at cap anyway and he's playing the game I am not interested in...") :P

I believe I have better solution, please try to look on my recent post in feature request and leave a feeback, thanks!

CouchTalkWithGamerGirls

  • Youngling
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
  • Twitch Name: ctwgg
Re: Max Points Value for Viewers
« Reply #2 on: November 28, 2013, 10:23:09 PM »
Our stream is a little different, the viewers that would ever hit the point cap would still come and watch regardless. But I could definitely be just fine without a point cap and have my site do that automatically. Just an idea putting it out there. As far as your post, I read it over. I'll comment on your thread about my thoughts.

woodydaocas

  • Padawan
  • **
  • Posts: 96
  • Karma: +3/-0
    • View Profile
  • Twitch Name: woodydaocas
Re: Max Points Value for Viewers
« Reply #3 on: November 29, 2013, 01:40:25 AM »
ok then, sorry
Thanks :)

Madwurst

  • Youngling
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Germanmadwurst
Re: Max Points Value for Viewers
« Reply #4 on: June 03, 2017, 08:07:17 AM »
...

Wait did you get myCred to use Deepbot Points? That would be awesome how did you do it?