Перейти к контенту

Рекомендуемые сообщения

Я тут на досуге написал аукцион для RPG Inferno 4.2 хотел бы что б вы проверили.... код конечно корявый но рабочий))) так что если надо юзайте но о копирайте не забывайте....

 

 

File source/RPG.php

[COLOR=red]switch($ibforums->input['CODE']) {[/COLOR]

[COLOR=green]case 'auction':
$this->auction();
break;
case 'do_auction':
$this->do_auction();
break;
case 'auctionadd':
$this->auctionadd();
break;
case 'do_add':
$this->do_add();
break;[/COLOR]

 

 

 

Same file

[COLOR=red]// print data
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." - ".$this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );
}[/COLOR]

//by CTAPbIu_MABP

function auction(){
global $DB, $ibforums, $std;

// fitch
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='".$ibforums->member['id']."'");
$Member=$DB->fetch_row();

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// Grab Items And Data
$this->output .= $this->html->auctiontop($shop);

$DB->query("SELECT i.*,s.*,w.name as owner
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)");

while($Item=$DB->fetch_row()){
$this->output .= $this->html->auctionrow($Item);
}

$this->output .= $this->html->auctionbottom($Member);

$this->output .= $this->html->Copyright();
$this->page_title = "Itemshop";
$this->nav        = array( "Itemshop", );
}



function do_auction(){
global $ibforums, $DB, $std, $print;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='{$ibforums->member['id']}'");
$this->member=$DB->fetch_row();

// Grab Items And Data
$DB->query("SELECT * FROM ibf_auction where i_id = {$ibforums->input['i_id']}");
$this->TData = $DB->fetch_row();

// is already own?
$DB->query("SELECT * FROM ibf_infernostock WHERE owner = '{$ibforums->member['id']}'");
$this->RData = $DB->fetch_row();
if ($this->RData['item'] == $ibforums->input['item_id']){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'allr_owni' ) );
}

// isn't it your's?
if ($this->TData['owner'] == $ibforums->member['id']) { 
$print->redirect_screen( "Это и так Ваше, Вы не можете купить у самого себя!", 'act=RPG&CODE=auction' );
}

// dont you have another?
$DB->query("SELECT * FROM ibf_auction where owner = '{$ibforums->member['id']}'");
$this->SData = $DB->fetch_row();
if ($this->SData['item'] == $ibforums->input['item_id']){
$print->redirect_screen( "Здается мне вы уже торгуетесь за такую вещ...", 'act=RPG&CODE=auction' );
}

// do you rich enought?
$fullcost = $this->TData['cost'] + $ibforums->input['price'];
if ($this->member['money'] < $fullcost){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'need_morem' ) );
}

// return money
$DB->query("SELECT * FROM ibf_members where id = {$this->TData['owner']}");
$this->PData = $DB->fetch_row();
$this->rmoney = $this->PData['money'] + $this->TData['cost'];
$DB->query("UPDATE ibf_members SET money = $this->rmoney WHERE id={$this->TData['owner']} ");

// loose money
$this->lmoney = $this->member['money'] - $this->TData['cost'] - $ibforums->input['price'];
$DB->query("UPDATE ibf_members SET money = $this->lmoney WHERE id={$this->member['id']} ");

// new price and owner
$this->new_price = $this->TData['cost'] + $ibforums->input['price'];
$DB->query("UPDATE ibf_auction SET cost = $this->new_price, owner = {$this->member['id']} WHERE i_id={$ibforums->input['i_id']} ");

//log
$DB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$ibforums->member['id']} поднял цену на предмет {$ibforums->input['item_id']} с {$this->TData['cost']} до $this->new_price')");

// all right :)
$print->redirect_screen( "Теперь этот замечательный предмет Ваш!!!", 'act=RPG&CODE=auction' );
}


function auctionadd(){
global $DB, $ibforums, $std;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='".$ibforums->member['id']."'");
$Member=$DB->fetch_row();

// Grab Items And Data
$this->output .= $this->html->addtop($shop);

$DB->query("SELECT i.*,s.* FROM ibf_infernostock s LEFT JOIN ibf_infernoshop i ON (s.item=i.id) where s.owner='{$ibforums->member['id']}'");
while($Item=$DB->fetch_row()){
$this->output .= $this->html->addrow($Item);
}
$this->output .= $this->html->addbottom($Member);

$this->output .= $this->html->Copyright();
$this->page_title = "Itemshop";
$this->nav        = array( "Itemshop", );
}



function do_add(){
global $DB, $ibforums, $std, $print;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// remove item from user inventary and add it to auction
$endtime = $time + 1728000;
$i=0;
$DB->query("SELECT * FROM ibf_infernostock WHERE item = {$ibforums->input['add']}");
while ($EData = $DB->fetch_row()){
$i++;
if ($EData['owner'] == $ibforums->member['id']){
$DDB->query("DELETE FROM ibf_infernostock WHERE (owner = {$ibforums->member['id']} && item = {$ibforums->input['add']})");
$DDB->query("INSERT INTO ibf_auction VALUES ('','{$EData['item']}','{$EData['owner']}','1','$endtime', '{$ibforums->member['id']}')");
}}

//log
$DB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$ibforums->member['id']} выставил на аукцион предмет {$ibforums->input['add']}')");

// all right :)
$print->redirect_screen( "Вы выставили этот предмет на торги!!!", 'act=RPG&CODE=auction' );
}

//end by

 

File sources\Admin\ad_auction.php ++

<?php

$idx = new ad_rpgstore();


class ad_rpgstore {
function ad_rpgstore() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_title = "Mange RPG Store";
$ADMIN->page_detail = "";

switch($IN['code']){
case 'auction':
$this->view();
break;

case 'delete':
$this->delete();
break;

case 'do_edit':
$this->do_edit();
break;

case 'edit':
$this->edit();
break;

case 'log':
$this->log();
break;

default:
$this->view();
break;
}
$ADMIN->output();
}

function view(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$SKIN->td_header[] = array( "Icon"    , "10%" );
$SKIN->td_header[] = array( "Owner"    , "10%" );
$SKIN->td_header[] = array( "Name" , "20%" );
$SKIN->td_header[] = array( "Description"       , "35%" );
$SKIN->td_header[] = array( "Cost"         , "10%" );
$SKIN->td_header[] = array( "Edit"         , "5%" );
$SKIN->td_header[] = array( "Delete"         , "5%" );

// ----------------

$ADMIN->html .= $SKIN->start_table( "Manage Items In RPG Auction" );
$DB->query("SELECT i.*,s.*,w.name as owner
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)");
while ($Data = $DB->fetch_row() ) {
$ADMIN->html .= $SKIN->add_td_row( array(
"<center><img src='{$INFO['html_url']}/Inferno/items/{$Data['img']}'></center>" ,
"<center><b>{$Data['owner']}</b></center>",
"<center><b>{$Data['name']}</b></center>",
"<center>{$Data['desc']}</center>",
"<center>{$Data['cost']}</center>",
"<center><a href='{$ADMIN->base_url}&act=auction&code=edit&i_id={$Data['i_id']}'>Edit</a></center>",
"<center><a href='{$ADMIN->base_url}&act=auction&code=delete&i_id={$Data['i_id']}'>Delete</a></center>",
)      );

}
$ADMIN->html .= $SKIN->end_table();
}



function delete(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

// kill item =(
$DB->query("delete from ibf_auction where i_id='".$IN['i_id']."'");
$DB->query("OPTIMIZE TABLE ibf_infernoshop");

$ADMIN->done_screen("Item Removed", "Item Shop Control", "act=additem" );
}




function edit(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;


$ADMIN->html .= $SKIN->start_form( array(
1 => array( 'code'  , 'do_edit'  ),
2 => array( 'act'  , 'auction'     ),
3 => array( 'id'    , $IN['i_id']   ),
)  );


// $DB->query("SELECT * FROM ibf_auction WHERE i_id='".$IN['i_id']."'");
$DB->query("SELECT i.*,s.* FROM ibf_auction s LEFT JOIN ibf_infernoshop i ON (s.item=i.id) WHERE i_id='".$IN['i_id']."'");
if ( ! $Data = $DB->fetch_row() ){
$ADMIN->error("Unable to find the item inside the db");
}


//+-------------------------------

$SKIN->td_header[] = array( " "  , "40%" );
$SKIN->td_header[] = array( " "  , "60%" );

//+-------------------------------

$ADMIN->html .= $SKIN->start_table( "Edit Item" );

$ADMIN->html .= $SKIN->add_td_row( array( "<b>Item Name</b><br>" ,
$SKIN->form_input("name", $Data['name'])
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Description</b>" ,
$SKIN->form_input("desc", $Data['desc'] )
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Cost</b>" ,
$SKIN->form_input("cost", $Data['cost'] )
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Owner</b>" ,
$SKIN->form_input("owner", $Data['owner'] )
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Time</b>" ,
$SKIN->form_input("time", $Data['time'] )
)      );

$ADMIN->html .= $SKIN->end_form('Update Item');

$ADMIN->html .= $SKIN->end_table();
}



