forked from metin2/client
1
0
Fork 0
client/bin_original/interfaceModule.py

1720 lines
45 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

##
## Interface
##
import constInfo
import systemSetting
import wndMgr
import chat
import app
import player
import uiTaskBar
import uiCharacter
import uiInventory
import uiDragonSoul
import uiChat
import uiMessenger
import guild
import ui
import uiHelp
import uiWhisper
import uiPointReset
import uiShop
import uiExchange
import uiSystem
import uiRestart
import uiToolTip
import uiMiniMap
import uiParty
import uiSafebox
import uiGuild
import uiQuest
import uiPrivateShopBuilder
import uiCommon
import uiRefine
import uiEquipmentDialog
import uiGameButton
import uiTip
import uiCube
import miniMap
# ACCESSORY_REFINE_ADD_METIN_STONE
import uiSelectItem
# END_OF_ACCESSORY_REFINE_ADD_METIN_STONE
import uiScriptLocale
import event
import locale
IsQBHide = 0
class Interface(object):
CHARACTER_STATUS_TAB = 1
CHARACTER_SKILL_TAB = 2
def __init__(self):
systemSetting.SetInterfaceHandler(self)
self.windowOpenPosition = 0
self.dlgWhisperWithoutTarget = None
self.inputDialog = None
self.tipBoard = None
self.bigBoard = None
# ITEM_MALL
self.mallPageDlg = None
# END_OF_ITEM_MALL
self.wndWeb = None
self.wndTaskBar = None
self.wndCharacter = None
self.wndInventory = None
self.wndExpandedTaskBar = None
self.wndDragonSoul = None
self.wndDragonSoulRefine = None
self.wndChat = None
self.wndMessenger = None
self.wndMiniMap = None
self.wndGuild = None
self.wndGuildBuilding = None
self.listGMName = {}
self.wndQuestWindow = []
self.privateShopAdvertisementBoardDict = {}
self.guildScoreBoardDict = {}
self.equipmentDialogDict = {}
event.SetInterfaceWindow(self)
def __del__(self):
systemSetting.DestroyInterfaceHandler()
event.SetInterfaceWindow(None)
################################
## Make Windows & Dialogs
def __MakeUICurtain(self):
wndUICurtain = ui.Bar("TOP_MOST")
wndUICurtain.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
wndUICurtain.SetColor(0x77000000)
wndUICurtain.Hide()
self.wndUICurtain = wndUICurtain
def __MakeMessengerWindow(self):
self.wndMessenger = uiMessenger.MessengerWindow()
from _weakref import proxy
self.wndMessenger.SetWhisperButtonEvent(lambda n,i=proxy(self):i.OpenWhisperDialog(n))
self.wndMessenger.SetGuildButtonEvent(ui.__mem_func__(self.ToggleGuildWindow))
def __MakeGuildWindow(self):
self.wndGuild = uiGuild.GuildWindow()
def __MakeChatWindow(self):
wndChat = uiChat.ChatWindow()
wndChat.SetSize(wndChat.CHAT_WINDOW_WIDTH, 0)
wndChat.SetPosition(wndMgr.GetScreenWidth()/2 - wndChat.CHAT_WINDOW_WIDTH/2, wndMgr.GetScreenHeight() - wndChat.EDIT_LINE_HEIGHT - 37)
wndChat.SetHeight(200)
wndChat.Refresh()
wndChat.Show()
self.wndChat = wndChat
self.wndChat.BindInterface(self)
self.wndChat.SetSendWhisperEvent(ui.__mem_func__(self.OpenWhisperDialogWithoutTarget))
self.wndChat.SetOpenChatLogEvent(ui.__mem_func__(self.ToggleChatLogWindow))
def __MakeTaskBar(self):
wndTaskBar = uiTaskBar.TaskBar()
wndTaskBar.LoadWindow()
self.wndTaskBar = wndTaskBar
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_CHARACTER, ui.__mem_func__(self.ToggleCharacterWindowStatusPage))
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_INVENTORY, ui.__mem_func__(self.ToggleInventoryWindow))
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_MESSENGER, ui.__mem_func__(self.ToggleMessenger))
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_SYSTEM, ui.__mem_func__(self.ToggleSystemDialog))
if uiTaskBar.TaskBar.IS_EXPANDED:
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_EXPAND, ui.__mem_func__(self.ToggleExpandedButton))
self.wndExpandedTaskBar = uiTaskBar.ExpandedTaskBar()
self.wndExpandedTaskBar.LoadWindow()
self.wndExpandedTaskBar.SetToggleButtonEvent(uiTaskBar.ExpandedTaskBar.BUTTON_DRAGON_SOUL, ui.__mem_func__(self.ToggleDragonSoulWindow))
else:
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_CHAT, ui.__mem_func__(self.ToggleChat))
self.wndEnergyBar = None
import app
if app.ENABLE_ENERGY_SYSTEM:
wndEnergyBar = uiTaskBar.EnergyBar()
wndEnergyBar.LoadWindow()
self.wndEnergyBar = wndEnergyBar
def __MakeParty(self):
wndParty = uiParty.PartyWindow()
wndParty.Hide()
self.wndParty = wndParty
def __MakeGameButtonWindow(self):
wndGameButton = uiGameButton.GameButtonWindow()
wndGameButton.SetTop()
wndGameButton.Show()
wndGameButton.SetButtonEvent("STATUS", ui.__mem_func__(self.__OnClickStatusPlusButton))
wndGameButton.SetButtonEvent("SKILL", ui.__mem_func__(self.__OnClickSkillPlusButton))
wndGameButton.SetButtonEvent("QUEST", ui.__mem_func__(self.__OnClickQuestButton))
wndGameButton.SetButtonEvent("HELP", ui.__mem_func__(self.__OnClickHelpButton))
wndGameButton.SetButtonEvent("BUILD", ui.__mem_func__(self.__OnClickBuildButton))
self.wndGameButton = wndGameButton
def __IsChatOpen(self):
return TRUE
def __MakeWindows(self):
wndCharacter = uiCharacter.CharacterWindow()
wndInventory = uiInventory.InventoryWindow()
wndInventory.BindInterfaceClass(self)
if app.ENABLE_DRAGON_SOUL_SYSTEM:
wndDragonSoul = uiDragonSoul.DragonSoulWindow()
wndDragonSoulRefine = uiDragonSoul.DragonSoulRefineWindow()
else:
wndDragonSoul = None
wndDragonSoulRefine = None
wndMiniMap = uiMiniMap.MiniMap()
wndSafebox = uiSafebox.SafeboxWindow()
# ITEM_MALL
wndMall = uiSafebox.MallWindow()
self.wndMall = wndMall
# END_OF_ITEM_MALL
wndChatLog = uiChat.ChatLogWindow()
wndChatLog.BindInterface(self)
self.wndCharacter = wndCharacter
self.wndInventory = wndInventory
self.wndDragonSoul = wndDragonSoul
self.wndDragonSoulRefine = wndDragonSoulRefine
self.wndMiniMap = wndMiniMap
self.wndSafebox = wndSafebox
self.wndChatLog = wndChatLog
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.SetDragonSoulRefineWindow(self.wndDragonSoulRefine)
self.wndDragonSoulRefine.SetInventoryWindows(self.wndInventory, self.wndDragonSoul)
self.wndInventory.SetDragonSoulRefineWindow(self.wndDragonSoulRefine)
def __MakeDialogs(self):
self.dlgExchange = uiExchange.ExchangeDialog()
self.dlgExchange.LoadDialog()
self.dlgExchange.SetCenterPosition()
self.dlgExchange.Hide()
self.dlgPointReset = uiPointReset.PointResetDialog()
self.dlgPointReset.LoadDialog()
self.dlgPointReset.Hide()
self.dlgShop = uiShop.ShopDialog()
self.dlgShop.LoadDialog()
self.dlgShop.Hide()
self.dlgRestart = uiRestart.RestartDialog()
self.dlgRestart.LoadDialog()
self.dlgRestart.Hide()
self.dlgSystem = uiSystem.SystemDialog()
self.dlgSystem.LoadDialog()
self.dlgSystem.SetOpenHelpWindowEvent(ui.__mem_func__(self.OpenHelpWindow))
self.dlgSystem.Hide()
self.dlgPassword = uiSafebox.PasswordDialog()
self.dlgPassword.Hide()
self.hyperlinkItemTooltip = uiToolTip.HyperlinkItemToolTip()
self.hyperlinkItemTooltip.Hide()
self.tooltipItem = uiToolTip.ItemToolTip()
self.tooltipItem.Hide()
self.tooltipSkill = uiToolTip.SkillToolTip()
self.tooltipSkill.Hide()
self.privateShopBuilder = uiPrivateShopBuilder.PrivateShopBuilder()
self.privateShopBuilder.Hide()
self.dlgRefineNew = uiRefine.RefineDialogNew()
self.dlgRefineNew.Hide()
def __MakeHelpWindow(self):
self.wndHelp = uiHelp.HelpWindow()
self.wndHelp.LoadDialog()
self.wndHelp.SetCloseEvent(ui.__mem_func__(self.CloseHelpWindow))
self.wndHelp.Hide()
def __MakeTipBoard(self):
self.tipBoard = uiTip.TipBoard()
self.tipBoard.Hide()
self.bigBoard = uiTip.BigBoard()
self.bigBoard.Hide()
def __MakeWebWindow(self):
if constInfo.IN_GAME_SHOP_ENABLE:
import uiWeb
self.wndWeb = uiWeb.WebWindow()
self.wndWeb.LoadWindow()
self.wndWeb.Hide()
def __MakeCubeWindow(self):
self.wndCube = uiCube.CubeWindow()
self.wndCube.LoadWindow()
self.wndCube.Hide()
def __MakeCubeResultWindow(self):
self.wndCubeResult = uiCube.CubeResultWindow()
self.wndCubeResult.LoadWindow()
self.wndCubeResult.Hide()
# ACCESSORY_REFINE_ADD_METIN_STONE
def __MakeItemSelectWindow(self):
self.wndItemSelect = uiSelectItem.SelectItemWindow()
self.wndItemSelect.Hide()
# END_OF_ACCESSORY_REFINE_ADD_METIN_STONE
def MakeInterface(self):
self.__MakeMessengerWindow()
self.__MakeGuildWindow()
self.__MakeChatWindow()
self.__MakeParty()
self.__MakeWindows()
self.__MakeDialogs()
self.__MakeUICurtain()
self.__MakeTaskBar()
self.__MakeGameButtonWindow()
self.__MakeHelpWindow()
self.__MakeTipBoard()
self.__MakeWebWindow()
self.__MakeCubeWindow()
self.__MakeCubeResultWindow()
# ACCESSORY_REFINE_ADD_METIN_STONE
self.__MakeItemSelectWindow()
# END_OF_ACCESSORY_REFINE_ADD_METIN_STONE
self.questButtonList = []
self.whisperButtonList = []
self.whisperDialogDict = {}
self.privateShopAdvertisementBoardDict = {}
self.wndInventory.SetItemToolTip(self.tooltipItem)
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.SetItemToolTip(self.tooltipItem)
self.wndDragonSoulRefine.SetItemToolTip(self.tooltipItem)
self.wndSafebox.SetItemToolTip(self.tooltipItem)
self.wndCube.SetItemToolTip(self.tooltipItem)
self.wndCubeResult.SetItemToolTip(self.tooltipItem)
# ITEM_MALL
self.wndMall.SetItemToolTip(self.tooltipItem)
# END_OF_ITEM_MALL
self.wndCharacter.SetSkillToolTip(self.tooltipSkill)
self.wndTaskBar.SetItemToolTip(self.tooltipItem)
self.wndTaskBar.SetSkillToolTip(self.tooltipSkill)
self.wndGuild.SetSkillToolTip(self.tooltipSkill)
# ACCESSORY_REFINE_ADD_METIN_STONE
self.wndItemSelect.SetItemToolTip(self.tooltipItem)
# END_OF_ACCESSORY_REFINE_ADD_METIN_STONE
self.dlgShop.SetItemToolTip(self.tooltipItem)
self.dlgExchange.SetItemToolTip(self.tooltipItem)
self.privateShopBuilder.SetItemToolTip(self.tooltipItem)
self.__InitWhisper()
self.DRAGON_SOUL_IS_QUALIFIED = FALSE
def MakeHyperlinkTooltip(self, hyperlink):
tokens = hyperlink.split(":")
if tokens and len(tokens):
type = tokens[0]
if "item" == type:
self.hyperlinkItemTooltip.SetHyperlinkItem(tokens)
## Make Windows & Dialogs
################################
def Close(self):
if self.dlgWhisperWithoutTarget:
self.dlgWhisperWithoutTarget.Destroy()
del self.dlgWhisperWithoutTarget
if uiQuest.QuestDialog.__dict__.has_key("QuestCurtain"):
uiQuest.QuestDialog.QuestCurtain.Close()
if self.wndQuestWindow:
for eachQuestWindow in self.wndQuestWindow:
eachQuestWindow.nextCurtainMode = -1
eachQuestWindow.CloseSelf()
eachQuestWindow = None
if self.wndChat:
self.wndChat.Destroy()
if self.wndTaskBar:
self.wndTaskBar.Destroy()
if self.wndExpandedTaskBar:
self.wndExpandedTaskBar.Destroy()
if self.wndEnergyBar:
self.wndEnergyBar.Destroy()
if self.wndCharacter:
self.wndCharacter.Destroy()
if self.wndInventory:
self.wndInventory.Destroy()
if self.wndDragonSoul:
self.wndDragonSoul.Destroy()
if self.wndDragonSoulRefine:
self.wndDragonSoulRefine.Destroy()
if self.dlgExchange:
self.dlgExchange.Destroy()
if self.dlgPointReset:
self.dlgPointReset.Destroy()
if self.dlgShop:
self.dlgShop.Destroy()
if self.dlgRestart:
self.dlgRestart.Destroy()
if self.dlgSystem:
self.dlgSystem.Destroy()
if self.dlgPassword:
self.dlgPassword.Destroy()
if self.wndMiniMap:
self.wndMiniMap.Destroy()
if self.wndSafebox:
self.wndSafebox.Destroy()
if self.wndWeb:
self.wndWeb.Destroy()
self.wndWeb = None
if self.wndMall:
self.wndMall.Destroy()
if self.wndParty:
self.wndParty.Destroy()
if self.wndHelp:
self.wndHelp.Destroy()
if self.wndCube:
self.wndCube.Destroy()
if self.wndCubeResult:
self.wndCubeResult.Destroy()
if self.wndMessenger:
self.wndMessenger.Destroy()
if self.wndGuild:
self.wndGuild.Destroy()
if self.privateShopBuilder:
self.privateShopBuilder.Destroy()
if self.dlgRefineNew:
self.dlgRefineNew.Destroy()
if self.wndGuildBuilding:
self.wndGuildBuilding.Destroy()
if self.wndGameButton:
self.wndGameButton.Destroy()
# ITEM_MALL
if self.mallPageDlg:
self.mallPageDlg.Destroy()
# END_OF_ITEM_MALL
# ACCESSORY_REFINE_ADD_METIN_STONE
if self.wndItemSelect:
self.wndItemSelect.Destroy()
# END_OF_ACCESSORY_REFINE_ADD_METIN_STONE
self.wndChatLog.Destroy()
for btn in self.questButtonList:
btn.SetEvent(0)
for btn in self.whisperButtonList:
btn.SetEvent(0)
for dlg in self.whisperDialogDict.itervalues():
dlg.Destroy()
for brd in self.guildScoreBoardDict.itervalues():
brd.Destroy()
for dlg in self.equipmentDialogDict.itervalues():
dlg.Destroy()
# ITEM_MALL
del self.mallPageDlg
# END_OF_ITEM_MALL
del self.wndGuild
del self.wndMessenger
del self.wndUICurtain
del self.wndChat
del self.wndTaskBar
if self.wndExpandedTaskBar:
del self.wndExpandedTaskBar
del self.wndEnergyBar
del self.wndCharacter
del self.wndInventory
if self.wndDragonSoul:
del self.wndDragonSoul
if self.wndDragonSoulRefine:
del self.wndDragonSoulRefine
del self.dlgExchange
del self.dlgPointReset
del self.dlgShop
del self.dlgRestart
del self.dlgSystem
del self.dlgPassword
del self.hyperlinkItemTooltip
del self.tooltipItem
del self.tooltipSkill
del self.wndMiniMap
del self.wndSafebox
del self.wndMall
del self.wndParty
del self.wndHelp
del self.wndCube
del self.wndCubeResult
del self.privateShopBuilder
del self.inputDialog
del self.wndChatLog
del self.dlgRefineNew
del self.wndGuildBuilding
del self.wndGameButton
del self.tipBoard
del self.bigBoard
del self.wndItemSelect
self.questButtonList = []
self.whisperButtonList = []
self.whisperDialogDict = {}
self.privateShopAdvertisementBoardDict = {}
self.guildScoreBoardDict = {}
self.equipmentDialogDict = {}
uiChat.DestroyChatInputSetWindow()
## Skill
def OnUseSkill(self, slotIndex, coolTime):
self.wndCharacter.OnUseSkill(slotIndex, coolTime)
self.wndTaskBar.OnUseSkill(slotIndex, coolTime)
self.wndGuild.OnUseSkill(slotIndex, coolTime)
def OnActivateSkill(self, slotIndex):
self.wndCharacter.OnActivateSkill(slotIndex)
self.wndTaskBar.OnActivateSkill(slotIndex)
def OnDeactivateSkill(self, slotIndex):
self.wndCharacter.OnDeactivateSkill(slotIndex)
self.wndTaskBar.OnDeactivateSkill(slotIndex)
def OnChangeCurrentSkill(self, skillSlotNumber):
self.wndTaskBar.OnChangeCurrentSkill(skillSlotNumber)
def SelectMouseButtonEvent(self, dir, event):
self.wndTaskBar.SelectMouseButtonEvent(dir, event)
## Refresh
def RefreshAlignment(self):
self.wndCharacter.RefreshAlignment()
def RefreshStatus(self):
self.wndTaskBar.RefreshStatus()
self.wndCharacter.RefreshStatus()
self.wndInventory.RefreshStatus()
if self.wndEnergyBar:
self.wndEnergyBar.RefreshStatus()
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.RefreshStatus()
def RefreshStamina(self):
self.wndTaskBar.RefreshStamina()
def RefreshSkill(self):
self.wndCharacter.RefreshSkill()
self.wndTaskBar.RefreshSkill()
def RefreshInventory(self):
self.wndTaskBar.RefreshQuickSlot()
self.wndInventory.RefreshItemSlot()
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.RefreshItemSlot()
def RefreshCharacter(self): ## Character <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, Inventory <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>׸<EFBFBD> <20><><EFBFBD><EFBFBD> Refresh
self.wndCharacter.RefreshCharacter()
self.wndTaskBar.RefreshQuickSlot()
def RefreshQuest(self):
self.wndCharacter.RefreshQuest()
def RefreshSafebox(self):
self.wndSafebox.RefreshSafebox()
# ITEM_MALL
def RefreshMall(self):
self.wndMall.RefreshMall()
def OpenItemMall(self):
if not self.mallPageDlg:
self.mallPageDlg = uiShop.MallPageDialog()
self.mallPageDlg.Open()
# END_OF_ITEM_MALL
def RefreshMessenger(self):
self.wndMessenger.RefreshMessenger()
def RefreshGuildInfoPage(self):
self.wndGuild.RefreshGuildInfoPage()
def RefreshGuildBoardPage(self):
self.wndGuild.RefreshGuildBoardPage()
def RefreshGuildMemberPage(self):
self.wndGuild.RefreshGuildMemberPage()
def RefreshGuildMemberPageGradeComboBox(self):
self.wndGuild.RefreshGuildMemberPageGradeComboBox()
def RefreshGuildSkillPage(self):
self.wndGuild.RefreshGuildSkillPage()
def RefreshGuildGradePage(self):
self.wndGuild.RefreshGuildGradePage()
def DeleteGuild(self):
self.wndMessenger.ClearGuildMember()
self.wndGuild.DeleteGuild()
def RefreshMobile(self):
self.dlgSystem.RefreshMobile()
def OnMobileAuthority(self):
self.dlgSystem.OnMobileAuthority()
def OnBlockMode(self, mode):
self.dlgSystem.OnBlockMode(mode)
## Calling Functions
# PointReset
def OpenPointResetDialog(self):
self.dlgPointReset.Show()
self.dlgPointReset.SetTop()
def ClosePointResetDialog(self):
self.dlgPointReset.Close()
# Shop
def OpenShopDialog(self, vid):
self.wndInventory.Show()
self.wndInventory.SetTop()
self.dlgShop.Open(vid)
self.dlgShop.SetTop()
def CloseShopDialog(self):
self.dlgShop.Close()
def RefreshShopDialog(self):
self.dlgShop.Refresh()
## Quest
def OpenCharacterWindowQuestPage(self):
self.wndCharacter.Show()
self.wndCharacter.SetState("QUEST")
def OpenQuestWindow(self, skin, idx):
wnds = ()
q = uiQuest.QuestDialog(skin, idx)
q.SetWindowName("QuestWindow" + str(idx))
q.Show()
if skin:
q.Lock()
wnds = self.__HideWindows()
# UNKNOWN_UPDATE
q.AddOnDoneEvent(lambda tmp_self, args=wnds: self.__ShowWindows(args))
# END_OF_UNKNOWN_UPDATE
if skin:
q.AddOnCloseEvent(q.Unlock)
q.AddOnCloseEvent(lambda s = self, qw = q: s.__dict__.__getitem__("wndQuestWindow").remove(qw))
# UNKNOWN_UPDATE
self.wndQuestWindow.append(q)
# END_OF_UNKNOWN_UPDATE
## Exchange
def StartExchange(self):
self.dlgExchange.OpenDialog()
self.dlgExchange.Refresh()
def EndExchange(self):
self.dlgExchange.CloseDialog()
def RefreshExchange(self):
self.dlgExchange.Refresh()
## Party
def AddPartyMember(self, pid, name):
self.wndParty.AddPartyMember(pid, name)
self.__ArrangeQuestButton()
def UpdatePartyMemberInfo(self, pid):
self.wndParty.UpdatePartyMemberInfo(pid)
def RemovePartyMember(self, pid):
self.wndParty.RemovePartyMember(pid)
##!! 20061026.levites.<2E><><EFBFBD><EFBFBD>Ʈ_<C6AE><5F>ġ_<C4A1><5F><EFBFBD><EFBFBD>
self.__ArrangeQuestButton()
def LinkPartyMember(self, pid, vid):
self.wndParty.LinkPartyMember(pid, vid)
def UnlinkPartyMember(self, pid):
self.wndParty.UnlinkPartyMember(pid)
def UnlinkAllPartyMember(self):
self.wndParty.UnlinkAllPartyMember()
def ExitParty(self):
self.wndParty.ExitParty()
##!! 20061026.levites.<2E><><EFBFBD><EFBFBD>Ʈ_<C6AE><5F>ġ_<C4A1><5F><EFBFBD><EFBFBD>
self.__ArrangeQuestButton()
def PartyHealReady(self):
self.wndParty.PartyHealReady()
def ChangePartyParameter(self, distributionMode):
self.wndParty.ChangePartyParameter(distributionMode)
## Safebox
def AskSafeboxPassword(self):
if self.wndSafebox.IsShow():
return
# SAFEBOX_PASSWORD
self.dlgPassword.SetTitle(locale.PASSWORD_TITLE)
self.dlgPassword.SetSendMessage("/safebox_password ")
# END_OF_SAFEBOX_PASSWORD
self.dlgPassword.ShowDialog()
def OpenSafeboxWindow(self, size):
self.dlgPassword.CloseDialog()
self.wndSafebox.ShowWindow(size)
def RefreshSafeboxMoney(self):
self.wndSafebox.RefreshSafeboxMoney()
def CommandCloseSafebox(self):
self.wndSafebox.CommandCloseSafebox()
# ITEM_MALL
def AskMallPassword(self):
if self.wndMall.IsShow():
return
self.dlgPassword.SetTitle(locale.MALL_PASSWORD_TITLE)
self.dlgPassword.SetSendMessage("/mall_password ")
self.dlgPassword.ShowDialog()
def OpenMallWindow(self, size):
self.dlgPassword.CloseDialog()
self.wndMall.ShowWindow(size)
def CommandCloseMall(self):
self.wndMall.CommandCloseMall()
# END_OF_ITEM_MALL
## Guild
def OnStartGuildWar(self, guildSelf, guildOpp):
self.wndGuild.OnStartGuildWar(guildSelf, guildOpp)
guildWarScoreBoard = uiGuild.GuildWarScoreBoard()
guildWarScoreBoard.Open(guildSelf, guildOpp)
guildWarScoreBoard.Show()
self.guildScoreBoardDict[uiGuild.GetGVGKey(guildSelf, guildOpp)] = guildWarScoreBoard
def OnEndGuildWar(self, guildSelf, guildOpp):
self.wndGuild.OnEndGuildWar(guildSelf, guildOpp)
key = uiGuild.GetGVGKey(guildSelf, guildOpp)
if not self.guildScoreBoardDict.has_key(key):
return
self.guildScoreBoardDict[key].Destroy()
del self.guildScoreBoardDict[key]
# GUILDWAR_MEMBER_COUNT
def UpdateMemberCount(self, gulidID1, memberCount1, guildID2, memberCount2):
key = uiGuild.GetGVGKey(gulidID1, guildID2)
if not self.guildScoreBoardDict.has_key(key):
return
self.guildScoreBoardDict[key].UpdateMemberCount(gulidID1, memberCount1, guildID2, memberCount2)
# END_OF_GUILDWAR_MEMBER_COUNT
def OnRecvGuildWarPoint(self, gainGuildID, opponentGuildID, point):
key = uiGuild.GetGVGKey(gainGuildID, opponentGuildID)
if not self.guildScoreBoardDict.has_key(key):
return
guildBoard = self.guildScoreBoardDict[key]
guildBoard.SetScore(gainGuildID, opponentGuildID, point)
## PK Mode
def OnChangePKMode(self):
self.wndCharacter.RefreshAlignment()
self.dlgSystem.OnChangePKMode()
## Refine
def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type):
self.dlgRefineNew.Open(targetItemPos, nextGradeItemVnum, cost, prob, type)
def AppendMaterialToRefineDialog(self, vnum, count):
self.dlgRefineNew.AppendMaterial(vnum, count)
## Show & Hide
def ShowDefaultWindows(self):
self.wndTaskBar.Show()
self.wndMiniMap.Show()
self.wndMiniMap.ShowMiniMap()
if self.wndEnergyBar:
self.wndEnergyBar.Show()
def ShowAllWindows(self):
self.wndTaskBar.Show()
self.wndCharacter.Show()
self.wndInventory.Show()
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.Show()
self.wndDragonSoulRefine.Show()
self.wndChat.Show()
self.wndMiniMap.Show()
if self.wndEnergyBar:
self.wndEnergyBar.Show()
if self.wndExpandedTaskBar:
self.wndExpandedTaskBar.Show()
self.wndExpandedTaskBar.SetTop()
def HideAllWindows(self):
if self.wndTaskBar:
self.wndTaskBar.Hide()
if self.wndEnergyBar:
self.wndEnergyBar.Hide()
if self.wndCharacter:
self.wndCharacter.Hide()
if self.wndInventory:
self.wndInventory.Hide()
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.Hide()
self.wndDragonSoulRefine.Hide()
if self.wndChat:
self.wndChat.Hide()
if self.wndMiniMap:
self.wndMiniMap.Hide()
if self.wndMessenger:
self.wndMessenger.Hide()
if self.wndGuild:
self.wndGuild.Hide()
if self.wndExpandedTaskBar:
self.wndExpandedTaskBar.Hide()
def ShowMouseImage(self):
self.wndTaskBar.ShowMouseImage()
def HideMouseImage(self):
self.wndTaskBar.HideMouseImage()
def ToggleChat(self):
if TRUE == self.wndChat.IsEditMode():
self.wndChat.CloseChat()
else:
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ä<><C3A4> <20>Է<EFBFBD><D4B7><EFBFBD> <20>ȵ<EFBFBD>
if self.wndWeb and self.wndWeb.IsShow():
pass
else:
self.wndChat.OpenChat()
def IsOpenChat(self):
return self.wndChat.IsEditMode()
def SetChatFocus(self):
self.wndChat.SetChatFocus()
def OpenRestartDialog(self):
self.dlgRestart.OpenDialog()
self.dlgRestart.SetTop()
def CloseRestartDialog(self):
self.dlgRestart.Close()
def ToggleSystemDialog(self):
if FALSE == self.dlgSystem.IsShow():
self.dlgSystem.OpenDialog()
self.dlgSystem.SetTop()
else:
self.dlgSystem.Close()
def OpenSystemDialog(self):
self.dlgSystem.OpenDialog()
self.dlgSystem.SetTop()
def ToggleMessenger(self):
if self.wndMessenger.IsShow():
self.wndMessenger.Hide()
else:
self.wndMessenger.SetTop()
self.wndMessenger.Show()
def ToggleMiniMap(self):
if app.IsPressed(app.DIK_LSHIFT) or app.IsPressed(app.DIK_RSHIFT):
if FALSE == self.wndMiniMap.isShowMiniMap():
self.wndMiniMap.ShowMiniMap()
self.wndMiniMap.SetTop()
else:
self.wndMiniMap.HideMiniMap()
else:
self.wndMiniMap.ToggleAtlasWindow()
def PressMKey(self):
if app.IsPressed(app.DIK_LALT) or app.IsPressed(app.DIK_RALT):
self.ToggleMessenger()
else:
self.ToggleMiniMap()
def SetMapName(self, mapName):
self.wndMiniMap.SetMapName(mapName)
def MiniMapScaleUp(self):
self.wndMiniMap.ScaleUp()
def MiniMapScaleDown(self):
self.wndMiniMap.ScaleDown()
def ToggleCharacterWindow(self, state):
if FALSE == player.IsObserverMode():
if FALSE == self.wndCharacter.IsShow():
self.OpenCharacterWindowWithState(state)
else:
if state == self.wndCharacter.GetState():
self.wndCharacter.OverOutItem()
self.wndCharacter.Hide()
else:
self.wndCharacter.SetState(state)
def OpenCharacterWindowWithState(self, state):
if FALSE == player.IsObserverMode():
self.wndCharacter.SetState(state)
self.wndCharacter.Show()
self.wndCharacter.SetTop()
def ToggleCharacterWindowStatusPage(self):
self.ToggleCharacterWindow("STATUS")
def ToggleInventoryWindow(self):
if FALSE == player.IsObserverMode():
if FALSE == self.wndInventory.IsShow():
self.wndInventory.Show()
self.wndInventory.SetTop()
else:
self.wndInventory.OverOutItem()
self.wndInventory.Close()
def ToggleExpandedButton(self):
if FALSE == player.IsObserverMode():
if FALSE == self.wndExpandedTaskBar.IsShow():
self.wndExpandedTaskBar.Show()
self.wndExpandedTaskBar.SetTop()
else:
self.wndExpandedTaskBar.Close()
# <20><>ȥ<EFBFBD><C8A5>
def DragonSoulActivate(self, deck):
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.ActivateDragonSoulByExtern(deck)
def DragonSoulDeactivate(self):
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.DeactivateDragonSoul()
def Highligt_Item(self, inven_type, inven_pos):
if player.DRAGON_SOUL_INVENTORY == inven_type:
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoul.HighlightSlot(inven_pos)
def DragonSoulGiveQuilification(self):
self.DRAGON_SOUL_IS_QUALIFIED = TRUE
self.wndExpandedTaskBar.SetToolTipText(uiTaskBar.ExpandedTaskBar.BUTTON_DRAGON_SOUL, uiScriptLocale.TASKBAR_DRAGON_SOUL)
def ToggleDragonSoulWindow(self):
if FALSE == player.IsObserverMode():
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if FALSE == self.wndDragonSoul.IsShow():
if self.DRAGON_SOUL_IS_QUALIFIED:
self.wndDragonSoul.Show()
else:
try:
self.wndPopupDialog.SetText(locale.DRAGON_SOUL_UNQUALIFIED)
self.wndPopupDialog.Open()
except:
self.wndPopupDialog = uiCommon.PopupDialog()
self.wndPopupDialog.SetText(locale.DRAGON_SOUL_UNQUALIFIED)
self.wndPopupDialog.Open()
else:
self.wndDragonSoul.Close()
def ToggleDragonSoulWindowWithNoInfo(self):
if FALSE == player.IsObserverMode():
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if FALSE == self.wndDragonSoul.IsShow():
if self.DRAGON_SOUL_IS_QUALIFIED:
self.wndDragonSoul.Show()
else:
self.wndDragonSoul.Close()
def FailDragonSoulRefine(self, reason, inven_type, inven_pos):
if FALSE == player.IsObserverMode():
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if TRUE == self.wndDragonSoulRefine.IsShow():
self.wndDragonSoulRefine.RefineFail(reason, inven_type, inven_pos)
def SucceedDragonSoulRefine(self, inven_type, inven_pos):
if FALSE == player.IsObserverMode():
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if TRUE == self.wndDragonSoulRefine.IsShow():
self.wndDragonSoulRefine.RefineSucceed(inven_type, inven_pos)
def OpenDragonSoulRefineWindow(self):
if FALSE == player.IsObserverMode():
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if FALSE == self.wndDragonSoulRefine.IsShow():
self.wndDragonSoulRefine.Show()
if None != self.wndDragonSoul:
if FALSE == self.wndDragonSoul.IsShow():
self.wndDragonSoul.Show()
def CloseDragonSoulRefineWindow(self):
if FALSE == player.IsObserverMode():
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if TRUE == self.wndDragonSoulRefine.IsShow():
self.wndDragonSoulRefine.Close()
# <20><>ȥ<EFBFBD><C8A5> <20><>
def ToggleGuildWindow(self):
if not self.wndGuild.IsShow():
if self.wndGuild.CanOpen():
self.wndGuild.Open()
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GUILD_YOU_DO_NOT_JOIN)
else:
self.wndGuild.OverOutItem()
self.wndGuild.Hide()
def ToggleChatLogWindow(self):
if self.wndChatLog.IsShow():
self.wndChatLog.Hide()
else:
self.wndChatLog.Show()
def CheckGameButton(self):
if self.wndGameButton:
self.wndGameButton.CheckGameButton()
def __OnClickStatusPlusButton(self):
self.ToggleCharacterWindow("STATUS")
def __OnClickSkillPlusButton(self):
self.ToggleCharacterWindow("SKILL")
def __OnClickQuestButton(self):
self.ToggleCharacterWindow("QUEST")
def __OnClickHelpButton(self):
player.SetPlayTime(1)
self.CheckGameButton()
self.OpenHelpWindow()
def __OnClickBuildButton(self):
self.BUILD_OpenWindow()
def OpenHelpWindow(self):
self.wndUICurtain.Show()
self.wndHelp.Open()
def CloseHelpWindow(self):
self.wndUICurtain.Hide()
self.wndHelp.Close()
def OpenWebWindow(self, url):
self.wndWeb.Open(url)
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ä<><C3A4><EFBFBD><EFBFBD> <20>ݴ´<DDB4>
self.wndChat.CloseChat()
# show GIFT
def ShowGift(self):
self.wndTaskBar.ShowGift()
def CloseWbWindow(self):
self.wndWeb.Close()
def OpenCubeWindow(self):
self.wndCube.Open()
if FALSE == self.wndInventory.IsShow():
self.wndInventory.Show()
def UpdateCubeInfo(self, gold, itemVnum, count):
self.wndCube.UpdateInfo(gold, itemVnum, count)
def CloseCubeWindow(self):
self.wndCube.Close()
def FailedCubeWork(self):
self.wndCube.Refresh()
def SucceedCubeWork(self, itemVnum, count):
self.wndCube.Clear()
print "ť<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>! [%d:%d]" % (itemVnum, count)
if 0: # <20><><EFBFBD><EFBFBD> <20>޽<EFBFBD><DEBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
self.wndCubeResult.SetPosition(*self.wndCube.GetGlobalPosition())
self.wndCubeResult.SetCubeResultItem(itemVnum, count)
self.wndCubeResult.Open()
self.wndCubeResult.SetTop()
def __HideWindows(self):
hideWindows = self.wndTaskBar,\
self.wndCharacter,\
self.wndInventory,\
self.wndMiniMap,\
self.wndGuild,\
self.wndMessenger,\
self.wndChat,\
self.wndParty,\
self.wndGameButton,
if self.wndEnergyBar:
hideWindows += self.wndEnergyBar,
if self.wndExpandedTaskBar:
hideWindows += self.wndExpandedTaskBar,
if app.ENABLE_DRAGON_SOUL_SYSTEM:
hideWindows += self.wndDragonSoul,\
self.wndDragonSoulRefine,
hideWindows = filter(lambda x:x.IsShow(), hideWindows)
map(lambda x:x.Hide(), hideWindows)
import sys
self.HideAllQuestButton()
self.HideAllWhisperButton()
if self.wndChat.IsEditMode():
self.wndChat.CloseChat()
return hideWindows
def __ShowWindows(self, wnds):
import sys
map(lambda x:x.Show(), wnds)
global IsQBHide
if not IsQBHide:
self.ShowAllQuestButton()
else:
self.HideAllQuestButton()
self.ShowAllWhisperButton()
def BINARY_OpenAtlasWindow(self):
if self.wndMiniMap:
self.wndMiniMap.ShowAtlas()
def BINARY_SetObserverMode(self, flag):
self.wndGameButton.SetObserverMode(flag)
# ACCESSORY_REFINE_ADD_METIN_STONE
def BINARY_OpenSelectItemWindow(self):
self.wndItemSelect.Open()
# END_OF_ACCESSORY_REFINE_ADD_METIN_STONE
#####################################################################################
### Private Shop ###
def OpenPrivateShopInputNameDialog(self):
#if player.IsInSafeArea():
# chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CANNOT_OPEN_PRIVATE_SHOP_IN_SAFE_AREA)
# return
inputDialog = uiCommon.InputDialog()
inputDialog.SetTitle(locale.PRIVATE_SHOP_INPUT_NAME_DIALOG_TITLE)
inputDialog.SetMaxLength(32)
inputDialog.SetAcceptEvent(ui.__mem_func__(self.OpenPrivateShopBuilder))
inputDialog.SetCancelEvent(ui.__mem_func__(self.ClosePrivateShopInputNameDialog))
inputDialog.Open()
self.inputDialog = inputDialog
def ClosePrivateShopInputNameDialog(self):
self.inputDialog = None
return TRUE
def OpenPrivateShopBuilder(self):
if not self.inputDialog:
return TRUE
if not len(self.inputDialog.GetText()):
return TRUE
self.privateShopBuilder.Open(self.inputDialog.GetText())
self.ClosePrivateShopInputNameDialog()
return TRUE
def AppearPrivateShop(self, vid, text):
board = uiPrivateShopBuilder.PrivateShopAdvertisementBoard()
board.Open(vid, text)
self.privateShopAdvertisementBoardDict[vid] = board
def DisappearPrivateShop(self, vid):
if not self.privateShopAdvertisementBoardDict.has_key(vid):
return
del self.privateShopAdvertisementBoardDict[vid]
uiPrivateShopBuilder.DeleteADBoard(vid)
#####################################################################################
### Equipment ###
def OpenEquipmentDialog(self, vid):
dlg = uiEquipmentDialog.EquipmentDialog()
dlg.SetItemToolTip(self.tooltipItem)
dlg.SetCloseEvent(ui.__mem_func__(self.CloseEquipmentDialog))
dlg.Open(vid)
self.equipmentDialogDict[vid] = dlg
def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
if not vid in self.equipmentDialogDict:
return
self.equipmentDialogDict[vid].SetEquipmentDialogItem(slotIndex, vnum, count)
def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
if not vid in self.equipmentDialogDict:
return
self.equipmentDialogDict[vid].SetEquipmentDialogSocket(slotIndex, socketIndex, value)
def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
if not vid in self.equipmentDialogDict:
return
self.equipmentDialogDict[vid].SetEquipmentDialogAttr(slotIndex, attrIndex, type, value)
def CloseEquipmentDialog(self, vid):
if not vid in self.equipmentDialogDict:
return
del self.equipmentDialogDict[vid]
#####################################################################################
#####################################################################################
### Quest ###
def BINARY_ClearQuest(self, index):
btn = self.__FindQuestButton(index)
if 0 != btn:
self.__DestroyQuestButton(btn)
def RecvQuest(self, index, name):
# QUEST_LETTER_IMAGE
self.BINARY_RecvQuest(index, name, "file", locale.GetLetterImageName())
# END_OF_QUEST_LETTER_IMAGE
def BINARY_RecvQuest(self, index, name, iconType, iconName):
btn = self.__FindQuestButton(index)
if 0 != btn:
self.__DestroyQuestButton(btn)
btn = uiWhisper.WhisperButton()
# QUEST_LETTER_IMAGE
##!! 20061026.levites.<2E><><EFBFBD><EFBFBD>Ʈ_<C6AE>̹<EFBFBD><CCB9><EFBFBD>_<EFBFBD><5F>ü
import item
if "item"==iconType:
item.SelectItem(int(iconName))
buttonImageFileName=item.GetIconImageFileName()
else:
buttonImageFileName=iconName
if locale.IsEUROPE():
if "highlight" == iconType:
btn.SetUpVisual("locale/ymir_ui/highlighted_quest.tga")
btn.SetOverVisual("locale/ymir_ui/highlighted_quest_r.tga")
btn.SetDownVisual("locale/ymir_ui/highlighted_quest_r.tga")
else:
btn.SetUpVisual(locale.GetLetterCloseImageName())
btn.SetOverVisual(locale.GetLetterOpenImageName())
btn.SetDownVisual(locale.GetLetterOpenImageName())
else:
btn.SetUpVisual(buttonImageFileName)
btn.SetOverVisual(buttonImageFileName)
btn.SetDownVisual(buttonImageFileName)
btn.Flash()
# END_OF_QUEST_LETTER_IMAGE
if locale.IsARABIC():
btn.SetToolTipText(name, 0, 35)
btn.ToolTipText.SetHorizontalAlignCenter()
else:
btn.SetToolTipText(name, -20, 35)
btn.ToolTipText.SetHorizontalAlignLeft()
btn.SetEvent(ui.__mem_func__(self.__StartQuest), btn)
btn.Show()
btn.index = index
btn.name = name
self.questButtonList.insert(0, btn)
self.__ArrangeQuestButton()
#chat.AppendChat(chat.CHAT_TYPE_NOTICE, locale.QUEST_APPEND)
def __ArrangeQuestButton(self):
screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
##!! 20061026.levites.<2E><><EFBFBD><EFBFBD>Ʈ_<C6AE><5F>ġ_<C4A1><5F><EFBFBD><EFBFBD>
if self.wndParty.IsShow():
xPos = 100 + 30
else:
xPos = 20
if locale.IsARABIC():
xPos = xPos + 15
yPos = 170 * screenHeight / 600
yCount = (screenHeight - 330) / 63
count = 0
for btn in self.questButtonList:
btn.SetPosition(xPos + (int(count/yCount) * 100), yPos + (count%yCount * 63))
count += 1
global IsQBHide
if IsQBHide:
btn.Hide()
else:
btn.Show()
def __StartQuest(self, btn):
event.QuestButtonClick(btn.index)
self.__DestroyQuestButton(btn)
def __FindQuestButton(self, index):
for btn in self.questButtonList:
if btn.index == index:
return btn
return 0
def __DestroyQuestButton(self, btn):
btn.SetEvent(0)
self.questButtonList.remove(btn)
self.__ArrangeQuestButton()
def HideAllQuestButton(self):
for btn in self.questButtonList:
btn.Hide()
def ShowAllQuestButton(self):
for btn in self.questButtonList:
btn.Show()
#####################################################################################
#####################################################################################
### Whisper ###
def __InitWhisper(self):
chat.InitWhisper(self)
## ä<><C3A4>â<EFBFBD><C3A2> "<22>޽<EFBFBD><DEBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȭâ<C8AD><C3A2> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD>
## <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WhisperDialogDict <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>.
def OpenWhisperDialogWithoutTarget(self):
if not self.dlgWhisperWithoutTarget:
dlgWhisper = uiWhisper.WhisperDialog(self.MinimizeWhisperDialog, self.CloseWhisperDialog)
dlgWhisper.BindInterface(self)
dlgWhisper.LoadDialog()
dlgWhisper.OpenWithoutTarget(self.RegisterTemporaryWhisperDialog)
dlgWhisper.SetPosition(self.windowOpenPosition*30,self.windowOpenPosition*30)
dlgWhisper.Show()
self.dlgWhisperWithoutTarget = dlgWhisper
self.windowOpenPosition = (self.windowOpenPosition+1) % 5
else:
self.dlgWhisperWithoutTarget.SetTop()
self.dlgWhisperWithoutTarget.OpenWithoutTarget(self.RegisterTemporaryWhisperDialog)
## <20≯<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȭâ<C8AD><C3A2><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WhisperDialogDict<63><74> â<><C3A2> <20>־<EFBFBD><D6BE>ִ<EFBFBD> <20>Լ<EFBFBD>
def RegisterTemporaryWhisperDialog(self, name):
if not self.dlgWhisperWithoutTarget:
return
btn = self.__FindWhisperButton(name)
if 0 != btn:
self.__DestroyWhisperButton(btn)
elif self.whisperDialogDict.has_key(name):
oldDialog = self.whisperDialogDict[name]
oldDialog.Destroy()
del self.whisperDialogDict[name]
self.whisperDialogDict[name] = self.dlgWhisperWithoutTarget
self.dlgWhisperWithoutTarget.OpenWithTarget(name)
self.dlgWhisperWithoutTarget = None
self.__CheckGameMaster(name)
## ij<><C4B3><EFBFBD><EFBFBD> <20>޴<EFBFBD><DEB4><EFBFBD> 1:1 <20><>ȭ <20>ϱ<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٷ<EFBFBD> â<><C3A2> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD>
def OpenWhisperDialog(self, name):
if not self.whisperDialogDict.has_key(name):
dlg = self.__MakeWhisperDialog(name)
dlg.OpenWithTarget(name)
dlg.chatLine.SetFocus()
dlg.Show()
self.__CheckGameMaster(name)
btn = self.__FindWhisperButton(name)
if 0 != btn:
self.__DestroyWhisperButton(btn)
## <20>ٸ<EFBFBD> ij<><C4B3><EFBFBD>ͷκ<CDB7><CEBA><EFBFBD> <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20>޾<EFBFBD><DEBE><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20><>ư<EFBFBD><C6B0> <20><><EFBFBD><EFBFBD> <20>δ<EFBFBD> <20>Լ<EFBFBD>
def RecvWhisper(self, name):
if not self.whisperDialogDict.has_key(name):
btn = self.__FindWhisperButton(name)
if 0 == btn:
btn = self.__MakeWhisperButton(name)
btn.Flash()
chat.AppendChat(chat.CHAT_TYPE_NOTICE, locale.RECEIVE_MESSAGE % (name))
else:
btn.Flash()
elif self.IsGameMasterName(name):
dlg = self.whisperDialogDict[name]
dlg.SetGameMasterLook()
def MakeWhisperButton(self, name):
self.__MakeWhisperButton(name)
## <20><>ư<EFBFBD><C6B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> â<><C3A2> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD>
def ShowWhisperDialog(self, btn):
try:
self.__MakeWhisperDialog(btn.name)
dlgWhisper = self.whisperDialogDict[btn.name]
dlgWhisper.OpenWithTarget(btn.name)
dlgWhisper.Show()
self.__CheckGameMaster(btn.name)
except:
import dbg
dbg.TraceError("interface.ShowWhisperDialog - Failed to find key")
## <20><>ư <20>ʱ<EFBFBD>ȭ
self.__DestroyWhisperButton(btn)
## WhisperDialog â<><C3A2><EFBFBD><EFBFBD> <20>ּ<EFBFBD>ȭ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD>Ǵ<EFBFBD> <20>Լ<EFBFBD>
## â<><C3A2> <20>ּ<EFBFBD>ȭ <20>մϴ<D5B4>.
def MinimizeWhisperDialog(self, name):
if 0 != name:
self.__MakeWhisperButton(name)
self.CloseWhisperDialog(name)
## WhisperDialog â<><C3A2><EFBFBD><EFBFBD> <20>ݱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD>Ǵ<EFBFBD> <20>Լ<EFBFBD>
## â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
def CloseWhisperDialog(self, name):
if 0 == name:
if self.dlgWhisperWithoutTarget:
self.dlgWhisperWithoutTarget.Destroy()
self.dlgWhisperWithoutTarget = None
return
try:
dlgWhisper = self.whisperDialogDict[name]
dlgWhisper.Destroy()
del self.whisperDialogDict[name]
except:
import dbg
dbg.TraceError("interface.CloseWhisperDialog - Failed to find key")
## <20><>ư<EFBFBD><C6B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD><D9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ư<EFBFBD><C6B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20>Լ<EFBFBD>
def __ArrangeWhisperButton(self):
screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
xPos = screenWidth - 70
yPos = 170 * screenHeight / 600
yCount = (screenHeight - 330) / 63
#yCount = (screenHeight - 285) / 63
count = 0
for button in self.whisperButtonList:
button.SetPosition(xPos + (int(count/yCount) * -50), yPos + (count%yCount * 63))
count += 1
## <20≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> Whisper <20><>ư<EFBFBD><C6B0> ã<><C3A3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20>Լ<EFBFBD>
## <20><>ư<EFBFBD><C6B0> <20><><EFBFBD>ųʸ<C5B3><CAB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
## <20>̷<EFBFBD> <20><><EFBFBD><EFBFBD> ToolTip<69><70><EFBFBD><EFBFBD> <20>ٸ<EFBFBD> <20><>ư<EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>.
def __FindWhisperButton(self, name):
for button in self.whisperButtonList:
if button.name == name:
return button
return 0
## â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
def __MakeWhisperDialog(self, name):
dlgWhisper = uiWhisper.WhisperDialog(self.MinimizeWhisperDialog, self.CloseWhisperDialog)
dlgWhisper.BindInterface(self)
dlgWhisper.LoadDialog()
dlgWhisper.SetPosition(self.windowOpenPosition*30,self.windowOpenPosition*30)
self.whisperDialogDict[name] = dlgWhisper
self.windowOpenPosition = (self.windowOpenPosition+1) % 5
return dlgWhisper
## <20><>ư<EFBFBD><C6B0> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
def __MakeWhisperButton(self, name):
whisperButton = uiWhisper.WhisperButton()
whisperButton.SetUpVisual("d:/ymir work/ui/game/windows/btn_mail_up.sub")
whisperButton.SetOverVisual("d:/ymir work/ui/game/windows/btn_mail_up.sub")
whisperButton.SetDownVisual("d:/ymir work/ui/game/windows/btn_mail_up.sub")
if self.IsGameMasterName(name):
whisperButton.SetToolTipTextWithColor(name, 0xffffa200)
else:
whisperButton.SetToolTipText(name)
whisperButton.ToolTipText.SetHorizontalAlignCenter()
whisperButton.SetEvent(ui.__mem_func__(self.ShowWhisperDialog), whisperButton)
whisperButton.Show()
whisperButton.name = name
self.whisperButtonList.insert(0, whisperButton)
self.__ArrangeWhisperButton()
return whisperButton
def __DestroyWhisperButton(self, button):
button.SetEvent(0)
self.whisperButtonList.remove(button)
self.__ArrangeWhisperButton()
def HideAllWhisperButton(self):
for btn in self.whisperButtonList:
btn.Hide()
def ShowAllWhisperButton(self):
for btn in self.whisperButtonList:
btn.Show()
def __CheckGameMaster(self, name):
if not self.listGMName.has_key(name):
return
if self.whisperDialogDict.has_key(name):
dlg = self.whisperDialogDict[name]
dlg.SetGameMasterLook()
def RegisterGameMasterName(self, name):
if self.listGMName.has_key(name):
return
self.listGMName[name] = "GM"
def IsGameMasterName(self, name):
if self.listGMName.has_key(name):
return TRUE
else:
return FALSE
#####################################################################################
#####################################################################################
### Guild Building ###
def BUILD_OpenWindow(self):
self.wndGuildBuilding = uiGuild.BuildGuildBuildingWindow()
self.wndGuildBuilding.Open()
self.wndGuildBuilding.wnds = self.__HideWindows()
self.wndGuildBuilding.SetCloseEvent(ui.__mem_func__(self.BUILD_CloseWindow))
def BUILD_CloseWindow(self):
self.__ShowWindows(self.wndGuildBuilding.wnds)
self.wndGuildBuilding = None
def BUILD_OnUpdate(self):
if not self.wndGuildBuilding:
return
if self.wndGuildBuilding.IsPositioningMode():
import background
x, y, z = background.GetPickingPoint()
self.wndGuildBuilding.SetBuildingPosition(x, y, z)
def BUILD_OnMouseLeftButtonDown(self):
if not self.wndGuildBuilding:
return
# GUILD_BUILDING
if self.wndGuildBuilding.IsPositioningMode():
self.wndGuildBuilding.SettleCurrentPosition()
return TRUE
elif self.wndGuildBuilding.IsPreviewMode():
pass
else:
return TRUE
# END_OF_GUILD_BUILDING
return FALSE
def BUILD_OnMouseLeftButtonUp(self):
if not self.wndGuildBuilding:
return
if not self.wndGuildBuilding.IsPreviewMode():
return TRUE
return FALSE
def BULID_EnterGuildArea(self, areaID):
# GUILD_BUILDING
mainCharacterName = player.GetMainCharacterName()
masterName = guild.GetGuildMasterName()
if mainCharacterName != masterName:
return
if areaID != player.GetGuildID():
return
# END_OF_GUILD_BUILDING
self.wndGameButton.ShowBuildButton()
def BULID_ExitGuildArea(self, areaID):
self.wndGameButton.HideBuildButton()
#####################################################################################
def IsEditLineFocus(self):
if self.ChatWindow.chatLine.IsFocus():
return 1
if self.ChatWindow.chatToLine.IsFocus():
return 1
return 0
def EmptyFunction(self):
pass
if __name__ == "__main__":
import app
import wndMgr
import systemSetting
import mouseModule
import grp
import ui
import locale
app.SetMouseHandler(mouseModule.mouseController)
app.SetHairColorEnable(TRUE)
wndMgr.SetMouseHandler(mouseModule.mouseController)
wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight())
app.Create(locale.APP_TITLE, systemSetting.GetWidth(), systemSetting.GetHeight(), 1)
mouseModule.mouseController.Create()
class TestGame(ui.Window):
def __init__(self):
ui.Window.__init__(self)
locale.LoadLocaleData()
player.SetItemData(0, 27001, 10)
player.SetItemData(1, 27004, 10)
self.interface = Interface()
self.interface.MakeInterface()
self.interface.ShowDefaultWindows()
self.interface.RefreshInventory()
#self.interface.OpenCubeWindow()
def __del__(self):
ui.Window.__del__(self)
def OnUpdate(self):
app.UpdateGame()
def OnRender(self):
app.RenderGame()
grp.PopState()
grp.SetInterfaceRenderState()
game = TestGame()
game.SetSize(systemSetting.GetWidth(), systemSetting.GetHeight())
game.Show()
app.Loop()