domingo, 3 de junho de 2012

Editor de Mapa Versão 1.39


Editor de Mapas Version 1.39
Algumas partes ta meio confusa de intender, mas que conseguir vai fikar phoda D:


Abra a source e procure por:

def ParseOldPacket (self, data) 

adiciona nessa seção:

elif Opcode1 == «\x0E»: 

E dentro dele:
 
if Opcode2 == «\x0A»:
# Testing the map
xml = Values ​​[0] # values ​​= split \ x01
code = str(random.randint(0, 555555555)) # Generate code map
self.Server.CreateMap(self.Name, code, xml) # The information database
self.sendDataUTF(«\x0E» + «\x05", [code]) # plate with a code card, successfully created
elif Opcode2 == "\x1A":
# Exit from the editor
self.sendDataUTF("\ x0E" + "\ x0E", ["0"]) #exit
self.GotoRoom("1") # pass in a room 1 

Em Class Server ou Servidor adiciona essa função:
 
def CreateMap(self, username, code, xml):
self.Database.execute("""INSERT INTO! VMaps (! MCreator,! MXML,! MID,! MPermanent) VALUES (?,?,?, 0);""", [username, xml, code])
self.Database.commit ()
return 0 

É isso, o editor está pronto. Ao testar o mapa uma vez que é verificado e adicionado à base de dados. Você pode executar a função:

def changeMapCc (self, map_number):
if map_number.startswith ("@"):
isCustom = True
else:
isCustom = False
for code, client in self.Clients.iteritems ():
client.ResetPlay ()
self.SendShamanPerformance ()
self.World = map_number
self.RoundCode + = 1
self.Mice_Saved = 0
self.Sync_Code = self.GetNewSync ()
self.Shaman_Code = self.GetNewShaman ()
self.Clients [self.Shaman_Code]. isShaman = True
self.Clients [self.Sync_Code]. isSync = True
self.Start_Time = time.time ()
self.WorldChange_Timer = reactor.callLater (120, self.ChangeMapRandom)
for code, client in self.Clients.iteritems ():
client.StartPlay (isCustom, False)
client.sendRemainingTime (120)
self.Start_Time = time.time ()
self.Mice_Saved = 0 

E substituindo a SendNewParty anterior para:

def sendNewParty (self, isCustom = False):
if isCustom:
self.Database.execute ("SELECT Creator, XML, Permanent, ID FROM Maps WHERE ID =?", [self.Room.World.replace ("@", "")])
infos_map = self.Database.fetchone ()
self.sendDataUTF ("\ x05 \ x05", ['@' + str (infos_map [3]), self.Room.GetPlayerCount (), self.Room.RoundCode, "\ x01" + infos_map [1] + "\ x02 "+ infos_map [0] +" \ x02 "+ str (infos_map [2])])
else:
self.sendDataUTF ("\ x05 \ x05", [self.Room.World, self.Room.GetPlayerCount (), self.Room.RoundCode]) 





Creditos: #Cheese
Somente ao Cheese pois a Tradução eu que Fiz ./.

0 comentários:

Postar um comentário

:a   :b   :c   :d   :e   :f   :g   :h   :i   :j   :k   :l   :m   :n   :o   :p   :q   :r   :s   :t