Problema Chat

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Avatar utilizator
KriTecK
Fost Helper

Fost Helper
Mesaje: 520
Membru din: 28 Iul 2013, 11:05
Aprecieri: 9  
Mulţumiri: 11  
 Contact:
Medalii

Salut. Am o problema si ar trebuii sa o rezolv urgent.. Daca ma poate ajuta cineva...

Am bagat chat universal pe serverul meu. (2098M) si merge chat-ul dar problema e alta. Nu pot scrie pe grup sau breasla.

Am facut cum a zis baiatu asta la tutorial

Salut despachetezi root -> mergi in uichat.py .. folosind combinatia de tastre CTRL+f , cauti randul urmator
COD: SELECTAŢI TOT
def __SendChatPacket(self, text, type):
, il stergi intri pe link-ul acesta
COD: SELECTAŢI TOT


si inlocuiesti cu ce scrie acolo.

Bafta 100% merge, daca aplici si diff nu o sa iti ceara sticla precipitati !!

Ps:
Daca ai game 2089 foloseste astea 2 diffuri
COD: SELECTAŢI TOT
000E7C8D: 0F E9
000E7C8E: 84 01
000E7C8F: A4 00
000E7D51: 97 00
000E7D52: 51 00
000E7D53: 0E 00
000ED2FB: 74 EB

si
COD: SELECTAŢI TOT
000E29AC: E8 90
000E29AD: 0F 90
000E29AE: 72 90
000E29AF: F6 90
000E29B0: FF 90
000E29D0: 89 90
000E29D1: 54 90
000E29D2: 24 90
000E29D3: 08 90
000E29D4: C7 90
000E29D5: 44 90
000E29D6: 24 90
000E29D7: 04 90
000E29D8: C9 90
000E29D9: 15 90
000E29DA: 01 90
000E29DB: 00 90
000E29DC: 89 90
000E29DD: 1C 90
000E29DE: 24 90
000E29DF: E8 90
000E29E0: FC 90
000E29E1: 9C 90
000E29E2: F6 90
000E29E3: FF 90

Daca ma poate ajuta cineva ii raman dator vandut..
Avatar utilizator
Marggraf
Utilizator interzis !

Utilizator interzis !
Mesaje: 1074
Membru din: 25 Mai 2014, 12:46
Server: loading...
Regat: Shinsoo
Aprecieri: 36  
Mulţumiri: 36  
Medalii

posteaza uichat.py aici si te rezolv eu
Imagine
Imagine
Afișează semnătura
Avatar utilizator
KriTecK
Fost Helper

Fost Helper
Mesaje: 520
Membru din: 28 Iul 2013, 11:05
Aprecieri: 9  
Mulţumiri: 11  
 Contact:
Medalii

Uichar.py

import ui
import grp
import chat
import wndMgr
import net
import app
import ime
import locale
import colorInfo
import constInfo
import systemSetting
import player

ENABLE_CHAT_COMMAND = TRUE
ENABLE_LAST_SENTENCE_STACK = TRUE
ENABLE_INSULT_CHECK = TRUE

if locale.IsHONGKONG():
ENABLE_LAST_SENTENCE_STACK = TRUE

if locale.IsEUROPE():
ENABLE_CHAT_COMMAND = FALSE

if locale.IsCANADA():
ENABLE_LAST_SENTENCE_STACK = FALSE

chatInputSetList = []
def InsertChatInputSetWindow(wnd):
global chatInputSetList
chatInputSetList.append(wnd)
def RefreshChatMode():
global chatInputSetList
map(lambda wnd:wnd.OnRefreshChatMode(), chatInputSetList)
def DestroyChatInputSetWindow():
global chatInputSetList
chatInputSetList = []

## ChatModeButton
class ChatModeButton(ui.Window):

OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)
OVER_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 0.3)
BUTTON_STATE_UP = 0
BUTTON_STATE_OVER = 1
BUTTON_STATE_DOWN = 2

def __init__(self):
ui.Window.__init__(self)
self.state = None
self.buttonText = None
self.event = None

net.EnableChatInsultFilter(ENABLE_INSULT_CHECK)

def __del__(self):
ui.Window.__del__(self)

def SAFE_SetEvent(self, event):
self.event=ui.__mem_func__(event)

def SetText(self, text):
if None == self.buttonText:
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetWindowHorizontalAlignCenter()
textLine.SetWindowVerticalAlignCenter()
textLine.SetVerticalAlignCenter()
textLine.SetHorizontalAlignCenter()
textLine.SetPackedFontColor(self.OUTLINE_COLOR)
textLine.Show()
self.buttonText = textLine

self.buttonText.SetText(text)

def SetSize(self, width, height):
self.width = width
self.height = height
ui.Window.SetSize(self, width, height)

def OnMouseOverIn(self):
self.state = self.BUTTON_STATE_OVER

def OnMouseOverOut(self):
self.state = self.BUTTON_STATE_UP

def OnMouseLeftButtonDown(self):
self.state = self.BUTTON_STATE_DOWN

def OnMouseLeftButtonUp(self):
self.state = self.BUTTON_STATE_UP
if self.IsIn():
self.state = self.BUTTON_STATE_OVER

if None != self.event:
self.event()

def OnRender(self):

(x, y) = self.GetGlobalPosition()

grp.SetColor(self.OUTLINE_COLOR)
grp.RenderRoundBox(x, y, self.width, self.height)

if self.state >= self.BUTTON_STATE_OVER:
grp.RenderRoundBox(x+1, y, self.width-2, self.height)
grp.RenderRoundBox(x, y+1, self.width, self.height-2)

if self.BUTTON_STATE_DOWN == self.state:
grp.SetColor(self.OVER_COLOR)
grp.RenderBar(x+1, y+1, self.width-2, self.height-2)

## ChatLine
class ChatLine(ui.EditLine):

CHAT_MODE_NAME = { chat.CHAT_TYPE_TALKING : locale.CHAT_NORMAL,
chat.CHAT_TYPE_PARTY : locale.CHAT_PARTY,
chat.CHAT_TYPE_GUILD : locale.CHAT_GUILD,
chat.CHAT_TYPE_SHOUT : locale.CHAT_SHOUT, }

def __init__(self):
ui.EditLine.__init__(self)
self.SetWindowName("Chat Line")
self.lastShoutTime = 0
self.eventEscape = lambda *arg: None
self.eventReturn = lambda *arg: None
self.eventTab = None
self.chatMode = chat.CHAT_TYPE_TALKING
self.bCodePage = TRUE

self.overTextLine = ui.TextLine()
self.overTextLine.SetParent(self)
self.overTextLine.SetPosition(-1, 0)
self.overTextLine.SetFontColor(1.0, 1.0, 0.0)
self.overTextLine.SetOutline()
self.overTextLine.Hide()

self.lastSentenceStack = []
self.lastSentencePos = 0

def SetChatMode(self, mode):
self.chatMode = mode

def GetChatMode(self):
return self.chatMode

def ChangeChatMode(self):
if chat.CHAT_TYPE_TALKING == self.GetChatMode():
self.SetChatMode(chat.CHAT_TYPE_PARTY)
self.SetText("#")
self.SetEndPosition()

elif chat.CHAT_TYPE_PARTY == self.GetChatMode():
self.SetChatMode(chat.CHAT_TYPE_GUILD)
self.SetText("%")
self.SetEndPosition()

elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
self.SetChatMode(chat.CHAT_TYPE_SHOUT)
self.SetText("!")
self.SetEndPosition()

elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
self.SetChatMode(chat.CHAT_TYPE_TALKING)
self.SetText("")

self.__CheckChatMark()

def GetCurrentChatModeName(self):
try:
return self.CHAT_MODE_NAME[self.chatMode]
except:
import exception
exception.Abort("ChatLine.GetCurrentChatModeName")

def SAFE_SetEscapeEvent(self, event):
self.eventReturn = ui.__mem_func__(event)

def SAFE_SetReturnEvent(self, event):
self.eventEscape = ui.__mem_func__(event)

def SAFE_SetTabEvent(self, event):
self.eventTab = ui.__mem_func__(event)

def SetTabEvent(self, event):
self.eventTab = event

def OpenChat(self):
self.SetFocus()
self.__ResetChat()

def __ClearChat(self):
self.SetText("")
self.lastSentencePos = 0

def __ResetChat(self):
if chat.CHAT_TYPE_PARTY == self.GetChatMode():
self.SetText("#")
self.SetEndPosition()
elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
self.SetText("%")
self.SetEndPosition()
elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
self.SetText("!")
self.SetEndPosition()
else:
self.__ClearChat()

self.__CheckChatMark()


def __SendChatPacket(self, text, type):
if net.IsChatInsultIn(text):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)
else:
name = player.GetName()
if type == chat.CHAT_TYPE_SHOUT:
if name.find("[") !=-1:
empire_id = "|cffffc700|H|h[Staff]|cFFA7FFD4|H|h"
else:
empire_id = str(net.GetEmpireID())
if empire_id == "1":
empire_id = "|cFFFF0000|H|h[Sinshoo]|cFFA7FFD4|H|h"
elif empire_id == "2":
empire_id = "|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h"
elif empire_id == "3":
empire_id = "|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"

text = empire_id + text

# if text[0] == '/':
# if ENABLE_CHAT_COMMAND or constInfo.CONSOLE_ENABLE:
# pass
# else:
# return

if net.IsChatInsultIn(text):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)
else:
net.SendChatPacket(text, type)

def __SendShoutChatPacket(self, text):

if 1 == len(text):
self.RunCloseEvent()
return

if app.GetTime() < self.lastShoutTime + 15:
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_SHOUT_LIMIT)
self.__ResetChat()
return

self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT)
self.__ResetChat()

self.lastShoutTime = app.GetTime()

def __SendTalkingChatPacket(self, text):
if text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and text[2] == ' ':
newtext = text.split(' ', 1)
net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
self.__ResetChat()
elif text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and (text[2] == 'o' or text[2] == 'O') and (text[3] == 't' or text[3] == 'T') and (text[4] == 'i' or text[4] == 'I') and (text[5] == 'c' or text[5] == 'C') and (text[6] == 'e' or text[6] == 'E') and text[7] == ' ':
newtext = text.split(' ', 1)
net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
self.__ResetChat()
else:
self.__SendChatPacket(text, chat.CHAT_TYPE_TALKING)
self.__ResetChat()

def OnIMETab(self):
#if None != self.eventTab:
# self.eventTab()
#return TRUE
return FALSE

def OnIMEUpdate(self):
ui.EditLine.OnIMEUpdate(self)
self.__CheckChatMark()

def __CheckChatMark(self):

self.overTextLine.Hide()

text = self.GetText()
if len(text) > 0:
if '#' == text[0]:
self.overTextLine.SetText("#")
self.overTextLine.Show()
elif '%' == text[0]:
self.overTextLine.SetText("%")
self.overTextLine.Show()
elif '!' == text[0]:
self.overTextLine.SetText("!")
self.overTextLine.Show()

def OnIMEKeyDown(self, key):
# LAST_SENTENCE_STACK
if app.VK_UP == key:
self.__PrevLastSentenceStack()
return TRUE

if app.VK_DOWN == key:
self.__NextLastSentenceStack()
return TRUE
# END_OF_LAST_SENTENCE_STACK

ui.EditLine.OnIMEKeyDown(self, key)

# LAST_SENTENCE_STACK
def __PrevLastSentenceStack(self):
global ENABLE_LAST_SENTENCE_STACK
if not ENABLE_LAST_SENTENCE_STACK:
return

if self.lastSentenceStack and self.lastSentencePos < len(self.lastSentenceStack):
self.lastSentencePos += 1
lastSentence = self.lastSentenceStack[-self.lastSentencePos]
self.SetText(lastSentence)
self.SetEndPosition()

def __NextLastSentenceStack(self):
global ENABLE_LAST_SENTENCE_STACK
if not ENABLE_LAST_SENTENCE_STACK:
return

if self.lastSentenceStack and self.lastSentencePos > 1:
self.lastSentencePos -= 1
lastSentence = self.lastSentenceStack[-self.lastSentencePos]
self.SetText(lastSentence)
self.SetEndPosition()

def __PushLastSentenceStack(self, text):
global ENABLE_LAST_SENTENCE_STACK
if not ENABLE_LAST_SENTENCE_STACK:
return

if len(text) <= 0:
return

LAST_SENTENCE_STACK_SIZE = 32
if len(self.lastSentenceStack) > LAST_SENTENCE_STACK_SIZE:
self.lastSentenceStack.pop(0)

self.lastSentenceStack.append(text)
# END_OF_LAST_SENTENCE_STACK

def OnIMEReturn(self):
text = self.GetText()
textLen=len(text)

# LAST_SENTENCE_STACK
self.__PushLastSentenceStack(text)
# END_OF_LAST_SENTENCE_STACK

textSpaceCount=text.count(' ')

if (textLen > 0) and (textLen != textSpaceCount):
if '#' == text[0]:
self.__SendPartyChatPacket(text)
elif '%' == text[0]:
self.__SendGuildChatPacket(text)
elif '!' == text[0]:
self.__SendShoutChatPacket(text)
else:
self.__SendTalkingChatPacket(text)
else:
self.__ClearChat()
self.eventReturn()

return TRUE

def OnPressEscapeKey(self):
self.__ClearChat()
self.eventEscape()
return TRUE

def RunCloseEvent(self):
self.eventEscape()

def BindInterface(self, interface):
self.interface = interface

def OnMouseLeftButtonDown(self):
hyperlink = ui.GetHyperlink()
if hyperlink:
if app.IsPressed(app.DIK_LALT):
link = chat.GetLinkFromHyperlink(hyperlink)
ime.PasteString(link)
else:
self.interface.MakeHyperlinkTooltip(hyperlink)
else:
ui.EditLine.OnMouseLeftButtonDown(self)

class ChatInputSet(ui.Window):

CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

def __init__(self):
ui.Window.__init__(self)

InsertChatInputSetWindow(self)
self.__Create()

def __del__(self):
ui.Window.__del__(self)

def __Create(self):
chatModeButton = ChatModeButton()
chatModeButton.SetParent(self)
chatModeButton.SetSize(40, 17)
chatModeButton.SetText(locale.CHAT_NORMAL)
chatModeButton.SetPosition(7, 2)
chatModeButton.SAFE_SetEvent(self.OnChangeChatMode)
self.chatModeButton = chatModeButton

chatLine = ChatLine()
chatLine.SetParent(self)
chatLine.SetMax(512)
chatLine.SetUserMax(76)
chatLine.SetText("")
chatLine.SAFE_SetTabEvent(self.OnChangeChatMode)
chatLine.x = 0
chatLine.y = 0
chatLine.width = 0
chatLine.height = 0
self.chatLine = chatLine

btnSend = ui.Button()
btnSend.SetParent(self)
btnSend.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_01.sub")
btnSend.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_02.sub")
btnSend.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_03.sub")
btnSend.SetToolTipText(locale.CHAT_SEND_CHAT)
btnSend.SAFE_SetEvent(self.chatLine.OnIMEReturn)
self.btnSend = btnSend

def Destroy(self):
self.chatModeButton = None
self.chatLine = None
self.btnSend = None

def Open(self):
self.chatLine.Show()
self.chatLine.SetPosition(57, 5)
self.chatLine.SetFocus()
self.chatLine.OpenChat()

self.chatModeButton.SetPosition(7, 2)
self.chatModeButton.Show()

self.btnSend.Show()
self.Show()

self.RefreshPosition()
return TRUE

def Close(self):
self.chatLine.KillFocus()
self.chatLine.Hide()
self.chatModeButton.Hide()
self.btnSend.Hide()
self.Hide()
return TRUE

def SetEscapeEvent(self, event):
self.chatLine.SetEscapeEvent(event)

def SetReturnEvent(self, event):
self.chatLine.SetReturnEvent(event)

def OnChangeChatMode(self):
RefreshChatMode()

def OnRefreshChatMode(self):
self.chatLine.ChangeChatMode()
self.chatModeButton.SetText(self.chatLine.GetCurrentChatModeName())

def SetChatFocus(self):
self.chatLine.SetFocus()

def KillChatFocus(self):
self.chatLine.KillFocus()

def SetChatMax(self, max):
self.chatLine.SetUserMax(max)

def RefreshPosition(self):
if locale.IsARABIC():
self.chatLine.SetSize(self.GetWidth() - 93, 18)
else:
self.chatLine.SetSize(self.GetWidth() - 93, 13)

self.btnSend.SetPosition(self.GetWidth() - 25, 2)

(self.chatLine.x, self.chatLine.y, self.chatLine.width, self.chatLine.height) = self.chatLine.GetRect()

def BindInterface(self, interface):
self.chatLine.BindInterface(interface)

def OnRender(self):
(x, y, width, height) = self.chatLine.GetRect()
ui.RenderRoundBox(x-4, y-3, width+7, height+4, self.CHAT_OUTLINE_COLOR)

## ChatWindow
class ChatWindow(ui.Window):

BOARD_START_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.0)
BOARD_END_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.8)
BOARD_MIDDLE_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.5)
CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

EDIT_LINE_HEIGHT = 25

class ChatBackBoard(ui.Window):
def __init__(self):
ui.Window.__init__(self)
def __del__(self):
ui.Window.__del__(self)

class ChatButton(ui.DragButton):

def __init__(self):
ui.DragButton.__init__(self)
self.AddFlag("float")
self.AddFlag("movable")
self.AddFlag("restrict_x")
self.topFlag = FALSE

def __del__(self):
ui.DragButton.__del__(self)

def SetOwner(self, owner):
self.owner = owner

def OnMouseOverIn(self):
app.SetCursor(app.VSIZE)

def OnMouseOverOut(self):
app.SetCursor(app.NORMAL)

def OnTop(self):
if TRUE == self.topFlag:
return

self.topFlag = TRUE
self.owner.SetTop()
self.topFlag = FALSE

def __init__(self):
ui.Window.__init__(self)
self.AddFlag("float")

self.__RegisterChatColorDict()

self.boardState = chat.BOARD_STATE_VIEW
self.chatID = chat.CreateChatSet(chat.CHAT_SET_CHAT_WINDOW)
chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)

self.xBar = 0
self.yBar = 0
self.widthBar = 0
self.heightBar = 0
self.curHeightBar = 0
self.visibleLineCount = 0
self.scrollBarPos = 1.0
self.scrollLock = FALSE

chatInputSet = ChatInputSet()
chatInputSet.SetParent(self)
chatInputSet.SetEscapeEvent(ui.__mem_func__(self.CloseChat))
chatInputSet.SetReturnEvent(ui.__mem_func__(self.CloseChat))
chatInputSet.SetSize(550, 25)
self.chatInputSet = chatInputSet

btnSendWhisper = ui.Button()
btnSendWhisper.SetParent(self)
btnSendWhisper.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_01.sub")
btnSendWhisper.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_02.sub")
btnSendWhisper.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_03.sub")
btnSendWhisper.SetToolTipText(locale.CHAT_SEND_MEMO)
btnSendWhisper.Hide()
self.btnSendWhisper = btnSendWhisper

btnChatLog = ui.Button()
btnChatLog.SetParent(self)
btnChatLog.SetUpVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_01.sub")
btnChatLog.SetOverVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_02.sub")
btnChatLog.SetDownVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_03.sub")
btnChatLog.SetToolTipText(locale.CHAT_LOG)
btnChatLog.Hide()
self.btnChatLog = btnChatLog

