function _notify_discount_applied($discount_percentage, $coupon) { $username = $this->tank_auth->get_username() ? $this->tank_auth->get_username() : 'creature'; $domain_discount = get_current_user_discount_domain_info(); //Notify event for modal pop up if ($discount_percentage == 0) { $params['title'] = "wrong cheat code"; $params['body'] = "<strong>{$username}</strong>, either there is no such cheat code like this or it cannot be applied right now.<br>Anyway, we strongly encourage playing games with no cheat codes applied.<br>But here is a hint just for you.<br><br><strong>Hint : Google \"What is the Konami code\"</strong>. "; } else { if (count($domain_discount)) { $params['title'] = $username; $params['body'] = "We already gave you <strong>{$domain_discount['how_much']}%</strong> off because you belong to the lands of <strong>{$domain_discount['domain']}</strong>. Now dont push us, we cannot afford to give you anymore discount, that would be unfair for our people. Hope you understand."; } else { //Personalised message depending on cheat code applied switch ($coupon) { case 'frapp_mode': $params['title'] = "Cheat Code Applied {$discount_percentage}% off"; $params['body'] = "<strong>{$username}</strong>, We all have been through student life and we all know how important discounts are, wish frapp was there in our times as well. Enjoy your <strong>{$discount_percentage}%</strong> discount. <br><br>Happy gaming/debugging!"; break; case 'bin_mode': $params['title'] = "Cheat Code Applied {$discount_percentage}% off"; $params['body'] = "Hello, <strong>earthling</strong>, a big thank you from BinBag and Psycho Store for being a responsible creature of earth. For all your good deeds we have applied <strong>{$discount_percentage}%</strong> discount just for you. <br><br>Happy gaming/debugging!"; break; default: $params['title'] = "Cheat Code Applied {$discount_percentage}% off"; $params['body'] = "<strong>{$username}</strong>, we strongly oppose gaming with cheat codes applied. But anyway, we have made this game <strong>{$discount_percentage}%</strong> easier, just for you.<br><br>Happy gaming/debugging!"; break; } } } notify_event('apply_discount', $params); }
function _post_login($redirect_url) { $username = $this->tank_auth->get_username(); $params['title'] = "Greetings {$username}"; notify_event('login_done', $params); redirect($redirect_url); }
function show_alert($text, $timeout = 0) { $params['alert_text'] = $text; $params['timeout'] = $timeout; notify_event('alert', $params); }