SMF Shop
SMFShop => Items => Topic started by: GhostWriter on March 21, 2007, 09:18:41 pm
-
I don't know if this could be done or not and I wouldn't know how to do it, so I guess I am making a request.
Everyone likes to play cards, how about an item for the shop that would work at random, though you wouldn't have 52 cards perhaps it would only consist of
King- Would give money
Queen-Would give Karma
Jack-Would give post count
Ace-Would give cash and karma
Joker-Would take everything away (Cash,. Karma, Post Count)
SOmething along those lines. Basically I think it would work where you would purchase the cards which as I said would be random and which ever one you get would give you the items or take from you. Don't know how interesting this would be,but I think on a fun forum this could work out well...
-
are you saying that when you use teh item, it give me that say "gives money"
why would you need the card interface?
is there a game?
-
I just thought it would be cool to have the card interface. What I thought would be cool but would probably be alot to code, would be perhaps when you buy the item "perhaps calling 21" you got an amount of money or karma or something depending on how much you wager if you lose that is what you lose.
I just though having the cards like joker would be cool, you get that and you lose everything...
-
<?php
if (!defined('SMF'))
die('Hacking attempt...');
class item_Cards extends itemTemplate
{
function getItemDetails()
{
$this->authorName = 'Inkstains';
$this->authorWeb = '';
$this->authorEmail = '';
$this->name = 'Cards';
$this->desc = 'Try your luck and win. Karma, Credits and more up for grabs, but dont cry if you get burnt.';
$this->price = 100;
$this->require_input = true;
$this->can_use_item = true;
$this->addInput_editable = true;
}
function getAddInput()
{
global $item_info, $db_prefix;
return '
Maximum amount to increase/decrease post count by: <input type="text" name="info1" value="' . $item_info[1] . '" /><br />
Maximum amount to increase/decrease credits by: <input type="text" name="info2" value="' . $item_info[2] . '" /><br />
Maximum amount to increase/decrease karma by: <input type="text" name="info3" value="' . $item_info[3] . '" /><br />
Maximum amount to increase/decrease time online by: <input type="text" name="info4" value="' . $item_info[4] . '" /><br />';
}
function onUse()
{
global $db_prefix, $ID_MEMBER, $item_info;
$value = mt_rand(1, 8);
if ($value == 1) {
$value1 = mt_rand(1, $item_info[1]);
$result = db_query("UPDATE {$db_prefix}members SET posts = posts + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got an Ace and increased your post count by ". ($value1) ."";
}
elseif ($value == 2) {
$value1 = mt_rand(1, $item_info[2]);
$result = db_query("UPDATE {$db_prefix}members SET money = money + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a King and gained ". formatMoney($value1) ."";
}
elseif ($value == 3) {
$value1 = mt_rand(1, $item_info[3]);
$result = db_query("UPDATE {$db_prefix}members SET karmaGood = karmaGood + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a Queen and increased you karma by ". ($value1) ."";
}
elseif ($value == 4) {
$value1 = mt_rand(1, $item_info[4]);
$result = db_query("UPDATE {$db_prefix}members SET totalTimeLoggedIn = totalTimeLoggedIn + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a Jack and increased your time online by ". ($value1) ."";
}
elseif ($value == 5) {
$value1 = mt_rand(1, $item_info[1]);
$result = db_query("UPDATE {$db_prefix}members SET posts = posts - {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a Joker!! and decreased your post count by ". ($value1) ."";
}
elseif ($value == 6) {
$value1 = mt_rand(1, $item_info[2]);
$result = db_query("UPDATE {$db_prefix}members SET money = money - {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a Joker!! and lost ". formatMoney($value1) ."";
}
elseif ($value == 7) {
$value1 = mt_rand(1, $item_info[3]);
$result = db_query("UPDATE {$db_prefix}members SET karmaBad = karmaBad + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a Joker!! and decreased your karma by ". ($value1) ."";
}
elseif ($value == 8) {
$value1 = mt_rand(1, $item_info[4]);
$result = db_query("UPDATE {$db_prefix}members SET totalTimeLoggedIn = totalTimeLoggedIn - {$value1} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You got a Joker!! and decreased your time online by ". ($value1) ."";
}
}
}
?>
I haven't added the card images or anything yet but that's the basis of it
EDIT: i'm still fairly new to php so this is just my version of how i think it would work. and it does what it needs to.
-
That is awesome, looks better then anything I could have done, especially since I don't know php. I think this will be so cool. I can't wait till it is all complete and I add it, I think my members and members of other forums will enjoy the way it works. Good job inkstains.
-
check this thread GhostWriter
http://www.daniel15.com/forum/index.php/topic,709.0.html