btnChatSizing = self.ChatButton()
btnChatSizing.SetOwner(self)
btnChatSizing.SetMoveEvent(ui.__mem_func__(self.Refresh))
btnChatSizing.Hide()
self.btnChatSizing = btnChatSizing

imgChatBarLeft = ui.ImageBox()
imgChatBarLeft.SetParent(self.btnChatSizing)
imgChatBarLeft.AddFlag("not_pick")
imgChatBarLeft.LoadImage("d:/ymir work/ui/pattern/chat_bar_left.tga")
imgChatBarLeft.Show()
self.imgChatBarLeft = imgChatBarLeft
imgChatBarRight = ui.ImageBox()
imgChatBarRight.SetParent(self.btnChatSizing)
imgChatBarRight.AddFlag("not_pick")
imgChatBarRight.LoadImage("d:/ymir work/ui/pattern/chat_bar_right.tga")
imgChatBarRight.Show()
self.imgChatBarRight = imgChatBarRight
imgChatBarMiddle = ui.ExpandedImageBox()
imgChatBarMiddle.SetParent(self.btnChatSizing)
imgChatBarMiddle.AddFlag("not_pick")
imgChatBarMiddle.LoadImage("d:/ymir work/ui/pattern/chat_bar_middle.tga")
imgChatBarMiddle.Show()
self.imgChatBarMiddle = imgChatBarMiddle

scrollBar = ui.ScrollBar()
scrollBar.AddFlag("float")
scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
self.scrollBar = scrollBar

self.Refresh()
self.chatInputSet.RefreshPosition() # RTL 시 위치를 제대로 잡으려면 위치 갱신이 필요하다

def __del__(self):
ui.Window.__del__(self)

def __RegisterChatColorDict(self):
CHAT_COLOR_DICT = {
chat.CHAT_TYPE_TALKING : colorInfo.CHAT_RGB_TALK,
chat.CHAT_TYPE_INFO : colorInfo.CHAT_RGB_INFO,
chat.CHAT_TYPE_NOTICE : colorInfo.CHAT_RGB_NOTICE,
chat.CHAT_TYPE_PARTY : colorInfo.CHAT_RGB_PARTY,
chat.CHAT_TYPE_GUILD : colorInfo.CHAT_RGB_GUILD,
chat.CHAT_TYPE_COMMAND : colorInfo.CHAT_RGB_COMMAND,
chat.CHAT_TYPE_SHOUT : colorInfo.CHAT_RGB_SHOUT,
chat.CHAT_TYPE_WHISPER : colorInfo.CHAT_RGB_WHISPER,
}

for colorItem in CHAT_COLOR_DICT.items():
type=colorItem[0]
rgb=colorItem[1]
chat.SetChatColor(type, rgb[0], rgb[1], rgb[2])

def Destroy(self):
self.chatInputSet.Destroy()
self.chatInputSet = None

self.btnSendWhisper = 0
self.btnChatLog = 0
self.btnChatSizing = 0

################
## Open & Close
def OpenChat(self):
chat.SetBoardState(self.chatID, chat.BOARD_STATE_EDIT)
self.boardState = chat.BOARD_STATE_EDIT

(x, y, width, height) = self.GetRect()
(btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

if locale.IsARABIC():
chat.SetPosition(self.chatID, x + width - 10, y)
else:
chat.SetPosition(self.chatID, x + 10, y)

chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

if self.IsShow():
self.btnChatSizing.Show()

self.Refresh()

self.btnSendWhisper.SetPosition(self.GetWidth() - 50, 2)
self.btnSendWhisper.Show()

self.btnChatLog.SetPosition(self.GetWidth() - 25, 2)
self.btnChatLog.Show()

self.chatInputSet.Open()
self.SetTop()

def CloseChat(self):
chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)
self.boardState = chat.BOARD_STATE_VIEW

(x, y, width, height) = self.GetRect()

if locale.IsARABIC():
chat.SetPosition(self.chatID, x + width - 10, y + height)
else:
chat.SetPosition(self.chatID, x + 10, y + height)

self.chatInputSet.Close()
self.btnSendWhisper.Hide()
self.btnChatLog.Hide()
self.btnChatSizing.Hide()
self.Refresh()

def SetSendWhisperEvent(self, event):
self.btnSendWhisper.SetEvent(event)

def SetOpenChatLogEvent(self, event):
self.btnChatLog.SetEvent(event)

def IsEditMode(self):
if chat.BOARD_STATE_EDIT == self.boardState:
return TRUE

return FALSE

def __RefreshSizingBar(self):
(x, y, width, height) = self.GetRect()
gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
self.btnChatSizing.SetPosition(x, gyChat)
self.btnChatSizing.SetSize(width, 22)
self.imgChatBarLeft.SetPosition(0, 0)
self.imgChatBarRight.SetPosition(width - 64, 0)
self.imgChatBarMiddle.SetPosition(64, 0)
self.imgChatBarMiddle.SetRenderingRect(0.0, 0.0, float(width - 128) / 64.0 - 1.0, 0.0)

def SetPosition(self, x, y):
ui.Window.SetPosition(self, x, y)
self.__RefreshSizingBar()

def SetSize(self, width, height):
ui.Window.SetSize(self, width, height)
self.__RefreshSizingBar()

def SetHeight(self, height):
gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
self.btnChatSizing.SetPosition(gxChat, wndMgr.GetScreenHeight() - height)

###########
## Refresh
def Refresh(self):
if self.boardState == chat.BOARD_STATE_EDIT:
self.RefreshBoardEditState()
elif self.boardState == chat.BOARD_STATE_VIEW:
self.RefreshBoardViewState()

def RefreshBoardEditState(self):

(x, y, width, height) = self.GetRect()
(btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

self.xBar = x
self.yBar = btnY
self.widthBar = width
self.heightBar = y - btnY + self.EDIT_LINE_HEIGHT
self.curHeightBar = self.heightBar

if locale.IsARABIC():
chat.SetPosition(self.chatID, x + width - 10, y)
else:
chat.SetPosition(self.chatID, x + 10, y)

chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT)
chat.ArrangeShowingChat(self.chatID)

if btnY > y:
self.btnChatSizing.SetPosition(btnX, y)
self.heightBar = self.EDIT_LINE_HEIGHT

def RefreshBoardViewState(self):
(x, y, width, height) = self.GetRect()
(btnX, btnY) = self.btnChatSizing.GetGlobalPosition()
textAreaHeight = self.visibleLineCount * chat.GetLineStep(self.chatID)

if locale.IsARABIC():
chat.SetPosition(self.chatID, x + width - 10, y + height)
else:
chat.SetPosition(self.chatID, x + 10, y + height)

chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

if self.boardState == chat.BOARD_STATE_EDIT:
textAreaHeight += 45
elif self.visibleLineCount != 0:
textAreaHeight += 10 + 10

self.xBar = x
self.yBar = y + height - textAreaHeight
self.widthBar = width
self.heightBar = textAreaHeight

self.scrollBar.Hide()

##########
## Render
def OnUpdate(self):
if self.boardState == chat.BOARD_STATE_EDIT:
chat.Update(self.chatID)
elif self.boardState == chat.BOARD_STATE_VIEW:
if systemSetting.IsViewChat():
chat.Update(self.chatID)

def OnRender(self):
if chat.GetVisibleLineCount(self.chatID) != self.visibleLineCount:
self.visibleLineCount = chat.GetVisibleLineCount(self.chatID)
self.Refresh()

if self.curHeightBar != self.heightBar:
self.curHeightBar += (self.heightBar - self.curHeightBar) / 10

if self.boardState == chat.BOARD_STATE_EDIT:
grp.SetColor(self.BOARD_MIDDLE_COLOR)
grp.RenderBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar) + 10, self.widthBar, self.curHeightBar)
chat.Render(self.chatID)
elif self.boardState == chat.BOARD_STATE_VIEW:
if systemSetting.IsViewChat():
grp.RenderGradationBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar), self.widthBar, self.curHeightBar, self.BOARD_START_COLOR, self.BOARD_END_COLOR)
chat.Render(self.chatID)

##########
## Event
def OnTop(self):
self.btnChatSizing.SetTop()
self.scrollBar.SetTop()

def OnScroll(self):
if not self.scrollLock:
self.scrollBarPos = self.scrollBar.GetPos()

lineCount = chat.GetLineCount(self.chatID)
visibleLineCount = chat.GetVisibleLineCount(self.chatID)
endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

chat.SetEndPos(self.chatID, self.scrollBarPos)

def OnChangeChatMode(self):
self.chatInputSet.OnChangeChatMode()

def SetChatFocus(self):
self.chatInputSet.SetChatFocus()

def BindInterface(self, interface):
self.chatInputSet.BindInterface(interface)

## ChatLogWindow
class ChatLogWindow(ui.Window):

BLOCK_WIDTH = 32
CHAT_MODE_NAME = ( locale.CHAT_NORMAL, locale.CHAT_PARTY, locale.CHAT_GUILD, locale.CHAT_SHOUT, locale.CHAT_INFORMATION, locale.CHAT_NOTICE, )
CHAT_MODE_INDEX = ( chat.CHAT_TYPE_TALKING,
chat.CHAT_TYPE_PARTY,
chat.CHAT_TYPE_GUILD,
chat.CHAT_TYPE_SHOUT,
chat.CHAT_TYPE_INFO,
chat.CHAT_TYPE_NOTICE, )

CHAT_LOG_WINDOW_MINIMUM_WIDTH = 450
CHAT_LOG_WINDOW_MINIMUM_HEIGHT = 120

class ResizeButton(ui.DragButton):

def __init__(self):
ui.DragButton.__init__(self)

def __del__(self):
ui.DragButton.__del__(self)

def OnMouseOverIn(self):
app.SetCursor(app.HVSIZE)

def OnMouseOverOut(self):
app.SetCursor(app.NORMAL)

def __init__(self):

self.allChatMode = TRUE
self.chatInputSet = None

ui.Window.__init__(self)
self.AddFlag("float")
self.AddFlag("movable")

self.__CreateChatInputSet()
self.__CreateWindow()
self.__CreateButton()
self.__CreateScrollBar()

self.chatID = chat.CreateChatSet(chat.CHAT_SET_LOG_WINDOW)
chat.SetBoardState(self.chatID, chat.BOARD_STATE_LOG)
for i in self.CHAT_MODE_INDEX:
chat.EnableChatMode(self.chatID, i)

self.SetPosition(20, 20)
self.SetSize(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT)
self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH-self.btnSizing.GetWidth(), self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT-self.btnSizing.GetHeight()+2)

self.OnResize()

def __CreateChatInputSet(self):
chatInputSet = ChatInputSet()
chatInputSet.SetParent(self)
chatInputSet.SetEscapeEvent(ui.__mem_func__(self.Close))
chatInputSet.SetWindowVerticalAlignBottom()
chatInputSet.Open()
self.chatInputSet = chatInputSet

def __CreateWindow(self):
imgLeft = ui.ImageBox()
imgLeft.AddFlag("not_pick")
imgLeft.SetParent(self)

imgCenter = ui.ExpandedImageBox()
imgCenter.AddFlag("not_pick")
imgCenter.SetParent(self)

imgRight = ui.ImageBox()
imgRight.AddFlag("not_pick")
imgRight.SetParent(self)

if locale.IsARABIC():
imgLeft.LoadImage("locale/ae/ui/pattern/titlebar_left.tga")
imgCenter.LoadImage("locale/ae/ui/pattern/titlebar_center.tga")
imgRight.LoadImage("locale/ae/ui/pattern/titlebar_right.tga")
else:
imgLeft.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_left.tga")
imgCenter.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_middle.tga")
imgRight.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_right.tga")

imgLeft.Show()
imgCenter.Show()
imgRight.Show()

btnClose = ui.Button()
btnClose.SetParent(self)
btnClose.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
btnClose.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
btnClose.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
btnClose.SetToolTipText(locale.UI_CLOSE, 0, -23)
btnClose.SetEvent(ui.__mem_func__(self.Close))
btnClose.Show()

btnSizing = self.ResizeButton()
btnSizing.SetParent(self)
btnSizing.SetMoveEvent(ui.__mem_func__(self.OnResize))
btnSizing.SetSize(16, 16)
btnSizing.Show()

titleName = ui.TextLine()
titleName.SetParent(self)

if locale.IsARABIC():
titleName.SetPosition(self.GetWidth()-20, 6)
else:
titleName.SetPosition(20, 6)

titleName.SetText(locale.CHAT_LOG_TITLE)
titleName.Show()

self.imgLeft = imgLeft
self.imgCenter = imgCenter
self.imgRight = imgRight
self.btnClose = btnClose
self.btnSizing = btnSizing
self.titleName = titleName

def __CreateButton(self):

if locale.IsARABIC():
bx = 20
else:
bx = 13

btnAll = ui.RadioButton()
btnAll.SetParent(self)
btnAll.SetPosition(bx, 24)
btnAll.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
btnAll.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
btnAll.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
btnAll.SetText(locale.CHAT_ALL)
btnAll.SetEvent(ui.__mem_func__(self.ToggleAllChatMode))
btnAll.Down()
btnAll.Show()
self.btnAll = btnAll

x = bx + 48
i = 0
self.modeButtonList = []
for name in self.CHAT_MODE_NAME:
btn = ui.ToggleButton()
btn.SetParent(self)
btn.SetPosition(x, 24)
btn.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
btn.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
btn.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
btn.SetText(name)
btn.Show()

mode = self.CHAT_MODE_INDEX
btn.SetToggleUpEvent(lambda arg=mode: self.ToggleChatMode(arg))
btn.SetToggleDownEvent(lambda arg=mode: self.ToggleChatMode(arg))
self.modeButtonList.append(btn)

x += 48
i += 1

def __CreateScrollBar(self):
scrollBar = ui.SmallThinScrollBar()
scrollBar.SetParent(self)
scrollBar.Show()
scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
self.scrollBar = scrollBar
self.scrollBarPos = 1.0

def __del__(self):
ui.Window.__del__(self)

def Destroy(self):
self.imgLeft = None
self.imgCenter = None
self.imgRight = None
self.btnClose = None
self.btnSizing = None
self.modeButtonList = []
self.scrollBar = None
self.chatInputSet = None

def ToggleAllChatMode(self):
if self.allChatMode:
return

self.allChatMode = TRUE

for i in self.CHAT_MODE_INDEX:
chat.EnableChatMode(self.chatID, i)
for btn in self.modeButtonList:
btn.SetUp()

def ToggleChatMode(self, mode):
if self.allChatMode:
self.allChatMode = FALSE
for i in self.CHAT_MODE_INDEX:
chat.DisableChatMode(self.chatID, i)
chat.EnableChatMode(self.chatID, mode)
self.btnAll.SetUp()

else:
chat.ToggleChatMode(self.chatID, mode)

def SetSize(self, width, height):
self.imgCenter.SetRenderingRect(0.0, 0.0, float((width - self.BLOCK_WIDTH*2) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0)
self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)

if locale.IsARABIC():
self.titleName.SetPosition(self.GetWidth()-20, 3)
self.btnClose.SetPosition(3, 3)
self.scrollBar.SetPosition(1, 45)
else:
self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 5, 5)
self.scrollBar.SetPosition(width - 15, 45)

self.scrollBar.SetScrollBarSize(height - 45 - 12)
self.scrollBar.SetPos(self.scrollBarPos)
ui.Window.SetSize(self, width, height)

def Open(self):
self.OnResize()
self.chatInputSet.SetChatFocus()
self.Show()

def Close(self):
if self.chatInputSet:
self.chatInputSet.KillChatFocus()
self.Hide()

def OnResize(self):
x, y = self.btnSizing.GetLocalPosition()
width = self.btnSizing.GetWidth()
height = self.btnSizing.GetHeight()

if x < self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width:
self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width, y)
return
if y < self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height:
self.btnSizing.SetPosition(x, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height)
return

self.scrollBar.LockScroll()
self.SetSize(x + width, y + height)
self.scrollBar.UnlockScroll()

if locale.IsARABIC():
self.chatInputSet.SetPosition(20, 25)
else:
self.chatInputSet.SetPosition(0, 25)

self.chatInputSet.SetSize(self.GetWidth() - 20, 20)
self.chatInputSet.RefreshPosition()
self.chatInputSet.SetChatMax(self.GetWidth() / 8)

def OnScroll(self):
self.scrollBarPos = self.scrollBar.GetPos()

lineCount = chat.GetLineCount(self.chatID)
visibleLineCount = chat.GetVisibleLineCount(self.chatID)
endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

chat.SetEndPos(self.chatID, self.scrollBarPos)

def OnRender(self):
(x, y, width, height) = self.GetRect()

if locale.IsARABIC():
grp.SetColor(0x77000000)
grp.RenderBar(x+2, y+45, 13, height-45)

grp.SetColor(0x77000000)
grp.RenderBar(x, y, width, height)
grp.SetColor(0xff525552)
grp.RenderBox(x, y, width-2, height)
grp.SetColor(0xff000000)
grp.RenderBox(x+1, y+1, width-2, height)

grp.SetColor(0xff989898)
grp.RenderLine(x+width-13, y+height-1, 11, -11)
grp.RenderLine(x+width-9, y+height-1, 7, -7)
grp.RenderLine(x+width-5, y+height-1, 3, -3)
else:
grp.SetColor(0x77000000)
grp.RenderBar(x+width-15, y+45, 13, height-45)

grp.SetColor(0x77000000)
grp.RenderBar(x, y, width, height)
grp.SetColor(0xff525552)
grp.RenderBox(x, y, width-2, height)
grp.SetColor(0xff000000)
grp.RenderBox(x+1, y+1, width-2, height)

grp.SetColor(0xff989898)
grp.RenderLine(x+width-13, y+height-1, 11, -11)
grp.RenderLine(x+width-9, y+height-1, 7, -7)
grp.RenderLine(x+width-5, y+height-1, 3, -3)

#####

chat.ArrangeShowingChat(self.chatID)

if locale.IsARABIC():
chat.SetPosition(self.chatID, x + width - 10, y + height - 25)
else:
chat.SetPosition(self.chatID, x + 10, y + height - 25)

chat.SetHeight(self.chatID, height - 45 - 25)
chat.Update(self.chatID)
chat.Render(self.chatID)

def OnPressEscapeKey(self):
self.Close()
return TRUE

def BindInterface(self, interface):
self.interface = interface

def OnMouseLeftButtonDown(self):
hyperlink = ui.GetHyperlink()
if hyperlink:
if app.IsPressed(app.DIK_LALT):
link = chat.GetLinkFromHyperlink(hyperlink)
ime.PasteString(link)
else:
self.interface.MakeHyperlinkTooltip(hyperlink)
Avatar utilizator
Marggraf
Utilizator interzis !

Utilizator interzis !
Mesaje: 1074
Membru din: 25 Mai 2014, 12:46
Server: loading...
Regat: Shinsoo
Aprecieri: 36  
Mulţumiri: 36  
Medalii

pune-l cu cod
Imagine
Imagine
Afișează semnătura
Avatar utilizator
KriTecK
Fost Helper

Fost Helper
Mesaje: 520
Membru din: 28 Iul 2013, 11:05
Aprecieri: 9  
Mulţumiri: 11  
 Contact:
Medalii

Cod: Selectaţi tot

import ui
import grp
import chat
import wndMgr
import net
import app
import ime
import locale
import colorInfo
import constInfo
import systemSetting
import player

ENABLE_CHAT_COMMAND = TRUE
ENABLE_LAST_SENTENCE_STACK = TRUE
ENABLE_INSULT_CHECK = TRUE

if locale.IsHONGKONG():
	ENABLE_LAST_SENTENCE_STACK = TRUE

if locale.IsEUROPE():
	ENABLE_CHAT_COMMAND = FALSE

if locale.IsCANADA():
	ENABLE_LAST_SENTENCE_STACK = FALSE

chatInputSetList = []
def InsertChatInputSetWindow(wnd):
	global chatInputSetList
	chatInputSetList.append(wnd)
def RefreshChatMode():
	global chatInputSetList
	map(lambda wnd:wnd.OnRefreshChatMode(), chatInputSetList)
def DestroyChatInputSetWindow():
	global chatInputSetList
	chatInputSetList = []

## ChatModeButton
class ChatModeButton(ui.Window):

	OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)
	OVER_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 0.3)
	BUTTON_STATE_UP = 0
	BUTTON_STATE_OVER = 1
	BUTTON_STATE_DOWN = 2

	def __init__(self):
		ui.Window.__init__(self)
		self.state = None
		self.buttonText = None
		self.event = None

		net.EnableChatInsultFilter(ENABLE_INSULT_CHECK)

	def __del__(self):
		ui.Window.__del__(self)

	def SAFE_SetEvent(self, event):
		self.event=ui.__mem_func__(event)

	def SetText(self, text):
		if None == self.buttonText:
			textLine = ui.TextLine()
			textLine.SetParent(self)
			textLine.SetWindowHorizontalAlignCenter()
			textLine.SetWindowVerticalAlignCenter()
			textLine.SetVerticalAlignCenter()
			textLine.SetHorizontalAlignCenter()
			textLine.SetPackedFontColor(self.OUTLINE_COLOR)
			textLine.Show()
			self.buttonText = textLine

		self.buttonText.SetText(text)

	def SetSize(self, width, height):
		self.width = width
		self.height = height
		ui.Window.SetSize(self, width, height)

	def OnMouseOverIn(self):
		self.state = self.BUTTON_STATE_OVER

	def OnMouseOverOut(self):
		self.state = self.BUTTON_STATE_UP

	def OnMouseLeftButtonDown(self):
		self.state = self.BUTTON_STATE_DOWN

	def OnMouseLeftButtonUp(self):
		self.state = self.BUTTON_STATE_UP
		if self.IsIn():
			self.state = self.BUTTON_STATE_OVER

		if None != self.event:
			self.event()

	def OnRender(self):

		(x, y) = self.GetGlobalPosition()

		grp.SetColor(self.OUTLINE_COLOR)
		grp.RenderRoundBox(x, y, self.width, self.height)

		if self.state >= self.BUTTON_STATE_OVER:
			grp.RenderRoundBox(x+1, y, self.width-2, self.height)
			grp.RenderRoundBox(x, y+1, self.width, self.height-2)

			if self.BUTTON_STATE_DOWN == self.state:
				grp.SetColor(self.OVER_COLOR)
				grp.RenderBar(x+1, y+1, self.width-2, self.height-2)

## ChatLine
class ChatLine(ui.EditLine):

	CHAT_MODE_NAME = {	chat.CHAT_TYPE_TALKING : locale.CHAT_NORMAL,
						chat.CHAT_TYPE_PARTY : locale.CHAT_PARTY,
						chat.CHAT_TYPE_GUILD : locale.CHAT_GUILD,
						chat.CHAT_TYPE_SHOUT : locale.CHAT_SHOUT, }

	def __init__(self):
		ui.EditLine.__init__(self)
		self.SetWindowName("Chat Line")
		self.lastShoutTime = 0
		self.eventEscape = lambda *arg: None
		self.eventReturn = lambda *arg: None
		self.eventTab = None
		self.chatMode = chat.CHAT_TYPE_TALKING
		self.bCodePage = TRUE

		self.overTextLine = ui.TextLine()
		self.overTextLine.SetParent(self)
		self.overTextLine.SetPosition(-1, 0)
		self.overTextLine.SetFontColor(1.0, 1.0, 0.0)
		self.overTextLine.SetOutline()
		self.overTextLine.Hide()

		self.lastSentenceStack = []
		self.lastSentencePos = 0

	def SetChatMode(self, mode):
		self.chatMode = mode

	def GetChatMode(self):
		return self.chatMode

	def ChangeChatMode(self):
		if chat.CHAT_TYPE_TALKING == self.GetChatMode():
			self.SetChatMode(chat.CHAT_TYPE_PARTY)
			self.SetText("#")
			self.SetEndPosition()

		elif chat.CHAT_TYPE_PARTY == self.GetChatMode():
			self.SetChatMode(chat.CHAT_TYPE_GUILD)
			self.SetText("%")
			self.SetEndPosition()

		elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
			self.SetChatMode(chat.CHAT_TYPE_SHOUT)
			self.SetText("!")
			self.SetEndPosition()

		elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
			self.SetChatMode(chat.CHAT_TYPE_TALKING)
			self.SetText("")

		self.__CheckChatMark()

	def GetCurrentChatModeName(self):
		try:
			return self.CHAT_MODE_NAME[self.chatMode]
		except:
			import exception
			exception.Abort("ChatLine.GetCurrentChatModeName")

	def SAFE_SetEscapeEvent(self, event):
		self.eventReturn = ui.__mem_func__(event)

	def SAFE_SetReturnEvent(self, event):
		self.eventEscape = ui.__mem_func__(event)

	def SAFE_SetTabEvent(self, event):
		self.eventTab = ui.__mem_func__(event)

	def SetTabEvent(self, event):
		self.eventTab = event

	def OpenChat(self):
		self.SetFocus()
		self.__ResetChat()

	def __ClearChat(self):
		self.SetText("")
		self.lastSentencePos = 0

	def __ResetChat(self):
		if chat.CHAT_TYPE_PARTY == self.GetChatMode():
			self.SetText("#")
			self.SetEndPosition()
		elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
			self.SetText("%")
			self.SetEndPosition()
		elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
			self.SetText("!")
			self.SetEndPosition()
		else:
			self.__ClearChat()

		self.__CheckChatMark()
		

	def __SendChatPacket(self, text, type):
                if net.IsChatInsultIn(text):
                        chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)
                else:
                        name = player.GetName()
                        if type == chat.CHAT_TYPE_SHOUT:
                                if name.find("[") !=-1:
                                        empire_id = "|cffffc700|H|h[Staff]|cFFA7FFD4|H|h"
                                else:
                                        empire_id = str(net.GetEmpireID())
                                        if empire_id == "1":
                                                empire_id = "|cFFFF0000|H|h[Sinshoo]|cFFA7FFD4|H|h"
                                        elif empire_id == "2":
                                                empire_id = "|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h"
                                        elif empire_id == "3":
                                                empire_id = "|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"
 
                                text = empire_id + text
 
#               if text[0] == '/':
#                       if ENABLE_CHAT_COMMAND or constInfo.CONSOLE_ENABLE:
#                               pass
#                       else:
#                               return
 
                if net.IsChatInsultIn(text):
                        chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)
                else:
                        net.SendChatPacket(text, type)

	def __SendShoutChatPacket(self, text):

		if 1 == len(text):
			self.RunCloseEvent()
			return

		if app.GetTime() < self.lastShoutTime + 15:
			chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_SHOUT_LIMIT)
			self.__ResetChat()
			return

		self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT)
		self.__ResetChat()

		self.lastShoutTime = app.GetTime()

	def __SendTalkingChatPacket(self, text):
		if text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and text[2] == ' ':
			newtext = text.split(' ', 1)
			net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
			self.__ResetChat()
		elif text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and (text[2] == 'o' or text[2] == 'O') and (text[3] == 't' or text[3] == 'T') and (text[4] == 'i' or text[4] == 'I') and (text[5] == 'c' or text[5] == 'C') and (text[6] == 'e' or text[6] == 'E') and text[7] == ' ':
			newtext = text.split(' ', 1)
			net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
			self.__ResetChat()
		else:
			self.__SendChatPacket(text, chat.CHAT_TYPE_TALKING)
			self.__ResetChat()

	def OnIMETab(self):
		#if None != self.eventTab:
		#	self.eventTab()
		#return TRUE
		return FALSE

	def OnIMEUpdate(self):
		ui.EditLine.OnIMEUpdate(self)
		self.__CheckChatMark()

	def __CheckChatMark(self):

		self.overTextLine.Hide()

		text = self.GetText()
		if len(text) > 0:
			if '#' == text[0]:
				self.overTextLine.SetText("#")
				self.overTextLine.Show()
			elif '%' == text[0]:
				self.overTextLine.SetText("%")
				self.overTextLine.Show()
			elif '!' == text[0]:
				self.overTextLine.SetText("!")
				self.overTextLine.Show()

	def OnIMEKeyDown(self, key):
		# LAST_SENTENCE_STACK
		if app.VK_UP == key:
			self.__PrevLastSentenceStack()
			return TRUE

		if app.VK_DOWN == key:
			self.__NextLastSentenceStack()				
			return TRUE			
		# END_OF_LAST_SENTENCE_STACK

		ui.EditLine.OnIMEKeyDown(self, key)

	# LAST_SENTENCE_STACK
	def __PrevLastSentenceStack(self):
		global ENABLE_LAST_SENTENCE_STACK
		if not ENABLE_LAST_SENTENCE_STACK:
			return

		if self.lastSentenceStack and self.lastSentencePos < len(self.lastSentenceStack):
			self.lastSentencePos += 1
			lastSentence = self.lastSentenceStack[-self.lastSentencePos]
			self.SetText(lastSentence)				
			self.SetEndPosition()			

	def __NextLastSentenceStack(self):
		global ENABLE_LAST_SENTENCE_STACK
		if not ENABLE_LAST_SENTENCE_STACK:
			return

		if self.lastSentenceStack and self.lastSentencePos > 1:
			self.lastSentencePos -= 1
			lastSentence = self.lastSentenceStack[-self.lastSentencePos]
			self.SetText(lastSentence)				
			self.SetEndPosition()			

	def __PushLastSentenceStack(self, text):		
		global ENABLE_LAST_SENTENCE_STACK
		if not ENABLE_LAST_SENTENCE_STACK:
			return

		if len(text) <= 0:
			return
			
		LAST_SENTENCE_STACK_SIZE = 32
		if len(self.lastSentenceStack) > LAST_SENTENCE_STACK_SIZE:
			self.lastSentenceStack.pop(0)

		self.lastSentenceStack.append(text)
	# END_OF_LAST_SENTENCE_STACK

	def OnIMEReturn(self):
		text = self.GetText()
		textLen=len(text)

		# LAST_SENTENCE_STACK
		self.__PushLastSentenceStack(text)
		# END_OF_LAST_SENTENCE_STACK
				
		textSpaceCount=text.count(' ')

		if (textLen > 0) and (textLen != textSpaceCount):
			if '#' == text[0]:
				self.__SendPartyChatPacket(text)
			elif '%' == text[0]:
				self.__SendGuildChatPacket(text)
			elif '!' == text[0]:
				self.__SendShoutChatPacket(text)
			else:
				self.__SendTalkingChatPacket(text)
		else:
			self.__ClearChat()
			self.eventReturn()

		return TRUE

	def OnPressEscapeKey(self):
		self.__ClearChat()
		self.eventEscape()
		return TRUE

	def RunCloseEvent(self):
		self.eventEscape()

	def BindInterface(self, interface):
		self.interface = interface

	def OnMouseLeftButtonDown(self):
		hyperlink = ui.GetHyperlink()
		if hyperlink:
			if app.IsPressed(app.DIK_LALT):
				link = chat.GetLinkFromHyperlink(hyperlink)
				ime.PasteString(link)
			else:
				self.interface.MakeHyperlinkTooltip(hyperlink)
		else:
			ui.EditLine.OnMouseLeftButtonDown(self)

class ChatInputSet(ui.Window):

	CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

	def __init__(self):
		ui.Window.__init__(self)

		InsertChatInputSetWindow(self)
		self.__Create()

	def __del__(self):
		ui.Window.__del__(self)

	def __Create(self):
		chatModeButton = ChatModeButton()
		chatModeButton.SetParent(self)
		chatModeButton.SetSize(40, 17)
		chatModeButton.SetText(locale.CHAT_NORMAL)
		chatModeButton.SetPosition(7, 2)
		chatModeButton.SAFE_SetEvent(self.OnChangeChatMode)
		self.chatModeButton = chatModeButton

		chatLine = ChatLine()
		chatLine.SetParent(self)
		chatLine.SetMax(512)
		chatLine.SetUserMax(76)
		chatLine.SetText("")
		chatLine.SAFE_SetTabEvent(self.OnChangeChatMode)
		chatLine.x = 0
		chatLine.y = 0
		chatLine.width = 0
		chatLine.height = 0
		self.chatLine = chatLine

		btnSend = ui.Button()
		btnSend.SetParent(self)
		btnSend.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_01.sub")
		btnSend.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_02.sub")
		btnSend.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_03.sub")
		btnSend.SetToolTipText(locale.CHAT_SEND_CHAT)
		btnSend.SAFE_SetEvent(self.chatLine.OnIMEReturn)
		self.btnSend = btnSend

	def Destroy(self):
		self.chatModeButton = None
		self.chatLine = None
		self.btnSend = None

	def Open(self):
		self.chatLine.Show()
		self.chatLine.SetPosition(57, 5)
		self.chatLine.SetFocus()
		self.chatLine.OpenChat()

		self.chatModeButton.SetPosition(7, 2)
		self.chatModeButton.Show()

		self.btnSend.Show()
		self.Show()

		self.RefreshPosition()
		return TRUE

	def Close(self):
		self.chatLine.KillFocus()
		self.chatLine.Hide()
		self.chatModeButton.Hide()
		self.btnSend.Hide()
		self.Hide()
		return TRUE

	def SetEscapeEvent(self, event):
		self.chatLine.SetEscapeEvent(event)

	def SetReturnEvent(self, event):
		self.chatLine.SetReturnEvent(event)

	def OnChangeChatMode(self):
		RefreshChatMode()

	def OnRefreshChatMode(self):
		self.chatLine.ChangeChatMode()
		self.chatModeButton.SetText(self.chatLine.GetCurrentChatModeName())

	def SetChatFocus(self):
		self.chatLine.SetFocus()

	def KillChatFocus(self):
		self.chatLine.KillFocus()

	def SetChatMax(self, max):
		self.chatLine.SetUserMax(max)

	def RefreshPosition(self):
		if locale.IsARABIC():
			self.chatLine.SetSize(self.GetWidth() - 93, 18)
		else:
			self.chatLine.SetSize(self.GetWidth() - 93, 13)

		self.btnSend.SetPosition(self.GetWidth() - 25, 2)

		(self.chatLine.x, self.chatLine.y, self.chatLine.width, self.chatLine.height) = self.chatLine.GetRect()

	def BindInterface(self, interface):
		self.chatLine.BindInterface(interface)

	def OnRender(self):
		(x, y, width, height) = self.chatLine.GetRect()
		ui.RenderRoundBox(x-4, y-3, width+7, height+4, self.CHAT_OUTLINE_COLOR)

