コード例 #1
0
ファイル: clientcommands.py プロジェクト: Pat61/hyperserv
def simpleMasterRequest(caller):
	#check for other privileged people
	privileged=[(session,user) for session,user in UserSessionManager.items() if session[0]=='ingame' and user[1]!='']
	
	if len(privileged)==0:
		setSimpleMaster(caller)
	else:
		playerCS.executeby(caller,"echo PermissionError: There are masters/admins present.")
		raise PermissionError("There are masters/admins present.")
コード例 #2
0
ファイル: usercommands.py プロジェクト: amstan/hyperserv
def logout(caller,everything="no"):
        """This logs the caller out. If everything="everything" then the caller will be logged out in every case of the UserSessionManager."""
	if everything=="everything":
		username=UserSessionManager[caller][0]
		for session in UserSessionManager:
			if UserSessionManager[session][0]==username:
				playerCS.executeby(session,"logout")
	else:
		del UserSessionManager[caller]
		playerCS.executeby(caller,"echo You have logged out.")
コード例 #3
0
ファイル: clientcommands.py プロジェクト: Pat61/hyperserv
def clientSetMaster(caller,text):
	caller=("ingame",caller)
	if UserSessionManager[caller][0]=="notloggedin":
		#TODO: see http://github.com/SirAlex/hyperserv/issues#issue/23
		if(config["serverpublic"]!="1"):
			simpleMasterRequest(caller)
		else:
			playerCS.executeby(caller,"echo PermissionError: You cannot claim master on this server without an account or auth.")
			raise PermissionError("You cannot claim master on this server without an account or auth.")
	else:
		checkforCS(caller,"@master")
コード例 #4
0
ファイル: usercommands.py プロジェクト: Pat61/hyperserv
def CSserverPM(caller, cn=None, *strings):
        """This allows the caller to pm another player. Note that this does not currently work for irc communications."""
        try:
                string=' '.join(strings)
                cn = int(cn)
                reciver = ("ingame", cn)
                string1 = "PM from %s:" %formatCaller(caller)
                newstring = color(3, string1)
                newstring1 = color(7, string)
                playerCS.executeby(reciver,"echo \"%s %s\"" % (newstring, newstring1))
        except ValueError:
                playerCS.executeby(caller,"echo \"PM does not work for irc yet\"")
	return string
コード例 #5
0
ファイル: servercommands.py プロジェクト: crcollins/hyperserv
def CSserverPM(caller, cn, *what):
	"""Allows players to pm other players."""
	string=' '.join(map(str,what))
	try:
		cn = int(cn)
		reciver = ("ingame", cn)
		if caller[0] == "ingame":
			namecn = " ("+str(caller[1])+"): "
		else:
			namecn = ""
		string1 = formatCaller(caller) + namecn
		newstring = color(3, string1+string)
		playerCS.executeby(reciver,"echo \"%s\"" %newstring)
	except ValueError:
		triggerServerEvent("pm",[caller,cn,string])
	return string
コード例 #6
0
ファイル: notices.py プロジェクト: amstan/hyperserv
def noticeVoteMap(caller,mode,name):
	if caller[1] in muted_cns:
                playerCS.executeby(caller,"echo \"You are muted so you are not allowed to vote.\"") 
	else:
                serverNotice("%s votes to play on %s (%s)." % (formatCaller(caller),name,modeName(mode)))
コード例 #7
0
ファイル: notices.py プロジェクト: amstan/hyperserv
def noticeMute(cn):
	caller=("ingame",cn)
	playerCS.executeby(caller,"echo \"%s is muted. You cannot talk.\"" % (formatCaller(caller)))
コード例 #8
0
ファイル: notices.py プロジェクト: amstan/hyperserv
def noticeEditMute(cn):
	caller=("ingame",cn)
	playerCS.executeby(caller,"echo \"%s is edit muted. You can not edit.\"" % (formatCaller(caller)))
コード例 #9
0
ファイル: clientcommands.py プロジェクト: Pat61/hyperserv
def setSimpleMaster(caller):
	"""sets the caller a simple master, just like /setmaster 1 does it on a vanilla server"""
	UserSessionManager[caller]=("notloggedin","master")
	playerCS.executeby(caller,"master")
コード例 #10
0
ファイル: clientcommands.py プロジェクト: Pat61/hyperserv
def clientMapVote(caller,mapname,mode):
	caller=("ingame",caller)
	try:
		playerCS.executeby(caller,"map %s %s" % (mapname,mode))
	except PermissionError:
		triggerServerEvent("vote_map",[caller,mode,mapname])
コード例 #11
0
ファイル: usercommands.py プロジェクト: amstan/hyperserv
def takeMaster(caller):
        """This command takes master from the person that currently has it."""
	masters=[session for session,user in UserSessionManager.items() if session[0]=='ingame' and user[1]=='master']
	for master in masters:
		playerCS.executeby(master,"relinquish; logout")
コード例 #12
0
ファイル: usercommands.py プロジェクト: deathstar/hyperserv
def logout(caller):
	del UserSessionManager[caller]
	playerCS.executeby(caller,"echo You have logged out.")