def OnUpdate(self): if not self.vid: return if systemSetting.IsShowSalesText(): if GetShopNamesRange() == 1.000: self.Show() (x, y) = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2) else: LIMIT_RANGE = abs(constInfo.SHOPNAMES_RANGE * GetShopNamesRange()) (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid) (my_x, my_y, my_z) = player.GetMainCharacterPosition() if abs(my_x - to_x) <= LIMIT_RANGE and abs( my_y - to_y) <= LIMIT_RANGE: (x, y) = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2) self.Show() else: self.Hide() self.SetPosition(-10000, 0) else: for key in g_privateShopAdvertisementBoardDict.keys(): if player.GetMainCharacterIndex() == key: g_privateShopAdvertisementBoardDict[key].Show() x, y = chr.GetProjectPosition( player.GetMainCharacterIndex(), 220) g_privateShopAdvertisementBoardDict[key].SetPosition( x - self.GetWidth() / 2, y - self.GetHeight() / 2) else: g_privateShopAdvertisementBoardDict[key].Hide()
def FollowTarget_1(self): x,y = chr.GetPixelPosition(TargetVid)[:2] chr.MoveToDestPosition(player.GetMainCharacterIndex(),int(x),int(y)) self.UpdateFollow = OpenLib.WaitingDialog() self.UpdateFollow.Open(1.0) self.UpdateFollow.SAFE_SetTimeOverEvent(self.FollowTarget_1)
def __ClickEmotionSlot(self, slotIndex): print "click emotion" if not slotIndex in emotion.EMOTION_DICT: return print "check acting" if player.IsActingEmotion(): return command = emotion.EMOTION_DICT[slotIndex]["command"] print "command", command if slotIndex > 50: vid = player.GetTargetVID() if 0 == vid or vid == player.GetMainCharacterIndex() or chr.IsNPC( vid) or chr.IsEnemy(vid): import chat chat.AppendChat(chat.CHAT_TYPE_INFO, locale.EMOTION_CHOOSE_ONE) return command += " " + chr.GetNameByVID(vid) print "send_command", command net.SendChatPacket(command)
def OnUpdate(self): playerIndex = player.GetMainCharacterIndex() (x, y, z)=textTail.GetPosition(playerIndex) isChat = textTail.IsChat(playerIndex) ui.Gauge.SetPosition(self, int(x - self.GetWidth()/2), int(y + 5) + isChat*17)
def OnMouseLeftButtonUp(self): if not self.vid: return net.SendOnClickPacket(self.vid) if self.vid != player.GetMainCharacterIndex(): self.textLine.SetPackedFontColor(SHOP_VISIT_COLOR) self.shopAdvertismentBoardSeen.append(self.vid) return True
def OnUpdate(self): if not self.vid: return if systemSetting.IsShowSalesText(): self.Show() x, y = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2) else: for key in g_privateShopAdvertisementBoardDict.keys(): if player.GetMainCharacterIndex() == key: #상점풍선을 안보이게 감추는 경우에도, 플레이어 자신의 상점 풍선은 보이도록 함. by 김준호 g_privateShopAdvertisementBoardDict[key].Show() x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220) g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2) else: g_privateShopAdvertisementBoardDict[key].Hide()
def OnMouseLeftButtonUp(self): if not self.vid: return net.SendOnClickPacket(self.vid) if app.ENABLE_OFFLINE_SHOP: if self.vid != player.GetMainCharacterIndex(): self.textLine.SetPackedFontColor(0xFF00C8FF) self.shopAdvertismentBoardSeen.append(self.vid) return True
def RotateMainCharacter(x, y): """ Rotate main character to (x,y) Args: x ([float]): X coordinate of destination. y ([float]): Y coordinate of destination. """ my_x, my_y, my_z = player.GetMainCharacterPosition() chr.SelectInstance(player.GetMainCharacterIndex()) rot = GetRotation(my_x, my_y, x, y) chr.SetRotation(rot)
def OnMouseLeftButtonDown(self): if self.vid: player.SetTarget(self.vid) player.OpenCharacterMenu(self.vid) if mouseModule.mouseController.isAttached(): attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() net.SendExchangeStartPacket(self.vid) net.SendExchangeItemAddPacket(attachedSlotPos, 0) mouseModule.mouseController.DeattachObject() return if player.IsPartyLeader(player.GetMainCharacterIndex()): if player.PARTY_STATE_LEADER != self.state: if self.isShowStateButton: self.__HideStateButton() else: self.__ShowStateButton()
def OnUpdate(self): if player.IsPVPInstance(self.vid): if app.GetTime() > self.SaveSecond: self.SaveSecond = app.GetTime() + 0.2 if str(chr.GetNameByVID(self.vid)) != "None": net.SendWhisperPacket( str(self.name.GetText()), "CODE_MESSAGE_OPPONENTS_HP_29305|" + str(player.GetMainCharacterIndex())) if constInfo.OPPONENTS_HP[1] != 0: if constInfo.OPPONENTS_HP[0] <= 0: self.SetHP(0) else: self.SetHP(((float(constInfo.OPPONENTS_HP[0]) / float(constInfo.OPPONENTS_HP[1])) * 100)) self.HPText.SetText( "%d/%d" % (constInfo.OPPONENTS_HP[0], constInfo.OPPONENTS_HP[1])) self.HPText.Show() else: self.HPText.Hide() if self.isShowButton: exchangeButton = self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE] distance = player.GetCharacterDistance(self.vid) if distance < 0: return if exchangeButton.IsShow(): if distance > self.EXCHANGE_LIMIT_RANGE: self.RefreshButton() else: if distance < self.EXCHANGE_LIMIT_RANGE: self.RefreshButton()
def RefreshButton(self): self.HideAllButton() if chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(self.vid): #self.__ShowButton(locale.TARGET_BUTTON_BUILDING_DESTROY) #self.__ArrangeButtonPosition() return if player.IsPVPInstance(self.vid) or player.IsObserverMode(): # PVP_INFO_SIZE_BUG_FIX self.SetSize(200 + 7 * self.nameLength, 40) self.UpdatePosition() # END_OF_PVP_INFO_SIZE_BUG_FIX return self.ShowDefaultButton() if guild.MainPlayerHasAuthority(guild.AUTH_ADD_MEMBER): if not guild.IsMemberByName(self.nameString): if 0 == chr.GetGuildID(self.vid): self.__ShowButton(locale.TARGET_BUTTON_INVITE_GUILD) if not messenger.IsFriendByName(self.nameString): self.__ShowButton(locale.TARGET_BUTTON_FRIEND) if player.IsPartyMember(self.vid): self.__HideButton(locale.TARGET_BUTTON_FIGHT) if player.IsPartyLeader(self.vid): self.__ShowButton(locale.TARGET_BUTTON_LEAVE_PARTY) elif player.IsPartyLeader(player.GetMainCharacterIndex()): self.__ShowButton(locale.TARGET_BUTTON_EXCLUDE) else: if player.IsPartyMember(player.GetMainCharacterIndex()): if player.IsPartyLeader(player.GetMainCharacterIndex()): self.__ShowButton(locale.TARGET_BUTTON_INVITE_PARTY) else: if chr.IsPartyMember(self.vid): self.__ShowButton(locale.TARGET_BUTTON_REQUEST_ENTER_PARTY) else: self.__ShowButton(locale.TARGET_BUTTON_INVITE_PARTY) if player.IsRevengeInstance(self.vid): self.__HideButton(locale.TARGET_BUTTON_FIGHT) self.__ShowButton(locale.TARGET_BUTTON_AVENGE) elif player.IsChallengeInstance(self.vid): self.__HideButton(locale.TARGET_BUTTON_FIGHT) self.__ShowButton(locale.TARGET_BUTTON_ACCEPT_FIGHT) elif player.IsCantFightInstance(self.vid): self.__HideButton(locale.TARGET_BUTTON_FIGHT) if not player.IsSameEmpire(self.vid): self.__HideButton(locale.TARGET_BUTTON_INVITE_PARTY) self.__HideButton(locale.TARGET_BUTTON_FRIEND) self.__HideButton(locale.TARGET_BUTTON_FIGHT) distance = player.GetCharacterDistance(self.vid) if distance > self.EXCHANGE_LIMIT_RANGE: self.__HideButton(locale.TARGET_BUTTON_EXCHANGE) self.__ArrangeButtonPosition() self.__ArrangeButtonPosition()
def MoveSelectedShop(self): itemList = self.ListBoxItems.GetSelectedItem() if itemList: item = itemList.GetText() x, y, z = chr.GetPixelPosition(item.shop) chr.MoveToDestPosition(player.GetMainCharacterIndex(), x, y)
def GoStraightToPoint(self, x, y): OpenLib.RotateMainCharacter(x, y) chr.MoveToDestPosition(player.GetMainCharacterIndex(), x, y)
def Open(self, vid, owner_vid, grid_type): isPrivateShop = False isMainPlayerPrivateShop = False self.isMyShop = owner_vid > 0 and player.IsMainCharacterIndex( owner_vid) self.lastShopVID = vid if chr.IsNPC(vid) and owner_vid == 0: isPrivateShop = False else: isPrivateShop = True if isPrivateShop: self.GridSize = self.SizeToGridSize[grid_type] else: self.GridSize = 40 for i in range(40, 90 + 10, 10): if self.itemSlotList["ItemSlot_%d" % i].IsShow(): self.itemSlotList["ItemSlot_%d" % i].Hide() self.SetSize(self.realWidth, self.realHeight) self.board.SetSize(self.realBoardWidth, self.realBoardHeight) self.titleBar.SetWidth(self.realTitleBarX) self.btnBuy.SetPosition(self.realBuyBtnX, self.realBuyBtnY) self.btnSell.SetPosition(self.realSellBtnX, self.realSellBtnY) self.btnMove.SetPosition(self.realMoveBtnX, self.realMoveBtnY) self.btnClose.SetPosition(self.realCloseBtnX, self.realCloseBtnY) self.wndMoneySlot.SetPosition(self.realMoneySlotX, self.realMoneySlotY) if self.btnBuy.IsShow(): self.btnBuy.Hide() if self.btnSell.IsShow(): self.btnSell.Hide() if self.btnMove.IsShow(): self.btnMove.Hide() if self.btnClose.IsShow(): self.btnClose.Hide() if self.wndMoneySlot.IsShow(): self.wndMoneySlot.Hide() self.itemSlotList["ItemSlot_%d" % self.GridSize].Show() self.itemSlotList["ItemSlot_%d" % self.GridSize].SetSlotStyle( wndMgr.SLOT_STYLE_NONE) self.itemSlotList["ItemSlot_%d" % self.GridSize].SAFE_SetButtonEvent( "LEFT", "EMPTY", self.SelectEmptySlot) self.itemSlotList["ItemSlot_%d" % self.GridSize].SAFE_SetButtonEvent( "LEFT", "EXIST", self.SelectItemSlot) self.itemSlotList["ItemSlot_%d" % self.GridSize].SAFE_SetButtonEvent( "RIGHT", "EXIST", self.UnselectItemSlot) self.itemSlotList["ItemSlot_%d" % self.GridSize].SetOverInItemEvent( ui.__mem_func__(self.OverInItem)) self.itemSlotList["ItemSlot_%d" % self.GridSize].SetOverOutItemEvent( ui.__mem_func__(self.OverOutItem)) if player.IsMainCharacterIndex(vid) or self.isMyShop or ( chr.IsGameMaster(player.GetMainCharacterIndex()) and isPrivateShop): isMainPlayerPrivateShop = True self.btnBuy.Hide() self.btnSell.Hide() self.btnClose.Show() if self.isMyShop: self.btnMove.Show() self.wndMoneySlot.Show() self.SetSize(self.width, self.height + 16) self.board.SetSize(self.width, self.height + 16) self.UpdateRect() else: isMainPlayerPrivateShop = False self.btnBuy.Show() self.btnSell.Show() self.btnClose.Hide() self.btnMove.Hide() self.wndMoneySlot.Hide() self.SetSize(self.width, self.height) self.board.SetSize(self.width, self.height) self.UpdateRect() shop.Open(isPrivateShop, isMainPlayerPrivateShop) self.tabIdx = 0 heightDifference = 80 widthDifferenceBase = 32 btnDifference = 20 gridSizeToWindowPos = grid_type - 1 fixDifference = 14 if self.GridSize >= 50: self.SetSize( self.realWidth + widthDifferenceBase * gridSizeToWindowPos, self.realHeight + heightDifference) self.board.SetSize( self.realBoardWidth + widthDifferenceBase * gridSizeToWindowPos, self.realBoardHeight + heightDifference) if self.GridSize != 50: self.titleBar.SetWidth(self.realTitleBarX + widthDifferenceBase * gridSizeToWindowPos) self.wndMoneySlot.SetPosition( self.realMoneySlotX * gridSizeToWindowPos, self.realMoneySlotY + heightDifference - fixDifference) else: self.wndMoneySlot.SetPosition( self.realMoneySlotX, self.realMoneySlotY + heightDifference - fixDifference) self.btnBuy.SetPosition(self.realBuyBtnX + btnDifference, self.realBuyBtnY + heightDifference) self.btnSell.SetPosition(self.realSellBtnX + btnDifference, self.realSellBtnY + heightDifference) self.btnMove.SetPosition( self.realMoveBtnX + btnDifference - fixDifference, self.realMoveBtnY + heightDifference - fixDifference) self.btnClose.SetPosition( self.realCloseBtnX + btnDifference, self.realCloseBtnY + heightDifference - fixDifference) #self.UpdateRect() if isPrivateShop: self.__HideMiddleTabs() self.__HideSmallTabs() else: if shop.GetTabCount() == 1: self.__ShowBuySellButton() self.__HideMiddleTabs() self.__HideSmallTabs() elif shop.GetTabCount() == 2: self.__HideBuySellButton() self.__ShowMiddleTabs() self.__HideSmallTabs() self.__SetTabNames() self.middleRadioButtonGroup.OnClick(0) elif shop.GetTabCount() == 3: self.__HideBuySellButton() self.__HideMiddleTabs() self.__ShowSmallTabs() self.__SetTabNames() self.middleRadioButtonGroup.OnClick(1) self.Refresh() self.SetTop() self.Show() (self.xShopStart, self.yShopStart, z) = player.GetMainCharacterPosition()