## ChatWindow
class ChatWindow(ui.Window):

	BOARD_START_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.0)
	BOARD_END_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.8)
	BOARD_MIDDLE_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.5)
	CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

	EDIT_LINE_HEIGHT = 25

	class ChatBackBoard(ui.Window):
		def __init__(self):
			ui.Window.__init__(self)
		def __del__(self):
			ui.Window.__del__(self)

	class ChatButton(ui.DragButton):

		def __init__(self):
			ui.DragButton.__init__(self)
			self.AddFlag("float")
			self.AddFlag("movable")
			self.AddFlag("restrict_x")
			self.topFlag = FALSE

		def __del__(self):
			ui.DragButton.__del__(self)

		def SetOwner(self, owner):
			self.owner = owner

		def OnMouseOverIn(self):
			app.SetCursor(app.VSIZE)

		def OnMouseOverOut(self):
			app.SetCursor(app.NORMAL)

		def OnTop(self):
			if TRUE == self.topFlag:
				return

			self.topFlag = TRUE
			self.owner.SetTop()
			self.topFlag = FALSE

	def __init__(self):
		ui.Window.__init__(self)
		self.AddFlag("float")

		self.__RegisterChatColorDict()

		self.boardState = chat.BOARD_STATE_VIEW
		self.chatID = chat.CreateChatSet(chat.CHAT_SET_CHAT_WINDOW)
		chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)

		self.xBar = 0
		self.yBar = 0
		self.widthBar = 0
		self.heightBar = 0
		self.curHeightBar = 0
		self.visibleLineCount = 0
		self.scrollBarPos = 1.0
		self.scrollLock = FALSE

		chatInputSet = ChatInputSet()
		chatInputSet.SetParent(self)
		chatInputSet.SetEscapeEvent(ui.__mem_func__(self.CloseChat))
		chatInputSet.SetReturnEvent(ui.__mem_func__(self.CloseChat))
		chatInputSet.SetSize(550, 25)
		self.chatInputSet = chatInputSet

		btnSendWhisper = ui.Button()
		btnSendWhisper.SetParent(self)
		btnSendWhisper.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_01.sub")
		btnSendWhisper.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_02.sub")
		btnSendWhisper.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_03.sub")
		btnSendWhisper.SetToolTipText(locale.CHAT_SEND_MEMO)
		btnSendWhisper.Hide()
		self.btnSendWhisper = btnSendWhisper

		btnChatLog = ui.Button()
		btnChatLog.SetParent(self)
		btnChatLog.SetUpVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_01.sub")
		btnChatLog.SetOverVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_02.sub")
		btnChatLog.SetDownVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_03.sub")
		btnChatLog.SetToolTipText(locale.CHAT_LOG)
		btnChatLog.Hide()
		self.btnChatLog = btnChatLog

		btnChatSizing = self.ChatButton()
		btnChatSizing.SetOwner(self)
		btnChatSizing.SetMoveEvent(ui.__mem_func__(self.Refresh))
		btnChatSizing.Hide()
		self.btnChatSizing = btnChatSizing

		imgChatBarLeft = ui.ImageBox()
		imgChatBarLeft.SetParent(self.btnChatSizing)
		imgChatBarLeft.AddFlag("not_pick")
		imgChatBarLeft.LoadImage("d:/ymir work/ui/pattern/chat_bar_left.tga")
		imgChatBarLeft.Show()
		self.imgChatBarLeft = imgChatBarLeft
		imgChatBarRight = ui.ImageBox()
		imgChatBarRight.SetParent(self.btnChatSizing)
		imgChatBarRight.AddFlag("not_pick")
		imgChatBarRight.LoadImage("d:/ymir work/ui/pattern/chat_bar_right.tga")
		imgChatBarRight.Show()
		self.imgChatBarRight = imgChatBarRight
		imgChatBarMiddle = ui.ExpandedImageBox()
		imgChatBarMiddle.SetParent(self.btnChatSizing)
		imgChatBarMiddle.AddFlag("not_pick")
		imgChatBarMiddle.LoadImage("d:/ymir work/ui/pattern/chat_bar_middle.tga")
		imgChatBarMiddle.Show()
		self.imgChatBarMiddle = imgChatBarMiddle

		scrollBar = ui.ScrollBar()
		scrollBar.AddFlag("float")
		scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
		self.scrollBar = scrollBar

		self.Refresh()
		self.chatInputSet.RefreshPosition() # RTL 시 위치를 제대로 잡으려면 위치 갱신이 필요하다
	
	def __del__(self):
		ui.Window.__del__(self)

	def __RegisterChatColorDict(self):
		CHAT_COLOR_DICT = {
			chat.CHAT_TYPE_TALKING : colorInfo.CHAT_RGB_TALK,
			chat.CHAT_TYPE_INFO : colorInfo.CHAT_RGB_INFO,
			chat.CHAT_TYPE_NOTICE : colorInfo.CHAT_RGB_NOTICE,
			chat.CHAT_TYPE_PARTY : colorInfo.CHAT_RGB_PARTY,
			chat.CHAT_TYPE_GUILD : colorInfo.CHAT_RGB_GUILD,
			chat.CHAT_TYPE_COMMAND : colorInfo.CHAT_RGB_COMMAND,
			chat.CHAT_TYPE_SHOUT : colorInfo.CHAT_RGB_SHOUT,
			chat.CHAT_TYPE_WHISPER : colorInfo.CHAT_RGB_WHISPER,
		}

		for colorItem in CHAT_COLOR_DICT.items():
			type=colorItem[0]
			rgb=colorItem[1]
			chat.SetChatColor(type, rgb[0], rgb[1], rgb[2])

	def Destroy(self):
		self.chatInputSet.Destroy()
		self.chatInputSet = None

		self.btnSendWhisper = 0
		self.btnChatLog = 0
		self.btnChatSizing = 0

	################
	## Open & Close
	def OpenChat(self):
		chat.SetBoardState(self.chatID, chat.BOARD_STATE_EDIT)
		self.boardState = chat.BOARD_STATE_EDIT

		(x, y, width, height) = self.GetRect()
		(btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

		if locale.IsARABIC():
			chat.SetPosition(self.chatID, x + width - 10, y)
		else:	
			chat.SetPosition(self.chatID, x + 10, y)

		chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

		if self.IsShow():
			self.btnChatSizing.Show()

		self.Refresh()

		self.btnSendWhisper.SetPosition(self.GetWidth() - 50, 2)
		self.btnSendWhisper.Show()

		self.btnChatLog.SetPosition(self.GetWidth() - 25, 2)
		self.btnChatLog.Show()

		self.chatInputSet.Open()
		self.SetTop()

	def CloseChat(self):
		chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)
		self.boardState = chat.BOARD_STATE_VIEW

		(x, y, width, height) = self.GetRect()

		if locale.IsARABIC():
			chat.SetPosition(self.chatID, x + width - 10, y + height)
		else:
			chat.SetPosition(self.chatID, x + 10, y + height)

		self.chatInputSet.Close()
		self.btnSendWhisper.Hide()
		self.btnChatLog.Hide()
		self.btnChatSizing.Hide()
		self.Refresh()

	def SetSendWhisperEvent(self, event):
		self.btnSendWhisper.SetEvent(event)

	def SetOpenChatLogEvent(self, event):
		self.btnChatLog.SetEvent(event)

	def IsEditMode(self):
		if chat.BOARD_STATE_EDIT == self.boardState:
			return TRUE

		return FALSE

	def __RefreshSizingBar(self):
		(x, y, width, height) = self.GetRect()
		gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
		self.btnChatSizing.SetPosition(x, gyChat)
		self.btnChatSizing.SetSize(width, 22)
		self.imgChatBarLeft.SetPosition(0, 0)
		self.imgChatBarRight.SetPosition(width - 64, 0)
		self.imgChatBarMiddle.SetPosition(64, 0)
		self.imgChatBarMiddle.SetRenderingRect(0.0, 0.0, float(width - 128) / 64.0 - 1.0, 0.0)

	def SetPosition(self, x, y):
		ui.Window.SetPosition(self, x, y)
		self.__RefreshSizingBar()

	def SetSize(self, width, height):
		ui.Window.SetSize(self, width, height)
		self.__RefreshSizingBar()

	def SetHeight(self, height):
		gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
		self.btnChatSizing.SetPosition(gxChat, wndMgr.GetScreenHeight() - height)

	###########
	## Refresh
	def Refresh(self):
		if self.boardState == chat.BOARD_STATE_EDIT:
			self.RefreshBoardEditState()
		elif self.boardState == chat.BOARD_STATE_VIEW:
			self.RefreshBoardViewState()

	def RefreshBoardEditState(self):

		(x, y, width, height) = self.GetRect()
		(btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

		self.xBar = x
		self.yBar = btnY
		self.widthBar = width
		self.heightBar = y - btnY + self.EDIT_LINE_HEIGHT
		self.curHeightBar = self.heightBar

		if locale.IsARABIC():
			chat.SetPosition(self.chatID, x + width - 10, y)
		else:
			chat.SetPosition(self.chatID, x + 10, y)

		chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT)
		chat.ArrangeShowingChat(self.chatID)

		if btnY > y:
			self.btnChatSizing.SetPosition(btnX, y)
			self.heightBar = self.EDIT_LINE_HEIGHT

	def RefreshBoardViewState(self):
		(x, y, width, height) = self.GetRect()
		(btnX, btnY) = self.btnChatSizing.GetGlobalPosition()
		textAreaHeight = self.visibleLineCount * chat.GetLineStep(self.chatID)

		if locale.IsARABIC():
			chat.SetPosition(self.chatID, x + width - 10, y + height)
		else:
			chat.SetPosition(self.chatID, x + 10, y + height)

		chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

		if self.boardState == chat.BOARD_STATE_EDIT:
			textAreaHeight += 45
		elif self.visibleLineCount != 0:
			textAreaHeight += 10 + 10

		self.xBar = x
		self.yBar = y + height - textAreaHeight
		self.widthBar = width
		self.heightBar = textAreaHeight

		self.scrollBar.Hide()

	##########
	## Render
	def OnUpdate(self):
		if self.boardState == chat.BOARD_STATE_EDIT:
			chat.Update(self.chatID)
		elif self.boardState == chat.BOARD_STATE_VIEW:
			if systemSetting.IsViewChat():
				chat.Update(self.chatID)

	def OnRender(self):
		if chat.GetVisibleLineCount(self.chatID) != self.visibleLineCount:
			self.visibleLineCount = chat.GetVisibleLineCount(self.chatID)
			self.Refresh()

		if self.curHeightBar != self.heightBar:
			self.curHeightBar += (self.heightBar - self.curHeightBar) / 10

		if self.boardState == chat.BOARD_STATE_EDIT:
			grp.SetColor(self.BOARD_MIDDLE_COLOR)
			grp.RenderBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar) + 10, self.widthBar, self.curHeightBar)
			chat.Render(self.chatID)
		elif self.boardState == chat.BOARD_STATE_VIEW:
			if systemSetting.IsViewChat():
				grp.RenderGradationBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar), self.widthBar, self.curHeightBar, self.BOARD_START_COLOR, self.BOARD_END_COLOR)
				chat.Render(self.chatID)

	##########
	## Event
	def OnTop(self):
		self.btnChatSizing.SetTop()
		self.scrollBar.SetTop()

	def OnScroll(self):
		if not self.scrollLock:
			self.scrollBarPos = self.scrollBar.GetPos()

		lineCount = chat.GetLineCount(self.chatID)
		visibleLineCount = chat.GetVisibleLineCount(self.chatID)
		endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

		chat.SetEndPos(self.chatID, self.scrollBarPos)

	def OnChangeChatMode(self):
		self.chatInputSet.OnChangeChatMode()

	def SetChatFocus(self):
		self.chatInputSet.SetChatFocus()			

	def BindInterface(self, interface):
		self.chatInputSet.BindInterface(interface)

## ChatLogWindow
class ChatLogWindow(ui.Window):

	BLOCK_WIDTH = 32
	CHAT_MODE_NAME = ( locale.CHAT_NORMAL, locale.CHAT_PARTY, locale.CHAT_GUILD, locale.CHAT_SHOUT, locale.CHAT_INFORMATION, locale.CHAT_NOTICE, )
	CHAT_MODE_INDEX = ( chat.CHAT_TYPE_TALKING,
						chat.CHAT_TYPE_PARTY,
						chat.CHAT_TYPE_GUILD,
						chat.CHAT_TYPE_SHOUT,
						chat.CHAT_TYPE_INFO,
						chat.CHAT_TYPE_NOTICE, )

	CHAT_LOG_WINDOW_MINIMUM_WIDTH = 450
	CHAT_LOG_WINDOW_MINIMUM_HEIGHT = 120

	class ResizeButton(ui.DragButton):

		def __init__(self):
			ui.DragButton.__init__(self)

		def __del__(self):
			ui.DragButton.__del__(self)

		def OnMouseOverIn(self):
			app.SetCursor(app.HVSIZE)

		def OnMouseOverOut(self):
			app.SetCursor(app.NORMAL)

	def __init__(self):

		self.allChatMode = TRUE
		self.chatInputSet = None

		ui.Window.__init__(self)
		self.AddFlag("float")
		self.AddFlag("movable")

		self.__CreateChatInputSet()
		self.__CreateWindow()
		self.__CreateButton()
		self.__CreateScrollBar()

		self.chatID = chat.CreateChatSet(chat.CHAT_SET_LOG_WINDOW)
		chat.SetBoardState(self.chatID, chat.BOARD_STATE_LOG)
		for i in self.CHAT_MODE_INDEX:
			chat.EnableChatMode(self.chatID, i)

		self.SetPosition(20, 20)
		self.SetSize(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT)
		self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH-self.btnSizing.GetWidth(), self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT-self.btnSizing.GetHeight()+2)

		self.OnResize()

	def __CreateChatInputSet(self):
		chatInputSet = ChatInputSet()
		chatInputSet.SetParent(self)
		chatInputSet.SetEscapeEvent(ui.__mem_func__(self.Close))
		chatInputSet.SetWindowVerticalAlignBottom()
		chatInputSet.Open()
		self.chatInputSet = chatInputSet

	def __CreateWindow(self):
		imgLeft = ui.ImageBox()
		imgLeft.AddFlag("not_pick")
		imgLeft.SetParent(self)				

		imgCenter = ui.ExpandedImageBox()
		imgCenter.AddFlag("not_pick")
		imgCenter.SetParent(self)
		
		imgRight = ui.ImageBox()
		imgRight.AddFlag("not_pick")
		imgRight.SetParent(self)			
		
		if locale.IsARABIC():
			imgLeft.LoadImage("locale/ae/ui/pattern/titlebar_left.tga")
			imgCenter.LoadImage("locale/ae/ui/pattern/titlebar_center.tga")
			imgRight.LoadImage("locale/ae/ui/pattern/titlebar_right.tga")
		else:
			imgLeft.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_left.tga")
			imgCenter.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_middle.tga")
			imgRight.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_right.tga")		

		imgLeft.Show()
		imgCenter.Show()
		imgRight.Show()

		btnClose = ui.Button()
		btnClose.SetParent(self)
		btnClose.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
		btnClose.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
		btnClose.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
		btnClose.SetToolTipText(locale.UI_CLOSE, 0, -23)
		btnClose.SetEvent(ui.__mem_func__(self.Close))
		btnClose.Show()

		btnSizing = self.ResizeButton()
		btnSizing.SetParent(self)
		btnSizing.SetMoveEvent(ui.__mem_func__(self.OnResize))
		btnSizing.SetSize(16, 16)
		btnSizing.Show()

		titleName = ui.TextLine()
		titleName.SetParent(self)
		
		if locale.IsARABIC():
			titleName.SetPosition(self.GetWidth()-20, 6)
		else:
			titleName.SetPosition(20, 6)
			
		titleName.SetText(locale.CHAT_LOG_TITLE)
		titleName.Show()

		self.imgLeft = imgLeft
		self.imgCenter = imgCenter
		self.imgRight = imgRight
		self.btnClose = btnClose
		self.btnSizing = btnSizing
		self.titleName = titleName

	def __CreateButton(self):
	
		if locale.IsARABIC():
			bx = 20
		else:
			bx = 13

		btnAll = ui.RadioButton()
		btnAll.SetParent(self)
		btnAll.SetPosition(bx, 24)
		btnAll.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
		btnAll.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
		btnAll.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
		btnAll.SetText(locale.CHAT_ALL)
		btnAll.SetEvent(ui.__mem_func__(self.ToggleAllChatMode))
		btnAll.Down()
		btnAll.Show()
		self.btnAll = btnAll

		x = bx + 48
		i = 0
		self.modeButtonList = []
		for name in self.CHAT_MODE_NAME:
			btn = ui.ToggleButton()
			btn.SetParent(self)
			btn.SetPosition(x, 24)
			btn.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
			btn.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
			btn.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
			btn.SetText(name)
			btn.Show()

			mode = self.CHAT_MODE_INDEX[i]
			btn.SetToggleUpEvent(lambda arg=mode: self.ToggleChatMode(arg))
			btn.SetToggleDownEvent(lambda arg=mode: self.ToggleChatMode(arg))
			self.modeButtonList.append(btn)

			x += 48
			i += 1

	def __CreateScrollBar(self):
		scrollBar = ui.SmallThinScrollBar()
		scrollBar.SetParent(self)
		scrollBar.Show()
		scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
		self.scrollBar = scrollBar
		self.scrollBarPos = 1.0

	def __del__(self):
		ui.Window.__del__(self)

	def Destroy(self):
		self.imgLeft = None
		self.imgCenter = None
		self.imgRight = None
		self.btnClose = None
		self.btnSizing = None
		self.modeButtonList = []
		self.scrollBar = None
		self.chatInputSet = None

	def ToggleAllChatMode(self):
		if self.allChatMode:
			return

		self.allChatMode = TRUE

		for i in self.CHAT_MODE_INDEX:
			chat.EnableChatMode(self.chatID, i)
		for btn in self.modeButtonList:
			btn.SetUp()

	def ToggleChatMode(self, mode):
		if self.allChatMode:
			self.allChatMode = FALSE
			for i in self.CHAT_MODE_INDEX:
				chat.DisableChatMode(self.chatID, i)
			chat.EnableChatMode(self.chatID, mode)
			self.btnAll.SetUp()

		else:
			chat.ToggleChatMode(self.chatID, mode)

	def SetSize(self, width, height):
		self.imgCenter.SetRenderingRect(0.0, 0.0, float((width - self.BLOCK_WIDTH*2) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0)
		self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
		self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)
		
		if locale.IsARABIC():
			self.titleName.SetPosition(self.GetWidth()-20, 3)
			self.btnClose.SetPosition(3, 3)
			self.scrollBar.SetPosition(1, 45)
		else:
			self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 5, 5)			
			self.scrollBar.SetPosition(width - 15, 45)
			
		self.scrollBar.SetScrollBarSize(height - 45 - 12)
		self.scrollBar.SetPos(self.scrollBarPos)
		ui.Window.SetSize(self, width, height)

	def Open(self):
		self.OnResize()
		self.chatInputSet.SetChatFocus()
		self.Show()

	def Close(self):
		if self.chatInputSet:
			self.chatInputSet.KillChatFocus()
		self.Hide()

	def OnResize(self):
		x, y = self.btnSizing.GetLocalPosition()
		width = self.btnSizing.GetWidth()
		height = self.btnSizing.GetHeight()

		if x < self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width:
			self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width, y)
			return
		if y < self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height:
			self.btnSizing.SetPosition(x, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height)
			return

		self.scrollBar.LockScroll()
		self.SetSize(x + width, y + height)
		self.scrollBar.UnlockScroll()

		if locale.IsARABIC():
			self.chatInputSet.SetPosition(20, 25)
		else:
			self.chatInputSet.SetPosition(0, 25)
			
		self.chatInputSet.SetSize(self.GetWidth() - 20, 20)
		self.chatInputSet.RefreshPosition()
		self.chatInputSet.SetChatMax(self.GetWidth() / 8)

	def OnScroll(self):
		self.scrollBarPos = self.scrollBar.GetPos()

		lineCount = chat.GetLineCount(self.chatID)
		visibleLineCount = chat.GetVisibleLineCount(self.chatID)
		endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

		chat.SetEndPos(self.chatID, self.scrollBarPos)

	def OnRender(self):
		(x, y, width, height) = self.GetRect()
		
		if locale.IsARABIC():
			grp.SetColor(0x77000000)
			grp.RenderBar(x+2, y+45, 13, height-45)
			
			grp.SetColor(0x77000000)
			grp.RenderBar(x, y, width, height)
			grp.SetColor(0xff525552)
			grp.RenderBox(x, y, width-2, height)
			grp.SetColor(0xff000000)
			grp.RenderBox(x+1, y+1, width-2, height)

			grp.SetColor(0xff989898)
			grp.RenderLine(x+width-13, y+height-1, 11, -11)
			grp.RenderLine(x+width-9, y+height-1, 7, -7)
			grp.RenderLine(x+width-5, y+height-1, 3, -3)
		else:			
			grp.SetColor(0x77000000)
			grp.RenderBar(x+width-15, y+45, 13, height-45)

			grp.SetColor(0x77000000)
			grp.RenderBar(x, y, width, height)
			grp.SetColor(0xff525552)
			grp.RenderBox(x, y, width-2, height)
			grp.SetColor(0xff000000)
			grp.RenderBox(x+1, y+1, width-2, height)

			grp.SetColor(0xff989898)
			grp.RenderLine(x+width-13, y+height-1, 11, -11)
			grp.RenderLine(x+width-9, y+height-1, 7, -7)
			grp.RenderLine(x+width-5, y+height-1, 3, -3)

		#####

		chat.ArrangeShowingChat(self.chatID)

		if locale.IsARABIC():
			chat.SetPosition(self.chatID, x + width - 10, y + height - 25)
		else:
			chat.SetPosition(self.chatID, x + 10, y + height - 25)

		chat.SetHeight(self.chatID, height - 45 - 25)
		chat.Update(self.chatID)
		chat.Render(self.chatID)

	def OnPressEscapeKey(self):
		self.Close()
		return TRUE

	def BindInterface(self, interface):
		self.interface = interface
		
	def OnMouseLeftButtonDown(self):
		hyperlink = ui.GetHyperlink()
		if hyperlink:
			if app.IsPressed(app.DIK_LALT):
				link = chat.GetLinkFromHyperlink(hyperlink)
				ime.PasteString(link)
			else:
				self.interface.MakeHyperlinkTooltip(hyperlink)

Gata
Avatar utilizator
Marggraf
Utilizator interzis !

Utilizator interzis !
Mesaje: 1074
Membru din: 25 Mai 2014, 12:46
Server: loading...
Regat: Shinsoo
Aprecieri: 36  
Mulţumiri: 36  
Medalii

ia vezi boss

Cod: Selectaţi tot

import ui
import grp
import chat
import wndMgr
import net
import app
import ime
import locale
import colorInfo
import constInfo
import systemSetting
import player

ENABLE_CHAT_COMMAND = TRUE
ENABLE_LAST_SENTENCE_STACK = TRUE
ENABLE_INSULT_CHECK = TRUE

if locale.IsHONGKONG():
   ENABLE_LAST_SENTENCE_STACK = TRUE

if locale.IsEUROPE():
   ENABLE_CHAT_COMMAND = FALSE

if locale.IsCANADA():
   ENABLE_LAST_SENTENCE_STACK = FALSE

chatInputSetList = []
def InsertChatInputSetWindow(wnd):
   global chatInputSetList
   chatInputSetList.append(wnd)
def RefreshChatMode():
   global chatInputSetList
   map(lambda wnd:wnd.OnRefreshChatMode(), chatInputSetList)
def DestroyChatInputSetWindow():
   global chatInputSetList
   chatInputSetList = []

## ChatModeButton
class ChatModeButton(ui.Window):

   OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)
   OVER_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 0.3)
   BUTTON_STATE_UP = 0
   BUTTON_STATE_OVER = 1
   BUTTON_STATE_DOWN = 2

   def __init__(self):
      ui.Window.__init__(self)
      self.state = None
      self.buttonText = None
      self.event = None

      net.EnableChatInsultFilter(ENABLE_INSULT_CHECK)

   def __del__(self):
      ui.Window.__del__(self)

   def SAFE_SetEvent(self, event):
      self.event=ui.__mem_func__(event)

   def SetText(self, text):
      if None == self.buttonText:
         textLine = ui.TextLine()
         textLine.SetParent(self)
         textLine.SetWindowHorizontalAlignCenter()
         textLine.SetWindowVerticalAlignCenter()
         textLine.SetVerticalAlignCenter()
         textLine.SetHorizontalAlignCenter()
         textLine.SetPackedFontColor(self.OUTLINE_COLOR)
         textLine.Show()
         self.buttonText = textLine

      self.buttonText.SetText(text)

   def SetSize(self, width, height):
      self.width = width
      self.height = height
      ui.Window.SetSize(self, width, height)

   def OnMouseOverIn(self):
      self.state = self.BUTTON_STATE_OVER

   def OnMouseOverOut(self):
      self.state = self.BUTTON_STATE_UP

   def OnMouseLeftButtonDown(self):
      self.state = self.BUTTON_STATE_DOWN

   def OnMouseLeftButtonUp(self):
      self.state = self.BUTTON_STATE_UP
      if self.IsIn():
         self.state = self.BUTTON_STATE_OVER

      if None != self.event:
         self.event()

   def OnRender(self):

      (x, y) = self.GetGlobalPosition()

      grp.SetColor(self.OUTLINE_COLOR)
      grp.RenderRoundBox(x, y, self.width, self.height)

      if self.state >= self.BUTTON_STATE_OVER:
         grp.RenderRoundBox(x+1, y, self.width-2, self.height)
         grp.RenderRoundBox(x, y+1, self.width, self.height-2)

         if self.BUTTON_STATE_DOWN == self.state:
            grp.SetColor(self.OVER_COLOR)
            grp.RenderBar(x+1, y+1, self.width-2, self.height-2)

## ChatLine
class ChatLine(ui.EditLine):

   CHAT_MODE_NAME = {   chat.CHAT_TYPE_TALKING : locale.CHAT_NORMAL,
                  chat.CHAT_TYPE_PARTY : locale.CHAT_PARTY,
                  chat.CHAT_TYPE_GUILD : locale.CHAT_GUILD,
                  chat.CHAT_TYPE_SHOUT : locale.CHAT_SHOUT, }

   def __init__(self):
      ui.EditLine.__init__(self)
      self.SetWindowName("Chat Line")
      self.lastShoutTime = 0
      self.eventEscape = lambda *arg: None
      self.eventReturn = lambda *arg: None
      self.eventTab = None
      self.chatMode = chat.CHAT_TYPE_TALKING
      self.bCodePage = TRUE

      self.overTextLine = ui.TextLine()
      self.overTextLine.SetParent(self)
      self.overTextLine.SetPosition(-1, 0)
      self.overTextLine.SetFontColor(1.0, 1.0, 0.0)
      self.overTextLine.SetOutline()
      self.overTextLine.Hide()

      self.lastSentenceStack = []
      self.lastSentencePos = 0

   def SetChatMode(self, mode):
      self.chatMode = mode

   def GetChatMode(self):
      return self.chatMode

   def ChangeChatMode(self):
      if chat.CHAT_TYPE_TALKING == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_PARTY)
         self.SetText("#")
         self.SetEndPosition()

      elif chat.CHAT_TYPE_PARTY == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_GUILD)
         self.SetText("%")
         self.SetEndPosition()

      elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_SHOUT)
         self.SetText("!")
         self.SetEndPosition()

      elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_TALKING)
         self.SetText("")

      self.__CheckChatMark()

   def GetCurrentChatModeName(self):
      try:
         return self.CHAT_MODE_NAME[self.chatMode]
      except:
         import exception
         exception.Abort("ChatLine.GetCurrentChatModeName")

   def SAFE_SetEscapeEvent(self, event):
      self.eventReturn = ui.__mem_func__(event)

   def SAFE_SetReturnEvent(self, event):
      self.eventEscape = ui.__mem_func__(event)

   def SAFE_SetTabEvent(self, event):
      self.eventTab = ui.__mem_func__(event)

   def SetTabEvent(self, event):
      self.eventTab = event

   def OpenChat(self):
      self.SetFocus()
      self.__ResetChat()

   def __ClearChat(self):
      self.SetText("")
      self.lastSentencePos = 0

   def __ResetChat(self):
      if chat.CHAT_TYPE_PARTY == self.GetChatMode():
         self.SetText("#")
         self.SetEndPosition()
      elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
         self.SetText("%")
         self.SetEndPosition()
      elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
         self.SetText("!")
         self.SetEndPosition()
      else:
         self.__ClearChat()

      self.__CheckChatMark()
      

   def __SendChatPacket(self, text, type):
                if net.IsChatInsultIn(text):
                        chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)
                else:
                        name = player.GetName()
                        if type == chat.CHAT_TYPE_SHOUT:
                                if name.find("[") !=-1:
                                        empire_id = "|cffffc700|H|h[Staff]|cFFA7FFD4|H|h"
                                else:
                                        empire_id = str(net.GetEmpireID())
                                        if empire_id == "1":
                                                empire_id = "|cFFFF0000|H|h[Sinshoo]|cFFA7FFD4|H|h"
                                        elif empire_id == "2":
                                                empire_id = "|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h"
                                        elif empire_id == "3":
                                                empire_id = "|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"
 
                                text = empire_id + text

   def __SendShoutChatPacket(self, text):

      if 1 == len(text):
         self.RunCloseEvent()
         return

      if app.GetTime() < self.lastShoutTime + 15:
         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_SHOUT_LIMIT)
         self.__ResetChat()
         return

      self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT)
      self.__ResetChat()

      self.lastShoutTime = app.GetTime()

   def __SendTalkingChatPacket(self, text):
      if text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and text[2] == ' ':
         newtext = text.split(' ', 1)
         net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
         self.__ResetChat()
      elif text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and (text[2] == 'o' or text[2] == 'O') and (text[3] == 't' or text[3] == 'T') and (text[4] == 'i' or text[4] == 'I') and (text[5] == 'c' or text[5] == 'C') and (text[6] == 'e' or text[6] == 'E') and text[7] == ' ':
         newtext = text.split(' ', 1)
         net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
         self.__ResetChat()
      else:
         self.__SendChatPacket(text, chat.CHAT_TYPE_TALKING)
         self.__ResetChat()

   def OnIMETab(self):
      #if None != self.eventTab:
      #   self.eventTab()
      #return TRUE
      return FALSE

   def OnIMEUpdate(self):
      ui.EditLine.OnIMEUpdate(self)
      self.__CheckChatMark()

   def __CheckChatMark(self):

      self.overTextLine.Hide()

      text = self.GetText()
      if len(text) > 0:
         if '#' == text[0]:
            self.overTextLine.SetText("#")
            self.overTextLine.Show()
         elif '%' == text[0]:
            self.overTextLine.SetText("%")
            self.overTextLine.Show()
         elif '!' == text[0]:
            self.overTextLine.SetText("!")
            self.overTextLine.Show()

   def OnIMEKeyDown(self, key):
      # LAST_SENTENCE_STACK
      if app.VK_UP == key:
         self.__PrevLastSentenceStack()
         return TRUE

      if app.VK_DOWN == key:
         self.__NextLastSentenceStack()            
         return TRUE         
      # END_OF_LAST_SENTENCE_STACK

      ui.EditLine.OnIMEKeyDown(self, key)

   # LAST_SENTENCE_STACK
   def __PrevLastSentenceStack(self):
      global ENABLE_LAST_SENTENCE_STACK
      if not ENABLE_LAST_SENTENCE_STACK:
         return

      if self.lastSentenceStack and self.lastSentencePos < len(self.lastSentenceStack):
         self.lastSentencePos += 1
         lastSentence = self.lastSentenceStack[-self.lastSentencePos]
         self.SetText(lastSentence)            
         self.SetEndPosition()         

   def __NextLastSentenceStack(self):
      global ENABLE_LAST_SENTENCE_STACK
      if not ENABLE_LAST_SENTENCE_STACK:
         return

      if self.lastSentenceStack and self.lastSentencePos > 1:
         self.lastSentencePos -= 1
         lastSentence = self.lastSentenceStack[-self.lastSentencePos]
         self.SetText(lastSentence)            
         self.SetEndPosition()         

   def __PushLastSentenceStack(self, text):      
      global ENABLE_LAST_SENTENCE_STACK
      if not ENABLE_LAST_SENTENCE_STACK:
         return

      if len(text) <= 0:
         return
         
      LAST_SENTENCE_STACK_SIZE = 32
      if len(self.lastSentenceStack) > LAST_SENTENCE_STACK_SIZE:
         self.lastSentenceStack.pop(0)

      self.lastSentenceStack.append(text)
   # END_OF_LAST_SENTENCE_STACK

   def OnIMEReturn(self):
      text = self.GetText()
      textLen=len(text)

      # LAST_SENTENCE_STACK
      self.__PushLastSentenceStack(text)
      # END_OF_LAST_SENTENCE_STACK
            
      textSpaceCount=text.count(' ')

      if (textLen > 0) and (textLen != textSpaceCount):
         if '#' == text[0]:
            self.__SendPartyChatPacket(text)
         elif '%' == text[0]:
            self.__SendGuildChatPacket(text)
         elif '!' == text[0]:
            self.__SendShoutChatPacket(text)
         else:
            self.__SendTalkingChatPacket(text)
      else:
         self.__ClearChat()
         self.eventReturn()

      return TRUE

   def OnPressEscapeKey(self):
      self.__ClearChat()
      self.eventEscape()
      return TRUE

   def RunCloseEvent(self):
      self.eventEscape()

   def BindInterface(self, interface):
      self.interface = interface

   def OnMouseLeftButtonDown(self):
      hyperlink = ui.GetHyperlink()
      if hyperlink:
         if app.IsPressed(app.DIK_LALT):
            link = chat.GetLinkFromHyperlink(hyperlink)
            ime.PasteString(link)
         else:
            self.interface.MakeHyperlinkTooltip(hyperlink)
      else:
         ui.EditLine.OnMouseLeftButtonDown(self)

class ChatInputSet(ui.Window):

   CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

   def __init__(self):
      ui.Window.__init__(self)

      InsertChatInputSetWindow(self)
      self.__Create()

   def __del__(self):
      ui.Window.__del__(self)

   def __Create(self):
      chatModeButton = ChatModeButton()
      chatModeButton.SetParent(self)
      chatModeButton.SetSize(40, 17)
      chatModeButton.SetText(locale.CHAT_NORMAL)
      chatModeButton.SetPosition(7, 2)
      chatModeButton.SAFE_SetEvent(self.OnChangeChatMode)
      self.chatModeButton = chatModeButton

      chatLine = ChatLine()
      chatLine.SetParent(self)
      chatLine.SetMax(512)
      chatLine.SetUserMax(76)
      chatLine.SetText("")
      chatLine.SAFE_SetTabEvent(self.OnChangeChatMode)
      chatLine.x = 0
      chatLine.y = 0
      chatLine.width = 0
      chatLine.height = 0
      self.chatLine = chatLine

      btnSend = ui.Button()
      btnSend.SetParent(self)
      btnSend.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_01.sub")
      btnSend.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_02.sub")
      btnSend.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_03.sub")
      btnSend.SetToolTipText(locale.CHAT_SEND_CHAT)
      btnSend.SAFE_SetEvent(self.chatLine.OnIMEReturn)
      self.btnSend = btnSend

   def Destroy(self):
      self.chatModeButton = None
      self.chatLine = None
      self.btnSend = None

   def Open(self):
      self.chatLine.Show()
      self.chatLine.SetPosition(57, 5)
      self.chatLine.SetFocus()
      self.chatLine.OpenChat()

      self.chatModeButton.SetPosition(7, 2)
      self.chatModeButton.Show()

      self.btnSend.Show()
      self.Show()

      self.RefreshPosition()
      return TRUE

   def Close(self):
      self.chatLine.KillFocus()
      self.chatLine.Hide()
      self.chatModeButton.Hide()
      self.btnSend.Hide()
      self.Hide()
      return TRUE

   def SetEscapeEvent(self, event):
      self.chatLine.SetEscapeEvent(event)

   def SetReturnEvent(self, event):
      self.chatLine.SetReturnEvent(event)

   def OnChangeChatMode(self):
      RefreshChatMode()

   def OnRefreshChatMode(self):
      self.chatLine.ChangeChatMode()
      self.chatModeButton.SetText(self.chatLine.GetCurrentChatModeName())

   def SetChatFocus(self):
      self.chatLine.SetFocus()

   def KillChatFocus(self):
      self.chatLine.KillFocus()

   def SetChatMax(self, max):
      self.chatLine.SetUserMax(max)

   def RefreshPosition(self):
      if locale.IsARABIC():
         self.chatLine.SetSize(self.GetWidth() - 93, 18)
      else:
         self.chatLine.SetSize(self.GetWidth() - 93, 13)

      self.btnSend.SetPosition(self.GetWidth() - 25, 2)

      (self.chatLine.x, self.chatLine.y, self.chatLine.width, self.chatLine.height) = self.chatLine.GetRect()

   def BindInterface(self, interface):
      self.chatLine.BindInterface(interface)

   def OnRender(self):
      (x, y, width, height) = self.chatLine.GetRect()
      ui.RenderRoundBox(x-4, y-3, width+7, height+4, self.CHAT_OUTLINE_COLOR)

