Adaptare pentru cei ce nu detin multilanguage
game.py
Cauta:
if app.__RENEWAL_ADMIN_CHAT__:
def BINARY_OnRecvBulkWhisper(self, content):
Modifica tot def-ul:
if app.__RENEWAL_ADMIN_CHAT__:
def BINARY_OnRecvBulkWhisper(self, content):
content = content.replace("$", " ")
self.interface.RegisterGameMasterName("[SYSTEM]")
new_buf = content
chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, "[SYSTEM]", new_buf)
self.interface.RecvWhisper("[SYSTEM]")
interfacemodule.py:
Cauta:
if not player.GetName() in canOpenPlayerList or canOpenPlayerList.find("[") == -1:
return
Modifica:
if not player.GetName() in canOpenPlayerList or all("[" not in name for name in canOpenPlayerList):
return
uiwhisperadmin.py
Modifica tot continutul:
#author: dracaryS
import ui
import app
import net
import ime
import chat
class Manager(ui.BoardWithTitleBar):
def Destroy(self):
self.__children = {}
def __init__(self):
ui.BoardWithTitleBar.__init__(self)
self.Destroy()
self.__LoadWindow()
def __LoadWindow(self):
self.SetSize(500, 190)
self.SetCenterPosition()
self.AddFlag('movable')
self.AddFlag('float')
self.SetCloseEvent(self.Close)
self.SetTitleName("Admin Chat Panel")
colorTypes = [
["ffffff", 0xffffffff],
["ea150a", 0xffea150a],
["50b409", 0xff50b409],
["10cfcf", 0xff10cfcf],
["e5d500", 0xffe5d500],
["e05324", 0xffe05324],
["ff77aa", 0xffff77aa],
]
colorList = []
for idx, color in enumerate(colorTypes):
radioBtn = ui.RadioButton()
radioBtn.SetParent(self)
radioBtn.SetPosition(10 + idx * 45, 135)
radioBtn.SetUpVisual("d:/ymir work/ui/public/small_button_01.sub")
radioBtn.SetOverVisual("d:/ymir work/ui/public/small_button_02.sub")
radioBtn.SetDownVisual("d:/ymir work/ui/public/small_button_03.sub")
radioBtn.SetText("|cff{}{}".format(color[0], "Color"))
radioBtn.SetEvent(lambda x=idx: self.__SetColor(x))
radioBtn.Show()
colorList.append(radioBtn)
self.__children["colorList"] = colorList
self.__children["colorTypes"] = colorTypes
infoBtnDict = {
0: {"text": "Notice", "maxLength": 150, "chatIdx": chat.CHAT_TYPE_NOTICE},
1: {"text": "Big-Notice", "maxLength": 150, "chatIdx": chat.CHAT_TYPE_BIG_NOTICE},
2: {"text": "Map-Notice", "maxLength": 150, "chatIdx": 99},
3: {"text": "Whisper", "maxLength": 512, "chatIdx": chat.CHAT_TYPE_WHISPER},
}
btnList = []
for idx, data in infoBtnDict.items():
toggleBtn = ui.RadioButton()
toggleBtn.SetParent(self)
toggleBtn.SetPosition(10 + idx * 63, 160)
toggleBtn.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
toggleBtn.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
toggleBtn.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
toggleBtn.SetText(data["text"])
toggleBtn.SetEvent(lambda x=idx: self.__ClickChatTypeBtn(x))
toggleBtn.Show()
btnList.append(toggleBtn)
self.__children["btnList"] = btnList
self.__children["infoBtnDict"] = infoBtnDict
msgSlotBar = ui.SlotBar()
msgSlotBar.SetParent(self)
msgSlotBar.SetSize(478, 90)
msgSlotBar.SetPosition(10, 35)
msgSlotBar.Show()
self.__children["msgSlotBar"] = msgSlotBar
msgEditline = ui.EditLine()
msgEditline.SetParent(msgSlotBar)
msgEditline.SetSize(478, 90)
msgEditline.SetPosition(7, 3)
msgEditline.SetLimitWidth(469)
msgEditline.SetMultiLine()
msgEditline.SetText("")
msgEditline.Show()
msgEditline.OnIMEUpdate = ui.__mem_func__(self.__OnValueUpdate)
msgEditline.OnPressEscapeKey = ui.__mem_func__(self.Close)
self.__children["msgEditline"] = msgEditline
clearBtn = ui.Button()
clearBtn.SetParent(self)
clearBtn.SetPosition(self.GetWidth() - 50, 8)
clearBtn.SetUpVisual("d:/ymir work/ui/game/guild/Refresh_Button_01.sub")
clearBtn.SetOverVisual("d:/ymir work/ui/game/guild/Refresh_Button_02.sub")
clearBtn.SetDownVisual("d:/ymir work/ui/game/guild/Refresh_Button_03.sub")
clearBtn.SetToolTipText("Clear")
clearBtn.SetEvent(self.__RefreshFunc)
clearBtn.Show()
self.__children["clearBtn"] = clearBtn
sendBtn = ui.Button()
sendBtn.SetParent(self)
sendBtn.SetPosition(430, 135)
sendBtn.SetUpVisual('d:/ymir work/ui/public/middle_button_01.sub')
sendBtn.SetOverVisual('d:/ymir work/ui/public/middle_button_02.sub')
sendBtn.SetDownVisual('d:/ymir work/ui/public/middle_button_03.sub')
sendBtn.SetText("Send")
sendBtn.SetEvent(self.__SendFunc)
sendBtn.Show()
self.__children["sendBtn"] = sendBtn
msgInfo = ui.TextLine()
msgInfo.SetParent(self)
msgInfo.SetPosition(395, 137)
msgInfo.Show()
self.__children["msgInfo"] = msgInfo
self.__ClickChatTypeBtn(0)
self.__SetColor(0)
self.__RefreshFunc()
def ClickRadioButton(self, buttonList, buttonIndex):
try:
selButton = buttonList[buttonIndex]
except IndexError:
return
for eachButton in buttonList:
eachButton.SetUp()
selButton.Down()
def __SetColor(self, btnIndex):
self.ClickRadioButton(self.__children["colorList"], btnIndex)
msgEditline = self.__children["msgEditline"]
if msgEditline:
msgEditline.SetText("{}{}{}".format(
msgEditline.GetText(),
"|r" if "|cff" in msgEditline.GetText().lower() else "",
"|cff" + self.__children["colorTypes"][btnIndex][0] if btnIndex != 0 else ""
))
t = msgEditline.GetText()
msgEditline.SetText("")
ime.PasteString(t)
self.__OnValueUpdate()
def __ClickChatTypeBtn(self, chatIdx):
self.__children["chatIdx"] = chatIdx
self.ClickRadioButton(self.__children["btnList"], chatIdx)
self.__OnValueUpdate()
def __RefreshFunc(self):
self.__children["msgEditline"].SetText("")
self.__children["msgEditline"].SetMax(self.__children["infoBtnDict"][self.__children["chatIdx"]]["maxLength"])
self.__children["msgInfo"].SetText("0/{}".format(self.__children["infoBtnDict"][self.__children["chatIdx"]]["maxLength"]))
def __SendFunc(self):
text = self.__children["msgEditline"].GetText()
if not text or text.isspace():
return
net.SendAdminChat(self.__children["infoBtnDict"][self.__children["chatIdx"]]["chatIdx"], "RO", text)
def __OnValueUpdate(self):
ui.EditLine.OnIMEUpdate(self.__children["msgEditline"])
self.__children["msgInfo"].SetText("{}/{}".format(
len(self.__children["msgEditline"].GetText()),
self.__children["infoBtnDict"][self.__children["chatIdx"]]["maxLength"]
))
def Open(self):
self.__children["msgEditline"].SetFocus()
self.SetTop()
self.Show()
def Close(self):
self.__children["msgEditline"].KillFocus()
self.Hide()
return True
def OnPressEscape(self):
return self.Close()
def OnPressExitKey(self):
return self.Close()