mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
XP grant button
This commit is contained in:
10
ldap-server/config-freebsd-9-*
Normal file
10
ldap-server/config-freebsd-9-*
Normal file
@@ -0,0 +1,10 @@
|
||||
config_file=/usr/local/etc/openldap/slapd.conf
|
||||
schema_dir=/usr/local/etc/openldap/schema
|
||||
slapd=/usr/local/libexec/slapd
|
||||
ldap_user=ldap
|
||||
browse_max=100
|
||||
attr_count=6
|
||||
start_cmd=/usr/local/etc/rc.d/slapd start
|
||||
stop_cmd=/usr/local/etc/rc.d/slapd stop
|
||||
apply_cmd=/usr/local/etc/rc.d/slapd restart
|
||||
init_name=slapd
|
||||
@@ -3,3 +3,5 @@ Added a page for setting up scheduled backups of some or all worlds on the serve
|
||||
Added a warning message on the main page if the server version is out of date.
|
||||
German translations from Raymond Vetter.
|
||||
Added a list of recent events for a player to the Manage Player page.
|
||||
---- Changes since 1.1 ----
|
||||
Added a button to grant XP orbs / levels to a player.
|
||||
|
||||
@@ -114,6 +114,10 @@ conn_ename=Missing or invalid player name
|
||||
conn_give=Grant item with ID
|
||||
conn_count=count
|
||||
conn_giveb=Give
|
||||
conn_xp=Grant XP
|
||||
conn_xp0=orbs
|
||||
conn_xp1=level
|
||||
conn_xpb=Give
|
||||
conn_never=This player has not logged into the server recently, and may not even exist.
|
||||
conn_err=Player action failed
|
||||
conn_etext=Missing message text
|
||||
@@ -122,6 +126,9 @@ conn_killdone=Killed player
|
||||
conn_eid=Missing or invalid item ID
|
||||
conn_ecount=Missing or non-numeric item count
|
||||
conn_givedone=Gave $2 of item $1 to player
|
||||
conn_xpdone=Gave $1 XP orbs to player
|
||||
conn_exp=Missing number of XP to grant
|
||||
conn_explevel=Level is too high to compute orbs
|
||||
conn_spawn=Change spawn point
|
||||
conn_spawnb=Set
|
||||
conn_tp=Teleport to point
|
||||
|
||||
@@ -718,4 +718,27 @@ return 0 if ($config{'backup_email_err'} && !$err);
|
||||
$msg);
|
||||
}
|
||||
|
||||
# level_to_orbs(level)
|
||||
# Converts a desired level to a number of orbs. From :
|
||||
# http://www.minecraftwiki.net/wiki/Experience
|
||||
sub level_to_orbs
|
||||
{
|
||||
my ($lvl) = @_;
|
||||
if ($lvl < 17) {
|
||||
return $lvl * 17;
|
||||
}
|
||||
my @xpmap = split(/\s+/,
|
||||
"17 292 18 315 19 341 20 370 21 402 22 437 23 475 24 516 ".
|
||||
"25 560 26 607 27 657 28 710 29 766 30 825 31 887 32 956 ".
|
||||
"33 1032 34 1115 35 1205 36 1302 37 1406 38 1517 39 1635 ".
|
||||
"40 1760 41 3147 42 3297 43 3451 44 3608 45 3769 46 3933 ".
|
||||
"47 4101 48 4272 49 4447 50 4625");
|
||||
for(my $i=0; $i<@xpmap; $i+=2) {
|
||||
if ($xpmap[$i] == $lvl) {
|
||||
return $xpmap[$i+1];
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -38,6 +38,23 @@ elsif ($in{'give'}) {
|
||||
$msg = &text('conn_givedone', $i ? $i->{'name'} : $in{'id'},
|
||||
$in{'count'});
|
||||
}
|
||||
elsif ($in{'xp'}) {
|
||||
# Grant XP
|
||||
$in{'xpadd'} =~ /^\d+$/ || &error($text{'conn_exp'});
|
||||
my $xp;
|
||||
if ($in{'xpmode'} == 0) {
|
||||
$xp = $in{'xpadd'};
|
||||
}
|
||||
else {
|
||||
$xp = &level_to_orbs($in{'xpadd'});
|
||||
$xp || &error($text{'conn_explevel'});
|
||||
}
|
||||
my $out = &execute_minecraft_command(
|
||||
"/xp $xp $in{'name'}");
|
||||
$out =~ /Given.*experience.*\Q$in{'name'}\E/ ||
|
||||
&error(&html_escape($out));
|
||||
$msg = &text('conn_xpdone', $xp);
|
||||
}
|
||||
elsif ($in{'spawn'}) {
|
||||
# Change spawn point
|
||||
$in{'spawnx'} =~ /^\-?([0-9]+)$/ || &error($text{'conn_ex'});
|
||||
|
||||
@@ -70,6 +70,14 @@ if ($c || 1) {
|
||||
&ui_textbox("count", 1, 5)." ".
|
||||
&ui_submit($text{'conn_giveb'}, 'give'));
|
||||
|
||||
# Grant XP
|
||||
print &ui_table_row($text{'conn_xp'},
|
||||
&ui_textbox("xpadd", undef, 5)." ".
|
||||
&ui_select("xpmode", 0,
|
||||
[ [ 0, $text{'conn_xp0'} ],
|
||||
[ 1, $text{'conn_xp1'} ] ])." ".
|
||||
&ui_submit($text{'conn_xpb'}, 'xp'));
|
||||
|
||||
# Change spawn point
|
||||
print &ui_table_row($text{'conn_spawn'},
|
||||
"X:".&ui_textbox("spawnx", int($x), 10)." ".
|
||||
|
||||
Reference in New Issue
Block a user