## ChatWindow
class ChatWindow(ui.Window):

   BOARD_START_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.0)
   BOARD_END_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.8)
   BOARD_MIDDLE_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.5)
   CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

   EDIT_LINE_HEIGHT = 25

   class ChatBackBoard(ui.Window):
      def __init__(self):
         ui.Window.__init__(self)
      def __del__(self):
         ui.Window.__del__(self)

   class ChatButton(ui.DragButton):

      def __init__(self):
         ui.DragButton.__init__(self)
         self.AddFlag("float")
         self.AddFlag("movable")
         self.AddFlag("restrict_x")
         self.topFlag = FALSE

      def __del__(self):
         ui.DragButton.__del__(self)

      def SetOwner(self, owner):
         self.owner = owner

      def OnMouseOverIn(self):
         app.SetCursor(app.VSIZE)

      def OnMouseOverOut(self):
         app.SetCursor(app.NORMAL)

      def OnTop(self):
         if TRUE == self.topFlag:
            return

         self.topFlag = TRUE
         self.owner.SetTop()
         self.topFlag = FALSE

   def __init__(self):
      ui.Window.__init__(self)
      self.AddFlag("float")

      self.__RegisterChatColorDict()

      self.boardState = chat.BOARD_STATE_VIEW
      self.chatID = chat.CreateChatSet(chat.CHAT_SET_CHAT_WINDOW)
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)

      self.xBar = 0
      self.yBar = 0
      self.widthBar = 0
      self.heightBar = 0
      self.curHeightBar = 0
      self.visibleLineCount = 0
      self.scrollBarPos = 1.0
      self.scrollLock = FALSE

      chatInputSet = ChatInputSet()
      chatInputSet.SetParent(self)
      chatInputSet.SetEscapeEvent(ui.__mem_func__(self.CloseChat))
      chatInputSet.SetReturnEvent(ui.__mem_func__(self.CloseChat))
      chatInputSet.SetSize(550, 25)
      self.chatInputSet = chatInputSet

      btnSendWhisper = ui.Button()
      btnSendWhisper.SetParent(self)
      btnSendWhisper.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_01.sub")
      btnSendWhisper.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_02.sub")
      btnSendWhisper.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_03.sub")
      btnSendWhisper.SetToolTipText(locale.CHAT_SEND_MEMO)
      btnSendWhisper.Hide()
      self.btnSendWhisper = btnSendWhisper

      btnChatLog = ui.Button()
      btnChatLog.SetParent(self)
      btnChatLog.SetUpVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_01.sub")
      btnChatLog.SetOverVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_02.sub")
      btnChatLog.SetDownVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_03.sub")
      btnChatLog.SetToolTipText(locale.CHAT_LOG)
      btnChatLog.Hide()
      self.btnChatLog = btnChatLog

      btnChatSizing = self.ChatButton()
      btnChatSizing.SetOwner(self)
      btnChatSizing.SetMoveEvent(ui.__mem_func__(self.Refresh))
      btnChatSizing.Hide()
      self.btnChatSizing = btnChatSizing

      imgChatBarLeft = ui.ImageBox()
      imgChatBarLeft.SetParent(self.btnChatSizing)
      imgChatBarLeft.AddFlag("not_pick")
      imgChatBarLeft.LoadImage("d:/ymir work/ui/pattern/chat_bar_left.tga")
      imgChatBarLeft.Show()
      self.imgChatBarLeft = imgChatBarLeft
      imgChatBarRight = ui.ImageBox()
      imgChatBarRight.SetParent(self.btnChatSizing)
      imgChatBarRight.AddFlag("not_pick")
      imgChatBarRight.LoadImage("d:/ymir work/ui/pattern/chat_bar_right.tga")
      imgChatBarRight.Show()
      self.imgChatBarRight = imgChatBarRight
      imgChatBarMiddle = ui.ExpandedImageBox()
      imgChatBarMiddle.SetParent(self.btnChatSizing)
      imgChatBarMiddle.AddFlag("not_pick")
      imgChatBarMiddle.LoadImage("d:/ymir work/ui/pattern/chat_bar_middle.tga")
      imgChatBarMiddle.Show()
      self.imgChatBarMiddle = imgChatBarMiddle

      scrollBar = ui.ScrollBar()
      scrollBar.AddFlag("float")
      scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
      self.scrollBar = scrollBar

      self.Refresh()
      self.chatInputSet.RefreshPosition() # RTL ? ??? ??? ???? ?? ??? ????
   
   def __del__(self):
      ui.Window.__del__(self)

   def __RegisterChatColorDict(self):
      CHAT_COLOR_DICT = {
         chat.CHAT_TYPE_TALKING : colorInfo.CHAT_RGB_TALK,
         chat.CHAT_TYPE_INFO : colorInfo.CHAT_RGB_INFO,
         chat.CHAT_TYPE_NOTICE : colorInfo.CHAT_RGB_NOTICE,
         chat.CHAT_TYPE_PARTY : colorInfo.CHAT_RGB_PARTY,
         chat.CHAT_TYPE_GUILD : colorInfo.CHAT_RGB_GUILD,
         chat.CHAT_TYPE_COMMAND : colorInfo.CHAT_RGB_COMMAND,
         chat.CHAT_TYPE_SHOUT : colorInfo.CHAT_RGB_SHOUT,
         chat.CHAT_TYPE_WHISPER : colorInfo.CHAT_RGB_WHISPER,
      }

      for colorItem in CHAT_COLOR_DICT.items():
         type=colorItem[0]
         rgb=colorItem[1]
         chat.SetChatColor(type, rgb[0], rgb[1], rgb[2])

   def Destroy(self):
      self.chatInputSet.Destroy()
      self.chatInputSet = None

      self.btnSendWhisper = 0
      self.btnChatLog = 0
      self.btnChatSizing = 0

   ################
   ## Open & Close
   def OpenChat(self):
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_EDIT)
      self.boardState = chat.BOARD_STATE_EDIT

      (x, y, width, height) = self.GetRect()
      (btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y)
      else:   
         chat.SetPosition(self.chatID, x + 10, y)

      chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

      if self.IsShow():
         self.btnChatSizing.Show()

      self.Refresh()

      self.btnSendWhisper.SetPosition(self.GetWidth() - 50, 2)
      self.btnSendWhisper.Show()

      self.btnChatLog.SetPosition(self.GetWidth() - 25, 2)
      self.btnChatLog.Show()

      self.chatInputSet.Open()
      self.SetTop()

   def CloseChat(self):
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)
      self.boardState = chat.BOARD_STATE_VIEW

      (x, y, width, height) = self.GetRect()

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y + height)
      else:
         chat.SetPosition(self.chatID, x + 10, y + height)

      self.chatInputSet.Close()
      self.btnSendWhisper.Hide()
      self.btnChatLog.Hide()
      self.btnChatSizing.Hide()
      self.Refresh()

   def SetSendWhisperEvent(self, event):
      self.btnSendWhisper.SetEvent(event)

   def SetOpenChatLogEvent(self, event):
      self.btnChatLog.SetEvent(event)

   def IsEditMode(self):
      if chat.BOARD_STATE_EDIT == self.boardState:
         return TRUE

      return FALSE

   def __RefreshSizingBar(self):
      (x, y, width, height) = self.GetRect()
      gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
      self.btnChatSizing.SetPosition(x, gyChat)
      self.btnChatSizing.SetSize(width, 22)
      self.imgChatBarLeft.SetPosition(0, 0)
      self.imgChatBarRight.SetPosition(width - 64, 0)
      self.imgChatBarMiddle.SetPosition(64, 0)
      self.imgChatBarMiddle.SetRenderingRect(0.0, 0.0, float(width - 128) / 64.0 - 1.0, 0.0)

   def SetPosition(self, x, y):
      ui.Window.SetPosition(self, x, y)
      self.__RefreshSizingBar()

   def SetSize(self, width, height):
      ui.Window.SetSize(self, width, height)
      self.__RefreshSizingBar()

   def SetHeight(self, height):
      gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
      self.btnChatSizing.SetPosition(gxChat, wndMgr.GetScreenHeight() - height)

   ###########
   ## Refresh
   def Refresh(self):
      if self.boardState == chat.BOARD_STATE_EDIT:
         self.RefreshBoardEditState()
      elif self.boardState == chat.BOARD_STATE_VIEW:
         self.RefreshBoardViewState()

   def RefreshBoardEditState(self):

      (x, y, width, height) = self.GetRect()
      (btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

      self.xBar = x
      self.yBar = btnY
      self.widthBar = width
      self.heightBar = y - btnY + self.EDIT_LINE_HEIGHT
      self.curHeightBar = self.heightBar

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y)
      else:
         chat.SetPosition(self.chatID, x + 10, y)

      chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT)
      chat.ArrangeShowingChat(self.chatID)

      if btnY > y:
         self.btnChatSizing.SetPosition(btnX, y)
         self.heightBar = self.EDIT_LINE_HEIGHT

   def RefreshBoardViewState(self):
      (x, y, width, height) = self.GetRect()
      (btnX, btnY) = self.btnChatSizing.GetGlobalPosition()
      textAreaHeight = self.visibleLineCount * chat.GetLineStep(self.chatID)

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y + height)
      else:
         chat.SetPosition(self.chatID, x + 10, y + height)

      chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

      if self.boardState == chat.BOARD_STATE_EDIT:
         textAreaHeight += 45
      elif self.visibleLineCount != 0:
         textAreaHeight += 10 + 10

      self.xBar = x
      self.yBar = y + height - textAreaHeight
      self.widthBar = width
      self.heightBar = textAreaHeight

      self.scrollBar.Hide()

   ##########
   ## Render
   def OnUpdate(self):
      if self.boardState == chat.BOARD_STATE_EDIT:
         chat.Update(self.chatID)
      elif self.boardState == chat.BOARD_STATE_VIEW:
         if systemSetting.IsViewChat():
            chat.Update(self.chatID)

   def OnRender(self):
      if chat.GetVisibleLineCount(self.chatID) != self.visibleLineCount:
         self.visibleLineCount = chat.GetVisibleLineCount(self.chatID)
         self.Refresh()

      if self.curHeightBar != self.heightBar:
         self.curHeightBar += (self.heightBar - self.curHeightBar) / 10

      if self.boardState == chat.BOARD_STATE_EDIT:
         grp.SetColor(self.BOARD_MIDDLE_COLOR)
         grp.RenderBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar) + 10, self.widthBar, self.curHeightBar)
         chat.Render(self.chatID)
      elif self.boardState == chat.BOARD_STATE_VIEW:
         if systemSetting.IsViewChat():
            grp.RenderGradationBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar), self.widthBar, self.curHeightBar, self.BOARD_START_COLOR, self.BOARD_END_COLOR)
            chat.Render(self.chatID)

   ##########
   ## Event
   def OnTop(self):
      self.btnChatSizing.SetTop()
      self.scrollBar.SetTop()

   def OnScroll(self):
      if not self.scrollLock:
         self.scrollBarPos = self.scrollBar.GetPos()

      lineCount = chat.GetLineCount(self.chatID)
      visibleLineCount = chat.GetVisibleLineCount(self.chatID)
      endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

      chat.SetEndPos(self.chatID, self.scrollBarPos)

   def OnChangeChatMode(self):
      self.chatInputSet.OnChangeChatMode()

   def SetChatFocus(self):
      self.chatInputSet.SetChatFocus()         

   def BindInterface(self, interface):
      self.chatInputSet.BindInterface(interface)

## ChatLogWindow
class ChatLogWindow(ui.Window):

   BLOCK_WIDTH = 32
   CHAT_MODE_NAME = ( locale.CHAT_NORMAL, locale.CHAT_PARTY, locale.CHAT_GUILD, locale.CHAT_SHOUT, locale.CHAT_INFORMATION, locale.CHAT_NOTICE, )
   CHAT_MODE_INDEX = ( chat.CHAT_TYPE_TALKING,
                  chat.CHAT_TYPE_PARTY,
                  chat.CHAT_TYPE_GUILD,
                  chat.CHAT_TYPE_SHOUT,
                  chat.CHAT_TYPE_INFO,
                  chat.CHAT_TYPE_NOTICE, )

   CHAT_LOG_WINDOW_MINIMUM_WIDTH = 450
   CHAT_LOG_WINDOW_MINIMUM_HEIGHT = 120

   class ResizeButton(ui.DragButton):

      def __init__(self):
         ui.DragButton.__init__(self)

      def __del__(self):
         ui.DragButton.__del__(self)

      def OnMouseOverIn(self):
         app.SetCursor(app.HVSIZE)

      def OnMouseOverOut(self):
         app.SetCursor(app.NORMAL)

   def __init__(self):

      self.allChatMode = TRUE
      self.chatInputSet = None

      ui.Window.__init__(self)
      self.AddFlag("float")
      self.AddFlag("movable")

      self.__CreateChatInputSet()
      self.__CreateWindow()
      self.__CreateButton()
      self.__CreateScrollBar()

      self.chatID = chat.CreateChatSet(chat.CHAT_SET_LOG_WINDOW)
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_LOG)
      for i in self.CHAT_MODE_INDEX:
         chat.EnableChatMode(self.chatID, i)

      self.SetPosition(20, 20)
      self.SetSize(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT)
      self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH-self.btnSizing.GetWidth(), self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT-self.btnSizing.GetHeight()+2)

      self.OnResize()

   def __CreateChatInputSet(self):
      chatInputSet = ChatInputSet()
      chatInputSet.SetParent(self)
      chatInputSet.SetEscapeEvent(ui.__mem_func__(self.Close))
      chatInputSet.SetWindowVerticalAlignBottom()
      chatInputSet.Open()
      self.chatInputSet = chatInputSet

   def __CreateWindow(self):
      imgLeft = ui.ImageBox()
      imgLeft.AddFlag("not_pick")
      imgLeft.SetParent(self)            

      imgCenter = ui.ExpandedImageBox()
      imgCenter.AddFlag("not_pick")
      imgCenter.SetParent(self)
      
      imgRight = ui.ImageBox()
      imgRight.AddFlag("not_pick")
      imgRight.SetParent(self)         
      
      if locale.IsARABIC():
         imgLeft.LoadImage("locale/ae/ui/pattern/titlebar_left.tga")
         imgCenter.LoadImage("locale/ae/ui/pattern/titlebar_center.tga")
         imgRight.LoadImage("locale/ae/ui/pattern/titlebar_right.tga")
      else:
         imgLeft.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_left.tga")
         imgCenter.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_middle.tga")
         imgRight.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_right.tga")      

      imgLeft.Show()
      imgCenter.Show()
      imgRight.Show()

      btnClose = ui.Button()
      btnClose.SetParent(self)
      btnClose.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
      btnClose.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
      btnClose.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
      btnClose.SetToolTipText(locale.UI_CLOSE, 0, -23)
      btnClose.SetEvent(ui.__mem_func__(self.Close))
      btnClose.Show()

      btnSizing = self.ResizeButton()
      btnSizing.SetParent(self)
      btnSizing.SetMoveEvent(ui.__mem_func__(self.OnResize))
      btnSizing.SetSize(16, 16)
      btnSizing.Show()

      titleName = ui.TextLine()
      titleName.SetParent(self)
      
      if locale.IsARABIC():
         titleName.SetPosition(self.GetWidth()-20, 6)
      else:
         titleName.SetPosition(20, 6)
         
      titleName.SetText(locale.CHAT_LOG_TITLE)
      titleName.Show()

      self.imgLeft = imgLeft
      self.imgCenter = imgCenter
      self.imgRight = imgRight
      self.btnClose = btnClose
      self.btnSizing = btnSizing
      self.titleName = titleName

   def __CreateButton(self):
   
      if locale.IsARABIC():
         bx = 20
      else:
         bx = 13

      btnAll = ui.RadioButton()
      btnAll.SetParent(self)
      btnAll.SetPosition(bx, 24)
      btnAll.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
      btnAll.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
      btnAll.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
      btnAll.SetText(locale.CHAT_ALL)
      btnAll.SetEvent(ui.__mem_func__(self.ToggleAllChatMode))
      btnAll.Down()
      btnAll.Show()
      self.btnAll = btnAll

      x = bx + 48
      i = 0
      self.modeButtonList = []
      for name in self.CHAT_MODE_NAME:
         btn = ui.ToggleButton()
         btn.SetParent(self)
         btn.SetPosition(x, 24)
         btn.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
         btn.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
         btn.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
         btn.SetText(name)
         btn.Show()

         mode = self.CHAT_MODE_INDEX[i]
         btn.SetToggleUpEvent(lambda arg=mode: self.ToggleChatMode(arg))
         btn.SetToggleDownEvent(lambda arg=mode: self.ToggleChatMode(arg))
         self.modeButtonList.append(btn)

         x += 48
         i += 1

   def __CreateScrollBar(self):
      scrollBar = ui.SmallThinScrollBar()
      scrollBar.SetParent(self)
      scrollBar.Show()
      scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
      self.scrollBar = scrollBar
      self.scrollBarPos = 1.0

   def __del__(self):
      ui.Window.__del__(self)

   def Destroy(self):
      self.imgLeft = None
      self.imgCenter = None
      self.imgRight = None
      self.btnClose = None
      self.btnSizing = None
      self.modeButtonList = []
      self.scrollBar = None
      self.chatInputSet = None

   def ToggleAllChatMode(self):
      if self.allChatMode:
         return

      self.allChatMode = TRUE

      for i in self.CHAT_MODE_INDEX:
         chat.EnableChatMode(self.chatID, i)
      for btn in self.modeButtonList:
         btn.SetUp()

   def ToggleChatMode(self, mode):
      if self.allChatMode:
         self.allChatMode = FALSE
         for i in self.CHAT_MODE_INDEX:
            chat.DisableChatMode(self.chatID, i)
         chat.EnableChatMode(self.chatID, mode)
         self.btnAll.SetUp()

      else:
         chat.ToggleChatMode(self.chatID, mode)

   def SetSize(self, width, height):
      self.imgCenter.SetRenderingRect(0.0, 0.0, float((width - self.BLOCK_WIDTH*2) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0)
      self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
      self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)
      
      if locale.IsARABIC():
         self.titleName.SetPosition(self.GetWidth()-20, 3)
         self.btnClose.SetPosition(3, 3)
         self.scrollBar.SetPosition(1, 45)
      else:
         self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 5, 5)         
         self.scrollBar.SetPosition(width - 15, 45)
         
      self.scrollBar.SetScrollBarSize(height - 45 - 12)
      self.scrollBar.SetPos(self.scrollBarPos)
      ui.Window.SetSize(self, width, height)

   def Open(self):
      self.OnResize()
      self.chatInputSet.SetChatFocus()
      self.Show()

   def Close(self):
      if self.chatInputSet:
         self.chatInputSet.KillChatFocus()
      self.Hide()

   def OnResize(self):
      x, y = self.btnSizing.GetLocalPosition()
      width = self.btnSizing.GetWidth()
      height = self.btnSizing.GetHeight()

      if x < self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width:
         self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width, y)
         return
      if y < self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height:
         self.btnSizing.SetPosition(x, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height)
         return

      self.scrollBar.LockScroll()
      self.SetSize(x + width, y + height)
      self.scrollBar.UnlockScroll()

      if locale.IsARABIC():
         self.chatInputSet.SetPosition(20, 25)
      else:
         self.chatInputSet.SetPosition(0, 25)
         
      self.chatInputSet.SetSize(self.GetWidth() - 20, 20)
      self.chatInputSet.RefreshPosition()
      self.chatInputSet.SetChatMax(self.GetWidth() / 8)

   def OnScroll(self):
      self.scrollBarPos = self.scrollBar.GetPos()

      lineCount = chat.GetLineCount(self.chatID)
      visibleLineCount = chat.GetVisibleLineCount(self.chatID)
      endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

      chat.SetEndPos(self.chatID, self.scrollBarPos)

   def OnRender(self):
      (x, y, width, height) = self.GetRect()
      
      if locale.IsARABIC():
         grp.SetColor(0x77000000)
         grp.RenderBar(x+2, y+45, 13, height-45)
         
         grp.SetColor(0x77000000)
         grp.RenderBar(x, y, width, height)
         grp.SetColor(0xff525552)
         grp.RenderBox(x, y, width-2, height)
         grp.SetColor(0xff000000)
         grp.RenderBox(x+1, y+1, width-2, height)

         grp.SetColor(0xff989898)
         grp.RenderLine(x+width-13, y+height-1, 11, -11)
         grp.RenderLine(x+width-9, y+height-1, 7, -7)
         grp.RenderLine(x+width-5, y+height-1, 3, -3)
      else:         
         grp.SetColor(0x77000000)
         grp.RenderBar(x+width-15, y+45, 13, height-45)

         grp.SetColor(0x77000000)
         grp.RenderBar(x, y, width, height)
         grp.SetColor(0xff525552)
         grp.RenderBox(x, y, width-2, height)
         grp.SetColor(0xff000000)
         grp.RenderBox(x+1, y+1, width-2, height)

         grp.SetColor(0xff989898)
         grp.RenderLine(x+width-13, y+height-1, 11, -11)
         grp.RenderLine(x+width-9, y+height-1, 7, -7)
         grp.RenderLine(x+width-5, y+height-1, 3, -3)

      #####

      chat.ArrangeShowingChat(self.chatID)

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y + height - 25)
      else:
         chat.SetPosition(self.chatID, x + 10, y + height - 25)

      chat.SetHeight(self.chatID, height - 45 - 25)
      chat.Update(self.chatID)
      chat.Render(self.chatID)

   def OnPressEscapeKey(self):
      self.Close()
      return TRUE

   def BindInterface(self, interface):
      self.interface = interface
      
   def OnMouseLeftButtonDown(self):
      hyperlink = ui.GetHyperlink()
      if hyperlink:
         if app.IsPressed(app.DIK_LALT):
            link = chat.GetLinkFromHyperlink(hyperlink)
            ime.PasteString(link)
         else:
            self.interface.MakeHyperlinkTooltip(hyperlink)
Imagine
Imagine
Afișează semnătura
Avatar utilizator
KriTecK
Fost Helper

Fost Helper
Mesaje: 520
Membru din: 28 Iul 2013, 11:05
Aprecieri: 9  
Mulţumiri: 11  
 Contact:
Medalii

Bag contu si ma scoate cu eroarea

0802 19:53:07559 ::
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:28) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:15) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 1156)

0802 19:53:07559 :: ============================================================================================================
0802 19:53:07559 :: Abort!!!!
Avatar utilizator
Marggraf
Utilizator interzis !

Utilizator interzis !
Mesaje: 1074
Membru din: 25 Mai 2014, 12:46
Server: loading...
Regat: Shinsoo
Aprecieri: 36  
Mulţumiri: 36  
Medalii

KriTecK scrie:Bag contu si ma scoate cu eroarea

0802 19:53:07559 ::
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:28) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:15) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 1156)

0802 19:53:07559 :: ============================================================================================================
0802 19:53:07559 :: Abort!!!!

Cod: Selectaţi tot

import ui
import grp
import chat
import wndMgr
import net
import app
import ime
import locale
import colorInfo
import constInfo
import systemSetting
import player

ENABLE_CHAT_COMMAND = TRUE
ENABLE_LAST_SENTENCE_STACK = TRUE
ENABLE_INSULT_CHECK = TRUE

if locale.IsHONGKONG():
   ENABLE_LAST_SENTENCE_STACK = TRUE

if locale.IsEUROPE():
   ENABLE_CHAT_COMMAND = FALSE

if locale.IsCANADA():
   ENABLE_LAST_SENTENCE_STACK = FALSE

chatInputSetList = []
def InsertChatInputSetWindow(wnd):
   global chatInputSetList
   chatInputSetList.append(wnd)
def RefreshChatMode():
   global chatInputSetList
   map(lambda wnd:wnd.OnRefreshChatMode(), chatInputSetList)
def DestroyChatInputSetWindow():
   global chatInputSetList
   chatInputSetList = []

## ChatModeButton
class ChatModeButton(ui.Window):

   OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)
   OVER_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 0.3)
   BUTTON_STATE_UP = 0
   BUTTON_STATE_OVER = 1
   BUTTON_STATE_DOWN = 2

   def __init__(self):
      ui.Window.__init__(self)
      self.state = None
      self.buttonText = None
      self.event = None

      net.EnableChatInsultFilter(ENABLE_INSULT_CHECK)

   def __del__(self):
      ui.Window.__del__(self)

   def SAFE_SetEvent(self, event):
      self.event=ui.__mem_func__(event)

   def SetText(self, text):
      if None == self.buttonText:
         textLine = ui.TextLine()
         textLine.SetParent(self)
         textLine.SetWindowHorizontalAlignCenter()
         textLine.SetWindowVerticalAlignCenter()
         textLine.SetVerticalAlignCenter()
         textLine.SetHorizontalAlignCenter()
         textLine.SetPackedFontColor(self.OUTLINE_COLOR)
         textLine.Show()
         self.buttonText = textLine

      self.buttonText.SetText(text)

   def SetSize(self, width, height):
      self.width = width
      self.height = height
      ui.Window.SetSize(self, width, height)

   def OnMouseOverIn(self):
      self.state = self.BUTTON_STATE_OVER

   def OnMouseOverOut(self):
      self.state = self.BUTTON_STATE_UP

   def OnMouseLeftButtonDown(self):
      self.state = self.BUTTON_STATE_DOWN

   def OnMouseLeftButtonUp(self):
      self.state = self.BUTTON_STATE_UP
      if self.IsIn():
         self.state = self.BUTTON_STATE_OVER

      if None != self.event:
         self.event()

   def OnRender(self):

      (x, y) = self.GetGlobalPosition()

      grp.SetColor(self.OUTLINE_COLOR)
      grp.RenderRoundBox(x, y, self.width, self.height)

      if self.state >= self.BUTTON_STATE_OVER:
         grp.RenderRoundBox(x+1, y, self.width-2, self.height)
         grp.RenderRoundBox(x, y+1, self.width, self.height-2)

         if self.BUTTON_STATE_DOWN == self.state:
            grp.SetColor(self.OVER_COLOR)
            grp.RenderBar(x+1, y+1, self.width-2, self.height-2)

## ChatLine
class ChatLine(ui.EditLine):

   CHAT_MODE_NAME = {   chat.CHAT_TYPE_TALKING : locale.CHAT_NORMAL,
                  chat.CHAT_TYPE_PARTY : locale.CHAT_PARTY,
                  chat.CHAT_TYPE_GUILD : locale.CHAT_GUILD,
                  chat.CHAT_TYPE_SHOUT : locale.CHAT_SHOUT, }

   def __init__(self):
      ui.EditLine.__init__(self)
      self.SetWindowName("Chat Line")
      self.lastShoutTime = 0
      self.eventEscape = lambda *arg: None
      self.eventReturn = lambda *arg: None
      self.eventTab = None
      self.chatMode = chat.CHAT_TYPE_TALKING
      self.bCodePage = TRUE

      self.overTextLine = ui.TextLine()
      self.overTextLine.SetParent(self)
      self.overTextLine.SetPosition(-1, 0)
      self.overTextLine.SetFontColor(1.0, 1.0, 0.0)
      self.overTextLine.SetOutline()
      self.overTextLine.Hide()

      self.lastSentenceStack = []
      self.lastSentencePos = 0

   def SetChatMode(self, mode):
      self.chatMode = mode

   def GetChatMode(self):
      return self.chatMode

   def ChangeChatMode(self):
      if chat.CHAT_TYPE_TALKING == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_PARTY)
         self.SetText("#")
         self.SetEndPosition()

      elif chat.CHAT_TYPE_PARTY == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_GUILD)
         self.SetText("%")
         self.SetEndPosition()

      elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_SHOUT)
         self.SetText("!")
         self.SetEndPosition()

      elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
         self.SetChatMode(chat.CHAT_TYPE_TALKING)
         self.SetText("")

      self.__CheckChatMark()

   def GetCurrentChatModeName(self):
      try:
         return self.CHAT_MODE_NAME[self.chatMode]
      except:
         import exception
         exception.Abort("ChatLine.GetCurrentChatModeName")

   def SAFE_SetEscapeEvent(self, event):
      self.eventReturn = ui.__mem_func__(event)

   def SAFE_SetReturnEvent(self, event):
      self.eventEscape = ui.__mem_func__(event)

   def SAFE_SetTabEvent(self, event):
      self.eventTab = ui.__mem_func__(event)

   def SetTabEvent(self, event):
      self.eventTab = event

   def OpenChat(self):
      self.SetFocus()
      self.__ResetChat()

   def __ClearChat(self):
      self.SetText("")
      self.lastSentencePos = 0

   def __ResetChat(self):
      if chat.CHAT_TYPE_PARTY == self.GetChatMode():
         self.SetText("#")
         self.SetEndPosition()
      elif chat.CHAT_TYPE_GUILD == self.GetChatMode():
         self.SetText("%")
         self.SetEndPosition()
      elif chat.CHAT_TYPE_SHOUT == self.GetChatMode():
         self.SetText("!")
         self.SetEndPosition()
      else:
         self.__ClearChat()

      self.__CheckChatMark()
      

	def __SendChatPacket(self, text, type):
#		if text[0] == '/':
#			if ENABLE_CHAT_COMMAND or constInfo.CONSOLE_ENABLE:
#				pass
#			else:
#				return

		if net.IsChatInsultIn(text):
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
		else:
			net.SendChatPacket(text, type)

   def __SendShoutChatPacket(self, text):

      if 1 == len(text):
         self.RunCloseEvent()
         return

      if app.GetTime() < self.lastShoutTime + 15:
         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_SHOUT_LIMIT)
         self.__ResetChat()
         return

      self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT)
      self.__ResetChat()

      self.lastShoutTime = app.GetTime()

   def __SendTalkingChatPacket(self, text):
      if text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and text[2] == ' ':
         newtext = text.split(' ', 1)
         net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
         self.__ResetChat()
      elif text[0] == '/' and (text[1] == 'n' or text[1] == 'N') and (text[2] == 'o' or text[2] == 'O') and (text[3] == 't' or text[3] == 'T') and (text[4] == 'i' or text[4] == 'I') and (text[5] == 'c' or text[5] == 'C') and (text[6] == 'e' or text[6] == 'E') and text[7] == ' ':
         newtext = text.split(' ', 1)
         net.SendChatPacket(newtext[0] + " " + player.GetName() + ": " + newtext[1], chat.CHAT_TYPE_TALKING)
         self.__ResetChat()
      else:
         self.__SendChatPacket(text, chat.CHAT_TYPE_TALKING)
         self.__ResetChat()

   def OnIMETab(self):
      #if None != self.eventTab:
      #   self.eventTab()
      #return TRUE
      return FALSE

   def OnIMEUpdate(self):
      ui.EditLine.OnIMEUpdate(self)
      self.__CheckChatMark()

   def __CheckChatMark(self):

      self.overTextLine.Hide()

      text = self.GetText()
      if len(text) > 0:
         if '#' == text[0]:
            self.overTextLine.SetText("#")
            self.overTextLine.Show()
         elif '%' == text[0]:
            self.overTextLine.SetText("%")
            self.overTextLine.Show()
         elif '!' == text[0]:
            self.overTextLine.SetText("!")
            self.overTextLine.Show()

   def OnIMEKeyDown(self, key):
      # LAST_SENTENCE_STACK
      if app.VK_UP == key:
         self.__PrevLastSentenceStack()
         return TRUE

      if app.VK_DOWN == key:
         self.__NextLastSentenceStack()            
         return TRUE         
      # END_OF_LAST_SENTENCE_STACK

      ui.EditLine.OnIMEKeyDown(self, key)

   # LAST_SENTENCE_STACK
   def __PrevLastSentenceStack(self):
      global ENABLE_LAST_SENTENCE_STACK
      if not ENABLE_LAST_SENTENCE_STACK:
         return

      if self.lastSentenceStack and self.lastSentencePos < len(self.lastSentenceStack):
         self.lastSentencePos += 1
         lastSentence = self.lastSentenceStack[-self.lastSentencePos]
         self.SetText(lastSentence)            
         self.SetEndPosition()         

   def __NextLastSentenceStack(self):
      global ENABLE_LAST_SENTENCE_STACK
      if not ENABLE_LAST_SENTENCE_STACK:
         return

      if self.lastSentenceStack and self.lastSentencePos > 1:
         self.lastSentencePos -= 1
         lastSentence = self.lastSentenceStack[-self.lastSentencePos]
         self.SetText(lastSentence)            
         self.SetEndPosition()         

   def __PushLastSentenceStack(self, text):      
      global ENABLE_LAST_SENTENCE_STACK
      if not ENABLE_LAST_SENTENCE_STACK:
         return

      if len(text) <= 0:
         return
         
      LAST_SENTENCE_STACK_SIZE = 32
      if len(self.lastSentenceStack) > LAST_SENTENCE_STACK_SIZE:
         self.lastSentenceStack.pop(0)

      self.lastSentenceStack.append(text)
   # END_OF_LAST_SENTENCE_STACK

   def OnIMEReturn(self):
      text = self.GetText()
      textLen=len(text)

      # LAST_SENTENCE_STACK
      self.__PushLastSentenceStack(text)
      # END_OF_LAST_SENTENCE_STACK
            
      textSpaceCount=text.count(' ')

      if (textLen > 0) and (textLen != textSpaceCount):
         if '#' == text[0]:
            self.__SendPartyChatPacket(text)
         elif '%' == text[0]:
            self.__SendGuildChatPacket(text)
         elif '!' == text[0]:
            self.__SendShoutChatPacket(text)
         else:
            self.__SendTalkingChatPacket(text)
      else:
         self.__ClearChat()
         self.eventReturn()

      return TRUE

   def OnPressEscapeKey(self):
      self.__ClearChat()
      self.eventEscape()
      return TRUE

   def RunCloseEvent(self):
      self.eventEscape()

   def BindInterface(self, interface):
      self.interface = interface

   def OnMouseLeftButtonDown(self):
      hyperlink = ui.GetHyperlink()
      if hyperlink:
         if app.IsPressed(app.DIK_LALT):
            link = chat.GetLinkFromHyperlink(hyperlink)
            ime.PasteString(link)
         else:
            self.interface.MakeHyperlinkTooltip(hyperlink)
      else:
         ui.EditLine.OnMouseLeftButtonDown(self)

class ChatInputSet(ui.Window):

   CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

   def __init__(self):
      ui.Window.__init__(self)

      InsertChatInputSetWindow(self)
      self.__Create()

   def __del__(self):
      ui.Window.__del__(self)

   def __Create(self):
      chatModeButton = ChatModeButton()
      chatModeButton.SetParent(self)
      chatModeButton.SetSize(40, 17)
      chatModeButton.SetText(locale.CHAT_NORMAL)
      chatModeButton.SetPosition(7, 2)
      chatModeButton.SAFE_SetEvent(self.OnChangeChatMode)
      self.chatModeButton = chatModeButton

      chatLine = ChatLine()
      chatLine.SetParent(self)
      chatLine.SetMax(512)
      chatLine.SetUserMax(76)
      chatLine.SetText("")
      chatLine.SAFE_SetTabEvent(self.OnChangeChatMode)
      chatLine.x = 0
      chatLine.y = 0
      chatLine.width = 0
      chatLine.height = 0
      self.chatLine = chatLine

      btnSend = ui.Button()
      btnSend.SetParent(self)
      btnSend.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_01.sub")
      btnSend.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_02.sub")
      btnSend.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Chat_Button_03.sub")
      btnSend.SetToolTipText(locale.CHAT_SEND_CHAT)
      btnSend.SAFE_SetEvent(self.chatLine.OnIMEReturn)
      self.btnSend = btnSend

   def Destroy(self):
      self.chatModeButton = None
      self.chatLine = None
      self.btnSend = None

   def Open(self):
      self.chatLine.Show()
      self.chatLine.SetPosition(57, 5)
      self.chatLine.SetFocus()
      self.chatLine.OpenChat()

      self.chatModeButton.SetPosition(7, 2)
      self.chatModeButton.Show()

      self.btnSend.Show()
      self.Show()

      self.RefreshPosition()
      return TRUE

   def Close(self):
      self.chatLine.KillFocus()
      self.chatLine.Hide()
      self.chatModeButton.Hide()
      self.btnSend.Hide()
      self.Hide()
      return TRUE

   def SetEscapeEvent(self, event):
      self.chatLine.SetEscapeEvent(event)

   def SetReturnEvent(self, event):
      self.chatLine.SetReturnEvent(event)

   def OnChangeChatMode(self):
      RefreshChatMode()

   def OnRefreshChatMode(self):
      self.chatLine.ChangeChatMode()
      self.chatModeButton.SetText(self.chatLine.GetCurrentChatModeName())

   def SetChatFocus(self):
      self.chatLine.SetFocus()

   def KillChatFocus(self):
      self.chatLine.KillFocus()

   def SetChatMax(self, max):
      self.chatLine.SetUserMax(max)

   def RefreshPosition(self):
      if locale.IsARABIC():
         self.chatLine.SetSize(self.GetWidth() - 93, 18)
      else:
         self.chatLine.SetSize(self.GetWidth() - 93, 13)

      self.btnSend.SetPosition(self.GetWidth() - 25, 2)

      (self.chatLine.x, self.chatLine.y, self.chatLine.width, self.chatLine.height) = self.chatLine.GetRect()

   def BindInterface(self, interface):
      self.chatLine.BindInterface(interface)

   def OnRender(self):
      (x, y, width, height) = self.chatLine.GetRect()
      ui.RenderRoundBox(x-4, y-3, width+7, height+4, self.CHAT_OUTLINE_COLOR)

