[endspiel] 6 new revisions pushed by tvsdes...@gmail.com on 2009-08-31 17:10 GMT

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 31, 2009, 1:10:41 PM8/31/09
to endspi...@googlegroups.com
6 new revisions:

Revision: e7ac4c1642
Author: tvsd...@gmail.com
Date: Sun Aug 30 14:47:48 2009
Log: Улучшена навигация в режиме сообщений
http://code.google.com/p/endspiel/source/detail?r=e7ac4c1642

Revision: cc3b284b88
Author: tvsd...@gmail.com
Date: Mon Aug 31 02:17:42 2009
Log: Повторяющийся код кнопки логаута вынесен в отдельный шаблон
http://code.google.com/p/endspiel/source/detail?r=cc3b284b88

Revision: 00dd4bd1be
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:41:52 2009
Log: Отображение основного игрового окна выделено в отдельный метод.
http://code.google.com/p/endspiel/source/detail?r=00dd4bd1be

Revision: e697ebe1cf
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:45:34 2009
Log: Добавлен класс управления игровыми вещами.
http://code.google.com/p/endspiel/source/detail?r=e697ebe1cf

Revision: ec76f776ba
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:47:39 2009
Log: Добавлены таблицы для хранения игровых вещей.
http://code.google.com/p/endspiel/source/detail?r=ec76f776ba

Revision: 549b9f8242
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:50:22 2009
Log: Добавлено управление игровыми вещами (инвентарь, поднять, выбросить).
http://code.google.com/p/endspiel/source/detail?r=549b9f8242

==============================================================================
Revision: e7ac4c1642
Author: tvsd...@gmail.com
Date: Sun Aug 30 14:47:48 2009
Log: Улучшена навигация в режиме сообщений
http://code.google.com/p/endspiel/source/detail?r=e7ac4c1642

Modified:
/tpl/tpl/base.pda.readmsg.tpl

=======================================
--- /tpl/tpl/base.pda.readmsg.tpl Sun Aug 30 06:09:31 2009
+++ /tpl/tpl/base.pda.readmsg.tpl Sun Aug 30 14:47:48 2009
@@ -16,6 +16,12 @@
<table>
<tr>
<td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="idle" />
+ <input type="submit" value="{$str.close_PDA}" />
+ </form>
+ </td>
+ <td>
<form action="/" method="POST">
<input type="hidden" name="m" value="pda" />
<input type="hidden" name="d" value="map" />
@@ -32,15 +38,33 @@
<td>
<form action="/" method="POST">
<input type="hidden" name="m" value="pda" />
- <input type="hidden" name="d" value="sms" />
- <input type="submit" value="{$str.sms}" />
+ <input type="hidden" name="d" value="glossary" />
+ <input type="submit" value="{$str.glossary}" />
</form>
</td>
+ </tr>
+ </table>
+ <table>
+ <tr>
<td>
<form action="/" method="POST">
<input type="hidden" name="m" value="pda" />
- <input type="hidden" name="d" value="glossary" />
- <input type="submit" value="{$str.glossary}" />
+ <input type="hidden" name="d" value="inbox" />
+ <input type="submit" value="{$str.inbox}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="sent" />
+ <input type="submit" value="{$str.sent}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="sms" />
+ <input type="submit" value="{$str.contactlist}" />
</form>
</td>
</tr>

==============================================================================
Revision: cc3b284b88
Author: tvsd...@gmail.com
Date: Mon Aug 31 02:17:42 2009
Log: Повторяющийся код кнопки логаута вынесен в отдельный шаблон
http://code.google.com/p/endspiel/source/detail?r=cc3b284b88

Added:
/tpl/tpl/base.include.exitbtn.tpl
Modified:
/css/base.css
/tpl/tpl/base.index.idle.tpl
/tpl/tpl/base.pda.clist.tpl
/tpl/tpl/base.pda.inbox.tpl
/tpl/tpl/base.pda.map.tpl
/tpl/tpl/base.pda.newpmsg.tpl
/tpl/tpl/base.pda.readmsg.tpl
/tpl/tpl/base.pda.sent.tpl
/tpl/tpl/base.talk.tpl

=======================================
--- /dev/null
+++ /tpl/tpl/base.include.exitbtn.tpl Mon Aug 31 02:17:42 2009
@@ -0,0 +1,6 @@
+<div class="arig">
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="logout" />
+ <input type="submit" class="exit" value="Выйти" />
+ </form>
+</div>
=======================================
--- /css/base.css Tue Aug 25 14:09:34 2009
+++ /css/base.css Mon Aug 31 02:17:42 2009
@@ -3,6 +3,7 @@

