mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Implement Stores
This commit is contained in:
parent
363e18ae8c
commit
b898983778
4 changed files with 120 additions and 127 deletions
|
@ -112,6 +112,7 @@ namespace HISP.Player
|
|||
|
||||
public void TakeMoney(int amount)
|
||||
{
|
||||
int money = Money;
|
||||
money -= amount;
|
||||
Database.SetPlayerMoney(money, Id);
|
||||
GameServer.UpdatePlayer(LoggedinClient);
|
||||
|
@ -119,6 +120,7 @@ namespace HISP.Player
|
|||
|
||||
public void AddMoney(int amount)
|
||||
{
|
||||
int money = Money;
|
||||
try
|
||||
{
|
||||
checked
|
||||
|
@ -278,7 +280,7 @@ namespace HISP.Player
|
|||
{
|
||||
get
|
||||
{
|
||||
return money;
|
||||
return Database.GetPlayerMoney(Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,7 +442,6 @@ namespace HISP.Player
|
|||
private int x;
|
||||
private bool stealth = false;
|
||||
private int y;
|
||||
private int money;
|
||||
private int questPoints;
|
||||
private double bankMoney;
|
||||
private int experience;
|
||||
|
@ -541,7 +542,7 @@ namespace HISP.Player
|
|||
|
||||
Facing = PacketBuilder.DIRECTION_DOWN;
|
||||
experience = Database.GetExperience(UserId);
|
||||
money = Database.GetPlayerMoney(UserId);
|
||||
//money = Database.GetPlayerMoney(UserId);
|
||||
bankMoney = Database.GetPlayerBankMoney(UserId);
|
||||
questPoints = Database.GetPlayerQuestPoints(UserId);
|
||||
subscribed = Database.IsUserSubscribed(UserId);
|
||||
|
|
|
@ -653,8 +653,8 @@ namespace HISP.Server
|
|||
while (reader.Read())
|
||||
{
|
||||
Item.ItemPurchaseQueueItem itm = new Item.ItemPurchaseQueueItem();
|
||||
itm.ItemId = reader.GetInt32(0);
|
||||
itm.ItemCount = reader.GetInt32(1);
|
||||
itm.ItemId = reader.GetInt32(1);
|
||||
itm.ItemCount = reader.GetInt32(2);
|
||||
queueItems.Add(itm);
|
||||
}
|
||||
sqlCommand.Dispose();
|
||||
|
|
|
@ -3609,7 +3609,7 @@ namespace HISP.Server
|
|||
Item.ItemPurchaseQueueItem[] queueItems = Database.GetItemPurchaseQueue(sender.LoggedinUser.Id);
|
||||
foreach (Item.ItemPurchaseQueueItem queueItem in queueItems)
|
||||
{
|
||||
for(int i = 0; i < queueItems.Length; i++)
|
||||
for(int i = 0; i < queueItem.ItemCount; i++)
|
||||
{
|
||||
sender.LoggedinUser.Inventory.AddIgnoringFull(new ItemInstance(queueItem.ItemId));
|
||||
}
|
||||
|
|
|
@ -23,138 +23,130 @@ if(isset($_GET["go"], $_GET["qnt"], $_GET["itm"], $_GET["ret"]))
|
|||
{
|
||||
if($_GET["go"] == 1)
|
||||
{
|
||||
$itm = $_GET["itm"];
|
||||
|
||||
if(isUserOnline($dbname, $_SESSION['PLAYER_ID']))
|
||||
if(strpos($itm, "One Month Horse Isle Membership") === 0){
|
||||
$amount = 5; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
setUserSubbed($dbname, $_SESSION['PLAYER_ID'], true);
|
||||
setUserSubbedUntil($dbname, $_SESSION['PLAYER_ID'], $subbedUntil + 2678400);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Please log off the server first!");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
}
|
||||
|
||||
$itm = $_GET["itm"];
|
||||
|
||||
if(strpos($itm, "One Month Horse Isle Membership") === 0){
|
||||
$amount = 5; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
setUserSubbed($dbname, $_SESSION['PLAYER_ID'], true);
|
||||
setUserSubbedUntil($dbname, $_SESSION['PLAYER_ID'], $subbedUntil + 2678400);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
else if(strpos($itm, "Full Year Horse Isle Membership") === 0){
|
||||
$amount = 40; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
setUserSubbed($dbname, $_SESSION['PLAYER_ID'], true);
|
||||
setUserSubbedUntil($dbname, $_SESSION['PLAYER_ID'], $subbedUntil + 31622400);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(strpos($itm, "Full Year Horse Isle Membership") === 0){
|
||||
$amount = 40; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
setUserSubbed($dbname, $_SESSION['PLAYER_ID'], true);
|
||||
setUserSubbedUntil($dbname, $_SESSION['PLAYER_ID'], $subbedUntil + 31622400);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else if(strpos($itm, "100k Horse Isle Money") === 0){ // Why thou?
|
||||
$amount = 1; // NO CHEATING!
|
||||
$quantity = intval($_GET["qnt"]);
|
||||
$cost = ($amount*$EXHANGE_RATE)*$quantity;
|
||||
if($money >= $cost)
|
||||
{
|
||||
$amountGained = (100000 * $quantity);
|
||||
if($quantity == 5)
|
||||
$amountGained = 550000;
|
||||
if($quantity == 10)
|
||||
$amountGained = 1100000;
|
||||
if($quantity == 10)
|
||||
$amountGained = 1100000;
|
||||
if($quantity == 20)
|
||||
$amountGained = 2300000;
|
||||
if($quantity == 50)
|
||||
$amountGained = 5750000;
|
||||
if($quantity == 100)
|
||||
$amountGained = 12000000;
|
||||
if($quantity == 250)
|
||||
$amountGained = 31250000;
|
||||
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
$money-=$cost;
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money+=$amountGained);
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
else if(strpos($itm, "Pawneer Order") === 0){
|
||||
$amount = 8; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
addItemToPuchaseQueue($dbname, $_SESSION['PLAYER_ID'], 559, 1);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(strpos($itm, "Five Pawneer Order") === 0){
|
||||
$amount = 30; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
addItemToPuchaseQueue($dbname, $_SESSION['PLAYER_ID'], 559, 5);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
else if(strpos($itm, "100k Horse Isle Money") === 0){ // Why thou?
|
||||
$amount = 1; // NO CHEATING!
|
||||
$quantity = intval($_GET["qnt"]);
|
||||
$cost = ($amount*$EXHANGE_RATE)*$quantity;
|
||||
if($money >= $cost)
|
||||
{
|
||||
$amountGained = (100000 * $quantity);
|
||||
if($quantity == 5)
|
||||
$amountGained = 550000;
|
||||
if($quantity == 10)
|
||||
$amountGained = 1100000;
|
||||
if($quantity == 10)
|
||||
$amountGained = 1100000;
|
||||
if($quantity == 20)
|
||||
$amountGained = 2300000;
|
||||
if($quantity == 50)
|
||||
$amountGained = 5750000;
|
||||
if($quantity == 100)
|
||||
$amountGained = 12000000;
|
||||
if($quantity == 250)
|
||||
$amountGained = 31250000;
|
||||
|
||||
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
$money-=$cost;
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money+=$amountGained);
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(strpos($itm, "Pawneer Order") === 0){
|
||||
$amount = 8; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
addItemToPuchaseQueue($dbname, $_SESSION['PLAYER_ID'], 559, 1);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(strpos($itm, "Five Pawneer Order") === 0){
|
||||
$amount = 30; // NO CHEATING!
|
||||
$cost = $amount*$EXHANGE_RATE;
|
||||
if($money >= $cost)
|
||||
{
|
||||
setUserMoney($dbname, $_SESSION['PLAYER_ID'], $money-$cost);
|
||||
addItemToPuchaseQueue($dbname, $_SESSION['PLAYER_ID'], 559, 5);
|
||||
|
||||
header("Location: ".$_GET["ret"]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
include("header.php");
|
||||
echo("Not enough money.");
|
||||
include("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue