Показать сообщение отдельно
Старый 28.05.2009, 22:50 Вверх   #4
Коварный тип
 
Аватар для Serberg
Serberg вне форума
Доп. информация
Хорошо Интеграция ibProArcade с vbcredits

Интеграция ibProArcade с vbcredits

Английская версия.

Перед установкой сделайте бэкап базы на всяк случай.
  • Загружаете все файлы из папки upload к себе на хост
  • Импортируйте продукт product-credits_ibproarcade.xml
  • Произведите замены в файлах
  • Обновите настройки для групп пользователей

Инструкция по установке:
Нажми для просмотра
================================
Файл: arcade.php
================================
НАЙТИ:
--------------------------------
$specialtemplates = array();
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$specialtemplates = array('credits_central');
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("SELECT t.nbtries, t.demare, t.datestarted, t.cost, t.numplayers, g.gtitle, g.gname, g.gid, g.decpoints, g.highscore_type FROM ibf_tournaments as t, ibf_games_list as g WHERE t.gid = g.gid AND t.tid=".$tid." LIMIT 0, 1");
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$DB->query("SELECT t.*, g.gtitle, g.gname, g.gid, g.decpoints, g.highscore_type FROM ibf_tournaments as t, ibf_games_list as g WHERE t.gid = g.gid AND t.tid = $tid LIMIT 0, 1");
--------------------------------
НАЙТИ:
--------------------------------
$tinfo['jackpottxt'] = "";
if ( (floatval($tinfo['cost']) > 0) && (($vbulletin->options['vbbux_enabled'] == 1) && ($vbulletin->options['vbbux_arcadeintegration'] == 1)) )
{
$tinfo['jackpottxt'] = $ibforums->lang['tourney_jackpot1']."<b>".$tinfo['cost']."</b><br />";
$tinfo['jackpottxt'].= $ibforums->lang['tourney_jackpot2']."<b>".(floatval($tinfo['cost'])*intval($tinfo['numplayers']))."</b><br />";
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$tinfo['jackpottxt'] = '<div>' . construct_phrase($GLOBALS['vbphrase']['credits_ibp_tournyinfo'], vb_number_format($tinfo['cost'], $vbulletin->options['credits_decimals']), $GLOBALS['vbphrase']['credits'], vb_number_format($tinfo['jackpot'], $vbulletin->options['credits_decimals'])) . '</div>';
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("SELECT t.numplayers,t.datestarted,t.tid,g.gtitle,g.gid,t.champion FROM ibf_tournaments as t, ibf_games_list as g WHERE champion = '' AND t.gid = g.gid AND demare>0 ORDER BY datestarted DESC");
while($row = $DB->fetch_row()) {
$row['link'] = "<a href='".$ibforums->base_url."act=Arcade&amp;do=viewtourney&amp;tid=".$row['tid']."'>".$ibforums->lang['view_tourney']."</a>";
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$DB->query("SELECT t.*, g.gtitle, g.gid FROM ibf_tournaments as t, ibf_games_list as g WHERE champion = '' AND t.gid = g.gid AND demare > 0 ORDER BY datestarted DESC");

while ($row = $DB->fetch_row())
{
$row['link'] = '<a href="' . $ibforums->base_url . 'act=Arcade&amp;do=viewtourney&amp;tid=' . $row['tid'] . '">' . $ibforums->lang['view_tourney'] . '</a>';
$row['jackpot'] = vb_number_format($row['jackpot'], $vbulletin->options['credits_decimals']);
--------------------------------
НАЙТИ:
--------------------------------
if ($costhtmlstart!="")
{
// add the costs to HTML and format it
$value = $vbulletin->options['vbbux_decimalplaces'];
if (($vbversion != "3.0") && ($NATIVEMODE==0))
{
($hook = vBulletinHook::fetch_hook('ibproarcade_view_tourney_getcosts')) ? eval($hook) : false;
}
$costhtmlstart .= vb_number_format($row['cost'], $value);
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
if ($vbversion != '3.0' AND !$NATIVEMODE)
{
($hook = vBulletinHook::fetch_hook('ibproarcade_view_tourney_getcosts')) ? eval($hook) : false;
}
--------------------------------
НАЙТИ:
--------------------------------
$selected['sort']['gtitle']="";
$selected['sort']['gcount']="";
$selected['sort']['gwords']="";
$selected['sort']['g_rating']="";
$selected['sort']['added']="";
$selected['order']['ASC']="";
$selected['order']['DESC']="";

// make sure the setting is clean and has a valid value
if (!in_array($this->arcade->settings['g_display_sort'],array('gtitle','gcount','gwords','g_rating','added')))
{
$this->arcade->settings['g_display_sort'] = "gtitle";
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$selected = array(
'sort' => array(
'gtitle' => '',
'gcount' => '',
'gwords' => '',
'g_rating' => '',
'added' => '',
'cost' => '',
'jackpot' => ''
),
'order' => array(
'ASC' => '',
'DESC' => ''
)
);

if (!in_array($this->arcade->settings['g_display_sort'], array('gtitle', 'gcount', 'gwords', 'g_rating', 'added', 'cost', 'jackpot')))
{
$this->arcade->settings['g_display_sort'] = 'gtitle';
}
--------------------------------
НАЙТИ:
--------------------------------
// detect vBplaza
if (($vbulletin->options['vbbux_enabled'] == 1) && ($vbulletin->options['vbbux_arcadeintegration'] == 1))
{
$the_game['ibprostyle_info1']=" <fieldset>
<legend><b>{$ibforums->lang['gb_jackpot_title']}</b></legend>
<span class=\"smallfont\"><center>";
$the_game['ibprostyle_info2']=" </center></span></fieldset>";
$the_game['v3style_info']="<br />";

$the_game['cost_info'] = $ibforums->lang['costs_pgame']."<b>".$the_game['cost']."</b><br />";

if ($the_game['jackpot_type']=='-1')
{
// raising Jackpot, so display it in GameBit!
$the_game['jackpot_info'] = $ibforums->lang['gb_win_jackpot_raising']."<b>".$the_game['jackpot']."</b>";
}
else
{
// static Jackpot
$the_game['jackpot_info'] = $ibforums->lang['gb_win_jackpot_static']."<b>".$the_game['jackpot']."</b>";
}
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
if ($vbulletin->options['credits_enabled'])
{
$the_game['ibprostyle_info1'] = '<fieldset><legend><b>' . $vbphrase['credits'] . '</b></legend><span class="smallfont"><center>';
$the_game['ibprostyle_info2'] = '</center></span></fieldset>';
$the_game['v3style_info'] = '<b>' . $vbphrase['credits'] . ':</b><br />';
$the_game['cost_info'] = $vbphrase['credits_ibp_playcost'] . ': <b>' . $the_game['cost'] . '</b><br />';
$the_game['jackpot_info'] = $vbphrase['jackpot'] . ': <b>' . $the_game['jackpot'] . '</b>' . $the_game['pass_extra'];
}
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("SELECT gid, mid, lid FROM ibf_games_league WHERE gid=".$gid." AND mid=".$lboard['mid']." AND position=0");
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
if ($vbulletin->userinfo['credits_canearn'] AND $ctr <= $vbulletin->options['credits_ibp_minrank'] AND $lboard['score'] == $player_score AND $vbulletin->userinfo['credits_ibp_paid'])
{
$paidout = false;

if ($vbulletin->options['credits_ibp_buffer'])
{
$topcurrent = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "games_scores WHERE gid = " . $gid . " ORDER BY score " . ( $ginfo['highscore_type'] == 'high' ? 'DESC' : 'ASC' ) . ", timespent ASC LIMIT " . $vbulletin->options['credits_ibp_minrank']);

while ($topscore = $vbulletin->db->fetch_array($topcurrent))
{
if ($topscore['datescored'] != ( empty($gtime) ? TIMENOW : $gtime ) AND $topscore['name'] == $vbulletin->userinfo['username'] AND $topscore['datescored'] + $vbulletin->options['credits_ibp_buffer'] > TIMENOW)
{
$paidout = true;
break;
}
}

$vbulletin->db->free_result($topcurrent);
}
switch ($vbulletin->options['credits_ibp_jptype'])
{
case 'rank':
$winamount = $ginfo['jackpot'] / $ctr;
break;
case 'score':
$winamount = $ginfo['jackpot'] * $points;
break;
case 'static':
$winamount = $ginfo['jackpot'];
break;
}
if ($winamount)
{
if ($ginfo['jackpot_type'] == 'raising')
{
if ($winamount > $ginfo['jackpot'])
{
$winamount = $ginfo['jackpot'];
}

$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "games_list SET jackpot = jackpot - $winamount WHERE gid = $gid");
}

$wintax = $vbulletin->options['credits_ibp_tax'] * $winamount;
$vbulletin->userinfo['credits_ibp_paid'] = false;
$amount = $winamount - $wintax;
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits + $amount WHERE userid = " . $vbulletin->userinfo['userid']);
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "credits_transactions (touserid, action, comment, amount, timestamp) VALUES (" . $vbulletin->userinfo['userid'] . ", 'ibp_game', '" . $vbulletin->db->escape_string(construct_phrase($GLOBALS['vbphrase']['credits_ibp_game_desc'], vb_number_format($player_score, 0), $ginfo['gtitle'])) . "', $amount, " . TIMENOW . ")");
build_datastore('credits_central', $vbulletin->credits_central + $wintax, false);
}
}
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("SELECT name,id FROM ibf_members WHERE id='".$winner."' LIMIT 1");
$name = $DB->fetch_row();
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$tourn = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "tournaments WHERE tid = " . $tid);
$name = $vbulletin->db->query_first("SELECT *, username AS name FROM " . TABLE_PREFIX . "user WHERE userid = " . $winner);

if ($tourn['jackpot'])
{
$oldtourn = $vbulletin->db->query_first("SELECT user.* FROM " . TABLE_PREFIX . "tournaments AS tourn LEFT JOIN " . TABLE_PREFIX . "user AS user ON(tourn.champion = user.username) WHERE user.credits_canspend = 1 AND tourn.champion != '' AND tourn.tid = " . $tid);

if ($oldtourn['userid'] != $winner)
{
$wintax = $vbulletin->options['credits_ibp_tax'] * $tourn['jackpot'];
$amount = $tourn['jackpot'] - $wintax;

if (!empty($oldtourn['userid']))
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits - $amount WHERE userid = " . $oldtourn['userid']);
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "credits_transactions WHERE touserid = " . $oldtourn['userid'] . " AND action = 'ibp_tourn' AND amount = $amount ORDER BY timestamp DESC LIMIT 1");
}
else if ($wintax)
{
build_datastore('credits_central', $vbulletin->credits_central + $wintax, false);
}
if ($name['credits_canearn'])
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits + $amount WHERE userid = " . $winner);
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "credits_transactions (touserid, action, comment, amount, timestamp) VALUES (" . $winner . ", 'ibp_tourn', '" . $vbulletin->db->escape_string(construct_phrase($GLOBALS['vbphrase']['credits_ibp_tourn_desc'], vb_number_format(( $vbulletin->userinfo['userid'] == $winner ? $savearray[1] : $opponentinfo['rungscore'] ), 0), $gameinfo['gtitle'])) . "', $amount, " . TIMENOW . ")");
}
}
}
--------------------------------
НАЙТИ:
--------------------------------
'cost' => $costs,
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
'jackpot' => $joincost,
'jackpot_type' => 'raising',
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("SELECT creat, gid, demare, numplayers, cost FROM ibf_tournaments WHERE tid = '".$tid."' LIMIT 1");
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$DB->query("SELECT * FROM ibf_tournaments WHERE tid = " . $tid . " LIMIT 1");


================================
Файл: arcade/modules/mod_arcade.php
================================
НАЙТИ:
--------------------------------
$validsort = array('gtitle','gcount','gwords','g_rating','added');
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
$validsort = array('gtitle', 'gcount', 'gwords', 'g_rating', 'added', 'cost', 'jackpot');
--------------------------------
НАЙТИ:
--------------------------------
if ($arcadepass_expire!="")
{
$the_links = "<span class='smallfont' style='color: red;'><b>".$ibforums->lang['arcade_pass'].$arcadepass_expire."</b></span><br />".$the_links;
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
if ($vbulletin->userinfo['userid'] AND $vbulletin->userinfo['creditperms']['credit_ibp_passcost'])
{
$the_links = '<span class="smallfont"><b>' . ( $vbulletin->userinfo['credits_ibp_pass'] > TIMENOW ? construct_phrase($GLOBALS['vbphrase']['credits_ibp_passexpires'], vbdate($vbulletin->options['dateformat'] . ', ' . $vbulletin->options['timeformat'], $vbulletin->userinfo['credits_ibp_pass']), $GLOBALS['vbphrase']['credits']) : construct_phrase($GLOBALS['vbphrase']['credits_ibp_buypass'], vb_number_format($vbulletin->userinfo['creditperms']['credit_ibp_passcost'], $vbulletin->options['credits_decimals']), $GLOBALS['vbphrase']['credits'], $vbulletin->session->vars['sessionurl']) ) . '</b></span><br />' . $the_links;
}


================================
Файл: arcade/skins/skin_Arcade.php AND/OR skin_v3Arcade.php
================================
НАЙТИ:
--------------------------------
<tr>
<td width="100%" align="center" class="thead" colspan="5">{$ibforums->lang['active_tournaments']}</td>
</tr>
<tr>
<td width="20%" align="center" class="tcat">{$ibforums->lang['legend_of_zelda']}</td>
<td width="20%" align="center" class="tcat">{$ibforums->lang['tourney_title']}</td>
<td width="20%" align="center" class="tcat">{$ibforums->lang['num_of_players']}</td>
<td width="20%" align="center" class="tcat">{$ibforums->lang['your_status']}</td>
<td width="20%" align="center" class="tcat">{$ibforums->lang['date_started']}</td>
</tr>
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
<tr>
<td width="100%" align="center" class="thead" colspan="6">{$ibforums->lang['active_tournaments']}</td>
</tr>
<tr>
<td width="17%" align="center" class="tcat">{$ibforums->lang['legend_of_zelda']}</td>
<td width="18%" align="center" class="tcat">{$ibforums->lang['tourney_title']}</td>
<td width="17%" align="center" class="tcat">{$ibforums->lang['num_of_players']}</td>
<td width="16%" align="center" class="tcat">{$ibforums->lang['your_status']}</td>
<td width="16%" align="center" class="tcat">{$ibforums->lang['date_started']}</td>
<td width="16%" align="center" class="tcat">{$GLOBALS['vbphrase']['jackpot']}</td>
</tr>
--------------------------------
НАЙТИ:
--------------------------------
<td align='center' nowrap='nowrap' class='alt1'>{$rowinfo['datestarted']}</td>
</tr>
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
<td align='center' nowrap='nowrap' class='alt1'>{$rowinfo['datestarted']}</td>
<td align='center' nowrap='nowrap' class='alt1'>{$rowinfo['jackpot']}</td>
</tr>
--------------------------------
НАЙТИ ДВАЖДЫ:
--------------------------------
<option value="added" {$selected['sort']['added']}>{$ibforums->lang['dateadded']}</option>
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
<option value="cost" {$selected['sort']['cost']}>{$GLOBALS['vbphrase']['credits_ibp_playcost']}</option>
<option value="jackpot" {$selected['sort']['jackpot']}>{$GLOBALS['vbphrase']['jackpot']}</option>


================================
Файл: admincp/arcade.php
================================
НАЙТИ:
--------------------------------
$sortextra = "";
if (($IN['sort']=="dateasc") || ($IN['sort']=="datedesc") || ($IN['sort']=="timesplayed") || ($IN['sort']=="inactive") || ($IN['sort']=="costs") || ($IN['sort']=="jpraise") || ($IN['sort']=="jpstatic"))
{
if ($IN['sort']=="dateasc") { $sortextra = "added ASC,"; }
if ($IN['sort']=="datedesc") { $sortextra = "added DESC,"; }
if ($IN['sort']=="timesplayed") { $sortextra = "gcount DESC,"; }
if ($IN['sort']=="costs") { $sortextra = "cost DESC,"; }

if ($IN['sort']=="jpraise")
{
$sortextra = "jackpot DESC,";
if ($query_extra=="") { $query_extra ="WHERE jackpot_type='-1'";}
else { $query_extra.=" AND jackpot_type='-1'";}
}

if ($IN['sort']=="jpstatic")
{
$sortextra = "jackpot_type DESC,";
if ($query_extra=="") { $query_extra ="WHERE jackpot_type<>'-1'";}
else { $query_extra.=" AND jackpot_type<>'-1'";}
}
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
switch ($IN['sort'])
{
case 'dateasc':
$sortextra = 'added ASC,';
break;
case 'datedesc':
$sortextra = 'added DESC,';
break;
case 'timesplayed':
$sortextra = 'gcount DESC,';
break;
case 'cost':
$sortextra = 'cost DESC,';
break;
case 'jackpot':
$sortextra = 'jackpot DESC,';
break;
}
--------------------------------
НАЙТИ:
--------------------------------
if ($IN['opt_jackpottype']==1)
{
if ($IN['select_jackpottype']==0)
{
// static Jackpot
if ($staticjp)
{
$db_string = $DB->compile_db_update_string( array ( 'jackpot_type' => $IN['select_jackpotstatic'] ) );
}
else
{
$db_string = $DB->compile_db_update_string( array ( 'jackpot_type' => '0' ));
}
}
else
{
// raising Jackpot
$db_string = $DB->compile_db_update_string( array ( 'jackpot_type' => '-1' ) );
}
$DB->query("UPDATE ibf_games_list SET ".$db_string." WHERE gid IN ".$cat_string);
}
else
{
// no changes on Jackpot-Type, so finally store static value if that was changed
if ($staticjp)
{
// check if Jackpot-Type of that Game isn't set to RAISING (done via Query)
$db_string = $DB->compile_db_update_string( array ( 'jackpot_type' => $staticjackpot ) );
$DB->query("UPDATE ibf_games_list SET ".$db_string." WHERE jackpot_type<>'-1' AND gid IN ".$cat_string);
}
}
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
if ($IN['opt_jackpottype'])
{
$DB->query("UPDATE ibf_games_list SET " . $DB->compile_db_update_string(array('jackpot_type' => $IN['select_jackpottype'])) . " WHERE gid IN " . $cat_string);
}
--------------------------------
НАЙТИ ДВАЖДЫ:
--------------------------------
if( (!is_numeric($costs)) || ($costs < 0) )
{
$costs = 0;
}

if (($jackpottype<0) || ($jackpottype>1))
{
$jackpottype = 1;
}

if( (!is_numeric($jackpot)) || ($jackpot < 0) )
{
$jackpot = 0;
}

if( (!is_numeric($static)) || ($static < 0) )
{
$static = 0;
}

if ($jackpottype == 1)
{
// if raising Jackpot set the Jackpot itself to Zero
$jackpottype = "-1";
}
else
{
// static Jackpot
$jackpottype = $static;
}
--------------------------------
ЗАМЕНИТЬ НА В ОБОИХ:
--------------------------------
$costs = $vbulletin->input->clean_gpc('r', 'cost', TYPE_UNUM);
$jackpottype = $vbulletin->input->clean_gpc('r', 'jackpottype', TYPE_NOHTML);
$jackpot = $vbulletin->input->clean_gpc('r', 'jackpot', TYPE_UNUM);
--------------------------------
НАЙТИ:
--------------------------------
'cost' => $costs,
--------------------------------
ЗАМЕНИТЬ НА:
--------------------------------
'cost' => $vbulletin->input->clean_gpc('r', 'costs', TYPE_UNUM),
'jackpot_type' => $vbulletin->input->clean_gpc('r', 'jackpottype', TYPE_NOHTML),
'jackpot' => $vbulletin->input->clean_gpc('r', 'jackpot', TYPE_UNUM) + ( $vbulletin->input->clean_gpc('r', 'jackpottype', TYPE_NOHTML) == 'raising' ? (sizeof($match) - 1) * $vbulletin->input->clean_gpc('r', 'costs', TYPE_UNUM) : 0 ),
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("INSERT INTO ibf_tournament_players (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits - " . $vbulletin->input->clean_gpc('r', 'costs', TYPE_UNUM) . " WHERE userid = $key");
--------------------------------
НАЙТИ:
--------------------------------
print_table_header($ibforums->lang['acp_tourney_edituser']);
print_description_row($ibforums->lang['acp_tourney_editusertxt']."<input type='text' name='username' value='' size='32' class='textinput' readonly='readonly'>");
print_input_row($ibforums->lang['acp_tourney_replace'], 'replaceid', '', 0);
print_submit_row($ibforums->lang['acp_replace'], 0);
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
$tourn = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "tournaments WHERE tid = " . $IN['tid']);
print_form_header('credits_admin', 'ibp_tourn');
print_table_header($vbphrase['credits_ibp_settings']);
construct_hidden_code('tournament', $IN['tid']);
print_input_row($vbphrase['credits_ibp_acp_entrance'], 'costs', $tourn['cost']);
print_select_row($vbphrase['credits_ibp_acp_jackpot_type_tourn'], 'jackpottype', array('raising' => $vbphrase['raising'], 'static' => $vbphrase['static']), $tourn['jackpot_type']);
print_input_row($vbphrase['credits_ibp_acp_jackpot_value_tourn'], 'jackpot', $tourn['jackpot']);
print_submit_row();


================================


Вложения
Тип файла: zip vBCredits with ibProArcade.zip (9.6 Кб, 3 просмотров)

Последний раз редактировалось Serberg; 01.06.2009 в 20:05..
  Ответить с цитированием
Cказали cпасибо:
 
Время генерации страницы 0.15615 секунды с 11 запросами