function do_edit(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

$db_string = array(

         'cost'      => $IN['cost'],
         'owner'      => $IN['owner'],
         'time'      => $IN['time'],
 );
$rstring = $DB->compile_db_update_string( $db_string );

$DB->query("UPDATE `ibf_auction` SET $rstring WHERE i_id='".$IN['id']."'");
$DB->query("OPTIMIZE TABLE ibf_auction");
$ADMIN->done_screen("Item Updated", "Item Shop Control", "act=additem" );
}




function log(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

$SKIN->td_header[] = array( "ID"    , "1%" );
$SKIN->td_header[] = array( "LOG"    , "100%" );
$ADMIN->html .= $SKIN->start_table( "Logs" );
$DB->query("SELECT * FROM ibf_auction_log");
while ($Data = $DB->fetch_row() ) {
$ADMIN->html .= $SKIN->add_td_row( array(
"<center><b>{$Data['id']}</b></center>",
"<div align=left>{$Data['log']}</div>",
)      );
}
$ADMIN->html .= $SKIN->end_table();
}




// end class
}
?>

 

file admin_pages.php

 

[COLOR=red]19 => array (
                                          1 =>array( 'Add Job' , 'act=jobs&code=addjob' ),
                                          2 =>array( 'Edit/Delete Jobs' , 'act=jobs&code=viewjob' ),
           ),[/COLOR]

[COLOR=green]20 => array (
                                          1 =>array( 'Auction' , 'act=auction&code=auction' ),
            2 =>array( 'Auction_Log' , 'act=auction&code=log' ),
           ),[/COLOR]

 

Same file

 

20 => "Auction Management",

 

20 => "Control your Auction",

 

File lang_rpg.php

 

'item_id' => "Не могу понять какой предмет вы хотите купить, попробуйте еще раз...",

 

БАЗА!

 

-- --------------------------------------------------------

-- 
-- Структура таблицы `ibf_auction`
-- 