## ChatWindow
class ChatWindow(ui.Window):

   BOARD_START_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.0)
   BOARD_END_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.8)
   BOARD_MIDDLE_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.5)
   CHAT_OUTLINE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 1.0)

   EDIT_LINE_HEIGHT = 25

   class ChatBackBoard(ui.Window):
      def __init__(self):
         ui.Window.__init__(self)
      def __del__(self):
         ui.Window.__del__(self)

   class ChatButton(ui.DragButton):

      def __init__(self):
         ui.DragButton.__init__(self)
         self.AddFlag("float")
         self.AddFlag("movable")
         self.AddFlag("restrict_x")
         self.topFlag = FALSE

      def __del__(self):
         ui.DragButton.__del__(self)

      def SetOwner(self, owner):
         self.owner = owner

      def OnMouseOverIn(self):
         app.SetCursor(app.VSIZE)

      def OnMouseOverOut(self):
         app.SetCursor(app.NORMAL)

      def OnTop(self):
         if TRUE == self.topFlag:
            return

         self.topFlag = TRUE
         self.owner.SetTop()
         self.topFlag = FALSE

   def __init__(self):
      ui.Window.__init__(self)
      self.AddFlag("float")

      self.__RegisterChatColorDict()

      self.boardState = chat.BOARD_STATE_VIEW
      self.chatID = chat.CreateChatSet(chat.CHAT_SET_CHAT_WINDOW)
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)

      self.xBar = 0
      self.yBar = 0
      self.widthBar = 0
      self.heightBar = 0
      self.curHeightBar = 0
      self.visibleLineCount = 0
      self.scrollBarPos = 1.0
      self.scrollLock = FALSE

      chatInputSet = ChatInputSet()
      chatInputSet.SetParent(self)
      chatInputSet.SetEscapeEvent(ui.__mem_func__(self.CloseChat))
      chatInputSet.SetReturnEvent(ui.__mem_func__(self.CloseChat))
      chatInputSet.SetSize(550, 25)
      self.chatInputSet = chatInputSet

      btnSendWhisper = ui.Button()
      btnSendWhisper.SetParent(self)
      btnSendWhisper.SetUpVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_01.sub")
      btnSendWhisper.SetOverVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_02.sub")
      btnSendWhisper.SetDownVisual("d:/ymir work/ui/game/taskbar/Send_Whisper_Button_03.sub")
      btnSendWhisper.SetToolTipText(locale.CHAT_SEND_MEMO)
      btnSendWhisper.Hide()
      self.btnSendWhisper = btnSendWhisper

      btnChatLog = ui.Button()
      btnChatLog.SetParent(self)
      btnChatLog.SetUpVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_01.sub")
      btnChatLog.SetOverVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_02.sub")
      btnChatLog.SetDownVisual("d:/ymir work/ui/game/taskbar/Open_Chat_Log_Button_03.sub")
      btnChatLog.SetToolTipText(locale.CHAT_LOG)
      btnChatLog.Hide()
      self.btnChatLog = btnChatLog

      btnChatSizing = self.ChatButton()
      btnChatSizing.SetOwner(self)
      btnChatSizing.SetMoveEvent(ui.__mem_func__(self.Refresh))
      btnChatSizing.Hide()
      self.btnChatSizing = btnChatSizing

      imgChatBarLeft = ui.ImageBox()
      imgChatBarLeft.SetParent(self.btnChatSizing)
      imgChatBarLeft.AddFlag("not_pick")
      imgChatBarLeft.LoadImage("d:/ymir work/ui/pattern/chat_bar_left.tga")
      imgChatBarLeft.Show()
      self.imgChatBarLeft = imgChatBarLeft
      imgChatBarRight = ui.ImageBox()
      imgChatBarRight.SetParent(self.btnChatSizing)
      imgChatBarRight.AddFlag("not_pick")
      imgChatBarRight.LoadImage("d:/ymir work/ui/pattern/chat_bar_right.tga")
      imgChatBarRight.Show()
      self.imgChatBarRight = imgChatBarRight
      imgChatBarMiddle = ui.ExpandedImageBox()
      imgChatBarMiddle.SetParent(self.btnChatSizing)
      imgChatBarMiddle.AddFlag("not_pick")
      imgChatBarMiddle.LoadImage("d:/ymir work/ui/pattern/chat_bar_middle.tga")
      imgChatBarMiddle.Show()
      self.imgChatBarMiddle = imgChatBarMiddle

      scrollBar = ui.ScrollBar()
      scrollBar.AddFlag("float")
      scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
      self.scrollBar = scrollBar

      self.Refresh()
      self.chatInputSet.RefreshPosition() # RTL ? ??? ??? ???? ?? ??? ????
   
   def __del__(self):
      ui.Window.__del__(self)

   def __RegisterChatColorDict(self):
      CHAT_COLOR_DICT = {
         chat.CHAT_TYPE_TALKING : colorInfo.CHAT_RGB_TALK,
         chat.CHAT_TYPE_INFO : colorInfo.CHAT_RGB_INFO,
         chat.CHAT_TYPE_NOTICE : colorInfo.CHAT_RGB_NOTICE,
         chat.CHAT_TYPE_PARTY : colorInfo.CHAT_RGB_PARTY,
         chat.CHAT_TYPE_GUILD : colorInfo.CHAT_RGB_GUILD,
         chat.CHAT_TYPE_COMMAND : colorInfo.CHAT_RGB_COMMAND,
         chat.CHAT_TYPE_SHOUT : colorInfo.CHAT_RGB_SHOUT,
         chat.CHAT_TYPE_WHISPER : colorInfo.CHAT_RGB_WHISPER,
      }

      for colorItem in CHAT_COLOR_DICT.items():
         type=colorItem[0]
         rgb=colorItem[1]
         chat.SetChatColor(type, rgb[0], rgb[1], rgb[2])

   def Destroy(self):
      self.chatInputSet.Destroy()
      self.chatInputSet = None

      self.btnSendWhisper = 0
      self.btnChatLog = 0
      self.btnChatSizing = 0

   ################
   ## Open & Close
   def OpenChat(self):
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_EDIT)
      self.boardState = chat.BOARD_STATE_EDIT

      (x, y, width, height) = self.GetRect()
      (btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y)
      else:   
         chat.SetPosition(self.chatID, x + 10, y)

      chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

      if self.IsShow():
         self.btnChatSizing.Show()

      self.Refresh()

      self.btnSendWhisper.SetPosition(self.GetWidth() - 50, 2)
      self.btnSendWhisper.Show()

      self.btnChatLog.SetPosition(self.GetWidth() - 25, 2)
      self.btnChatLog.Show()

      self.chatInputSet.Open()
      self.SetTop()

   def CloseChat(self):
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_VIEW)
      self.boardState = chat.BOARD_STATE_VIEW

      (x, y, width, height) = self.GetRect()

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y + height)
      else:
         chat.SetPosition(self.chatID, x + 10, y + height)

      self.chatInputSet.Close()
      self.btnSendWhisper.Hide()
      self.btnChatLog.Hide()
      self.btnChatSizing.Hide()
      self.Refresh()

   def SetSendWhisperEvent(self, event):
      self.btnSendWhisper.SetEvent(event)

   def SetOpenChatLogEvent(self, event):
      self.btnChatLog.SetEvent(event)

   def IsEditMode(self):
      if chat.BOARD_STATE_EDIT == self.boardState:
         return TRUE

      return FALSE

   def __RefreshSizingBar(self):
      (x, y, width, height) = self.GetRect()
      gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
      self.btnChatSizing.SetPosition(x, gyChat)
      self.btnChatSizing.SetSize(width, 22)
      self.imgChatBarLeft.SetPosition(0, 0)
      self.imgChatBarRight.SetPosition(width - 64, 0)
      self.imgChatBarMiddle.SetPosition(64, 0)
      self.imgChatBarMiddle.SetRenderingRect(0.0, 0.0, float(width - 128) / 64.0 - 1.0, 0.0)

   def SetPosition(self, x, y):
      ui.Window.SetPosition(self, x, y)
      self.__RefreshSizingBar()

   def SetSize(self, width, height):
      ui.Window.SetSize(self, width, height)
      self.__RefreshSizingBar()

   def SetHeight(self, height):
      gxChat, gyChat = self.btnChatSizing.GetGlobalPosition()
      self.btnChatSizing.SetPosition(gxChat, wndMgr.GetScreenHeight() - height)

   ###########
   ## Refresh
   def Refresh(self):
      if self.boardState == chat.BOARD_STATE_EDIT:
         self.RefreshBoardEditState()
      elif self.boardState == chat.BOARD_STATE_VIEW:
         self.RefreshBoardViewState()

   def RefreshBoardEditState(self):

      (x, y, width, height) = self.GetRect()
      (btnX, btnY) = self.btnChatSizing.GetGlobalPosition()

      self.xBar = x
      self.yBar = btnY
      self.widthBar = width
      self.heightBar = y - btnY + self.EDIT_LINE_HEIGHT
      self.curHeightBar = self.heightBar

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y)
      else:
         chat.SetPosition(self.chatID, x + 10, y)

      chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT)
      chat.ArrangeShowingChat(self.chatID)

      if btnY > y:
         self.btnChatSizing.SetPosition(btnX, y)
         self.heightBar = self.EDIT_LINE_HEIGHT

   def RefreshBoardViewState(self):
      (x, y, width, height) = self.GetRect()
      (btnX, btnY) = self.btnChatSizing.GetGlobalPosition()
      textAreaHeight = self.visibleLineCount * chat.GetLineStep(self.chatID)

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y + height)
      else:
         chat.SetPosition(self.chatID, x + 10, y + height)

      chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100)

      if self.boardState == chat.BOARD_STATE_EDIT:
         textAreaHeight += 45
      elif self.visibleLineCount != 0:
         textAreaHeight += 10 + 10

      self.xBar = x
      self.yBar = y + height - textAreaHeight
      self.widthBar = width
      self.heightBar = textAreaHeight

      self.scrollBar.Hide()

   ##########
   ## Render
   def OnUpdate(self):
      if self.boardState == chat.BOARD_STATE_EDIT:
         chat.Update(self.chatID)
      elif self.boardState == chat.BOARD_STATE_VIEW:
         if systemSetting.IsViewChat():
            chat.Update(self.chatID)

   def OnRender(self):
      if chat.GetVisibleLineCount(self.chatID) != self.visibleLineCount:
         self.visibleLineCount = chat.GetVisibleLineCount(self.chatID)
         self.Refresh()

      if self.curHeightBar != self.heightBar:
         self.curHeightBar += (self.heightBar - self.curHeightBar) / 10

      if self.boardState == chat.BOARD_STATE_EDIT:
         grp.SetColor(self.BOARD_MIDDLE_COLOR)
         grp.RenderBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar) + 10, self.widthBar, self.curHeightBar)
         chat.Render(self.chatID)
      elif self.boardState == chat.BOARD_STATE_VIEW:
         if systemSetting.IsViewChat():
            grp.RenderGradationBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar), self.widthBar, self.curHeightBar, self.BOARD_START_COLOR, self.BOARD_END_COLOR)
            chat.Render(self.chatID)

   ##########
   ## Event
   def OnTop(self):
      self.btnChatSizing.SetTop()
      self.scrollBar.SetTop()

   def OnScroll(self):
      if not self.scrollLock:
         self.scrollBarPos = self.scrollBar.GetPos()

      lineCount = chat.GetLineCount(self.chatID)
      visibleLineCount = chat.GetVisibleLineCount(self.chatID)
      endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

      chat.SetEndPos(self.chatID, self.scrollBarPos)

   def OnChangeChatMode(self):
      self.chatInputSet.OnChangeChatMode()

   def SetChatFocus(self):
      self.chatInputSet.SetChatFocus()         

   def BindInterface(self, interface):
      self.chatInputSet.BindInterface(interface)

## ChatLogWindow
class ChatLogWindow(ui.Window):

   BLOCK_WIDTH = 32
   CHAT_MODE_NAME = ( locale.CHAT_NORMAL, locale.CHAT_PARTY, locale.CHAT_GUILD, locale.CHAT_SHOUT, locale.CHAT_INFORMATION, locale.CHAT_NOTICE, )
   CHAT_MODE_INDEX = ( chat.CHAT_TYPE_TALKING,
                  chat.CHAT_TYPE_PARTY,
                  chat.CHAT_TYPE_GUILD,
                  chat.CHAT_TYPE_SHOUT,
                  chat.CHAT_TYPE_INFO,
                  chat.CHAT_TYPE_NOTICE, )

   CHAT_LOG_WINDOW_MINIMUM_WIDTH = 450
   CHAT_LOG_WINDOW_MINIMUM_HEIGHT = 120

   class ResizeButton(ui.DragButton):

      def __init__(self):
         ui.DragButton.__init__(self)

      def __del__(self):
         ui.DragButton.__del__(self)

      def OnMouseOverIn(self):
         app.SetCursor(app.HVSIZE)

      def OnMouseOverOut(self):
         app.SetCursor(app.NORMAL)

   def __init__(self):

      self.allChatMode = TRUE
      self.chatInputSet = None

      ui.Window.__init__(self)
      self.AddFlag("float")
      self.AddFlag("movable")

      self.__CreateChatInputSet()
      self.__CreateWindow()
      self.__CreateButton()
      self.__CreateScrollBar()

      self.chatID = chat.CreateChatSet(chat.CHAT_SET_LOG_WINDOW)
      chat.SetBoardState(self.chatID, chat.BOARD_STATE_LOG)
      for i in self.CHAT_MODE_INDEX:
         chat.EnableChatMode(self.chatID, i)

      self.SetPosition(20, 20)
      self.SetSize(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT)
      self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH-self.btnSizing.GetWidth(), self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT-self.btnSizing.GetHeight()+2)

      self.OnResize()

   def __CreateChatInputSet(self):
      chatInputSet = ChatInputSet()
      chatInputSet.SetParent(self)
      chatInputSet.SetEscapeEvent(ui.__mem_func__(self.Close))
      chatInputSet.SetWindowVerticalAlignBottom()
      chatInputSet.Open()
      self.chatInputSet = chatInputSet

   def __CreateWindow(self):
      imgLeft = ui.ImageBox()
      imgLeft.AddFlag("not_pick")
      imgLeft.SetParent(self)            

      imgCenter = ui.ExpandedImageBox()
      imgCenter.AddFlag("not_pick")
      imgCenter.SetParent(self)
      
      imgRight = ui.ImageBox()
      imgRight.AddFlag("not_pick")
      imgRight.SetParent(self)         
      
      if locale.IsARABIC():
         imgLeft.LoadImage("locale/ae/ui/pattern/titlebar_left.tga")
         imgCenter.LoadImage("locale/ae/ui/pattern/titlebar_center.tga")
         imgRight.LoadImage("locale/ae/ui/pattern/titlebar_right.tga")
      else:
         imgLeft.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_left.tga")
         imgCenter.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_middle.tga")
         imgRight.LoadImage("d:/ymir work/ui/pattern/chatlogwindow_titlebar_right.tga")      

      imgLeft.Show()
      imgCenter.Show()
      imgRight.Show()

      btnClose = ui.Button()
      btnClose.SetParent(self)
      btnClose.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
      btnClose.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
      btnClose.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
      btnClose.SetToolTipText(locale.UI_CLOSE, 0, -23)
      btnClose.SetEvent(ui.__mem_func__(self.Close))
      btnClose.Show()

      btnSizing = self.ResizeButton()
      btnSizing.SetParent(self)
      btnSizing.SetMoveEvent(ui.__mem_func__(self.OnResize))
      btnSizing.SetSize(16, 16)
      btnSizing.Show()

      titleName = ui.TextLine()
      titleName.SetParent(self)
      
      if locale.IsARABIC():
         titleName.SetPosition(self.GetWidth()-20, 6)
      else:
         titleName.SetPosition(20, 6)
         
      titleName.SetText(locale.CHAT_LOG_TITLE)
      titleName.Show()

      self.imgLeft = imgLeft
      self.imgCenter = imgCenter
      self.imgRight = imgRight
      self.btnClose = btnClose
      self.btnSizing = btnSizing
      self.titleName = titleName

   def __CreateButton(self):
   
      if locale.IsARABIC():
         bx = 20
      else:
         bx = 13

      btnAll = ui.RadioButton()
      btnAll.SetParent(self)
      btnAll.SetPosition(bx, 24)
      btnAll.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
      btnAll.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
      btnAll.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
      btnAll.SetText(locale.CHAT_ALL)
      btnAll.SetEvent(ui.__mem_func__(self.ToggleAllChatMode))
      btnAll.Down()
      btnAll.Show()
      self.btnAll = btnAll

      x = bx + 48
      i = 0
      self.modeButtonList = []
      for name in self.CHAT_MODE_NAME:
         btn = ui.ToggleButton()
         btn.SetParent(self)
         btn.SetPosition(x, 24)
         btn.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
         btn.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
         btn.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
         btn.SetText(name)
         btn.Show()

         mode = self.CHAT_MODE_INDEX[i]
         btn.SetToggleUpEvent(lambda arg=mode: self.ToggleChatMode(arg))
         btn.SetToggleDownEvent(lambda arg=mode: self.ToggleChatMode(arg))
         self.modeButtonList.append(btn)

         x += 48
         i += 1

   def __CreateScrollBar(self):
      scrollBar = ui.SmallThinScrollBar()
      scrollBar.SetParent(self)
      scrollBar.Show()
      scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
      self.scrollBar = scrollBar
      self.scrollBarPos = 1.0

   def __del__(self):
      ui.Window.__del__(self)

   def Destroy(self):
      self.imgLeft = None
      self.imgCenter = None
      self.imgRight = None
      self.btnClose = None
      self.btnSizing = None
      self.modeButtonList = []
      self.scrollBar = None
      self.chatInputSet = None

   def ToggleAllChatMode(self):
      if self.allChatMode:
         return

      self.allChatMode = TRUE

      for i in self.CHAT_MODE_INDEX:
         chat.EnableChatMode(self.chatID, i)
      for btn in self.modeButtonList:
         btn.SetUp()

   def ToggleChatMode(self, mode):
      if self.allChatMode:
         self.allChatMode = FALSE
         for i in self.CHAT_MODE_INDEX:
            chat.DisableChatMode(self.chatID, i)
         chat.EnableChatMode(self.chatID, mode)
         self.btnAll.SetUp()

      else:
         chat.ToggleChatMode(self.chatID, mode)

   def SetSize(self, width, height):
      self.imgCenter.SetRenderingRect(0.0, 0.0, float((width - self.BLOCK_WIDTH*2) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0)
      self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
      self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)
      
      if locale.IsARABIC():
         self.titleName.SetPosition(self.GetWidth()-20, 3)
         self.btnClose.SetPosition(3, 3)
         self.scrollBar.SetPosition(1, 45)
      else:
         self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 5, 5)         
         self.scrollBar.SetPosition(width - 15, 45)
         
      self.scrollBar.SetScrollBarSize(height - 45 - 12)
      self.scrollBar.SetPos(self.scrollBarPos)
      ui.Window.SetSize(self, width, height)

   def Open(self):
      self.OnResize()
      self.chatInputSet.SetChatFocus()
      self.Show()

   def Close(self):
      if self.chatInputSet:
         self.chatInputSet.KillChatFocus()
      self.Hide()

   def OnResize(self):
      x, y = self.btnSizing.GetLocalPosition()
      width = self.btnSizing.GetWidth()
      height = self.btnSizing.GetHeight()

      if x < self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width:
         self.btnSizing.SetPosition(self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width, y)
         return
      if y < self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height:
         self.btnSizing.SetPosition(x, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height)
         return

      self.scrollBar.LockScroll()
      self.SetSize(x + width, y + height)
      self.scrollBar.UnlockScroll()

      if locale.IsARABIC():
         self.chatInputSet.SetPosition(20, 25)
      else:
         self.chatInputSet.SetPosition(0, 25)
         
      self.chatInputSet.SetSize(self.GetWidth() - 20, 20)
      self.chatInputSet.RefreshPosition()
      self.chatInputSet.SetChatMax(self.GetWidth() / 8)

   def OnScroll(self):
      self.scrollBarPos = self.scrollBar.GetPos()

      lineCount = chat.GetLineCount(self.chatID)
      visibleLineCount = chat.GetVisibleLineCount(self.chatID)
      endLine = visibleLineCount + int(float(lineCount - visibleLineCount) * self.scrollBarPos)

      chat.SetEndPos(self.chatID, self.scrollBarPos)

   def OnRender(self):
      (x, y, width, height) = self.GetRect()
      
      if locale.IsARABIC():
         grp.SetColor(0x77000000)
         grp.RenderBar(x+2, y+45, 13, height-45)
         
         grp.SetColor(0x77000000)
         grp.RenderBar(x, y, width, height)
         grp.SetColor(0xff525552)
         grp.RenderBox(x, y, width-2, height)
         grp.SetColor(0xff000000)
         grp.RenderBox(x+1, y+1, width-2, height)

         grp.SetColor(0xff989898)
         grp.RenderLine(x+width-13, y+height-1, 11, -11)
         grp.RenderLine(x+width-9, y+height-1, 7, -7)
         grp.RenderLine(x+width-5, y+height-1, 3, -3)
      else:         
         grp.SetColor(0x77000000)
         grp.RenderBar(x+width-15, y+45, 13, height-45)

         grp.SetColor(0x77000000)
         grp.RenderBar(x, y, width, height)
         grp.SetColor(0xff525552)
         grp.RenderBox(x, y, width-2, height)
         grp.SetColor(0xff000000)
         grp.RenderBox(x+1, y+1, width-2, height)

         grp.SetColor(0xff989898)
         grp.RenderLine(x+width-13, y+height-1, 11, -11)
         grp.RenderLine(x+width-9, y+height-1, 7, -7)
         grp.RenderLine(x+width-5, y+height-1, 3, -3)

      #####

      chat.ArrangeShowingChat(self.chatID)

      if locale.IsARABIC():
         chat.SetPosition(self.chatID, x + width - 10, y + height - 25)
      else:
         chat.SetPosition(self.chatID, x + 10, y + height - 25)

      chat.SetHeight(self.chatID, height - 45 - 25)
      chat.Update(self.chatID)
      chat.Render(self.chatID)

   def OnPressEscapeKey(self):
      self.Close()
      return TRUE

   def BindInterface(self, interface):
      self.interface = interface
      
   def OnMouseLeftButtonDown(self):
      hyperlink = ui.GetHyperlink()
      if hyperlink:
         if app.IsPressed(app.DIK_LALT):
            link = chat.GetLinkFromHyperlink(hyperlink)
            ime.PasteString(link)
         else:
            self.interface.MakeHyperlinkTooltip(hyperlink)
si vezi daca iti da eroare ,daca iti da eroare,te scoate din cauza altui bug ,nu din cauza cu chatul
Imagine
Imagine
Afișează semnătura
Avatar utilizator
KriTecK
Fost Helper

Fost Helper
Mesaje: 520
Membru din: 28 Iul 2013, 11:05
Aprecieri: 9  
Mulţumiri: 11  
 Contact:
Medalii

Eroare "LOG"

Nu deschide deloc clientu.

Nu poti muta ca la chat sa apara [Jinno] .. Etc Inainte numelui ? Poate asta e ca nu te lasa sa scrii colorat pe chat-urile alea.

Incearca daca poti sa faci asa incat sa apara asa cand scrii la striga

"[Jinno]MrCrispy : Am bug la chat "

Majoritatea servarelor asa au. Steag / Nume : Mesaj.

Nu am vazut la nimeni ca la mine

Nume : [steag] mesaj
Avatar utilizator
Marggraf
Utilizator interzis !

Utilizator interzis !
Mesaje: 1074
Membru din: 25 Mai 2014, 12:46
Server: loading...
Regat: Shinsoo
Aprecieri: 36  
Mulţumiri: 36  
Medalii

KriTecK scrie:Eroare "LOG"

Nu deschide deloc clientu.

Nu poti muta ca la chat sa apara [Jinno] .. Etc Inainte numelui ? Poate asta e ca nu te lasa sa scrii colorat pe chat-urile alea.

Incearca daca poti sa faci asa incat sa apara asa cand scrii la striga

"[Jinno]MrCrispy : Am bug la chat "

Majoritatea servarelor asa au. Steag / Nume : Mesaj.

Nu am vazut la nimeni ca la mine

Nume : [steag] mesaj
alea sunt facute din sursa cum STEAG NUME...in caz ca ai sursa,vezi ca e un tut pe forum...fara sursa nu poti ce vrei tu

Dar ai reusit sa intri in joc?
Imagine
Imagine
Afișează semnătura
Închis
Răspunsuri
2
Vizualizări
118
Răspunsuri
9
Vizualizări
3794
Răspunsuri
11
Vizualizări
614
Răspunsuri
1
Vizualizări
150

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie