-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpvp.php
130 lines (120 loc) · 3.68 KB
/
pvp.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
// translator ready
// addnews ready
// mail ready
require_once("common.php");
require_once("lib/fightnav.php");
require_once("lib/pvpwarning.php");
require_once("lib/pvplist.php");
require_once("lib/pvpsupport.php");
require_once("lib/http.php");
require_once("lib/taunt.php");
require_once("lib/villagenav.php");
tlschema("pvp");
$iname = getsetting("innname", LOCATION_INN);
$battle = false;
page_header("PvP Combat!");
$op = httpget('op');
$act = httpget('act');
if ($op=="" && $act!="attack"){
checkday();
pvpwarning();
$args = array(
'atkmsg'=> '`4You head out to the fields, where you know some unwitting warriors are sleeping.`n`nYou have `^%s`4 PvP fights left for today.`n`n',
'schemas'=>array('atkmsg'=>'pvp')
);
$args = modulehook("pvpstart", $args);
tlschema($args['schemas']['atkmsg']);
output($args['atkmsg'], $session['user']['playerfights']);
tlschema();
addnav("L?Refresh List of Warriors","pvp.php");
pvplist();
villagenav();
} else if ($act == "attack") {
$name = httpget('name');
$badguy = setup_target($name);
$options['type'] = "pvp";
$failedattack = false;
if ($badguy === false) {
$failedattack = true;
} else {
$battle=true;
if ($badguy['location']==$iname) {
$badguy['bodyguardlevel']=$badguy['boughtroomtoday'];
}
$attackstack['enemies'][0] = $badguy;
$attackstack['options'] = $options;
$session['user']['badguy']=createstring($attackstack);
//debug($session['user']['badguy']);
$session['user']['playerfights']--;
}
if ($failedattack){
if (httpget('inn') > ""){
addnav("Return to Listing","inn.php?op=bartender&act=listupstairs");
}else{
addnav("Return to Listing","pvp.php");
}
}
}
if ($op=="run"){
output("Your pride prevents you from running");
$op="fight";
httpset('op', $op);
}
$skill = httpget('skill');
if ($skill!=""){
output("Your honor prevents you from using any special ability");
$skill="";
httpset('skill', $skill);
}
if ($op=="fight" || $op=="run"){
$battle=true;
}
if ($battle){
require_once("battle.php");
if ($victory){
$killedin = $badguy['location'];
$handled = pvpvictory($badguy, $killedin, $options);
// Handled will be true if a module has already done the addnews or
// whatever was needed.
if (!$handled) {
if ($killedin==$iname){
addnews("`4%s`3 defeated `4%s`3 by sneaking into their room in the inn!",$session['user']['name'],$badguy['creaturename']);
}else{
addnews("`4%s`3 defeated `4%s`3 in fair combat in the fields of %s.", $session['user']['name'],$badguy['creaturename'], $killedin);
}
}
$op = "";
httpset('op', $op);
if ($killedin==$iname){
addnav("Return to the inn","inn.php");
} else {
villagenav();
}
if ($session['user']['hitpoints'] <= 0) {
output("`n`n`&Using a bit of cloth nearby, you manage to staunch your wounds so that you do not die as well.");
$session['user']['hitpoints'] = 1;
}
}elseif($defeat){
$killedin = $badguy['location'];
$taunt = select_taunt_array();
// This is okay because system mail which is all it's used for is
// not translated
$handled = pvpdefeat($badguy, $killedin, $taunt, $options);
// Handled will be true if a module has already done the addnews or
// whatever was needed.
if (!$handled) {
if ($killedin == $iname) {
addnews("`%%s`5 has been slain while breaking into the inn room of `^%s`5 in order to attack them.`n%s`0", $session['user']['name'], $badguy['creaturename'], $taunt);
}else {
addnews("`%%s`5 has been slain while attacking `^%s`5 in the fields of `&%s`5.`n%s`0", $session['user']['name'], $badguy['creaturename'], $killedin, $taunt);
}
}
}else{
$extra = "";
if (httpget('inn')) $extra = "?inn=1";
fightnav(false,false, "pvp.php$extra");
}
}
page_footer();
?>