.aw { width:100% }
.alef { text-align:left }
+.arig { text-align:right }
.vatop { vertical-align:top }

input.text, textarea { background:#f0f0f0; color:#111 }
@@ -26,7 +27,7 @@
.attack { background:#ff6633; color:#000 }
.friend { background:#33ff66; color:#000 }

-.exit { background:#000; border-color:#999; color:#fff }
+.exit { background:#000; border-color:#999; color:#fff; margin-right:15px }

input { background:#3366ee; color:#fff; border:1px solid #cccccc;
-moz-border-radius:3px }
.a-u { -moz-border-radius-topleft:9px; -moz-border-radius-topright:9px; }
=======================================
--- /tpl/tpl/base.index.idle.tpl Sat Aug 22 13:55:28 2009
+++ /tpl/tpl/base.index.idle.tpl Mon Aug 31 02:17:42 2009
@@ -8,16 +8,9 @@
</head>
<body>
<div class="cwrap">
+ {include file='base.include.exitbtn.tpl'}
<table class="aw">
<tr>
- <td colspan="2">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input class="exit" type="submit" value="Выйти" />
- </form>
- </td>
- </tr>
- <tr>
<td colspan="2">
<form action="/" method="POST">
<input type="hidden" name="m" value="bag" />
=======================================
--- /tpl/tpl/base.pda.clist.tpl Tue Aug 25 13:41:52 2009
+++ /tpl/tpl/base.pda.clist.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$str.PDA}: {$str.contactlist}</h4>
<table>
<tr>
=======================================
--- /tpl/tpl/base.pda.inbox.tpl Tue Aug 25 14:11:12 2009
+++ /tpl/tpl/base.pda.inbox.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$str.PDA}: {$str.inbox}</h4>
<table>
<tr>
=======================================
--- /tpl/tpl/base.pda.map.tpl Sat Aug 22 14:07:16 2009
+++ /tpl/tpl/base.pda.map.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$str.PDA}: {$str.map}</h4>
<table>
<tr>
=======================================
--- /tpl/tpl/base.pda.newpmsg.tpl Mon Aug 24 04:47:50 2009
+++ /tpl/tpl/base.pda.newpmsg.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$str.PDA}: {$str.newpmessage}</h4>
<table>
<tr>
=======================================
--- /tpl/tpl/base.pda.readmsg.tpl Sun Aug 30 14:47:48 2009
+++ /tpl/tpl/base.pda.readmsg.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$str.PDA}: {$str.readmsg}</h4>
<table>
<tr>
=======================================
--- /tpl/tpl/base.pda.sent.tpl Sun Aug 30 06:13:17 2009
+++ /tpl/tpl/base.pda.sent.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$str.PDA}: {$str.sent}</h4>
<table>
<tr>
=======================================
--- /tpl/tpl/base.talk.tpl Sat Aug 22 12:58:46 2009
+++ /tpl/tpl/base.talk.tpl Mon Aug 31 02:17:42 2009
@@ -8,10 +8,7 @@
</head>
<body>
<div class="cwrap">
- <form action="/" method="POST">
- <input type="hidden" name="m" value="logout" />
- <input type="submit" class="exit" value="Выйти" />
- </form>
+ {include file='base.include.exitbtn.tpl'}
<h4>{$npcname}</h4>
<p>{$npcsays}</p>
<table class="aw">

==============================================================================
Revision: 00dd4bd1be
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:41:52 2009
Log: Отображение основного игрового окна выделено в отдельный метод.
http://code.google.com/p/endspiel/source/detail?r=00dd4bd1be

Modified:
/lib/c.idle.class.php

=======================================
--- /lib/c.idle.class.php Sun Aug 30 06:13:17 2009
+++ /lib/c.idle.class.php Mon Aug 31 09:41:52 2009
@@ -143,56 +143,70 @@
throw new Application_Exception('Wrong input');
}
}
+ $this->renderIdlePage();
+ break;
}
case "indevelopment":
case "idle":
default:
{
- /*
- * Пересчет разрешенных направлений движения
- */
- if ((Engine::get()->player->coords('L') != 0) ||
(Engine::get()->player->talking()))
- {
- //Если игрок в здании или общается с NPC, то он не может ходить
- $moveEnabled = array('n' => false, 's' => false, 'e' => false, 'w' =>
false, 'u' => false, 'd' => false);
- }
- else
- {
- //Иначе определяем разрешенные направления по карте
- $moveEnabled = array(
- 'n' => Engine::get()->map->isCellActive(0,1,0), //Север
- 's' => Engine::get()->map->isCellActive(0,-1,0), //Юг
- 'e' => Engine::get()->map->isCellActive(1,0,0), //Восток
- 'w' => Engine::get()->map->isCellActive(-1,0,0), //Запад
- 'u' => Engine::get()->map->isCellActive(0,0,1), //Выше
- 'd' => Engine::get()->map->isCellActive(0,0,-1) //Ниже
- );
- }
- Engine::get()->smarty->assign('moveenabled',$moveEnabled); //Передаем
в шаблон
-
- /*
- * Вывод дверей в локации
- */
- $doors = Engine::get()->map->doors(Engine::get()->player->coords());
//Получаем список дверей
- Engine::get()->smarty->assign('doors',$doors); //Передаем в шаблон
-
- /*
- * Вывод игроков, находящихся на одних координатах с активным
- */
- $players =
Engine::get()->pmanager->listPlayersAtPos(Engine::get()->player->coords());
//Получаем список игроков
- unset($players[Engine::get()->player->getId()]); //Удаляем себя из
списка
- Engine::get()->smarty->assign('players',$players); //Передаем в шаблон
-
- /*
- * Вывод NPC
- */
- $npcs = Engine::get()->npc->listNPCs(); //Получаем список NPC
- Engine::get()->smarty->assign('npcs',$npcs); //Передаем в шаблон
-
- Engine::get()->smarty->display('base.index.idle.tpl'); //Генерация
страницы
+ $this->renderIdlePage();
}
}
}
+
+ protected function renderIdlePage()
+ {
+ /*
+ * Пересчет разрешенных направлений движения
+ */
+ if ((Engine::get()->player->coords('L') != 0) ||
(Engine::get()->player->talking()))
+ {
+ //Если игрок в здании или общается с NPC, то он не может ходить
+ $moveEnabled = array('n' => false, 's' => false, 'e' => false, 'w' =>
false, 'u' => false, 'd' => false);
+ }
+ else
+ {
+ //Иначе определяем разрешенные направления по карте
+ $moveEnabled = array(
+ 'n' => Engine::get()->map->isCellActive(0,1,0), //Север
+ 's' => Engine::get()->map->isCellActive(0,-1,0), //Юг
+ 'e' => Engine::get()->map->isCellActive(1,0,0), //Восток
+ 'w' => Engine::get()->map->isCellActive(-1,0,0), //Запад
+ 'u' => Engine::get()->map->isCellActive(0,0,1), //Выше
+ 'd' => Engine::get()->map->isCellActive(0,0,-1) //Ниже
+ );
+ }
+ Engine::get()->smarty->assign('moveenabled',$moveEnabled); //Передаем в
шаблон
+
+ /*
+ * Вывод лежащих на земле предметов
+ */
+
+ $itemsOnGround =
Engine::get()->inventory->listItemsOnGround(Engine::get()->player->coords());
//Получаем список предметов
+ Engine::get()->smarty->assign('itemsonground',$itemsOnGround);
//Передаем в шаблон
+
+ /*
+ * Вывод дверей в локации
+ */
+ $doors = Engine::get()->map->doors(Engine::get()->player->coords());
//Получаем список дверей
+ Engine::get()->smarty->assign('doors',$doors); //Передаем в шаблон
+
+ /*
+ * Вывод игроков, находящихся на одних координатах с активным
+ */
+ $players =
Engine::get()->pmanager->listPlayersAtPos(Engine::get()->player->coords());
//Получаем список игроков
+ unset($players[Engine::get()->player->getId()]); //Удаляем себя из списка
+ Engine::get()->smarty->assign('players',$players); //Передаем в шаблон
+
+ /*
+ * Вывод NPC
+ */
+ $npcs = Engine::get()->npc->listNPCs(); //Получаем список NPC
+ Engine::get()->smarty->assign('npcs',$npcs); //Передаем в шаблон
+
+ Engine::get()->smarty->display('base.index.idle.tpl'); //Генерация
страницы
+ }

public function __construct()
{

==============================================================================
Revision: e697ebe1cf
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:45:34 2009
Log: Добавлен класс управления игровыми вещами.
http://code.google.com/p/endspiel/source/detail?r=e697ebe1cf

Added:
/lib/inventory.class.php
Modified:
/lib/engine.class.php

=======================================
--- /dev/null
+++ /lib/inventory.class.php Mon Aug 31 09:45:34 2009
@@ -0,0 +1,68 @@
+<?
+/*
+ * inventory.class.php
+ *
+ * Copyright 2009 Valery Tverdohleb <tvsd...@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
modify
+ * it under the terms of the GNU General Public License as published
by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+class Inventory
+{
+ protected $id;
+
+ public function __construct($id)
+ {
+ $this->id = $id;
+ }
+
+ public function dropItem($itemid)
+ {
+ $stmt = Engine::get()->db->prepare('UPDATE `items` AS i, `users` AS u
SET i.`X` = u.`X`, i.`Y` = u.`Y`, i.`Z` = u.`Z`, i.`L` = u.`L`, i.`owner` =
0 WHERE i.`owner` = u.`id` AND u.`id` = :uid AND i.`id` = :iid;');
+ $stmt->bindValue(':uid', $this->id);
+ $stmt->bindValue(':iid',$itemid);
+ $stmt->execute();
+ }
+
+ public function listItemsOnGround($coords)
+ {
+ $stmt = Engine::get()->db->prepare('SELECT i.`id`, t.`title` FROM
`items` AS i LEFT JOIN `item_types` AS t ON t.`id` = i.`itype` WHERE `X`=:X
AND `Y`=:Y AND `Z`=:Z AND `L`=:L AND `owner` = 0;');
+ $stmt->bindValue(':X',$coords['X']);
+ $stmt->bindValue(':Y',$coords['Y']);
+ $stmt->bindValue(':Z',$coords['Z']);
+ $stmt->bindValue(':L',$coords['L']);
+ $stmt->execute();
+ return $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
+
+ public function takeItem($itemid)
+ {
+ $stmt = Engine::get()->db->prepare('UPDATE `items` SET `owner` = :uid
WHERE `id` = :iid;');
+ $stmt->bindValue(':uid', $this->id);
+ $stmt->bindValue(':iid',$itemid);
+ $stmt->execute();
+ }
+
+ public function listItems()
+ {
+ $stmt = Engine::get()->db->prepare('SELECT i.`id`, t.`title`,
t.`description` FROM `items` AS i LEFT JOIN `item_types` AS t ON t.`id` =
i.`itype` WHERE i.`owner` = :id;');
+ $stmt->bindValue('id',$this->id);
+ $stmt->execute();
+ return $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
+}
+
+?>
=======================================
--- /lib/engine.class.php Sun Aug 23 11:34:59 2009
+++ /lib/engine.class.php Mon Aug 31 09:45:34 2009
@@ -33,6 +33,7 @@
require_once("access.class.php");
require_once("player.class.php");
require_once("messaging.class.php");
+require_once("inventory.class.php");
require_once("map.class.php");
require_once("pmanager.class.php");
require_once("npc.class.php");
@@ -54,6 +55,7 @@
public $request;
public $router;
public $player;
+ public $inventory;
public $map;
public $npc;
public $messaging;
@@ -128,6 +130,7 @@
{
$this->player = new Player($id);
$this->messaging = new Messaging($id);
+ $this->inventory = new Inventory($id);
}

public function loadMap($coords)

==============================================================================
Revision: ec76f776ba
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:47:39 2009
Log: Добавлены таблицы для хранения игровых вещей.
http://code.google.com/p/endspiel/source/detail?r=ec76f776ba

Modified:
/install.sql

=======================================
--- /install.sql Thu Aug 27 13:44:08 2009
+++ /install.sql Mon Aug 31 09:47:39 2009
@@ -195,3 +195,35 @@
INDEX (`rid`),
INDEX (`sid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+#Шаблоны игровых объектов
+
+DROP TABLE IF EXISTS `item_types`;
+
+CREATE TABLE IF NOT EXISTS `item_types`(
+ `id` int(11) NOT NULL auto_increment,
+ `title` varchar(255) NOT NULL,
+ `description` TEXT DEFAULT '',
+ `type` INT(11) NOT NULL,
+ `wearing` BIT (16) NOT NULL DEFAULT 0,
+ `basecost` FLOAT DEFAULT NULL,
+ `quality` FLOAT DEFAULT NULL,
+ `ammunition_type` INT(11) NOT NULL DEFAULT 0,
+ `max_ammo` INT(11) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS `items`;
+
+CREATE TABLE IF NOT EXISTS `items`(
+ `id` INT(11) NOT NULL auto_increment,
+ `itype` INT(11) NOT NULL,
+ `consistency` FLOAT DEFAULT NULL,
+ `ammo` INT(11) DEFAULT 0,
+ `owner` INT(11) DEFAULT 0,
+ X int(11) NOT NULL DEFAULT 0,
+ Y int(11) NOT NULL DEFAULT 0,
+ Z int(11) NOT NULL DEFAULT 0,
+ L int(11) unsigned NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

==============================================================================
Revision: 549b9f8242
Author: tvsd...@gmail.com
Date: Mon Aug 31 09:50:22 2009
Log: Добавлено управление игровыми вещами (инвентарь, поднять, выбросить).
http://code.google.com/p/endspiel/source/detail?r=549b9f8242

Added:
/tpl/tpl/base.bag.tpl
/tpl/tpl/base.include.ioglist.tpl
Modified:
/lib/c.idle.class.php
/lib/str.php
/tpl/tpl/base.index.idle.tpl

=======================================
--- /dev/null
+++ /tpl/tpl/base.bag.tpl Mon Aug 31 09:50:22 2009
@@ -0,0 +1,56 @@
+{* Smarty *}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="{$str.locale}">
+<head>
+ <title>{$title}</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <link rel="stylesheet" href="/css/base.css" media="all" />
+</head>
+<body>
+ <div class="cwrap">
+ {include file='base.include.exitbtn.tpl'}
+ <h4>{$str.bag}</h4>
+ <table>
+ <tr>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="idle" />
+ <input type="submit" value="{$str.close}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="bag" />
+ <input type="hidden" name="d" value="equip" />
+ <input type="submit" value="{$str.equipment}" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ <table>
+ {foreach from=$items item=i}
+ <tr>
+ <td class="alef">
+ {$i.title}
+ </td>
+ <td class="alef">
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="msgread" />
+ <input type="hidden" name="i" value="{$m.id}" />
+ <input type="submit" value="Надеть" />
+ </form>
+ </td>
+ <td class="alef">
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="bag" />
+ <input type="hidden" name="d" value="throw" />
+ <input type="hidden" name="i" value="{$i.id}" />
+ <input type="submit" value="Выбросить" />
+ </form>
+ </td>
+ </tr>
+ {/foreach}
+ </table>
+ </div>
+</body>
=======================================
--- /dev/null
+++ /tpl/tpl/base.include.ioglist.tpl Mon Aug 31 09:50:22 2009
@@ -0,0 +1,16 @@
+{if count($iog) gt 0}
+<table>
+ {foreach from=$iog item=i}
+ <tr>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="bag" />
+ <input type="hidden" name="d" value="pickup" />
+ <input type="hidden" name="i" value="{$i.id}" />
+ <input class="iog" type="submit" value="{$i.title}" />
+ </form>
+ </td>
+ </tr>
+ {/foreach}
+</table>
+{/if}
=======================================
--- /lib/c.idle.class.php Mon Aug 31 09:41:52 2009
+++ /lib/c.idle.class.php Mon Aug 31 09:50:22 2009
@@ -128,6 +128,29 @@
Engine::get()->smarty->display('base.pda.readmsg.tpl');
break;
}
+ case "bag":
+ {
+ switch ($_POST['d'])
+ {
+ case "pickup":
+ {
+ Engine::get()->inventory->takeItem($_POST['i']);
+ $this->renderIdlePage();
+ break;
+ }
+ case "throw":
+ {
+ Engine::get()->inventory->dropItem($_POST['i']);
+ }
+ default:
+ {
+ $items = Engine::get()->inventory->listItems();
+ Engine::get()->smarty->assign('items',$items);
+ Engine::get()->smarty->display('base.bag.tpl'); //Генерация страницы
+ }
+ }
+ break;
+ }
case "touch":
{
switch ($this->state['who'])
@@ -259,6 +282,11 @@
}
break;
}
+ case "bag":
+ {
+ $this->state['mode'] = 'bag';
+ break;
+ }
case "login":
case "idle":
default:
=======================================
--- /lib/str.php Sun Aug 30 06:09:31 2009
+++ /lib/str.php Mon Aug 31 09:50:22 2009
@@ -40,6 +40,8 @@
'cancel' => 'Отменить',

'bag' => 'Инвентарь',
+ 'close' => 'Закрыть',
+ 'equipment' => 'Обмундирование',

'PDA' => 'PDA',
'map' => 'Карта',
=======================================
--- /tpl/tpl/base.index.idle.tpl Mon Aug 31 02:17:42 2009
+++ /tpl/tpl/base.index.idle.tpl Mon Aug 31 09:50:22 2009
@@ -61,6 +61,7 @@
</td>
<td>
{include file='base.include.playerlist.tpl' players=$players
touched=$touched}
+ {include file='base.include.ioglist.tpl' iog=$itemsonground}
{include file='base.include.npcslist.tpl' npcs=$npcs}
{include file='base.include.doorslist.tpl' doors=$doors}
</td>
Reply all
Reply to author
Forward
0 new messages