Advertisement
Guest User

Untitled

a guest
Sep 19th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.54 KB | None | 0 0
  1. import os
  2. import app
  3. import dbg
  4. import grp
  5. import item
  6. import background
  7. import chr
  8. import chrmgr
  9. import player
  10. import snd
  11. import chat
  12. import textTail
  13. import snd
  14. import net
  15. import effect
  16. import wndMgr
  17. import fly
  18. import systemSetting
  19. import quest
  20. import guild
  21. import skill
  22. import messenger
  23. import localeInfo
  24. import constInfo
  25. import exchange
  26. import ime
  27.  
  28. from switchbot import Bot
  29. import ui
  30. import uiCommon
  31. import uiPhaseCurtain
  32. import uiMapNameShower
  33. import uiAffectShower
  34. import uiPlayerGauge
  35. import uiCharacter
  36. import uiTarget
  37.  
  38. # PRIVATE_SHOP_PRICE_LIST
  39. import uiPrivateShopBuilder
  40. # END_OF_PRIVATE_SHOP_PRICE_LIST
  41.  
  42. import mouseModule
  43. import consoleModule
  44. import localeInfo
  45.  
  46. import playerSettingModule
  47. import interfaceModule
  48.  
  49. import musicInfo
  50. import debugInfo
  51. import stringCommander
  52.  
  53. from _weakref import proxy
  54.  
  55. # TEXTTAIL_LIVINGTIME_CONTROL
  56. #if localeInfo.IsJAPAN():
  57. # app.SetTextTailLivingTime(8.0)
  58. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  59.  
  60. # SCREENSHOT_CWDSAVE
  61. SCREENSHOT_CWDSAVE = FALSE
  62. SCREENSHOT_DIR = None
  63.  
  64. if localeInfo.IsEUROPE():
  65. SCREENSHOT_CWDSAVE = TRUE
  66.  
  67. if localeInfo.IsCIBN10():
  68. SCREENSHOT_CWDSAVE = FALSE
  69. SCREENSHOT_DIR = "YT2W"
  70.  
  71. cameraDistance = 1550.0
  72. cameraPitch = 27.0
  73. cameraRotation = 0.0
  74. cameraHeight = 100.0
  75.  
  76. testAlignment = 0
  77.  
  78. class GameWindow(ui.ScriptWindow):
  79. def __init__(self, stream):
  80. ui.ScriptWindow.__init__(self, "GAME")
  81. self.SetWindowName("game")
  82. net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  83. player.SetGameWindow(self)
  84.  
  85. self.quickSlotPageIndex = 0
  86. self.lastPKModeSendedTime = 0
  87. self.pressNumber = None
  88.  
  89. self.guildWarQuestionDialog = None
  90. self.interface = None
  91. self.targetBoard = None
  92. self.console = None
  93. self.mapNameShower = None
  94. self.affectShower = None
  95. self.playerGauge = None
  96.  
  97. self.switchbot = Bot()
  98. self.switchbot.Hide()
  99.  
  100. self.stream=stream
  101. self.interface = interfaceModule.Interface()
  102. self.interface.MakeInterface()
  103. self.interface.ShowDefaultWindows()
  104.  
  105. self.curtain = uiPhaseCurtain.PhaseCurtain()
  106. self.curtain.speed = 0.03
  107. self.curtain.Hide()
  108.  
  109. self.targetBoard = uiTarget.TargetBoard()
  110. self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  111. self.targetBoard.Hide()
  112.  
  113. self.console = consoleModule.ConsoleWindow()
  114. self.console.BindGameClass(self)
  115. self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  116. self.console.Hide()
  117.  
  118. self.mapNameShower = uiMapNameShower.MapNameShower()
  119. self.affectShower = uiAffectShower.AffectShower()
  120.  
  121. self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  122. self.playerGauge.Hide()
  123.  
  124. #wj 2014.1.2. ESC키를 누를 시 우선적으로 DropQuestionDialog를 끄도록 만들었다. 하지만 처음에 itemDropQuestionDialog가 선언되어 있지 않아 ERROR가 발생하여 init에서 선언과 동시에 초기화 시킴.
  125. self.itemDropQuestionDialog = None
  126.  
  127. self.__SetQuickSlotMode()
  128.  
  129. self.__ServerCommand_Build()
  130. self.__ProcessPreservedServerCommand()
  131.  
  132. def __del__(self):
  133. player.SetGameWindow(0)
  134. net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  135. ui.ScriptWindow.__del__(self)
  136.  
  137. def Open(self):
  138. app.SetFrameSkip(1)
  139.  
  140. self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  141.  
  142. self.quickSlotPageIndex = 0
  143. self.PickingCharacterIndex = -1
  144. self.PickingItemIndex = -1
  145. self.consoleEnable = FALSE
  146. self.isShowDebugInfo = FALSE
  147. self.ShowNameFlag = FALSE
  148.  
  149. self.enableXMasBoom = FALSE
  150. self.startTimeXMasBoom = 0.0
  151. self.indexXMasBoom = 0
  152.  
  153. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  154.  
  155. app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  156.  
  157. constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  158. constInfo.SET_DEFAULT_CHRNAME_COLOR()
  159. constInfo.SET_DEFAULT_FOG_LEVEL()
  160. constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  161. constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  162. constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  163.  
  164. # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  165. constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  166. # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  167.  
  168. import event
  169. event.SetLeftTimeString(localeInfo.UI_LEFT_TIME)
  170.  
  171. textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
  172.  
  173. if constInfo.PVPMODE_TEST_ENABLE:
  174. self.testPKMode = ui.TextLine()
  175. self.testPKMode.SetFontName(localeInfo.UI_DEF_FONT)
  176. self.testPKMode.SetPosition(0, 15)
  177. self.testPKMode.SetWindowHorizontalAlignCenter()
  178. self.testPKMode.SetHorizontalAlignCenter()
  179. self.testPKMode.SetFeather()
  180. self.testPKMode.SetOutline()
  181. self.testPKMode.Show()
  182.  
  183. self.testAlignment = ui.TextLine()
  184. self.testAlignment.SetFontName(localeInfo.UI_DEF_FONT)
  185. self.testAlignment.SetPosition(0, 35)
  186. self.testAlignment.SetWindowHorizontalAlignCenter()
  187. self.testAlignment.SetHorizontalAlignCenter()
  188. self.testAlignment.SetFeather()
  189. self.testAlignment.SetOutline()
  190. self.testAlignment.Show()
  191.  
  192. self.__BuildKeyDict()
  193. self.__BuildDebugInfo()
  194.  
  195. # PRIVATE_SHOP_PRICE_LIST
  196. uiPrivateShopBuilder.Clear()
  197. # END_OF_PRIVATE_SHOP_PRICE_LIST
  198.  
  199. # UNKNOWN_UPDATE
  200. exchange.InitTrading()
  201. # END_OF_UNKNOWN_UPDATE
  202.  
  203. if debugInfo.IsDebugMode():
  204. self.ToggleDebugInfo()
  205.  
  206. ## Sound
  207. snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  208. snd.SetSoundVolume(systemSetting.GetSoundVolume())
  209.  
  210. netFieldMusicFileName = net.GetFieldMusicFileName()
  211. if netFieldMusicFileName:
  212. snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  213. elif musicInfo.fieldMusic != "":
  214. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  215.  
  216. self.__SetQuickSlotMode()
  217. self.__SelectQuickPage(self.quickSlotPageIndex)
  218.  
  219. self.SetFocus()
  220. self.Show()
  221. app.ShowCursor()
  222.  
  223. net.SendEnterGamePacket()
  224.  
  225. # START_GAME_ERROR_EXIT
  226. try:
  227. self.StartGame()
  228. except:
  229. import exception
  230. exception.Abort("GameWindow.Open")
  231. # END_OF_START_GAME_ERROR_EXIT
  232.  
  233. # NPC가 큐브시스템으로 만들 수 있는 아이템들의 목록을 캐싱
  234. # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  235. self.cubeInformation = {}
  236. self.currentCubeNPC = 0
  237.  
  238. def Close(self):
  239. self.Hide()
  240.  
  241. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  242. (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  243.  
  244. if musicInfo.fieldMusic != "":
  245. snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
  246.  
  247. self.onPressKeyDict = None
  248. self.onClickKeyDict = None
  249.  
  250. chat.Close()
  251. snd.StopAllSound()
  252. grp.InitScreenEffect()
  253. chr.Destroy()
  254. textTail.Clear()
  255. quest.Clear()
  256. background.Destroy()
  257. guild.Destroy()
  258. messenger.Destroy()
  259. skill.ClearSkillData()
  260. wndMgr.Unlock()
  261. mouseModule.mouseController.DeattachObject()
  262.  
  263. if self.guildWarQuestionDialog:
  264. self.guildWarQuestionDialog.Close()
  265.  
  266. self.guildNameBoard = None
  267. self.partyRequestQuestionDialog = None
  268. self.partyInviteQuestionDialog = None
  269. self.guildInviteQuestionDialog = None
  270. self.guildWarQuestionDialog = None
  271. self.messengerAddFriendQuestion = None
  272.  
  273. # UNKNOWN_UPDATE
  274. self.itemDropQuestionDialog = None
  275. # END_OF_UNKNOWN_UPDATE
  276.  
  277. # QUEST_CONFIRM
  278. self.confirmDialog = None
  279. # END_OF_QUEST_CONFIRM
  280.  
  281. self.PrintCoord = None
  282. self.FrameRate = None
  283. self.Pitch = None
  284. self.Splat = None
  285. self.TextureNum = None
  286. self.ObjectNum = None
  287. self.ViewDistance = None
  288. self.PrintMousePos = None
  289.  
  290. self.ClearDictionary()
  291.  
  292. self.playerGauge = None
  293. self.mapNameShower = None
  294. self.affectShower = None
  295.  
  296. if self.console:
  297. self.console.BindGameClass(0)
  298. self.console.Close()
  299. self.console=None
  300.  
  301. if self.targetBoard:
  302. self.targetBoard.Destroy()
  303. self.targetBoard = None
  304.  
  305. if self.interface:
  306. self.interface.HideAllWindows()
  307. self.interface.Close()
  308. self.interface=None
  309.  
  310. player.ClearSkillDict()
  311. player.ResetCameraRotation()
  312.  
  313. self.KillFocus()
  314. app.HideCursor()
  315.  
  316. print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  317.  
  318. def __BuildKeyDict(self):
  319. onPressKeyDict = {}
  320.  
  321. ##PressKey 는 누르고 있는 동안 계속 적용되는 키이다.
  322.  
  323. ## 숫자 단축키 퀵슬롯에 이용된다.(이후 숫자들도 퀵 슬롯용 예약)
  324. ## F12 는 클라 디버그용 키이므로 쓰지 않는 게 좋다.
  325. onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
  326. onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
  327. onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
  328. onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
  329. onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
  330. onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
  331. onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
  332. onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
  333. onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
  334. onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
  335. onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
  336. onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
  337. onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
  338. onPressKeyDict[app.DIK_F6]= lambda : self.__toggleSwitchbot()
  339. onPressKeyDict[app.DIK_F5] = lambda : self.__nopickInfo()
  340.  
  341. onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
  342. onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
  343. onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
  344. onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
  345.  
  346. #캐릭터 이동키
  347. onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
  348. onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
  349. onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
  350. onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
  351. onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
  352. onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
  353. onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
  354. onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()
  355.  
  356. onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  357. onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  358. #onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  359. onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  360. onPressKeyDict[app.DIK_G] = self.__PressGKey
  361. onPressKeyDict[app.DIK_Q] = self.__PressQKey
  362.  
  363. onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
  364. onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  365. onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  366. onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  367. onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  368. onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  369. onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  370. onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
  371. onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
  372. onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  373. onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  374. #onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  375. onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  376. onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
  377. onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  378. onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
  379. #onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()
  380. onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
  381. onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
  382. onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
  383. onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
  384. onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
  385.  
  386. onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
  387. onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
  388. onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
  389. onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
  390.  
  391. # CUBE_TEST
  392. #onPressKeyDict[app.DIK_K] = lambda : self.interface.OpenCubeWindow()
  393. # CUBE_TEST_END
  394.  
  395. self.onPressKeyDict = onPressKeyDict
  396.  
  397. onClickKeyDict = {}
  398. onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  399. onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  400. onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  401. onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  402. onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  403.  
  404. onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  405. onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  406. onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  407. onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  408. onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  409. onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  410. onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  411. onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  412. onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  413. onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  414. onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  415. onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  416. onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  417. onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  418. onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  419. onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  420. onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  421. onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  422. onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  423.  
  424. #if constInfo.PVPMODE_ACCELKEY_ENABLE:
  425. # onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  426.  
  427. self.onClickKeyDict=onClickKeyDict
  428.  
  429. def __PressNumKey(self,num):
  430. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  431.  
  432. if num >= 1 and num <= 9:
  433. if(chrmgr.IsPossibleEmoticon(-1)):
  434. chrmgr.SetEmoticon(-1,int(num)-1)
  435. net.SendEmoticon(int(num)-1)
  436. else:
  437. if num >= 1 and num <= 4:
  438. self.pressNumber(num-1)
  439.  
  440. def __ClickBKey(self):
  441. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  442. return
  443. else:
  444. if constInfo.PVPMODE_ACCELKEY_ENABLE:
  445. self.ChangePKMode()
  446.  
  447.  
  448. def __PressJKey(self):
  449. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  450. if player.IsMountingHorse():
  451. net.SendChatPacket("/unmount")
  452. else:
  453. #net.SendChatPacket("/user_horse_ride")
  454. if not uiPrivateShopBuilder.IsBuildingPrivateShop():
  455. for i in xrange(player.INVENTORY_PAGE_SIZE):
  456. if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
  457. net.SendItemUsePacket(i)
  458. break
  459. def __PressHKey(self):
  460. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  461. net.SendChatPacket("/user_horse_ride")
  462. else:
  463. self.interface.OpenHelpWindow()
  464.  
  465. def __PressBKey(self):
  466. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  467. net.SendChatPacket("/user_horse_back")
  468. else:
  469. state = "EMOTICON"
  470. self.interface.ToggleCharacterWindow(state)
  471.  
  472. def __PressFKey(self):
  473. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  474. net.SendChatPacket("/user_horse_feed")
  475. else:
  476. app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  477.  
  478. def __PressGKey(self):
  479. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  480. net.SendChatPacket("/ride")
  481. else:
  482. if self.ShowNameFlag:
  483. self.interface.ToggleGuildWindow()
  484. else:
  485. app.PitchCamera(app.CAMERA_TO_POSITIVE)
  486.  
  487. def __ReleaseGKey(self):
  488. app.PitchCamera(app.CAMERA_STOP)
  489.  
  490. def __PressQKey(self):
  491. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  492. if 0==interfaceModule.IsQBHide:
  493. interfaceModule.IsQBHide = 1
  494. self.interface.HideAllQuestButton()
  495. else:
  496. interfaceModule.IsQBHide = 0
  497. self.interface.ShowAllQuestButton()
  498. else:
  499. app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  500.  
  501. def __SetQuickSlotMode(self):
  502. self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  503.  
  504. def __SetQuickPageMode(self):
  505. self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  506.  
  507. def __PressQuickSlot(self, localSlotIndex):
  508. if localeInfo.IsARABIC():
  509. if 0 <= localSlotIndex and localSlotIndex < 4:
  510. player.RequestUseLocalQuickSlot(3-localSlotIndex)
  511. else:
  512. player.RequestUseLocalQuickSlot(11-localSlotIndex)
  513. else:
  514. player.RequestUseLocalQuickSlot(localSlotIndex)
  515.  
  516. def __SelectQuickPage(self, pageIndex):
  517. self.quickSlotPageIndex = pageIndex
  518. player.SetQuickPage(pageIndex)
  519.  
  520. def ToggleDebugInfo(self):
  521. self.isShowDebugInfo = not self.isShowDebugInfo
  522.  
  523. if self.isShowDebugInfo:
  524. self.PrintCoord.Show()
  525. self.FrameRate.Show()
  526. self.Pitch.Show()
  527. self.Splat.Show()
  528. self.TextureNum.Show()
  529. self.ObjectNum.Show()
  530. self.ViewDistance.Show()
  531. self.PrintMousePos.Show()
  532. else:
  533. self.PrintCoord.Hide()
  534. self.FrameRate.Hide()
  535. self.Pitch.Hide()
  536. self.Splat.Hide()
  537. self.TextureNum.Hide()
  538. self.ObjectNum.Hide()
  539. self.ViewDistance.Hide()
  540. self.PrintMousePos.Hide()
  541.  
  542. def __BuildDebugInfo(self):
  543. ## Character Position Coordinate
  544. self.PrintCoord = ui.TextLine()
  545. self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  546. self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  547.  
  548. ## Frame Rate
  549. self.FrameRate = ui.TextLine()
  550. self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  551. self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  552.  
  553. ## Camera Pitch
  554. self.Pitch = ui.TextLine()
  555. self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  556. self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  557.  
  558. ## Splat
  559. self.Splat = ui.TextLine()
  560. self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  561. self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  562.  
  563. ##
  564. self.PrintMousePos = ui.TextLine()
  565. self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  566. self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  567.  
  568. # TextureNum
  569. self.TextureNum = ui.TextLine()
  570. self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  571. self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  572.  
  573. # 오브젝트 그리는 개수
  574. self.ObjectNum = ui.TextLine()
  575. self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  576. self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  577.  
  578. # 시야거리
  579. self.ViewDistance = ui.TextLine()
  580. self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  581. self.ViewDistance.SetPosition(0, 0)
  582.  
  583. def __NotifyError(self, msg):
  584. chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  585.  
  586. def ChangePKMode(self):
  587.  
  588. if not app.IsPressed(app.DIK_LCONTROL):
  589. return
  590.  
  591. if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  592. self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  593. return
  594.  
  595. curTime = app.GetTime()
  596. if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  597. return
  598.  
  599. self.lastPKModeSendedTime = curTime
  600.  
  601. curPKMode = player.GetPKMode()
  602. nextPKMode = curPKMode + 1
  603. if nextPKMode == player.PK_MODE_PROTECT:
  604. if 0 == player.GetGuildID():
  605. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  606. nextPKMode = 0
  607. else:
  608. nextPKMode = player.PK_MODE_GUILD
  609.  
  610. elif nextPKMode == player.PK_MODE_MAX_NUM:
  611. nextPKMode = 0
  612.  
  613. net.SendChatPacket("/PKMode " + str(nextPKMode))
  614. print "/PKMode " + str(nextPKMode)
  615.  
  616. def OnChangePKMode(self):
  617.  
  618. self.interface.OnChangePKMode()
  619.  
  620. try:
  621. self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  622. except KeyError:
  623. print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  624.  
  625. if constInfo.PVPMODE_TEST_ENABLE:
  626. curPKMode = player.GetPKMode()
  627. alignment, grade = chr.testGetPKData()
  628. self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  629. self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  630. self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  631.  
  632. ###############################################################################################
  633. ###############################################################################################
  634. ## Game Callback Functions
  635.  
  636. # Start
  637. def StartGame(self):
  638. self.RefreshInventory()
  639. self.RefreshEquipment()
  640. self.RefreshCharacter()
  641. self.RefreshSkill()
  642.  
  643. # Refresh
  644. def CheckGameButton(self):
  645. if self.interface:
  646. self.interface.CheckGameButton()
  647.  
  648. def RefreshAlignment(self):
  649. self.interface.RefreshAlignment()
  650.  
  651. def RefreshStatus(self):
  652. self.CheckGameButton()
  653.  
  654. if self.interface:
  655. self.interface.RefreshStatus()
  656.  
  657. if self.playerGauge:
  658. self.playerGauge.RefreshGauge()
  659.  
  660. def RefreshStamina(self):
  661. self.interface.RefreshStamina()
  662.  
  663. def RefreshSkill(self):
  664. self.CheckGameButton()
  665. if self.interface:
  666. self.interface.RefreshSkill()
  667.  
  668. def RefreshQuest(self):
  669. self.interface.RefreshQuest()
  670.  
  671. def RefreshMessenger(self):
  672. self.interface.RefreshMessenger()
  673.  
  674. def RefreshGuildInfoPage(self):
  675. self.interface.RefreshGuildInfoPage()
  676.  
  677. def RefreshGuildBoardPage(self):
  678. self.interface.RefreshGuildBoardPage()
  679.  
  680. def RefreshGuildMemberPage(self):
  681. self.interface.RefreshGuildMemberPage()
  682.  
  683. def RefreshGuildMemberPageGradeComboBox(self):
  684. self.interface.RefreshGuildMemberPageGradeComboBox()
  685.  
  686. def RefreshGuildSkillPage(self):
  687. self.interface.RefreshGuildSkillPage()
  688.  
  689. def RefreshGuildGradePage(self):
  690. self.interface.RefreshGuildGradePage()
  691.  
  692. def RefreshMobile(self):
  693. if self.interface:
  694. self.interface.RefreshMobile()
  695.  
  696. def OnMobileAuthority(self):
  697. self.interface.OnMobileAuthority()
  698.  
  699. def OnBlockMode(self, mode):
  700. self.interface.OnBlockMode(mode)
  701.  
  702. def OpenQuestWindow(self, skin, idx):
  703. self.interface.OpenQuestWindow(skin, idx)
  704.  
  705. def AskGuildName(self):
  706.  
  707. guildNameBoard = uiCommon.InputDialog()
  708. guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  709. guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  710. guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  711. guildNameBoard.Open()
  712.  
  713. self.guildNameBoard = guildNameBoard
  714.  
  715. def ConfirmGuildName(self):
  716. guildName = self.guildNameBoard.GetText()
  717. if not guildName:
  718. return
  719.  
  720. if net.IsInsultIn(guildName):
  721. self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  722. return
  723.  
  724. net.SendAnswerMakeGuildPacket(guildName)
  725. self.guildNameBoard.Close()
  726. self.guildNameBoard = None
  727. return TRUE
  728.  
  729. def CancelGuildName(self):
  730. self.guildNameBoard.Close()
  731. self.guildNameBoard = None
  732. return TRUE
  733.  
  734. ## Refine
  735. def PopupMessage(self, msg):
  736. self.stream.popupWindow.Close()
  737. self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  738.  
  739. def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  740. self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  741.  
  742. def AppendMaterialToRefineDialog(self, vnum, count):
  743. self.interface.AppendMaterialToRefineDialog(vnum, count)
  744.  
  745. def RunUseSkillEvent(self, slotIndex, coolTime):
  746. self.interface.OnUseSkill(slotIndex, coolTime)
  747.  
  748. def ClearAffects(self):
  749. self.affectShower.ClearAffects()
  750.  
  751. def SetAffect(self, affect):
  752. self.affectShower.SetAffect(affect)
  753.  
  754. def ResetAffect(self, affect):
  755. self.affectShower.ResetAffect(affect)
  756.  
  757. # UNKNOWN_UPDATE
  758. def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  759. self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  760. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  761. self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  762. elif chr.NEW_AFFECT_DRAGON_SOUL_QUALIFIED == type:
  763. self.BINARY_DragonSoulGiveQuilification()
  764.  
  765. def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  766. self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  767. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  768. self.interface.DragonSoulDeactivate()
  769.  
  770.  
  771.  
  772. # END_OF_UNKNOWN_UPDATE
  773.  
  774. def ActivateSkillSlot(self, slotIndex):
  775. if self.interface:
  776. self.interface.OnActivateSkill(slotIndex)
  777.  
  778. def DeactivateSkillSlot(self, slotIndex):
  779. if self.interface:
  780. self.interface.OnDeactivateSkill(slotIndex)
  781.  
  782. def RefreshEquipment(self):
  783. if self.interface:
  784. self.interface.RefreshInventory()
  785.  
  786. def RefreshInventory(self):
  787. if self.interface:
  788. self.interface.RefreshInventory()
  789.  
  790. def RefreshCharacter(self):
  791. if self.interface:
  792. self.interface.RefreshCharacter()
  793.  
  794. def OnGameOver(self):
  795. self.CloseTargetBoard()
  796. self.OpenRestartDialog()
  797.  
  798. def OpenRestartDialog(self):
  799. self.interface.OpenRestartDialog()
  800.  
  801. def ChangeCurrentSkill(self, skillSlotNumber):
  802. self.interface.OnChangeCurrentSkill(skillSlotNumber)
  803.  
  804. ## TargetBoard
  805. def SetPCTargetBoard(self, vid, name):
  806. self.targetBoard.Open(vid, name)
  807.  
  808. if app.IsPressed(app.DIK_LCONTROL):
  809.  
  810. if not player.IsSameEmpire(vid):
  811. return
  812.  
  813. if player.IsMainCharacterIndex(vid):
  814. return
  815. elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  816. return
  817.  
  818. self.interface.OpenWhisperDialog(name)
  819.  
  820.  
  821. def RefreshTargetBoardByVID(self, vid):
  822. self.targetBoard.RefreshByVID(vid)
  823.  
  824. def RefreshTargetBoardByName(self, name):
  825. self.targetBoard.RefreshByName(name)
  826.  
  827. def __RefreshTargetBoard(self):
  828. self.targetBoard.Refresh()
  829.  
  830. def SetHPTargetBoard(self, vid, hpPercentage):
  831. if vid != self.targetBoard.GetTargetVID():
  832. self.targetBoard.ResetTargetBoard()
  833. self.targetBoard.SetEnemyVID(vid)
  834.  
  835. self.targetBoard.SetHP(hpPercentage)
  836. self.targetBoard.Show()
  837.  
  838. def CloseTargetBoardIfDifferent(self, vid):
  839. if vid != self.targetBoard.GetTargetVID():
  840. self.targetBoard.Close()
  841.  
  842. def CloseTargetBoard(self):
  843. self.targetBoard.Close()
  844.  
  845. ## View Equipment
  846. def OpenEquipmentDialog(self, vid):
  847. self.interface.OpenEquipmentDialog(vid)
  848.  
  849. def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  850. self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  851.  
  852. def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  853. self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  854.  
  855. def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  856. self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  857.  
  858. # SHOW_LOCAL_MAP_NAME
  859. def ShowMapName(self, mapName, x, y):
  860.  
  861. if self.mapNameShower:
  862. self.mapNameShower.ShowMapName(mapName, x, y)
  863.  
  864. if self.interface:
  865. self.interface.SetMapName(mapName)
  866. # END_OF_SHOW_LOCAL_MAP_NAME
  867.  
  868. def BINARY_OpenAtlasWindow(self):
  869. self.interface.BINARY_OpenAtlasWindow()
  870.  
  871. ## Chat
  872. def OnRecvWhisper(self, mode, name, line):
  873. if mode != chat.WHISPER_TYPE_GM:
  874. if os.path.exists("ignore.cfg"):
  875. ignored = open("ignore.cfg", "r")
  876. ignoredList = ignored.read()
  877. ignoredPlayer = ignoredList.split(",\n")
  878. ignored.close()
  879. for i in xrange(str(ignoredList).count(",\n")):
  880. if str(ignoredPlayer[i]) != name:
  881. pass
  882. else:
  883. return
  884.  
  885. chat.AppendWhisper(mode, name, line)
  886. self.interface.RecvWhisper(name)
  887. else:
  888. self.interface.RegisterGameMasterName(name)
  889. chat.AppendWhisper(mode, name, line)
  890. self.interface.RecvWhisper(name)
  891.  
  892.  
  893. def OnRecvWhisperSystemMessage(self, mode, name, line):
  894. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  895. self.interface.RecvWhisper(name)
  896.  
  897. def OnRecvWhisperError(self, mode, name, line):
  898. if localeInfo.WHISPER_ERROR.has_key(mode):
  899. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  900. else:
  901. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  902. self.interface.RecvWhisper(name)
  903.  
  904. def RecvWhisper(self, name):
  905. self.interface.RecvWhisper(name)
  906.  
  907. def OnPickMoney(self, money):
  908. if constInfo.pickInfo == 1:
  909. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  910. else:
  911. return
  912.  
  913. def OnShopError(self, type):
  914. try:
  915. self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  916. except KeyError:
  917. self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  918.  
  919. def OnSafeBoxError(self):
  920. self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  921.  
  922. def OnFishingSuccess(self, isFish, fishName):
  923. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  924.  
  925. # ADD_FISHING_MESSAGE
  926. def OnFishingNotifyUnknown(self):
  927. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  928.  
  929. def OnFishingWrongPlace(self):
  930. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  931. # END_OF_ADD_FISHING_MESSAGE
  932.  
  933. def OnFishingNotify(self, isFish, fishName):
  934. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  935.  
  936. def OnFishingFailure(self):
  937. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  938.  
  939. def OnCannotPickItem(self):
  940. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  941.  
  942. # MINING
  943. def OnCannotMining(self):
  944. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  945. # END_OF_MINING
  946.  
  947. def OnCannotUseSkill(self, vid, type):
  948. if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  949. textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  950.  
  951. if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  952. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  953.  
  954. def OnCannotShotError(self, vid, type):
  955. textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  956.  
  957. ## PointReset
  958. def StartPointReset(self):
  959. self.interface.OpenPointResetDialog()
  960.  
  961. ## Shop
  962. def StartShop(self, vid):
  963. self.interface.OpenShopDialog(vid)
  964.  
  965. def EndShop(self):
  966. self.interface.CloseShopDialog()
  967.  
  968. def RefreshShop(self):
  969. self.interface.RefreshShopDialog()
  970.  
  971. def SetShopSellingPrice(self, Price):
  972. pass
  973.  
  974. ## Exchange
  975. def StartExchange(self):
  976. self.interface.StartExchange()
  977.  
  978. def EndExchange(self):
  979. self.interface.EndExchange()
  980.  
  981. def RefreshExchange(self):
  982. self.interface.RefreshExchange()
  983.  
  984. ## Party
  985. def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  986. partyInviteQuestionDialog = uiCommon.QuestionDialog()
  987. partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  988. partyInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerPartyInvite(arg))
  989. partyInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerPartyInvite(arg))
  990. partyInviteQuestionDialog.Open()
  991. partyInviteQuestionDialog.partyLeaderVID = leaderVID
  992. self.partyInviteQuestionDialog = partyInviteQuestionDialog
  993.  
  994. def AnswerPartyInvite(self, answer):
  995.  
  996. if not self.partyInviteQuestionDialog:
  997. return
  998.  
  999. partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1000.  
  1001. distance = player.GetCharacterDistance(partyLeaderVID)
  1002. if distance < 0.0 or distance > 5000:
  1003. answer = FALSE
  1004.  
  1005. net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1006.  
  1007. self.partyInviteQuestionDialog.Close()
  1008. self.partyInviteQuestionDialog = None
  1009.  
  1010. def AddPartyMember(self, pid, name):
  1011. self.interface.AddPartyMember(pid, name)
  1012.  
  1013. def UpdatePartyMemberInfo(self, pid):
  1014. self.interface.UpdatePartyMemberInfo(pid)
  1015.  
  1016. def RemovePartyMember(self, pid):
  1017. self.interface.RemovePartyMember(pid)
  1018. self.__RefreshTargetBoard()
  1019.  
  1020. def LinkPartyMember(self, pid, vid):
  1021. self.interface.LinkPartyMember(pid, vid)
  1022.  
  1023. def UnlinkPartyMember(self, pid):
  1024. self.interface.UnlinkPartyMember(pid)
  1025.  
  1026. def UnlinkAllPartyMember(self):
  1027. self.interface.UnlinkAllPartyMember()
  1028.  
  1029. def ExitParty(self):
  1030. self.interface.ExitParty()
  1031. self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1032.  
  1033. def ChangePartyParameter(self, distributionMode):
  1034. self.interface.ChangePartyParameter(distributionMode)
  1035.  
  1036. ## Messenger
  1037. def OnMessengerAddFriendQuestion(self, name):
  1038. messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1039. messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1040. messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1041. messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1042. messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1043. messengerAddFriendQuestion.Open()
  1044. messengerAddFriendQuestion.name = name
  1045. self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1046.  
  1047. def OnAcceptAddFriend(self):
  1048. name = self.messengerAddFriendQuestion.name
  1049. net.SendChatPacket("/messenger_auth y " + name)
  1050. self.OnCloseAddFriendQuestionDialog()
  1051. return TRUE
  1052.  
  1053. def OnDenyAddFriend(self):
  1054. name = self.messengerAddFriendQuestion.name
  1055. net.SendChatPacket("/messenger_auth n " + name)
  1056. self.OnCloseAddFriendQuestionDialog()
  1057. return TRUE
  1058.  
  1059. def OnCloseAddFriendQuestionDialog(self):
  1060. self.messengerAddFriendQuestion.Close()
  1061. self.messengerAddFriendQuestion = None
  1062. return TRUE
  1063.  
  1064. ## SafeBox
  1065. def OpenSafeboxWindow(self, size):
  1066. self.interface.OpenSafeboxWindow(size)
  1067.  
  1068. def RefreshSafebox(self):
  1069. self.interface.RefreshSafebox()
  1070.  
  1071. def RefreshSafeboxMoney(self):
  1072. self.interface.RefreshSafeboxMoney()
  1073.  
  1074. # ITEM_MALL
  1075. def OpenMallWindow(self, size):
  1076. self.interface.OpenMallWindow(size)
  1077.  
  1078. def RefreshMall(self):
  1079. self.interface.RefreshMall()
  1080. # END_OF_ITEM_MALL
  1081.  
  1082. ## Guild
  1083. def RecvGuildInviteQuestion(self, guildID, guildName):
  1084. guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1085. guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1086. guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
  1087. guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
  1088. guildInviteQuestionDialog.Open()
  1089. guildInviteQuestionDialog.guildID = guildID
  1090. self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1091.  
  1092. def AnswerGuildInvite(self, answer):
  1093.  
  1094. if not self.guildInviteQuestionDialog:
  1095. return
  1096.  
  1097. guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1098. net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1099.  
  1100. self.guildInviteQuestionDialog.Close()
  1101. self.guildInviteQuestionDialog = None
  1102.  
  1103.  
  1104. def DeleteGuild(self):
  1105. self.interface.DeleteGuild()
  1106.  
  1107. ## Clock
  1108. def ShowClock(self, second):
  1109. self.interface.ShowClock(second)
  1110.  
  1111. def HideClock(self):
  1112. self.interface.HideClock()
  1113.  
  1114. ## Emotion
  1115. def BINARY_ActEmotion(self, emotionIndex):
  1116. if self.interface.wndCharacter:
  1117. self.interface.wndCharacter.ActEmotion(emotionIndex)
  1118.  
  1119. ###############################################################################################
  1120. ###############################################################################################
  1121. ## Keyboard Functions
  1122.  
  1123. def CheckFocus(self):
  1124. if FALSE == self.IsFocus():
  1125. if TRUE == self.interface.IsOpenChat():
  1126. self.interface.ToggleChat()
  1127.  
  1128. self.SetFocus()
  1129.  
  1130. def SaveScreen(self):
  1131. print "save screen"
  1132.  
  1133. # SCREENSHOT_CWDSAVE
  1134. if SCREENSHOT_CWDSAVE:
  1135. if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1136. os.mkdir(os.getcwd()+os.sep+"screenshot")
  1137.  
  1138. (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1139. elif SCREENSHOT_DIR:
  1140. (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1141. else:
  1142. (succeeded, name) = grp.SaveScreenShot()
  1143. # END_OF_SCREENSHOT_CWDSAVE
  1144.  
  1145. if succeeded:
  1146. pass
  1147. """
  1148. chat.AppendChat(chat.CHAT_TYPE_INFO, name + localeInfo.SCREENSHOT_SAVE1)
  1149. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE2)
  1150. """
  1151. else:
  1152. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)
  1153.  
  1154. def ShowConsole(self):
  1155. if debugInfo.IsDebugMode() or TRUE == self.consoleEnable:
  1156. player.EndKeyWalkingImmediately()
  1157. self.console.OpenWindow()
  1158.  
  1159. def ShowName(self):
  1160. self.ShowNameFlag = TRUE
  1161. self.playerGauge.EnableShowAlways()
  1162. player.SetQuickPage(self.quickSlotPageIndex+1)
  1163.  
  1164. # ADD_ALWAYS_SHOW_NAME
  1165. def __IsShowName(self):
  1166.  
  1167. if systemSetting.IsAlwaysShowName():
  1168. return TRUE
  1169.  
  1170. if self.ShowNameFlag:
  1171. return TRUE
  1172.  
  1173. return FALSE
  1174. # END_OF_ADD_ALWAYS_SHOW_NAME
  1175.  
  1176. def HideName(self):
  1177. self.ShowNameFlag = FALSE
  1178. self.playerGauge.DisableShowAlways()
  1179. player.SetQuickPage(self.quickSlotPageIndex)
  1180.  
  1181. def ShowMouseImage(self):
  1182. self.interface.ShowMouseImage()
  1183.  
  1184. def HideMouseImage(self):
  1185. self.interface.HideMouseImage()
  1186.  
  1187. def StartAttack(self):
  1188. player.SetAttackKeyState(TRUE)
  1189.  
  1190. def EndAttack(self):
  1191. player.SetAttackKeyState(FALSE)
  1192.  
  1193. def MoveUp(self):
  1194. player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  1195.  
  1196. def MoveDown(self):
  1197. player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  1198.  
  1199. def MoveLeft(self):
  1200. player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  1201.  
  1202. def MoveRight(self):
  1203. player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  1204.  
  1205. def StopUp(self):
  1206. player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
  1207.  
  1208. def StopDown(self):
  1209. player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
  1210.  
  1211. def StopLeft(self):
  1212. player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
  1213.  
  1214. def StopRight(self):
  1215. player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
  1216.  
  1217. def PickUpItem(self):
  1218. player.PickCloseItem()
  1219.  
  1220. ###############################################################################################
  1221. ###############################################################################################
  1222. ## Event Handler
  1223.  
  1224. def OnKeyDown(self, key):
  1225. if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1226. return
  1227.  
  1228. if key == app.DIK_ESC:
  1229. self.RequestDropItem(FALSE)
  1230. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1231.  
  1232. try:
  1233. self.onPressKeyDict[key]()
  1234. except KeyError:
  1235. pass
  1236. except:
  1237. raise
  1238.  
  1239. return TRUE
  1240.  
  1241. def OnKeyUp(self, key):
  1242. try:
  1243. self.onClickKeyDict[key]()
  1244. except KeyError:
  1245. pass
  1246. except:
  1247. raise
  1248.  
  1249. return TRUE
  1250.  
  1251. def OnMouseLeftButtonDown(self):
  1252. if self.interface.BUILD_OnMouseLeftButtonDown():
  1253. return
  1254.  
  1255. if mouseModule.mouseController.isAttached():
  1256. self.CheckFocus()
  1257. else:
  1258. hyperlink = ui.GetHyperlink()
  1259. if hyperlink:
  1260. return
  1261. else:
  1262. self.CheckFocus()
  1263. player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1264.  
  1265. return TRUE
  1266.  
  1267. def OnMouseLeftButtonUp(self):
  1268.  
  1269. if self.interface.BUILD_OnMouseLeftButtonUp():
  1270. return
  1271.  
  1272. if mouseModule.mouseController.isAttached():
  1273.  
  1274. attachedType = mouseModule.mouseController.GetAttachedType()
  1275. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1276. attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1277. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1278.  
  1279. ## QuickSlot
  1280. if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1281. player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1282.  
  1283. ## Inventory
  1284. elif player.SLOT_TYPE_INVENTORY == attachedType:
  1285.  
  1286. if player.ITEM_MONEY == attachedItemIndex:
  1287. self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1288. else:
  1289. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1290.  
  1291. ## DragonSoul
  1292. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1293. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1294.  
  1295. mouseModule.mouseController.DeattachObject()
  1296.  
  1297. else:
  1298. hyperlink = ui.GetHyperlink()
  1299. if hyperlink:
  1300. if app.IsPressed(app.DIK_LALT):
  1301. link = chat.GetLinkFromHyperlink(hyperlink)
  1302. ime.PasteString(link)
  1303. else:
  1304. self.interface.MakeHyperlinkTooltip(hyperlink)
  1305. return
  1306. else:
  1307. player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1308.  
  1309. #player.EndMouseWalking()
  1310. return TRUE
  1311.  
  1312. def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1313. if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1314. attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1315. if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1316. if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType:
  1317. self.stream.popupWindow.Close()
  1318. self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1319. else:
  1320. if chr.IsNPC(dstChrID):
  1321. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1322. else:
  1323. net.SendExchangeStartPacket(dstChrID)
  1324. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1325. else:
  1326. self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1327.  
  1328. def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1329. if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1330. net.SendExchangeStartPacket(dstChrID)
  1331. net.SendExchangeElkAddPacket(attachedMoney)
  1332. else:
  1333. self.__DropMoney(attachedType, attachedMoney)
  1334.  
  1335. def __DropMoney(self, attachedType, attachedMoney):
  1336. # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1337. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1338. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1339. return
  1340. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1341.  
  1342. if attachedMoney>=1000:
  1343. self.stream.popupWindow.Close()
  1344. self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1345. return
  1346.  
  1347. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1348. itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1349. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1350. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1351. itemDropQuestionDialog.Open()
  1352. itemDropQuestionDialog.dropType = attachedType
  1353. itemDropQuestionDialog.dropCount = attachedMoney
  1354. itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1355. self.itemDropQuestionDialog = itemDropQuestionDialog
  1356.  
  1357. def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1358. # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1359. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1360. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1361. return
  1362. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1363.  
  1364. if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1365. self.stream.popupWindow.Close()
  1366. self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1367.  
  1368. else:
  1369. if player.SLOT_TYPE_INVENTORY == attachedType:
  1370. dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1371.  
  1372. item.SelectItem(dropItemIndex)
  1373. dropItemName = item.GetItemName()
  1374.  
  1375. ## Question Text
  1376. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1377.  
  1378. ## Dialog
  1379. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1380. itemDropQuestionDialog.SetText(questionText)
  1381. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1382. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1383. itemDropQuestionDialog.Open()
  1384. itemDropQuestionDialog.dropType = attachedType
  1385. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1386. itemDropQuestionDialog.dropCount = attachedItemCount
  1387. self.itemDropQuestionDialog = itemDropQuestionDialog
  1388.  
  1389. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1390. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1391. dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1392.  
  1393. item.SelectItem(dropItemIndex)
  1394. dropItemName = item.GetItemName()
  1395.  
  1396. ## Question Text
  1397. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1398.  
  1399. ## Dialog
  1400. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1401. itemDropQuestionDialog.SetText(questionText)
  1402. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1403. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1404. itemDropQuestionDialog.Open()
  1405. itemDropQuestionDialog.dropType = attachedType
  1406. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1407. itemDropQuestionDialog.dropCount = attachedItemCount
  1408. self.itemDropQuestionDialog = itemDropQuestionDialog
  1409.  
  1410. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1411.  
  1412. def RequestDropItem(self, answer):
  1413. if not self.itemDropQuestionDialog:
  1414. return
  1415.  
  1416. if answer:
  1417. dropType = self.itemDropQuestionDialog.dropType
  1418. dropCount = self.itemDropQuestionDialog.dropCount
  1419. dropNumber = self.itemDropQuestionDialog.dropNumber
  1420.  
  1421. if player.SLOT_TYPE_INVENTORY == dropType:
  1422. if dropNumber == player.ITEM_MONEY:
  1423. net.SendGoldDropPacketNew(dropCount)
  1424. snd.PlaySound("sound/ui/money.wav")
  1425. else:
  1426. # PRIVATESHOP_DISABLE_ITEM_DROP
  1427. self.__SendDropItemPacket(dropNumber, dropCount)
  1428. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1429. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1430. # PRIVATESHOP_DISABLE_ITEM_DROP
  1431. self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1432. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1433.  
  1434. self.itemDropQuestionDialog.Close()
  1435. self.itemDropQuestionDialog = None
  1436.  
  1437. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1438.  
  1439. # PRIVATESHOP_DISABLE_ITEM_DROP
  1440. def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1441. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1442. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1443. return
  1444.  
  1445. net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1446. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1447.  
  1448. def OnMouseRightButtonDown(self):
  1449.  
  1450. self.CheckFocus()
  1451.  
  1452. if TRUE == mouseModule.mouseController.isAttached():
  1453. mouseModule.mouseController.DeattachObject()
  1454.  
  1455. else:
  1456. player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1457.  
  1458. return TRUE
  1459.  
  1460. def OnMouseRightButtonUp(self):
  1461. if TRUE == mouseModule.mouseController.isAttached():
  1462. return TRUE
  1463.  
  1464. player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1465. return TRUE
  1466.  
  1467. def OnMouseMiddleButtonDown(self):
  1468. player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1469.  
  1470. def OnMouseMiddleButtonUp(self):
  1471. player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1472.  
  1473. if self.mapNameShower.IsShow():
  1474. self.mapNameShower.Update()
  1475.  
  1476. if self.isShowDebugInfo:
  1477. self.UpdateDebugInfo()
  1478.  
  1479. if self.enableXMasBoom:
  1480. self.__XMasBoom_Update()
  1481.  
  1482. self.interface.BUILD_OnUpdate()
  1483.  
  1484.  
  1485. def UpdateDebugInfo(self):
  1486. #
  1487. # 캐릭터 좌표 및 FPS 출력
  1488. (x, y, z) = player.GetMainCharacterPosition()
  1489. nUpdateTime = app.GetUpdateTime()
  1490. nUpdateFPS = app.GetUpdateFPS()
  1491. nRenderFPS = app.GetRenderFPS()
  1492. nFaceCount = app.GetFaceCount()
  1493. fFaceSpeed = app.GetFaceSpeed()
  1494. nST=background.GetRenderShadowTime()
  1495. (fAveRT, nCurRT) = app.GetRenderTime()
  1496. (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1497. (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1498. if iPatch == 0:
  1499. iPatch = 1
  1500.  
  1501. #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1502.  
  1503. self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1504. xMouse, yMouse = wndMgr.GetMousePosition()
  1505. self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))
  1506.  
  1507. self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1508.  
  1509. if fAveRT>1.0:
  1510. self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1511.  
  1512. self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1513. #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1514. #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1515. #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1516. self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1517.  
  1518. def OnRender(self):
  1519. app.RenderGame()
  1520.  
  1521. if self.console.Console.collision:
  1522. background.RenderCollision()
  1523. chr.RenderCollision()
  1524.  
  1525. (x, y) = app.GetCursorPosition()
  1526.  
  1527. ########################
  1528. # Picking
  1529. ########################
  1530. textTail.UpdateAllTextTail()
  1531.  
  1532. if TRUE == wndMgr.IsPickedWindow(self.hWnd):
  1533.  
  1534. self.PickingCharacterIndex = chr.Pick()
  1535.  
  1536. if -1 != self.PickingCharacterIndex:
  1537. textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1538. if 0 != self.targetBoard.GetTargetVID():
  1539. textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1540.  
  1541. # ADD_ALWAYS_SHOW_NAME
  1542. if not self.__IsShowName():
  1543. self.PickingItemIndex = item.Pick()
  1544. if -1 != self.PickingItemIndex:
  1545. textTail.ShowItemTextTail(self.PickingItemIndex)
  1546. # END_OF_ADD_ALWAYS_SHOW_NAME
  1547.  
  1548. ## Show all name in the range
  1549.  
  1550. # ADD_ALWAYS_SHOW_NAME
  1551. if self.__IsShowName():
  1552. textTail.ShowAllTextTail()
  1553. self.PickingItemIndex = textTail.Pick(x, y)
  1554. # END_OF_ADD_ALWAYS_SHOW_NAME
  1555.  
  1556. textTail.UpdateShowingTextTail()
  1557. textTail.ArrangeTextTail()
  1558. if -1 != self.PickingItemIndex:
  1559. textTail.SelectItemName(self.PickingItemIndex)
  1560.  
  1561. grp.PopState()
  1562. grp.SetInterfaceRenderState()
  1563.  
  1564. textTail.Render()
  1565. textTail.HideAllTextTail()
  1566.  
  1567. def OnPressEscapeKey(self):
  1568. if app.TARGET == app.GetCursor():
  1569. app.SetCursor(app.NORMAL)
  1570.  
  1571. elif TRUE == mouseModule.mouseController.isAttached():
  1572. mouseModule.mouseController.DeattachObject()
  1573.  
  1574. else:
  1575. self.interface.OpenSystemDialog()
  1576.  
  1577. return TRUE
  1578.  
  1579. def OnIMEReturn(self):
  1580. if app.IsPressed(app.DIK_LSHIFT):
  1581. self.interface.OpenWhisperDialogWithoutTarget()
  1582. else:
  1583. self.interface.ToggleChat()
  1584. return TRUE
  1585.  
  1586. def OnPressExitKey(self):
  1587. self.interface.ToggleSystemDialog()
  1588. return TRUE
  1589.  
  1590. ## BINARY CALLBACK
  1591. ######################################################################################
  1592.  
  1593. # WEDDING
  1594. def BINARY_LoverInfo(self, name, lovePoint):
  1595. if self.interface.wndMessenger:
  1596. self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1597. if self.affectShower:
  1598. self.affectShower.SetLoverInfo(name, lovePoint)
  1599.  
  1600. def BINARY_UpdateLovePoint(self, lovePoint):
  1601. if self.interface.wndMessenger:
  1602. self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1603. if self.affectShower:
  1604. self.affectShower.OnUpdateLovePoint(lovePoint)
  1605. # END_OF_WEDDING
  1606.  
  1607. # QUEST_CONFIRM
  1608. def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1609. confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1610. confirmDialog.Open(msg, timeout)
  1611. confirmDialog.SetAcceptEvent(lambda answer=TRUE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1612. confirmDialog.SetCancelEvent(lambda answer=FALSE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1613. self.confirmDialog = confirmDialog
  1614. # END_OF_QUEST_CONFIRM
  1615.  
  1616. # GIFT command
  1617. def Gift_Show(self):
  1618. self.interface.ShowGift()
  1619.  
  1620. # CUBE
  1621. def BINARY_Cube_Open(self, npcVNUM):
  1622. self.currentCubeNPC = npcVNUM
  1623.  
  1624. self.interface.OpenCubeWindow()
  1625.  
  1626.  
  1627. if npcVNUM not in self.cubeInformation:
  1628. net.SendChatPacket("/cube r_info")
  1629. else:
  1630. cubeInfoList = self.cubeInformation[npcVNUM]
  1631.  
  1632. i = 0
  1633. for cubeInfo in cubeInfoList:
  1634. self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1635.  
  1636. j = 0
  1637. for materialList in cubeInfo["materialList"]:
  1638. for materialInfo in materialList:
  1639. itemVnum, itemCount = materialInfo
  1640. self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1641. j = j + 1
  1642.  
  1643. i = i + 1
  1644.  
  1645. self.interface.wndCube.Refresh()
  1646.  
  1647. def BINARY_Cube_Close(self):
  1648. self.interface.CloseCubeWindow()
  1649.  
  1650. # 제작에 필요한 골드, 예상되는 완성품의 VNUM과 개수 정보 update
  1651. def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1652. self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1653.  
  1654. def BINARY_Cube_Succeed(self, itemVnum, count):
  1655. print "큐브 제작 성공"
  1656. self.interface.SucceedCubeWork(itemVnum, count)
  1657. pass
  1658.  
  1659. def BINARY_Cube_Failed(self):
  1660. print "큐브 제작 실패"
  1661. self.interface.FailedCubeWork()
  1662. pass
  1663.  
  1664. def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1665. # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5 이런식으로 "/" 문자로 구분된 리스트를 줌
  1666. #print listText
  1667.  
  1668. if npcVNUM == 0:
  1669. npcVNUM = self.currentCubeNPC
  1670.  
  1671. self.cubeInformation[npcVNUM] = []
  1672.  
  1673. try:
  1674. for eachInfoText in listText.split("/"):
  1675. eachInfo = eachInfoText.split(",")
  1676. itemVnum = int(eachInfo[0])
  1677. itemCount = int(eachInfo[1])
  1678.  
  1679. self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1680. self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1681.  
  1682. resultCount = len(self.cubeInformation[npcVNUM])
  1683. requestCount = 7
  1684. modCount = resultCount % requestCount
  1685. splitCount = resultCount / requestCount
  1686. for i in xrange(splitCount):
  1687. #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1688. net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1689.  
  1690. if 0 < modCount:
  1691. #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1692. net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1693.  
  1694. except RuntimeError, msg:
  1695. dbg.TraceError(msg)
  1696. return 0
  1697.  
  1698. pass
  1699.  
  1700. def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1701. # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1702. try:
  1703. #print listText
  1704.  
  1705. if 3 > len(listText):
  1706. dbg.TraceError("Wrong Cube Material Infomation")
  1707. return 0
  1708.  
  1709.  
  1710.  
  1711. eachResultList = listText.split("@")
  1712.  
  1713. cubeInfo = self.cubeInformation[self.currentCubeNPC]
  1714.  
  1715. itemIndex = 0
  1716. for eachResultText in eachResultList:
  1717. cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1718. materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1719.  
  1720. gold = 0
  1721. splitResult = eachResultText.split("/")
  1722. if 1 < len(splitResult):
  1723. gold = int(splitResult[1])
  1724.  
  1725. #print "splitResult : ", splitResult
  1726. eachMaterialList = splitResult[0].split("&")
  1727.  
  1728. i = 0
  1729. for eachMaterialText in eachMaterialList:
  1730. complicatedList = eachMaterialText.split("|")
  1731.  
  1732. if 0 < len(complicatedList):
  1733. for complicatedText in complicatedList:
  1734. (itemVnum, itemCount) = complicatedText.split(",")
  1735. itemVnum = int(itemVnum)
  1736. itemCount = int(itemCount)
  1737. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1738.  
  1739. materialList[i].append((itemVnum, itemCount))
  1740.  
  1741. else:
  1742. itemVnum, itemCount = eachMaterialText.split(",")
  1743. itemVnum = int(itemVnum)
  1744. itemCount = int(itemCount)
  1745. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1746.  
  1747. materialList[i].append((itemVnum, itemCount))
  1748.  
  1749. i = i + 1
  1750.  
  1751.  
  1752.  
  1753. itemIndex = itemIndex + 1
  1754.  
  1755. self.interface.wndCube.Refresh()
  1756.  
  1757.  
  1758. except RuntimeError, msg:
  1759. dbg.TraceError(msg)
  1760. return 0
  1761.  
  1762. pass
  1763.  
  1764. # END_OF_CUBE
  1765.  
  1766. # 용혼석
  1767. def BINARY_Highlight_Item(self, inven_type, inven_pos):
  1768. self.interface.Highligt_Item(inven_type, inven_pos)
  1769.  
  1770. def BINARY_DragonSoulGiveQuilification(self):
  1771. self.interface.DragonSoulGiveQuilification()
  1772.  
  1773. def BINARY_DragonSoulRefineWindow_Open(self):
  1774. self.interface.OpenDragonSoulRefineWindow()
  1775.  
  1776. def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  1777. self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  1778.  
  1779. def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  1780. self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  1781.  
  1782. # END of DRAGON SOUL REFINE WINDOW
  1783.  
  1784. def BINARY_SetBigMessage(self, message):
  1785. self.interface.bigBoard.SetTip(message)
  1786.  
  1787. def BINARY_SetTipMessage(self, message):
  1788. self.interface.tipBoard.SetTip(message)
  1789.  
  1790. def BINARY_AppendNotifyMessage(self, type):
  1791. if not type in localeInfo.NOTIFY_MESSAGE:
  1792. return
  1793. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  1794.  
  1795. def BINARY_Guild_EnterGuildArea(self, areaID):
  1796. self.interface.BULID_EnterGuildArea(areaID)
  1797.  
  1798. def BINARY_Guild_ExitGuildArea(self, areaID):
  1799. self.interface.BULID_ExitGuildArea(areaID)
  1800.  
  1801. def BINARY_GuildWar_OnSendDeclare(self, guildID):
  1802. pass
  1803.  
  1804. def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  1805. mainCharacterName = player.GetMainCharacterName()
  1806. masterName = guild.GetGuildMasterName()
  1807. if mainCharacterName == masterName:
  1808. self.__GuildWar_OpenAskDialog(guildID, warType)
  1809.  
  1810. def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  1811. self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  1812.  
  1813. def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  1814. self.interface.OnStartGuildWar(guildSelf, guildOpp)
  1815.  
  1816. def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  1817. self.interface.OnEndGuildWar(guildSelf, guildOpp)
  1818.  
  1819. def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  1820. self.interface.BINARY_SetObserverMode(isEnable)
  1821.  
  1822. def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  1823. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1824.  
  1825. def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  1826. guildID1 = int(guildID1)
  1827. guildID2 = int(guildID2)
  1828. memberCount1 = int(memberCount1)
  1829. memberCount2 = int(memberCount2)
  1830. observerCount = int(observerCount)
  1831.  
  1832. self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  1833. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1834.  
  1835. def __GuildWar_OpenAskDialog(self, guildID, warType):
  1836.  
  1837. guildName = guild.GetGuildName(guildID)
  1838.  
  1839. # REMOVED_GUILD_BUG_FIX
  1840. if "Noname" == guildName:
  1841. return
  1842. # END_OF_REMOVED_GUILD_BUG_FIX
  1843.  
  1844. import uiGuild
  1845. questionDialog = uiGuild.AcceptGuildWarDialog()
  1846. questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  1847. questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  1848. questionDialog.Open(guildName, warType)
  1849.  
  1850. self.guildWarQuestionDialog = questionDialog
  1851.  
  1852. def __GuildWar_CloseAskDialog(self):
  1853. self.guildWarQuestionDialog.Close()
  1854. self.guildWarQuestionDialog = None
  1855.  
  1856. def __GuildWar_OnAccept(self):
  1857.  
  1858. guildName = self.guildWarQuestionDialog.GetGuildName()
  1859.  
  1860. net.SendChatPacket("/war " + guildName)
  1861. self.__GuildWar_CloseAskDialog()
  1862.  
  1863. return 1
  1864.  
  1865. def __GuildWar_OnDecline(self):
  1866.  
  1867. guildName = self.guildWarQuestionDialog.GetGuildName()
  1868.  
  1869. net.SendChatPacket("/nowar " + guildName)
  1870. self.__GuildWar_CloseAskDialog()
  1871.  
  1872. return 1
  1873. ## BINARY CALLBACK
  1874. ######################################################################################
  1875.  
  1876. def __ServerCommand_Build(self):
  1877. serverCommandList={
  1878. "ConsoleEnable" : self.__Console_Enable,
  1879. "DayMode" : self.__DayMode_Update,
  1880. "PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update,
  1881. "CloseRestartWindow" : self.__RestartDialog_Close,
  1882. "OpenPrivateShop" : self.__PrivateShop_Open,
  1883. "PartyHealReady" : self.PartyHealReady,
  1884. "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  1885. "CloseSafebox" : self.CommandCloseSafebox,
  1886. "getinputbegin" : self.__Inputget1,
  1887. "getinputend" : self.__Inputget2,
  1888. "getinput" : self.__Inputget3,
  1889.  
  1890. #Gildenlager
  1891. "GUILDSTORAGE" : self._GuildStorageCMD,
  1892. "GUILDSTORAGE_ADDITEM" : self._GuildStorageAddItem,
  1893. "GUILDSTORAGE_ADDITEMSLOT" : self._GuildStorageAddItemSlot,
  1894. "GUILDSTORAGE_ADDMEMBER" : self._GuildStorageAddMemberToList,
  1895. "GUILDSTORAGE_ADDTEMPSLOT" : self._GuildStorageTempSlotsAdd,
  1896. "GUILDSTORAGE_ADDLOG" : self._GuildStorageAddLog,
  1897.  
  1898. # ITEM_MALL
  1899. "CloseMall" : self.CommandCloseMall,
  1900. "ShowMeMallPassword" : self.AskMallPassword,
  1901. "item_mall" : self.__ItemMall_Open,
  1902. # END_OF_ITEM_MALL
  1903.  
  1904. "RefineSuceeded" : self.RefineSuceededMessage,
  1905. "RefineFailed" : self.RefineFailedMessage,
  1906. "xmas_snow" : self.__XMasSnow_Enable,
  1907. "xmas_boom" : self.__XMasBoom_Enable,
  1908. "xmas_song" : self.__XMasSong_Enable,
  1909. "xmas_tree" : self.__XMasTree_Enable,
  1910. "newyear_boom" : self.__XMasBoom_Enable,
  1911. "PartyRequest" : self.__PartyRequestQuestion,
  1912. "PartyRequestDenied" : self.__PartyRequestDenied,
  1913. "horse_state" : self.__Horse_UpdateState,
  1914. "hide_horse_state" : self.__Horse_HideState,
  1915. "WarUC" : self.__GuildWar_UpdateMemberCount,
  1916. "test_server" : self.__EnableTestServerFlag,
  1917. "mall" : self.__InGameShop_Show,
  1918.  
  1919. # WEDDING
  1920. "lover_login" : self.__LoginLover,
  1921. "lover_logout" : self.__LogoutLover,
  1922. "lover_near" : self.__LoverNear,
  1923. "lover_far" : self.__LoverFar,
  1924. "lover_divorce" : self.__LoverDivorce,
  1925. "PlayMusic" : self.__PlayMusic,
  1926. # END_OF_WEDDING
  1927. # BUFF
  1928. "buff5" : self.__buff5,
  1929. "buff6" : self.__buff6,
  1930. # BUFF
  1931. # PRIVATE_SHOP_PRICE_LIST
  1932. "MyShopPriceList" : self.__PrivateShop_PriceList,
  1933. # END_OF_PRIVATE_SHOP_PRICE_LIST
  1934. }
  1935.  
  1936. self.serverCommander=stringCommander.Analyzer()
  1937. for serverCommandItem in serverCommandList.items():
  1938. self.serverCommander.SAFE_RegisterCallBack(
  1939. serverCommandItem[0], serverCommandItem[1]
  1940. )
  1941.  
  1942. def BINARY_ServerCommand_Run(self, line):
  1943. #dbg.TraceError(line)
  1944. try:
  1945. #print " BINARY_ServerCommand_Run", line
  1946. return self.serverCommander.Run(line)
  1947. except RuntimeError, msg:
  1948. dbg.TraceError(msg)
  1949. return 0
  1950.  
  1951. # BUFF
  1952. def __buff5(self):
  1953. net.SendChatPacket("(buff5)")
  1954. def __buff6(self):
  1955. net.SendChatPacket("(buff6)")
  1956. # BUFF
  1957.  
  1958. def __ProcessPreservedServerCommand(self):
  1959. try:
  1960. command = net.GetPreservedServerCommand()
  1961. while command:
  1962. print " __ProcessPreservedServerCommand", command
  1963. self.serverCommander.Run(command)
  1964. command = net.GetPreservedServerCommand()
  1965. except RuntimeError, msg:
  1966. dbg.TraceError(msg)
  1967. return 0
  1968.  
  1969. def PartyHealReady(self):
  1970. self.interface.PartyHealReady()
  1971.  
  1972. def AskSafeboxPassword(self):
  1973. self.interface.AskSafeboxPassword()
  1974.  
  1975. # ITEM_MALL
  1976. def AskMallPassword(self):
  1977. self.interface.AskMallPassword()
  1978.  
  1979. def __ItemMall_Open(self):
  1980. self.interface.OpenItemMall();
  1981.  
  1982. def CommandCloseMall(self):
  1983. self.interface.CommandCloseMall()
  1984. # END_OF_ITEM_MALL
  1985.  
  1986. def RefineSuceededMessage(self):
  1987. snd.PlaySound("sound/ui/make_soket.wav")
  1988. self.PopupMessage(localeInfo.REFINE_SUCCESS)
  1989.  
  1990. def RefineFailedMessage(self):
  1991. snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1992. self.PopupMessage(localeInfo.REFINE_FAILURE)
  1993.  
  1994. def CommandCloseSafebox(self):
  1995. self.interface.CommandCloseSafebox()
  1996.  
  1997. # PRIVATE_SHOP_PRICE_LIST
  1998. def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  1999. uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)
  2000. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2001.  
  2002. def __Horse_HideState(self):
  2003. self.affectShower.SetHorseState(0, 0, 0)
  2004.  
  2005. def __Horse_UpdateState(self, level, health, battery):
  2006. self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2007.  
  2008. def __IsXMasMap(self):
  2009. mapDict = ( "metin2_map_n_flame_01",
  2010. "metin2_map_n_desert_01",
  2011. "metin2_map_spiderdungeon",
  2012. "metin2_map_deviltower1", )
  2013.  
  2014. if background.GetCurrentMapName() in mapDict:
  2015. return FALSE
  2016.  
  2017. return TRUE
  2018.  
  2019. def __XMasSnow_Enable(self, mode):
  2020.  
  2021. self.__XMasSong_Enable(mode)
  2022.  
  2023. if "1"==mode:
  2024.  
  2025. if not self.__IsXMasMap():
  2026. return
  2027.  
  2028. print "XMAS_SNOW ON"
  2029. background.EnableSnow(1)
  2030.  
  2031. else:
  2032. print "XMAS_SNOW OFF"
  2033. background.EnableSnow(0)
  2034.  
  2035. def __XMasBoom_Enable(self, mode):
  2036. if "1"==mode:
  2037.  
  2038. if not self.__IsXMasMap():
  2039. return
  2040.  
  2041. print "XMAS_BOOM ON"
  2042. self.__DayMode_Update("dark")
  2043. self.enableXMasBoom = TRUE
  2044. self.startTimeXMasBoom = app.GetTime()
  2045. else:
  2046. print "XMAS_BOOM OFF"
  2047. self.__DayMode_Update("light")
  2048. self.enableXMasBoom = FALSE
  2049.  
  2050. def __XMasTree_Enable(self, grade):
  2051.  
  2052. print "XMAS_TREE ", grade
  2053. background.SetXMasTree(int(grade))
  2054.  
  2055. def __XMasSong_Enable(self, mode):
  2056. if "1"==mode:
  2057. print "XMAS_SONG ON"
  2058.  
  2059. XMAS_BGM = "xmas.mp3"
  2060.  
  2061. if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2062. if musicInfo.fieldMusic != "":
  2063. snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2064.  
  2065. musicInfo.fieldMusic=XMAS_BGM
  2066. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2067.  
  2068. else:
  2069. print "XMAS_SONG OFF"
  2070.  
  2071. if musicInfo.fieldMusic != "":
  2072. snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2073.  
  2074. musicInfo.fieldMusic=musicInfo.METIN2THEMA
  2075. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2076.  
  2077. def __RestartDialog_Close(self):
  2078. self.interface.CloseRestartDialog()
  2079.  
  2080. def __Console_Enable(self):
  2081. constInfo.CONSOLE_ENABLE = TRUE
  2082. self.consoleEnable = TRUE
  2083. app.EnableSpecialCameraMode()
  2084. ui.EnablePaste(TRUE)
  2085.  
  2086. ## PrivateShop
  2087. def __PrivateShop_Open(self):
  2088. self.interface.OpenPrivateShopInputNameDialog()
  2089.  
  2090. def BINARY_PrivateShop_Appear(self, vid, text):
  2091. self.interface.AppearPrivateShop(vid, text)
  2092.  
  2093. def BINARY_PrivateShop_Disappear(self, vid):
  2094. self.interface.DisappearPrivateShop(vid)
  2095.  
  2096. ## DayMode
  2097. def __PRESERVE_DayMode_Update(self, mode):
  2098. if "light"==mode:
  2099. background.SetEnvironmentData(0)
  2100. elif "dark"==mode:
  2101.  
  2102. if not self.__IsXMasMap():
  2103. return
  2104.  
  2105. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2106. background.SetEnvironmentData(1)
  2107.  
  2108. def __DayMode_Update(self, mode):
  2109. if "light"==mode:
  2110. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2111. elif "dark"==mode:
  2112.  
  2113. if not self.__IsXMasMap():
  2114. return
  2115.  
  2116. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2117.  
  2118. def __DayMode_OnCompleteChangeToLight(self):
  2119. background.SetEnvironmentData(0)
  2120. self.curtain.FadeIn()
  2121.  
  2122. def __DayMode_OnCompleteChangeToDark(self):
  2123. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2124. background.SetEnvironmentData(1)
  2125. self.curtain.FadeIn()
  2126.  
  2127. ## XMasBoom
  2128. def __XMasBoom_Update(self):
  2129.  
  2130. self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2131. if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2132. return
  2133.  
  2134. boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2135. boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2136.  
  2137. if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2138.  
  2139. self.indexXMasBoom += 1
  2140.  
  2141. for i in xrange(boomCount):
  2142. self.__XMasBoom_Boom()
  2143.  
  2144. def __XMasBoom_Boom(self):
  2145. x, y, z = player.GetMainCharacterPosition()
  2146. randX = app.GetRandom(-150, 150)
  2147. randY = app.GetRandom(-150, 150)
  2148.  
  2149. snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2150.  
  2151. def __PartyRequestQuestion(self, vid):
  2152. vid = int(vid)
  2153. partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2154. partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2155. partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2156. partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2157. partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
  2158. partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
  2159. partyRequestQuestionDialog.Open()
  2160. partyRequestQuestionDialog.vid = vid
  2161. self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2162.  
  2163. def __AnswerPartyRequest(self, answer):
  2164. if not self.partyRequestQuestionDialog:
  2165. return
  2166.  
  2167. vid = self.partyRequestQuestionDialog.vid
  2168.  
  2169. if answer:
  2170. net.SendChatPacket("/party_request_accept " + str(vid))
  2171. else:
  2172. net.SendChatPacket("/party_request_deny " + str(vid))
  2173.  
  2174. self.partyRequestQuestionDialog.Close()
  2175. self.partyRequestQuestionDialog = None
  2176.  
  2177. def __PartyRequestDenied(self):
  2178. self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2179.  
  2180. def __EnableTestServerFlag(self):
  2181. app.EnableTestServerFlag()
  2182.  
  2183. def __InGameShop_Show(self, url):
  2184. if constInfo.IN_GAME_SHOP_ENABLE:
  2185. self.interface.OpenWebWindow(url)
  2186.  
  2187. # WEDDING
  2188. def __LoginLover(self):
  2189. if self.interface.wndMessenger:
  2190. self.interface.wndMessenger.OnLoginLover()
  2191.  
  2192. def __LogoutLover(self):
  2193. if self.interface.wndMessenger:
  2194. self.interface.wndMessenger.OnLogoutLover()
  2195. if self.affectShower:
  2196. self.affectShower.HideLoverState()
  2197.  
  2198. def __LoverNear(self):
  2199. if self.affectShower:
  2200. self.affectShower.ShowLoverState()
  2201.  
  2202. def __LoverFar(self):
  2203. if self.affectShower:
  2204. self.affectShower.HideLoverState()
  2205.  
  2206. def __LoverDivorce(self):
  2207. if self.interface.wndMessenger:
  2208. self.interface.wndMessenger.ClearLoverInfo()
  2209. if self.affectShower:
  2210. self.affectShower.ClearLoverState()
  2211.  
  2212. def __PlayMusic(self, flag, filename):
  2213. flag = int(flag)
  2214. if flag:
  2215. snd.FadeOutAllMusic()
  2216. musicInfo.SaveLastPlayFieldMusic()
  2217. snd.FadeInMusic("BGM/" + filename)
  2218. else:
  2219. snd.FadeOutAllMusic()
  2220. musicInfo.LoadLastPlayFieldMusic()
  2221. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2222.  
  2223. # END_OF_WEDDING
  2224.  
  2225.  
  2226. def __nopickInfo(self):
  2227. if constInfo.pickInfo == 0:
  2228. constInfo.pickInfo = 1
  2229. chat.AppendChat(chat.CHAT_TYPE_INFO, "Deine Yangdropanzeige wurde aktiviert")
  2230. elif constInfo.pickInfo == 1:
  2231. constInfo.pickInfo = 0
  2232. chat.AppendChat(chat.CHAT_TYPE_INFO, "Deine Yangdropanzeige wurde deaktiviert")
  2233.  
  2234. def _GuildStorageCMD(self, command):
  2235. cmd = command.split("/")
  2236.  
  2237. if cmd[0] == "OPEN":
  2238. self.interface.GuildStorageWindow.Open(int(cmd[1]))
  2239. elif cmd[0] == "REFRESH":
  2240. self.interface.GuildStorageWindow.RefreshSlots()
  2241. elif cmd[0] == "REFRESH_MONEY":
  2242. self.interface.GuildStorageWindow.SetMoney(cmd[1])
  2243. elif cmd[0] == "REFRESH_MEMBERS":
  2244. self.interface.GuildStorageWindow.Adminpanel["board"].RefreshMembers()
  2245. elif cmd[0] == "CLEAR_TEMPSLOTS":
  2246. constInfo.GUILDSTORAGE["tempslots"] = {"TAB0" : {},"TAB1" : {},"TAB2" : {}}
  2247. elif cmd[0] == "COMPARE_TEMPSLOTS":
  2248. for i in range(3):
  2249. if constInfo.GUILDSTORAGE["tempslots"]["TAB"+str(i)] != constInfo.GUILDSTORAGE["slots"]["TAB"+str(i)]:
  2250. constInfo.GUILDSTORAGE["slots"]["TAB"+str(i)] = {}
  2251. constInfo.GUILDSTORAGE["slots"]["TAB"+str(i)] = constInfo.GUILDSTORAGE["tempslots"]["TAB"+str(i)]
  2252. self.interface.GuildStorageWindow.RefreshSlots()
  2253. elif cmd[0] == "QID":
  2254. self.GuildStorageQID(cmd[1])
  2255. elif cmd[0] == "QUESTCMD":
  2256. self._GuildStorageQuestCMD()
  2257. elif cmd[0] == "MEMBER_COMPLETE":
  2258. constInfo.GUILDSTORAGE["members"] = {}
  2259. self.interface.GuildStorageWindow.ClearMembers()
  2260. import event
  2261. constInfo.GUILDSTORAGE["questCMD"] = "GETMEMBERLIST"
  2262. event.QuestButtonClick(int(constInfo.GUILDSTORAGE["qid"]))
  2263.  
  2264. def _GuildStorageAddItemSlot(self, slot, tab ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  2265. self.interface.GuildStorageWindow.AddItemSlot(slot, tab ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6)
  2266.  
  2267. def _GuildStorageAddItem(self, slot ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  2268. slotsWidth = 15
  2269. slotsHeight = 8
  2270. slot = int(slot)
  2271. if slot <= 120:
  2272. constInfo.GUILDSTORAGE["slots"]["TAB0"][slot] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2273. elif slot > 120 and slot <= 240:
  2274. constInfo.GUILDSTORAGE["slots"]["TAB1"][slot-120] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2275. elif slot > 240 and slot <= 360:
  2276. constInfo.GUILDSTORAGE["slots"]["TAB2"][slot-240] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2277.  
  2278. def _GuildStorageTempSlotsAdd(self,slot ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  2279. slot = int(slot)
  2280. if slot <= 120:
  2281. constInfo.GUILDSTORAGE["tempslots"]["TAB0"][slot] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2282. elif slot > 120 and slot <= 240:
  2283. constInfo.GUILDSTORAGE["tempslots"]["TAB1"][slot-120] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2284. elif slot > 240 and slot <= 360:
  2285. constInfo.GUILDSTORAGE["tempslots"]["TAB2"][slot-240] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2286.  
  2287. def _GuildStorageAddLog(self,id,name,date,type,do,desc):
  2288. self.interface.GuildStorageWindow.LogsInsert(id,name,date,type,do,desc)
  2289. constInfo.GUILDSTORAGE["logs"][int(id)] = [name,date,type,do,desc]
  2290.  
  2291. def _GuildStorageQuestCMD(self):
  2292. net.SendQuestInputStringPacket(str(constInfo.GUILDSTORAGE["questCMD"]))
  2293. constInfo.GUILDSTORAGE["questCMD"] = "NULL#"
  2294.  
  2295. def GuildStorageQID(self, qid):
  2296. constInfo.GUILDSTORAGE["qid"] = int(qid)
  2297.  
  2298. def _GuildStorageAddMemberToList(self,memberId,member,authority0,authority1,authority2,authority3):
  2299. constInfo.GUILDSTORAGE["members"]["member"+memberId] = [member,int(authority0),int(authority1),int(authority2),int(authority3)]
  2300.  
  2301. def __Inputget1(self):
  2302. constInfo.INPUT_IGNORE = 1
  2303.  
  2304. def __Inputget2(self):
  2305. constInfo.INPUT_IGNORE = 0
  2306.  
  2307. def __Inputget3(self):
  2308. net.SendQuestInputStringPacket("1")
  2309.  
  2310. def __toggleSwitchbot(self):
  2311. if self.switchbot.bot_shown == 1:
  2312. self.switchbot.Hide()
  2313. else:
  2314. self.switchbot.Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement