This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcompletescavenger.php
107 lines (52 loc) · 2.16 KB
/
completescavenger.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
session_name("icsession");
session_start();
include('db.php');
$whom = ucwords(strtolower($_POST['whom']));
$getchar = mysql_query("SELECT * FROM characters WHERE id='".$_SESSION['userid']."'")or die("Not logged in!");
$char = mysql_fetch_assoc($getchar);
$data = "";
if(isset($_POST['adventureid'])){
$findAdventureInQuestion = mysql_query("SELECT * FROM scavenger WHERE id='".$_POST['adventureid']."' AND username='".$char['username']."'")or die("alert(\'Problem finding adventure!\');");
$adventure = mysql_fetch_assoc($findAdventureInQuestion);
$complete = explode("/", $adventure['complete']);
if($complete[0] == $complete[1]){
if($char['username'] == $adventure['username']){
$reward = rand(1,4);
if($reward >= "1"){
$goldRand = rand(200,5000);
$gold = $adventure['level'] * $goldRand;
$data .= "-You gain ".number_format($gold)." Gold!<br />";
mysql_query("UPDATE characters SET gold=gold+'".$gold."' WHERE username='".$adventure['username']."'");
}
if($reward <= "2"){
$sp = $adventure['level'];
$data .= "-You gain ".number_format($sp)." Stat Points!<br />";
mysql_query("UPDATE characters SET stats=stats+'".$sp."' WHERE username='".$adventure['username']."'");
}
if($reward <= "3"){
$blood = $adventure['level'] * 10;
$data .= "-You gain ".number_format($blood)." Blood!<br />";
mysql_query("UPDATE characters SET blood=blood+'".$blood."' WHERE username='".$adventure['username']."'");
}
if($reward <= "4"){
$cashRand = rand(1,30);
if($cashRand == "1"){
$data .= "-You gain Cash!<br />";
mysql_query("UPDATE characters SET cash=cash+'1' WHERE username='".$adventure['username']."'");
}
}
mysql_query("DELETE FROM scavenger WHERE id='".$adventure['id']."'");
mysql_query("UPDATE characters SET scavenges=scavenges+'1' WHERE username='".$char['username']."'");
}else{
$data .= "This is not your adventure.<br />";
}
}else{
$data .= "You must complete the adventure first!<br />";
}
}else{
$data .= "Unable to find this fake adventure your have created.";
}
print("fillDiv('displayArea','".$data."');");
include('updatestats.php');
?>