Criando Transformice Pirata [Source 0.55]554

Criando Transformice Pirata [Source 0.55]

Página 1 de 2 1, 2  Seguinte

Ver o tópico anterior Ver o tópico seguinte Ir em baixo

icon1 Criando Transformice Pirata [Source 0.55]

Mensagem por Heaven ♪ em Qua Out 26, 2011 12:54 pm

Aprenda agora como criar seu proprio servidor pirata ,lembrando que :
Nao me responsabilizo pelo mal uso da source.
Voce
tambem entende que é maior de 18 anos e tem a conciencia que copiar um
jogo pode resultar em puniçao devido a quebra de direitos autorias do
administrador do jogo transformice original.
Lembrando que é
proibido vender queijos ou itens em seu servidor pirata,resultando em
uma maior puniçao. O tutorial aqui postado se deve ao ator caio e tambem a source do mesmo.
Atençao as partes em vermelhos nao fazem parte da source,é só para voces separar o inicio e o fim da source !

// Abra o spoiler source dentro//


Spoiler:
# By Kyl3 (Edi472)
# Transformice Private Server 0.55 Source
# Copyright eSBody 2011
# The copy-source is released
# Manuteno
# [Você precisa estar registrado e conectado para ver este link.]
import random
import socket, asyncore, asynchat
import thread, threading
import time
import types
import re
import base64, binascii, hashlib
import logging

from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler

logging.basicConfig(filename='Archives.html',level =logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")


VERBOSE = False
VERSION = "0.55 "

ADMIN_NAME = "Admin"
ADMIN_NAMES
= frozenset(['Admin', 'admin', 'Phoenix', 'Tigrounette', 'Melibellule',
'Jonathan', 'Modogeek', 'Mododivin', 'Modoplouf', 'Modotruc'])
ADMIN_HASH = "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62 a11ef721d1542d8"

LEVEL_LIST = range(0, 100+1) + range(901, 910+1)
#0 to 100 are normal maps, 901 to 910 are replaced with nightmode maps.
#901 1006
#902 1007 (No Shaman)
#903 1015
#904 1027
#905 1040
#906 1062
#907 1067
#908 1087 (Shaman only on nightmode)
#909 1088 (Shaman only on nightmode)
#910 1092 (Shaman only on nightmode)

class TransformiceServer(asyncore.dispatcher):
def __init__(self, HOST='', PORT=1111):

self.HOST = HOST
self.PORT = PORT

asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)

# try to re-use a server port if possible
self.set_reuse_addr()
self.bind((self.HOST, self.PORT))
self.listen(5)

logging.info("running")

#self.clients = []

self.rooms = {}

def handle_accept(self):
socket, addr = self.accept()

TransformiceClientHandler(self, socket, addr)

def authenticate(self, username, passwordHash):
#authentication
if username.strip().lower() in ADMIN_NAMES:
if passwordHash != ADMIN_HASH:
return -1 #Invalid

return 10 #Admin

return 1 #Normal Player

def createAccount(self, username, passwordHash):
pass

def sendPrivMsg(self, fromUsername, toUsername, message):

found = False
for room in self.rooms.itervalues():
for player in room.clients.itervalues():
if player.username.lower() == toUsername.lower():
player.sendRecievePrivMsg(fromUsername, message)
found = True
return found

def addClientToRoom(self, client, roomName):
roomName = str(roomName)
if self.rooms.has_key(roomName):
self.rooms[roomName].addClient(client)
else:
self.rooms[roomName] = TransformiceRoomHandler(self, roomName)
self.rooms[roomName].addClient(client)
#return self.rooms[roomName]

def closeRoom(self, room):
if self.rooms.has_key(room.name):
room.close()
del self.rooms[room.name]

def getConnectedPlayerCount(self):
return 1

def generatePlayerCode(self):
return random.randrange(1, 10000000)

def recommendRoom(self):
return 1
#return min(self.rooms.itervalues(), key=lambda room: abs(len(room.clients) - 20)).name

class TransformiceStateRecorder(object):
def __init__(self, room):
self.room = room

self.reset()

def reset(self):
self.sateLog = []

self.lastPhysicsStateEvent = None
self.anchors = []

def log(self, eventTokens, values):
self.sateLog.append((eventTokens, values))
def logMessage(self, messageFunction, args):
self.sateLog.append((messageFunction, args))

def setPhyscisState(self, eventTokens, values):
self.lastPhysicsStateEvent = (eventTokens, values)
def addAnchor(self, values):
self.anchors.extend(values)

def sendToClient(self, client):
if self.lastPhysicsStateEvent:
eventTokens, value = self.lastPhysicsStateEvent
client.sendData(eventTokens, value)

for sendThing, value in self.sateLog:
if type(sendThing) == types.FunctionType:
sendThing(client, *value)
else:
client.sendData(sendThing, value)

if len(self.anchors) > 0:
client.sendSetAnchors(self.anchors)

class TransformiceRoomHandler(object):
def __init__(self, server, name):
self.server = server
self.name = name.strip()

self.clients = {}

self.stateRecorder = TransformiceStateRecorder(self)

self.currentShamanCode = None
self.currentSyncroniserCode = None

self.isSandbox = False
self.isBootcamp = False
self.specificMap = False
self.properNoShamanMaps = True

#self.currentWorld = random.choice(LEVEL_LIST)
runthismap = random.choice(LEVEL_LIST)
if runthismap == 901:
runthismap = 1006
if runthismap == 902:
runthismap = 1007
if runthismap == 903:
runthismap = 1015
if runthismap == 904:
runthismap = 1027
if runthismap == 905:
runthismap = 1040
if runthismap == 906:
runthismap = 1062
if runthismap == 907:
runthismap = 1067
if runthismap == 908:
runthismap = 1087
if runthismap == 909:
runthismap = 1088
if runthismap == 910:
runthismap = 1092
self.currentWorld = runthismap

