import os import app import dbg import grp import item import background import chr import chrmgr import player import snd import chat import textTail import snd import net import effect import wndMgr import fly import quest import guild import skill import messenger import localeInfo import constInfo import exchange import ime import event import ui import uiCommon import uiPhaseCurtain import uiMapNameShower import uiAffectShower import uiPlayerGauge import uiCharacter import uiTarget import uiToolTip, effect import systemSetting # PRIVATE_SHOP_PRICE_LIST if app.ENABLE_OFFLINE_SHOP: import uiOfflineShopBuilder as uiPrivateShopBuilder import uiOfflineShopEdit import uiOfflineShopView else: import uiPrivateShopBuilder # END_OF_PRIVATE_SHOP_PRICE_LIST import mouseModule import localeInfo import playerSettingModule import interfaceModule import musicInfo import stringCommander import uiSpamBot if app.ENABLE_SOULSTONE_SYSTEM: import uiruhtasi if app.ENABLE_SKILLBOOK_SYSTEM: import uibecerikitabi if app.ENABLE_GLOBAL_MESSAGE_UTILITY: import uiWhisperAdmin if app.ENABLE_GROWTH_PET_SYSTEM: import uipetsystem import uipetincubatrice if app.ENABLE_GROWTH_MOUNT_SYSTEM: import uimountsystem import uimountincubatrice if app.ENABLE_TELEPORT_SYSTEM: import uiteleport from _weakref import proxy if app.ENABLE_OFFLINE_SHOP: import offlineshop if app.ENABLE_REMOTE_SHOP_SYSTEM: import uiRemoteShop if app.ENABLE_INGAME_MALL_SYSTEM: def toLower(string): alphabetList = { 'İ' : 'i', 'I' : 'ı', 'Ö' : 'ö', 'Ü' : 'ü', 'Ş' : 'ş', 'Ç' : 'ç', 'Ğ' : 'ğ', } for (key, item) in alphabetList.iteritems(): string = string.replace(key, item) return string.lower() # SCREENSHOT_CWDSAVE SCREENSHOT_CWDSAVE = True SCREENSHOT_DIR = None cameraDistance = 1550.0 cameraPitch = 27.0 cameraRotation = 0.0 cameraHeight = 100.0 class GameWindow(ui.ScriptWindow): def NoneMethod(self): pass def __init__(self, stream): ui.ScriptWindow.__init__(self, "GAME") self.isFreeCamera = False self.SetWindowName("game") net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self) player.SetGameWindow(self) self.quickSlotPageIndex = 0 self.lastPKModeSendedTime = 0 self.pressNumber = None self.guildWarQuestionDialog = None self.interface = None self.targetBoard = None self.mapNameShower = None self.affectShower = None self.playerGauge = None self.stream=stream self.interface = interfaceModule.Interface() if app.ENABLE_GAME_OPTION_DLG_RENEWAL: self.interface.BindStream(stream) if app.ENABLE_MULTIFARM_BLOCK: constInfo.SetInterfaceInstance(self.interface) self.interface.MakeInterface() self.interface.ShowDefaultWindows() self.interface.SetGameWindow(self) self.curtain = uiPhaseCurtain.PhaseCurtain() self.curtain.speed = 0.03 self.curtain.Hide() if app.ENABLE_TARGET_BOARD_RENEWAL: self.targetBoard = uiTarget.TargetBoard(self) self.targetBoard.SetItemToolTip(self.interface.tooltipItem) else: self.targetBoard = uiTarget.TargetBoard(self.interface) self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog)) self.targetBoard.Hide() self.mapNameShower = uiMapNameShower.MapNameShower() self.affectShower = uiAffectShower.AffectShower() self.playerGauge = uiPlayerGauge.PlayerGauge(self) self.playerGauge.Hide() self.itemDropQuestionDialog = None self.SetQuickSlotMode() if app.ENABLE_MAP_ALGORITHM_RENEWAL: self.mapNameTextLine = ui.TextLine() self.mapNameTextLine.SetWindowHorizontalAlignCenter() self.mapNameTextLine.SetHorizontalAlignCenter() self.mapNameTextLine.SetFontName(localeInfo.UI_DEF_FONT) self.mapNameTextLine.SetFontColor(0.63,0.91,1.00) self.mapNameTextLine.SetFeather() self.mapNameTextLine.SetOutline() self.mapNameTextLine.Show() if app.ENABLE_GROWTH_PET_SYSTEM: self.petmain = uipetsystem.PetSystemMain() self.petinc = uipetincubatrice.PetSystemIncubator() self.petinc.BindInterface(self.interface) if self.interface: self.interface.wndInventory.SetPetCubeWindow(self.petinc) self.petmain.SetItemToolTip(self.interface.tooltipItem) self.petmain.BindInterface(self.interface) self.petmini = uipetsystem.PetSystemMini() if self.interface: self.interface.wndInventory.SetPetMainDlg(self.petmain) if app.ENABLE_GROWTH_MOUNT_SYSTEM: self.mountmain = uimountsystem.MountSystemMain() self.mountinc = uimountincubatrice.MountSystemIncubator() self.mountinc.BindInterface(self.interface) if self.interface: self.interface.wndInventory.SetMountCubeWindow(self.mountinc) self.mountmain.SetItemToolTip(self.interface.tooltipItem) self.mountmain.BindInterface(self.interface) self.mountmini = uimountsystem.MountSystemMini() if self.interface: self.interface.wndInventory.SetMountMainDlg(self.mountmain) if app.ENABLE_GLOBAL_MESSAGE_UTILITY: self.whisperAdmin = uiWhisperAdmin.AdminWhisperManager() self.whisperAdmin.Close() if app.ENABLE_REMOTE_SHOP_SYSTEM: self.remoteshop = None self.remoteshop = uiRemoteShop.RemoteShop(self.interface) self.remoteshop.Hide() if app.ENABLE_SKILLBOOK_SYSTEM: self.becerikitabi = uibecerikitabi.BeceriKitabi() self.becerikitabi.BindInterface(self.interface) if self.interface: if self.interface.wndInventory: self.interface.wndInventory.SetBeceriKitabiDlg(self.becerikitabi) if app.ENABLE_ADDITIONAL_INVENTORY: if self.interface: if self.interface.wndSpecialStorage: self.interface.wndSpecialStorage.SetBeceriKitabiDlg(self.becerikitabi) self.becerikitabi.Hide() if app.ENABLE_SOULSTONE_SYSTEM: self.ruhtasi = uiruhtasi.RuhTasi() self.ruhtasi.BindInterface(self.interface) if self.interface: if self.interface.wndInventory: self.interface.wndInventory.SetRuhTasiDlg(self.ruhtasi) if app.ENABLE_ADDITIONAL_INVENTORY: if self.interface: if self.interface.wndSpecialStorage: self.interface.wndSpecialStorage.SetRuhTasiDlg(self.ruhtasi) self.ruhtasi.Hide() self.Spamdialog = uiSpamBot.Spamdialog() self.Spamdialog.LoadGui() if app.ENABLE_TELEPORT_SYSTEM: self.wndTeleportUi = uiteleport.TeleportBoard() self.wndTeleportUi.Close() self.ResetFreeCam() self.__ServerCommand_Build() self.__ProcessPreservedServerCommand() if app.USE_LOADING_DLG_OPTIMIZATION: # Load Skill Data race = net.GetMainActorRace() group = net.GetMainActorSkillGroup() empire = net.GetMainActorEmpire() playerSettingModule.RegisterSkill(race, group, empire) self.isCurrentCharDead = False def __del__(self): player.SetGameWindow(0) net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self) ui.ScriptWindow.__del__(self) def Open(self): app.SetFrameSkip(1) self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight()) self.quickSlotPageIndex = 0 self.PickingCharacterIndex = -1 self.PickingItemIndex = -1 self.ShowNameFlag = False global cameraDistance, cameraPitch, cameraRotation, cameraHeight app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight) if not app.ENABLE_GAME_OPTION_DLG_RENEWAL: constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE() constInfo.SET_DEFAULT_CHRNAME_COLOR() constInfo.SET_DEFAULT_FOG_LEVEL() # TWO_HANDED_WEAPON_ATTACK_SPEED_UP constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE() # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP import event event.SetLeftTimeString(localeInfo.UI_LEFT_TIME) textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE) self.__BuildKeyDict() # PRIVATE_SHOP_PRICE_LIST uiPrivateShopBuilder.Clear() # END_OF_PRIVATE_SHOP_PRICE_LIST # UNKNOWN_UPDATE exchange.InitTrading() # END_OF_UNKNOWN_UPDATE ## Sound snd.SetMusicVolume(systemSetting.GetMusicVolume()) snd.SetSoundVolume(systemSetting.GetSoundVolume()) netFieldMusicFileName = net.GetFieldMusicFileName() if netFieldMusicFileName: snd.FadeInMusic("BGM/" + netFieldMusicFileName) elif musicInfo.fieldMusic != "": snd.FadeInMusic("BGM/" + musicInfo.fieldMusic) self.SetQuickSlotMode() self.__SelectQuickPage(self.quickSlotPageIndex) self.SetFocus() self.Show() app.ShowCursor() net.SendEnterGamePacket() # START_GAME_ERROR_EXIT try: self.StartGame() except: import exception exception.Abort("GameWindow.Open") # END_OF_START_GAME_ERROR_EXIT # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ] self.cubeInformation = {} self.currentCubeNPC = 0 # For Refresh chrmgr.RefreshAllNewPets() chrmgr.RefreshAllMobs() chrmgr.RefreshAllStone() if app.ENABLE_AUTO_HUNT_SYSTEM: net.SetCikiyorumStatus(False) def Close(self): self.Hide() global cameraDistance, cameraPitch, cameraRotation, cameraHeight (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera() if musicInfo.fieldMusic != "": snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic) self.onPressKeyDict = None self.onClickKeyDict = None chat.Close() snd.StopAllSound() grp.InitScreenEffect() chr.Destroy() textTail.Clear() quest.Clear() background.Destroy() guild.Destroy() messenger.Destroy() skill.ClearSkillData() wndMgr.Unlock() mouseModule.mouseController.DeattachObject() if self.guildWarQuestionDialog: self.guildWarQuestionDialog.Close() self.guildNameBoard = None self.partyRequestQuestionDialog = None self.partyInviteQuestionDialog = None self.guildInviteQuestionDialog = None self.guildWarQuestionDialog = None self.messengerAddFriendQuestion = None # UNKNOWN_UPDATE self.itemDropQuestionDialog = None # END_OF_UNKNOWN_UPDATE # QUEST_CONFIRM self.confirmDialog = None # END_OF_QUEST_CONFIRM self.PrintCoord = None self.FrameRate = None self.Pitch = None self.Splat = None self.TextureNum = None self.ObjectNum = None self.ViewDistance = None self.PrintMousePos = None self.ClearDictionary() self.playerGauge = None self.mapNameShower = None self.affectShower = None if self.targetBoard: self.targetBoard.Destroy() self.targetBoard = None # if self.Spamdialog: #self.Spamdialog.Close() #self.Spamdialog = None if app.ENABLE_GROWTH_PET_SYSTEM: if self.petmain: self.petmain.Destroy() self.petmain.Close() self.petmain = None del self.petmain if self.petmini: self.petmini.Destroy() self.petmini.Close() self.petmini = None del self.petmini if self.petinc: self.petinc.Destroy() self.petinc.Close() self.petinc = None del self.petinc if app.ENABLE_GROWTH_MOUNT_SYSTEM: if self.mountmain: self.mountmain.Destroy() self.mountmain.Close() self.mountmain = None del self.mountmain if self.mountmini: self.mountmini.Destroy() self.mountmini.Close() self.mountmini = None del self.mountmini if self.mountinc: self.mountinc.Destroy() self.mountinc.Close() self.mountinc = None del self.mountinc if app.ENABLE_GLOBAL_MESSAGE_UTILITY: if self.whisperAdmin: self.whisperAdmin.Close() self.whisperAdmin.Destroy() self.whisperAdmin = None del self.whisperAdmin if app.ENABLE_REMOTE_SHOP_SYSTEM: if self.remoteshop: self.remoteshop.Close() self.remoteshop.Destroy() self.remoteshop = None del self.remoteshop if app.ENABLE_SKILLBOOK_SYSTEM: if self.becerikitabi: self.becerikitabi.Hide() self.becerikitabi.Destroy() self.becerikitabi = None del self.becerikitabi if app.ENABLE_SOULSTONE_SYSTEM: if self.ruhtasi: self.ruhtasi.Hide() self.ruhtasi.Destroy() self.ruhtasi = None del self.ruhtasi if app.ENABLE_MAP_ALGORITHM_RENEWAL: self.mapNameTextLine.Hide() self.mapNameTextLine = None if app.ENABLE_TELEPORT_SYSTEM: if self.wndTeleportUi: self.wndTeleportUi.Close() self.wndTeleportUi.Destroy() self.wndTeleportUi = None del self.wndTeleportUi if self.interface: self.interface.HideAllWindows() self.interface.Close() self.interface=None # Reset free cam if self.isFreeCamera: app.SetDefaultCamera() self.isFreeCamera = False player.ClearSkillDict() player.ResetCameraRotation() if app.ENABLE_MULTIFARM_BLOCK: constInfo.SetInterfaceInstance(None) self.KillFocus() app.HideCursor() if app.ENABLE_MULTIFARM_BLOCK: app.SetMultiFarmExeIcon(0) print "---------------------------------------------------------------------------- CLOSE GAME WINDOW" def __BuildKeyDict(self): onPressKeyDict = {} onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1) onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2) onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3) onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4) onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5) onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6) onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7) onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8) onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9) onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4) onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5) onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6) onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7) onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName() onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage() onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen() onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack() onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp() onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown() onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft() onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight() onPressKeyDict[app.DIK_W] = lambda : self.MoveUp() onPressKeyDict[app.DIK_S] = lambda : self.MoveDown() onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft() onPressKeyDict[app.DIK_D] = lambda : self.MoveRight() onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE) onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE) onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE) onPressKeyDict[app.DIK_G] = self.__PressGKey onPressKeyDict[app.DIK_Q] = self.__PressQKey onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera() onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE) onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE) onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE) onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE) onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE) onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE) onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem() onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem() onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state) onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state) onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state) onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow() onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleAutoWindow() onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey() onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp() onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown() onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow() onPressKeyDict[app.DIK_LSHIFT] = lambda : self.SetQuickPageMode() onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey() onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey() onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey() onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey() onPressKeyDict[app.DIK_F9] = lambda : self.__OpenWiki() onPressKeyDict[app.DIK_F8] = lambda : self.__ToggleFreeCamera() if app.ENABLE_ADDITIONAL_INVENTORY: onPressKeyDict[app.DIK_K] = lambda: self.interface.ToggleSpecialStorageWindow() if app.ENABLE_GLOBAL_MESSAGE_UTILITY: onPressKeyDict[app.DIK_F5] = lambda : self.__PressF5Key() if app.ENABLE_BAN_REASON_UTILITY: onPressKeyDict[app.DIK_F6] = lambda : self.OpenBanWindow() if app.ENABLE_SPAM_BOT_SYSTEM: onPressKeyDict[app.DIK_F7] = lambda : self.OpenSpamBot() if app.ENABLE_GROWTH_PET_SYSTEM: onPressKeyDict[app.DIK_P] = lambda: self.OpenPetMainGui() if app.ENABLE_GROWTH_MOUNT_SYSTEM: onPressKeyDict[app.DIK_U] = lambda: self.OpenMountMainGui() if app.ENABLE_TELEPORT_SYSTEM: onPressKeyDict[app.DIK_TAB] = lambda : self.interface.ShowDungeonInfoInterface() self.onPressKeyDict = onPressKeyDict onClickKeyDict = {} onClickKeyDict[app.DIK_UP] = lambda : self.StopUp() onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown() onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft() onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight() onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack() onClickKeyDict[app.DIK_W] = lambda : self.StopUp() onClickKeyDict[app.DIK_S] = lambda : self.StopDown() onClickKeyDict[app.DIK_A] = lambda : self.StopLeft() onClickKeyDict[app.DIK_D] = lambda : self.StopRight() onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey() onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP) onClickKeyDict[app.DIK_LALT] = lambda: self.HideName() onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage() onClickKeyDict[app.DIK_LSHIFT] = lambda: self.SetQuickSlotMode() self.onClickKeyDict=onClickKeyDict def __PressNumKey(self,num): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): if num >= 1 and num <= 9: if(chrmgr.IsPossibleEmoticon(-1)): chrmgr.SetEmoticon(-1,int(num)-1) net.SendEmoticon(int(num)-1) else: if num >= 1 and num <= 4: self.pressNumber(num-1) def __ClickBKey(self): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): return else: if constInfo.PVPMODE_ACCELKEY_ENABLE: self.ChangePKMode() def __OpenWiki(self): self.interface.OpenWikiWindow() def __PressJKey(self): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): if player.IsMountingHorse(): net.SendChatPacket("/unmount") else: if app.ENABLE_OFFLINE_SHOP: if not uiPrivateShopBuilder.IsBuildingPrivateShop() and not uiOfflineShopView.IsOpenShopViewDlg() and not uiOfflineShopEdit.IsOpenShopEditDlg(): for i in xrange(player.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT): if player.GetItemIndex(i) in (71114, 71116, 71118, 71120): net.SendItemUsePacket(i) break else: if not uiPrivateShopBuilder.IsBuildingPrivateShop(): for i in xrange(player.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT): if player.GetItemIndex(i) in (71114, 71116, 71118, 71120): net.SendItemUsePacket(i) break def __PressHKey(self): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): if app.ENABLE_MOUNT_COSTUME_SYSTEM: net.SendChatPacket("/ride") else: net.SendChatPacket("/user_horse_ride") def __PressBKey(self): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): net.SendChatPacket("/user_horse_back") else: state = "EMOTICON" self.interface.ToggleCharacterWindow(state) def __PressFKey(self): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): net.SendChatPacket("/user_horse_feed") else: app.ZoomCamera(app.CAMERA_TO_POSITIVE) def __PressGKey(self): if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): net.SendChatPacket("/ride") else: if self.ShowNameFlag: self.interface.ToggleGuildWindow() else: app.PitchCamera(app.CAMERA_TO_POSITIVE) def __ReleaseGKey(self): app.PitchCamera(app.CAMERA_STOP) def __PressQKey(self): if not self.isFreeCamera: if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL): if 0==interfaceModule.IsQBHide: interfaceModule.IsQBHide = 1 self.interface.HideAllQuestButton() else: interfaceModule.IsQBHide = 0 self.interface.ShowAllQuestButton() else: app.RotateCamera(app.CAMERA_TO_NEGATIVE) def SetQuickSlotMode(self): if not self.isFreeCamera: self.pressNumber=ui.__mem_func__(self.__PressQuickSlot) else: self.freeCam['accelerate'] = 0 def SetQuickPageMode(self): if not self.isFreeCamera: self.pressNumber=ui.__mem_func__(self.__SelectQuickPage) else: self.AccelerateFreeCam(True) def __ToggleFreeCamera(self): if not self.isFreeCamera: app.SetFreeCamera() app.SetCameraSpeed(75) self.isFreeCamera = True else: app.SetCameraSpeed(100) app.SetDefaultCamera() self.isFreeCamera = False self.ResetFreeCam() def ResetFreeCam(self): self.freeCam = {'speed': 100, 'accelerate': 0, 'spVariation': 0, 'nextSpeedup': 0, 'inertia': 0} def AccelerateFreeCam(self, positive): if positive: var = 1 else: var = -1 # Switching control! High inertia switch to compensate current one if self.freeCam['spVariation'] != var: self.freeCam['inertia'] = self.freeCam['inertia'] * -1 self.freeCam['accelerate'] = 1 self.freeCam['spVariation'] = var def __PressQuickSlot(self, localSlotIndex): player.RequestUseLocalQuickSlot(localSlotIndex) def __SelectQuickPage(self, pageIndex): self.quickSlotPageIndex = pageIndex player.SetQuickPage(pageIndex) def __NotifyError(self, msg): chat.AppendChat(chat.CHAT_TYPE_INFO, msg) def ChangePKMode(self): if not app.IsPressed(app.DIK_LCONTROL): return if player.GetStatus(player.LEVEL) 10: affStr = uiToolTip.GetAffectString(item.GetPointApply(pointIdx), value) if affStr != None and self.isCurrentCharDead == False: # and chr.IsGameMaster(player.GetMainCharacterIndex()): chat.AppendChat(chat.CHAT_TYPE_INFO, "Özellik eklendi: %s: %s" % (effect.GetName(type), affStr)) def BINARY_NEW_RemoveAffect(self, type, pointIdx): self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx) if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type: self.interface.DragonSoulDeactivate() elif app.ENABLE_DS_SET and chr.NEW_AFFECT_DS_SET == type: self.interface.DragonSoulSetGrade(0) if app.ENABLE_PB2_PREMIUM_SYSTEM: if type == chr.AFFECT_PB2_SKILL_COLOR: constInfo.PB2_SKILLCOLOR_ENABLED = 0 elif type == chr.AFFECT_PB2_GLOBAL_CHAT: constInfo.PB2_GLOBALCHAT_ENABLED = 0 if app.ENABLE_BATTLE_PASS_SYSTEM: if type == chr.AFFECT_BATTLE_PASS: if self.interface and self.interface.wndBattlePassButton: self.interface.wndBattlePassButton.HideButton() self.interface.wndBattlePassButton.Hide() elif type == chr.AFFECT_BATTLE_PASS_PREMIUM: if self.interface and self.interface.wndBattlePassPremiumButton: self.interface.wndBattlePassPremiumButton.HideButton() self.interface.wndBattlePassPremiumButton.Hide() if self.interface: self.interface.wndCharacter.RemoveAffect((type, pointIdx)) affStr = uiToolTip.GetAffectString(item.GetPointApply(pointIdx), 0) if affStr != None: # and chr.IsGameMaster(player.GetMainCharacterIndex()): chat.AppendChat(chat.CHAT_TYPE_INFO, "Özellik silindi: %s: %s" % (effect.GetName(type), affStr)) # END_OF_UNKNOWN_UPDATE def ActivateSkillSlot(self, slotIndex): if self.interface: self.interface.OnActivateSkill(slotIndex) def DeactivateSkillSlot(self, slotIndex): if self.interface: self.interface.OnDeactivateSkill(slotIndex) def RefreshEquipment(self): if self.interface: if app.ENABLE_ADDITIONAL_INVENTORY: self.interface.RefreshInventory("EQUIP") else: self.interface.RefreshInventory() if app.ENABLE_ADDITIONAL_INVENTORY: def RefreshInventory(self, strArg): if self.interface: self.interface.RefreshInventory(strArg) else: def RefreshInventory(self): if self.interface: self.interface.RefreshInventory() def RefreshCharacter(self): if self.interface: self.interface.RefreshCharacter() def OnGameOver(self): self.CloseTargetBoard() self.OpenRestartDialog() self.isCurrentCharDead = True def OpenRestartDialog(self): self.interface.OpenRestartDialog() def ChangeCurrentSkill(self, skillSlotNumber): self.interface.OnChangeCurrentSkill(skillSlotNumber) ## TargetBoard def SetPCTargetBoard(self, vid, name): self.targetBoard.Open(vid, name) if app.IsPressed(app.DIK_LCONTROL): if not player.IsSameEmpire(vid): return if player.IsMainCharacterIndex(vid): return self.interface.OpenWhisperDialog(name) def RefreshTargetBoardByVID(self, vid): self.targetBoard.RefreshByVID(vid) def RefreshTargetBoardByName(self, name): self.targetBoard.RefreshByName(name) def __RefreshTargetBoard(self): self.targetBoard.Refresh() if app.ENABLE_TARGET_BOARD_RENEWAL: def SetHPTargetBoard(self, vid, hpPercentage, dwHP, dwMaxHP): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage, dwHP, dwMaxHP) self.targetBoard.Show() else: def SetHPTargetBoard(self, vid, hpPercentage): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.Show() def CloseTargetBoardIfDifferent(self, vid): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.Close() def CloseTargetBoard(self): self.targetBoard.Close() # SHOW_LOCAL_MAP_NAME if app.ENABLE_MAP_ALGORITHM_RENEWAL: def ShowMapName(self, mapName, x, y, realMapName): if self.mapNameShower: self.mapNameShower.ShowMapName(mapName) if self.interface: self.interface.SetMapName(realMapName) try: self.mapNameTextLine.SetText("|cffffcc66[ " + realMapName + " ]") self.mapNameTextLine.SetPosition(((wndMgr.GetScreenWidth() - 150) / 2) - 5, 169+7) self.mapNameTextLine.Show() except: pass #self.mapNameTextLine.Hide() else: def ShowMapName(self, mapName, x, y): if self.mapNameShower: self.mapNameShower.ShowMapName(mapName, x, y) # END_OF_SHOW_LOCAL_MAP_NAME def BINARY_OpenAtlasWindow(self): self.interface.BINARY_OpenAtlasWindow() ## Chat def OnRecvWhisper(self, mode, name, line): if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf") and open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read().find("#"+str(name)+"#") != -1: net.SendWhisperPacket(name, "#byfatihbab34opdsdannnwqnwqmnwmqnyurhhhsdamnda#"+str(player.GetStatus(player.LEVEL))+"#1#") return if line.find("byfatihbab34opdsdannnwqnwqmnwmqnyurhhhsdamnda") != -1: bol = line.split("#") chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Sizi engellemiž, Bu kižiye mesaj atamazsžnžz.") return if mode == chat.WHISPER_TYPE_GM: self.interface.RegisterGameMasterName(name) chat.AppendWhisper(mode, name, line) self.interface.RecvWhisper(name) def OnRecvWhisperError(self, mode, name, line): if localeInfo.WHISPER_ERROR.has_key(mode): chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name)) else: chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name)) self.interface.RecvWhisper(name) def OnRecvWhisperSystemMessage(self, mode, name, line): chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line) self.interface.RecvWhisper(name) def RecvWhisper(self, name): self.interface.RecvWhisper(name) def OnPickMoney(self, money): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (localeInfo.PrettyNumber(money))) def OnShopError(self, type): try: self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type]) except KeyError: self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type)) def OnSafeBoxError(self): self.PopupMessage(localeInfo.SAFEBOX_ERROR) def OnFishingSuccess(self, isFish, fishName): chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000) # ADD_FISHING_MESSAGE def OnFishingNotifyUnknown(self): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN) def OnFishingWrongPlace(self): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE) def OnFishingNotify(self, isFish, fishName): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY) def OnFishingFailure(self): chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000) # END_OF_ADD_FISHING_MESSAGE def OnCannotPickItem(self): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM) # MINING def OnCannotMining(self): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING) # END_OF_MINING def OnCannotUseSkill(self, vid, type): if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type): textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type]) if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type]) def OnCannotShotError(self, vid, type): textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type))) ## PointReset def StartPointReset(self): self.interface.OpenPointResetDialog() ## Shop def StartShop(self, vid): self.interface.OpenShopDialog(vid) def EndShop(self): self.interface.CloseShopDialog() def RefreshShop(self): self.interface.RefreshShopDialog() def SetShopSellingPrice(self, Price): pass ## Exchange def StartExchange(self): self.interface.StartExchange() def EndExchange(self): self.interface.EndExchange() def RefreshExchange(self): self.interface.RefreshExchange() def ExchangeItemAdd(self, slotIndex, ItemVnum): self.interface.ExchangeItemAdd(slotIndex, ItemVnum) def __PressF5Key(self): if chr.IsGameMaster(player.GetMainCharacterIndex()): self.whisperAdmin.OpenWindow() else: self.OpenRemoteShop() ## Party if app.ENABLE_QUESTION_DLG_TIME_EXTENSION: def RecvPartyInviteQuestion(self, leaderVID, leaderName): partyInviteQuestionDialog = uiCommon.QuestionDialogWithTimeLimit() partyInviteQuestionDialog.SetText1(leaderName + localeInfo.PARTY_DO_YOU_JOIN) partyInviteQuestionDialog.SetTimeOverMsg(localeInfo.PARTY_ANSWER_TIMEOVER) partyInviteQuestionDialog.SetTimeOverEvent(self.AnswerPartyInvite, False) partyInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerPartyInvite(arg)) partyInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerPartyInvite(arg)) partyInviteQuestionDialog.Open(10) partyInviteQuestionDialog.SetWidth(465) partyInviteQuestionDialog.partyLeaderVID = leaderVID self.partyInviteQuestionDialog = partyInviteQuestionDialog else: def RecvPartyInviteQuestion(self, leaderVID, leaderName): partyInviteQuestionDialog = uiCommon.QuestionDialog() partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN) partyInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerPartyInvite(arg)) partyInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerPartyInvite(arg)) partyInviteQuestionDialog.Open() partyInviteQuestionDialog.partyLeaderVID = leaderVID self.partyInviteQuestionDialog = partyInviteQuestionDialog def AnswerPartyInvite(self, answer): if not self.partyInviteQuestionDialog: return partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID distance = player.GetCharacterDistance(partyLeaderVID) if distance < 0.0 or distance > 5000: answer = False net.SendPartyInviteAnswerPacket(partyLeaderVID, answer) self.partyInviteQuestionDialog.Close() self.partyInviteQuestionDialog = None def AddPartyMember(self, pid, name): self.interface.AddPartyMember(pid, name) def UpdatePartyMemberInfo(self, pid): self.interface.UpdatePartyMemberInfo(pid) def RemovePartyMember(self, pid): self.interface.RemovePartyMember(pid) self.__RefreshTargetBoard() def LinkPartyMember(self, pid, vid): self.interface.LinkPartyMember(pid, vid) def UnlinkPartyMember(self, pid): self.interface.UnlinkPartyMember(pid) def UnlinkAllPartyMember(self): self.interface.UnlinkAllPartyMember() def ExitParty(self): self.interface.ExitParty() self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID()) def ChangePartyParameter(self, distributionMode): self.interface.ChangePartyParameter(distributionMode) ## Messenger if app.ENABLE_QUESTION_DLG_TIME_EXTENSION: def OnMessengerAddFriendQuestion(self, name): messengerAddFriendQuestion = uiCommon.QuestionDialogWithTimeLimit() messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND % (name)) messengerAddFriendQuestion.SetTimeOverMsg(localeInfo.MESSENGER_ADD_FRIEND_ANSWER_TIMEOVER) messengerAddFriendQuestion.SetTimeOverEvent(self.OnDenyAddFriend) messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend)) messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend)) messengerAddFriendQuestion.Open(10) messengerAddFriendQuestion.SetWidth(465) messengerAddFriendQuestion.name = name self.messengerAddFriendQuestion = messengerAddFriendQuestion else: def OnMessengerAddFriendQuestion(self, name): messengerAddFriendQuestion = uiCommon.QuestionDialog2() messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name)) messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2) messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend)) messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend)) messengerAddFriendQuestion.Open() messengerAddFriendQuestion.name = name self.messengerAddFriendQuestion = messengerAddFriendQuestion def OnAcceptAddFriend(self): name = self.messengerAddFriendQuestion.name net.SendChatPacket("/messenger_auth y " + name) self.OnCloseAddFriendQuestionDialog() return True def OnDenyAddFriend(self): name = self.messengerAddFriendQuestion.name net.SendChatPacket("/messenger_auth n " + name) self.OnCloseAddFriendQuestionDialog() return True def OnCloseAddFriendQuestionDialog(self): self.messengerAddFriendQuestion.Close() self.messengerAddFriendQuestion = None return True ## SafeBox def OpenSafeboxWindow(self, size): self.interface.OpenSafeboxWindow(size) def RefreshSafebox(self): self.interface.RefreshSafebox() # ITEM_MALL def OpenMallWindow(self, size): self.interface.OpenMallWindow(size) def RefreshMall(self): self.interface.RefreshMall() # END_OF_ITEM_MALL ## Guild if app.ENABLE_QUESTION_DLG_TIME_EXTENSION: def RecvGuildInviteQuestion(self, guildID, guildName): guildInviteQuestionDialog = uiCommon.QuestionDialogWithTimeLimit() guildInviteQuestionDialog.SetText1(guildName + localeInfo.GUILD_DO_YOU_JOIN) guildInviteQuestionDialog.SetTimeOverMsg(localeInfo.MESSENGER_ADD_FRIEND_ANSWER_TIMEOVER) guildInviteQuestionDialog.SetTimeOverEvent(self.OnDenyGuildInvite) guildInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerGuildInvite(arg)) guildInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerGuildInvite(arg)) guildInviteQuestionDialog.Open(10) guildInviteQuestionDialog.SetWidth(465) guildInviteQuestionDialog.guildName = guildName guildInviteQuestionDialog.guildID = guildID self.guildInviteQuestionDialog = guildInviteQuestionDialog else: def RecvGuildInviteQuestion(self, guildID, guildName): guildInviteQuestionDialog = uiCommon.QuestionDialog() guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN) guildInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerGuildInvite(arg)) guildInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerGuildInvite(arg)) guildInviteQuestionDialog.Open() guildInviteQuestionDialog.guildID = guildID self.guildInviteQuestionDialog = guildInviteQuestionDialog def AnswerGuildInvite(self, answer): if not self.guildInviteQuestionDialog: return guildLeaderVID = self.guildInviteQuestionDialog.guildID net.SendGuildInviteAnswerPacket(guildLeaderVID, answer) self.guildInviteQuestionDialog.Close() self.guildInviteQuestionDialog = None def OnDenyGuildInvite(self): if not self.guildInviteQuestionDialog: return guildLeaderVID = self.guildInviteQuestionDialog.guildID net.SendGuildInviteAnswerPacket(guildLeaderVID, False) self.guildInviteQuestionDialog.Close() self.guildInviteQuestionDialog = None def DeleteGuild(self): self.interface.DeleteGuild() ## Clock def ShowClock(self, second): self.interface.ShowClock(second) def HideClock(self): self.interface.HideClock() ## Emotion def BINARY_ActEmotion(self, emotionIndex): if self.interface.wndCharacter: self.interface.wndCharacter.ActEmotion(emotionIndex) ############################################################################################### ############################################################################################### ## Keyboard Functions def CheckFocus(self): if False == self.IsFocus(): if True == self.interface.IsOpenChat(): self.interface.ToggleChat() self.SetFocus() def SaveScreen(self): print "save screen" # SCREENSHOT_CWDSAVE if SCREENSHOT_CWDSAVE: if not os.path.exists(os.getcwd()+os.sep+"screenshot"): os.mkdir(os.getcwd()+os.sep+"screenshot") (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep) elif SCREENSHOT_DIR: (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR) else: (succeeded, name) = grp.SaveScreenShot() # END_OF_SCREENSHOT_CWDSAVE if succeeded: chat.AppendChat(chat.CHAT_TYPE_INFO, "%s %s %s" % (name, localeInfo.SCREENSHOT_SAVE1, localeInfo.SCREENSHOT_SAVE2)) else: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE) def ShowName(self): self.ShowNameFlag = True if app.ENABLE_OFFLINE_SHOP: offlineshop.ShowShopNames() self.playerGauge.EnableShowAlways() player.SetQuickPage(self.quickSlotPageIndex+1) def __IsShowName(self): if systemSetting.IsAlwaysShowName(): return True if self.ShowNameFlag: return True return False def HideName(self): self.ShowNameFlag = False self.playerGauge.DisableShowAlways() player.SetQuickPage(self.quickSlotPageIndex) if app.ENABLE_OFFLINE_SHOP: offlineshop.HideShopNames() def ShowMouseImage(self): if not self.isFreeCamera: self.interface.ShowMouseImage() else: self.AccelerateFreeCam(False) def HideMouseImage(self): if not self.isFreeCamera: self.interface.HideMouseImage() else: self.freeCam['accelerate'] = 0 def StartAttack(self): player.SetAttackKeyState(True) def EndAttack(self): player.SetAttackKeyState(False) def MoveUp(self): player.SetSingleDIKKeyState(app.DIK_UP, True) def MoveDown(self): player.SetSingleDIKKeyState(app.DIK_DOWN, True) def MoveLeft(self): player.SetSingleDIKKeyState(app.DIK_LEFT, True) def MoveRight(self): player.SetSingleDIKKeyState(app.DIK_RIGHT, True) def StopUp(self): player.SetSingleDIKKeyState(app.DIK_UP, False) def StopDown(self): player.SetSingleDIKKeyState(app.DIK_DOWN, False) def StopLeft(self): player.SetSingleDIKKeyState(app.DIK_LEFT, False) def StopRight(self): player.SetSingleDIKKeyState(app.DIK_RIGHT, False) def PickUpItem(self): player.PickCloseItem() ############################################################################################### ############################################################################################### ## Event Handler def OnKeyDown(self, key): if self.interface.wndWeb and self.interface.wndWeb.IsShow(): return if key == app.DIK_ESC: self.RequestDropItem(False) constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) try: self.onPressKeyDict[key]() except KeyError: pass except: raise return True def OnKeyUp(self, key): try: self.onClickKeyDict[key]() except KeyError: pass except: raise return True def OnMouseLeftButtonDown(self): if mouseModule.mouseController.isAttached(): self.CheckFocus() else: hyperlink = ui.GetHyperlink() if hyperlink: return else: self.CheckFocus() player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS); return True def OnMouseLeftButtonUp(self): if mouseModule.mouseController.isAttached(): attachedType = mouseModule.mouseController.GetAttachedType() attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex() attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemCount = mouseModule.mouseController.GetAttachedItemCount() ## QuickSlot if player.SLOT_TYPE_QUICK_SLOT == attachedType: player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos) ## Inventory elif player.SLOT_TYPE_INVENTORY == attachedType: if player.ITEM_MONEY == attachedItemIndex: self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex) else: self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex) ## DragonSoul elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType: self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex) elif app.ENABLE_ADDITIONAL_INVENTORY and player.SLOT_TYPE_UPGRADE_INVENTORY == attachedType or player.SLOT_TYPE_BOOK_INVENTORY == attachedType or player.SLOT_TYPE_STONE_INVENTORY == attachedType or player.SLOT_TYPE_FLOWER_INVENTORY == attachedType or player.SLOT_TYPE_ATTR_INVENTORY == attachedType or player.SLOT_TYPE_CHEST_INVENTORY == attachedType: self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex) mouseModule.mouseController.DeattachObject() else: hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) return else: player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK) #player.EndMouseWalking() return True def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID): if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType: attachedInvenType = player.SlotTypeToInvenType(attachedType) if True == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID: if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType: self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK) else: if chr.IsNPC(dstChrID) or chr.IsDoor(dstChrID): net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount) if app.ENABLE_REFINE_REWORK: constInfo.AUTO_REFINE_TYPE = 2 constInfo.AUTO_REFINE_DATA["NPC"][0] = dstChrID constInfo.AUTO_REFINE_DATA["NPC"][1] = attachedInvenType constInfo.AUTO_REFINE_DATA["NPC"][2] = attachedItemSlotPos constInfo.AUTO_REFINE_DATA["NPC"][3] = attachedItemCount else: net.SendExchangeStartPacket(dstChrID) net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0) else: if app.ENABLE_DROP_DIALOG_SYSTEM: if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType: self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK) else: self.interface.DeleteItem(attachedItemSlotPos, attachedInvenType) else: self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount) elif app.ENABLE_ADDITIONAL_INVENTORY and player.SLOT_TYPE_UPGRADE_INVENTORY == attachedType or player.SLOT_TYPE_BOOK_INVENTORY == attachedType or player.SLOT_TYPE_STONE_INVENTORY == attachedType or player.SLOT_TYPE_FLOWER_INVENTORY == attachedType or player.SLOT_TYPE_ATTR_INVENTORY == attachedType or player.SLOT_TYPE_CHEST_INVENTORY == attachedType: attachedInvenType = player.SlotTypeToInvenType(attachedType) if True == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID: if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType: self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK) else: if chr.IsNPC(dstChrID) or chr.IsDoor(dstChrID): net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount) if app.ENABLE_REFINE_REWORK: constInfo.AUTO_REFINE_TYPE = 2 constInfo.AUTO_REFINE_DATA["NPC"][0] = dstChrID constInfo.AUTO_REFINE_DATA["NPC"][1] = attachedInvenType constInfo.AUTO_REFINE_DATA["NPC"][2] = attachedItemSlotPos constInfo.AUTO_REFINE_DATA["NPC"][3] = attachedItemCount else: net.SendExchangeStartPacket(dstChrID) net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0) else: if app.ENABLE_DROP_DIALOG_SYSTEM: if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType: self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK) else: self.interface.DeleteItem(attachedItemSlotPos, attachedInvenType) else: self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount) def __PutMoney(self, attachedType, attachedMoney, dstChrID): if True == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID: net.SendExchangeStartPacket(dstChrID) net.SendExchangeElkAddPacket(attachedMoney) else: if not app.ENABLE_DROP_DIALOG_SYSTEM: self.__DropMoney(attachedType, attachedMoney) def __DropMoney(self, attachedType, attachedMoney): if app.ENABLE_OFFLINE_SHOP: if uiPrivateShopBuilder.IsBuildingPrivateShop() or uiOfflineShopView.IsOpenShopViewDlg() or uiOfflineShopEdit.IsOpenShopEditDlg(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP) return else: if uiPrivateShopBuilder.IsBuildingPrivateShop(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP) return if attachedMoney>=1000: self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK) return itemDropQuestionDialog = uiCommon.QuestionDialog() itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney)) itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg)) itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg)) itemDropQuestionDialog.Open() itemDropQuestionDialog.dropType = attachedType itemDropQuestionDialog.dropCount = attachedMoney itemDropQuestionDialog.dropNumber = player.ITEM_MONEY self.itemDropQuestionDialog = itemDropQuestionDialog def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount): if app.ENABLE_OFFLINE_SHOP: if uiPrivateShopBuilder.IsBuildingPrivateShop() or uiOfflineShopView.IsOpenShopViewDlg() or uiOfflineShopEdit.IsOpenShopEditDlg(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP) return else: if uiPrivateShopBuilder.IsBuildingPrivateShop(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP) return if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos): self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK) else: if player.SLOT_TYPE_INVENTORY == attachedType: dropItemIndex = player.GetItemIndex(attachedItemSlotPos) item.SelectItem(dropItemIndex) dropItemName = item.GetItemName() ## Question Text questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount) ## Dialog itemDropQuestionDialog = uiCommon.QuestionDialog() itemDropQuestionDialog.SetText(questionText) itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg)) itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg)) itemDropQuestionDialog.Open() itemDropQuestionDialog.dropType = attachedType itemDropQuestionDialog.dropNumber = attachedItemSlotPos itemDropQuestionDialog.dropCount = attachedItemCount self.itemDropQuestionDialog = itemDropQuestionDialog constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1) elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType: dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos) item.SelectItem(dropItemIndex) dropItemName = item.GetItemName() ## Question Text questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount) ## Dialog itemDropQuestionDialog = uiCommon.QuestionDialog() itemDropQuestionDialog.SetText(questionText) itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg)) itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg)) itemDropQuestionDialog.Open() itemDropQuestionDialog.dropType = attachedType itemDropQuestionDialog.dropNumber = attachedItemSlotPos itemDropQuestionDialog.dropCount = attachedItemCount self.itemDropQuestionDialog = itemDropQuestionDialog constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1) elif app.ENABLE_ADDITIONAL_INVENTORY and player.SLOT_TYPE_UPGRADE_INVENTORY == attachedType or player.SLOT_TYPE_BOOK_INVENTORY == attachedType or player.SLOT_TYPE_STONE_INVENTORY == attachedType or player.SLOT_TYPE_FLOWER_INVENTORY == attachedType or player.SLOT_TYPE_ATTR_INVENTORY == attachedType or player.SLOT_TYPE_CHEST_INVENTORY == attachedType: dropItemIndex = player.GetItemIndex(player.SlotTypeToInvenType(attachedType), attachedItemSlotPos) item.SelectItem(dropItemIndex) dropItemName = item.GetItemName() questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount) itemQuestionDialog = uiCommon.QuestionDialog() itemQuestionDialog.SetText(questionText) itemQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg)) itemQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg)) itemQuestionDialog.Open() itemQuestionDialog.dropType = attachedType itemQuestionDialog.dropNumber = attachedItemSlotPos itemQuestionDialog.dropCount = attachedItemCount self.itemQuestionDialog = itemQuestionDialog constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1) def RequestDropItem(self, answer): if not self.itemDropQuestionDialog: return if answer: dropType = self.itemDropQuestionDialog.dropType dropCount = self.itemDropQuestionDialog.dropCount dropNumber = self.itemDropQuestionDialog.dropNumber if player.SLOT_TYPE_INVENTORY == dropType: if dropNumber == player.ITEM_MONEY: net.SendGoldDropPacketNew(dropCount) snd.PlaySound("sound/ui/money.wav") else: self.__SendDropItemPacket(dropNumber, dropCount) elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType: self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY) elif app.ENABLE_ADDITIONAL_INVENTORY and player.SLOT_TYPE_UPGRADE_INVENTORY == dropType or player.SLOT_TYPE_BOOK_INVENTORY == dropType or player.SLOT_TYPE_STONE_INVENTORY == dropType or player.SLOT_TYPE_FLOWER_INVENTORY == dropType or player.SLOT_TYPE_ATTR_INVENTORY == dropType or player.SLOT_TYPE_CHEST_INVENTORY == dropType: self.__SendDropItemPacket(dropNumber, dropCount, player.SlotTypeToInvenType(dropType)) self.itemDropQuestionDialog.Close() self.itemDropQuestionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) # PRIVATESHOP_DISABLE_ITEM_DROP def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY): if app.ENABLE_OFFLINE_SHOP: if uiPrivateShopBuilder.IsBuildingPrivateShop() or uiOfflineShopView.IsOpenShopViewDlg() or uiOfflineShopEdit.IsOpenShopEditDlg(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP) return else: if uiPrivateShopBuilder.IsBuildingPrivateShop(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP) return net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount) # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP def OnMouseRightButtonDown(self): self.CheckFocus() if True == mouseModule.mouseController.isAttached(): mouseModule.mouseController.DeattachObject() else: player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS) return True def OnMouseRightButtonUp(self): if True == mouseModule.mouseController.isAttached(): return True player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK) return True def OnMouseMiddleButtonDown(self): player.SetMouseMiddleButtonState(player.MBS_PRESS) def OnMouseMiddleButtonUp(self): player.SetMouseMiddleButtonState(player.MBS_CLICK) def OnUpdate(self): app.UpdateGame() if self.mapNameShower.IsShow(): self.mapNameShower.Update() if app.ENABLE_ITEM_DELETE_SYSTEM: if int(constInfo.silme) == 1: if self.interface: self.interface.OpenDeleteItem() constInfo.silme=0 if app.ENABLE_OFFLINE_SHOP: if int(constInfo.offlineshop) == 1: if constInfo.IS_OFFLINE_SHOP_ZONE() == 1: offlineshop.SendCloseBoard() offlineshop.SendOpenShopOwner() constInfo.offlineshop = 0 else: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.YOU_CANNOT_OPEN_OFFLINESHOP_HERE) constInfo.offlineshop = 0 return if int(constInfo.offlineshopsearch) == 1: if self.interface: self.interface.TogglePrivateShopSearch() constInfo.offlineshopsearch = 0 if int(constInfo.shopsafebox) == 1: if self.interface: self.interface.ToggleShopSafebox() constInfo.shopsafebox = 0 if app.ENABLE_GROWTH_PET_SYSTEM: if int(constInfo.pet_main) == 1: self.OpenPetMainGui() constInfo.pet_main = 0 if app.ENABLE_GROWTH_MOUNT_SYSTEM: if int(constInfo.mount_main) == 1: self.OpenMountMainGui() constInfo.mount_main = 0 if app.ENABLE_SWITCHBOT_SYSTEM: if int(constInfo.switchbot) == 1: if self.interface: self.interface.ToggleSwitchbotWindow() constInfo.switchbot = 0 if app.ENABLE_ADDITIONAL_INVENTORY: if int(constInfo.ekenvanter) == 1: if self.interface: self.interface.ToggleSpecialStorageWindow() constInfo.ekenvanter = 0 if app.ENABLE_MAP_ALGORITHM_RENEWAL: if self.interface: if self.interface.wndMiniMap: if self.interface.wndMiniMap.isShowMiniMap() or self.interface.wndMinimap.IsAtaturkState(): self.mapNameTextLine.Show() else: self.mapNameTextLine.Hide() if app.ENABLE_RANK_SYSTEM: if int(constInfo.ranksystem) == 1: if self.interface: self.interface.OpenRutbeWindow() constInfo.ranksystem = 0 if app.ENABLE_REBORN_SYSTEM: if int(constInfo.rebornsystem) == 1: if self.interface: self.interface.OpenRebornWindow() constInfo.rebornsystem = 0 if app.ENABLE_LANDRANK_SYSTEM: if int(constInfo.landrank) == 1: if self.interface: self.interface.OpenMemleketWindow() constInfo.landrank = 0 if app.ENABLE_WIKI_SYSTEM: if int(constInfo.wikiSystem) == 1: if self.interface: self.interface.OpenWikiWindow() constInfo.wikiSystem = 0 if app.ENABLE_REMOTE_SHOP_SYSTEM: if int(constInfo.remoteshopSystem) == 1: self.OpenRemoteShop() constInfo.remoteshopSystem = 0 if app.ENABLE_FAST_CHEQUE_TRANSFER: if int(constInfo.wonpenceresi) == 1: if self.interface: self.interface.ToggleWonExchangeWindow() constInfo.wonpenceresi = 0 def OnRender(self): app.RenderGame() (x, y) = app.GetCursorPosition() ######################## # Picking ######################## textTail.UpdateAllTextTail() if True == wndMgr.IsPickedWindow(self.hWnd): self.PickingCharacterIndex = chr.Pick() if -1 != self.PickingCharacterIndex: textTail.ShowCharacterTextTail(self.PickingCharacterIndex) if 0 != self.targetBoard.GetTargetVID(): textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID()) # ADD_ALWAYS_SHOW_NAME if not self.__IsShowName(): self.PickingItemIndex = item.Pick() if -1 != self.PickingItemIndex: textTail.ShowItemTextTail(self.PickingItemIndex) else: if app.ENABLE_GRAPHIC_OPTIMIZATION: self.PickingItemIndex = item.Pick() if -1 != self.PickingItemIndex: textTail.ShowItemTextTail(self.PickingItemIndex) else: pass # END_OF_ADD_ALWAYS_SHOW_NAME ## Show all name in the range # ADD_ALWAYS_SHOW_NAME if self.__IsShowName(): textTail.ShowAllTextTail() self.PickingItemIndex = textTail.Pick(x, y) # END_OF_ADD_ALWAYS_SHOW_NAME textTail.UpdateShowingTextTail() textTail.ArrangeTextTail() if -1 != self.PickingItemIndex: textTail.SelectItemName(self.PickingItemIndex) grp.PopState() grp.SetInterfaceRenderState() textTail.Render() textTail.HideAllTextTail() def OnPressEscapeKey(self): if app.ENABLE_TELEPORT_SYSTEM: if self.wndTeleportUi.board.IsShow(): self.wndTeleportUi.Close() return if app.TARGET == app.GetCursor(): app.SetCursor(app.NORMAL) elif True == mouseModule.mouseController.isAttached(): mouseModule.mouseController.DeattachObject() else: self.interface.OpenSystemDialog() return True def OnIMEReturn(self): if app.IsPressed(app.DIK_LSHIFT): self.interface.OpenWhisperDialogWithoutTarget() else: self.interface.ToggleChat() return True def OnPressExitKey(self): self.interface.ToggleSystemDialog() return True ## BINARY CALLBACK ###################################################################################### # QUEST_CONFIRM if app.ENABLE_QUESTION_DLG_TIME_EXTENSION: def BINARY_OnQuestConfirm(self, msg, timeout, pid): confirmDialog = uiCommon.QuestionDialogWithTimeLimit() confirmDialog.SetText1(msg) confirmDialog.Open(timeout) confirmDialog.SetAcceptEvent(lambda answer=True, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide()) confirmDialog.SetCancelEvent(lambda answer=False, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide()) self.confirmDialog = confirmDialog else: def BINARY_OnQuestConfirm(self, msg, timeout, pid): confirmDialog = uiCommon.QuestionDialogWithTimeLimit() confirmDialog.Open(msg, timeout) confirmDialog.SetAcceptEvent(lambda answer=True, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide()) confirmDialog.SetCancelEvent(lambda answer=False, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide()) self.confirmDialog = confirmDialog # END_OF_QUEST_CONFIRM # CUBE def BINARY_Cube_Open(self, npcVNUM): self.currentCubeNPC = npcVNUM self.interface.OpenCubeWindow() if npcVNUM not in self.cubeInformation: net.SendChatPacket("/cube r_info") else: cubeInfoList = self.cubeInformation[npcVNUM] i = 0 for cubeInfo in cubeInfoList: self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"]) j = 0 for materialList in cubeInfo["materialList"]: for materialInfo in materialList: if app.ENABLE_CUBE_PERCENT_RENEWAL: itemVnum, itemCount, percent = materialInfo self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount, percent) else: itemVnum, itemCount = materialInfo self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount) j = j + 1 i = i + 1 self.interface.wndCube.Refresh() if app.ENABLE_CUBE_RELOAD_FIX: def BINARY_Reload_Cube(self): if app.ENABLE_CUBE_RENEWAL: self.interface.wndCubeRenewal.Close() else: self.cubeInformation.clear() self.interface.wndCube.ClearOldSlots() def BINARY_Cube_Close(self): self.interface.CloseCubeWindow() def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count): self.interface.UpdateCubeInfo(gold, itemVnum, count) def BINARY_Cube_Succeed(self, itemVnum, count): print "Å¥ºê Á¦ÀÛ ¼º°ø" self.interface.SucceedCubeWork(itemVnum, count) pass def BINARY_Cube_Failed(self): print "Å¥ºê Á¦ÀÛ ½ÇÆĞ" self.interface.FailedCubeWork() pass def BINARY_Cube_ResultList(self, npcVNUM, listText): #print listText if npcVNUM == 0: npcVNUM = self.currentCubeNPC self.cubeInformation[npcVNUM] = [] try: for eachInfoText in listText.split("/"): eachInfo = eachInfoText.split(",") itemVnum = int(eachInfo[0]) itemCount = int(eachInfo[1]) self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount}) self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount) resultCount = len(self.cubeInformation[npcVNUM]) requestCount = 7 modCount = resultCount % requestCount splitCount = resultCount / requestCount for i in xrange(splitCount): #print("/cube r_info %d %d" % (i * requestCount, requestCount)) net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount)) if 0 < modCount: #print("/cube r_info %d %d" % (splitCount * requestCount, modCount)) net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount)) except RuntimeError, msg: dbg.TraceError(msg) return 0 pass if app.ENABLE_CUBE_PERCENT_RENEWAL: def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText): # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000 try: if 3 > len(listText): dbg.TraceError("Wrong Cube Material Infomation") return 0 eachResultList = listText.split("@") cubeInfo = self.cubeInformation[self.currentCubeNPC] cube = self.interface.wndCube itemIndex = 0 for eachResultText in eachResultList: cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []] materialList = cubeInfo[startIndex + itemIndex]["materialList"] percent = 0 gold = 0 splitResult = eachResultText.split("]") if 1 < len(splitResult): new_gold = str(splitResult[1]).split("/") new_gold2 = str(new_gold[0]).split("/") gold = int(new_gold2[0]) percent = int(splitResult[1]) #print "splitResult : ", splitResult eachMaterialList = splitResult[0].split("&") i = 0 for eachMaterialText in eachMaterialList: complicatedList = eachMaterialText.split("|") if 0 < len(complicatedList): for complicatedText in complicatedList: (itemVnum, itemCount) = complicatedText.split(",") itemVnum = int(itemVnum) count_test = str(itemCount).split("/") itemCount = int(count_test[0]) cube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount, percent) materialList[i].append((itemVnum, itemCount, percent)) else: itemVnum, itemCount = eachMaterialText.split(",") itemVnum = int(itemVnum) itemCount = int(itemCount) cube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount, percent) materialList[i].append((itemVnum, itemCount,percent)) i = i + 1 itemIndex = itemIndex + 1 cube.Refresh() except RuntimeError, msg: dbg.TraceError(msg) return 0 pass else: def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText): # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000 try: if 3 > len(listText): dbg.TraceError("Wrong Cube Material Infomation") return 0 eachResultList = listText.split("@") cubeInfo = self.cubeInformation[self.currentCubeNPC] itemIndex = 0 for eachResultText in eachResultList: cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []] materialList = cubeInfo[startIndex + itemIndex]["materialList"] gold = 0 splitResult = eachResultText.split("/") if 1 < len(splitResult): gold = int(splitResult[1]) #print "splitResult : ", splitResult eachMaterialList = splitResult[0].split("&") i = 0 for eachMaterialText in eachMaterialList: complicatedList = eachMaterialText.split("|") if 0 < len(complicatedList): for complicatedText in complicatedList: (itemVnum, itemCount) = complicatedText.split(",") itemVnum = int(itemVnum) itemCount = int(itemCount) self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount) materialList[i].append((itemVnum, itemCount)) else: itemVnum, itemCount = eachMaterialText.split(",") itemVnum = int(itemVnum) itemCount = int(itemCount) self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount) materialList[i].append((itemVnum, itemCount)) i = i + 1 itemIndex = itemIndex + 1 self.interface.wndCube.Refresh() except RuntimeError, msg: dbg.TraceError(msg) return 0 pass # END_OF_CUBE def BINARY_Highlight_Item(self, inven_type, inven_pos): # @fixme003 (+if self.interface:) if self.interface: self.interface.Highligt_Item(inven_type, inven_pos) def BINARY_DragonSoulGiveQuilification(self): self.interface.DragonSoulGiveQuilification() def BINARY_DragonSoulRefineWindow_Open(self): self.interface.OpenDragonSoulRefineWindow() def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos): self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos) def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos): self.interface.SucceedDragonSoulRefine(inven_type, inven_pos) # END of DRAGON SOUL REFINE WINDOW def BINARY_SetBigMessage(self, message): if self.interface and self.interface.tipBoard: self.interface.bigBoard.SetTip(message) def BINARY_SetTipMessage(self, message): if self.interface and self.interface.tipBoard: self.interface.tipBoard.SetTip(message) def BINARY_AppendNotifyMessage(self, type): if not type in localeInfo.NOTIFY_MESSAGE: return chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type]) def BINARY_GuildWar_OnSendDeclare(self, guildID): pass if app.ENABLE_GUILD_WAR_REWORK: def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType, maxPlayer, maxScore): mainCharacterName = player.GetMainCharacterName() masterName = guild.GetGuildMasterName() if mainCharacterName == masterName: self.__GuildWar_OpenAskDialog(guildID, warType, maxPlayer, maxScore) else: def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType): mainCharacterName = player.GetMainCharacterName() masterName = guild.GetGuildMasterName() if mainCharacterName == masterName: self.__GuildWar_OpenAskDialog(guildID, warType) def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point): self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point) def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp): self.interface.OnStartGuildWar(guildSelf, guildOpp) def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp): self.interface.OnEndGuildWar(guildSelf, guildOpp) def BINARY_BettingGuildWar_SetObserverMode(self, isEnable): self.interface.BINARY_SetObserverMode(isEnable) def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount): self.interface.wndMiniMap.UpdateObserverCount(observerCount) def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount): guildID1 = int(guildID1) guildID2 = int(guildID2) memberCount1 = int(memberCount1) memberCount2 = int(memberCount2) observerCount = int(observerCount) self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2) self.interface.wndMiniMap.UpdateObserverCount(observerCount) if app.ENABLE_GUILD_WAR_REWORK: def __GuildWar_OpenAskDialog(self, guildID, warType, maxPlayer, maxScore): guildName = guild.GetGuildName(guildID) if "Noname" == guildName: return import uiGuild questionDialog = uiGuild.AcceptGuildWarDialog() questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept) questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline) questionDialog.Open(guildName, warType, maxPlayer, maxScore) self.guildWarQuestionDialog = questionDialog else: def __GuildWar_OpenAskDialog(self, guildID, warType): guildName = guild.GetGuildName(guildID) if "Noname" == guildName: return import uiGuild questionDialog = uiGuild.AcceptGuildWarDialog() questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept) questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline) questionDialog.Open(guildName, warType) self.guildWarQuestionDialog = questionDialog def __GuildWar_CloseAskDialog(self): self.guildWarQuestionDialog.Close() self.guildWarQuestionDialog = None def __GuildWar_OnAccept(self): guildName = self.guildWarQuestionDialog.GetGuildName() if app.ENABLE_GUILD_WAR_REWORK: warType = self.guildWarQuestionDialog.GetWarType() maxScore = self.guildWarQuestionDialog.GetMaxScore() maxPlayer = self.guildWarQuestionDialog.GetMaxPlayerCount() if app.ENABLE_GUILD_WAR_REWORK: net.SendChatPacket("/war %s %s %s %s" % (str(guildName), str(warType), str(maxPlayer), str(maxScore))) else: net.SendChatPacket("/war " + guildName) self.__GuildWar_CloseAskDialog() return 1 def __GuildWar_OnDecline(self): guildName = self.guildWarQuestionDialog.GetGuildName() net.SendChatPacket("/nowar " + guildName) self.__GuildWar_CloseAskDialog() return 1 ## BINARY CALLBACK ###################################################################################### def __ServerCommand_Build(self): serverCommandList={ "ConsoleEnable" : self.__Console_Enable, "MasterEnable" : self.__Master_Enable, "DayMode" : self.__DayMode_Update, "PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update, "CloseRestartWindow" : self.__RestartDialog_Close, "OpenPrivateShop" : self.__PrivateShop_Open, "PartyHealReady" : self.PartyHealReady, "ShowMeSafeboxPassword" : self.AskSafeboxPassword, "CloseSafebox" : self.CommandCloseSafebox, # ITEM_MALL "CloseMall" : self.CommandCloseMall, "ShowMeMallPassword" : self.AskMallPassword, "item_mall" : self.__ItemMall_Open, # END_OF_ITEM_MALL "RefineSuceeded" : self.RefineSuceededMessage, "RefineFailed" : self.RefineFailedMessage, "PartyRequest" : self.__PartyRequestQuestion, "PartyRequestDenied" : self.__PartyRequestDenied, "horse_state" : self.__Horse_UpdateState, "hide_horse_state" : self.__Horse_HideState, "WarUC" : self.__GuildWar_UpdateMemberCount, "test_server" : self.__EnableTestServerFlag, "mall" : self.__InGameShop_Show, # PRIVATE_SHOP_PRICE_LIST "MyShopPriceList" : self.__PrivateShop_PriceList, # END_OF_PRIVATE_SHOP_PRICE_LIST } if app.ENABLE_SKILLBOOK_SYSTEM: serverCommandList["bkekranac"] = self.hizlibecerikitabi if app.ENABLE_SOULSTONE_SYSTEM: serverCommandList["ruhtasiekranac"] = self.hizliruhtasi if app.ENABLE_GLOBAL_MESSAGE_UTILITY: serverCommandList["OpenBulkWhisperPanel"] = self.whisperAdmin.OpenWindow if app.ENABLE_GROWTH_PET_SYSTEM: serverCommandList["PetEvolution"] = self.SetPetEvolution serverCommandList["PetName"] = self.SetPetName serverCommandList["PetLevel"] = self.SetPetLevel serverCommandList["PetDuration"] = self.SetPetDuration serverCommandList["PetAgeDuration"] = self.SetPetAgeDuration serverCommandList["PetBonus"] = self.SetPetBonus serverCommandList["PetSkill"] = self.SetPetskill serverCommandList["PetIcon"] = self.SetPetIcon serverCommandList["PetExp"] = self.SetPetExp serverCommandList["PetUnsummon"] = self.PetUnsummon serverCommandList["OpenPetIncubator"] = self.OpenPetIncubator serverCommandList["OnResultPetAttrDetermine"] = self.__OnResultPetAttrDetermine serverCommandList["OnResultPetAttrChange"] = self.__OnResultPetAttrChange if app.ENABLE_GROWTH_MOUNT_SYSTEM: serverCommandList["MountEvolution"] = self.SetMountEvolution serverCommandList["MountName"] = self.SetMountName serverCommandList["MountLevel"] = self.SetMountLevel serverCommandList["MountDuration"] = self.SetMountDuration serverCommandList["MountAgeDuration"] = self.SetMountAgeDuration serverCommandList["MountBonus"] = self.SetMountBonus serverCommandList["MountSkill"] = self.SetMountskill serverCommandList["MountIcon"] = self.SetMountIcon serverCommandList["MountExp"] = self.SetMountExp serverCommandList["MountUnsummon"] = self.MountUnsummon serverCommandList["OpenMountIncubator"] = self.OpenMountIncubator serverCommandList["OnResultMountAttrDetermine"] = self.__OnResultMountAttrDetermine serverCommandList["OnResultMountAttrChange"] = self.__OnResultMountAttrChange if app.ENABLE_EVENT_CALENDAR_SYSTEM: serverCommandList["OpenEventCalendar"] = self.QUEST_OpenEventCalendar if app.ENABLE_BIOLOG_SYSTEM: serverCommandList["OpenBiologWindow"] = self.interface.GCHandleBiologData if app.ENABLE_DUNGEON_INFO_SYSTEM: serverCommandList["CleanDungeonInfo"] = self.CleanDungeonInfo serverCommandList["UpdateDungeonInfo"] = self.UpdateDungeonInfo serverCommandList["UpdateDungeonTime"] = self.UpdateDungeonTime serverCommandList["UpdateDungeonInfoBonus"] = self.UpdateDungeonInfoBonus if app.ENABLE_NEW_DUNGEON_TYPE: serverCommandList["DugeonRemainTime"] = self.__UpdateDungeonRemainTime else: serverCommandList["DugeonRemainTime"] = self.NoneMethod if app.ENABLE_INGAME_MALL_SYSTEM: serverCommandList["BINARY_ItemShop_Close"] = self.BINARY_ItemShop_Close serverCommandList["BINARY_ItemShop_Clear"] = self.BINARY_ItemShop_ClearData if app.ENABLE_BATTLE_PASS_SYSTEM: serverCommandList["SpecialEventUntil"] = self.SpecialEventUntil serverCommandList["EnableBattlePassUI"] = self.EnableBattlePassUI if app.ENABLE_MULTIFARM_BLOCK: serverCommandList["UpdateMultiFarmAffect"] = self.UpdateMultiFarmAffect serverCommandList["UpdateMultiFarmPlayer"] = self.UpdateMultiFarmPlayer self.serverCommander=stringCommander.Analyzer() for serverCommandItem in serverCommandList.items(): self.serverCommander.SAFE_RegisterCallBack( serverCommandItem[0], serverCommandItem[1] ) def BINARY_ServerCommand_Run(self, line): #dbg.TraceError(line) try: #print " BINARY_ServerCommand_Run", line return self.serverCommander.Run(line) except RuntimeError, msg: dbg.TraceError(msg) return 0 def __ProcessPreservedServerCommand(self): try: command = net.GetPreservedServerCommand() while command: print " __ProcessPreservedServerCommand", command self.serverCommander.Run(command) command = net.GetPreservedServerCommand() except RuntimeError, msg: dbg.TraceError(msg) return 0 def PartyHealReady(self): self.interface.PartyHealReady() def AskSafeboxPassword(self): self.interface.AskSafeboxPassword() # ITEM_MALL def AskMallPassword(self): self.interface.AskMallPassword() def __ItemMall_Open(self): self.interface.OpenItemMall(); def CommandCloseMall(self): self.interface.CommandCloseMall() # END_OF_ITEM_MALL def RefineSuceededMessage(self): self.PopupMessage(localeInfo.REFINE_SUCCESS) if app.ENABLE_REFINE_REWORK: self.interface.CheckRefineDialog(False) def RefineFailedMessage(self): self.PopupMessage(localeInfo.REFINE_FAILURE) if app.ENABLE_REFINE_REWORK: self.interface.CheckRefineDialog(True) def CommandCloseSafebox(self): self.interface.CommandCloseSafebox() # PRIVATE_SHOP_PRICE_LIST def __PrivateShop_PriceList(self, itemVNum, itemPrice): uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice) # END_OF_PRIVATE_SHOP_PRICE_LIST def __Horse_HideState(self): self.affectShower.SetHorseState(0, 0, 0) def __Horse_UpdateState(self, level, health, battery): self.affectShower.SetHorseState(int(level), int(health), int(battery)) def __RestartDialog_Close(self): self.interface.CloseRestartDialog() self.isCurrentCharDead = False def __Console_Enable(self): constInfo.CONSOLE_ENABLE = True app.EnableSpecialCameraMode() ui.EnablePaste(True) def __Master_Enable(self): constInfo.IS_GAME_MASTER = 1 ## PrivateShop def __PrivateShop_Open(self): self.interface.OpenPrivateShopInputNameDialog() def BINARY_PrivateShop_Appear(self, vid, text): self.interface.AppearPrivateShop(vid, text) def BINARY_PrivateShop_Disappear(self, vid): self.interface.DisappearPrivateShop(vid) ## DayMode def __PRESERVE_DayMode_Update(self, mode): if "light"==mode: background.SetEnvironmentData(0) elif "dark"==mode: background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT) background.SetEnvironmentData(1) def __DayMode_Update(self, mode): if "light"==mode: self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight) elif "dark"==mode: self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark) def __DayMode_OnCompleteChangeToLight(self): background.SetEnvironmentData(0) self.curtain.FadeIn() def __DayMode_OnCompleteChangeToDark(self): background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT) background.SetEnvironmentData(1) self.curtain.FadeIn() def __PartyRequestQuestion(self, vid): vid = int(vid) partyRequestQuestionDialog = uiCommon.QuestionDialog() partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT) partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT) partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY) partyRequestQuestionDialog.SetAcceptEvent(lambda arg=True: self.__AnswerPartyRequest(arg)) partyRequestQuestionDialog.SetCancelEvent(lambda arg=False: self.__AnswerPartyRequest(arg)) partyRequestQuestionDialog.Open() partyRequestQuestionDialog.vid = vid self.partyRequestQuestionDialog = partyRequestQuestionDialog def __AnswerPartyRequest(self, answer): if not self.partyRequestQuestionDialog: return vid = self.partyRequestQuestionDialog.vid if answer: net.SendChatPacket("/party_request_accept " + str(vid)) else: net.SendChatPacket("/party_request_deny " + str(vid)) self.partyRequestQuestionDialog.Close() self.partyRequestQuestionDialog = None def __PartyRequestDenied(self): self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED) def __EnableTestServerFlag(self): app.EnableTestServerFlag() def __InGameShop_Show(self, url): self.interface.OpenWebWindow(url) if app.ENABLE_REFINE_MSG_REWORK: def BINARY_RefineFailedTypeMessage(self, type): REFINE_FAILURE_DICT = { player.REFINE_FAIL_GRADE_DOWN: localeInfo.REFINE_FAILURE_GRADE_DOWN, player.REFINE_FAIL_DEL_ITEM: localeInfo.REFINE_FAILURE_DEL_ITEM, player.REFINE_FAIL_KEEP_GRADE: localeInfo.REFINE_FAILURE_KEEP_GRADE, player.REFINE_FAIL_MAX: localeInfo.REFINE_FAILURE } snd.PlaySound("sound/ui/refine_fail.wav") self.PopupMessage(REFINE_FAILURE_DICT.get(type, player.REFINE_FAIL_MAX)) if app.ENABLE_ACCE_SYSTEM: def ActAcce(self, iAct, bWindow): if self.interface: self.interface.ActAcce(iAct, bWindow) def AlertAcce(self, bWindow): snd.PlaySound("sound/ui/make_soket.wav") if app.ENABLE_CHANNEL_INFO_UPDATE: def BINARY_ReceiveChannel(self, channel): if self.interface: if self.interface.wndMiniMap: self.interface.wndMiniMap.UpdateChannelInfo(channel) if app.ENABLE_CHEST_INFO_SYSTEM: def BINARY_AddChestDropInfo(self, chestVnum, pos_window, pos_cell, pageIndex, slotIndex, itemVnum, itemCount): if self.interface: self.interface.AddChestDropInfo(chestVnum, pos_window, pos_cell, pageIndex, slotIndex, itemVnum, itemCount) def BINARY_RefreshChestDropInfo(self, chestVnum): if self.interface: self.interface.RefreshChestDropInfo(chestVnum) if app.ENABLE_SOULSTONE_SYSTEM: if app.ENABLE_SAGE_SKILL: def hizliruhtasi(self, type): self.ruhtasi.Show(type) else: def hizliruhtasi(self): self.ruhtasi.Show() if app.ENABLE_SKILLBOOK_SYSTEM: def hizlibecerikitabi(self): self.becerikitabi.Show() if app.ENABLE_GROWTH_PET_SYSTEM: def SetPetEvolution(self, evo): petname = [localeInfo.PET_EVOLUTION_0, localeInfo.PET_EVOLUTION_1, localeInfo.PET_EVOLUTION_2, localeInfo.PET_EVOLUTION_3] self.petmain.SetEvolveName(petname[int(evo)]) self.petmain.SetEvolveInt(int(evo)) def SetPetName(self, name): if len(name) > 1 and name != "": self.petmini.Show() self.petmain.SetName(name) def SetPetLevel(self, level): self.petmain.SetLevel(level) def SetPetDuration(self, dur, durt): if int(durt) > 0: self.petmini.SetDuration(dur, durt) self.petmain.SetDuration(dur, durt) def SetPetAgeDuration(self, age): if (int(age)) > 0: self.petmain.SetAgeDuration(age) def SetPetBonus(self, hp, dif, sp): self.petmain.SetHp(hp) self.petmain.SetDef(dif) self.petmain.SetSp(sp) def SetPetskill(self, slot, idx, lv): if int(lv) > 0: self.petmini.SetSkill(slot, idx, lv) self.petmain.SetSkill(slot, idx, lv) self.affectShower.BINARY_NEW_AddAffect(5400+int(idx),int(constInfo.LASTAFFECT_POINT)+1,int(constInfo.LASTAFFECT_VALUE)+1, 0) if int(slot)==0: constInfo.SKILL_PET1=5400+int(idx) if int(slot)==1: constInfo.SKILL_PET2=5400+int(idx) if int(slot)==2: constInfo.SKILL_PET3=5400+int(idx) def SetPetIcon(self, vnum): if int(vnum) > 0: self.petmini.SetImageSlot(vnum) self.petmain.SetImageSlot(vnum) def SetPetExp(self, exp, expi, exptot): if int(exptot) > 0: self.petmini.SetExperience(exp, expi, exptot) self.petmain.SetExperience(exp, expi, exptot) def PetUnsummon(self): self.petmini.SetDefaultInfo() self.petmini.Close() self.petmain.SetDefaultInfo() self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET1),0) self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET2),0) self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET3),0) constInfo.SKILL_PET1 = 0 constInfo.SKILL_PET2 = 0 constInfo.SKILL_PET3 = 0 def OpenPetMainGui(self): if self.petmain.IsShow() == True: self.petmain.Close() else: self.petmain.Show() self.petmain.SetTop() def OpenPetIncubator(self, pet_new = 0, pet_cell = 0): self.petinc.LoadPetIncubatorImg(pet_new, pet_cell) self.petinc.Show() self.petinc.SetTop() def __OnResultPetAttrDetermine(self, pet_type): self.petmain.OnResultPetAttrDetermine(int(pet_type)) def __OnResultPetAttrChange(self, pet_type): self.petmain.OnResultPetAttrChange(int(pet_type)) if app.ENABLE_GROWTH_MOUNT_SYSTEM: def SetMountEvolution(self, evo): mountname = [localeInfo.PET_EVOLUTION_0, localeInfo.PET_EVOLUTION_1, localeInfo.PET_EVOLUTION_2, localeInfo.PET_EVOLUTION_3] self.mountmain.SetEvolveName(mountname[int(evo)]) self.mountmain.SetEvolveInt(int(evo)) def SetMountName(self, name): #if len(name) > 1 and name != "": #self.mountmain.Show() self.mountmain.SetName(name) def SetMountLevel(self, level): self.mountmain.SetLevel(level) def SetMountDuration(self, dur, durt): if int(durt) > 0: self.mountmini.SetDuration(dur, durt) self.mountmain.SetDuration(dur, durt) def SetMountAgeDuration(self, age): if (int(age)) > 0: self.mountmain.SetAgeDuration(age) def SetMountBonus(self, hp, dif, sp): self.mountmain.SetHp(hp) self.mountmain.SetDef(dif) self.mountmain.SetSp(sp) def SetMountskill(self, slot, idx, lv): if int(lv) > 0: self.mountmini.SetSkill(slot, idx, lv) self.mountmain.SetSkill(slot, idx, lv) self.affectShower.BINARY_NEW_AddAffect(7400+int(idx),int(constInfo.M_LASTAFFECT_POINT)+1,int(constInfo.M_LASTAFFECT_VALUE)+1, 0) if int(slot)==0: constInfo.SKILL_MOUNT1=7400+int(idx) if int(slot)==1: constInfo.SKILL_MOUNT2=7400+int(idx) if int(slot)==2: constInfo.SKILL_MOUNT3=7400+int(idx) def SetMountIcon(self, vnum): if int(vnum) > 0: self.mountmini.SetImageSlot(vnum) self.mountmain.SetImageSlot(vnum) def SetMountExp(self, exp, expi, exptot): if int(exptot) > 0: self.mountmini.SetExperience(exp, expi, exptot) self.mountmain.SetExperience(exp, expi, exptot) def MountUnsummon(self): self.mountmini.SetDefaultInfo() #self.mountmini.Close() self.mountmain.SetDefaultInfo() self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_MOUNT1),0) self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_MOUNT2),0) self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_MOUNT3),0) constInfo.SKILL_MOUNT1 = 0 constInfo.SKILL_MOUNT2 = 0 constInfo.SKILL_MOUNT3 = 0 def OpenMountMainGui(self): if self.mountmain.IsShow() == True: self.mountmain.Close() else: self.mountmain.Show() self.mountmain.SetTop() def OpenMountIncubator(self, pet_new = 0, pet_cell = 0): self.mountinc.LoadPetIncubatorImg(pet_new, pet_cell) self.mountinc.Show() self.mountinc.SetTop() def __OnResultMountAttrDetermine(self, pet_type): self.mountmain.OnResultPetAttrDetermine(int(pet_type)) def __OnResultMountAttrChange(self, pet_type): self.mountmain.OnResultPetAttrChange(int(pet_type)) if app.ENABLE_EVENT_SYSTEM: def OnRecvEventInformation(self): if self.interface: self.interface.RefreshEventWindowDialog() if app.ENABLE_SKILL_CHOOSE_SYSTEM: def BINARY_SkillChoose(self, raceNum): if self.interface: self.interface.openSkillChoose(raceNum) if app.ENABLE_CHANGELOOK_SYSTEM: if app.ENABLE_MOUNT_CHANGELOOK_SYSTEM: def ActChangeLook(self, iAct, bMount): if self.interface: self.interface.ActChangeLook(iAct, bMount) else: def ActChangeLook(self, iAct): if self.interface: self.interface.ActChangeLook(iAct) def AlertChangeLook(self): self.PopupMessage(localeInfo.CHANGE_LOOK_DEL_ITEM) if app.ENABLE_DUNGEON_INFO_SYSTEM: def CleanDungeonInfo(self): import constInfo constInfo.dungeonInfo = [] def UpdateDungeonInfo(self, type, organization, minLevel, partyMembers, mapIndex, mapName, mapEntrance, mapCoordX, mapCoordY, cooldown, duration, rejoinTime, maxLevel, strengthBonus, resistanceBonus, itemVnum, bossVnum): type = int(type) organization = int(organization) minLevel = int(minLevel) partyMembers = int(partyMembers) mapName = str(mapName).replace("_", " ") mapEntrance = str(mapEntrance).replace("_", " ") mapIndex = int(mapIndex) mapCoordX = int(mapCoordX) mapCoordY = int(mapCoordY) cooldown = int(cooldown) duration = int(duration) rejoinTime = int(rejoinTime) maxLevel = int(maxLevel) strengthBonus = int(strengthBonus) resistanceBonus = int(resistanceBonus) itemVnum = int(itemVnum) bossVnum = int(bossVnum) constInfo.dungeonInfo.append(\ { "type" : type,\ "organization" : organization,\ "min_level" : minLevel,\ "party_members" : partyMembers,\ "map" : mapName,\ "entrance_map" : mapEntrance,\ "map_index" : mapIndex,\ "map_coord_x" : mapCoordX,\ "map_coord_y" : mapCoordY,\ "cooldown" : cooldown,\ "duration" : duration,\ "rejoin_time" : rejoinTime,\ "max_level" : maxLevel,\ "strength_bonus" : strengthBonus,\ "resistance_bonus" : resistanceBonus,\ "item_vnum" : itemVnum,\ "boss_vnum" : bossVnum,\ }, ) def UpdateDungeonTime(self, map_ind, ttime): map_ind = int(map_ind) ttime = int(ttime) for di in constInfo.dungeonInfo: if di["map_index"] == map_ind: di["rejoin_time"] = ttime break def UpdateDungeonPNGInfo(self, png_id): png_id = int(png_id) constInfo.dungeonPNGInfo.append({"id" : png_id},) def UpdateDungeonInfoBonus(self, data): arg = data.split(',') required_bonus = arg[0] temp_required_bonus = [] for i in required_bonus.split('#'): typevalue = i.split('|') temp_required_bonus.append([typevalue[0], typevalue[1]]) ds_bonus = arg[1] temp_ds_bonus = [] for i in ds_bonus.split('#'): typevalue = i.split('|') temp_ds_bonus.append([typevalue[0], typevalue[1], typevalue[2], typevalue[3], typevalue[4]]) resist_bonus = arg[2] temp_resist_bonus = [] for i in resist_bonus.split('#'): typevalue = i.split('|') temp_resist_bonus.append([typevalue[0], typevalue[1]]) att_bonus = arg[3] temp_att_bonus = [] for i in att_bonus.split('#'): typevalue = i.split('|') temp_att_bonus.append([typevalue[0], typevalue[1]]) boss_vnum = arg[4] constInfo.dungeonInfoBonus.append(\ { "required_bonus0_type" : temp_required_bonus[0][0],\ "required_bonus0_value" : temp_required_bonus[0][1],\ "required_bonus1_type" : temp_required_bonus[1][0],\ "required_bonus1_value" : temp_required_bonus[1][1],\ "required_bonus2_type" : temp_required_bonus[2][0],\ "required_bonus2_value" : temp_required_bonus[2][1],\ "required_bonus3_type" : temp_required_bonus[3][0],\ "required_bonus3_value" : temp_required_bonus[3][1],\ "required_bonus4_type" : temp_required_bonus[4][0],\ "required_bonus4_value" : temp_required_bonus[4][1],\ "ds_bonus0_type" : temp_ds_bonus[0][0],\ "ds_bonus0_step" : temp_ds_bonus[0][1],\ "ds_bonus0_grade" : temp_ds_bonus[0][2],\ "ds_bonus0_set" : temp_ds_bonus[0][3],\ "ds_bonus0_level" : temp_ds_bonus[0][4],\ "ds_bonus1_type" : temp_ds_bonus[1][0],\ "ds_bonus1_step" : temp_ds_bonus[1][1],\ "ds_bonus1_grade" : temp_ds_bonus[1][2],\ "ds_bonus1_set" : temp_ds_bonus[1][3],\ "ds_bonus1_level" : temp_ds_bonus[1][4],\ "ds_bonus2_type" : temp_ds_bonus[2][0],\ "ds_bonus2_step" : temp_ds_bonus[2][1],\ "ds_bonus2_grade" : temp_ds_bonus[2][2],\ "ds_bonus2_set" : temp_ds_bonus[2][3],\ "ds_bonus2_level" : temp_ds_bonus[2][4],\ "ds_bonus3_type" : temp_ds_bonus[3][0],\ "ds_bonus3_step" : temp_ds_bonus[3][1],\ "ds_bonus3_grade" : temp_ds_bonus[3][2],\ "ds_bonus3_set" : temp_ds_bonus[3][3],\ "ds_bonus3_level" : temp_ds_bonus[3][4],\ "ds_bonus4_type" : temp_ds_bonus[4][0],\ "ds_bonus4_step" : temp_ds_bonus[4][1],\ "ds_bonus4_grade" : temp_ds_bonus[4][2],\ "ds_bonus4_set" : temp_ds_bonus[4][3],\ "ds_bonus4_level" : temp_ds_bonus[4][4],\ "ds_bonus5_type" : temp_ds_bonus[5][0],\ "ds_bonus5_step" : temp_ds_bonus[5][1],\ "ds_bonus5_grade" : temp_ds_bonus[5][2],\ "ds_bonus5_set" : temp_ds_bonus[5][3],\ "ds_bonus5_level" : temp_ds_bonus[5][4],\ "resist_bonus0_type" : temp_resist_bonus[0][0],\ "resist_bonus0_value" : temp_resist_bonus[0][1],\ "resist_bonus1_type" : temp_resist_bonus[1][0],\ "resist_bonus1_value" : temp_resist_bonus[1][1],\ "resist_bonus2_type" : temp_resist_bonus[2][0],\ "resist_bonus2_value" : temp_resist_bonus[2][1],\ "resist_bonus3_type" : temp_resist_bonus[3][0],\ "resist_bonus3_value" : temp_resist_bonus[3][1],\ "resist_bonus4_type" : temp_resist_bonus[4][0],\ "resist_bonus4_value" : temp_resist_bonus[4][1],\ "att_bonus0_type" : temp_att_bonus[0][0],\ "att_bonus0_value" : temp_att_bonus[0][1],\ "att_bonus1_type" : temp_att_bonus[1][0],\ "att_bonus1_value" : temp_att_bonus[1][1],\ "att_bonus2_type" : temp_att_bonus[2][0],\ "att_bonus2_value" : temp_att_bonus[2][1],\ "att_bonus3_type" : temp_att_bonus[3][0],\ "att_bonus3_value" : temp_att_bonus[3][1],\ "att_bonus4_type" : temp_att_bonus[4][0],\ "att_bonus4_value" : temp_att_bonus[4][1],\ "boss_vnum" : boss_vnum,\ }, ) if app.ENABLE_EVENT_CALENDAR_SYSTEM: def QUEST_OpenEventCalendar(self): if self.interface: self.interface.OpenEventCalendar() if app.ENABLE_SWITCHBOT_SYSTEM: def RefreshSwitchbotWindow(self): if self.interface: self.interface.RefreshSwitchbotWindow() def RefreshSwitchbotItem(self, slot): if self.interface: self.interface.RefreshSwitchbotItem(slot) if app.ENABLE_CUBE_RENEWAL: def BINARY_CUBE_RENEWAL_OPEN(self): if self.interface: self.interface.BINARY_CUBE_RENEWAL_OPEN() if app.ENABLE_NEW_DUNGEON_TYPE: def BINARY_SetDungeonMission(self, message): self.interface.wndMissionBoard.SetMission(message) def BINARY_SetDungeonSubMission(self, message): self.interface.wndMissionBoard.SetSubMission(message) def BINARY_ClearDungeonMission(self): self.interface.wndMissionBoard.CleanMission() if app.ENABLE_GLOBAL_MESSAGE_UTILITY: def BINARY_OnRecvBulkWhisper(self, content): content = content.replace("$", " ") if app.ENABLE_WEB_LINK_SYSTEM: link = self.GetLink(content) if link != "": import chr if not chr.IsGameMaster(): content = content.replace(link, "|cFF00C0FC|h|Hweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r") else: content = content.replace(link, "|cFF00C0FC|h|Hsysweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r") self.interface.RegisterGameMasterName(localeInfo.SYSTEM_EX_MSG_TITLE) chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, localeInfo.SYSTEM_EX_MSG_TITLE, content) self.interface.RecvWhisper(localeInfo.SYSTEM_EX_MSG_TITLE) if app.ENABLE_WEB_LINK_SYSTEM: def GetLink(self, text): link = "" start = text.find("http://") if start == -1: start = text.find("https://") if start == -1: return "" return text[start:len(text)].split(" ")[0] if app.ENABLE_EXP_INFO_TEXT: def OnRecvExp(self, exp): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_RECV_EXP % (localeInfo.PrettyNumber(exp))) if app.ENABLE_CHEQUE_SYSTEM: def OnPickCheque(self, cheque): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHEQUE_SYSTEM_PICK_WON % (cheque)) if app.ENABLE_NEW_DUNGEON_TYPE: def __UpdateDungeonRemainTime(self, remainTime): remainTime = int(remainTime) # chat.AppendChat(chat.CHAT_TYPE_INFO, "Zindan Sayaci: %s" % localeInfo.FormatTime(remainTime)) if self.interface.wndDungeonRemainTimer: self.interface.wndDungeonRemainTimer.SetRemainTime(remainTime) if app.ENABLE_BAN_REASON_UTILITY: def OpenBanWindow(self): if chr.IsGameMaster(player.GetMainCharacterIndex()) and (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)): # Open window with CTRL + F5 if self.interface: self.interface.ToggleBanManager() if app.ENABLE_OFFLINE_SHOP: def OpenShopOwnerNoShop(self): if self.interface: self.interface.OpenPrivateShopInputNameDialog() if app.ENABLE_TARGET_BOARD_RENEWAL: def BINARY_RecvMobInformation(self, arg): if self.targetBoard: self.targetBoard.RecvMobInformation(arg) def BINARY_MobInformationDropItem(self, vnum, count): if self.targetBoard: self.targetBoard.RecvMobInformationDropItem(vnum, count, 0) if app.ENABLE_DUNGEON_INFO_SYSTEM: def BINARY_MobInformationDungeonDropItem(self, vnum, count): if self.interface: self.interface.RecvMobInformationDungeonDropItem(vnum, count, 0) def BINARY_RecvDungeonMobInformation(self): if self.interface: self.interface.OpenDungeonInfoBossDrop() def RegisterSkill(self): race = net.GetMainActorRace() group = net.GetMainActorSkillGroup() empire = net.GetMainActorEmpire() playerSettingModule.RegisterSkill(race, group, empire) if app.ENABLE_PLAYER_STATISTICS: def ReceivePlayerStatisticsPacket(self, killedshinsoo, killedchunjo, killedjinno, totalkill, duelwon, duellost, killedmonster, killedstone, killedboss, completeddungeon, takedfish, beststonedamage, bestbossdamage): constInfo.PLAYER_STATISTICS_DATA = [ int(killedshinsoo), int(killedchunjo), int(killedjinno), int(totalkill), int(duelwon), int(duellost), int(killedmonster), int(killedstone), int(killedboss), int(completeddungeon), int(takedfish), long(beststonedamage), long(bestbossdamage), ] if self.interface: self.interface.RefreshPlayerStatistics() if app.ENABLE_SPAM_BOT_SYSTEM: def OpenSpamBot(self): #if not uiSpamBot.isEnabledName(player.GetMainCharacterName()): # return if self.Spamdialog and self.Spamdialog.IsShow(): self.Spamdialog.Close() else: self.Spamdialog.Open() if app.ENABLE_REMOTE_SHOP_SYSTEM: def OpenRemoteShop(self): if True == self.remoteshop.IsShow(): self.remoteshop.Hide() else: self.remoteshop.Open() self.remoteshop.SetTop() if app.ENABLE_INGAME_MALL_SYSTEM: def BINARY_ItemShop_Close(self): self.PopupMessage(localeInfo.NESNE_UYARI_RELOAD) self.interface.CloseItemShop() def BINARY_ItemShop_ClearData(self): self.interface.RefreshItemShop() def BINARY_ItemShop_ItemData(self, id, category, sub_category, vnum, count, coins, socketzero): if not constInfo.IS_ITEM_DATA.has_key(category): constInfo.IS_ITEM_DATA[category] = {} if not constInfo.IS_ITEM_DATA[category].has_key(sub_category): constInfo.IS_ITEM_DATA[category][sub_category] = [] item.SelectItem(vnum) constInfo.IS_ITEM_DATA[category][sub_category].append((None, id, vnum, coins, count, socketzero)) constInfo.IS_ITEM_SEARCH_DATA.append((toLower(item.GetItemName()), id, vnum, coins, count, socketzero)) if app.ENABLE_BATTLE_PASS_SYSTEM: def BINARY_BattlePassOpen(self): if self.interface: self.interface.OpenBattlePass() def BINARY_BattlePassAddMission(self, missionType, missionInfo1, missionInfo2, missionInfo3, skipCost): if self.interface: self.interface.AddBattlePassMission(missionType, missionInfo1, missionInfo2, missionInfo3, skipCost) def BINARY_BattlePassAddMissionReward(self, missionType, itemVnum, itemCount): if self.interface: self.interface.AddBattlePassMissionReward(missionType, itemVnum, itemCount) def BINARY_BattlePassUpdate(self, missionType, newProgress): if self.interface: self.interface.UpdateBattlePassMission(missionType, newProgress) def BINARY_BattlePassAddReward(self, itemVnum, itemCount): if self.interface: self.interface.AddBattlePassReward(itemVnum, itemCount) def BINARY_BattlePassAddRanking(self, pos, playerName, finishTime): if self.interface: self.interface.AddBattlePassRanking(pos, playerName, finishTime) def BINARY_BattlePassRefreshRanking(self): if self.interface: self.interface.RefreshBattlePassRanking() def BINARY_BattlePassOpenRanking(self): if self.interface: self.interface.OpenBattlePassRanking() def SpecialEventUntil(self, tillNextSeconds): if self.interface: self.interface.SetEventUntilTime(tillNextSeconds) def EnableBattlePassUI(self): if app.ENABLE_AUTO_HUNT_SYSTEM: self.CheckAfterLogin() if self.interface: self.interface.EnableBattlePassUI() if app.ENABLE_AUTO_HUNT_SYSTEM: def CheckAfterLogin(self): if self.interface: self.interface.CheckAfterLogin() if app.ENABLE_TELEPORT_SYSTEM: def OpenTeleportUi(self): self.wndTeleportUi.Open() if app.ENABLE_MULTIFARM_BLOCK: def UpdateMultiFarmPlayer(self, multiFarmPlayer): self.affectShower.SetMultiFarmPlayer(str(multiFarmPlayer)) def UpdateMultiFarmAffect(self, multiFarmStatus, isNewStatus): self.affectShower.SetMultiFarmInfo(int(multiFarmStatus)) if int(isNewStatus) == 1: if int(multiFarmStatus) == 1: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MULTI_FARM_ACTIVE_CHAT) else: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MULTI_FARM_DEACTIVE_CHAT) app.SetMultiFarmExeIcon(int(multiFarmStatus))