本文整理汇总了PHP中has_item函数的典型用法代码示例。如果您正苦于以下问题:PHP has_item函数的具体用法?PHP has_item怎么用?PHP has_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hunterslodge_avatar_run
function hunterslodge_avatar_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
$op = httpget("op");
$free = httpget("free");
$context = httpget("context");
switch ($context) {
case "village":
$backlink = "village.php";
break;
case "forest":
$backlink = "forest.php";
break;
case "worldmap":
$backlink = "runmodule.php?module=worldmapen&op=continue";
break;
case "lodge":
$backlink = "runmodule.php?module=iitems_hunterslodge&op=start";
break;
}
page_header("Choose your Avatar");
switch ($op) {
case "change":
output("Want to change your Avatar? No problem. Upload your avatar via the box below. Please note that NSFW images, stolen artwork or otherwise dodgy avatars will be erased without refund. Upload files in .jpg or .png format. Your limits are 100 pixels wide, 100 pixels tall, with a maximum filesize of 100k. 100px * 100px * 100k, simple!`n`n");
output("Upload your avatar:`n");
rawoutput("<form method='POST' enctype='multipart/form-data' name='upload' action='runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}'><input type='file' name='file'><br><br><input type='submit' class='button' name='Upload' value='Upload!'></form>");
addnav("", "runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}");
addnav("Cancel");
addnav("Don't set an Avatar, just go back to where I came from", $backlink);
break;
case "confirm":
if (httppost("Upload")) {
$allowed_types = "(jpg|png)";
debug(httpallpost());
debug($_FILES);
$file = $_FILES["file"];
debug($file);
$errors = array(0 => "File Received!", 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini.", 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.", 3 => "The uploaded file was only partially uploaded.", 4 => "No file was uploaded.", 6 => "Missing a temporary folder.");
output_notl("`\$" . $errors[$error] . "`n");
if (is_uploaded_file($file["tmp_name"])) {
if (preg_match("/\\." . $allowed_types . "\$/i", $file["name"])) {
if ($file["size"] <= 102400) {
$extension = substr($file['name'], strlen($file['name']) - 4, 4);
$loginname = str_replace(" ", "", $session['user']['login']);
$filename = "images/avatars/" . date("YmdHs") . $loginname . $extension;
if (move_uploaded_file($file["tmp_name"], $filename)) {
$pic_size = @getimagesize($filename);
// GD2 required here - else size always is recognized as 0
$pic_width = $pic_size[0];
$pic_height = $pic_size[1];
if ($pic_height <= 100 && $pic_width <= 100) {
output("So, this is what you want to look like? Click \"Set Avatar\" to confirm.`n`n");
addnav("Confirm");
addnav("Set Avatar", "runmodule.php?module=hunterslodge_avatar&op=set&free={$free}&context={$context}&avatar=" . rawurlencode($filename));
$image = "<img align='left' src='" . $filename . "'>";
rawoutput("<table><tr><td valign='top'>");
$terms = appoencode(translate_inline("Your Avatar"));
rawoutput("</td><td valign='top'>{$image}</td></tr><td></td><td>{$terms}</td></table>");
} else {
output("That picture's too big! The limit is 100 pixels by 100 pixels.`n`n");
}
} else {
output("The file could not be uploaded.`n`n");
}
} else {
output("You may only have a filesize up to 100 kilobytes!`n`n");
}
} else {
output("That file extension is not supported!`n`n");
}
} else {
output("You did not specify a file to upload.`n`n");
}
}
output("`0To try again with a different picture, use the form below.`n`n");
rawoutput("<form method='POST' enctype='multipart/form-data' name='upload' action='runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}'><input type='file' name='file'><br><br><input type='submit' class='button' name='Upload' value='Upload!'></form>");
addnav("", "runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}");
addnav("Cancel");
addnav("Don't set an Avatar, just go back to where I came from", $backlink);
break;
case "set":
$av = httpget("avatar");
set_module_pref("avatar", $av);
output("Your Avatar has been changed!`n`n");
if (!$free) {
$id = has_item("hunterslodge_avatar");
delete_item($id);
}
addnav("Return");
addnav("Go back to where I came from", $backlink);
break;
}
page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:96,代码来源:hunterslodge_avatar.php
示例2: rem_sc_from_book
function rem_sc_from_book($spell, $book, $login)
{
// v has_item proveritsja
//$spell = preg_replace ('/[^a-z0-9_\.]/i', '', $spell);
//$book = preg_replace ('/[^a-z0-9_\.]/i', '', $book);
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
include_once 'modules/f_has_item.php';
if (!has_item($book, $login)) {
put_g_error('у вас нету книги');
}
// zapros na magiju chto v knige:
$q = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $book . "' AND type = 'b';");
if (!mysql_num_rows($q)) {
return 0;
}
$magic = mysql_result($q, 0);
if (strpos($magic, $spell) === false) {
put_g_error('в этой книге нету этого заклинания!');
}
// esli prodolzhaetsja skript, znachit magija estq, izvlekem ee (snachala udalim, togda bagov skryvatq nebvudut:)
$magic = string_drop($magic, $spell);
// terq sozdadim:
//include_once ('modules/f_create_item.php');
$q = do_mysql("SELECT type FROM magic WHERE fullname = '" . $spell . "';");
if (!mysql_num_rows($q)) {
put_error('netu takogo zaklinanija');
}
$tp = mysql_result($q, 0);
//#####$scroll = create_item ('i.s.'.$tp.'.'.$spell);
include_once 'modules/f_gain_item.php';
gain_item('i.s.' . $tp . '.' . $spell, 1, $login);
// obnovim knigu i vse:
do_mysql("UPDATE items SET on_take = '" . $magic . "' WHERE fullname = '" . $book . "';");
return 1;
}
示例3: teach_magic_from_sc
function teach_magic_from_sc($scroll, $npc, $login)
{
//$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
//$npc = preg_replace ('/[^a-z0-9_\.]/i', '', $npc);
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
$nid = is_npc($npc);
$id = is_player($login);
// v odnoj li lokacii
$q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
if (!mysql_num_rows($q)) {
return 0;
}
$loc1 = mysql_result($q, 0);
$q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
if (!mysql_num_rows($q)) {
return 0;
}
$loc2 = mysql_result($q, 0);
if ($loc1 != $loc2) {
return 0;
}
include_once 'modules/f_has_item.php';
if (!has_item($scroll, $login)) {
put_g_error('у вас нету свитка!');
}
$q = do_mysql("SELECT on_take, price FROM items WHERE fullname = '" . $scroll . "' AND type = 's';");
if (!mysql_num_rows($q)) {
return 0;
}
$spell = mysql_fetch_assoc($q);
// neumeet li on uzhe
include_once 'modules/f_has_magic.php';
if (has_magic($spell['on_take'], $login)) {
put_g_error('вы уже умеете это заклинание!');
}
// cenu vyschitaem:
$q = do_mysql("SELECT money FROM players WHERE id_player = '" . $id . "';");
$money = mysql_result($q, 0);
$cost = $spell['price'] * 10;
if ($money < $cost) {
put_g_error('нехватает серебра, нужно ' . $cost . ' серебреных!');
}
$money -= $cost;
// dobavljaem zakl:
$q = do_mysql("SELECT magic FROM players WHERE id_player = '" . $id . "';");
$magic = mysql_result($q, 0);
if (!$magic) {
$magic = $spell['on_take'];
} else {
$magic .= '|' . $spell['on_take'];
}
// obnovim dannye:
do_mysql("UPDATE players SET magic = '" . $magic . "', money = '" . $money . "' WHERE id_player = '" . $id . "';");
// udaljaem svitok
include_once 'modules/f_delete_item.php';
delete_item($scroll);
$q = do_mysql("SELECT name FROM magic WHERE fullname = '" . $spell['on_take'] . "';");
$name = mysql_result($q, 0);
exit_msg('магия', 'вы выучили заклинание ' . $name . ' за ' . $cost . ' серебреных!');
}
示例4: hunterslodge_customtitle_run
function hunterslodge_customtitle_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
$op = httpget("op");
$free = httpget("free");
page_header("Choose your Custom Title");
switch ($op) {
case "change":
output("Ready to change your Title? No problem. Enter your desired Title in the box below. You've got 25 characters to play with, including colour codes.`n`n");
titlechange_form();
addnav("Cancel");
addnav("Don't change colours, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "confirm":
$ntitle = rawurldecode(httppost('newname'));
$ntitle = newline_sanitize($ntitle);
if ($ntitle == "") {
$ntitle = "`0";
}
$ntitle = preg_replace("/[`][cHw]/", "", $ntitle);
$ntitle = sanitize_html($ntitle);
$nname = get_player_basename();
output("`0Your new title will look like this: %s`0`n", $ntitle);
output("`0Your entire name will look like: %s %s`0`n`n", $ntitle, $nname);
output("Do you want to set the new title now?`n`n");
output("`0Try a different title below, if you like.`n`n");
titlechange_form();
addnav("Confirm");
addnav("Set the new Title", "runmodule.php?module=hunterslodge_customtitle&op=set&free={$free}&newname=" . rawurlencode($ntitle));
addnav("Cancel");
addnav("Don't change your Title, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "set":
$ntitle = rawurldecode(httpget('newname'));
$fromname = $session['user']['name'];
$newname = change_player_ctitle($ntitle);
$session['user']['ctitle'] = $ntitle;
$session['user']['name'] = $newname;
output("You are now known as %s!`0`n`n", $session['user']['name']);
if (!$free) {
$id = has_item("hunterslodge_customtitle");
delete_item($id);
}
addnav("Return");
addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
}
page_footer();
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:51,代码来源:hunterslodge_customtitle.php
示例5: hunterslodge_customrace_run
function hunterslodge_customrace_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
$op = httpget("op");
$free = httpget("free");
page_header("Choose your Custom Race");
switch ($op) {
case "change":
output("Want to change your Custom Race? No problem. Enter your desired race in the box below. You've got 25 characters to play around with.`n(leave this blank to disable custom race naming and return to default, game-supplied race names)`n`n");
rawoutput("<form action='runmodule.php?module=hunterslodge_customrace&op=confirm&free=" . $free . "' method='POST'>");
$race = get_module_pref("customrace");
rawoutput("<input id='input' name='newrace' width='25' maxlength='25' value='" . htmlentities($race, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>");
rawoutput("<input type='submit' class='button' value='Preview'>");
rawoutput("</form>");
addnav("", "runmodule.php?module=hunterslodge_customrace&op=confirm&free=" . $free);
addnav("Cancel");
addnav("Don't set a custom race, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "confirm":
$newrace = httppost("newrace");
$sub = httpget("sub");
$newrace = str_replace("`", "", $newrace);
$newrace = comment_sanitize($newrace);
$newrace = substr($newrace, 0, 25);
if ($newrace) {
output("Your new custom race is:`n%s`nWould you like to set your new Race now?`n`n", $newrace);
} else {
output("You've chosen to go back to the default, game-supplied races. Are you sure that's what you want?`n`n");
}
addnav("Confirm");
addnav("Set custom race", "runmodule.php?module=hunterslodge_customrace&op=set&free={$free}&newrace=" . rawurlencode($newrace));
addnav("Cancel");
addnav("Don't set a custom race, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "set":
$newrace = rawurldecode(httpget("newrace"));
output("Your custom race has been set to %s!`n`n", $newrace);
set_module_pref("customrace", $newrace);
if (!$free) {
$id = has_item("hunterslodge_customrace");
delete_item($id);
}
addnav("Return");
addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
}
page_footer();
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:50,代码来源:hunterslodge_customrace.php
示例6: hunterslodge_healthinsurance_dohook
function hunterslodge_healthinsurance_dohook($hookname, $args)
{
global $session;
switch ($hookname) {
case "healmultiply":
if ($session['user']['race'] != "Robot") {
if (has_item("hunterslodge_healthinsurance")) {
redirect("runmodule.php?module=hunterslodge_healthinsurance");
}
}
break;
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:14,代码来源:hunterslodge_healthinsurance.php
示例7: giftbox_use
function giftbox_use($args)
{
global $session;
debug($args);
$cname = get_item_pref("verbosename", $args['giftbox_contains']);
output("`0You open up the box to find a %s!`0`n`n", $cname);
if (get_item_pref("inventorylocation", $args['giftbox_contains']) == "lodgebag") {
if (!has_item("lodgebag")) {
give_item("lodgebag");
}
} else {
clear_item_pref("inventorylocation", $args['giftbox_contains']);
}
change_item_owner($args['giftbox_contains'], $session['user']['acctid']);
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:16,代码来源:giftbox.php
示例8: add_sc_to_book
function add_sc_to_book($scroll, $book, $login)
{
// v has_item proveritsja
//$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
//$book = preg_replace ('/[^a-z0-9_\.]/i', '', $book);
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
include_once 'modules/f_has_item.php';
if (!has_item($scroll, $login)) {
put_g_error('у вас нету свитка');
}
if (!has_item($book, $login)) {
put_g_error('у вас нету книги');
}
// tolqko esli estq navyk:
$q = do_mysql("SELECT skills FROM players WHERE login = '" . $login . "';");
$skills = mysql_result($q, 0);
$skills = explode('|', $skills);
if (!$skills[30]) {
put_g_error('у вас нету навыка');
}
// dobavim:
$q = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $book . "' AND type = 'b';");
if (!mysql_num_rows($q)) {
return 0;
}
$mlist = mysql_result($q, 0);
$q = do_mysql("SELECT on_take FROM items WHERE type = 's' AND fullname = '" . $scroll . "';");
if (!mysql_num_rows($q)) {
return 0;
}
$spell = mysql_result($q, 0);
if (strpos($mlist, $spell) !== false) {
put_g_error('в этой книге уже есть это заклинание!');
}
if ($mlist) {
$mlist .= '~' . $spell;
} else {
$mlist = $spell;
}
do_mysql("UPDATE items SET on_take = '" . $mlist . "' WHERE fullname = '" . $book . "';");
// udalim svitok:
include_once 'modules/f_delete_item.php';
delete_item($scroll);
return 1;
}
示例9: staminafood_run
function staminafood_run()
{
global $session;
$pmeat1 = has_item_quantity("meat_low");
$pmeat2 = has_item_quantity("meat_medium");
$pmeat3 = has_item_quantity("meat_high");
addnav("Eat");
switch (httpget("op")) {
case "sellmeat":
switch ($session['user']['location']) {
case "NewHome":
page_header("Joe's Diner");
if (httpget('q') == 1) {
delete_item(has_item("meat_medium"));
$session['user']['gold'] += 5;
output("With a surly grunt, Joe grabs your meat and slaps down five Requisition tokens.`n`n");
} else {
for ($i = 1; $i <= $pmeat2; $i++) {
delete_item(has_item("meat_medium"));
$session['user']['gold'] += 5;
}
output("With a surly grunt, Joe grabs your meat and slaps down %s Requisition tokens.`n`n", $pmeat2 * 5);
}
break;
case "New Pittsburgh":
page_header("BRAAAAAINS");
if (httpget('q') == 1) {
delete_item(has_item("meat_medium"));
$session['user']['gold'] += 6;
output("With a nod, the waiter takes your meat and hands back six Requisition tokens.`n`n");
} else {
for ($i = 1; $i <= $pmeat2; $i++) {
delete_item(has_item("meat_medium"));
$session['user']['gold'] += 6;
}
output("With a nod, the waiter takes your meat and hands back %s Requisition tokens.`n`n", $pmeat2 * 6);
}
break;
case "Kittania":
page_header("Cool Springs Cafe");
if (httpget('q') == 1) {
delete_item(has_item("meat_high"));
$session['user']['gold'] += 12;
output("With a warm smile, the waitress takes your meat and hands back twelve Requisition tokens.`n`n");
} else {
for ($i = 1; $i <= $pmeat3; $i++) {
delete_item(has_item("meat_high"));
$session['user']['gold'] += 12;
}
output("With a warm smile, the waitress takes your meat and hands back %s Requisition tokens.`n`n", $pmeat3 * 12);
}
break;
case "Squat Hole":
page_header("Kebabs 'N' Shite");
if (httpget('q') == 1) {
delete_item(has_item("meat_low"));
$session['user']['gold'] += 2;
output("With a squeaky \"Ta mate,\" the Midget behind the counter relieves you of the stinking yellow meat and hands back two Requisition tokens.`n`n");
} else {
for ($i = 1; $i <= $pmeat1; $i++) {
delete_item(has_item("meat_low"));
$session['user']['gold'] += 2;
}
output("With a squeaky \"Ta mate,\" the Midget behind the counter relieves you of the stinking yellow meat and hands back %s Requisition tokens.`n`n", $pmeat1 * 2);
}
break;
}
break;
case "start":
switch (httpget("location")) {
case "nh":
page_header("Joe's Diner");
output("`0You head into what presents itself as a 1950's-style diner. Plastic red and white gingham patterns cover every available surface. Tomato-shaped ketchup bottles are dotted on tables here and there, dried gunge crusting their nozzles. Behind the bar can be seen Joe, the owner, who is keeping himself busy wiping down the counter tops with a rag, redistributing the half-inch-thick layer of grease into a more uniform level. A sign above the counter reads \"`2WE BUY MEAT. WE PAY 5 REQ PER 120 GRAM'S.`0\"`n`n");
if ($session['user']['race'] != "Robot") {
output("The smell of fried onions does its wicked work, and you glance up at the menu.`n`n");
if (get_module_pref("fullness") <= 100) {
if ($session['user']['gold'] >= 10) {
addnav("Crisps (10 Req)", "runmodule.php?module=staminafood&op=buy&bought=1");
} else {
output("After a careful read of the menu, you realise that you can't afford a single thing on it. Bah.");
}
if ($session['user']['gold'] >= 40) {
addnav("Garden Salad (40 Req)", "runmodule.php?module=staminafood&op=buy&bought=2");
}
if ($session['user']['gold'] >= 50) {
addnav("Plate of Chips (50 Req)", "runmodule.php?module=staminafood&op=buy&bought=3");
addnav("Coffee (50 Req)", "runmodule.php?module=staminafood&op=buy&bought=4");
}
if ($session['user']['gold'] >= 150) {
addnav("Bangers & Mash (150 Req)", "runmodule.php?module=staminafood&op=buy&bought=5");
}
if ($session['user']['gold'] >= 300) {
addnav("Cheeseburger (300 Req)", "runmodule.php?module=staminafood&op=buy&bought=6");
}
} else {
output("You are far too full to eat any more today.`n`n");
}
}
if ($pmeat2) {
output("You remember that Maiko told you that the NewHome diner will only buy middling-quality meat. You have %s pieces of average-quality meat to sell. All of them, quite conveniently - perhaps a little TOO conveniently - weigh exactly a hundred and twenty grams each.`n`n", $pmeat2);
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:staminafood.php
示例10: eboy_run
function eboy_run()
{
global $session, $inventory;
if (!isset($inventory)) {
load_inventory();
}
page_header("eBoy's Trading Station");
addnav("Buy Items");
addnav("Sell Items");
require_once "modules/cityprefs/lib.php";
$cid = get_cityprefs_cityid("location", $session['user']['location']);
$item = httpget('item');
if ($item) {
$curstock = get_item_setting("eboy_stock_" . $cid, $item);
$curprice = get_item_setting("eboy_price_" . $cid, $item);
}
eboy_updateprices();
$eboy_info = get_items_with_settings("eboy");
if (httpget('op') == "start") {
output("Already fearing the worst, you head into eBoy's Trading Station.`n`nYour fears are well-founded. The place is packed with the heaving, sweaty bodies of the hardcore capitalist, shouting \"`iBuy, buy!`i\" and \"`iSell, sell!`i\" and \"`iPut down the chainsaw and let's talk about this!`i\"`n`neBoy himself - although you suspect that this place, like Mike's Chop Shop, is a franchise of which you'll find one in every outpost, so is his name really eBoy? Whoever he is, he stands on an elevated section of floor behind a tall mahogany counter, grabbing money with one hand and tossing grenades and ration packs over his shoulder with the other. His arms are a blur. His speech is the unintelligible, rapid-fire gabble of a professional auctioneer. His eyes bulge and swivel. You know he's loving this.`n`n");
}
if (httpget('op') == "buy") {
$pprice = httpget('price');
if ($pprice == $curprice) {
if ($curstock > 0) {
give_item($item);
$session['user']['gold'] -= $curprice;
increment_item_setting("eboy_stock_" . $cid, -1, $item);
output("You fight your way to the front of the crowd and shout your order up to eBoy, slapping your Requisition tokens down on the counter. Before you can blink, your money is gone and the item you desired sits in its place. You grab it hastily and stuff it into your backpack as eBoy turns to deal with the next customer.`n`n");
} else {
output("eBoy turns to you and gibbers.`n`n\"Sorrymatejustsoldthelastoneyougottabefasteritsthequickandthedeadaroundherepal.\" He turns to the next customer in line, leaving you trying to piece together whatever it is that he just said.`n`n");
}
} else {
output("You fight your way to the front of the crowd and shout your order up to eBoy, slapping your Requisition tokens down on the counter. eBoy turns to you and gibbers.`n`n\"Idontmeantobefunnymatebutlookattheboardthepricehasjustbloodychangedagainyousureyoustillwannabuy?\" After giving you exactly one microsecond to consider what the hell he just asked, he rolls his eyes and turns to the next customer in line.`n`n");
}
}
if (httpget('op') == "sell") {
$pprice = httpget('price');
$requiredprefs = array("inventorylocation" => "main");
$itemid = has_item($item, $requiredprefs);
if ($pprice == $curprice) {
delete_item($itemid);
if ($curstock < 3) {
$buy = round($curprice * 0.5);
} else {
$buy = round($curprice * 0.7);
}
$session['user']['gold'] += $buy;
increment_item_setting("eboy_stock_" . $cid, 1, $item);
output("You barge your way through the crowd like a battleship through an ice floe, and toss your item up to eBoy. eBoy snatches the item out of the air with his left hand while tossing your Requisition tokens back at you with his right, and goes on to serve the next customer.`n`n");
} else {
output("You fight your way to the front of the crowd and shout your order up to eBoy, slapping your Requisition tokens down on the counter. eBoy turns to you and gibbers.`n`n\"Idontmeatobefunnymatebutlookattheboardthepricehasjustbloodychangedagainyousureyoustillwannasell?\" After giving you exactly one microsecond to consider what the hell he just asked, he rolls his eyes and turns to the next customer in line.`n`n");
}
}
output("You look up above eBoy's head at the trading board, the values of each commodity displayed on a mechanical readout which clatters and changes constantly.`n`n");
$sellable_inventory = array();
foreach ($inventory as $itemid => $prefs) {
if (!$prefs['carrieritem'] && $prefs['eboy'] && $prefs['inventorylocation'] == "main") {
$sellable_inventory[$prefs['item']]['quantity'] += 1;
$sellable_inventory[$prefs['item']]['itemids'][] = $itemid;
}
}
eboy_updateprices();
$eboy_info = get_items_with_settings("eboy");
//inventory-type display routine
rawoutput("<table width=100% style='border: dotted 1px #000000;'>");
$classcount = 1;
foreach ($eboy_info as $item => $settings) {
if ($settings['eboy_stock_' . $cid] > 0) {
$stock = number_format($settings['eboy_stock_' . $cid]) . " available";
} else {
$stock = "`4Sold Out`0";
}
$classcount++;
$class = $classcount % 2 ? "trdark" : "trlight";
rawoutput("<tr class='{$class}'><td>");
if ($settings['image']) {
rawoutput("<table width=100% cellpadding=0 cellspacing=0><tr><td width=100px align=center><img src=\"images/items/" . $settings['image'] . "\"></td><td>");
}
output("`b%s`b`n", stripslashes($settings['verbosename']));
output("%s`n", stripslashes($settings['description']));
if ($settings['weight']) {
output("Weight: %s kg`n", $settings['weight']);
}
rawoutput("<table width=100%><tr><td width=50%>");
output("`bStock:`b %s", $stock);
if ($settings['eboy_stock_' . $cid] < 3) {
$buy = round($settings['eboy_price_' . $cid] * 0.5);
} else {
$buy = round($settings['eboy_price_' . $cid] * 0.7);
}
if ($settings['eboy_price_' . $cid] > 0) {
output("`n`7Buying at: %s Requisition", number_format($buy));
} else {
output("`nNot Buying");
}
if ($settings['eboy_stock_' . $cid] > 0) {
output("`n`2Selling at: %s Requisition`n`n", number_format($settings['eboy_price_' . $cid]));
} else {
output("`n`n");
//.........这里部分代码省略.........
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:eboy.php
示例11: hunterslodge_customarmour_run
function hunterslodge_customarmour_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
$op = httpget("op");
$free = httpget("free");
$context = httpget("context");
switch ($context) {
case "village":
$backlink = "village.php";
break;
case "forest":
$backlink = "forest.php";
break;
case "worldmap":
$backlink = "runmodule.php?module=worldmapen&op=continue";
break;
case "lodge":
$backlink = "runmodule.php?module=iitems_hunterslodge&op=start";
break;
}
page_header("Choose your Custom Armour");
switch ($op) {
case "change":
output("Want to change your Custom Armour? No problem. Enter your desired armour in the box below. You've got 25 characters to play around with.`n(leave this blank to disable custom armour naming and return to default, game-supplied armour names)`n`n");
rawoutput("<form action='runmodule.php?module=hunterslodge_customarmour&op=confirm&free={$free}&context={$context}' method='POST'>");
$armour = get_module_pref("customarmour");
rawoutput("<input id='input' name='newarmour' width='25' maxlength='25' value='" . htmlentities($armour, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>");
rawoutput("<input type='submit' class='button' value='Preview'>");
rawoutput("</form>");
addnav("", "runmodule.php?module=hunterslodge_customarmour&op=confirm&free={$free}&context={$context}");
addnav("Cancel");
addnav("Don't set custom armour, just go back to where I came from", $backlink);
break;
case "confirm":
$newarmour = httppost("newarmour");
$sub = httpget("sub");
$newarmour = str_replace("`", "", $newarmour);
$newarmour = comment_sanitize($newarmour);
$newarmour = substr($newarmour, 0, 25);
if ($newarmour) {
output("Your new custom armour is:`n%s`nWould you like to set your new armour now?`n`n", $newarmour);
} else {
output("You've chosen to go back to the default, game-supplied armours. Are you sure that's what you want?`n`n");
}
addnav("Confirm");
addnav("Set custom armour", "runmodule.php?module=hunterslodge_customarmour&op=set&free={$free}&context={$context}&newarmour=" . rawurlencode($newarmour));
addnav("Cancel");
addnav("Don't set custom armour, just go back to where I came from", $backlink);
break;
case "set":
$newarmour = rawurldecode(httpget("newarmour"));
if ($newarmour == "") {
output("Your custom armour name has been removed. The next time you change your armour, you'll return to game-supplied armour names.`n`n");
} else {
output("Your custom armour has been set to %s!`n`n", $newarmour);
$session['user']['armor'] = $newarmour;
}
set_module_pref("customarmour", $newarmour);
if (!$free) {
require_once "modules/iitems/lib/lib.php";
$id = has_item("hunterslodge_customarmour");
delete_item($id);
}
addnav("Return");
addnav("Return to where I came from", $backlink);
break;
}
page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:71,代码来源:hunterslodge_customarmour.php
示例12: list_inventory
<?php
// zheltyj kamenq, prevrashjaet rybu v fosfor
if (!isset($_GET['part'])) {
// vyberaem chto prevratitq v fosfor, ato somov vsjakih zhalko budet
include_once 'modules/f_list_inventory.php';
$f .= '<b>выберите рыбу, какую не жалко:</b><br/>';
$f .= list_inventory($LOGIN, 'i.f.foo.fish_', 'use_stand&item=' . $item . '&part=2');
exit_msg('желтый камень', $f);
} else {
$to = mysql_real_escape_string(strip_tags($_GET['to']));
if (substr($to, 0, 12) != 'i.f.foo.fish') {
put_g_error('ты та что суешь?');
}
include_once 'modules/f_has_item.php';
if (!has_item($to, $LOGIN)) {
put_g_error('а где рыба?');
}
// udaljaem syrqe
include_once 'modules/f_delete_item.php';
delete_item($to);
include_once 'modules/f_gain_item.php';
gain_item('i.q.que.alch.fosfor', 1, $LOGIN);
}
示例13: output
<?php
if (has_item("toolbox_decorating") || has_item("toolbox_carpentry") || has_item("toolbox_masonry")) {
output("You look around for your tools, but find none. Suzie's staff must taken them back during the night.`n`n");
delete_all_items_of_type("toolbox_decorating");
delete_all_items_of_type("toolbox_carpentry");
delete_all_items_of_type("toolbox_masonry");
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:8,代码来源:newday.php
示例14: preg_replace
<?php
// fail ispolqzovanija veshej
// tolqko perebiraet tipy i podkljuchjaet drgie nuzhnye faily
$item = preg_replace('/[^a-z0-9_\\.]/i', '', $_GET['item']);
$t = substr($item, 2, 1);
include_once 'modules/f_has_item.php';
include_once 'modules/f_get_it_name.php';
$itname = get_it_name($item);
// infa veshi
//$ii = get_it_info ($item);
if (has_item($item, $LOGIN) == 0) {
put_g_error('у вас нету этой веши');
}
// handler )
// stranica
switch ($t) {
case 'w':
include 'modules/sp/sp_use_weapon.php';
break;
case 'a':
include 'modules/sp/sp_use_armor.php';
break;
case 'f':
include 'modules/sp/sp_use_food.php';
break;
case 's':
include 'modules/sp/sp_use_scroll.php';
break;
case 'b':
include 'modules/sp/sp_use_book.php';
break;
示例15: improbablehousing_show_build_jobs
function improbablehousing_show_build_jobs($house)
{
//run through the build jobs and show percentage to completion, along with navs to use the relevant item and its associated Stamina cost.
//For easyness, don't allow the player to build if they're in Amber stamina
$jobs = $house['data']['buildjobs'];
require_once "modules/staminasystem/lib/lib.php";
$storestock = $house['data']['store'];
$displayjobs = array();
if (count($jobs)) {
foreach ($jobs as $key => $vals) {
if (!isset($displayjobs[$vals['name']])) {
addnav(array("%s", $vals['name']));
foreach ($vals['jobs'] as $skey => $svals) {
$cando = 1;
$displayjobs[$vals['name']][$svals['name']]['req'] = $svals['req'];
$displayjobs[$vals['name']][$svals['name']]['done'] = $svals['done'];
//check completion
if ($svals['completed']) {
$cando = 0;
}
//Check Stamina
if (get_stamina() < 100) {
$cando = 0;
$nostam = 1;
$displayjobs[$vals['name']][$svals['name']]['nostamina'] = true;
}
$store = array();
$player = array();
foreach ($svals['iitems'] as $ikey => $iitem) {
$store[$ikey] = $house['data']['store'][$ikey];
if (has_item($ikey)) {
$player[$ikey] = 1;
}
}
//check that each item required is present in either the store or the player's inventory... this could be neater...
$svals['useplayer'] = true;
foreach ($svals['iitems'] as $ikey => $iitem) {
if (!$store[$ikey] && !$player[$ikey]) {
$cando = 0;
$displayjobs[$vals['name']][$svals['name']]['noitem'] = true;
}
if ($store[$ikey] > 0) {
$svals['usestore'] = true;
}
if (!$player[$ikey]) {
$svals['useplayer'] = false;
}
}
// debug($store);
// debug($player);
if ($cando) {
$scost = 0;
foreach ($svals['actions'] as $akey => $action) {
$scost += stamina_getdisplaycost($akey);
}
if ($svals['useplayer']) {
addnav(array("%s (`Q%s%%`0)", $svals['name'], $scost), "runmodule.php?module=improbablehousing&op=build&hid=" . $house['id'] . "&job=" . $key . "&subjob=" . $skey);
}
if ($svals['usestore']) {
addnav(array("%s (using store) (`Q%s%%`0)", $svals['name'], $scost), "runmodule.php?module=improbablehousing&op=build&hid=" . $house['id'] . "&job=" . $key . "&subjob=" . $skey . "&store=true");
}
}
}
}
}
}
if (count($displayjobs)) {
output("`b`0Current Construction Jobs`b`n");
foreach ($displayjobs as $job => $sub) {
output_notl("`0->%s`n", $job);
foreach ($sub as $sjob => $vals) {
$jobout = "<table><tr><td>";
require_once "lib/bars.php";
$bar = fadebar($vals['done'], $vals['req']);
if ($vals['completed']) {
$jobout .= "-->" . $sjob . " </td><td>" . $bar . "</td> ";
} else {
$jobout .= "-->" . $sjob . " </td><td>" . $bar . "</td><td> " . $vals['done'] . "/" . $vals['req'] . " ";
if ($vals['nostamina']) {
$jobout .= "(you don't have enough Stamina to do this job) ";
}
if ($vals['noitem']) {
$jobout .= "(you don't have all the items you need to do this job) ";
}
}
$jobout .= "</td></tr></table>";
rawoutput($jobout);
}
output_notl("`n");
}
output_notl("`n");
}
if ($nostam) {
output("You have the brains to know that doing construction work when you're anything but wide awake is an idea so bad you're not even willing to entertain it.`n`n");
}
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:96,代码来源:lib.php