Jump to content

Erro Na Skin Cliente


Guest KemazI
 Share

Recommended Posts

Guest KemazI

Boas, estou com um erro no cliente que ao seleccionar a 2ª aparência não grava e fica com a 1ª

 

GIF-

 

giphy.gif

 

Obrigado

Link to comment
Share on other sites

Guest KemazI

 

Coloca aqui o introcreate.py sff

 

 

import chr

import grp

import app

import net

import snd

import wndMgr

import event

import systemSetting

import localeInfo

import constInfo

import ui

import networkModule

import math

import snd

import musicInfo

import playerSettingModule

import uiScriptLocale

import uiToolTip

 

LOCALE_PATH = "uiscript/"+uiScriptLocale.CODEPAGE+"_"

 

MAN = 0

WOMAN = 1

SHAPE0 = 0

SHAPE1 = 1

PAGE_COUNT = 2

SLOT_COUNT = 4

BASE_CHR_ID = 3

 

class CreateCharacterWindow(ui.Window):

 

class CharacterRenderer(ui.Window):

def OnRender(self):

grp.ClearDepthBuffer()

 

grp.SetGameRenderState()

grp.PushState()

grp.SetOmniLight()

 

screenWidth = wndMgr.GetScreenWidth()

screenHeight = wndMgr.GetScreenHeight()

newScreenWidth = float(screenWidth+30)

newScreenHeight = float(screenHeight+30)

 

grp.SetViewport(270.0/screenWidth, 0.0, newScreenWidth/screenWidth, newScreenHeight/screenHeight)

 

app.SetCenterPosition(30.0, -40.0, -45.0)

app.SetCamera(1500.0, 15.0, 180.0, 90.0)

grp.SetPerspective(11.0, newScreenWidth/newScreenHeight, 1000.0, 3000.0)

 

(x, y) = app.GetCursorPosition()

grp.SetCursorPosition(x, y)

 

chr.Deform()

chr.Render()

 

grp.RestoreViewport()

grp.PopState()

grp.SetInterfaceRenderState()

 

def __init__(self, stream):

ui.Window.__init__(self)

net.SetPhaseWindow(net.PHASE_WINDOW_CREATE, self)

 

self.stream = stream

 

def __del__(self):

print "---------------------------------------------------------------------------- DELETE CREATE WINDOW"

 

net.SetPhaseWindow(net.PHASE_WINDOW_CREATE, 0)

ui.Window.__del__(self)

 

def Open(self):

print "OPEN CREATE WINDOW ----------------------------------------------------------------------------"

 

playerSettingModule.LoadGameData("INIT")

 

self.reservingRaceIndex = -1

self.reservingShapeIndex = -1

self.reservingHairstyleIndex = -1

self.reservingStartTime = 0

 

self.gender = 0

self.slot = -1

self.hairID = 0

self.hairstyles = {}

self.shapeList = [

[0, 0, 0, 0],

[0, 0, 0, 0]]

 

try:

dlgBoard = ui.ScriptWindow()

pythonScriptLoader = ui.PythonScriptLoader()

pythonScriptLoader.LoadScriptFile(dlgBoard, uiScriptLocale.LOCALE_UISCRIPT_PATH + "createcharacterwindow.py")

 

except:

import exception

exception.Abort("CreateCharacterWindow.Open.LoadObject")

 

try:

getChild = dlgBoard.GetChild

 

self.btnCreate = getChild("enter_button")

self.btnCancel = getChild("exit_button")

self.btnLeft = getChild("left_button")

self.btnRight = getChild("right_button")

self.editCharacterName = getChild("name")

 

self.genderButtonList = []

self.genderButtonList.append(getChild("man"))

self.genderButtonList.append(getChild("woman"))

 

self.hair = getChild("hair_text")

 

getChild("left_hair").SetEvent(ui.__mem_func__(self.HairEvent), 0)

getChild("right_hair").SetEvent(ui.__mem_func__(self.HairEvent), 1)

 

self.backGround = getChild("BackGround")

 

except:

import exception

exception.Abort("CreateCharacterWindow.Open.BindObject")

 

 

self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacter))

self.btnCancel.SetEvent(ui.__mem_func__(self.CancelCreate))

self.btnLeft.SetEvent(ui.__mem_func__(self.__DecreaseSlotIndex))

self.btnRight.SetEvent(ui.__mem_func__(self.__IncreaseSlotIndex))

 

self.genderButtonList[0].SetEvent(ui.__mem_func__(self.__SelectGender), MAN)

self.genderButtonList[1].SetEvent(ui.__mem_func__(self.__SelectGender), WOMAN)

 

 

self.editCharacterName.SetReturnEvent(ui.__mem_func__(self.CreateCharacter))

self.editCharacterName.SetEscapeEvent(ui.__mem_func__(self.CancelCreate))

 

self.dlgBoard = dlgBoard

 

self.chrRenderer = self.CharacterRenderer()

self.chrRenderer.SetParent(self.backGround)

self.chrRenderer.Show()

 

self.editCharacterName.SetText("")

self.selected = 0

 