CREATE TABLE `ibf_auction` (
 `i_id` int(11) NOT NULL auto_increment,
 `item` int(11) NOT NULL default '0',
 `owner` int(11) NOT NULL default '0',
 `cost` int(10) NOT NULL default '0',
 `time` int(10) NOT NULL default '0',
 `fu` int(10) NOT NULL default '0',
 PRIMARY KEY  (`i_id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=0;

-- 
-- Дамп данных таблицы `ibf_auction`
-- 

INSERT INTO `ibf_auction` VALUES (1, 1, 1, 1, 15000000000, 1);


-- --------------------------------------------------------

 

-- 
-- Структура таблицы `ibf_auction_log`
-- 

CREATE TABLE `ibf_auction_log` (
 `id` int(11) NOT NULL auto_increment,
 `log` text NOT NULL,
 PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=0;

-- 
-- Дамп данных таблицы `ibf_auction_log`
-- 

INSERT INTO `ibf_auction_log` VALUES (1, 'пользователь 1 выставил на аукцион предмет 1');

 

 

в таблице ibf_rpgoptions добавить колонку auctionon с параметром 1 (включено) или 0 (віключено)

Блин теги color повылазили(((

 

и еще я забыл

 

file skin_RPG.php

// by CTAPbIu_MABP

function auctiontop() {
global $ibforums;
return <<<EOF
<div class="tableborder">
<div class=maintitle align=center>
<a href='?act=RPG&CODE=auctionadd'>Поставить свой товар на торги</a><br>
<a href='?showtopic=4445'>Инсрукция по работе</a>
</div></div><br>

<div class="tableborder">
<div class=maintitle><b>{$ibforums->vars['board_name']} {$id['name']} Shop</b></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td class='titlemedium' align='center' width='1%'>Icon</td>
<td class='titlemedium' align='center'>Owner</td>
<td class='titlemedium' align='center'>Name</td>
<td class='titlemedium' align='center' width='1%'>Price</td>
<td class='titlemedium' align='center' width='1%'>Price Up</td>
<td class='titlemedium' align='center' width='1%'>Scan</td>
</tr>
EOF;
}

function auctionrow($Data) {
global $ibforums;
return <<<EOF
<tr>
<td class='row2' align='center' width='1%'><img src='html/Inferno/items/{$Data['img']}' alt='{$Data['name']}'></td>
<td class='row2' align='center'>{$Data['owner']}</td>
<td class='row2' align='center'>{$Data['name']}</td>
<td class='row2' align='center'>{$Data['cost']}</td>
<td class='row2' align='center' width='1%'><form action="{$ibforums->base_url}&act=RPG&CODE=do_auction" method="post"><input type='hidden' name="item_id" value="{$Data['id']}"><input type='hidden' name="i_id" value="{$Data['i_id']}"></input><select name="price" class="codebuttons"><option value="5">5<option value="10">10<option value="25">25<option value="50">50<option value="100">100<option value="200">200<option value="500">500<option value="1000">1000</select><input type="submit" value="submit"></form></td>
<td class='row2' align='center' width='1%'><a href='?act=RPG&CODE=scan&id={$Data['id']}'><img src='sources/Inferno/scan.gif' alt='Scan {$Data['name']}' border='0'></a></td>
</tr>
EOF;
}

function auctionbottom($Member) {
global $ibforums;
return <<<EOF
<tr>
<td colspan='6' class='row4' width='1%'>Total {$ibforums->lang['money']}: {$Member['money']}</td>
</tr>
</table>
</div>
<br>
EOF;
}

function addtop() {
global $ibforums;
return <<<EOF
<div class="tableborder">
<div class=maintitle><b>{$ibforums->vars['board_name']} {$id['name']} Shop</b></div>

<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td class='titlemedium' align='center' width='1%'>Icon</td>
<td class='titlemedium' align='center'>Name</td>
<td class='titlemedium' align='center'>Description</td>
<td class='titlemedium' align='center' width='1%'>Auction</td>
<td class='titlemedium' align='center' width='1%'>Scan</td>
</tr>
EOF;
}

function addrow($Data) {
global $ibforums;
return <<<EOF
<tr>
<td class='row2' align='center' width='1%'><img src='html/Inferno/items/{$Data['img']}' alt='{$Data['name']}'></td>
<td class='row2' align='center'>{$Data['name']}</td>
<td class='row2' align='center'>{$Data['desc']}</td>
<td class='row2' align='center' width='1%'><form action="{$ibforums->base_url}&act=RPG&CODE=do_add" method="post"><input type="hidden" name="add" value="{$Data['id']}"><input type="submit" value="submit"></form></td>
<td class='row2' align='center' width='1%'><a href='?act=RPG&CODE=scan&id={$Data['id']}'><img src='sources/Inferno/scan.gif' alt='Scan {$Data['name']}' border='0'></a></td>
</tr>
EOF;
}

function addbottom($Member) {
global $ibforums;
return <<<EOF
<tr>
<td colspan='5' class='row4' width='1%'>Total {$ibforums->lang['money']}: {$Member['money']}</td>
</tr>
</table>
</div>
<br>
EOF;
}

//end by

 

и file skin_global.php

<a href='{$ibforums->base_url}&act=RPG&CODE=auction'>Аукцион</a>
<a href='{$ibforums->base_url}&act=RPG&CODE=auction_add'>Добавить на аукцион</a>

Ссылка на комментарий
Поделиться на других сайтах

Я конечно знаю что немного не в тему, что есть спецальная тема для этого вопроса, но трафик не позволяет искать дальше...

Короче у меня к вам предложение: Сделать на рпг инферно карту, всмысле не говрода, а нескольких городов. Что бы можно было переезжать из города в город, что бы в каждом городе были разные магазины (точнее вещи разные в них), покупая билеты - такое возможно ???

Ссылка на комментарий
Поделиться на других сайтах

все возможно))) icq 289/833/781

а ты аукцион не ставил случаем?!

По просьбам трудящихся еще раз публикую полную, нормальную, доделаную версию аукциона и да простят меня админы за флуд!

 

ПРЕДУПРЕЖДЕНИЕ!: Перед установкой ОБЯЗАТЕЛЬНО сделайте бэкап!

 

КОПИРАЙТ: Скрипт написал CTAPbIu_MABP тоесть я :D для портала OTAS.RU который по некоторым причинам им не воспользовался... Поэтому я выкладываю его на общее пользование. Каждый желающий может устанавливать, изменять и/или улучшать код на свое усмотрение не забывая оставить надписи "//by CTAPbIu_MABP" и "//end by"

 

ПРОСЬБА: Люди знающие SQL лучше меня плз помогите оптимизировать функцию "// remove offtimes" а то она слишком распухла

 

Итак мод к RPG Inferno 4.2

 

Разрабатывалось на IPB 1.3.1 и RPG Inferno 2.5, тестировалось на RPG Inferno 4.2, с IPB 2.0.x совместимость неизвестна

 

Итак начнем:

 

Открыть: source/RPG.php

 

найти

switch($ibforums->input['CODE']) {

 

снизу

// by CTAPbIu_MABP
case 'auction':
$this->auction();
break;
case 'do_auction':
$this->do_auction();
break;
case 'auctionadd':
$this->auctionadd();
break;
case 'do_add':
$this->do_add();
break;
// end by

 

 

найти

// print data
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." - ".$this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );
}

 

снизу

//by CTAPbIu_MABP

function auction(){
global $DB, $ibforums, $std;

// fitch
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='".$ibforums->member['id']."'");
$Member=$DB->fetch_row();

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['owner']}");
$owner=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['fu']}");
$fu=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_infernoshop WHERE id = {$RemData['item']} ");
$item=$DDB->fetch_row();
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$owner['name']}</b> выиграл торги на предмет {$item['name']}</b>')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$fu['name']}</b> получил <b>{$RemData['cost']}</b> за предмет <b>{$item['name']}</b> проданный с аукциона')");
}

// Grab Items And Data
$this->output .= $this->html->auctiontop($shop);

$DB->query("SELECT i.*,s.*,w.name as owner
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)");

while($Item=$DB->fetch_row()){
$this->output .= $this->html->auctionrow($Item);
}

$this->output .= $this->html->auctionbottom($Member);

$this->output .= $this->html->Copyright();
$this->page_title = "Itemshop";
$this->nav        = array( "Itemshop", );
}



function do_auction(){
global $ibforums, $DB, $std, $print;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['owner']}");
$owner=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['fu']}");
$fu=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_infernoshop WHERE id = {$RemData['item']} ");
$item=$DDB->fetch_row();
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$owner['name']}</b> выиграл торги на предмет {$item['name']}</b>')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$fu['name']}</b> получил <b>{$RemData['cost']}</b> за предмет <b>{$item['name']}</b> проданный с аукциона')");
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='{$ibforums->member['id']}'");
$this->member=$DB->fetch_row();

// Grab Items And Data
$DB->query("SELECT * FROM ibf_auction where i_id = {$ibforums->input['i_id']}");
$this->TData = $DB->fetch_row();

// is already own?
$DB->query("SELECT * FROM ibf_infernostock WHERE owner = '{$ibforums->member['id']}'");
$this->RData = $DB->fetch_row();
if ($this->RData['item'] == $ibforums->input['item_id']){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'allr_owni' ) );
}

// isn't it your's?
if ($this->TData['owner'] == $ibforums->member['id']) { 
$print->redirect_screen( "Это и так Ваше, Вы не можете купить у самого себя!", 'act=RPG&CODE=auction' );
}

// dont you have another?
$DB->query("SELECT * FROM ibf_auction where owner = '{$ibforums->member['id']}'");
$this->SData = $DB->fetch_row();
if ($this->SData['item'] == $ibforums->input['item_id']){
$print->redirect_screen( "Здается мне вы уже торгуетесь за такую вещ...", 'act=RPG&CODE=auction' );
}

// do you rich enought?
$fullcost = $this->TData['cost'] + $ibforums->input['price'];
if ($this->member['money'] < $fullcost){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'need_morem' ) );
}

// return money
$DB->query("SELECT * FROM ibf_members where id = {$this->TData['owner']}");
$this->PData = $DB->fetch_row();
$this->rmoney = $this->PData['money'] + $this->TData['cost'];
$DB->query("UPDATE ibf_members SET money = $this->rmoney WHERE id={$this->TData['owner']} ");

// loose money
$this->lmoney = $this->member['money'] - $this->TData['cost'] - $ibforums->input['price'];
$DB->query("UPDATE ibf_members SET money = $this->lmoney WHERE id={$this->member['id']} ");

// new price and owner
$this->new_price = $this->TData['cost'] + $ibforums->input['price'];
$DB->query("UPDATE ibf_auction SET cost = $this->new_price, owner = {$this->member['id']} WHERE i_id={$ibforums->input['i_id']} ");

//log
$DB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$ibforums->member['name']} поднял цену на предмет {$ibforums->input['item_id']} с {$this->TData['cost']} до $this->new_price')");

// all right :)
$print->redirect_screen( "Теперь этот замечательный предмет Ваш!!!", 'act=RPG&CODE=auction' );
}


function auctionadd(){
global $DB, $ibforums, $std;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['owner']}");
$owner=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['fu']}");
$fu=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_infernoshop WHERE id = {$RemData['item']} ");
$item=$DDB->fetch_row();
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$owner['name']}</b> выиграл торги на предмет {$item['name']}</b>')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$fu['name']}</b> получил <b>{$RemData['cost']}</b> за предмет <b>{$item['name']}</b> проданный с аукциона')");
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='".$ibforums->member['id']."'");
$Member=$DB->fetch_row();

// Grab Items And Data
$this->output .= $this->html->addtop($shop);

$DB->query("SELECT i.*,s.* FROM ibf_infernostock s LEFT JOIN ibf_infernoshop i ON (s.item=i.id) where s.owner='{$ibforums->member['id']}'");
while($Item=$DB->fetch_row()){
$this->output .= $this->html->addrow($Item);
}
$this->output .= $this->html->addbottom($Member);

$this->output .= $this->html->Copyright();
$this->page_title = "Itemshop";
$this->nav        = array( "Itemshop", );
}



function do_add(){
global $DB, $ibforums, $std, $print;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['owner']}");
$owner=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_members WHERE id = {$RemData['fu']}");
$fu=$DDB->fetch_row();
$DDB->query("SELECT * FROM ibf_infernoshop WHERE id = {$RemData['item']} ");
$item=$DDB->fetch_row();
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$owner['name']}</b> выиграл торги на предмет {$item['name']}</b>')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь <b>{$fu['name']}</b> получил <b>{$RemData['cost']}</b> за предмет <b>{$item['name']}</b> проданный с аукциона')");
}

// remove item from user inventary and add it to auction
$endtime = $time + 1728000;
$i=0;
$DB->query("SELECT * FROM ibf_infernostock WHERE item = {$ibforums->input['add']}");
while ($EData = $DB->fetch_row()){
$i++;
if ($EData['owner'] == $ibforums->member['id']){
$DDB->query("DELETE FROM ibf_infernostock WHERE (owner = {$ibforums->member['id']} && item = {$ibforums->input['add']})");
$DDB->query("INSERT INTO ibf_auction VALUES ('','{$EData['item']}','{$EData['owner']}','1','$endtime', '{$ibforums->member['id']}')");
}}

//log
$DB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$ibforums->member['name']} выставил на аукцион предмет {$ibforums->input['add']}')");

// all right :)
$print->redirect_screen( "Вы выставили этот предмет на торги!!!", 'act=RPG&CODE=auction' );
}

//end by

 

 

Открыть: sources/Admin/admin_pages.php

 

найти

19 => array (
            1 =>array( 'Add Job' , 'act=jobs&code=addjob' ),
            2 =>array( 'Edit/Delete Jobs' , 'act=jobs&code=viewjob' ),
           ),

 

снизу

20 => array (
            1 =>array( 'Auction' , 'act=auction&code=auction' ),
            2 =>array( 'Auction_Log' , 'act=auction&code=log' ),
           ),

 

 

найти

19 => "Job Office Management",

снизу

20 => "Auction Management",

 

найти

19 => "Control your Job Office",

снизу

20 => "Control your Auction",

 

 

Открыть: sources/Admin/ad_rpgop.php

 

найти

$ADMIN->html .= $SKIN->add_td_row( array( "<b>RPG Jobs State</b>" ,
$SKIN->form_dropdown('rpgjobon', $state,"",""),
"Currently: <b>{$online['rpgjobon']}</b>",
)      );

 

снизу

$ADMIN->html .= $SKIN->add_td_row( array( "<b>RPG Auction State</b>" ,
$SKIN->form_dropdown('auctionon', $state,"",""),
"Currently: <b>{$online['auctionon']}</b>",
)      );

 

 

найти

$DB->query("update ibf_rpgoptions set itemshopon='{$IN['itemshopon']}',bankon='{$IN['bankon']}',transferon='{$IN['transferon']}',healingon='{$IN['healingon']}',battleon='{$IN['battleon']}',clanon='{$IN['clanon']}',rpgstatson='{$IN['rpgstatson']}',lotteryon='{$IN['lotteryon']}',storeon='{$IN['storeon']}',helpeon='{$IN['helpeon']}',rpgjobon='{$IN['rpgjobon']}' where id='1'");

заменить

$DB->query("update ibf_rpgoptions set itemshopon='{$IN['itemshopon']}',bankon='{$IN['bankon']}',transferon='{$IN['transferon']}',healingon='{$IN['healingon']}',battleon='{$IN['battleon']}',clanon='{$IN['clanon']}',rpgstatson='{$IN['rpgstatson']}',lotteryon='{$IN['lotteryon']}',storeon='{$IN['storeon']}',helpeon='{$IN['helpeon']}',rpgjobon='{$IN['rpgjobon']}',auctionon='{$IN['auctionon']}' where id='1'");

 

 

Создать: sources/Admin/ad_auction.php

<?php

// by CTAPbIu_MABP

$idx = new ad_rpgstore();


class ad_rpgstore {
function ad_rpgstore() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_title = "Mange RPG Store";
$ADMIN->page_detail = "";

switch($IN['code']){
case 'auction':
$this->view();
break;

case 'delete':
$this->delete();
break;

case 'do_edit':
$this->do_edit();
break;

case 'edit':
$this->edit();
break;

case 'log':
$this->log();
break;

case 'log_del':
$this->log_del();
break;

default:
$this->view();
break;
}
$ADMIN->output();
}

function view(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$SKIN->td_header[] = array( "Icon"    , "10%" );
$SKIN->td_header[] = array( "Owner"    , "10%" );
$SKIN->td_header[] = array( "Name" , "20%" );
$SKIN->td_header[] = array( "Description"       , "35%" );
$SKIN->td_header[] = array( "Cost"         , "10%" );
$SKIN->td_header[] = array( "Edit"         , "5%" );
$SKIN->td_header[] = array( "Delete"         , "5%" );

// ----------------

$ADMIN->html .= $SKIN->start_table( "Manage Items In RPG Auction" );
$DB->query("SELECT i.*,s.*,w.name as owner
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)");
while ($Data = $DB->fetch_row() ) {
$ADMIN->html .= $SKIN->add_td_row( array(
"<center><img src='{$INFO['html_url']}/Inferno/items/{$Data['img']}'></center>" ,
"<center><b>{$Data['owner']}</b></center>",
"<center><b>{$Data['name']}</b></center>",
"<center>{$Data['desc']}</center>",
"<center>{$Data['cost']}</center>",
"<center><a href='{$ADMIN->base_url}&act=auction&code=edit&i_id={$Data['i_id']}'>Edit</a></center>",
"<center><a href='{$ADMIN->base_url}&act=auction&code=delete&i_id={$Data['i_id']}'>Delete</a></center>",
)      );

}
$ADMIN->html .= $SKIN->end_table();
}



function delete(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

// kill item =(
$DB->query("delete from ibf_auction where i_id='".$IN['i_id']."'");
$DB->query("OPTIMIZE TABLE ibf__auction");

$ADMIN->done_screen("Item Removed", "Item Shop Control", "act=auction" );
}




function edit(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;


$ADMIN->html .= $SKIN->start_form( array(
1 => array( 'code'  , 'do_edit'  ),
2 => array( 'act'  , 'auction'     ),
3 => array( 'id'    , $IN['i_id']   ),
)  );


// $DB->query("SELECT * FROM ibf_auction WHERE i_id='".$IN['i_id']."'");
$DB->query("SELECT i.*,s.* FROM ibf_auction s LEFT JOIN ibf_infernoshop i ON (s.item=i.id) WHERE i_id='".$IN['i_id']."'");
if ( ! $Data = $DB->fetch_row() ){
$ADMIN->error("Unable to find the item inside the db");
}


//+-------------------------------

$SKIN->td_header[] = array( " "  , "40%" );
$SKIN->td_header[] = array( " "  , "60%" );

//+-------------------------------

$ADMIN->html .= $SKIN->start_table( "Edit Item" );

$ADMIN->html .= $SKIN->add_td_row( array( "<b>Item Name</b><br>" ,
$SKIN->form_input("name", $Data['name'])
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Description</b>" ,
$SKIN->form_input("desc", $Data['desc'] )
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Cost</b>" ,
$SKIN->form_input("cost", $Data['cost'] )
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Owner</b>" ,
$SKIN->form_input("owner", $Data['owner'] )
)      );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Time</b>" ,
$SKIN->form_input("time", $Data['time'] )
)      );

$ADMIN->html .= $SKIN->end_form('Update Item');

$ADMIN->html .= $SKIN->end_table();
}



function do_edit(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

$db_string = array(

         'cost'      => $IN['cost'],
         'owner'      => $IN['owner'],
         'time'      => $IN['time'],
 );
$rstring = $DB->compile_db_update_string( $db_string );

$DB->query("UPDATE `ibf_auction` SET $rstring WHERE i_id='".$IN['id']."'");
$DB->query("OPTIMIZE TABLE ibf_auction");
$ADMIN->done_screen("Item Updated", "Item Shop Control", "act=additem" );
}




function log(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

$SKIN->td_header[] = array( "ID"    , "1%" );
$SKIN->td_header[] = array( "LOG"    , "100%" );
$SKIN->td_header[] = array( "DELETE"    , "1%" );
$ADMIN->html .= $SKIN->start_table( "Logs" );
$DB->query("SELECT * FROM ibf_auction_log");
while ($Data = $DB->fetch_row() ) {
$ADMIN->html .= $SKIN->add_td_row( array(
"<div align=center><b>{$Data['id']}</b></div>",
"<div align=left>{$Data['log']}</div>",
"<div align=center><a href='{$ADMIN->base_url}&act=auction&code=log_del&id={$Data['id']}'>Delete</a></div>",
)      );
}
$ADMIN->html .= $SKIN->end_table();
}

function log_del(){
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;

// kill item =(
$DB->query("delete from ibf_auction_log where id='".$IN['id']."'");
$DB->query("OPTIMIZE TABLE ibf_auction_log");

$ADMIN->done_screen("Log Removed", "Auction Log Control", "act=auction&code=log" );
}


// end class
}

// end by

?>

 

 

Открыть: Skin/s*/skin_RPG.php

найти

function HealInvTop() {

 

сверху

// by CTAPbIu_MABP

function auctiontop() {
global $ibforums;
return <<<EOF
<div class="tableborder">
<div class=maintitle align=center>
<a href='?act=RPG&CODE=auctionadd'>Iinoaaeou naie oiaa? ia oi?ae</a><br>
<a href='?showtopic=4445'>Ein?oeoey ii ?aaioa</a>
</div></div><br>

<div class="tableborder">
<div class=maintitle><b>{$ibforums->vars['board_name']} {$id['name']} Shop</b></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td class='titlemedium' align='center' width='1%'>Icon</td>
<td class='titlemedium' align='center'>Owner</td>
<td class='titlemedium' align='center'>Name</td>
<td class='titlemedium' align='center' width='1%'>Price</td>
<td class='titlemedium' align='center' width='1%'>Price Up</td>
<td class='titlemedium' align='center' width='1%'>Scan</td>
</tr>
EOF;
}

function auctionrow($Data) {
global $ibforums;
return <<<EOF
<tr>
<td class='row2' align='center' width='1%'><img src='html/Inferno/items/{$Data['img']}' alt='{$Data['name']}'></td>
<td class='row2' align='center'>{$Data['owner']}</td>
<td class='row2' align='center'>{$Data['name']}</td>
<td class='row2' align='center'>{$Data['cost']}</td>
<td class='row2' align='center' width='1%'><form action="{$ibforums->base_url}&act=RPG&CODE=do_auction" method="post"><input type='hidden' name="item_id" value="{$Data['id']}"><input type='hidden' name="i_id" value="{$Data['i_id']}"></input><select name="price" class="codebuttons"><option value="5">5<option value="10">10<option value="25">25<option value="50">50<option value="100">100<option value="200">200<option value="500">500<option value="1000">1000</select><input type="submit" value="submit"></form></td>
<td class='row2' align='center' width='1%'><a href='?act=RPG&CODE=scan&id={$Data['id']}'><img src='sources/Inferno/scan.gif' alt='Scan {$Data['name']}' border='0'></a></td>
</tr>
EOF;
}

function auctionbottom($Member) {
global $ibforums;
return <<<EOF
<tr>
<td colspan='6' class='row4' width='1%'>Total {$ibforums->lang['money']}: {$Member['money']}</td>
</tr>
</table>
</div>
<br>
EOF;
}

function addtop() {
global $ibforums;
return <<<EOF
<div class="tableborder">
<div class=maintitle><b>{$ibforums->vars['board_name']} {$id['name']} Shop</b></div>

<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td class='titlemedium' align='center' width='1%'>Icon</td>
<td class='titlemedium' align='center'>Name</td>
<td class='titlemedium' align='center'>Description</td>
<td class='titlemedium' align='center' width='1%'>Auction</td>
<td class='titlemedium' align='center' width='1%'>Scan</td>
</tr>
EOF;
}

function addrow($Data) {
global $ibforums;
return <<<EOF
<tr>
<td class='row2' align='center' width='1%'><img src='html/Inferno/items/{$Data['img']}' alt='{$Data['name']}'></td>
<td class='row2' align='center'>{$Data['name']}</td>
<td class='row2' align='center'>{$Data['desc']}</td>
<td class='row2' align='center' width='1%'><form action="{$ibforums->base_url}&act=RPG&CODE=do_add" method="post"><input type="hidden" name="add" value="{$Data['id']}"><input type="submit" value="submit"></form></td>
<td class='row2' align='center' width='1%'><a href='?act=RPG&CODE=scan&id={$Data['id']}'><img src='sources/Inferno/scan.gif' alt='Scan {$Data['name']}' border='0'></a></td>
</tr>
EOF;
}

function addbottom($Member) {
global $ibforums;
return <<<EOF
<tr>
<td colspan='5' class='row4' width='1%'>Total {$ibforums->lang['money']}: {$Member['money']}</td>
</tr>
</table>
</div>
<br>
EOF;
}

//end by

 

Открыть: Skin/s*/skin_global.php

 

найти

<a href='{$ibforums->base_url}&act=RPG&CODE=Bank'>Bank</a> |

 

снизу

<a href='{$ibforums->base_url}&act=RPG&CODE=auction'>Auction</a> |

 

 

Открыть: lang/en/lang_rpg.php

 

найти

'notenoughs' => "Sorry, you do not have enough to buy a shop",

 

снизу

'item_id' => "Не могу понять какой предмет вы хотите купить, попробуйте еще раз...",

 

 

Код закончился ;) началась БД

 

создать файл и запустить

 

<html>
<head>
<title>RPG Inferno Installler</title>
</head>
<body bgcolor='000000'>
<font face='arial' color='999999' size='1'>
Preparing To Install RPG Inferno v4.1<br>
Starting Install<br>
<?php
// Require the configuration
require "./conf_global.php";

// Connect to the database
$INFO['sql_driver'] = !$INFO['sql_driver'] ? 'mySQL' : $INFO['sql_driver'];

$to_require = "./sources/Drivers/".$INFO['sql_driver'].".php";
require ($to_require);

$DB = new db_driver;

$DB->obj['sql_database']     = $INFO['sql_database'];
$DB->obj['sql_user']         = $INFO['sql_user'];
$DB->obj['sql_pass']         = $INFO['sql_pass'];
$DB->obj['sql_host']         = $INFO['sql_host'];
$DB->obj['sql_tbl_prefix']   = $INFO['sql_tbl_prefix'];

// Connect Now
echo('Connecting To Database<br>');
$DB->connect();
echo('Connection Complete - Hacking Database...<br>');
$install=Array();


$install[] = "CREATE TABLE `ibf_auction` (
 `i_id` int(11) NOT NULL auto_increment,
 `item` int(11) NOT NULL default '0',
 `owner` int(11) NOT NULL default '0',
 `cost` int(10) NOT NULL default '0',
 `time` int(10) NOT NULL default '0',
 `fu` int(10) NOT NULL default '0',
 PRIMARY KEY  (`i_id`)
) TYPE=MyISAM AUTO_INCREMENT=1;";



$install[] = "CREATE TABLE `ibf_auction_log` (
 `id` int(11) NOT NULL auto_increment,
 `log` text NOT NULL,
 PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;";


$install[] = "alter table ibf_options
add `auctionon` text not null;";

echo('Inserts Complete<br>');
foreach ($install AS $this_query){
$DB->query($this_query);
}
$DB->close_db();
echo('Install Complete - REMOVE FILE NOW!!! <- Yeh, what he said');
?>
</body>
</html>

 

Готов

Ссылка на комментарий
Поделиться на других сайтах

Ну я в кодинге не силен, но мой друган с которым мы держим нашу локальную РПГ инферно под ИПБ 2.х переписал твой скрипт... пока шас происходить отладка скриптов. Он ещё немного недоработан но все в процессе. В дальнейшем планы на апгреид рпг инферно:

1. Добавление параметров (там магия, ловкость, интеллект....)

2. Улучшение боя (принцип комбатса)

3. Создание карты (как в комбатсе, токо вот рисовать её надо а так нехочеться)

4. Усовершенствование кузници (ужас как не понравилась)

5. Добавление магических вещей (типа +5 удара молнии, защиты от ней, удар огня - это как для всяких ожерельев, камней и прочей гадости)

6. Курс валют ещё не ставил ( но чувствую тож надо много менять)

7. Преписывание целебного источника (что бы при нажатии кнопки обновить не пополняло жизни а щитало по времени, к примеру 1 минута = +20 жизней + 8 маны и - 10 золота)

8. Дописание ко всем этим функциям пунктов в админцентрах

9. Добовление и присваивание вещам статуса сламмался, подчинить, апгрейдить.

Остальное пока ещё не придумали....

 

Кто хочет беритесь за дело пишите, будем обмениваться модами, я думаю администрация форума непротив будет того что на их архиве пудут появлять ПРОДУМАНЫЕ, ПРОРАБОТАНЫЕ, КАЧЕСТВЕННЫЕ и Экслюзивные моды.

 

П.С: а все- так мож у кто то писал уже карту на инферно?

Ссылка на комментарий
Поделиться на других сайтах

А вот он я :D

По поводу сообщения Фримана:

Мавр, я так понял, ты на ИПБ 1й писал мод? а то на 2,0,3 он никак не хотел ставится :) Вчера переписал скрипт на админку, сейчас переписываю скрипт для юзверов. Касаемо остального - всё по порядку ;)

Сейчас, кроме всего перевожу скрипты админмода RPG. Я то английский знаю, но вот со-администраторы - не бум-бум :D

 

Если что, пишите письма.

zentavr[сабака]neuro.zp.ua[1111534345:1111559547]Ну, вроде как закончил... Выкладываю свои наработки :)

Имеем IPG 2.0.3 rus RPG Inferno 4.2

 

Открываем: sources/rpg.php

Ищем

switch($ibforums->input['code']) {

 

Пишем ниже

// ++++ Аукцион +++
// by CTAPbIu_MABP
case 'auction':
$this->auction();
break;
case 'do_auction':
$this->do_auction();
break;
case 'auctionadd':
$this->auctionadd();
break;
case 'do_add':
$this->do_add();
break;
// end by

 

 

В этом же файле ищем

// print data
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." - ".$this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );
}

 

В этом же файле добавляем

/* ********************************** */
//by CTAPbIu_MABP
// patched by Andrey Juroff Zentavr
function auction(){
global $DB, $ibforums, $std;

// fitch
$DDB = $DB;

// Является ли секция в онлайне?
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// Выбираем юзвера, который открыл эту страничку с таблицы
$DB->query("SELECT * FROM ibf_members where id='".$ibforums->member['id']."'");
$Member=$DB->fetch_row();

// Удаляем старьё;)
$time = time();
$i=0; // << === А зачем это???

$DB->query("SELECT * FROM ibf_auction WHERE time <= $time"); //  Выбираем всё старьё
/*
$RemData['owner'] - победитель аукциона, получает товар, теряет деньги
$RemData['fu'] - предыдущий хозяин товара, выставшивый его на аукцион, теряет товар, получает деньги
*/

while ($RemData = $DB->fetch_row()){
$i++; // << === А зачем это???
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')"); // Кладём победителю товар
$big_money = $Member['money'] + $RemData['cost']; // 
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// Grab Items And Data
$this->output .= $this->html->auctiontop($shop);

$DB->query("SELECT i.*,s.*,w.name as owner, z.name as fu
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)
LEFT JOIN ibf_members z ON (s.fu=z.id)
");

if($DB->get_num_rows() == 0)
$this->output .= $this->html->addnullrow(8, "На аукционе нет товаров для продажи");
else while($Item=$DB->fetch_row())
$this->output .= $this->html->auctionrow($Item);


$this->output .= $this->html->auctionbottom($Member);

$this->output .= $this->html->Copyright();
$this->page_title = "Аукцион";
$this->nav        = array( "Аукцион", );
}



function do_auction(){
global $ibforums, $DB, $std, $print;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='{$ibforums->member['id']}'");
$this->member=$DB->fetch_row();

// Grab Items And Data
$DB->query("SELECT * FROM ibf_auction where i_id = {$ibforums->input['i_id']}");
$this->TData = $DB->fetch_row();

// is already own?
$DB->query("SELECT * FROM ibf_infernostock WHERE owner = '{$ibforums->member['id']}'");
$this->RData = $DB->fetch_row();
if ($this->RData['item'] == $ibforums->input['item_id']){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'allr_owni' ) );
}

// isn't it your's?
if ($this->TData['owner'] == $ibforums->member['id']) { 
$print->redirect_screen( "Это и так Ваше, Вы не можете купить у самого себя!", 'act=rpg&code=auction' );
}

// dont you have another?
$DB->query("SELECT * FROM ibf_auction where owner = '{$ibforums->member['id']}'");
$this->SData = $DB->fetch_row();
if ($this->SData['item'] == $ibforums->input['item_id']){
$print->redirect_screen( "Сдается мне, Вы уже торгуетесь за такую вещь...", 'act=rpg&code=auction' );
}

// do you rich enought?
$fullcost = $this->TData['cost'] + $ibforums->input['price'];
if ($this->member['money'] < $fullcost){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'need_morem' ) );
}

// return money
$DB->query("SELECT * FROM ibf_members where id = {$this->TData['owner']}");
$this->PData = $DB->fetch_row();
$this->rmoney = $this->PData['money'] + $this->TData['cost'];
$DB->query("UPDATE ibf_members SET money = $this->rmoney WHERE id={$this->TData['owner']} ");

// loose money
$this->lmoney = $this->member['money'] - $this->TData['cost'] - $ibforums->input['price'];
$DB->query("UPDATE ibf_members SET money = $this->lmoney WHERE id={$this->member['id']} ");

// new price and owner
$this->new_price = $this->TData['cost'] + $ibforums->input['price'];
$DB->query("UPDATE ibf_auction SET cost = $this->new_price, owner = {$this->member['id']} WHERE i_id={$ibforums->input['i_id']} ");

//log
$DB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$ibforums->member['id']} поднял цену на предмет {$ibforums->input['item_id']} с {$this->TData['cost']} до $this->new_price')");

// all right :)
$print->redirect_screen( "Теперь этот замечательный предмет Ваш!!!", 'act=rpg&code=auction' );
}


function auctionadd(){
global $DB, $ibforums, $std;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// Member Money
$DB->query("SELECT * FROM ibf_members where id='".$ibforums->member['id']."'");
$Member=$DB->fetch_row();

// Grab Items And Data
$this->output .= $this->html->addtop($shop);

$DB->query("SELECT i.*,s.* FROM ibf_infernostock s LEFT JOIN ibf_infernoshop i ON (s.item=i.id) where s.owner='{$ibforums->member['id']}'");
if($DB->get_num_rows() == 0)
$this->output .= $this->html->addnullrow(7, "У вас нечего выставить на аукцион.");
else while($Item=$DB->fetch_row())
$this->output .= $this->html->addrow($Item);

$this->output .= $this->html->addbottom($Member);

$this->output .= $this->html->Copyright();
$this->page_title = "Аукцион";
$this->nav        = array( "Аукцион", );
}



function do_add(){
global $DB, $ibforums, $std, $print;

// fitch (for offtimes)
$DDB = $DB;

// are we offline? v2 //
$DB->query("SELECT * FROM ibf_rpgoptions where id='1'");
$options=$DB->fetch_row();
if($options['auctionon']=="Offline"){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_offline' ) );
}

// Проверка, цифрами ли юзер ввёл цену
$lot_price = (int)$ibforums->input['cost'];
if($lot_price <= 0){
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'section_auction_errnum' ) );
}

// remove offtimes
$time = time();
$i=0;
$DB->query("SELECT * FROM ibf_auction WHERE time <= $time");
while ($RemData = $DB->fetch_row()){
$i++;
$DDB->query("INSERT INTO ibf_infernostock VALUES('','{$RemData['owner']}','{$RemData['item']}')");
$big_money = $Member['money'] + $RemData['cost'];
$DDB->query("UPDATE ibf_members SET money = $big_money WHERE id={$RemData['fu']} ");
$DDB->query("DELETE FROM ibf_auction WHERE time <= $time");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['owner']} выиграл торги на предмет {$RemData['item']}')");
$DDB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$RemData['fu']} получил {$RemData['cost']} за предмет {$RemData['item']} проданный с аукциона')");
}

// remove item from user inventary and add it to auction
$endtime = $time + (int)$ibforums->input['period'];
$i=0;
$DB->query("SELECT * FROM ibf_infernostock WHERE item = {$ibforums->input['add']}");
while ($EData = $DB->fetch_row()){
$i++;
if ($EData['owner'] == $ibforums->member['id']){
$DDB->query("DELETE FROM ibf_infernostock WHERE (owner = {$ibforums->member['id']} && item = {$ibforums->input['add']})");
////// Oaia ////
$DDB->query("INSERT INTO ibf_auction VALUES ('','{$EData['item']}','{$EData['owner']}','$lot_price','$endtime', '{$ibforums->member['id']}')");
}}

//log
$DB->query("INSERT INTO ibf_auction_log VALUES('','пользователь {$ibforums->member['id']} выставил на аукцион предмет {$ibforums->input['add']}')");

// all right :)
$print->redirect_screen( "Вы выставили этот предмет на торги $time --- $endtime !!!", 'act=rpg&code=auction' );
}

//end by

/* *********************************** */

 

Открыть: sources/admin/admin_pages.php

Где-то среди всего всего, что качается RPG-менюшек добавить

$PAGES[count($PAGES)+100] = array(
      1 =>array( 'Аукцион' , 'act=auction&code=auction'),
      2 =>array( 'Логи аукциона' , 'act=auction&code=log'),
  	 );
   
$CATS[count($CATS)+100] = array("Аукцион", '#AAAAAA' );
$DESC[count($PAGES)+100] = "Управление RPG аукционом";

 

Открываем sources/admin/ad_rpgop.php

Ищем

$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>RPG Jobs State</b>" ,
$ibforums->adskin->form_dropdown('rpgjobon', $state,"",""),
"Currently: <b>{$online['rpgjobon']}</b>",
)      );

 

Сразу под ним по образу и подобию пишем

$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Аукцион</b>" ,
$ibforums->adskin->form_dropdown('auctionon', $state,"",""),
"Сейчас: <b>{$online['auctionon']}</b>",
)      );

 

В этом же файле найти

function doonline(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;
$DB->query("update ibf_rpgoptions set itemshopon='{$ibforums->input['itemshopon']}',bankon='{$ibforums->input['bankon']}',transferon='{$ibforums->input['transferon']}',healingon='{$ibforums->input['healingon']}',battleon='{$ibforums->input['battleon']}',clanon='{$ibforums->input['clanon']}',rpgstatson='{$ibforums->input['rpgstatson']}',lotteryon='{$ibforums->input['lotteryon']}',storeon='{$ibforums->input['storeon']}',helpeon='{$ibforums->input['helpeon']}',rpgjobon='{$ibforums->input['rpgjobon']}',synthesison='{$ibforums->input['synthesison']}',adventureon='{$ibforums->input['adventureon']}',botbattleon='{$ibforums->input['botbattleon']}' where id='1'");
$ibforums->admin->done_screen("Состояние RPG секций изменено", "Состояние разделов", "act=rpgop&code=setonline" );

 

И заменить на

function doonline(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;
$DB->query("update ibf_rpgoptions set itemshopon='{$ibforums->input['itemshopon']}',bankon='{$ibforums->input['bankon']}',transferon='{$ibforums->input['transferon']}',healingon='{$ibforums->input['healingon']}',battleon='{$ibforums->input['battleon']}',clanon='{$ibforums->input['clanon']}',rpgstatson='{$ibforums->input['rpgstatson']}',lotteryon='{$ibforums->input['lotteryon']}',storeon='{$ibforums->input['storeon']}',helpeon='{$ibforums->input['helpeon']}',rpgjobon='{$ibforums->input['rpgjobon']}',synthesison='{$ibforums->input['synthesison']}',adventureon='{$ibforums->input['adventureon']}',auctionon='{$ibforums->input['auctionon']}',botbattleon='{$ibforums->input['botbattleon']}' where id='1'");
$ibforums->admin->done_screen("Состояние RPG секций изменено", "Состояние разделов", "act=rpgop&code=setonline" );
}

Создаём sources/admin/ad_auction.php

<?php
// by CTAPbIu_MABP
// patched to version IPB 2.0.3 by Andrey Juroff Zentavr
$idx = new ad_auction();


class ad_auction {

function ad_auction() {
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;
$ibforums->admin->page_title = "Управление аукционом";
$ibforums->admin->page_detail = "";

switch($ibforums->input['code']){
case 'auction':
$this->view();
break;

case 'delete':
$this->delete();
break;

case 'do_edit':
$this->do_edit();
break;

case 'edit':
$this->edit();
break;

case 'log':
$this->log();
break;

default:
$this->view();
break;
}

$ibforums->admin->output();
}

function view(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;

$ibforums->adskin->td_header[] = array( " "    , "4%" );
$ibforums->adskin->td_header[] = array( "Текущий держатель"    , "18%" );
$ibforums->adskin->td_header[] = array( "Продавец"    , "18%" );
$ibforums->adskin->td_header[] = array( "Наименование" , "20%" );
$ibforums->adskin->td_header[] = array( "Описание"       , "20%" );
$ibforums->adskin->td_header[] = array( "Цена"         , "5%" );
$ibforums->adskin->td_header[] = array( "Правка"         , "5%" );
$ibforums->adskin->td_header[] = array( "Удаление"         , "5%" );

// ----------------

$ibforums->html .= $ibforums->adskin->start_table( "Управление лотами RPG Аукциона" );
/*$DB->query("SELECT i.*,s.*,w.name as owner
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)");
*/
$DB->query("SELECT i.*,s.*,w.name as owner, z.name as fu
FROM ibf_auction s 
LEFT JOIN ibf_infernoshop i ON (s.item=i.id)
LEFT JOIN ibf_members w ON (s.owner=w.id)
LEFT JOIN ibf_members z ON (s.fu=z.id)
");

$ibforums->vars['html_url'] = "html";

while ($Data = $DB->fetch_row() ) {
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<center><img src='{$ibforums->vars['html_url']}/Inferno/items/{$Data['img']}'></center>" ,
"<center><b>{$Data['owner']}</b></center>",
"<center><b>{$Data['fu']}</b></center>",
"<center><b>{$Data['name']}</b></center>",
"<center>{$Data['desc']}</center>",
"<center>{$Data['cost']}</center>",
"<center><a href='{$ibforums->admin->base_url}&act=auction&code=edit&i_id={$Data['i_id']}'>Редактировать</a></center>",
"<center><a href='{$ibforums->admin->base_url}&act=auction&code=delete&i_id={$Data['i_id']}'>Удалить</a></center>",
)      );

}
$ibforums->html .= $ibforums->adskin->end_table();
}



function delete(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;

// kill item =(
$DB->query("delete from ibf_auction where i_id='".$ibforums->input['i_id']."'");
$DB->query("OPTIMIZE TABLE ibf_infernoshop");

$ibforums->admin->done_screen("Предмет удалён", "Управление аукционом", "act=auction" );
}




function edit(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;


$ibforums->html .= $ibforums->adskin->start_form( array(
1 => array( 'code'  , 'do_edit'  ),
2 => array( 'act'  , 'auction'     ),
3 => array( 'id'    , $ibforums->input['i_id']   ),
)  );


// $DB->query("SELECT * FROM ibf_auction WHERE i_id='".$ibforums->input['i_id']."'");
$DB->query("SELECT i.*,s.* FROM ibf_auction s LEFT JOIN ibf_infernoshop i ON (s.item=i.id) WHERE i_id='".$ibforums->input['i_id']."'");
if ( ! $Data = $DB->fetch_row() ){
$ibforums->admin->error("Unable to find the item inside the db");
}


//+-------------------------------

$ibforums->adskin->td_header[] = array( " "  , "40%" );
$ibforums->adskin->td_header[] = array( " "  , "60%" );

//+-------------------------------

$ibforums->html .= $ibforums->adskin->start_table( "Правка предмета" );

$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Имя предмета</b><br>" ,
$ibforums->adskin->form_input("name", $Data['name'])
)      );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Описание предмета</b>" ,
$ibforums->adskin->form_input("desc", $Data['desc'] )
)      );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Цена предмета</b>" ,
$ibforums->adskin->form_input("cost", $Data['cost'] )
)      );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Текущий держатель</b>" ,
$ibforums->adskin->form_input("owner", $Data['owner'] )
)      );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Время окончания аукциона</b>" ,
$ibforums->adskin->form_input("time", $Data['time'] )
)      );

$ibforums->html .= $ibforums->adskin->end_form('Обновить предмет');

$ibforums->html .= $ibforums->adskin->end_table();
}



function do_edit(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;

$db_string = array(

        'cost'      => $ibforums->input['cost'],
        'owner'      => $ibforums->input['owner'],
        'time'      => $ibforums->input['time'],
);
$rstring = $DB->compile_db_update_string( $db_string );

$DB->query("UPDATE `ibf_auction` SET $rstring WHERE i_id='".$ibforums->input['id']."'");
$DB->query("OPTIMIZE TABLE ibf_auction");
$ibforums->admin->done_screen("Предмет отредактирован", "Управление аукционом", "act=auction" );
}




function log(){
global $ibforums, $DB,  $std, $forums, $HTTP_POST_VARS;

$ibforums->adskin->td_header[] = array( "ID"    , "1%" );
$ibforums->adskin->td_header[] = array( "LOG"    , "100%" );
$ibforums->html .= $ibforums->adskin->start_table( "Logs" );
$DB->query("SELECT * FROM ibf_auction_log");
while ($Data = $DB->fetch_row() ) {
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<center><b>{$Data['id']}</b></center>",
"<div align=left>{$Data['log']}</div>",
)      );
}
$ibforums->html .= $ibforums->adskin->end_table();
}


// end class
}
?>

Открыть skin/s*/skin_rpg.php

Найти

/* END OF FILE                                      */
/*--------------------------------------------------*/

?>

в общем, конец скрипта :)

 

и вписать перед этим концом

// by CTAPbIu_MABP
// patched by Andrey Zentavr
function auctiontop() {
global $ibforums;
return <<<EOF
<div class="borderwrap">
<div class="maintitle" align=center>
<a href='?act=rpg&code=auctionadd'>Поставить свой товар на торги</a>
</div></div><br>

<div class="tableborder">
<div class=maintitle><b>{$ibforums->vars['board_name']} {$id['name']} Аукцион</b></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<th align='center' width='25'> </th>
<th align='center' width='15%'>Текущий Держатель</th>
<th align='center' width='15%'>Продавец</th>
<th align='center' width="30%">Название</th>
<th align='center' width="30">Цена</th>
<th align='center' width='20%'>Цена +</th>
<th align='center' width='5%'>Дата окончания</th>
<th align='center' width='20'>Свойства</th>
</tr>
EOF;
}

function auctionrow($Data) {
global $ibforums;
$endtime = date("H:i:s, d F Y", $Data['time']);
return <<<EOF
<tr>
<td class='row1' align='center' width='1%'><img src='html/Inferno/items/{$Data['img']}' alt='{$Data['name']}'></td>
<td class='row2' align='center'><b>{$Data['owner']}</b></td>
<td class='row1' align='center'>{$Data['fu']}</td>
<td class='row2' align='center'>{$Data['name']}</td>
<td class='row1' align='center'>{$Data['cost']}</td>
<td class='row2' align='center'>
<form action="{$ibforums->base_url}&act=rpg&code=do_auction" method="post">
 <input type='hidden' name="item_id" value="{$Data['id']}">
 <input type='hidden' name="i_id" value="{$Data['i_id']}"></input>
 <select name="price" class="codebuttons" style="width: 80px; ">
	 <option value="5">5 золота
	 <option value="10">10 золота
	 <option value="25">25 золота
	 <option value="50">50 золота
	 <option value="100">100 золота
	 <option value="200">200 золота
	 <option value="500">500 золота
	 <option value="1000">1000 золота
 </select>
 <input type="submit" class="button" value="Поднять!">
</form>
</td>
<td class='row1' align='center'>{$endtime}</td>
<td class='row2' align='center' width='1%'>
<a href='?act=rpg&CODE=scan&id={$Data['id']}'><img src='sources/Inferno/scan.gif' alt='Scan {$Data['name']}' border='0'></a>
</td>
</tr>
EOF;
}

function auctionbottom($Member) {
global $ibforums;
return <<<EOF
<tr>
<td colspan='8' class='formsubtitle'>Всего {$ibforums->lang['money']}: {$Member['money']}</td>
</tr>
</table>
</div>
<br>
EOF;
}

function addtop() {
global $ibforums;
return <<<EOF
<div class="tableborder">
<div class=maintitle><b>{$ibforums->vars['board_name']} {$id['name']} Аукцион</b></div>

<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<th align='center' width='25'> </th>
<th align='center' width="20%">Название</th>
<th align='center' width="30%">Описание</th>
<th align='center' width="70">Стартовая цена</th>
<th align='center'>Период</th>
<th align='center' width='1%'>Аукцион</th>
<th align='center' width='20'>Свойства</th>
</tr>
EOF;
}

function addrow($Data) {
global $ibforums;
return <<<EOF
<tr>
<form action="{$ibforums->base_url}&act=rpg&code=do_add" method="post">
<input type="hidden" name="add" value="{$Data['id']}">
<td class='row1' align='center' width='1%'><img src='html/Inferno/items/{$Data['img']}' alt='{$Data['name']}'></td>
<td class='row2' align='center'>{$Data['name']}</td>
<td class='row1' align='center'>{$Data['desc']}</td>
<td class='row2' align='center'><input type="text" name="cost" value="{$Data['cost']}"></td>
<td class='row1' align='center'>
 <select name="period" class="codebuttons" style="width: 80px; ">
	 <option value="3600">1 час
	 <option value="10800">3 часа
	 <option value="21600">6 часов
	 <option value="43200">12 часов
	 <option value="86400" selected>1 день
	 <option value="259200">3 дня
	 <option value="604800">1 неделя
	 <option value="1209600">2 недели
	 <option value="1814400">3 недели
	 <option value="2419200">4 недели
 </select>
</td>
<td class='row2' align='center'> 	 
	 <input type="submit" class="button" value="Выставить лот">  
</td>
<td class='row1' align='center'>
 <a href='?act=rpg&code=scan&id={$Data['id']}'><img src='sources/Inferno/scan.gif' alt='Scan {$Data['name']}' border='0'></a>
</td>
</form>
</tr>
EOF;
}

function addnullrow($colspan, $msg = "Аукцион пуст") {
global $ibforums;
return <<<EOF
<tr>
<td class='row1' align='center' colspan="{$colspan}">
 {$msg}
</td>
</tr>
EOF;
}


function addbottom($Member) {
global $ibforums;
return <<<EOF
<tr>
<td colspan='7' class='formsubtitle'>Всего {$ibforums->lang['money']}: {$Member['money']}</td>
</tr>
</table>
</div>
<br>
EOF;
}

 

Открываем skin/s*/skin_global.php

Ищем начало функции

function global_board_header()

 

В ней по образу и подобию вписываем ссылочки на аукцион

<a href='{$ibforums->base_url}act=rpg&code=auction'>Аукцион</a>
<a href='{$ibforums->base_url}act=rpg&code=auctionadd'>Добавить на аукцион</a>

 

Открываем lang/*/lang_rpg.php

Ищем

$lang = array (

Вставляем после

'section_auction_errnum' => 'Веденое Вами число неверно! Повторите ввод снова.',
'item_id' => "Не могу понять какой предмет вы хотите купить, попробуйте еще раз...",

 

 

Открываем admin.php

Ищем

//------------------------------------------------------
//  What do you want to require today?
//------------------------------------------------------

$choice = array(

 

По образу и подобию вписываем нашу ссылку

 

'auction'     => array( 'auction',    'auction'),

 

Инсталлятор таблиц берём у Мавра.

 

А теперь Changelog:

1) Добавил колонку "Продавец" - т.е. начальный хозяин и "Текущий держатель"

2) Продавец может задавать начальную стоимость товара

3) Продавец может задавать время торгов

4) Скрипты переписаны под IPB 2.0.3

5) Чуть косметики :)

 

Спасибо Старому Муавру за идею, Freeman'у за то, что ткнул носом в эту тему и всем, кому это пригодится :)

 

P.S.: Бекапы нас спасут :) Если что, кричите на асю 174-347-123

P.P.S.: Дайте WMZ ;) Z539406480214

Ссылка на комментарий
Поделиться на других сайтах

2 Andrey Zentavr

 

Ага именно под 1.3

Спасибо что перевели на 2.0

 

А теперь Changelog:

1) Добавил колонку "Продавец" - т.е. начальный хозяин и "Текущий держатель"

2) Продавец может задавать начальную стоимость товара

3) Продавец может задавать время торгов

4) Скрипты переписаны под IPB 2.0.3

5) Чуть косметики

 

 

Я хотел сделать начальную стоимость и время однако времени все никак не было))) спасибо что написал... я когда к себе на комп сяду добавлю теьбя в асю и мы поговорим...

Ссылка на комментарий
Поделиться на других сайтах

2 Andrey Zentavr

 

Ага именно под 1.3

Спасибо что перевели на 2.0

 

А теперь Changelog:

1) Добавил колонку "Продавец" - т.е. начальный хозяин и "Текущий держатель"

2) Продавец может задавать начальную стоимость товара

3) Продавец может задавать время торгов

4) Скрипты переписаны под IPB 2.0.3

5) Чуть косметики

 

 

Я хотел сделать начальную стоимость и время однако времени все никак не было))) спасибо что написал... я когда к себе на комп сяду добавлю теьбя в асю и мы поговорим...

Дай линк, где посмотреть пример твоего аукциона.. Кстати, очень жаль, что не тестили с 2.0.х
Ссылка на комментарий
Поделиться на других сайтах

Дай линк, где посмотреть пример твоего аукциона.. Кстати, очень жаль, что не тестили с 2.0.х

Кто тебе сказал, что не тестили??? мои скрипты как раз рассчитаны на 2,0,x

У меня стоит 2,0,3 форум + 4,2 RPG Форум стоит внутри локалки, так что линка не даю :D Сейчас юзерами активно производится тестирование форума и в частности новых скрипов.

Ссылка на комментарий
Поделиться на других сайтах

Дай линк, где посмотреть пример твоего аукциона.. Кстати, очень жаль, что не тестили с 2.0.х

 

Сожалею но портал OTAS.RU для которого я писал скрипт не поставил его....

 

кстати я не дописал одну маленькую деталь

 

Открыть: admin.php

 

найти

'skinfix'   => 'skinfix',

 

снизу

'auction' => 'auction',

 

а то некоторые поставить не могут

 

 

По просьбе Фримэна написал мод с городами и разными магазинами в них... сейчас дописываю последнии функции и обработки ошибок... наверное завтра уже выложу тут

 

Ссылка на комментарий
Поделиться на других сайтах

  • 2 недели спустя...

Приветствую

 

попробовал поставить мод, а он ругается.

 

при попытке посмотреть аукционы на rgp.php 330 строка

 

// Grab Items And Data

$this->output .= $this->html->auctiontop($shop);

 

 

при попытке добавить на аукцион на rpg.php 468 строка

 

// Grab Items And Data

$this->output .= $this->html->addtop($shop);

 

стоит 2,0,3 + рпг 4,2

 

Если не трудно поможите.

Ссылка на комментарий
Поделиться на других сайтах

  • 3 недели спустя...
Andrey Zentavr он вроде как модифицировал под 2,0,3 говорит все у него работает вот его я и спросил.

Кинь мне мыло, я возьму у зеника и скину тебе.

Ссылка на комментарий
Поделиться на других сайтах

  • 2 недели спустя...
  • 7 месяцев спустя...

Что-то нехочет работать аукцион!

 

Всё исправил!

$DB->query("SELECT * FROM ibf_infernostock WHERE item = '{$ibforums->input['add']}'");

вместо

$DB->query("SELECT * FROM ibf_infernostock WHERE item = {$ibforums->input['add']}");

Ссылка на комментарий
Поделиться на других сайтах

  • 1 год спустя...

Точно! Вот здесь"

// Grab Items And Data

$this->output .= $this->html->auctiontop($shop);"

возникает ошибка"

Fatal error: Call to undefined function: auctiontop() in /home2/richard/public_html/sources/rpg.php on line 330"

 

Как починить?

Ссылка на комментарий
Поделиться на других сайтах

sM1Le

Нет-всё нормально.

ошибку нашёл!

Надо не так:

Открыть skin/s*/skin_rpg.php

Найти

CODE

/* END OF FILE */

/*--------------------------------------------------*/

 

?>

 

в общем, конец скрипта

а так:

Открыть skin/s*/skin_rpg.php

Найти

CODE

}

/* END OF FILE */

/*--------------------------------------------------*/

 

?>

 

в общем, конец скрипта

всего то-фигурная скобка, а какие результаты :D

Ссылка на комментарий
Поделиться на других сайтах

Присоединиться к обсуждению

Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.

Гость
Ответить в этой теме...

×   Вы вставили отформатированный текст.   Удалить форматирование

  Допустимо не более 75 смайлов.

×   Ваша ссылка была автоматически заменена на медиа-контент.   Отображать как ссылку

×   Ваши публикации восстановлены.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

Зарузка...
×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.