Hallo liebe Community, ich habe ein Problem mit nem Script.
Ich kann den Itemshop nicht richtig ausführen zwar sind da die kategorien jedoch kann ich die Item's die dort eingeteilt sind nicht sehen.
Bräuchte dringend Hilfe.
Ich kann den Itemshop nicht richtig ausführen zwar sind da die kategorien jedoch kann ich die Item's die dort eingeteilt sind nicht sehen.
Bräuchte dringend Hilfe.
<?php
class shop
{
public function listclass()
{
echo '<div class="sbsub_ui sbsubtop"></div>
<div class="sbsub_ui sbsubpost"> <div class="wrap">';
mysql::connect();
$query = "
SELECT *
FROM `player`.`shop_class`
ORDER BY `shop_class`.`classid` ASC
";
$exec = mysql_query($query);
while($row = mysql_fetch_assoc($exec))
{
($_GET['class'] == $row['classid'])?($active_style = 'text-decoration:underline; color:#fff;'):($active_style = '');
?>
<a href="?p=shop&class=<? echo $row['classid']; ?>" style="text-decoration:none;">
<? echo $row['classname']; ?></a>
<div class="sbborder"></div>
<?php
}
echo '
</div></div>
<div class="sb-ui sb-bt"></div>';
}
public function listitems()
{
mysql::connect();
$_GET['class'] == '' ? $class = 1 : $class = $_GET['class'];
$query = "
SELECT
`item_proto_shop`.`id`,
`item_proto_shop`.`vnum`,
`item_proto_shop`.`prices`,
`item_proto_shop`.`classid`,
`item_proto_shop`.`content`,
`item_proto_shop`.`count`,
`item_proto_shop`.`vprice`,
`item_proto_shop`.`venabled`,
`item_proto`.`locale_name` AS name,
`item_proto`.`size`
FROM `player`.`item_proto_shop`
LEFT JOIN `player`.`item_proto`
ON `item_proto`.`vnum` = `item_proto_shop`.`vnum`
WHERE `item_proto_shop`.`classid` = '".$class."'
ORDER BY `item_proto_shop`.`id` ASC";
$exec = mysql_query($query);
while($row = mysql_fetch_assoc($exec))
{
$id = $row['id'];
$vnum = $row['vnum'];
$price = $row['prices'];
$classid = $row['classid'];
$content = $row['content'];
$count = $row['count'];
$name = $row['name'];
$venabled = $row['venabled'];
?>
<div class="con_ui contop"><h2 style="cursor:pointer;"><? echo $row['name']; ?></h2></div>
<div class="con_ui conpost">
<div class="wrap">
<div style="float:left;">
<div style=" width:96px; height:100px; background-image:url(images/i_bg2.png); text-align:center;">
<div class="item_<? echo $row['size']; ?>">
<br>
<img src="images/item/<? echo $row['vnum']; ?>.PNG "/>
</div>
</div></div>
<div style="padding-left:25px; width:300px; float:left;">
<?
echo shop::item_info($row['vnum']);
if(!empty($row['content']))
echo 'Beschreibung: <br/>'.$row['content'];
?>
</div>
<div style="text-align:right; padding:15px; float:right; width:150px; vertical-align:center;">
Preis: <?php echo $row['prices']; ?> Coins<br>
Preis: <?php echo $row['vprice']; ?> VCoins
<br />
<br />
<?php if($venabled=="YES"):?>
<input type="submit" value="Kaufen" style = "position: relative;left: -155px;top: 51px;" class="small ishopbuy s1" id="<? echo $row['id']; ?>" />
<input type="submit" value="Kaufen V4C" class="small ishopbuy2 s1 v4c" id="<? echo $row['id']; ?>" />
<? else:?>
<input type="submit" value="Kaufen" class="small ishopbuy s1" id="<? echo $row['id']; ?>" />
<? endif; ?>
</div>
<div class="clear"></div>
</div>
</div>
<div class="con_ui conbt"></div>
<?
}
}
private function item_info($vnum)
{
$query = "
SELECT *
FROM `player`.`item_proto`
WHERE `item_proto`.`vnum` = '".$vnum."'
LIMIT 1
";
$exec = mysql_query($query);
$row = mysql_fetch_assoc($exec);
## Waffen
if($row['type'] == '1')
{
if($row['limittype0'] != 0)
$desc .= 'Level: '.$row['limitvalue0'].'<br/>';
if($row['limittype1'] != 0)
$desc .= 'Limit: '.m2_data::item_attr($row['limittype1']).' '.$row['limitvalue1'].'<br/>';
$desc .= 'Angriffswert '.($row['value3'] + $row['value5']).' - '.($row['value4'] + $row['value5']).' <br/>';
if($row['value1'] != 0 && $row['value2'] != 0)
$desc .= 'Magischer Angriffswert '.($row['value1'] + $row['value5']).' - '.($row['value2'] + $row['value5']).' <br/>';
if($row['applytype0'] != 0)
$desc .= m2_data::item_attr($row['applytype0']).' '.$row['applyvalue0'].'<br/>';
if($row['applytype1'] != 0)
$desc .= m2_data::item_attr($row['applytype1']).' '.$row['applyvalue1'].'<br/>';
if($row['applytype2'] != 0)
$desc .= m2_data::item_attr($row['applytype2']).' '.$row['applyvalue2'].'<br/>';
if($row['addon_type'] == -1 || $row['addon_type'] == '-1')
$desc .= 'Besitzt DSS und FKS<br/>';
$equipable[32] = 'Krieger, Ninja, Sura';
$equipable[288] = 'Krieger, Ninja, Sura';
$equipable[56] = 'Krieger';
$equipable[312] = 'Krieger';
$equipable[52] = 'Ninja';
$equipable[308] = 'Ninja';
$equipable[44] = 'Sura';
$equipable[300] = 'Sura';
$equipable[28] = 'Schamane';
$equipable[284] = 'Schamane';
$desc .= "<br>Ausrüstbar: " . $equipable[$row['antiflag']];
return $desc;
}
elseif($row['type'] == 2)
{
if($row['limittype0'] != 0)
$desc .= 'Level: '.$row['limitvalue0'].'<br/>';
if($row['limittype1'] != 0)
$desc .= 'Limit: '.m2_data::item_attr($row['limittype1']).' '.$row['limitvalue1'].'<br/>';
$desc .= 'Verteidigung '.($row['value1'] + $row['value5']).'<br/>';
if($row['applytype0'] != 0 && $row['applyvalue0'] != 0)
$desc .= m2_data::item_attr($row['applytype0']).' '.$row['applyvalue0'].'<br/>';
if($row['applytype1'] != 0 && $row['applyvalue1'] != 0)
$desc .= m2_data::item_attr($row['applytype1']).' '.$row['applyvalue1'].'<br/>';
if($row['applytype2'] != 0 && $row['applyvalue2'] != 0)
$desc .= m2_data::item_attr($row['applytype2']).' '.$row['applyvalue2'].'<br/>';
$equipable[0] = 'Alle Klassen';
$equipable[32] = 'Krieger, Ninja, Sura';
$equipable[288] = 'Krieger, Ninja, Sura';
$equipable[56] = 'Krieger';
$equipable[312] = 'Krieger';
$equipable[52] = 'Ninja';
$equipable[308] = 'Ninja';
$equipable[44] = 'Sura';
$equipable[300] = 'Sura';
$equipable[28] = 'Schamane';
$equipable[284] = 'Schamane';
$desc .= "<br>Ausrüstbar: " . $equipable[$row['antiflag']];
return $desc;
}
elseif($row['type'] == 10)
{
if($row['applytype0'] != 0 && $row['applyvalue0'] != 0)
$desc .= m2_data::item_attr($row['applytype0']).' '.$row['applyvalue0'].'%<br/>';
if($row['applytype1'] != 0 && $row['applyvalue1'] != 0)
$desc .= m2_data::item_attr($row['applytype1']).' '.$row['applyvalue1'].'%<br/>';
if($row['applytype2'] != 0 && $row['applyvalue2'] != 0)
$desc .= m2_data::item_attr($row['applytype2']).' '.$row['applyvalue2'].'%<br/>';
$equipable[16] = "Waffe";
$equipable[1] = "Rüstung";
$desc .= 'Gegenstand mit Fassung: '.$equipable[$row['wearflag']].'<br/>';
return $desc;
}
}
public function buyitem($getid)
{
(!isset($_GET['s']) || empty($_GET['s']) || $_GET['s'] == '' || $_GET['s'] > 2)?($server = 1):($server = $_GET['s']);
mysql::connect(1);
$query = "
SELECT
`item_proto_shop`.`vnum` AS itemid,
`item_proto_shop`.`prices`,
`item_proto_shop`.`classid`,
`item_proto_shop`.`content`,
`item_proto_shop`.`count`,
`item_proto_shop`.`vprice`,
`item_proto_shop`.`venabled`,
`item_proto`.`locale_name` AS name
FROM `player`.`item_proto_shop`
LEFT JOIN `player`.`item_proto`
ON `item_proto`.`vnum` = `item_proto_shop`.`vnum`
WHERE `item_proto_shop`.`id` = '".$getid."'
";
$exec = mysql_query($query)or die(mysql_error());
$iteminfo = mysql_fetch_array($exec);
$query = "
SELECT
`account`.`id`,
`account`.`coins`,
`account`.`vcoins`
FROM `account`.`account`
WHERE `account`.`login` = '".$_SESSION['USER']."'
";
$exec = mysql_query($query);
$row = mysql_fetch_array($exec);
################################################## ################################################## ##########
if($_GET['v4c']!="1"):
($row['coins'] < $iteminfo['prices'])?( $err .= '<div class="err">Du hast nicht genügend Coins, um diesen Gegenstand kaufen zu können.</div><br />'):("");
else:
if($iteminfo['venabled']=="YES"):
($row['vcoins'] < $iteminfo['vprice'])?( $err .= '<div class="err">Du hast nicht genügend VoteCoins, um diesen Gegenstand kaufen zu können.</div><br />'):("");
else:
$err .= '<div class="err">Du kannst dieses Item nicht mit gevoteten Coins kaufen.</div><br />';
endif;
endif;
if(empty($err))
{
$giventime = date("Y-m-d H:i:s", time());
mysql::connect($server);
$query = "
INSERT INTO `player`.`item_award` (pid, login, vnum, count, given_time, why, socket0, socket1, socket2, mall)
VALUES ('".$row['id']."', '".$_SESSION['USER']."', '".$iteminfo['itemid']."', '".$count."', '".$giventime."', 'SHOP', '1', '1', (SELECT `item_proto`.`value0` FROM `player`.`item_proto` WHERE `item_proto`.`vnum` = '".$iteminfo['itemid']."'), '1')
";
$exec = mysql_query($query);
mysql::connect(1);
if($_GET['v4c']!="1"):
$query = "
UPDATE `account`.`account`
SET `account`.`coins` = `account`.`coins` - ".$iteminfo['prices']."
WHERE `account`.`id` = '".$row['id']."'
";
else:
$query = "
UPDATE `account`.`account`
SET `account`.`vcoins` = `account`.`vcoins` - ".$iteminfo['vprice']."
WHERE `account`.`id` = '".$row['id']."'
";
endif;
$exec = mysql_query($query);
echo '
<div class="con_ui contop"><h2 style="cursor:pointer;">Kauf erfolgreich.</h2></div>
<div class="con_ui conpost">
<div class="wrap">
<p>Das Item '.$iteminfo['name'].' befindet sich nun in deinem Lager auf Server Tsuyoshi.</p>
<div class="clear"></div>
</div>
</div>
<div class="con_ui conbt"></div>
';
}
else
{
echo '<font color="#fff">'.$err.'</font>';
}
}
}
?>
class shop
{
public function listclass()
{
echo '<div class="sbsub_ui sbsubtop"></div>
<div class="sbsub_ui sbsubpost"> <div class="wrap">';
mysql::connect();
$query = "
SELECT *
FROM `player`.`shop_class`
ORDER BY `shop_class`.`classid` ASC
";
$exec = mysql_query($query);
while($row = mysql_fetch_assoc($exec))
{
($_GET['class'] == $row['classid'])?($active_style = 'text-decoration:underline; color:#fff;'):($active_style = '');
?>
<a href="?p=shop&class=<? echo $row['classid']; ?>" style="text-decoration:none;">
<? echo $row['classname']; ?></a>
<div class="sbborder"></div>
<?php
}
echo '
</div></div>
<div class="sb-ui sb-bt"></div>';
}
public function listitems()
{
mysql::connect();
$_GET['class'] == '' ? $class = 1 : $class = $_GET['class'];
$query = "
SELECT
`item_proto_shop`.`id`,
`item_proto_shop`.`vnum`,
`item_proto_shop`.`prices`,
`item_proto_shop`.`classid`,
`item_proto_shop`.`content`,
`item_proto_shop`.`count`,
`item_proto_shop`.`vprice`,
`item_proto_shop`.`venabled`,
`item_proto`.`locale_name` AS name,
`item_proto`.`size`
FROM `player`.`item_proto_shop`
LEFT JOIN `player`.`item_proto`
ON `item_proto`.`vnum` = `item_proto_shop`.`vnum`
WHERE `item_proto_shop`.`classid` = '".$class."'
ORDER BY `item_proto_shop`.`id` ASC";
$exec = mysql_query($query);
while($row = mysql_fetch_assoc($exec))
{
$id = $row['id'];
$vnum = $row['vnum'];
$price = $row['prices'];
$classid = $row['classid'];
$content = $row['content'];
$count = $row['count'];
$name = $row['name'];
$venabled = $row['venabled'];
?>
<div class="con_ui contop"><h2 style="cursor:pointer;"><? echo $row['name']; ?></h2></div>
<div class="con_ui conpost">
<div class="wrap">
<div style="float:left;">
<div style=" width:96px; height:100px; background-image:url(images/i_bg2.png); text-align:center;">
<div class="item_<? echo $row['size']; ?>">
<br>
<img src="images/item/<? echo $row['vnum']; ?>.PNG "/>
</div>
</div></div>
<div style="padding-left:25px; width:300px; float:left;">
<?
echo shop::item_info($row['vnum']);
if(!empty($row['content']))
echo 'Beschreibung: <br/>'.$row['content'];
?>
</div>
<div style="text-align:right; padding:15px; float:right; width:150px; vertical-align:center;">
Preis: <?php echo $row['prices']; ?> Coins<br>
Preis: <?php echo $row['vprice']; ?> VCoins
<br />
<br />
<?php if($venabled=="YES"):?>
<input type="submit" value="Kaufen" style = "position: relative;left: -155px;top: 51px;" class="small ishopbuy s1" id="<? echo $row['id']; ?>" />
<input type="submit" value="Kaufen V4C" class="small ishopbuy2 s1 v4c" id="<? echo $row['id']; ?>" />
<? else:?>
<input type="submit" value="Kaufen" class="small ishopbuy s1" id="<? echo $row['id']; ?>" />
<? endif; ?>
</div>
<div class="clear"></div>
</div>
</div>
<div class="con_ui conbt"></div>
<?
}
}
private function item_info($vnum)
{
$query = "
SELECT *
FROM `player`.`item_proto`
WHERE `item_proto`.`vnum` = '".$vnum."'
LIMIT 1
";
$exec = mysql_query($query);
$row = mysql_fetch_assoc($exec);
## Waffen
if($row['type'] == '1')
{
if($row['limittype0'] != 0)
$desc .= 'Level: '.$row['limitvalue0'].'<br/>';
if($row['limittype1'] != 0)
$desc .= 'Limit: '.m2_data::item_attr($row['limittype1']).' '.$row['limitvalue1'].'<br/>';
$desc .= 'Angriffswert '.($row['value3'] + $row['value5']).' - '.($row['value4'] + $row['value5']).' <br/>';
if($row['value1'] != 0 && $row['value2'] != 0)
$desc .= 'Magischer Angriffswert '.($row['value1'] + $row['value5']).' - '.($row['value2'] + $row['value5']).' <br/>';
if($row['applytype0'] != 0)
$desc .= m2_data::item_attr($row['applytype0']).' '.$row['applyvalue0'].'<br/>';
if($row['applytype1'] != 0)
$desc .= m2_data::item_attr($row['applytype1']).' '.$row['applyvalue1'].'<br/>';
if($row['applytype2'] != 0)
$desc .= m2_data::item_attr($row['applytype2']).' '.$row['applyvalue2'].'<br/>';
if($row['addon_type'] == -1 || $row['addon_type'] == '-1')
$desc .= 'Besitzt DSS und FKS<br/>';
$equipable[32] = 'Krieger, Ninja, Sura';
$equipable[288] = 'Krieger, Ninja, Sura';
$equipable[56] = 'Krieger';
$equipable[312] = 'Krieger';
$equipable[52] = 'Ninja';
$equipable[308] = 'Ninja';
$equipable[44] = 'Sura';
$equipable[300] = 'Sura';
$equipable[28] = 'Schamane';
$equipable[284] = 'Schamane';
$desc .= "<br>Ausrüstbar: " . $equipable[$row['antiflag']];
return $desc;
}
elseif($row['type'] == 2)
{
if($row['limittype0'] != 0)
$desc .= 'Level: '.$row['limitvalue0'].'<br/>';
if($row['limittype1'] != 0)
$desc .= 'Limit: '.m2_data::item_attr($row['limittype1']).' '.$row['limitvalue1'].'<br/>';
$desc .= 'Verteidigung '.($row['value1'] + $row['value5']).'<br/>';
if($row['applytype0'] != 0 && $row['applyvalue0'] != 0)
$desc .= m2_data::item_attr($row['applytype0']).' '.$row['applyvalue0'].'<br/>';
if($row['applytype1'] != 0 && $row['applyvalue1'] != 0)
$desc .= m2_data::item_attr($row['applytype1']).' '.$row['applyvalue1'].'<br/>';
if($row['applytype2'] != 0 && $row['applyvalue2'] != 0)
$desc .= m2_data::item_attr($row['applytype2']).' '.$row['applyvalue2'].'<br/>';
$equipable[0] = 'Alle Klassen';
$equipable[32] = 'Krieger, Ninja, Sura';
$equipable[288] = 'Krieger, Ninja, Sura';
$equipable[56] = 'Krieger';
$equipable[312] = 'Krieger';
$equipable[52] = 'Ninja';
$equipable[308] = 'Ninja';
$equipable[44] = 'Sura';
$equipable[300] = 'Sura';
$equipable[28] = 'Schamane';
$equipable[284] = 'Schamane';
$desc .= "<br>Ausrüstbar: " . $equipable[$row['antiflag']];
return $desc;
}
elseif($row['type'] == 10)
{
if($row['applytype0'] != 0 && $row['applyvalue0'] != 0)
$desc .= m2_data::item_attr($row['applytype0']).' '.$row['applyvalue0'].'%<br/>';
if($row['applytype1'] != 0 && $row['applyvalue1'] != 0)
$desc .= m2_data::item_attr($row['applytype1']).' '.$row['applyvalue1'].'%<br/>';
if($row['applytype2'] != 0 && $row['applyvalue2'] != 0)
$desc .= m2_data::item_attr($row['applytype2']).' '.$row['applyvalue2'].'%<br/>';
$equipable[16] = "Waffe";
$equipable[1] = "Rüstung";
$desc .= 'Gegenstand mit Fassung: '.$equipable[$row['wearflag']].'<br/>';
return $desc;
}
}
public function buyitem($getid)
{
(!isset($_GET['s']) || empty($_GET['s']) || $_GET['s'] == '' || $_GET['s'] > 2)?($server = 1):($server = $_GET['s']);
mysql::connect(1);
$query = "
SELECT
`item_proto_shop`.`vnum` AS itemid,
`item_proto_shop`.`prices`,
`item_proto_shop`.`classid`,
`item_proto_shop`.`content`,
`item_proto_shop`.`count`,
`item_proto_shop`.`vprice`,
`item_proto_shop`.`venabled`,
`item_proto`.`locale_name` AS name
FROM `player`.`item_proto_shop`
LEFT JOIN `player`.`item_proto`
ON `item_proto`.`vnum` = `item_proto_shop`.`vnum`
WHERE `item_proto_shop`.`id` = '".$getid."'
";
$exec = mysql_query($query)or die(mysql_error());
$iteminfo = mysql_fetch_array($exec);
$query = "
SELECT
`account`.`id`,
`account`.`coins`,
`account`.`vcoins`
FROM `account`.`account`
WHERE `account`.`login` = '".$_SESSION['USER']."'
";
$exec = mysql_query($query);
$row = mysql_fetch_array($exec);
################################################## ################################################## ##########
if($_GET['v4c']!="1"):
($row['coins'] < $iteminfo['prices'])?( $err .= '<div class="err">Du hast nicht genügend Coins, um diesen Gegenstand kaufen zu können.</div><br />'):("");
else:
if($iteminfo['venabled']=="YES"):
($row['vcoins'] < $iteminfo['vprice'])?( $err .= '<div class="err">Du hast nicht genügend VoteCoins, um diesen Gegenstand kaufen zu können.</div><br />'):("");
else:
$err .= '<div class="err">Du kannst dieses Item nicht mit gevoteten Coins kaufen.</div><br />';
endif;
endif;
if(empty($err))
{
$giventime = date("Y-m-d H:i:s", time());
mysql::connect($server);
$query = "
INSERT INTO `player`.`item_award` (pid, login, vnum, count, given_time, why, socket0, socket1, socket2, mall)
VALUES ('".$row['id']."', '".$_SESSION['USER']."', '".$iteminfo['itemid']."', '".$count."', '".$giventime."', 'SHOP', '1', '1', (SELECT `item_proto`.`value0` FROM `player`.`item_proto` WHERE `item_proto`.`vnum` = '".$iteminfo['itemid']."'), '1')
";
$exec = mysql_query($query);
mysql::connect(1);
if($_GET['v4c']!="1"):
$query = "
UPDATE `account`.`account`
SET `account`.`coins` = `account`.`coins` - ".$iteminfo['prices']."
WHERE `account`.`id` = '".$row['id']."'
";
else:
$query = "
UPDATE `account`.`account`
SET `account`.`vcoins` = `account`.`vcoins` - ".$iteminfo['vprice']."
WHERE `account`.`id` = '".$row['id']."'
";
endif;
$exec = mysql_query($query);
echo '
<div class="con_ui contop"><h2 style="cursor:pointer;">Kauf erfolgreich.</h2></div>
<div class="con_ui conpost">
<div class="wrap">
<p>Das Item '.$iteminfo['name'].' befindet sich nun in deinem Lager auf Server Tsuyoshi.</p>
<div class="clear"></div>
</div>
</div>
<div class="con_ui conbt"></div>
';
}
else
{
echo '<font color="#fff">'.$err.'</font>';
}
}
}
?>