Skip to content

Instantly share code, notes, and snippets.

View beautyfree's full-sized avatar
😼

Alexey Elizarov beautyfree

😼
View GitHub Profile
/**
* Проверка достаточно ли XP для поднятия уровня
*/
public function CheckLevelUp() {
if ($this->xpSinceLastLevelUp() >= $this->nettoXpNeededForLevel($this->oPlayer->getLevel() +1)) {
// Повышаем левел
$this->oPlayer->setLevel($this->oPlayer->getLevel()+1);
$this->Cache_Set($this->oPlayer->getLevel()+1, "user_level_{$this->oPlayer->getId()}", array(), 60*60*24*4);
// Увеличиваем максимальный HP
var sys = require('util'),
path = require('path'),
fs = require('fs'),
config = require('../config'),
profiler = require('./lib/profiler').profiler,
httpcli = require("./lib/httpclient"),
module = require('./module').module;
var profiler = new profiler();
<?php
class PluginMap_ActionSettings extends PluginMap_Inherit_ActionSettings {
/**
* Регистрируем евенты
*/
protected function RegisterEvent() {
parent::RegisterEvent();
$this->AddEvent('map','EventMap');
<?php
/**
* https://github.com/kohana/core/blob/3.2/master/classes/kohana/request.php
* https://github.com/kohana/core/blob/3.2/master/classes/kohana/route.php
* https://github.com/kohana/core/blob/3.2/master/classes/kohana/response.php
*
* https://github.com/laravel/laravel/blob/master/laravel/routing/route.php
* https://github.com/laravel/laravel/blob/master/laravel/routing/router.php
* https://github.com/laravel/laravel/blob/master/laravel/response.php
public function AssignDataForMap($oUserCurrent=NULL) {
if(!$oUserCurrent) {
/**
* Пользователь авторизован?
*/
if (!$oUserCurrent = $this->User_GetUserCurrent()) {
return array();
}
}
{include file='topic_part_header.tpl'}
<div class="topic-content text">
{hook run='topic_content_begin' topic=$oTopic bTopicList=$bTopicList}
{if $bTopicList}
{$oTopic->getTextShort()}
{if $oTopic->getTextShort()!=$oTopic->getText()}
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
{
_id: ObjectId("51a7701a1805753fed000001"),
name: "Нижний Новгород",
alias: "nn",
areas: [
{
_id: ObjectId("51a7701a1805753fed000002"),
name: "Автозаводский"
},
{
<script src="http://localhost:8000/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8000', {
transports: ["websocket", "flashsocket", "xhr-polling"],
reconnect: !0,
"reconnection delay": 500,
"reopen delay": 500,
"max reconnect attempts": 5
});
socket.on('news', function (data) {
@beautyfree
beautyfree / new.js
Last active December 20, 2015 00:38
/**
Builds and returns the url of the socket transport endpoint
@method ioUrl
@return {String} The base url where our streaming api lives
**/
ioUrl : function() {
var cfg = (CL.Cfg.Node) ? CL.Cfg.Node : CL.Cfg.Stream;
return cfg.transport + '://' + cfg.host + ':' + cfg.port;
},