self.characters = {

0 : [playerSettingModule.RACE_WARRIOR_M, playerSettingModule.RACE_ASSASSIN_M, playerSettingModule.RACE_SURA_M, playerSettingModule.RACE_SHAMAN_M],

1 : [playerSettingModule.RACE_WARRIOR_W, playerSettingModule.RACE_ASSASSIN_W, playerSettingModule.RACE_SURA_W, playerSettingModule.RACE_SHAMAN_W]}

 

self.EnableWindow()

self.__SelectSlot(app.GetRandom(1,2))

 

app.SetCamera(500.0, 10.0, 180.0, 95.0)

 

self.__SelectGender(0)

 

self.dlgBoard.Show()

self.Show()

 

if musicInfo.createMusic != "":

snd.SetMusicVolume(systemSetting.GetMusicVolume())

snd.FadeInMusic("BGM/"+musicInfo.createMusic)

 

app.ShowCursor()

 

def Close(self):

print "---------------------------------------------------------------------------- CLOSE CREATE WINDOW"

 

self.editCharacterName.Enable()

self.dlgBoard.ClearDictionary()

self.reservingHairstyleIndex = -1

self.stream = 0

self.genderButtonList = []

self.btnCreate = 0

self.btnCancel = 0

self.btnLeft = 0

self.btnRight = 0

self.editCharacterName = 0

self.backGround = None

 

if musicInfo.createMusic != "":

snd.FadeOutMusic("BGM/"+musicInfo.createMusic)

 

for id in xrange(BASE_CHR_ID + SLOT_COUNT * PAGE_COUNT):

chr.DeleteInstance(id)

 

self.dlgBoard.Hide()

self.Hide()

 

app.HideCursor()

event.Destroy()

 

def EnableWindow(self):

self.reservingRaceIndex = -1

self.reservingShapeIndex = -1

self.btnCreate.Enable()

self.btnCancel.Enable()

self.btnLeft.Enable()

self.btnRight.Enable()

 

self.genderButtonList[0].Enable()

self.genderButtonList[1].Enable()

 

self.editCharacterName.SetFocus()

self.editCharacterName.Enable()

 

for page in xrange(PAGE_COUNT):

for slot in xrange(SLOT_COUNT):

chr_id = self.__GetSlotChrID(page, slot)

chr.SelectInstance(chr_id)

chr.BlendLoopMotion(chr.MOTION_INTRO_WAIT, 0.1)

 

self.woman_sel = 0

 

def DisableWindow(self):

self.btnCreate.Disable()

self.btnCancel.Disable()

self.btnLeft.Disable()

self.btnRight.Disable()

self.editCharacterName.Disable()

 

self.genderButtonList[0].Disable()

self.genderButtonList[1].Disable()

 

self.btnCreate.SetUp()

 

def __GetSlotChrID(self, page, slot):

return BASE_CHR_ID + page * SLOT_COUNT + slot

 

def __MakeCharacter(self,chr_id,race):

 

chr.CreateInstance(chr_id)

chr.SelectInstance(chr_id)

chr.SetVirtualID(chr_id)

 

chr.SetRace(race)

chr.SetArmor(0)

chr.SetHair(0)

 

chr.Refresh()

chr.SetMotionMode(chr.MOTION_MODE_GENERAL)

chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)

 

chr.SetRotation(0.0)

chr.Hide()

 

def __SelectGender(self, gender):

for button in self.genderButtonList:

button.SetUp()

 

self.genderButtonList[gender].Down()

self.gender -=1

 

if self.gender <= -1:

self.gender=1

 

t = ['Masculino', "Feminino"]

self.dlgBoard.GetChild("gender_text").SetText(t[self.gender])

 

if self.gender == MAN:

for i in xrange(SLOT_COUNT):

chr.SelectInstance(self.__GetSlotChrID(0, i))

chr.Show()

for i in xrange(SLOT_COUNT):

chr.SelectInstance(self.__GetSlotChrID(1, i))

chr.Hide()

else:

for i in xrange(SLOT_COUNT):

chr.SelectInstance(self.__GetSlotChrID(0, i))

chr.Hide()

for i in xrange(SLOT_COUNT):

chr.SelectInstance(self.__GetSlotChrID(1, i))

chr.Show()

 

for id in xrange(BASE_CHR_ID + SLOT_COUNT * PAGE_COUNT):

chr.DeleteInstance(id)

 

chr_id = self.__GetSlotChrID(self.gender, self.slot)

self.__MakeCharacter(chr_id, self.characters[self.gender][self.slot])

self.__LoadHairstyle(self.slot)

self.Update()

 

def GetSlotIndex(self):

return self.slot

 

def __SelectSlot(self, slot):

 

if slot < 0:

return

 

if slot >= SLOT_COUNT:

return

 

if self.slot == slot:

return

 

self.slot = slot

 

if self.IsShow():

snd.PlaySound("sound/ui/click.wav")

 

chr_id = self.__GetSlotChrID(self.gender, slot)

 

for id in xrange(BASE_CHR_ID + SLOT_COUNT * PAGE_COUNT):

chr.DeleteInstance(id)

 

chr.SelectInstance(chr_id)

 

self.__MakeCharacter(chr_id, self.characters[self.gender][slot])

