服务器端的问题
http://imgsrc.blacksheepgame.com/forum/cp%3Dtieba%2C10%2C399%3Bap%3Dcubeworld%B0%C9%2C90%2C407/sign=327517e3a51ea8d39e6f7c40fe6f522f/ec41b5d6277f9e2f0687bd501c30e924b999f306.jpg开服务端的时候就需要输入什么email 和pwd。
这个服务器端的配置文件里面可用限制等级 限制装备掉落率 和加密码T人等等。
而游戏自带的没有。其实我只想知道怎么限制等级、限制装备掉落率和装备掉落品质、T人。。。(完美限制修改档 再稍微提升游戏的乐趣)
下面是部分这个服务端的配置文件:
# Logging level 2 = Verbose, 1 = Default, or 0 = None
log_level = 2
# Logging to irc, same levels as above
irc_log_level = 1
# Regex name filter, anyone that does not match this will be removed.
# currently all keys normally on a keyboard. cubeworld really isnt picky.
name_filter = "^|:;'.,/\-+ <>\\\"{}~`=?]{2,16}$"
# If we allow the dual wield bug (equiping a 2h and a 1h at the same time)
allow_dual_wield = False
# Max allowed level
# Even players who level up legitly while playing will be removed
level_cap = 1000
# Highest level rarity level allowed on items, 4 is gold
rarity_cap = 6
# Number of times someone can attack and switch glider before it gets caught
# If you put this too low people just gliding after attacking will get kicked
# But you might want to put it slightly higher if people are getting kicked
# that are playing normally.
# This is mainly to stop the boomerang glitch, but who knows what other skills
# you can reset by spamming glider.
glider_abuse_count = 5
# Margin of time that can be between actual cooldown readiness and received
# readiness. smaller means more accurate, but also more chance someone gets
# kicked if he lags.
cooldown_margin = 0.5
# Max times someone can break cooldowns in a row before he is kicked
# This should be 1 or above because wollay.
max_cooldown_strikes = 3
# distance from the target they are hitting, larger basically allows
# for more lag.
max_hit_distance = 2000000
# Number of times in a row a player can break the max hit distance before he
# gets kicked, this should probably always be above 1, since if someone would
# respawn instantly they can still take damage from people with even minor lag.
max_hit_distance_strikes = 5
# Amount of seconds someone can be in the air before being kicked for flying
max_air_time = 10
# Allowed margin between real max speed and perceived max speed
# (not yet implemented)
speed_margin = 1
# Amount of seconds difference between last_hit and receiving a hitpacket
# last_hit_margin * max_last_hit_time_catchup + max_last_hit_strikes
# should be less then 15
# for it to effective, the closer to 15 the less chance it will actually do
# something..
last_hit_margin = 3.0
# Times last hit will be caught up instead of a strike given
max_last_hit_time_catchup = 3
# Last hit gets checked every second, if its over the margin a strike will be
# given. This should be above 0 as last_hit could probably be updated BEFORE
# the hitpacket arrives.
max_last_hit_strikes = 3
# Amount of times someone can exceed the max hit counter difference in a row
max_hit_counter_strikes = 3
# Max difference between estimated hit counter and actual hit counter
max_hit_counter_difference = 4
# Max times someones hp can exceed actual max hp, used to avoid kicks when
# switch items, and gaining above max hp from unholy spirits
max_max_hp_strikes = 4
# Max damage a player can hit another player with
max_damage = 10000
log_message = "{playername}({ip}) was removed for: {reason}."
disconnect_message = "{name} - You are being removed for: {reason}."
# Global server name
server_name = 'Tian Er Gou server'
# Max number of players on the server at once.
max_players = 40
# Seed for the server
seed = 8008
# Time speed modifier, 1.0 is default
time_modifier = 1.0
# List of scripts to run on the server on startup.
# Consider turning both of the following scripts on: pvp, ctf
scripts = ['log', 'ddos', 'commands', 'welcome', 'ban', 'console', 'master',
'anticheat']
# Passwords used for rights management. Keys are passwords, and values are
# a list of user types under that password. Right now, only 'admin' is defined,
# but scripts can restrict their usage depending on the user type
passwords = {
'PASSWORDREPLACEME': ['jkluj7adad']
}
# Used by the welcome.py script. Sends a small welcome message to users,
# replacing %(server_name)s with the server name defined in this file.
welcome = ["Welcome to %(server_name)s!",
"(server powered by cuwo)"]
# Logging variables
log_name = './logs/log.txt'
rotate_daily = True
console_log_format = '%(message)s'
file_log_format = '[%(asctime)s] %(message)s'
# Profile file. Set to something other than None to enable.
profile_file = None
# Max connections per IP to prevent DoS.
max_connections_per_ip = 5
# Connection timeout time in seconds
connection_timeout = 10.0
# Network interface to bind to. Defaults to all IPv4 interfaces.
network_interface = '0.0.0.0'
# Server port. Do not change this unless you have a modified client!
port = 12345
# Server send rate. Change this to a lower value for high-traffic servers.
# The vanilla server uses 50, but 20 or 25 may be more sensible.
update_fps = 50
# Enables terrain generation (depends on cuwo.tgen). This may not be needed
# for barebones PvP servers.
use_tgen = True
# Experimental support for mobs and NPCs. This is still work in progress, do
# not expect good results.
use_entities = False
# Current revision
git_rev = 'b9779f6'
# Round time in seconds
duration = 10 * 120
# Restart time in seconds
restart_time = 20
# Model to use for flag and base
flag_model = 'egg1'
base_model = 'workbench'
# Sounds
score_sound = 'bulwark'
drop_sound = 'craft'
take_sound = 'pickup'
start_sound = 'drop-coin'
end_sound = 'missioncomplete'
# IRC script variables (enable by adding 'irc' to script list)
nickname = 'cuwobot'
server = 'irc.esper.net'
password = None
port = 6667
channel = '#cuwo.bots'
channel_password = None
commandprefix = '.'
chatprefix = '#'
# User modes which are allowed to chat and use commands.
command_modes = [('@', 'o'), ('&', 'a'), ('~', 'q'), ('%', 'h')]
# User modes which are allowed to chat to the in-game server.
chat_modes = [('+', 'v')]
# User types that the IRC bot has. The available commands from other scripts
# are restricted by this list.
rights = ['admin', 'irc']
# Copyright (c) Mathias Kaerlev 2013-2014.
#
# This file is part of cuwo.
#
# cuwo 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 3 of the License, or
# (at your option) any later version.
#
# cuwo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cuwo.If not, see <http://www.gnu.org/licenses/>.
"""
Default set of commands bundled with cuwo
"""
from cuwo.script import ServerScript, command, admin, alias
from cuwo.common import get_chunk
from cuwo import constants
from cuwo import static
from cuwo.vector import Vector3
import platform
class CommandServer(ServerScript):
pass
def get_class():
return CommandServer
@command
@admin
def say(script, *message):
"""Sends a global server message."""
message = ' '.join(message)
script.server.send_chat(message)
@command
def server(script):
"""Returns information about the server's platform."""
msg = 'Server is running on %r' % platform.system()
revision = script.server.git_rev
if revision is not None:
msg += ', revision %s' % revision
return msg
@command
def login(script, password):
"""Logs in using the specified password."""
password = password.lower()
user_types = script.server.passwords.get(password, [])
if not user_types:
return 'Invalid password'
script.connection.rights.update(user_types)
return 'Logged in as %s' % (', '.join(user_types))
@command
def help(script, name=None):
"""Returns information about commands."""
if name is None:
commands = sorted()
return 'Commands: ' + ', '.join(commands)
else:
command = script.get_command(name)
if command is None:
return 'No such command'
return command.get_help()
@command
@admin
def kick(script, name):
"""Kicks the specified player."""
player = script.get_player(name)
player.kick()
@command
@admin
def setclock(script, value):
"""Sets the time of day. Format: hh:mm."""
try:
script.server.set_clock(value)
except ValueError:
return 'Invalid clock specified'
return 'Clock set to %s' % value
@command
def whereis(script, name=None):
"""Shows where a player is in the world."""
player = script.get_player(name)
if player is script.connection:
message = 'You are at %s'
else:
message = '%s is at %%s' % player.name
return message % (get_chunk(player.position),)
@command
def pm(script, name, *message):
"""Sends a private message to a player."""
player = script.get_player(name)
message = ' '.join(message)
player.send_chat('%s (PM): %s' % (script.connection.name, message))
return 'PM sent'
@command
@admin
def kill(script, name=None):
"""Kills a player."""
player = script.get_player(name)
player.entity.kill()
message = '%s was killed' % player.name
print(message)
script.server.send_chat(message)
@command
@admin
def stun(script, name, milliseconds=1000):
"""Stuns a player for a specified duration of time."""
player = script.get_player(name)
player.entity.damage(stun_duration=int(milliseconds))
message = '%s was stunned' % player.name
print(message)
script.server.send_chat(message)
@command
@admin
def heal(script, name=None, hp=1000):
"""Heals a player by a specified amount."""
player = script.get_player(name)
player.damage(-int(hp))
message = '%s was healed' % player.name
return message
def who_where(script, include_where):
server = script.server
player_count = len(server.players)
if player_count == 0:
return 'No players connected'
formatted_names = []
for player in list(server.players.values()):
name = '%s #%s' % (player.name, player.entity_id)
if include_where:
name += ' %s' % (get_chunk(player.position),)
formatted_names.append(name)
noun = 'player' if player_count == 1 else 'players'
msg = '%s %s connected: ' % (player_count, noun)
msg += ', '.join(formatted_names)
return msg
@command
def who(script):
"""Lists players."""
return who_where(script, False)
@command
def whowhere(script):
"""Lists players and their locations."""
return who_where(script, True)
@command
def player(script, name):
"""Returns information about a player."""
player = script.get_player(name)
entity = player.entity
typ = entity.class_type
klass = constants.CLASS_NAMES
spec = constants.CLASS_SPECIALIZATIONS
level = entity.level
return '%r is a lvl %s %s (%s)' % (player.name, level, klass, spec)
@command
@admin
def addrights(script, player, *rights):
"""Gives rights to a user."""
player = script.get_player(player)
rights = set(rights) & player.rights
player.rights.update(rights)
if rights:
rights = ', '.join((repr(right) for right in rights))
else:
rights = 'no'
return '%s rights given to %r' % (rights, player.name)
@command
@admin
def removerights(script, player, *rights):
"""Removes rights from a user."""
player = script.get_player(player)
rights = set(rights) & player.rights
player.rights.difference_update(rights)
if rights:
rights = ', '.join((repr(right) for right in rights))
else:
rights = 'no'
return '%s rights removed from %r' % (rights, player.name)
@command
def rights(script, player=None):
"""Displays the rights of a user."""
player = script.get_player(player)
rights = player.rights
if rights:
rights = ', '.join((repr(right) for right in player.rights))
else:
rights = 'no'
return '%r has %s rights' % (player.name, rights)
@command
@admin
def sound(script, name):
"""Plays a global sound."""
try:
script.server.play_sound(name)
except KeyError:
return 'No such sound'
def create_teleport_packet(pos, chunk_pos, user_id):
packet = static.StaticEntityPacket()
header = static.StaticEntityHeader()
packet.header = header
packet.chunk_x = chunk_pos
packet.chunk_y = chunk_pos
packet.entity_id = 0
header.set_name('Bench')
header.size = Vector3(0, 0, 0)
header.closed = True
header.orientation = static.ORIENT_SOUTH
header.pos = pos
header.time_offset = 0
header.something8 = 0
header.user_id = user_id
return packet
@command
@admin
@alias('t')
def teleport(script, a, b=None):
"""Teleport to a chunk or player."""
entity = script.connection.entity
if b is None:
player = script.get_player(a)
pos = player.entity.pos
else:
pos = Vector3(int(a), int(b), 0) * constants.CHUNK_SCALE
pos.z = script.world.get_height(pos.xy) or entity.pos.z
update_packet = script.server.update_packet
chunk = script.connection.chunk
packet = create_teleport_packet(pos, chunk.pos, entity.entity_id)
update_packet.static_entities.append(packet)
def send_reset_packet():
if chunk.static_entities:
chunk.static_entities.update()
else:
packet = create_teleport_packet(pos, chunk.pos, 0)
update_packet.static_entities.append(packet)
script.loop.call_later(0.1, send_reset_packet)
@command
@admin
def load(script, name):
"""Loads a script at runtime."""
name = str(name)
if name in script.server.scripts:
return 'Script %r already loaded' % name
script.server.load_script(name)
return 'Script %r loaded' % name
@command
@admin
def unload(script, name):
"""Unloads a script at runtime."""
name = str(name)
if not script.server.unload_script(name):
return 'Script %r is not loaded' % name
return 'Script %r unloaded' % name
@command
@admin
def reload(script, name):
"""Reloads a script at runtime."""
name = str(name)
if not script.server.unload_script(name):
return 'Script %r is not loaded' % name
script.server.load_script(name, update=True)
return 'Script %r reloaded' % name
@command
def scripts(script):
"""Lists the currently loaded scripts."""
return 'Scripts: ' + ', '.join(script.server.scripts.items)
# Copyright (c) Mathias Kaerlev 2013-2014.
#
# This file is part of cuwo.
#
# cuwo 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 3 of the License, or
# (at your option) any later version.
#
# cuwo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cuwo.If not, see <http://www.gnu.org/licenses/>.
"""
Ban management
"""
from cuwo.script import ServerScript, command, admin
SELF_BANNED = 'You are banned: {reason}'
PLAYER_BANNED = '{name} has been banned: {reason}'
DEFAULT_REASON = 'No reason specified'
DATA_NAME = 'banlist'
class BanServer(ServerScript):
def on_load(self):
self.ban_entries = self.server.load_data(DATA_NAME, {})
def save_bans(self):
self.server.save_data(DATA_NAME, self.ban_entries)
def ban(self, ip, reason):
self.ban_entries = reason
self.save_bans()
for connection in self.server.connections.copy():
if connection.address != ip:
continue
name = connection.name
if name is not None:
connection.send_chat(SELF_BANNED.format(reason=reason))
connection.disconnect()
if name is None:
continue
message = PLAYER_BANNED.format(name=name, reason=reason)
print(message)
self.server.send_chat(message)
def unban(self, ip):
try:
self.ban_entries.pop(ip)
self.save_bans()
return True
except KeyError:
return False
def on_connection_attempt(self, event):
try:
reason = self.ban_entries]
except KeyError:
return
return SELF_BANNED.format(reason=reason)
def get_class():
return BanServer
@command
@admin
def ban(script, name, *reason):
"""Bans a player."""
player = script.get_player(name)
reason = ' '.join(reason) or DEFAULT_REASON
script.parent.ban(player.address, reason)
@command
@admin
def unban(script, ip):
"""Unbans a player by IP."""
if script.parent.unban(ip):
return 'IP "%s" unbanned' % ip
else:
return 'IP not found'
页:
[1]