def __SelectGender(self, gender): for button in self.genderButton: button.SetUp() self.genderButton[gender].Down() self.gender = gender if 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.__SelectShape(self.shape)
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() for eachSlot in xrange(SLOT_COUNT[self.gender]): sel_id = self.__GetSlotChrID(self.gender, eachSlot) chr.SelectInstance(sel_id) if eachSlot == self.slot: chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED) else: chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED)
def __SelectSlot(self, slot): if slot < 0: return if slot >= SLOT_COUNT: return if self.slot == slot: return self.slot = slot constInfo.SLOTCH = slot self.ResetStat() for i in xrange(SLOT_COUNT): self.destNameAlpha[i] = 0.0 self.destNameAlpha[slot] = 1.0 for i in xrange(SLOT_COUNT): self.destRotation[(i+self.slot)%SLOT_COUNT] = self.SLOT_ROTATION[i] if self.IsShow(): snd.PlaySound("sound/ui/click.wav") event.ClearEventSet(self.descIndex) self.descIndex = event.RegisterEventSet(self.DESCRIPTION_FILE_NAME[self.slot]) if localeInfo.IsARABIC(): event.SetEventSetWidth(self.descIndex, 170) chr.SelectInstance(self.__GetSlotChrID(0, 0)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(0, 1)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(0, 2)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(0, 3)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 0)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 1)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 2)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 3)) chr.Hide() chr_id = self.__GetSlotChrID(self.gender, slot) if chr.HasInstance(chr_id): chr.SelectInstance(chr_id) self.__SelectShape(self.shapeList[self.gender][slot]) chr.Show()
def __MakeCharacter(self, race, x, y): nonplayer.GetEventType(1) nonplayer.GetGradeByVID(1) nonplayer.GetLevelByVID(100) nonplayer.GetMonsterName("SeMa Test") nonplayer.LoadNonPlayerData() chr.CreateInstance(race) chr.SetInstanceType(chr.INSTANCE_TYPE_NPC) chr.SelectInstance(race) chr.SetVirtualID(race) chr.SetRace(1) chr.SetNameString("Test SeMa") chr.Refresh() #chr.SetMotionMode(chr.MOTION_MODE_GENERAL) #chr.SetLoopMotion(chr.MOTION_MODE_GENERAL) chr.SetPixelPosition(x, y) chr.SetDirection(chr.DIR_SOUTHEAST) chr.SetMoveSpeed(300) chr.Render() grp.RestoreViewport() grp.PopState() grp.SetInterfaceRenderState() chr.Show()
def Open(self, vid, type=0): self.vid=int(vid) isPrivateShop = False isMainPlayerPrivateShop = False myshop=False for i in xrange(len(constInfo.MyShops)): if int(constInfo.MyShops[i]["vid"]) == int(self.vid): myshop=True self.vid=int(constInfo.MyShops[i]["id"]) chr.SelectInstance(self.vid) if chr.GetRace() == 30000 or not chr.IsNPC(self.vid): isPrivateShop = True if player.IsMainCharacterIndex(self.vid): myshop=True self.vid="" if myshop == True: isMainPlayerPrivateShop = True self.btnBuy.Hide() self.btnSell.Hide() self.btnClose.Show() else: isMainPlayerPrivateShop = False self.btnBuy.Show() self.btnSell.Show() self.btnClose.Hide() shop.Open(isPrivateShop, isMainPlayerPrivateShop) [..]
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) for i in xrange(len(self.char)): self.char[i].SetUp() self.char[slot].Down() self.__MakeCharacter(chr_id, self.characters[self.gender][slot]) self.__SelectShape(self.shape) self.__SelectGender(self.gender)
def EnableWindow(self): self.reservingRaceIndex = -1 self.reservingShapeIndex = -1 self.reservingHairstyleIndex = -1 self.btnCreate.Enable() self.btnExit.Enable() self.editCharacterName.SetFocus() self.editCharacterName.Enable() self.genderButton[0].Enable() self.genderButton[1].Enable() self.shapeButton[0].Enable() self.shapeButton[1].Enable() self.char[0].Enable() self.char[1].Enable() self.char[2].Enable() self.char[3].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)
def OnUpdate(self): chr.Update() for i in xrange(4): self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0 if abs(self.curGauge[i] - self.destGauge[i]) < 0.005: self.curGauge[i] = self.destGauge[i] # self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0) self.GaugeList[i].SetPercentage(min(self.curGauge[i], 0.5), 0.5) for i in xrange(self.CHARACTER_TYPE_COUNT): self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0 self.NameList[i].SetAlpha(self.curNameAlpha[i]) for i in xrange(self.SLOT_COUNT): if FALSE == chr.HasInstance(i): continue chr.SelectInstance(i) #distance = 50.0 #rotRadian = self.curRotation[i] * (math.pi*0) / 0.0 #x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian) #y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian) #chr.SetPixelPosition(int(x), int(y), 50) ##### #dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i]) #rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i]) #if app.DEGREE_DIRECTION_RIGHT == dir: # self.curRotation[i] += rot / 0.0 #elif app.DEGREE_DIRECTION_LEFT == dir: # self.curRotation[i] -= rot / 0.0 #self.curRotation[i] = (self.curRotation[i] + 0.0) % 0.0 ####################################################### if -1 != self.startIndex: ## Temporary ## BackGroundLoading이 지원 될때까지 임시로.. if app.GetTime() - self.startReservingTime > 3.0: if FALSE == self.openLoadingFlag: chrSlot = self.stream.GetCharacterSlot() GFHhg54GHGhh45GHGH.DirectEnter(chrSlot) self.openLoadingFlag = TRUE playTime = GFHhg54GHGhh45GHGH.GetAccountCharacterSlotDataInteger( self.slot, GFHhg54GHGhh45GHGH.ACCOUNT_CHARACTER_SLOT_PLAYTIME) import fgGHGjjFHJghjfFG1545gGG fgGHGjjFHJghjfFG1545gGG.SetPlayTime(playTime) import chat chat.Clear() ## 들어갈때 Chat 을 초기화. 임시 Pos.
def OnUpdate(self): chr.Update() for i in xrange(4): self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0 if abs(self.curGauge[i] - self.destGauge[i]) < 0.005: self.curGauge[i] = self.destGauge[i] self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0) for i in xrange(self.CHARACTER_TYPE_COUNT): self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0 self.NameList[i].SetAlpha(self.curNameAlpha[i]) for i in xrange(self.SLOT_COUNT): if FALSE == chr.HasInstance(i): continue chr.SelectInstance(i) distance = 50.0 rotRadian = self.curRotation[i] * (math.pi * 2) / 360.0 x = distance * math.sin(rotRadian) + distance * math.cos(rotRadian) y = distance * math.cos(rotRadian) - distance * math.sin(rotRadian) chr.SetPixelPosition(int(x), int(y), 30) ##### dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i]) rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i]) if app.DEGREE_DIRECTION_RIGHT == dir: self.curRotation[i] += rot / 10.0 elif app.DEGREE_DIRECTION_LEFT == dir: self.curRotation[i] -= rot / 10.0 self.curRotation[i] = (self.curRotation[i] + 360.0) % 360.0 ####################################################### if -1 != self.startIndex: ## Temporary ## BackGroundLoading이 지원 될때까지 임시로.. if app.GetTime() - self.startReservingTime > 3.0: if FALSE == self.openLoadingFlag: chrSlot = self.stream.GetCharacterSlot() net.DirectEnter(chrSlot) self.openLoadingFlag = TRUE playTime = net.GetAccountCharacterSlotDataInteger( self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME) import player player.SetPlayTime(playTime) import chat chat.Clear() ## 들어갈때 Chat 을 초기화. 임시 Pos.
def OnUpdate(self): chr.Update() (xposEventSet, yposEventSet) = self.textBoard.GetGlobalPosition() event.UpdateEventSet(self.descIndex, xposEventSet+7, -(yposEventSet+7)) self.descriptionBox.SetIndex(self.descIndex) for i in xrange(SLOT_COUNT[self.gender]): self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0 self.NameList[self.gender][i].SetAlpha(self.curNameAlpha[i]) for i in xrange(4): self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0 if abs(self.curGauge[i] - self.destGauge[i]) < 0.005: self.curGauge[i] = self.destGauge[i] self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0) for page in xrange(PAGE_COUNT): for i in xrange(SLOT_COUNT[page]): chr.SelectInstance(self.__GetSlotChrID(page, i)) distance = 50.0 rotRadian = self.curRotation[i] * (math.pi*2) / 360.0 x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian) y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian) chr.SetPixelPosition(int(x), int(y), 30) if abs(self.destRotation[i] - self.curRotation[i]) < 1.0: self.curRotation[i] = self.destRotation[i] dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i]) rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i]) if app.DEGREE_DIRECTION_RIGHT == dir: self.curRotation[i] += rot / 10.0 elif app.DEGREE_DIRECTION_LEFT == dir: self.curRotation[i] -= rot / 10.0 self.curRotation[i] = (self.curRotation[i] + 360.0) % 360.0 ########################################################### 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 startStat = self.START_STAT[self.reservingRaceIndex] statCon = self.stat[0] - startStat[0] statInt = self.stat[1] - startStat[1] statStr = self.stat[2] - startStat[2] statDex = self.stat[3] - startStat[3] net.SendCreateCharacterPacket(chrSlot, textName, raceIndex, shapeIndex, statCon, statInt, statStr, statDex) self.reservingRaceIndex = -1
def ScanPlayers(self): for x in net_packet.InstancesList: test = chr.HasInstance(x) chr.SelectInstance(x) if test != 0 and chr.GetRace( x) >= OpenLib.MIN_RACE_SHOP and chr.GetRace( x) <= OpenLib.MAX_RACE_SHOP: #chat.AppendChat(3,"Name: " + str(chr.GetNameByVID(x)) + " IsShop: " + str(chr.GetRace(x))) self.PlayersVids.append(x) self.UpdateLabelText() return True
def SearchVIDClosest(self): npcs = dict() for vid in net_packet.InstancesList: chr.SelectInstance(vid) curr_race = chr.GetRace() if self.race == curr_race: dist = player.GetCharacterDistance(vid) npcs[vid] = dist if len(npcs) == 0: return None min_vid = min(npcs.keys(), key=(lambda k: npcs[k])) return min_vid
def __SelectShape(self, shape): self.shapeList[self.gender][self.slot] = shape for button in self.shapeButtonList: button.SetUp() self.shapeButtonList[shape].Down() chr_id = self.__GetSlotChrID(self.gender, self.slot) chr.SelectInstance(chr_id) chr.ChangeShape(shape) chr.SetMotionMode(chr.MOTION_MODE_GENERAL) chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
def __SelectGender(self, gender): for button in self.genderButtonList: button.SetUp() self.genderButtonList[gender].Down() self.gender = gender if 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()
def __SelectShape(self, shape): self.shape = shape for i in xrange(len(self.shapeButton)): self.shapeButton[i].SetUp() self.shapeButton[shape].Down() chr_id = self.__GetSlotChrID(self.gender, self.slot) chr.SelectInstance(chr_id) chr.ChangeShape(shape) chr.SetMotionMode(chr.MOTION_MODE_GENERAL) chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
def StartGame(self): if self.sendedChangeNamePacket: return if self.changeNameFlag: self.OpenChangeNameDialog() return if -1 != self.startIndex: return if musicInfo.selectMusic != "": snd.FadeLimitOutMusic("BGM/" + musicInfo.selectMusic, systemSetting.GetMusicVolume() * 0.05) self.btnStart.SetUp() self.btnCreate.SetUp() self.btnDelete.SetUp() self.btnExit.SetUp() self.btnLeft.SetUp() self.btnRight.SetUp() self.btnStart.Disable() self.btnCreate.Disable() self.btnDelete.Disable() self.btnExit.Disable() self.btnLeft.Disable() self.btnRight.Disable() self.dlgQuestion.Hide() self.stream.SetCharacterSlot(self.slot) self.startIndex = self.slot self.startReservingTime = app.GetTime() for i in xrange(self.SLOT_COUNT): if FALSE == chr.HasInstance(i): continue chr.SelectInstance(i) if i == self.slot: self.slot = self.slot chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED, 0.1) continue chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)
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 MakeCharacter(self, index, id, name, race, form, hair): if 0 == id: return chr.CreateInstance(index) chr.SelectInstance(index) chr.SetVirtualID(index) chr.SetNameString(name) chr.SetRace(race) chr.SetArmor(form) chr.SetHair(hair) chr.Refresh() chr.SetMotionMode(chr.MOTION_MODE_GENERAL) chr.SetLoopMotion(chr.MOTION_INTRO_WAIT) chr.SetRotation(0.0)
def MakeCharacter(self, race): chr_id = race; chr.CreateInstance(chr_id) chr.SelectInstance(chr_id) chr.SetVirtualID(chr_id) chr.SetNameString(str(race)) chr.SetRace(race) chr.SetArmor(0) chr.SetHair(0) chr.SetMotionMode(chr.MOTION_MODE_GENERAL) chr.SetLoopMotion(chr.MOTION_INTRO_WAIT) chr.SetRotation(-7.0) #Degree value chr.Hide()
def ScanShop(self, vid): self.numShopsSearched += 1 chr.SelectInstance(vid) for x in range(0, self.SLOT_COUNT * shop.GetTabCount()): id = shop.GetItemID(x) if id != 0: price = shop.GetItemPrice(x) name = item.GetItemNameByVnum(id) if id == 50300: sk = shop.GetItemMetinSocket(x, 0) skill_name = str(skill.GetSkillName(sk)) name = str(skill_name) + " " + name count = shop.GetItemCount(x) it = self.Item(name, vid, count, price, x, shop.GetItemCheque(x)) self.Items.append(it) self.UpdateLabelText()
def EnableWindow(self): self.reservingRaceIndex = -1 self.reservingShapeIndex = -1 self.btnCreate.Enable() self.btnCancel.Enable() self.btnPrev.Enable() self.btnNext.Enable() self.btnLeft.Enable() self.btnRight.Enable() self.editCharacterName.SetFocus() self.editCharacterName.Enable() for page in xrange(PAGE_COUNT): for slot in xrange(SLOT_COUNT[page]): chr_id = self.__GetSlotChrID(page, slot) chr.SelectInstance(chr_id) chr.BlendLoopMotion(chr.MOTION_INTRO_WAIT, 0.1)
def SelectShape(self, shape): for button in self.shapeButtonList: button.SetUp() self.shape = shape self.shapeButtonList[self.shape].Down() #print "job = %s, race =%s, shape =%s" %(self.job_id, self.race, self.shape) if self.M2_INIT_VALUE == self.job_id : return chr.Hide() chr.SelectInstance(self.race) chr.ChangeShape(self.shape) chr.SetMotionMode(chr.MOTION_MODE_GENERAL) chr.SetLoopMotion(chr.MOTION_INTRO_WAIT) chr.Show()
def __MakeCharacter(self, page, slot, race): chr_id = self.__GetSlotChrID(page, slot) chr.CreateInstance(chr_id) chr.SelectInstance(chr_id) chr.SetVirtualID(chr_id) # self.instanceIDs.append(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 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 net.SendCreateCharacterPacket(chrSlot, textName, raceIndex, shapeIndex, 0, 0, 0, 0) self.reservingRaceIndex = -1
def MakeCharacter(self, slot, name, race, form, hair, acce): chr.CreateInstance(slot) chr.SelectInstance(slot) chr.SetVirtualID(slot) chr.SetNameString(name) chr.SetRace(race) chr.SetArmor(form) chr.SetHair(hair) #chr.SetAcce(acce) chr.SetMotionMode(chr.MOTION_MODE_GENERAL) chr.SetLoopMotion(chr.MOTION_INTRO_WAIT) ## 수인족만, 스케일 조금 축소. #if chr.RaceToJob(race) == JOB_WOLFMAN: # chr.SetScale(0.95,0.95,0.95) chr.SetRotation(0.0) chr.Hide()
def __UpdateScene(self): for i in xrange(SLOT_COUNT[self.gender]): self.destNameAlpha[i] = 0.0 self.destNameAlpha[self.slot] = 1.0 for i in xrange(SLOT_COUNT[self.gender]): self.destRotation[(i+self.slot)%SLOT_COUNT[self.gender]] = self.SLOT_ROTATION[self.gender][i] if self.IsShow(): snd.PlaySound("sound/ui/click.wav") event.ClearEventSet(self.descIndex) self.descIndex = event.RegisterEventSet(self.DESCRIPTION_FILE_NAME[self.slot]) if localeInfo.IsARABIC(): event.SetEventSetWidth(self.descIndex, 170) chr_id = self.__GetSlotChrID(self.gender, self.slot) if chr.HasInstance(chr_id): chr.SelectInstance(chr_id) self.__SelectShape(self.shapeList[self.gender][self.slot])