if self.name.startswith("sandbox_") or self.name.startswith("play_") or self.name.startswith("bootcamp_"):
try:
runthismap = int(re.search(r"([0-9]+)$", self.name).group(0))
if runthismap == 901:
runthismap = 11006
if runthismap == 902:
runthismap = 11007
if runthismap == 903:
runthismap = 11015
if runthismap == 904:
runthismap = 11027
if runthismap == 905:
runthismap = 11040
if runthismap == 906:
runthismap = 11062
if runthismap == 907:
runthismap = 11067
if runthismap == 908:
runthismap = 11087
if runthismap == 909:
runthismap = 11088
if runthismap == 910:
runthismap = 11092
self.currentWorld = runthismap
except (ValueError, AttributeError):
pass
else:
self.specificMap = True

if self.name.startswith("sandbox_"):
self.isSandbox = True
if self.name.startswith("bootcamp_"):
self.isBootcamp = True

self.everybodyIsShaman = self.isSandbox
self.nobodyIsShaman = self.isBootcamp


self.worldChangeTimer = None
if not self.isSandbox:
self.worldChangeTimer = threading.Timer(120, self.worldChange)
self.worldChangeTimer.start()

self.gameStartTime = time.time()
self.numCompleted = 0

def close(self):
if self.worldChangeTimer:
self.worldChangeTimer.cancel()


def worldChange(self):

self.stateRecorder.reset()
self.currentSyncroniserCode = None
if self.clients.has_key(self.currentShamanCode):
currentShaman = self.clients[self.currentShamanCode]
for playerCode, client in self.clients.iteritems():
try: #be cautious, threads break things but we don't want it to die
client.sendShamanPerformance(currentShaman.usernam e, self.numCompleted)
except:
pass
self.currentShamanCode = None

for playerCode, client in self.clients.iteritems():
client.resetPlay()

if not self.specificMap:
runthismap = random.choice(LEVEL_LIST)
#if runthismap == 901:
# runthismap = random.choice(LEVEL_LIST)
#if runthismap == 902:
# runthismap = random.choice(LEVEL_LIST)
#if runthismap == 903:
# runthismap = random.choice(LEVEL_LIST)
#if runthismap == 904:
# runthismap = random.choice(LEVEL_LIST)
if runthismap == 901:
runthismap = 1006
if runthismap == 902:
runthismap = 1007
if runthismap == 903:
runthismap = 1015
if runthismap == 904:
runthismap = 1027
if runthismap == 905:
runthismap = 1040
if runthismap == 906:
runthismap = 1062
if runthismap == 907:
runthismap = 1067
if runthismap == 908:
runthismap = 1087
if runthismap == 909:
runthismap = 1088
if runthismap == 910:
runthismap = 1092
if runthismap == self.currentWorld:
runthismap = random.choice(LEVEL_LIST)
self.currentWorld = runthismap
#print self.currentWorld, self.specificMap

for playerCode, client in self.clients.iteritems():
client.startPlay()

self.worldChangeTimer = threading.Timer(120, self.worldChange)
self.worldChangeTimer.start()

self.gameStartTime = time.time()
self.numCompleted = 0

def worldChangeSpecific(self, mapnumber):

#self.stateRecorder.reset()
#self.currentSyncroniserCode = None

#if self.clients.has_key(self.currentShamanCode):
# currentShaman = self.clients[self.currentShamanCode]
# for playerCode, client in self.clients.iteritems():
# try: #be cautious, threads break things but we don't want it to die
# client.sendShamanPerformance(currentShaman.usernam e, self.numCompleted)
# except:
# pass
#self.currentShamanCode = None

#for playerCode, client in self.clients.iteritems():
# client.resetPlay()

#if not self.specificMap:
self.currentWorld = mapnumber
#print self.currentWorld, self.specificMap

for playerCode, client in self.clients.iteritems():
client.startPlay()

#self.worldChangeTimer = threading.Timer(120, self.worldChange)
#self.worldChangeTimer.start()

#self.gameStartTime = time.time()
#self.numCompleted = 0


def checkShouldChangeWorld(self):
if not self.isSandbox:
if all(client.isDead for client in self.clients.itervalues()):
self.worldChangeTimer.cancel()
self.worldChange()

def resetSandbox(self):
if self.isSandbox:
for playerCode, client in self.clients.iteritems():
resetpscore=0
self.informAll(TransformiceClientHandler.sendPlaye rDied, [playerCode, resetpscore])
client.isDead=True
if all(client.isDead for client in self.clients.itervalues()):
#self.worldChangeTimer.cancel()
#self.worldChange()
for playerCode, client in self.clients.iteritems():
client.resetPlay()
self.currentWorld = self.currentWorld
for playerCode, client in self.clients.iteritems():
client.startPlay()
else:
pass

def addClient(self, newClient):

self.clients[newClient.playerCode] = newClient

self.informAllOthers(newClient, TransformiceClientHandler.sendNewPlayer, [newClient.getPlayerData()])

#h
newClient.room = self

newClient.startPlay()
self.stateRecorder.sendToClient(newClient)

def removeClient(self, removeClient):
if self.clients.has_key(removeClient.playerCode):
del self.clients[removeClient.playerCode]

if self.getPlayerCount() == 0:
self.server.closeRoom(self)
return

self.informAll(TransformiceClientHandler.sendPlaye rDisconnect, [removeClient.playerCode])
if self.currentSyncroniserCode == removeClient.playerCode:
newSyncroniser = random.choice(self.clients.values())
newSyncroniser.isSyncroniser = True

self.currentSyncroniserCode = newSyncroniser.playerCode
self.informAll(TransformiceClientHandler.sendSynch roniser, [newSyncroniser.playerCode])

self.checkShouldChangeWorld()

def playMusic(self, path):
self.informAll(TransformiceClientHandler.sendPlayM usic, [path])

def informAll(self, clientFunction, args):
for playerCode, client in self.clients.iteritems():
clientFunction(client, *args)

def informAllOthers(self, senderClient, clientFunction, args):
for playerCode, client in self.clients.iteritems():
if playerCode != senderClient.playerCode:
clientFunction(client, *args)

def sendAll(self, eventTokens, data = None):
for playerCode, client in self.clients.iteritems():
client.sendData(eventTokens, data)
def sendAllOthers(self, senderClient, eventTokens, data):
for playerCode, client in self.clients.iteritems():
if client.playerCode != senderClient.playerCode:
client.sendData(eventTokens, data)

def killAll(self):
for playerCode, client in self.clients.iteritems():
resetpscore=0
self.informAll(TransformiceClientHandler.sendPlaye rDied, [playerCode, resetpscore])
client.isDead=True
self.checkShouldChangeWorld()

def getPlayerCount(self):
return len(self.clients)

def getPlayerList(self):
for playerCode, client in self.clients.iteritems():
yield client.getPlayerData()

def getShamanCode(self):
if self.currentShamanCode is None:
self.currentShamanCode = random.choice(self.clients.keys())
return self.currentShamanCode
def getSyncroniserCode(self):
if self.currentSyncroniserCode is None:
self.currentSyncroniserCode = random.choice(self.clients.keys())
return self.currentSyncroniserCode

class TransformiceClientHandler(asynchat.async_chat):
def __init__(self, server, sock, address):
self.server = server
self.address = address

asynchat.async_chat.__init__(self, sock=sock)
self.buffer = ""
self.set_terminator("\x00")
self.validatingVersion = True


self.username = ""
self.playerCode = -1
self.privilegeLevel = 0
#0 - "Invite" - Guest?
#1 - Normal player
#5 - "Modo"?
#10 - Admin
self.room = None

self.isShaman = False
self.isDead = False
self.isSyncroniser = False
self.score = 0

self.titleNumber = 0

self.Tellfirsttime = 0



def collect_incoming_data(self, data):
self.buffer += data

def found_terminator(self):
if self.validatingVersion:
if self.buffer == "<policy-file-request/>":
if VERBOSE:
logging.debug("Policy file request")
self.push(r"""<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*" to-ports="%d"/>
</cross-domain-policy>""" % (self.server.PORT) + "\x00")
self.close_when_done()

else:
version, bytesLoaded1, bytesLoaded2 = self.buffer.split("\x01")
if version == VERSION:
self.sendCorrectVersion()
else:
self.close_when_done()
self.validatingVersion = False
else:
self.parseData(self.buffer)

self.buffer = ""


def parseData(self, data):
MDT_stuff = data[:4]
data = data[4:]

values = data.split("\x01")

if VERBOSE:
pass
#logging.debug(repr(MDT_stuff), values)

eventTokens = values.pop(0)
eventToken1, eventToken2 = eventTokens

if eventToken1 == "\x1A":
if eventToken2 == "\x02":
#awake timer
unknownTime, = values
unknownTime = int(unknownTime)

elif eventToken2 == "\x03":
#create account
username, passwordHash = values

username = username.replace("<","")

self.server.createAccount(username, passwordHash)
self.login(username, passwordHash)

elif eventToken2 == "\x04":
#login
username, passwordHash, showTarget = values
showTarget = bool(int(showTarget))

username = username.replace("<","")

self.login(username, passwordHash)

else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens
elif eventToken1 == "\x04":
if eventToken2 == "\x03":
#world physics update
#CodePartieEnCours = values.pop(0)
#for objectData in values:
# if objectData == 'x':
# continue
# objectType, x, y, dx, dy, rotation, angularVelocity, isSolid = objectData.split(',')

if self.isSyncroniser:
self.room.sendAllOthers(self, eventTokens, values)
self.room.stateRecorder.setPhyscisState(eventToken s, values)

elif eventToken2 == "\x04":
#position update
#isMovingRight, isMovingLeft, x, y, dx, dy, isJumping, jumpAnimation = values

self.room.sendAllOthers(self, eventTokens, values + [self.playerCode])



elif eventToken2 == "\x05":
#player went out of bounds
self.isDead = True

#score shit
#self.score = self.score-1
#if self.score < 0:
# self.score = 0
#end

self.room.informAll(TransformiceClientHandler.send PlayerDied, [self.playerCode, self.score])

self.room.checkShouldChangeWorld()
elif eventToken2 == "\x06":
# "Demande_Giclage"
#objectCode, = values

self.room.sendAll(eventTokens, values)


elif eventToken2 == "\x08":
#animation conjouring?
#direction, = values
#direction = int(direction)

self.room.sendAllOthers(self, eventTokens, [self.playerCode] + values)

elif eventToken2 == "\x09":
#begin/end crouch
crouching, = values
crouching = bool(int(crouching))
if crouching:
self.room.sendAllOthers(self, eventTokens, [self.playerCode] + values)
else:
self.room.sendAllOthers(self, eventTokens, [self.playerCode])
elif eventToken2 == "\x12":
#begin grappin
x, y = values
self.room.sendAllOthers(self, eventTokens, [self.playerCode] + values)
#pass
elif eventToken2 == "\x13":
#end grappin
self.room.sendAllOthers(self, eventTokens, [self.playerCode])
#pass

elif eventToken2 == "\x14":
logging.debug("PONG'd")

else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens
elif eventToken1 == "\x06":
if eventToken2 == "\x06":
#sent chat message
message, = values

message = message.replace("<","")
#message = message.replace("#","")

logging.info("(%s) %s: %r" % (self.room.name, self.username, message))

self.room.sendAll(eventTokens, [self.playerCode, self.username, message.strip()])
elif eventToken2 == "\x1A":
#sent command

event, = values
event_raw = event.strip()
event = event_raw.lower()

logging.info("(%s) [c] %s: %r" % (self.room.name, self.username, event))

if event.startswith("room ") or event.startswith("salon "):
#changing room
#roomname = event[5:]
roomname = event.split(" ", 1)[1]
self.enterRoom(roomname)

elif event.startswith("c ") or event.startswith("w "):
_, username, message = event_raw.split(" ", 2)

if not self.server.sendPrivMsg(self.username, username, message): #if failure
self.sendPlayerNotFound()
else:
self.sendSentPrivMsg(username, message)

elif event in ("dance", "danse", "profil"):
self.room.informAll(TransformiceClientHandler.send PlayerAction, [self.playerCode, 1])
elif event in ("laugh", "rire"):
self.room.informAll(TransformiceClientHandler.send PlayerAction, [self.playerCode, 2])
elif event in ("cry", "pleurer"):
self.room.informAll(TransformiceClientHandler.send PlayerAction, [self.playerCode, 3])
elif event in ("deconnecter"):
self.room.informAll(TransformiceClientHandler.send PlayerDisconnect, [self.playerCode])
self.close()
elif event in ("kill", "sucide", "bubbles", "die"):
self.isDead = True
self.room.informAll(TransformiceClientHandler.send PlayerDied, [self.playerCode, self.score])
self.room.checkShouldChangeWorld()


elif event.startswith("title ") or event.startswith("titre "):
titlenumber = event.split(" ", 1)[1]
self.titleNumber = titlenumber

elif event.startswith("profil"):
self.sendPlayerNotFound()

elif event.startswith("ban "):
banname = event.split(" ", 1)[1]
#Not done

elif event.startswith("annonce ") or event.startswith("an "):
#modsendmessage = event.split(" ", 1)[1]
if self.username=="Admin":
modsendmessage = event.split(" ", 1)[1]
#for room in self.server.rooms.itervalues():
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Admin", modsendmessage])

elif event.startswith("information") or event.startswith("info "):
#modsendmessage = event.split(" ", 1)[1]
if self.username=="Admin":
modsendmessage = event.split(" ", 1)[1]
#for room in self.server.rooms.itervalues():
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event.startswith("all") or event.startswith("tous "):
#modsendmessage = event.split(" ", 1)[1]
if self.username=="Admin":
modsendmessage = event.split(" ", 1)[1]
#for room in self.server.rooms.itervalues():
self.room.informAll(TransformiceClientHandler.send ModMessage, ["", modsendmessage])

elif event.startswith("def"):
if self.username=="Admin":
tellfirstm = event.split(" ", 1)[1]
if tellfirstm == "arret":
modsendmessage = "Arret du serveur"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])
elif tellfirstm == "infos":
modsendmessage = "TransforEmu V 0.55 By Phoenix ~For FUNKYCHEAT.FR~"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])
elif tellfirstm == "aide":
modsendmessage = "Liste des commandes dans le site. Pour obtenir de l'aide de la part d'un administrateur '/c Admin TONMESSAGE"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])
elif tellfirstm == "maj":
modsendmessage = "Relancez la page et videz le cache"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Mise A Jour", modsendmessage])
elif tellfirstm == "reboot":
modsendmessage = "Reboot (Redemmarage) du serveur imminent"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])
elif tellfirstm == "commandes":
modsendmessage
= "Normaux</br></br> <b><u>Touche ALT + Clic sur la
carte</u></b>
Teleportation</br></br></br> <b><u>Clic
sur la carte</u></b> Active/Bouge le Grappin</br>
<b><u>Clic sur soi</u></b> Desactive le
Grappin</br> <b><u>/salon X</u></b> Change
de salon</br> <b><u>/salon
sandbox_X</u></b> Va dans un salon Sandbox (Pas de limite de
temps, tout le monde chaman) (X = ID de carte)
</br><b><u>/salon play_X</u></b> Va dans
un salon ou une carte sera joue en boucle (X = ID de carte)</br>
<b><u>/salon bootcamp_X</u></b> Va dans un salon
sans chaman (X = ID de carte)</br>
<b><u>/rire</u></b> Rigoler</br>
<b><u>/pleurer</u></b> Pleurer</br>
<b><u>/danse</u></b> Danser</br>
<b><u>/deconnecter</u></b> Se
deconnecter</br> <b><u>/sucide</u></b> Se
tuer (de la partie)</br> <b><u>/titre
X</u></b> Change de titre</br> <b><u>/c X
Y</u></b> Parler a quelqun (X = Destinataire, Y = Message)"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event.startswith("first ") or event.startswith("premier "):
if self.username=="Admin":
tellfirstm = event.split(" ", 1)[1]
if tellfirstm == "oui":
modsendmessage = "Publication des first dans le chat"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])
self.Tellfirsttime=1
elif tellfirstm == "non":
modsendmessage = "Arret de la publication des first dans le chat"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])
self.Tellfirsttime=0
else:
modsendmessage = "Invalide."
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Erreur", modsendmessage])
self.Tellfirsttime=0

elif event.startswith("map ") or event.startswith("carte "):
#This command is very glitchy. Avoid using.
if self.username=="Admin":
mapnumber = event.split(" ", 1)[1]
self.isDead = True
self.room.informAll(TransformiceClientHandler.send PlayerDied, [self.playerCode, self.score])
self.room.worldChangeSpecific(mapnumber)
modsendmessage = "Changement de carte"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])





elif event.startswith("chamanfake ") or event.startswith("fake "):
if self.username=="Admin":
_, hname, hsaves = event_raw.split(" ", 2)
self.room.informAll(TransformiceClientHandler.send ShamanPerformance, [hname, hsaves])

elif event in ("killall") or event.startswith("tuercarte"):
if self.username=="Admin":
self.room.killAll()
modsendmessage = "Joueurs de la carte tues"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event in ("clear") or event.startswith("nettoyer"):
if self.username=="Admin":
self.room.resetSandbox()
modsendmessage = "Relancement de la carte"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event in ("online") or event.startswith("joueursco"):
#modsendmessage = event.split(" ", 1)[1]
if self.username=="Admin":
#modsendmessage = self.room.getPlayerCount()
playercountm = self.room.getPlayerCount()
modsendmessage = 'Il y a %d Joueurs Connéctés.' % playercountm
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event in ("mapid") or event.startswith("idcarte"):
#modsendmessage = event.split(" ", 1)[1]
if self.username=="Admin":
currentmapme = self.room.currentWorld
modsendmessage = 'Nous sommes sur la carte %d.' % currentmapme
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event in ("cartere") or event.startswith("replay"):
#modsendmessage = event.split(" ", 1)[1]
if self.username=="Admin":
currentmapme = self.room.currentWorld
self.isDead = True
self.room.informAll(TransformiceClientHandler.send PlayerDied, [self.playerCode, self.score])
self.room.worldChangeSpecific(currentmapme)
modsendmessage = 'Relancement de la carte %d.' % currentmapme
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Information", modsendmessage])

elif event.startswith("hole ") or event.startswith("troufake "):
if self.username=="Admin":
_, hscore, hplace, htime = event_raw.split(" ", 3)
self.isDead = True
#self.room.informAll(TransformiceClientHandler.sen dPlayerDied, [self.playerCode, self.score])
self.room.informAll(TransformiceClientHandler.send PlayerGotCheese, [self.playerCode, hscore, hplace, htime])
self.room.checkShouldChangeWorld()

elif event.startswith("libre ") or event.startswith("free "):
if self.username=="Admin":
_, hscore, htime = event_raw.split(" ", 2)
self.room.informAll(TransformiceClientHandler.send ModMessage, ["", ])


elif event.startswith("music ") or event.startswith("musique"):
if self.username=="Admin":
musicmessage = event.split(" ", 1)[1]
self.room.informAll(TransformiceClientHandler.send PlayMusic, [musicmessage])
modsendmessage = "On met le son !!!"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Musique", modsendmessage])

elif event.startswith("musicoff") or event.startswith("musiqueoff"):
if self.username=="Admin":
musicmessage = event.split("off", 1)[1]
self.room.informAll(TransformiceClientHandler.send PlayMusic, [musicmessage])
modsendmessage = "Et on coupe le son !!!"
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~Musique", modsendmessage])

else:
logging.warning("Unimplemented %r" % event)
#raise NotImplementedError, event

else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens
elif eventToken1 == "\x05":
if eventToken2 == "\x07":
#Anchor thing
#jointType, object1, o1x, o1y, o1r, object2, o2x, o2y, o2r = values

self.room.stateRecorder.addAnchor(values)
self.room.sendAllOthers(self, eventTokens, values)
#self.room.sendAll(eventTokens, values)

elif eventToken2 == "\x08":
#object begin conjouring
#objectCode, x, y, rotation = values
self.room.sendAllOthers(self, eventTokens, [self.playerCode] + values)

elif eventToken2 == "\x09":
#end conjouring?
self.room.sendAllOthers(self, eventTokens, [self.playerCode])

elif eventToken2 == "\x0E":
# "Demande_Creation_Clou"
#pass

self.room.sendAll(eventTokens, values)

elif eventToken2 == "\x0F":
# "Demande_Creation_Sol"
#pass

self.room.sendAll(eventTokens, values)

elif eventToken2 == "\x10":
# "Demande_Deplacement_Fromage"
#x, y = values

self.room.sendAll(eventTokens, values)

elif eventToken2 == "\x11":
# "Demande_Explosion"
#pass

self.room.sendAll(eventTokens, values)

elif eventToken2 == "\x12":
#Mouse got cheese into hole!
objectID, = values

self.isDead = True

self.room.numCompleted += 1
place = self.room.numCompleted

timeTaken = int( (time.time() - self.room.gameStartTime)*10 )

#Score shit
playerscorep = self.score
if place==1:
playerscorep = playerscorep+16
elif place==2:
playerscorep = playerscorep+14
elif place==3:
playerscorep = playerscorep+12
else:
playerscorep = playerscorep+10
if self.isShaman==True:
playerscorep = 0
self.score = playerscorep
#end

if self.room.numCompleted==1:
if self.Tellfirsttime == 1:
modsendmessage = 'First en %d dixiemes de secondes' % (timeTaken)
self.room.informAll(TransformiceClientHandler.send ModMessage, ["~First", modsendmessage])

