Advertisement
Guest User

Untitled

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