ADR2 is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

/
 
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<?php
/***************************************************************************
 *                    adr_character_equipment.php
 *                ------------------------
 *    begin             : 28/03/2004
 *    copyright        : Malicious Rabbit / Dr DLP
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/

define('IN_PHPBB', true);
define('IN_ADR_SHOPS', true);
define('IN_ADR_CHARACTER', true);
define('IN_ADR_BATTLE', true);
define('IN_ADR_EQUIPMENT', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$loc = 'character';
$sub_loc = 'adr_character_equipment';

//
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management
//

include($phpbb_root_path . 'adr/includes/adr_global.'.$phpEx);

$user_id = $userdata['user_id'];

// Sorry , only logged users ...
if ( !$userdata['session_logged_in'] )
{
    $redirect = "adr_character_inventory.$phpEx";
    $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : '';
    header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

if ( (!( isset($HTTP_POST_VARS[POST_USERS_URL]) || isset($HTTP_GET_VARS[POST_USERS_URL]))) || ( empty($HTTP_POST_VARS[POST_USERS_URL]) && empty($HTTP_GET_VARS[POST_USERS_URL])))
{
    $view_userdata = $userdata;
}
else
{
    $view_userdata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
}
$searchid = $view_userdata['user_id'];


// Get the general config
$adr_general = adr_get_general_config();

adr_enable_check();
adr_ban_check($user_id);
adr_character_created_check($user_id);

// See if the user has ever created a character or no
$char = adr_get_user_infos($searchid);

// Deny access if user is imprisioned
if($userdata['user_cell_time']){
    adr_previous(Adr_shops_no_thief, adr_cell, '');}

$equip_armor = $char['equip_armor'];
$equip_buckler = $char['equip_buckler'];
$equip_helm = $char['equip_helm'];
$equip_gloves = $char['equip_gloves'];
$equip_amulet = $char['equip_amulet'];
$equip_ring = $char['equip_ring'];

adr_template_file('adr_equipment_body.tpl');

$submit = isset($HTTP_POST_VARS['equip']);

if ( $submit && ( $user_id == $searchid ) )
{
    $armor = intval($HTTP_POST_VARS['item_armor']);
    $buckler = intval($HTTP_POST_VARS['item_buckler']);
    $helm = intval($HTTP_POST_VARS['item_helm']);
    $gloves = intval($HTTP_POST_VARS['item_gloves']);
    $amulet = intval($HTTP_POST_VARS['item_amulet']);
    $ring = intval($HTTP_POST_VARS['item_ring']);

    $sql = " UPDATE " . ADR_CHARACTERS_TABLE . "
        SET equip_armor = $armor,
            equip_buckler = $buckler,
            equip_helm = $helm,
            equip_gloves = $gloves,
            equip_amulet = $amulet,
            equip_ring = $ring
        WHERE character_id = $user_id ";
    if( !($result = $db->sql_query($sql)) )
    {
        message_die(GENERAL_ERROR, 'Could not update equipment', '', __LINE__, __FILE__, $sql);
    }

    adr_previous( Adr_equip_done , adr_character_equipment , '' );
}

if ( $user_id == $searchid )
{
    $template->assign_block_vars('owner',array());

    ### START restriction checks ###
    $item_sql = adr_make_restrict_sql($char);
    ### END restriction checks ###

    // First select the available items
    $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "
        WHERE item_in_shop = 0
        AND item_duration > 0
        AND item_in_warehouse = 0
        $item_sql
        AND item_owner_id = $user_id ";
    if( !($result = $db->sql_query($sql)) )
    {
        message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
    }
    $items = $db->sql_fetchrowset($result);

    // Prepare the items list
    $armor_list = '<select name="item_armor">';
    $armor_list .= '<option value = "0" >' . $lang['Adr_battle_no_armor'] . '</option>';
    $buckler_list = '<select name="item_buckler">';
    $buckler_list .= '<option value = "0" >' . $lang['Adr_battle_no_buckler'] . '</option>';
    $helm_list = '<select name="item_helm">';
    $helm_list .= '<option value = "0" >' . $lang['Adr_battle_no_helm'] . '</option>';
    $gloves_list = '<select name="item_gloves">';
    $gloves_list .= '<option value = "0" >' . $lang['Adr_battle_no_gloves'] . '</option>';
    $amulet_list = '<select name="item_amulet">';
    $amulet_list .= '<option value = "0" >' . $lang['Adr_battle_no_amulet'] . '</option>';
    $ring_list = '<select name="item_ring">';
    $ring_list .= '<option value = "0" >' . $lang['Adr_battle_no_ring'] . '</option>';

    for ( $i = 0 ; $i < count($items) ; $i ++ )
    {
        $item_power = $items[$i]['item_power'] + $items[$i]['item_add_power'];

        if ( $items[$i]['item_type_use'] == 7 )
        {
            $armor_selected = ( $equip_armor == $items[$i]['item_id'] ) ? 'selected' : '';
            $armor_list .= '<option value = "'.$items[$i]['item_id'].'" '.$armor_selected.' >' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )'.'</option>';
        }
        if ( $items[$i]['item_type_use'] == 8 )
        {
            $buckler_selected = ( $equip_buckler == $items[$i]['item_id'] ) ? 'selected' : '';
            $buckler_list .= '<option value = "'.$items[$i]['item_id'].'" '.$buckler_selected.'>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )'.'</option>';
        }
        if ( $items[$i]['item_type_use'] == 9 )
        {
            $helm_selected = ( $equip_helm == $items[$i]['item_id'] ) ? 'selected' : '';
            $helm_list .= '<option value = "'.$items[$i]['item_id'].'" '.$helm_selected.'>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )'.'</option>';
        }
        if ( $items[$i]['item_type_use'] == 10 )
        {
            $gloves_selected = ( $equip_gloves == $items[$i]['item_id'] ) ? 'selected' : '';
            $gloves_list .= '<option value = "'.$items[$i]['item_id'].'" '.$gloves_selected.'>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )'.'</option>';
        }
        if ( $items[$i]['item_type_use'] == 13 )
        {
            $amulet_selected = ( $equip_amulet == $items[$i]['item_id'] ) ? 'selected' : '';
            $amulet_list .= '<option value = "'.$items[$i]['item_id'].'" '.$amulet_selected.'>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )'.'</option>';
        }
        if ( $items[$i]['item_type_use'] == 14 )
        {
            $ring_selected = ( $equip_ring == $items[$i]['item_id'] ) ? 'selected' : '';
            $ring_list .= '<option value = "'.$items[$i]['item_id'].'" '.$ring_selected.'>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )'.'</option>';
        }
    }

    $armor_list .= '</select>';
    $buckler_list .= '</select>';
    $helm_list .= '</select>';
    $gloves_list .= '</select>';
    $amulet_list .= '</select>';
    $ring_list .= '</select>';

    $equip_title = $lang['Adr_equip_title'];
    $equip_larmor = $lang['Adr_battle_select_armor'];
    $equip_lbuckler = $lang['Adr_battle_select_buckler'];
    $equip_lhelm = $lang['Adr_battle_select_helm'];
    $equip_lgloves = $lang['Adr_battle_select_gloves'];
    $equip_lamulet = $lang['Adr_battle_select_amulet'];
    $equip_lring = $lang['Adr_battle_select_ring'];

}

else
{
    $template->assign_block_vars('see',array());

    $equip_title = sprintf($lang['Adr_equip_title_of'],$char['character_name']);
    $equip_larmor = $lang['Adr_equip_armor'];
    $equip_lbuckler = $lang['Adr_equip_buckler'];
    $equip_lhelm = $lang['Adr_equip_helm'];
    $equip_lgloves = $lang['Adr_equip_gloves'];
    $equip_lamulet = $lang['Adr_equip_amulet'];
    $equip_lring = $lang['Adr_equip_ring'];

    $armor_list = $lang['Adr_battle_no_armor'];
    $buckler_list = $lang['Adr_battle_no_buckler'];
    $helm_list = $lang['Adr_battle_no_helm'];
    $gloves_list = $lang['Adr_battle_no_gloves'];
    $amulet_list = $lang['Adr_battle_no_amulet'];
    $ring_list = $lang['Adr_battle_no_ring'];

    $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "
        WHERE item_in_shop = 0
        AND item_duration > 0
        AND item_in_warehouse = 0
        AND item_monster_thief = 0
        AND item_owner_id = $searchid ";
    if( !($result = $db->sql_query($sql)) )
    {
        message_die(GENERAL_ERROR, 'Could not query items list', '', __LINE__, __FILE__, $sql);
    }
    $items = $db->sql_fetchrowset($result);

    for ( $i = 0 ; $i < count($items) ; $i ++ )
    {
        if ( $items[$i]['item_type_use'] == 7 && $items[$i]['item_id'] == $equip_armor )
        {
            $armor_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $armor_pic = $items[$i]['item_icon'];
        }
        if ( $items[$i]['item_type_use'] == 8 && $items[$i]['item_id'] == $equip_buckler )
        {
            $buckler_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $buckler_pic = $items[$i]['item_icon'];
        }
        if ( $items[$i]['item_type_use'] == 9 && $items[$i]['item_id'] == $equip_helm )
        {
            $helm_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $helm_pic = $items[$i]['item_icon'];
        }
        if ( $items[$i]['item_type_use'] == 10 && $items[$i]['item_id'] == $equip_gloves )
        {
            $gloves_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $gloves_pic = $items[$i]['item_icon'];
        }
        if ( $items[$i]['item_type_use'] == 13 && $items[$i]['item_id'] == $equip_amulet )
        {
            $amulet_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $amulet_pic = $items[$i]['item_icon'];
        }
        if ( $items[$i]['item_type_use'] == 14 && $items[$i]['item_id'] == $equip_ring )
        {
            $ring_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $ring_pic = $items[$i]['item_icon'];
        }
    }
}



$template->assign_vars(array(
    'ARMOR_IMG' => $armor_pic,
    'BUCKLER_IMG' => $buckler_pic,
    'HELM_IMG' => $helm_pic,
    'GLOVES_IMG' => $gloves_pic,
    'AMULET_IMG' => $amulet_pic,
    'RING_IMG' => $ring_pic,
    'SELECT_ARMOR'  => $armor_list,
    'SELECT_BUCKLER' => $buckler_list,
    'SELECT_HELM' => $helm_list,
    'SELECT_GLOVES' => $gloves_list,
    'SELECT_AMULET' => $amulet_list,
    'SELECT_RING' => $ring_list,
    'L_EQUIPMENT' => $equip_title,
    'L_SELECT_ARMOR'  => $equip_larmor,
    'L_SELECT_BUCKLER' => $equip_lbuckler,
    'L_SELECT_HELM' => $equip_lhelm,
    'L_SELECT_GLOVES' => $equip_lgloves,
    'L_SELECT_AMULET' => $equip_lamulet,
    'L_SELECT_RING' => $equip_lring,
    'L_EQUIP' => $lang['Adr_equip'],
));

include($phpbb_root_path . 'adr/includes/adr_header.'.$phpEx);

$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
Ajax-loader Loading, please wait...