self.room.informAll(TransformiceClientHandler.send PlayerGotCheese, [self.playerCode, self.score, place, timeTaken])

#h
self.room.stateRecorder.logMessage(TransformiceCli
entHandler.sendPlayerGotCheese, [self.playerCode, self.score, place,
timeTaken])

self.room.checkShouldChangeWorld()

elif eventToken2 == "\x13":
#client thinks he has cheese
#pass

#sendAll will confirm it to the client :/
self.room.sendAll(eventTokens, [self.playerCode])

self.room.stateRecorder.log(eventTokens, [self.playerCode])

elif eventToken2 == "\x14":
#object finalise conjouring
#objectCode, x, y, rotation, unkn1, unkn2, isSolid = values

self.room.sendAllOthers(self, eventTokens, [self.playerCode] + values)


elif eventToken2 == "\x15":
# "Creation_Objet_Monde" - world object creation
#objectCode, x, y, unkn1, unkn2, unkn3, unkn4 = values

#if self.isSyncroniser:
self.room.sendAllOthers(self, eventToken1 + "\x14", values)
elif eventToken2 == "\x16":
# "Demande_Changement_Gravite"
#gx, gy = values

#if self.isSyncroniser:
self.room.sendAll(eventTokens, values)

else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens
elif eventToken1 == "\x14":
if eventToken2 == "\x14":
#open shop

#do something here
pass
elif eventToken1 == "\x18":
if eventToken2 == "\x0F":
#open forums

#do something here
pass
else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens
elif eventToken1 == "\x08":
if eventToken2 == "\x0D":
#open friends
pass
elif eventToken2 == "\x10":
#attach baloon to player
#playerCode, = values
self.room.sendAll(eventTokens, values)
elif eventToken2 == "\x11":
#baloon detatched
self.room.sendAllOthers(self, "\x08\x10", [self.playerCode, "0"]) #unknown??
else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens
elif eventToken1 == "\x19":
if eventToken2 == "\x03":
#Clear drawing
self.room.sendAllOthers(self, eventTokens, values)
elif eventToken2 == "\x04":
#Start drawing
#x,y = values
self.room.sendAllOthers(self, eventTokens, values)
elif eventToken2 == "\x05":
#Draw point
#x,y = values
self.room.sendAllOthers(self, eventTokens, values)
else:
logging.warning("Unimplemented %r" % eventTokens)
else:
logging.warning("Unimplemented %r" % eventTokens)
#raise NotImplementedError, eventTokens


def handle_close(self):
if self.room:
self.room.removeClient(self)
self.close()


def getLook(self):
return "0,0"

def sendData(self, eventCodes, data = None):
if VERBOSE:
logging.debug("Send %r %r" % (eventCodes, data))

if data:
self.push('\x01'.join(map(str, [eventCodes] + data)) + "\x00")
else:
self.push(eventCodes + "\x00")

def sendCorrectVersion(self):
self.sendData("\x1A" + "\x1B",
[str(self.server.getConnectedPlayerCount()), "0123456789", "0"] #MDT, CMDTEC
)

def sendTitleList(self):
self.sendData("\x08" + "\x0F",
["0"]
)

def sendPlayerLoginData(self):
self.sendData("\x1A" + "\x08",
[self.username, str(self.playerCode), str(self.privilegeLevel)]
)

def sendEnterRoom(self, roomName):
self.sendData("\x05" + "\x15",
[str(roomName)]
)

def sendNewParty(self):
self.sendData("\x05" + "\x05",
[self.room.currentWorld, self.room.getPlayerCount(), 1] #time remaining?
)
def sendPlayerList(self):
self.sendData("\x08" + "\x09",
list(self.room.getPlayerList())
)

def sendNewPlayer(self, playerData):
self.sendData("\x08" + "\x08",
[playerData]
)

def sendPlayerDisconnect(self, playerCode):
self.sendData("\x08" + "\x07",
[playerCode]
)
def sendPlayerDied(self, playerCode, score):
score = score-1
if score < 0:
score = 0
self.score=score
self.sendData("\x08" + "\x05",
[playerCode, 0, score] # unkn (num left?), score
)
def sendPlayerGotCheese(self, playerCode, score, place, timeTaken):
self.sendData("\x08" + "\x06",
[playerCode, 0, score, place, timeTaken] #unkn (num left?), score, place, time
)

def sendShamanCode(self, shamanPlayerCode):
self.sendData("\x08" + "\x14",
[shamanPlayerCode]
)
def sendSynchroniser(self, playerCode):
self.sendData("\x08" + "\x15",
[playerCode]
)

def sendSetAnchors(self, anchors):
self.sendData("\x05" + "\x07",
anchors
)

def sendATEC(self):
self.sendData("\x1A" + "\x1A")
def sendPING(self):
self.sendData("\x04" + "\x14")

def sendShamanPerformance(self, shamanName, numGathered):
#Will display "Info_Fromage_Chamane" in chat
# - "Merci a self.sendData("\x08" + "\x11",
[shamanName, numGathered]
)

def sendPlayerAction(self, playerCode, action):
self.sendData("\x08" + "\x16",
[playerCode, action]
)

def sendModMessage(self, name, message):
self.sendData("\x1A" + "\x05",
[name, message]
)
def sendServerMessage(self, message):
self.room.sendWholeServer(self, "\x1A\x04", ["[~Message serveur] ", message])



def sendPlayMusic(self, path):
self.sendData("\x1A" + "\x0C",
[path]
)


def sendSentPrivMsg(self, username, message):
self.sendData("\x06" + "\x07",
[message, username]
)
def sendRecievePrivMsg(self, username, message):
self.sendData("\x06" + "\x07",
[message, username, "x"]
)
def sendPlayerNotFound(self):
self.sendData("\x06" + "\x07")


def getPlayerData(self):
return '#'.join(map(str,
#has cheese #avatar?
[self.username, self.playerCode, int(self.isDead), self.score, 0, self.titleNumber, 0, self.getLook()]
))

def enterRoom(self, roomName):

if self.room:
self.room.removeClient(self)

self.resetPlay()
self.score = 0

self.sendEnterRoom(roomName)

#self.room =
self.server.addClientToRoom(self, roomName)


def resetPlay(self):
self.isShaman = False
self.isDead = False
self.isSyncroniser = False

def startPlay(self):
self.resetPlay()

self.sendNewParty()
self.sendPlayerList()

shamanCode = self.room.getShamanCode()
if self.room.everybodyIsShaman:
self.sendShamanCode(self.playerCode)
elif self.room.nobodyIsShaman:
self.sendShamanCode(0)
elif self.room.properNoShamanMaps:
if self.room.currentWorld==7:
self.sendShamanCode(0)
elif self.room.currentWorld==8:
self.sendShamanCode(0)
elif self.room.currentWorld==54:
self.sendShamanCode(0)
elif self.room.currentWorld==55:
self.sendShamanCode(0)
elif self.room.currentWorld==57:
self.sendShamanCode(0)
elif self.room.currentWorld==70:
self.sendShamanCode(0)
elif self.room.currentWorld==77:
self.sendShamanCode(0)
elif self.room.currentWorld==78:
self.sendShamanCode(0)
elif self.room.currentWorld==87:
self.sendShamanCode(0)
elif self.room.currentWorld==88:
self.sendShamanCode(0)
elif self.room.currentWorld==89:
self.sendShamanCode(0)
elif self.room.currentWorld==92:
self.sendShamanCode(0)
elif self.room.currentWorld==99:
self.sendShamanCode(0)
elif self.room.currentWorld==1007:
self.sendShamanCode(0)
else:
self.sendShamanCode(shamanCode)
else:
self.sendShamanCode(shamanCode)

if shamanCode == self.playerCode:
self.isShaman = True

syncroniserCode = self.room.getSyncroniserCode()
self.sendSynchroniser(syncroniserCode)
if syncroniserCode == self.playerCode:
self.isSyncroniser = True
if self.username == "Timekeeper":
self.isDead = True
self.room.informAll(TransformiceClientHandler.send PlayerDied, [self.playerCode, self.score])



def login(self, username, passwordHash):

if username == "":
username = "Souris"

if username == "Nickname":
username = "Souris"

if username == "Yellow":
username = "[~Yellow~]"

if username == "Melibellule":
username = "[~Melibellule~]"

if username == "Tigrounette":
username = "[~Tigrounette~]"

if username == "Modogeek":
username = "[~Modogeek~]"

if username == "Jonathan":
username = "[~Jonathan~]"

if username == "Tigrounette":
username = "[~Tigrounette~]"

logging.info("Authenticate %s - %s %s" % (self.address, username, passwordHash))

priv = self.server.authenticate(username, passwordHash)
if priv == -1:
#return False
self.close()

else:
self.username = username

self.playerCode = self.server.generatePlayerCode()
self.privilegeLevel = priv
#self.titleNumber = 0
if self.username == "Phoenix":
self.titleNumber = 440
elif self.username == "Admin":
self.titleNumber = 440
elif self.username == "Yellow":
self.titleNumber = 444
else:
self.titleNumber = 102


self.sendTitleList()
self.sendPlayerLoginData()

self.enterRoom(self.server.recommendRoom())

return True


class TransformiceAdminTools(object):
def __init__(self, server):
self.server = server
def sendModMessage(self, message):
for room in self.server.rooms.itervalues():
room.informAll(TransformiceClientHandler.sendModMe ssage, [ADMIN_NAME, message])
def playMusicInRoom(self, roomName, path):
roomName = str(roomName)
if self.server.rooms.has_key(roomName):
self.server.rooms[roomName].playMusic(path)


#from Basic HTTP Authentication with XMLRPC in Python
class VerifyingXMLRPCServer(SimpleXMLRPCServer):
def __init__(self, *args, **kargs):
# we use an inner class so that we can call out to the
# authenticate method
class VerifyingRequestHandler(SimpleXMLRPCRequestHandler ):
# this is the method we must override
def parse_request(myself):
# first, call the original implementation which returns
# True if all OK so far
if SimpleXMLRPCRequestHandler.parse_request(myself):
# next we authenticate
if self.authenticate(myself.headers):
return True
else:
# if authentication fails, tell the client
myself.send_error(401, 'Authentication failed')
return False
# and intialise the superclass with the above
SimpleXMLRPCServer.__init__(self, requestHandler=VerifyingRequestHandler, *args, **kargs)

def authenticate(self, headers):
basic, _, encoded = headers.get('Authorization').partition(' ')
assert basic == 'Basic', 'Only basic authentication supported'
username, _, password = base64.b64decode(encoded).partition(':')

return username.lower() in ADMIN_NAMES and hashlib.sha256(password).hexdigest() == ADMIN_HASH

if __name__ == "__main__":
TEST = False
server = TransformiceServer()

adminTools = TransformiceAdminTools(server)

rpcServer = VerifyingXMLRPCServer(('', 1110), allow_none=True)
rpcServer.register_introspection_functions()
rpcServer.register_instance(adminTools, True)
thread.start_new_thread(rpcServer.serve_forever, ())

asyncore.loop()

//source no spoiler^^ //