self.__LoadHairstyle(slot)

 

self.Update()

 

def Update(self):

t = {

0 : ['warrior', 'assassin', 'sura', 'shaman'],

1 : ['m', 'w'],

}

 

self.dlgBoard.GetChild("title").LoadImage("locale/tr/ui/createcharacterwindow/%s.tga" % t[0][self.slot])

self.dlgBoard.GetChild("desc").LoadImage("locale/tr/ui/createcharacterwindow/desc_%s.tga" % t[0][self.slot])

self.dlgBoard.GetChild("character").LoadImage("locale/tr/ui/createcharacterwindow/desc_%s_%s.tga" % (t[0][self.slot], t[1][self.gender]))

self.dlgBoard.GetChild("character_main").LoadImage("locale/tr/ui/createcharacterwindow/%s_%s.tga" % (t[0][self.slot], t[1][self.gender]))

 

def CreateCharacter(self):

 

if -1 != self.reservingRaceIndex:

return

 

textName = self.editCharacterName.GetText()

if False == self.__CheckCreateCharacter(textName):

return

 

if musicInfo.selectMusic != "":

snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)

 

self.DisableWindow()

 

chr_id = self.__GetSlotChrID(self.gender, self.slot)

 

chr.SelectInstance(chr_id)

 

self.reservingRaceIndex = chr.GetRace()

self.reservingShapeIndex = self.shapeList[self.gender][self.slot]

self.reservingStartTime = app.GetTime()

try:

self.reservingHairstyleIndex = self.hairstyles[self.GetSlotIndex()]

except:

self.reservingHairstyleIndex = 0

 

self.selected = 1

 

for eachSlot in xrange(SLOT_COUNT):

 

sel_id = self.__GetSlotChrID(self.gender, eachSlot)

 

chr.SelectInstance(sel_id)

chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED)

 

def CancelCreate(self):

self.stream.SetSelectCharacterPhase()

 

def __DecreaseSlotIndex(self):

if self.selected == 0:

slotIndex = (self.GetSlotIndex() - 1 + SLOT_COUNT) % SLOT_COUNT

self.__SelectSlot(slotIndex)

 

def __IncreaseSlotIndex(self):

if self.selected == 0:

slotIndex = (self.GetSlotIndex() + 1) % SLOT_COUNT

self.__SelectSlot(slotIndex)

 

 

def HairEvent(self, i):

 

self.hairID -= 1

 

 

if self.hairID <= -1:

self.hairID=1

 

chr_id = self.__GetSlotChrID(self.gender, self.slot)

chr.SelectInstance(chr_id)

job = chr.RaceToJob(chr.GetRace())

chr.ChangeShape(self.hairID)

chr.SetMotionMode(chr.MOTION_MODE_GENERAL)

chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)

 

if self.hairID == 0:

self.hair.SetText("Aparencia 1")

elif self.hairID == 1:

self.hair.SetText("Aparencia 2")

 

 

 

def __LoadHairstyle(self, slotIndex):

try:

if self.hairstyles[slotIndex]:

self.HairEvent(13)

except KeyError:

self.hairID = 0

 

def __CheckCreateCharacter(self, name):

if len(name) == 0:

self.PopupMessage(localeInfo.CREATE_INPUT_NAME, self.EnableWindow)

return False

 

if name.find(localeInfo.CREATE_GM_NAME)!=-1:

self.PopupMessage(localeInfo.CREATE_ERROR_GM_NAME, self.EnableWindow)

return False

 

if net.IsInsultIn(name):

self.PopupMessage(localeInfo.CREATE_ERROR_INSULT_NAME, self.EnableWindow)

return False

 

return True

 

def OnCreateSuccess(self):

self.stream.SetSelectCharacterPhase()

 

def OnCreateFailure(self, type):

if 1 == type:

self.PopupMessage(localeInfo.CREATE_EXIST_SAME_NAME, self.EnableWindow)

else:

self.PopupMessage("Verifique o nome e aguarde 30s", self.EnableWindow)

 

def OnUpdate(self):

chr.Update()

 

for page in xrange(PAGE_COUNT):

for i in xrange(SLOT_COUNT):

chr.SelectInstance(self.__GetSlotChrID(page, i))

chr.Show()

 

if -1 != self.reservingRaceIndex:

if app.GetTime() - self.reservingStartTime >= 1.5:

 

chrSlot=self.stream.GetCharacterSlot()

textName = self.editCharacterName.GetText()

raceIndex = self.reservingRaceIndex

shapeIndex = self.reservingShapeIndex

hairstyleIndex = self.reservingHairstyleIndex

statCon = 5

statInt = 5

statStr = 5

statDex = 5

net.SendCreateCharacterPacket(chrSlot, textName, raceIndex, shapeIndex, statCon, statInt, statStr, statDex)

 

self.reservingRaceIndex = -1

 

def EmptyFunc(self):

pass

 

def PopupMessage(self, msg, func=0):

if not func:

func=self.EmptyFunc

 

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)

 

def OnPressExitKey(self):

self.CancelCreate()

return True

 

 

Link to comment
Share on other sites

  • 5 months later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...