public function actionInventory($id) { if ($this->getFConfig('db_driver') == 'sqlsrv') { $query = "DECLARE @items varbinary(max);SET @items = (SELECT Inventory FROM Character WHERE Name='{$id}');Select @items"; $getI = Yii::app()->db->createCommand($query)->queryScalar(); $getItem = $getI; } else { $getI = Character::model()->find(array('select' => 'Inventory', 'condition' => 'Name=:Name', 'params' => array(':Name' => $id))); $getItem = strtoupper(bin2hex($getI->Inventory)); } $i = -1; while ($i < 11) { $i++; $itemCode[$i] = substr($getItem, $this->getFConfig('versionBit') * $i, $this->getFConfig('versionBit')); if ($itemCode[$i] != $this->getVersionBit()) { $itemInfo[$i] = Item::getItem(substr($getItem, $this->getFConfig('versionBit') * $i, $this->getFConfig('versionBit'))); if ($itemInfo[$i] == NULL) { $itemInfo[$i]['thumb'] = "images/items/no.png"; $itemDesc[$i] = ''; } else { $itemDesc[$i] = $itemInfo[$i]['info']; } } } $model = Character::model()->find(array('select' => 'AccountID,Strength,Dexterity,Vitality,Energy,Leadership,Life,Mana,PkLevel,PkCount,Name,cLevel,Money,MapNumber,MapPosX,MapPosY,Class,' . $this->getFConfig('reset_col') . ',' . $this->getFConfig('greset_col') . '', 'condition' => 'Name=:Name', 'params' => array(':Name' => $id))); $getChars = Character::model()->findAll(array('select' => 'AccountID,Name,cLevel,Class,' . $this->getFConfig('reset_col') . ',' . $this->getFConfig('greset_col') . '', 'condition' => 'AccountID=:AccountID', 'params' => array(':AccountID' => $model->AccountID))); $this->renderPartial('cpage', array('item' => $itemInfo, 'itemDesc' => $itemDesc, 'model' => $model, 'chars' => $getChars)); }
} $i++; } unset($_SESSION['allPastBonuses']); } if (isset($_SESSION['levelError'])) { print $_SESSION['levelError']; unset($_SESSION['levelError']); } if (isset($_SESSION['dailyBonus'])) { $message = "You found \$" . $_SESSION['dailyBonus'] . " cash as daily bonus."; bonuses('Daily Bonus', $message); unset($_SESSION['dailyBonus']); } else { if (isset($_SESSION['weeklyBonus'])) { $item = Item::getItem($_SESSION['weeklyBonus']); $message = "For playing the last 7 days, you received one " . $item->getName() . "!"; bonuses('Weekly Bonus', $message); unset($_SESSION['weeklyBonus']); } } function bonuses($bonusType, $message) { ?> <script> $(document).ready(function() { $('#inline1').html('<h5 class="popupweaponheader"><?php echo $bonusType; ?> </h5><br/><p> <?php echo $message;
$type_el = 0; //$sel = myquery("SELECT * FROM game_items WHERE priznak=4 AND user_id=$user_id AND item_id IN (SELECT id FROM game_items_factsheet WHERE type=13)"); if ($sel != false and mysql_num_rows($sel) > 0) { while ($hran = mysql_fetch_array($sel)) { echo ' <table border="1" cellpadding="0" style="border-collapse: collapse" width="98%" bordercolor="777777" bgcolor="223344"><table border="1" cellpadding="0" style="border-collapse: collapse" width="98%" bordercolor="777777" bgcolor="223344" align=center><tr><td>'; echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width=100 align="center">'; $Item = new Item($hran['id']); $Item->hint(0, 0, '<a '); echo '<img src="http://' . img_domain . '/item/' . $Item->getFact('img') . '.gif" border="0" alt=""></a>'; //echo'<br><font color="#ffff00">'.$Item->getFact('name').'</font>'; echo '</td><td valign="top" width="220"> <div align="left">'; QuoteTable('open', '100%'); echo '<center><b>' . $Item->getFact('name') . '</b></center><br>'; //$Item->info(0,1,1,'100%'); if ($Item->fact['curse'] != '') { $str = $Item->fact['curse']; $order = array("\r\n", "\n", "\r"); $replace = '<br />'; $newstr = str_replace($order, $replace, $str); echo $newstr . '<br>'; } echo 'Вес эликсира: ' . $Item->getItem('weight') . '<br>'; echo '<div>Количество эликсиров: <font color="#FF8080"><b>' . $Item->getItem('count_item') . '</b></font>'; QuoteTable('close'); echo '</td><td style="text-align:right;padding-right:10px;width:130px;"><input type="button" value="Взять эликсир" onClick=location.replace("town.php?option=' . $option . '&town_id=' . $town . '&get=' . $hran['id'] . '&part4&add=' . $build_id . '")>'; echo '</td></tr></table></td></tr></table>'; } } QuoteTable('close');
echo '<table border="0" cellpadding="1"><tr><td></td></tr></table><table border="1" cellpadding="0" style="border-collapse: collapse" width="98%" bordercolor="777777" bgcolor="223344"><tr><td width=70 align=center><a href=town.php?option=' . $option . '&hran=' . $row["id"] . '&part4&dom><img src="http://' . img_domain . '/item/' . $row["img"] . '.gif" border="0"></a></td><td><a href=town.php?option=' . $option . '&hran=' . $row["id"] . '&part4&dom>' . $row["name"] . '</a></td></tr></table>'; } echo 'Нажми на рисунок, чтобы положить предмет в хранилище'; } else { echo '<br />В хранилище больше нет свободных мест!<br />'; } } elseif (isset($_GET['get'])) { $Item = new Item($_GET['get']); if ($Item->getItem('user_id') == $user_id and $Item->getItem('priznak') == 4 and $Item->getFact('weight') <= $char['CC'] - $char['CW']) { $Item->move_item_to_user(0, $user_id); $free++; } } elseif (isset($_GET['hran'])) { if ($free > 0) { $Item = new Item($_GET['hran']); if ($Item->getItem('user_id') == $user_id and $Item->getFact('type') < 90 and $Item->getFact('type') != 13 and $Item->getItem('item_for_quest') == 0 and ($Item->getItem('ref_id') == 0 or $Item->getFact('type') == 12 or $Item->getFact('type') == 14) and $Item->getItem('priznak') == 0 and $Item->getItem('used') == 0) { $Item->move_item_to_market($town, 0, 0, 0, 4); $free--; } } } //хранилище echo '<strong>Хранилище предметов (максимум ' . $templ['min_value'] . ' предметов)</strong><br /><br />'; echo 'Сейчас свободно <b><font color=red>' . $free . '</font></b> мест для хранения предметов.<br />'; echo "В инвентаре свободно место для <b><font color=red>" . max(0, $char['CC'] - $char['CW']) . "</font></b> кг.<br><br>"; echo '<a href="?option=' . $option . '&town_id=' . $town . '&part4&dom&sel_hran">Положить предметы в хранилище</a><br /><br />'; echo '<SCRIPT language=javascript src="../js/info.js"></SCRIPT><DIV id=hint style="Z-INDEX: 0; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"></DIV>'; QuoteTable('open', '100%'); $sel = myquery("SELECT * FROM game_items WHERE priznak=4 AND user_id={$user_id} AND town={$town} AND item_id NOT IN (SELECT id FROM game_items_factsheet WHERE type=13)"); if ($sel != false and mysql_num_rows($sel) > 0) { while ($hran = mysql_fetch_array($sel)) {
echo 'Комплект успешно удалён!'; QuoteTable('close'); } } //Используем предмет if (isset($_GET['option']) and $_GET['option'] == 'eliksir' and isset($_GET['id']) and $_GET['id'] > 0 and !$from_house and !$from_craft) { $Item = new Item(); $Item->use_item($_GET['id']); QuoteTable('open'); echo $Item->message; QuoteTable('close'); } //Заряжаем артефакт if (isset($_GET['option']) and $_GET['option'] == 'charge' and !$from_house and !$from_craft and isset($_GET['id']) and $_GET['id'] > 0) { $Item = new Item($_GET['id']); $zar = $Item->getFact('item_uselife') - $Item->getItem('count_item'); if ($Item->getFact('type') == 3 and $zar > 0) { $sel_last_event = myquery("SELECT timestamp FROM game_users_event WHERE user_id={$user_id} AND event=1"); if ($sel_last_event != false and mysql_num_rows($sel_last_event) > 0) { list($last_event) = mysql_fetch_array($sel_last_event); } else { $last_event = 0; } if ($last_event + $Item->getFact('cooldown') < time()) { if ($Item->item['item_uselife_max'] > 1 or $Item->fact['breakdown'] == 0) { //формула зарядки артефакта - 10 маны и 5 энергии на 1 заряд if ($char['STM_MAX'] > $char['MP_MAX']) { $mp = 10; $stm = 5; } else { $mp = 5;
function displayMissionInfo($mission, $playerLevel, $cityRank) { if (missionIsLocked($mission, $playerLevel)) { print "<b>LOCKED</b> <br>"; } $missionID = $mission->getID(); ?> Title: <?php echo $mission->getName(); ?> <br> City: <?php echo ucfirst(getCityNameFromCityID($mission->getCityID())); ?> <br> <?php $userMissionData = UserMissionData::getUserMissionData($_SESSION['userID'], $mission->getID()); $completionPercent; if ($cityRank == 4) { $completionPercent = 100; $cityRank = 3; } else { $userTimesMissionDoneInThisRank = 0; if ($userMissionData) { $userTimesMissionDoneInThisRank = $userMissionData->getRankTimes($cityRank); } $missionTimesToMasterRank = $mission->getRankReqTimes($cityRank); if ($userTimesMissionDoneInThisRank >= $missionTimesToMasterRank) { $completionPercent = 100; } else { $completionPercent = number_format($userTimesMissionDoneInThisRank / $missionTimesToMasterRank, 2) * 100; } } ?> <?php echo $completionPercent; ?> % R<?php echo $cityRank; ?> <br> Description: <?php echo $mission->getDescription(); ?> <br> Minimum level: <?php echo $mission->getMinLevel(); ?> <br> Cost: <?php echo $mission->getEnergyCost(); ?> energy<br> Will Gain: <?php echo $mission->getExpGained(); ?> exp<br> Will Gain <?php echo $mission->getMinCashGained(); ?> - <?php echo $mission->getMaxCashGained(); ?> cash<br> Chance of getting loot: <?php echo $mission->getChanceOfLoot(); ?> <br> <?php $lootItemID = $mission->getLootItemID(); if ($lootItemID) { $lootItem = Item::getItem($lootItemID); ?> You're not supposed to know this but the item you might get is the <?php echo $lootItem->getName(); ?> <br> didnt put in agency or item requirements too lazy but they work<br> <?php } print "Item Requirements:<br>"; $itemIDsToQuantity = Mission::getMissionRequiredItemsIDsToQuantity($missionID); $itemIDsToItems = Item::getItemIDsToItems(array_keys($itemIDsToQuantity)); foreach ($itemIDsToQuantity as $key => $value) { $item = $itemIDsToItems[$key]; print $value . "x " . $item->getName() . "<br>"; } if (!missionIsLocked($mission, $playerLevel)) { ?> <form action='backend/domission.php' method='post'> <input type='hidden' name='missionID' value='<?php echo $mission->getID(); ?> ' /> <input type='hidden' name='currentMissionCity' value='<?php echo $_SESSION['currentMissionCity']; ?> ' /> <input type='submit' value='Do It' /> </form> <?php } print "<br><br>"; }
break; case 'purchase': $it = (int) $_GET['it']; $Item = new Item($it); if ($Item->item['town'] != $town) { break; } if ($dostup_clan == 2 and $Item->item['user_id'] != $user_id) { echo 'Хотели купить неположенный предмет? Ну-ну!'; break; } $ar = $Item->buy_market(); if ($ar[0] > 0) { $town_select = myquery("select rustown from game_gorod where town='{$town}'"); list($rustown) = mysql_fetch_array($town_select); $userid = $Item->getItem('user_id'); $selname = myquery("SELECT name FROM game_users WHERE user_id={$userid}"); if (!mysql_num_rows($selname)) { $selname = myquery("SELECT name FROM game_users_archive WHERE user_id={$userid}"); } list($name) = mysql_fetch_array($selname); myquery("INSERT INTO game_pm (komu, otkogo, theme, post, view, time, folder) VALUES ('{$user_id}', '0', 'Рынок: Ты " . echo_sex('купил', 'купила') . " предмет " . mysql_real_escape_string($ar[1]) . " у игрока " . mysql_real_escape_string($name) . "', 'Ты " . echo_sex('купил', 'купила') . " предмет " . mysql_real_escape_string($ar[1]) . " выставленный на продажу на рынке в " . mysql_real_escape_string($rustown) . " у игрока " . mysql_real_escape_string($name) . " за " . $ar[0] . " " . pluralForm($ar[0], 'монету', 'монеты', 'монет') . ". Комментарий к предмету - " . mysql_real_escape_string($ar[2]) . "','0','" . time() . "',4)"); if ($user_id != $userid) { myquery("INSERT INTO game_pm (komu, otkogo, theme, post, view, time, folder) VALUES ('{$userid}', '0', 'Рынок: Твоя вещь " . mysql_real_escape_string($ar[1]) . " куплена игроком " . mysql_real_escape_string($char['name']) . "', 'Твоя вещь " . mysql_real_escape_string($ar[1]) . ", выставленная на продажу на рынке в " . mysql_real_escape_string($rustown) . ", куплена " . mysql_real_escape_string($char['name']) . " за " . $ar[0] . " " . pluralForm($ar[0], 'монету', 'монеты', 'монет') . ". Комментарий к предмету - " . mysql_real_escape_string($ar[2]) . "','0','" . time() . "',4)"); } save_stat($user_id, '', $town, 9, '', $ar[1], $userid, $ar[0], '', '', '', ''); echo '<br /><br /><font color="#FFFF00">Предмет <b>' . $Item->fact['name'] . '</b> куплен</font>'; } if ($dostup_clan == 2) { $str_query = "SELECT DISTINCT game_items_factsheet.type FROM game_items,game_items_factsheet where game_items.user_id={$user_id} and game_items.priznak=1 and game_items.town='{$town}' and game_items_factsheet.type<=97 and game_items.sell_time>'{$time_for_check}' AND game_items.post_to=0 AND game_items.item_id = game_items_factsheet.id and game_items_factsheet.type=" . $Item->fact['type'] . ""; } else {
<?php ini_set('display_errors', 1); error_reporting(E_ALL); include '../autoloader.php'; EventLog::logAddItem(1); echo "<p> ading to log item 1 add at time: " . date('Y-m-d H:i:s', time()); EventLog::logRemoveItem(1); echo "<p> ading to log item 1 remove at time: " . date('Y-m-d H:i:s', time()); EventLog::logItemCheckedOut(1, NULL); echo "<p> ading to log item 1 checked out no loan at time: " . date('Y-m-d H:i:s', time()); EventLog::logItemCheckedIn(1, NULL); echo "<p> ading to log item 1 checked in no loan at time: " . date('Y-m-d H:i:s', time()); EventLog::logItemCheckedOut(1, 1); echo "<p> ading to log item 1 checked out loan 1 at time: " . date('Y-m-d H:i:s', time()); EventLog::logItemCheckedIn(1, 1); echo "<p> ading to log item 1 checked in loan 1 at time: " . date('Y-m-d H:i:s', time()); EventLog::logUpdatedItem(1); echo "<p> ading to log item 1 update at time: " . date('Y-m-d H:i:s', time()); EventLog::logItemUnavailable(1); echo "<p> ading to log item 1 unavailable at time: " . date('Y-m-d H:i:s', time()); EventLog::logItemAvailable(1); echo "<p> ading to log item 1 unavailable at time: " . date('Y-m-d H:i:s', time()); $testItem = Item::getItem(1); $results = $testItem->getHistory(); var_dump($results);
include_once "../classes/Item.php"; include_once '../classes/common_functions.php'; ob_start(); session_start(); $SELL_RATIO = 0.6; $fn = new common_functions(); $actionToDo = $_GET['actionToDo']; if (isset($_GET['itemID'])) { $itemID = $_GET['itemID']; } if (isset($_GET['storePrice'])) { $storePrice = $_GET['storePrice']; } $user = User::getUser($_SESSION['userID']); if (isset($itemID)) { $item_details = Item::getItem($itemID); } $status = "success"; if (isset($_GET['oldUserQuantity'])) { $owned_quantity = $_GET['oldUserQuantity']; } if (isset($_GET['request_quantity'])) { $request_quantity = $_GET['request_quantity']; $required_money = $storePrice * $request_quantity; if ($user->getCash() < $required_money) { if (isset($_GET['cityID'])) { $_SESSION['missionEquipmentBought'] = 'false'; $_SESSION['missionEquipmentBoughtDesc'] = 'You don\'t have enough money to buy that.'; header("Location: {$serverRoot}choosemission.php?cityID=" . $_GET['cityID']); exit; }
<?php $access_item = false; if (isset($read_access) && $read_access) { return; } include_once $_SERVER["FRAMEWORK_PATH"] . "/config/init.php"; $query = new Query(); $IC = new Item(); print '<?xml version="1.0" encoding="UTF-8"?>'; ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <? // FRONTPAGE $item = $IC->getItem(array("tags" => "page:front")); ?> <url> <loc><?php echo SITE_URL; ?> /</loc> <lastmod><?php echo date("Y-m-d", strtotime($item["modified_at"])); ?> </lastmod> <changefreq>daily</changefreq> <priority>1</priority> </url> <? // POSTS MAINPAGE
} } echo '<br><br><input type="submit" name="delete_items" value="Удалить отмеченные предметы игрока">'; echo '<br><br><input type="submit" name="take_items" value="Удалить отмеченные предметы игрока c возвратом денег">'; echo '</form>'; } elseif (isset($_POST['delete_items']) or isset($_POST['take_items'])) { if (isset($_REQUEST['array_items'])) { $ar_it = $_REQUEST['array_items']; for ($i = 0; $i < sizeof($ar_it); $i++) { $deleteitem = $ar_it[$i]; $Item = new Item($deleteitem); $Item->admindelete(); echo '<br>Предмет <b>' . $Item->getFact('name') . '</b> успешно удален'; if (isset($_POST['take_items'])) { $item_cost = $Item->getFact('item_cost'); myquery("UPDATE game_users SET GP=GP+{$item_cost},CW=CW+" . $item_cost * money_weight . " WHERE user_id=" . $Item->getItem('user_id') . ""); myquery("UPDATE game_users_archive SET GP=GP+{$item_cost},CW=CW+" . $item_cost * money_weight . " WHERE user_id=" . $Item->getItem('user_id') . ""); setGP($Item->getItem('user_id'), $item_cost, 19); $da = getdate(); $log = myquery("INSERT INTO game_log_adm (adm,dei,cur_time,day,month,year)\n\t\t\t\t\t\t VALUES (\n\t\t\t\t\t\t '" . $char['name'] . "',\n\t\t\t\t\t\t 'Удалил предмет: <b>" . $Item->getFact('name') . "</b> у игрока " . $Item->getItem('user_id') . "',\n\t\t\t\t\t\t '" . time() . "',\n\t\t\t\t\t\t '" . $da['mday'] . "',\n\t\t\t\t\t\t '" . $da['mon'] . "',\n\t\t\t\t\t\t '" . $da['year'] . "')") or die(mysql_error()); } } } if (isset($_REQUEST['array_ress'])) { $ar_it = $_REQUEST['array_ress']; for ($i = 0; $i < sizeof($ar_it); $i++) { $selit = myquery("SELECT * FROM craft_resource_user WHERE id = " . $ar_it[$i] . ""); $it = mysql_fetch_array($selit); $ress = mysql_fetch_array(myquery("SELECT * FROM craft_resource WHERE id=" . $it['res_id'] . "")); $col = (int) $_REQUEST['array_ress_col_' . $ress['id']]; if ($col > 0) {
function displayMissionInfo($mission, $playerLevel, $cityRank, $currentCityID, $serverRoot, $requiredItemsPopupHTML) { $isMissionLocked = false; if (missionIsLocked($mission, $playerLevel)) { $isMissionLocked = true; } $missionID = $mission->getID(); if ($isMissionLocked) { ?> <div class="lockedupgeneric"> <h3><?php echo $mission->getName(); ?> </h3> <p>Unlock at LVL <?php echo $mission->getMinLevel(); ?> </p> </div> <?php } else { ?> <div class="mission"> <table class="topmission"> <tr> <td> <h4><?php echo $mission->getName() . $isMissionLocked; ?> </h4> <?php $userMissionData = UserMissionData::getUserMissionData($_SESSION['userID'], $mission->getID()); $completionPercent; if ($cityRank == 4) { $completionPercent = 100; $cityRank = 3; } else { $userTimesMissionDoneInThisRank = 0; if ($userMissionData) { $userTimesMissionDoneInThisRank = $userMissionData->getRankTimes($cityRank); } $missionTimesToMasterRank = $mission->getRankReqTimes($cityRank); if ($userTimesMissionDoneInThisRank >= $missionTimesToMasterRank) { $completionPercent = 100; } else { $completionPercent = number_format($userTimesMissionDoneInThisRank / $missionTimesToMasterRank, 2) * 100; } } ?> </td> <td> <div class="missionrank"> <img src="img/percentimage4.png" alt="9.5%" height="9" class="percentImageMissions" style="background-position: <?php echo 100 - $completionPercent; ?> % 0pt;" /> <p><?php echo $completionPercent; ?> % Rank <?php echo $cityRank; ?> </p> </div> </td> </tr> </table> <div class="missioninfo"> <ul> <li><strong>+ $<?php echo $mission->getMinCashGained(); ?> - $<?php echo $mission->getMaxCashGained(); ?> </strong></li> <li>+ <?php echo $mission->getExpGained(); ?> Experience</li> <?php $lootItemID = $mission->getLootItemID(); if ($lootItemID) { $lootItem = Item::getItem($lootItemID); ?> <li><em> Chance of Loot</em></li> <?php } $itemIDsToQuantity = Mission::getMissionRequiredItemsIDsToQuantity($missionID); $itemIDsToItems = Item::getItemIDsToItems(array_keys($itemIDsToQuantity)); $userItemsdetails = User::getUsersItemsIDsToQuantity($_SESSION['userID']); $requiredItemsHTML = ''; foreach ($itemIDsToQuantity as $key => $value) { $item = $itemIDsToItems[$key]; if (isset($userItemsdetails[$item->getID()]) && $userItemsdetails[$item->getID()] >= $value) { $requiredItemsHTML .= '<li><img src="' . $item->getImage() . '">x' . $value . ' </li>'; } else { $requiredItemsHTML .= '<li><a class="inlinecontent" href="#inline' . $item->getID() . $value . '-' . $mission->getCityID() . '"><img src="' . $item->getImage() . '"><span>x' . $value . '</span></a></li>'; itemRequiredPopUp($item, $value, $requiredItemsPopupHTML, $serverRoot, $mission->getCityID(), $playerLevel); } } if (!missionIsLocked($mission, $playerLevel)) { $url = $serverRoot . 'backend/domission.php?missionID=' . $mission->getID() . '¤tMissionCity=' . $currentCityID . '&cityID=' . $currentCityID . '&energyRequired=' . $mission->getEnergyCost(); ?> </ul> <div class="domission"> <a href="<?php echo $url; ?> "> Do Mission</a> </div> <?php } ?> </div> <div class="missionreq"> <h5>Required <em><?php echo $mission->getEnergyCost(); ?> Energy</em></h5> <ul class="reqitems"> <?php echo $requiredItemsHTML; ?> </ul> </div> </div> <?php } }
public function setItem(Item $item) { $this->item = $item; $this->id_item = $item->getItem()->getId(); return true; }
} elseif (!$check_time and $done) { not_in_time(); } else { fail(); } break; case 7: $Item = new Item(); $find = $Item->find_item($quest_user['par1_value']); if ($find == 0) { $done = 0; } else { $done = 1; } if ($find != 0) { $used = $Item->getItem('used'); } else { $used = 0; } if ($used != 0) { echo '<tr><td align="center">'; //QuoteTable('open'); echo '<font color=#F0F0F0>Сначала снимите предмет, чтобы я мог его осмотреть.'; //QuoteTable('close'); //echo '<BR><BR><BR>'; //QuoteTable('open'); /*cho '</tr></td></table><br><br><hr size=2 width=85%><br></tr></td><tr><td><center>';*/ echo '<br><br><hr size=2 width=85%><br></tr></td><tr><td><center>'; /*echo '<BR><BR><center>'; QuoteTable('open');*/ echo '<font color=#F0F0F0><a href ="?done=1">1) Сей момент</a><br>';