1 - Quando você tiver a source em *.py - Você terá que transforma-la em uma db, no caso poderia ser:
Ex.: Transformice.py.db
Algo
assim, e para transforma-la em db é preciso do SQLite, assim que pegar a
db, você ira baixar o vertrigo (para acessar o phpmyadmin).
2- Assim
que baixar o vertrigo, você irá abri-lo e clicar em "Start Host" depois
voce vai em: phpmyadmin (como se fosse entrar em um site).
3- Você irá criar um novo banco de dados com esse nome:
Transformice DB
4-
O site irá redirecionar você para uma outra página nele você ira na aba
"Importar" e colocará a db que criamos no caso: Transformice.py.db
5-
Irá criar muitas, muitas, muitas tabelas você irá em "Ip, Host" e ali
você colocará o seu IP e a Port do servidor ( Recomenda-se uma TCP ).
6- Depois você entra no site com seu numero de ip.
Ex.: [Você precisa estar registrado e conectado para ver este link.]
7-
Logo você se registra, e volta no phpmyadmin, dai você procura a tabela
"Users" ou "Usuarios" ou "Registros" e ali você ira achar um "registro"
com seu usuario ( que voce cadastrou no transformice, no site do seu ip
). Dai voce clica em um "lapizinho" e procura "rank" e você poem o
numero 5 ali.
Pronto você e fundador do seu servidor de transformice.

RANKS:

1 -Usuario
2 -Moderador
3 -Administrador aprendiz
4 -Administrador
5 -Fundador
8-
Para dar queijos você procura a tabela "infos" ou "queijos" e clique no
"lapizinho" do lado do nome de quem você quer dar queijos e procure
"Stats" ali você poem o numero de queijos que você quer dar para a
pessoa.


ATENÇÃO: Se for dar queijo para todo server entra na tabela "all" e faça isso.

Creditos :
Caio
TransformiceHackBrasil > Por disponibilizar ao publico
o texto de 18 anos! Ignore so a idade , mais usem com moderação ! Ou poderam levar cadeia.


Última edição por ●•LevYϟ em Qui Jan 12, 2012 1:59 pm, editado 1 vez(es)


[Você precisa estar registrado e conectado para ver esta imagem.][Você precisa estar registrado e conectado para ver esta imagem.]

Heaven ♪
Administrador
Administrador

Posts Posts: 224
Moedas Moedas: 500
Respeitos Respeitos: 14
Tickets Tickets: 539
Emblemas Emblemas:


Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por Meex. em Sab Nov 12, 2011 8:59 pm

Bom tutorial, levou meu +


[Você precisa estar registrado e conectado para ver esta imagem.]
[Você precisa estar registrado e conectado para ver esta imagem.]


[Você precisa estar registrado e conectado para ver esta imagem.]igor-uchoa@hotmail.com
Identifique-se, por favor.


Siga-me
[Você precisa estar registrado e conectado para ver esta imagem.]

#Sou fã:
Ninguém, sou um troll muahaha.


#Gift's:
[Você precisa estar registrado e conectado para ver esta imagem.]

[Você precisa estar registrado e conectado para ver esta imagem.]

Meex.
Administrador
Administrador

Posts Posts: 66
Moedas Moedas: 500
Respeitos Respeitos: 16
Tickets Tickets: 208
Emblemas Emblemas:


Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por Sub-Zero em Qua Nov 16, 2011 3:18 pm

Muito bom,mas a instrução de como fazer,podia ficar no começo mas tudo bem.

Sub-Zero
Novato
Novato

Posts Posts: 25
Moedas Moedas: 50
Respeitos Respeitos: 6
Tickets Tickets: 7

Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por *~Netz em Qua Jan 11, 2012 5:12 pm

Podia botar com um spoller pro tópic não ficar muito grande, mais levou meu thanks!

*~Netz
Novato
Novato

Posts Posts: 3
Moedas Moedas: 50
Respeitos Respeitos: 0
Tickets Tickets: 3

Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por PequenaAbelha em Qui Jan 12, 2012 2:19 am

*~Netz escreveu:Podia botar com um spoller pro tópic não ficar muito grande, mais levou meu thanks!
Agora está com spoiler!


PequenaAbelha
Administrador
Administrador

Posts Posts: 45
Moedas Moedas: 1
Respeitos Respeitos: 5
Tickets Tickets: 89

Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por Daηiel Ravagnołłi em Qui Fev 02, 2012 9:07 pm

Adorei o Tutorial.

@Off THB é THB não tem igual Troll Dance

Daηiel Ravagnołłi
Novato
Novato

Posts Posts: 33
Moedas Moedas: 40
Respeitos Respeitos: 1
Tickets Tickets: 34

Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por Soul em Sex Fev 03, 2012 3:42 pm

Muito bom Mas não Explico Muito Detalhado Mas ganho Meu +
So que é da Thb Mas ta Valendo

Soul
Novato
Novato

Posts Posts: 8
Moedas Moedas: 50
Respeitos Respeitos: 0
Tickets Tickets: 14

Ver perfil do usuário

Voltar ao Topo Ir em baixo

icon1 Re: Criando Transformice Pirata [Source 0.55]

Mensagem por Royal em Dom Fev 05, 2012 10:11 pm

Bom tutu

Royal
Novato
Novato

Posts Posts: 15
Moedas Moedas: 50
Respeitos Respeitos: 1
Tickets Tickets: 20

Ver perfil do usuário

Voltar ao Topo Ir em baixo

Página 1 de 2 1, 2  Seguinte

Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo

- Tópicos similares

Permissão deste fórum:
Você não pode responder aos tópicos neste fórum