diff --git a/ldap-server/config-freebsd-9-* b/ldap-server/config-freebsd-9-* new file mode 100644 index 000000000..ea8126da2 --- /dev/null +++ b/ldap-server/config-freebsd-9-* @@ -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 diff --git a/minecraft/CHANGELOG b/minecraft/CHANGELOG index 514a0d0e1..73d50878d 100644 --- a/minecraft/CHANGELOG +++ b/minecraft/CHANGELOG @@ -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. diff --git a/minecraft/lang/en b/minecraft/lang/en index 157a5ae77..d4d56717b 100644 --- a/minecraft/lang/en +++ b/minecraft/lang/en @@ -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 diff --git a/minecraft/minecraft-lib.pl b/minecraft/minecraft-lib.pl index f2691f467..4660f9f7e 100644 --- a/minecraft/minecraft-lib.pl +++ b/minecraft/minecraft-lib.pl @@ -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; diff --git a/minecraft/save_conn.cgi b/minecraft/save_conn.cgi index b0da4a5e5..57f4b7a09 100755 --- a/minecraft/save_conn.cgi +++ b/minecraft/save_conn.cgi @@ -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'}); diff --git a/minecraft/view_conn.cgi b/minecraft/view_conn.cgi index b5b79e8b2..c3e26715f 100755 --- a/minecraft/view_conn.cgi +++ b/minecraft/view_conn.cgi @@ -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)." ".