-
Posts
69 -
Joined
-
Last visited
-
Feedback
0%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Posts posted by Dex
-
-
-
Hello fellas,
I have some issues with the encoding of the hyperlinks when using special characters like umlate or diacritics, but can't figure out why is that happen. The database is storing the values right as far and the problem seems to be only on the SHOUT_CHAT.
This is an example of data which is stored in log > shout_log:Dex : |cfff1e6c0|Hitem:115d8:0:6568feca:4:0|h[Schlachtenlöwen-Siegel]|h|r
So how you can see everything seems to be fine, but the client is displaying a question mark instead of the right character as you can see here:
Is it possible somehow that the server isn't returning it correctly so the client is rendering wrong?
Kind regards,
Dex -
Somehow the time stays static and can't be updated in realtime, do you have a solution for that?
I already tried to put the function call inside the OnUpdate function, but still the same.- 1
-
1 hour ago, xGalardo said:
Thanks!!!
I guess the target info system needs to be modified to shop Item IDs correctly, right?
Yes you need to use std::pair as vector as far as I remember.
-
-
If you want to have all in one, you can also use Phabricator so you can manage Projects with Tasks and can also track time, it has also an integrated git.
- 1
-
-
How do the arrangement of each topic works? Because as far as I implement a new Topic in the __CreateObject class, this will overwrite the first element of the list. Altough the function don't even care about the Index given.
What would be the best approach to add an extra option for multi pickup or single pickup? -
-
Hello fellas,
the code pasted below works perfectly with pretty much all functions beside the when function itself. I was wondering if someone can share the code or already have a solution for parsing the array in the when function.
Here is the code which occurs the error mentioned on the topic.
case ST_WHEN_WITH_OR_BEGIN: { assert(nested==2); current_when_condition = ""; if (t.token == TK_WITH) { // here comes Á¶°Ç½Ä next(&lexstate); ostringstream os; os << (lexstate.t); //cout << (lexstate.t); next(&lexstate); while (lexstate.t.token!=TK_DO) { os << " " <<(lexstate.t); //cout << TK_DO<<lexstate.t.token << " " <<(lexstate.t) <<endl; next(&lexstate); } current_when_condition = os.str(); check_syntax("if "+current_when_condition+" then end", current_state_name+current_when_condition); cout << "\twith "; cout << current_when_condition; cout << endl; t = lexstate.t; } if (t.token == TK_DO) { ps = ST_WHEN_BODY; nested++; } else { //error("when doesn't have begin-end clause."); ostringstream os; os << "when doesn't have begin-end clause. (" << t << ")"; error(os.str().c_str()); } } break;
The switch case always return the else condition, does anyone have the missing parser code ?
-
On 4/12/2022 at 11:17 PM, Klaus said:
I've reviewed the codes a few times, but I couldn't get the chat to work, does anyone have any idea what might be happening, or know how I can fix it?
Obs.: In the "locale_game.txt" messages it is as if there are no spaces between the words, I don't know if this has something to do with the main problem.
In advance, I am grateful for your attention.
FIX:
Obs.: Working perfectly, with the exception of the accents in chat all, but in normal chat it works, in case anyone has a fix.
Thank you for the fix, in addition you should mention, that the class std::size will only work with c++17 and higher.
I would like to contribute with the gui for changing the language:Spoilerintrologin.py
under def __init__(self, stream): add self.languageBoard = 0 under def Close(self): add self.languageBoard = None under def __LoadScript(self, fileName): import dbg try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, fileName) except: import exception exception.Abort("LoginWindow.__LoadScript.LoadObject") try: GetObject=self.GetChild self.serverBoard = GetObject("ServerBoard") add this self.languageBoard = GetObject("LanguageBoard") self.OnClickChangeEn = GetObject("ChangeLanguageEn") self.OnClickChangeEs = GetObject("ChangeLanguageEs") self.OnClickChangeHu = GetObject("ChangeLanguageHu") self.OnClickChangeRo = GetObject("ChangeLanguageRo") self.OnClickChangeTr = GetObject("ChangeLanguageTr") self.OnClickChangeDe = GetObject("ChangeLanguageDe") under this except: import exception exception.Abort("LoginWindow.__LoadScript.BindObject") self.selectConnectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectConnectButton)) self.serverBoard.OnKeyUp = ui.__mem_func__(self.__ServerBoard_OnKeyUp) self.xServerBoard, self.yServerBoard = self.serverBoard.GetLocalPosition() self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton)) self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton)) self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton)) self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton)) self.serverList.SetEvent(ui.__mem_func__(self.__OnSelectServer)) self.idEditLine.SetReturnEvent(ui.__mem_func__(self.pwdEditLine.SetFocus)) self.idEditLine.SetTabEvent(ui.__mem_func__(self.pwdEditLine.SetFocus)) self.pwdEditLine.SetReturnEvent(ui.__mem_func__(self.__OnClickLoginButton)) self.pwdEditLine.SetTabEvent(ui.__mem_func__(self.idEditLine.SetFocus)) add this self.OnClickChangeEn.SetEvent(ui.__mem_func__(self.__OnClickChangeLanguage), "en") self.OnClickChangeEs.SetEvent(ui.__mem_func__(self.__OnClickChangeLanguage), "es") self.OnClickChangeHu.SetEvent(ui.__mem_func__(self.__OnClickChangeLanguage), "hu") self.OnClickChangeRo.SetEvent(ui.__mem_func__(self.__OnClickChangeLanguage), "ro") self.OnClickChangeTr.SetEvent(ui.__mem_func__(self.__OnClickChangeLanguage), "tr") self.OnClickChangeDe.SetEvent(ui.__mem_func__(self.__OnClickChangeLanguage), "de") before this: def __OnClickLoginButton(self): add this function def __OnClickChangeLanguage(self, language): self.Languages = { "en" : "0", "es" : "1", "hu" : "2", "ro" : "3", "tr" : "4", "de" : "5"} file = open("mylang.cfg", "w") file.write(self.Languages[str(language)]) file.close() dbg.LogBox("The laguage of client was changed.") dbg.LogBox("Please start your game again.") app.Exit()
loginwindow.py
{ "name" : "LanguageBoard", "type" : "window", "x" : 530, "y" :SCREEN_HEIGHT - SERVER_BOARD_HEIGHT - 122, "width" : 375, "height" : 50, "children" : ( { "name" : "ChangeLanguageEn", "type" : "radio_button", "x": 0, "y": 0, "default_image": "d:/ymir work/ui/game/language/login/flag_en_norm.tga", "over_image": "d:/ymir work/ui/game/language/login/flag_en_over.tga", "down_image": "d:/ymir work/ui/game/language/login/flag_en_norm.tga", }, { "name" : "ChangeLanguageEs", "type" : "radio_button", "x": 40, "y": 0, "default_image": "d:/ymir work/ui/game/language/login/flag_es_norm.tga", "over_image": "d:/ymir work/ui/game/language/login/flag_es_over.tga", "down_image": "d:/ymir work/ui/game/language/login/flag_es_norm.tga", }, { "name" : "ChangeLanguageHu", "type" : "radio_button", "x": 40*2, "y": 0, "default_image": "d:/ymir work/ui/game/language/login/flag_hu_norm.tga", "over_image": "d:/ymir work/ui/game/language/login/flag_hu_over.tga", "down_image": "d:/ymir work/ui/game/language/login/flag_hu_norm.tga", }, { "name" : "ChangeLanguageRo", "type" : "radio_button", "x": 40*3, "y": 0, "default_image": "d:/ymir work/ui/game/language/login/flag_ro_norm.tga", "over_image": "d:/ymir work/ui/game/language/login/flag_ro_over.tga", "down_image": "d:/ymir work/ui/game/language/login/flag_ro_norm.tga", }, { "name" : "ChangeLanguageTr", "type" : "radio_button", "x": 40*4, "y": 0, "default_image": "d:/ymir work/ui/game/language/login/flag_tr_norm.tga", "over_image": "d:/ymir work/ui/game/language/login/flag_tr_over.tga", "down_image": "d:/ymir work/ui/game/language/login/flag_tr_norm.tga", }, { "name" : "ChangeLanguageDe", "type" : "radio_button", "x": 40*5, "y": 0, "default_image": "d:/ymir work/ui/game/language/login/flag_de_norm.tga", "over_image": "d:/ymir work/ui/game/language/login/flag_de_over.tga", "down_image": "d:/ymir work/ui/game/language/login/flag_de_norm.tga", }, ) },
- 30
- 13
- 2
- 19
-
Hello there,
here is a little improvement for the characterwindow which looks like that:
You will be able to switch between tabs with the MouseWheel, so lets get started. First of all you need to put this in your source, after that simply do the following changes to the uicharacter.py:
SpoilerLook for this: def GetState(self): return self.state Add under it this: def OnRunMouseWheel(self, nLen): if nLen > 0: if self.GetState() == "STATUS": self.SetState("SKILL") elif self.GetState() == "SKILL": self.SetState("EMOTICON") elif self.GetState() == "EMOTICON": self.SetState("QUEST") else: if self.GetState() == "SKILL": self.SetState("STATUS") elif self.GetState() == "EMOTICON": self.SetState("SKILL") elif self.GetState() == "QUEST": self.SetState("EMOTICON")
Kind Regards,
Dex- 1
- 3
- 1
-
@Owsap i can confirm the problem with the GetGlobalPosition() function
Spoilerimport ui import grp import chat import wndMgr import net import app import ime import localeInfo import colorInfo import constInfo import systemSetting import player if app.ENABLE_CHATTING_WINDOW_RENEWAL: import os import uiCommon import uiScriptLocale try: import cPickle as pickle except (ImportError, TypeError): import pickle as pickle ENABLE_CHAT_COMMAND = TRUE ENABLE_LAST_SENTENCE_STACK = TRUE ENABLE_INSULT_CHECK = TRUE if localeInfo.IsHONGKONG(): ENABLE_LAST_SENTENCE_STACK = TRUE if localeInfo.IsEUROPE(): ENABLE_CHAT_COMMAND = FALSE if localeInfo.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 = [] if app.ENABLE_CHATTING_WINDOW_RENEWAL: CHECK_BOX_X_POS = 145 OPTION_CHECKBOX_TALKING = 1 OPTION_CHECKBOX_PARTY = 2 OPTION_CHECKBOX_GUILD = 3 OPTION_CHECKBOX_SHOUT = 4 OPTION_CHECKBOX_INFO = 5 OPTION_CHECKBOX_NOTICE = 6 #OPTION_CHECKBOX_DICE = 7 OPTION_CHECKBOX_EXP_INFO = 7 OPTION_CHECKBOX_ITEM_INFO = 8 OPTION_CHECKBOX_MONEY_INFO = 9 OPTION_CHECKBOX_MODE = { chat.CHAT_TYPE_TALKING : OPTION_CHECKBOX_TALKING, chat.CHAT_TYPE_INFO : OPTION_CHECKBOX_INFO, chat.CHAT_TYPE_NOTICE : OPTION_CHECKBOX_NOTICE, chat.CHAT_TYPE_PARTY : OPTION_CHECKBOX_PARTY, chat.CHAT_TYPE_GUILD : OPTION_CHECKBOX_GUILD, chat.CHAT_TYPE_SHOUT : OPTION_CHECKBOX_SHOUT, #chat.CHAT_TYPE_DICE_INFO : OPTION_CHECKBOX_DICE, chat.CHAT_TYPE_EXP_INFO : OPTION_CHECKBOX_EXP_INFO, chat.CHAT_TYPE_ITEM_INFO : OPTION_CHECKBOX_ITEM_INFO, chat.CHAT_TYPE_MONEY_INFO : OPTION_CHECKBOX_MONEY_INFO, } ## ChatSettingWindow class ChatSettingWindow(ui.ScriptWindow): __author__ = "Owsap" __copyright__ = "Copyright 2021, Owsap Productions" class MouseReflector(ui.Window): def __init__(self, parent): ui.Window.__init__(self) self.SetParent(parent) self.AddFlag("not_pick") self.width = self.height = 0 self.isDown = False def __del__(self): ui.Window.__del__(self) def Down(self): self.isDown = True def Up(self): self.isDown = False def OnRender(self): if self.isDown: grp.SetColor(ui.WHITE_COLOR) else: grp.SetColor(ui.HALF_WHITE_COLOR) x, y = self.GetGlobalPosition() grp.RenderBar(x + 2, y + 2, self.GetWidth() - 4, self.GetHeight() - 4) class CheckBox(ui.ImageBox): def __init__(self, parent, x, y, event, filename = "d:/ymir work/ui/chat/chattingoption_check_box_off.sub"): ui.ImageBox.__init__(self) self.SetParent(parent) self.SetPosition(x, y) self.LoadImage(filename) self.mouseReflector = parent.MouseReflector(self) self.mouseReflector.SetSize(self.GetWidth(), self.GetHeight()) image = ui.MakeImageBox(self, "d:/ymir work/ui/public/check_image.sub", 0, 0) image.AddFlag("not_pick") image.SetWindowHorizontalAlignCenter() image.SetWindowVerticalAlignCenter() image.Hide() self.check = False self.enable = True self.image = image self.event = event self.Show() self.mouseReflector.UpdateRect() def __del__(self): ui.ImageBox.__del__(self) def GetCheck(self): return self.check def SetCheck(self, flag): if flag: self.check = True self.image.Show() else: self.check = False self.image.Hide() def Disable(self): self.enable = False def OnMouseOverIn(self): if not self.enable: return self.mouseReflector.Show() def OnMouseOverOut(self): if not self.enable: return self.mouseReflector.Hide() def OnMouseLeftButtonDown(self): if not self.enable: return self.mouseReflector.Down() def OnMouseLeftButtonUp(self): if not self.enable: return self.mouseReflector.Up() self.event() def __init__(self, parent): ui.ScriptWindow.__init__(self) self.isLoaded = False self.parent = parent self.questionDialog = None self.checkBoxSlotDict = {} self.tmpCheckBoxSettingDict = {} self.__LoadWindow() def __del__(self): ui.ScriptWindow.__del__(self) self.isLoaded = False self.parent = None self.questionDialog = None self.checkBoxSlotDict = {} self.tmpCheckBoxSettingDict = {} def __LoadWindow(self): if self.isLoaded: return self.isLoaded = 1 try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/ChatSettingWindow.py") except: import exception exception.Abort("ChatSettingWindow.LoadWindow.LoadScript") try: self.__BindObject() except: import exception exception.Abort("ChatSettingWindow.LoadWindow.BindObject") try: self.__CreateObject() except: import exception exception.Abort("ChatSettingWindow.LoadWindow.CreateObject") try: self.__LoadChattingOptionFile() except: self.__SaveDefault() def __BindObject(self): self.GetChild("board").SetCloseEvent(ui.__mem_func__(self.Close)) self.resetBtn = self.GetChild("reset_button") self.resetBtn.SetEvent(ui.__mem_func__(self.__OnClickPopUpSetting), localeInfo.CHATTING_SETTING_CLEAR_QUESTION) self.saveBtn = self.GetChild("save_button") self.saveBtn.SetEvent(ui.__mem_func__(self.__OnClickSave)) self.cancelBtn = self.GetChild("cancle_button") self.cancelBtn.SetEvent(ui.__mem_func__(self.Close)) def __CreateObject(self): for key in xrange(1, len(OPTION_CHECKBOX_MODE) + 1): event = lambda index = key : ui.__mem_func__(self.SetCurrentChatOption)(index) # chatting_setting_talking_bg.y + (31 * y) yPos = 64 + (31 * 0) #if key >= OPTION_CHECKBOX_DICE: # yPos = 64 + (31 * 1) if key >= OPTION_CHECKBOX_EXP_INFO: yPos = 64 + (31 * 1) self.checkBoxSlotDict[key] = self.CheckBox(self, CHECK_BOX_X_POS, yPos + (18 * (key - 1)), event) def __OnClickSave(self): self.__SaveFile() if self.parent: self.parent.RefreshChatWindow() self.Close() def __GetChattingFile(self): # Create the UserData/chatting path if it doesn't exist. path = ["UserData", "chatting"] try: if not os.path.exists(os.getcwd() + os.sep + path[0] + os.sep + path[1]): os.makedirs(os.getcwd() + os.sep + "UserData" + os.sep + "chatting") except WindowsError as error: pass return "%s/%s/%s" % (path[0], path[1], player.GetName()) # -_-' def __LoadChattingOptionFile(self): load = False try: fileName = self.__GetChattingFile() file = open(fileName) try: load = True self.tmpCheckBoxSettingDict = pickle.load(file) except (ValueError, EOFError, pickle.PicklingError, pickle.UnpicklingError): pass except IOError: pass for key in xrange(1, len(OPTION_CHECKBOX_MODE) + 1): if not load: # Default, always enable and add to dict. value = True self.tmpCheckBoxSettingDict[key] = True else: value = self.tmpCheckBoxSettingDict[key] self.checkBoxSlotDict[key].SetCheck(value) if not load: self.__SaveDefault() def __SaveFile(self): if not self.tmpCheckBoxSettingDict: return try: fileName = self.__GetChattingFile() file = open(fileName, 'wb') pickle.dump(self.tmpCheckBoxSettingDict, file) except IOError: return def __SaveDefault(self): for key in xrange(1, len(OPTION_CHECKBOX_MODE) + 1): self.tmpCheckBoxSettingDict[key] = True try: fileName = self.__GetChattingFile() file = open(fileName, 'wb') pickle.dump(self.tmpCheckBoxSettingDict, file) except IOError: return def __OnClickPopUpSetting(self, text): questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(text) questionDialog.SetAcceptEvent(ui.__mem_func__(self.__QuestionPopupAccept)) questionDialog.SetCancelEvent(ui.__mem_func__(self.__QuestionPopupCancle)) questionDialog.Open() self.questionDialog = questionDialog def __QuestionPopupAccept(self): if not self.questionDialog: return self.__SaveDefault() if self.parent: self.parent.RefreshChatWindow() self.__QuestionPopupCancle() self.Close() def __QuestionPopupCancle(self): self.questionDialog.Close() self.questionDialog = None def SetCurrentChatOption(self, index): value = False if not self.checkBoxSlotDict[index].GetCheck(): value = True self.checkBoxSlotDict[index].SetCheck(value) self.tmpCheckBoxSettingDict.update({index: value}) def GetChatModeSetting(self, mode): try: value = OPTION_CHECKBOX_MODE[mode] return self.tmpCheckBoxSettingDict[value] except KeyError: return True def OnPressEscapeKey(self): self.Close() return True def Open(self): if not self.isLoaded: self.__LoadWindow() try: self.__LoadChattingOptionFile() except: self.__SaveDefault() self.Show() def Close(self): if self.questionDialog: self.questionDialog.Close() self.Hide() ## 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 self.SetWindowName("ChatModeButton") 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 : localeInfo.CHAT_NORMAL, chat.CHAT_TYPE_PARTY : localeInfo.CHAT_PARTY, chat.CHAT_TYPE_GUILD : localeInfo.CHAT_GUILD, chat.CHAT_TYPE_SHOUT : localeInfo.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() if app.LINK_IN_CHAT: def GetLink(self, text): link = "" start = text.find("http://") if start == -1: start = text.find("https://") if start == -1: return "" return text[start:len(text)].split(" ")[0] 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, localeInfo.CHAT_INSULT_STRING) else: if app.LINK_IN_CHAT: link = self.GetLink(text) if link != "": import chr if not chr.IsGameMaster(): text = text.replace(link, "|cFF00C0FC|h|Hweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r") else: text = text.replace(link, "|cFF00C0FC|h|Hsysweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r") net.SendChatPacket(text, type) def __SendPartyChatPacket(self, text): if 1 == len(text): self.RunCloseEvent() return self.__SendChatPacket(text[1:], chat.CHAT_TYPE_PARTY) self.__ResetChat() def __SendGuildChatPacket(self, text): if 1 == len(text): self.RunCloseEvent() return self.__SendChatPacket(text[1:], chat.CHAT_TYPE_GUILD) self.__ResetChat() def __SendShoutChatPacket(self, text): if 1 == len(text): self.RunCloseEvent() return if app.GetTime() < self.lastShoutTime + 15: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_SHOUT_LIMIT) self.__ResetChat() return self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT) self.__ResetChat() self.lastShoutTime = app.GetTime() def __SendTalkingChatPacket(self, text): 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) self.SetWindowName("ChatInputSet") 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(localeInfo.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(localeInfo.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 localeInfo.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 if app.ENABLE_CHATTING_WINDOW_RENEWAL: EDIT_LINE_HIDE_HEIGHT = 20 CHAT_WINDOW_WIDTH = 600 if app.ENABLE_CLEAR_CHAT: CHAT_WINDOW_WIDTH += 20 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 self.SetWindowName("ChatWindow:ChatButton") 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.SetWindowName("ChatWindow") 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 if app.ENABLE_CLEAR_CHAT: self.btnClearChat = ui.Button() self.btnClearChat.SetParent(self) self.btnClearChat.SetUpVisual("d:/ymir work/ui/game/taskbar/clear1.png") self.btnClearChat.SetOverVisual("d:/ymir work/ui/game/taskbar/clear2.png") self.btnClearChat.SetDownVisual("d:/ymir work/ui/game/taskbar/clear3.png") self.btnClearChat.SetToolTipText("Clear Chat") self.btnClearChat.SetEvent(lambda : chat.ClearChat()) self.btnClearChat.Hide() 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(localeInfo.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(localeInfo.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 if app.ENABLE_CHATTING_WINDOW_RENEWAL: imgChatBarLeft = ui.ImageBox() imgChatBarLeft.SetParent(self.btnChatSizing) imgChatBarLeft.AddFlag("not_pick") imgChatBarLeft.LoadImage("d:/ymir work/ui/chat/chat_linebar_left.tga") imgChatBarLeft.Show() self.imgChatBarLeft = imgChatBarLeft imgChatBarRight = ui.ImageBox() imgChatBarRight.SetParent(self.btnChatSizing) imgChatBarRight.AddFlag("not_pick") imgChatBarRight.LoadImage("d:/ymir work/ui/chat/chat_linebar_right.tga") imgChatBarRight.Show() self.imgChatBarRight = imgChatBarRight imgChatBarMiddle = ui.ExpandedImageBox() imgChatBarMiddle.SetParent(self.btnChatSizing) imgChatBarMiddle.AddFlag("not_pick") imgChatBarMiddle.LoadImage("d:/ymir work/ui/chat/chatmenutab_line.tga") imgChatBarMiddle.Show() self.imgChatBarMiddle = imgChatBarMiddle btnChatTab = ui.Button() btnChatTab.SetParent(self.btnChatSizing) btnChatTab.SetUpVisual("d:/ymir work/ui/chat/chatmenutab_down.tga") btnChatTab.SetOverVisual("d:/ymir work/ui/chat/chatmenutab_down.tga") btnChatTab.SetDownVisual("d:/ymir work/ui/chat/chatmenutab_down.tga") btnChatTab.SetToolTipText(uiScriptLocale.CHATTING_SETTING_TALKING, 0, -23) btnChatTab.Show() btnChatTab.Down() self.btnChatTab = btnChatTab btnChatSettingOption = ui.Button() btnChatSettingOption.SetParent(self.btnChatSizing) btnChatSettingOption.SetUpVisual("d:/ymir work/ui/chat/btn_option01_default.tga") btnChatSettingOption.SetOverVisual("d:/ymir work/ui/chat/btn_option01_over.tga") btnChatSettingOption.SetDownVisual("d:/ymir work/ui/chat/btn_option01_down.tga") btnChatSettingOption.SetToolTipText(localeInfo.CHATTING_SETTING_SETTING, 0, -23) btnChatSettingOption.SetEvent(ui.__mem_func__(self.__SettingOptionWndOpen)) btnChatSettingOption.Show() self.btnChatSettingOption = btnChatSettingOption self.wndChatSettingOption = ChatSettingWindow(self) else: 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() if app.ENABLE_CHATTING_WINDOW_RENEWAL: self.RefreshChatWindow() 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, } if app.ENABLE_CHATTING_WINDOW_RENEWAL: CHAT_COLOR_DICT.update({ chat.CHAT_TYPE_EXP_INFO : colorInfo.CHAT_RGB_INFO, chat.CHAT_TYPE_ITEM_INFO : colorInfo.CHAT_RGB_INFO, chat.CHAT_TYPE_MONEY_INFO : colorInfo.CHAT_RGB_INFO, }) 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 if app.ENABLE_CLEAR_CHAT: self.btnClearChat = 0 self.btnChatLog = 0 self.btnChatSizing = 0 if app.ENABLE_CHATTING_WINDOW_RENEWAL: if self.wndChatSettingOption: self.wndChatSettingOption.Close() self.wndChatSettingOption = None ################ ## Open & Close def OpenChat(self): self.SetSize(self.CHAT_WINDOW_WIDTH, 25) 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 localeInfo.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() if app.ENABLE_CHATTING_WINDOW_RENEWAL: self.RefreshChatWindow() self.btnSendWhisper.SetPosition(self.GetWidth() - 50, 2) self.btnSendWhisper.Show() if app.ENABLE_CLEAR_CHAT: self.btnClearChat.SetPosition(self.GetWidth() - 78, -5) self.btnClearChat.Show() self.btnChatLog.SetPosition(self.GetWidth() - 25, 2) self.btnChatLog.Show() self.chatInputSet.Open() self.chatInputSet.SetTop() 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 localeInfo.IsARABIC(): chat.SetPosition(self.chatID, x + width - 10, y + self.EDIT_LINE_HEIGHT) else: chat.SetPosition(self.chatID, x + 10, y + self.EDIT_LINE_HEIGHT) self.SetSize(self.CHAT_WINDOW_WIDTH, 0) self.chatInputSet.Close() self.btnSendWhisper.Hide() if app.ENABLE_CLEAR_CHAT: self.btnClearChat.Hide() self.btnChatLog.Hide() self.btnChatSizing.Hide() self.Refresh() if app.ENABLE_CHATTING_WINDOW_RENEWAL: self.RefreshChatWindow() 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) if app.ENABLE_CHATTING_WINDOW_RENEWAL: self.imgChatBarLeft.SetPosition(0, 17) self.imgChatBarRight.SetPosition(width - 57, 0) self.btnChatTab.SetTextAddPos(uiScriptLocale.CHATTING_SETTING_DEFAULT_TITLE, -2) self.btnChatTab.SetPosition(4, 0) self.btnChatSettingOption.SetPosition(width - 27, 3) self.imgChatBarMiddle.SetPosition(57.0, 0) self.imgChatBarMiddle.SetRenderingRect(0.0, 0.0, float(width - 57.0 * 2) / 57.0 - 1.0, 0.0) else: 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 localeInfo.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 localeInfo.IsARABIC(): chat.SetPosition(self.chatID, x + width - 10, y + self.EDIT_LINE_HEIGHT) else: chat.SetPosition(self.chatID, x + 10, y + self.EDIT_LINE_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 + self.EDIT_LINE_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) if app.ENABLE_CHATTING_WINDOW_RENEWAL: grp.RenderBar(self.xBar, self.yBar + (self.heightBar - self.curHeightBar) + self.EDIT_LINE_HIDE_HEIGHT, self.widthBar, self.curHeightBar) else: 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) if app.ENABLE_CHATTING_WINDOW_RENEWAL: def __SettingOptionWndOpen(self): if self.wndChatSettingOption: if self.wndChatSettingOption.IsShow(): self.wndChatSettingOption.Close() else: self.wndChatSettingOption.Open() def RefreshChatWindow(self): if not self.wndChatSettingOption: return for mode in OPTION_CHECKBOX_MODE.iterkeys(): enable = self.wndChatSettingOption.GetChatModeSetting(mode) if enable: chat.EnableChatMode(self.chatID, mode) else: chat.DisableChatMode(self.chatID, mode) ## ChatLogWindow class ChatLogWindow(ui.Window): BLOCK_WIDTH = 32 CHAT_MODE_NAME = ( localeInfo.CHAT_NORMAL, localeInfo.CHAT_PARTY, localeInfo.CHAT_GUILD, localeInfo.CHAT_SHOUT, localeInfo.CHAT_INFORMATION, localeInfo.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.SetWindowName("ChatLogWindow") 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) if app.ENABLE_CHATTING_WINDOW_RENEWAL: chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_EXP_INFO) chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_ITEM_INFO) chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_MONEY_INFO) 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 localeInfo.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(localeInfo.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 localeInfo.IsARABIC(): titleName.SetPosition(self.GetWidth()-20, 6) else: titleName.SetPosition(20, 6) titleName.SetText(localeInfo.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 localeInfo.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(localeInfo.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) if app.ENABLE_CHATTING_WINDOW_RENEWAL: chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_EXP_INFO) chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_ITEM_INFO) chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_MONEY_INFO) 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) if app.ENABLE_CHATTING_WINDOW_RENEWAL: if mode == chat.CHAT_TYPE_INFO: chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_EXP_INFO) chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_ITEM_INFO) chat.EnableChatMode(self.chatID, chat.CHAT_TYPE_MONEY_INFO) 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 localeInfo.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 localeInfo.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 OnRunMouseWheel(self, nLen): if nLen > 0: self.scrollBar.OnUp() else: self.scrollBar.OnDown() def OnRender(self): (x, y, width, height) = self.GetRect() if localeInfo.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 localeInfo.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)
@rares2017That is normal, because you neither get a notification on exp on the regular chat.
-
Would you like to put also the function for creating new chats through the + sign like official to have different chatwindows for each ?
-
Topic updated ! Metinstones are now also packed!
- 1
- 1
- 1
- 1
- 1
-
-
On 1/22/2021 at 9:31 PM, DevBlade said:
Hey is this also possible for common_drop_item.txt ? Thank you in advance!
It's already reloading common_drop_item.txt ^^
-
Well i think you wanna know how to use the source, because unpacking will be truly difficult without enough knowledge. There are 3 sources, first one the game source, then db and binary. Normally you would find those in the .zip of the files if there is any. Some serverfiles are coming without source code or are underdevelopt. You want to modify your source, you should make the changes in the files of game, db or binary and compile them, after compiling you have to change the old file with the new compiled one.
https://metin2.dev/board/topic/4654-how-to-compile-the-source-code-on-freebsd/
https://metin2.dev/board/topic/140-how-to-compile-metin2-server-source-on-freebsd/
- 1
- 2
-
Just post your uitaskbar.py
-
---------------------------------------------------- -- Power Mount System -- lvl x -- Copyright ©Zymos ---------------------------------------------------- quest p_mount begin state start begin when 80024.use begin chat("hi") end when 20349.take begin if pc.is_mount() then say_title(""..mob_name(20349).."") say("") say("könntest du bitte von deinem Mount absteigen,") say("solange wir miteinander reden? Ich habe einen") say("steifen Nacken und es ist ziemlich anstregend,") say("die ganze Zeit zu dir aufzuschauen zu müssen.") say("") return end chat("time "..item.get_socket(2).."") chat("pos "..item.get_cell().."") item.set_socket( 2,1 ) local vnum = item.get_vnum() if vnum >= 20201 and vnum <= 52090 then if pc.count_item(38100) >= 1 --Powersnack (7 Tage) or pc.count_item(38101) >= 1 --Powersnack (15 Tage) or pc.count_item(38102) >= 1 --Powersnack (30 Tage) then say_title(""..mob_name(20349).."") say("") say("Ich sehe, du besitzt einen Powersnack. Diese") say("wertvolle Heilplane versorgt dein Power Mount") say("mit reiner Energie, um seine Lebenszeit für") say("einige Tage zu verlängern. Was soll ich für dich") say("tun? Möchtest du, dass ich das Leben deines") say("Mounts verlängere oder möchtest du es verbessern") say("lassen?") say("") local i = select ("Verlängern","Verbessern","Abrechen") if i == 1 then local t = select("7 Tage","15 Tage","30 Tage","Abrechen") if t == 1 then --7 Tage if pc.count_item(38100) >= 1 then --Powersnack (7 Tage) say("verlängern 7 tage") pc.removeitem(38100,1) else p_mount.fail_message() end elseif t == 2 then --15 Tage if pc.count_item(38101) >= 1 then --Powersnack (15 Tage) say("verlängern 15 tage") pc.removeitem(38101,1) else p_mount.fail_message() end elseif t == 3 then --30 Tage if pc.count_item(38102) >= 1 then --Powersnack (30 Tage) say("verlängern 30 tage") pc.removeitem(38102,1) else p_mount.fail_message() end else return end elseif i == 2 then if p_mount.upgrade(vnum) == true then pc.give_item2(vnum +5,1) item.remove() else p_mount.fail_message() end end local blub = 1 elseif blub == 2 then --item.get_socket(2) <= 1440 then say_title(""..mob_name(20349).."") say("") say("Dein Mountsiegel hält weniger als 1 Tag noch.") say("Text... Text.. Text..") local f = select("Ja möchte ich","Nein noch nicht") say(""..pc.get_gold().." "..pc.count_item(50068).."") say(""..f.."") if f == 1 then if pc.get_gold() <= 200000 then say_title(""..mob_name(20349).."") say("") say("Um die Laufzeit deines Mounts zu verlängern.") say("Benötigst du 200.000 Yang.") return elseif pc.count_item(50068) == 0 then --Rolle der Mutation say_title(""..mob_name(20349).."") say("") say("Um die Laufzeit deines Mounts zu verlängern.") say("Benötigst du eine "..item_name(50068)..".") say("") say_item_vnum(50068) return elseif pc.get_gold() >= 200000 and pc.count_item(50068) >= 1 then pc.remove_item(50068,1) pc.changegold(-200000) if number(1,2) == 1 then local wert = item.get_socket(2) item.set_socket(2,wert + 60*24* number(1,3)) say("Zeit wurde verlängert") else say("Die Zeitaufwertung ist fehlgeschlagen") end else p_mount.fail_message() end else --Nein noch nicht return end elseif vnum >= 52011 and vnum <= 52015 or vnum >= 52026 and vnum <= 52030 or vnum >= 52041 and vnum <= 52045 or vnum >= 52056 and vnum <= 52060 or vnum >= 52071 and vnum <= 52075 or vnum >= 52086 and vnum <= 52090 then --Tapferere Mounts say_title(""..mob_name(20349).."") say("") say("Dieses Siegel kannst du nicht weiter verbessern.") return elseif pc.count_item(50067) >= 1 or pc.count_item(50068) >= 1 then say_title(""..mob_name(20349).."") say("") say("Wie ich sehe möchtest du wohl dein Mount verbessern.") say("") say("Möchtest du dies?") say("") local m = select("Ja","Nein") if m == 1 then --Ja if p_mount.upgrade(vnum) == true then pc.give_item2(vnum +5,1) --local wert = item.get_socket(2) --Upgrade 1-4 erhöhen laufzeit? ? item.set_socket(2,wert + 60*24* number(1,3)) item.remove() else p_mount.fail_message() end else --Nein return end else p_mount.fail_message() end end end function upgrade(vnum) if (vnum >= 52001 and vnum <= 52005 or vnum >= 52016 and vnum <= 52020 or vnum >= 52031 and vnum <= 52035 or vnum >= 52046 and vnum <= 52050 or vnum >= 52061 and vnum <= 52065 or vnum >= 52076 and vnum <= 52080) and pc.count_item(50067) >= 1 then --junge Mounts und Rolle der Evolution pc.remove_item(50067,1) return true elseif (vnum >= 52006 and vnum <= 52010 or vnum >= 52021 and vnum <= 52025 or vnum >= 52036 and vnum <= 52040 or vnum >= 52051 and vnum <= 52055 or vnum >= 52066 and vnum <= 52070 or vnum >= 52081 and vnum <= 52085) and pc.count_item(50068) >= 1 then --Wilde Mounts und Rolle der Mutation pc.remove_item(50068,1) return true else return false end end when 20349.chat."Ich will mein Mount verbessern" begin say_title(""..mob_name(20349).."") say("") say("Du willst also dein Mount verbessern? Weisst du") say("weißt du denn, wie das geht? Also gut,") say("ich werde es dir erklären.") wait() say_title(""..mob_name(20349).."") say("") say("Um den Mount zu einem Wilden Reittier zu") say("verwandeln, musst du dich auf der Suche nach der") say("Rolle der Evolution begeben. Finde die Rolle der") say("Mutation, damit du das Wilde zu einem Tapferen") say("Reittier ausbilden kanns. Es heisst, sie seien in") say("eineim fernen Land, bewohnt von gefährlichen") say("giganen versteckt!") wait() say_title(""..mob_name(20349).."") say("") say("Bring mir eine dieser Rollen und ich werde den") say("Mount verbessern. Du hast sie nicht zuäfflig") say("schon bei dir?") local v = select("Ja, ich möchte mein Mount verbessern!","Nein, jetzt nicht.") if v == 1 then say("Ziehe das Mount Siegel auf mich hierfür") end end when 20349.chat."Urkunde gegen Mount eintauschen" begin say_title(""..mob_name(20349).."") say("") say("Du möchtest deine Urkunde gegen ein Mount") say("eintauschen? Lass mich sehen, welche du dabei") say("hast. Besitzt du mehere Urkunden, kannst du") say("dich in den folgenden Schritten für eine") say("entscheiden.") wait() say_title(""..mob_name(20349).."") say("") if pc.count_item(52701) >= 1 then --Löwen-Urkunde say("du bringst mir ein "..item_name(52701).."") pc.setqf("mount",1) elseif pc.count_item(52702) >= 1 then --Tiger-Urkunde say("du bringst mir ein "..item_name(52702).."") pc.setqf("mount",2) elseif pc.count_item(52703) >= 1 then --Keiler-Urkunde say("du bringst mir ein "..item_name(52703).."") pc.setqf("mount",3) elseif pc.count_item(52704) >= 1 then --Wolfs-Urkunde say("du bringst mir ein "..item_name(52704).."") pc.setqf("mount",4) elseif pc.count_item(52705) >= 1 then --Rentier-Urkunde (m) say("du bringst mir ein "..item_name(52705).."") pc.setqf("mount",5) elseif pc.count_item(52706) >= 1 then --Rentier-Urkunde (w) say("du bringst mir ein "..item_name(52706).."") pc.setqf("mount",6) else say("Du hast keine Mount-Urkunde bei dir") return end -- say("Für Welcchen Boni entscheidest du dich?") say("") local b = select("Stark gegen Monster","Erfahrung (EXP)","Trefferpunkte (TP)","Verteidigung (DEF)","Angriffswert (AW)","Nein, lieber doch nichht.") if b == 1 then --Stark gegen Monster p_mount.give_seal(pc.getqf("mount"),1) elseif b == 2 then --Erfahrung (EXP) p_mount.give_seal(pc.getqf("mount"),2) elseif b == 3 then --Trefferpunkte (TP) p_mount.give_seal(pc.getqf("mount"),3) elseif b == 4 then --Verteidigung(DEF) p_mount.give_seal(pc.getqf("mount"),4) elseif b == 5 then --Angriffswert (AW) p_mount.give_seal(pc.getqf("mount"),5) end end function fail_message() say_title(""..mob_name(20349).."") say("") say("Tut mir leid, ohne die richtigen Dokumente kann") say("ich nichts für dich tun, Versuche nicht nochmal,") say("mich übers Ohr zu hauenn, sonst lass ich dich") say("dafür bezahlen.") end function give_seal(a,b) if a == 1 then --Löwen-Urkunde if b == 1 then --Start pc.give_item2( 52031 ) item.set_socket( 52031 , 100 ) --pc.give_item2(52031,1) --Stark gegen Monster pc.remove_item(52701,1) --Löwen-Urkunde return true elseif b == 2 then pc.give_item2(52032,1) --Erfahrung pc.remove_item(52701,1) --Löwen-Urkunde elseif b == 3 then pc.give_item2(52033,1) --Tp pc.remove_item(52701,1) --Löwen-Urkunde elseif b == 4 then pc.give_item2(52034,1) --Verteidigungswert pc.remove_item(52701,1) --Löwen-Urkunde elseif b == 5 then pc.give_item2(52035,1) --Angriffswert pc.remove_item(52701,1) --Löwen-Urkunde else return end elseif a == 2 then --Tiger-Urkunde if b == 1 then --Start pc.give_item2(52046,1) --Stark gegen Monster pc.remove_item(52702,1) --Tiger-Urkunde elseif b == 2 then pc.give_item2(52047,1) --Erfahrung pc.remove_item(52702,1) --Tiger-Urkunde elseif b == 3 then pc.give_item2(52048,1) --Tp pc.remove_item(52702,1) --Tiger-Urkunde elseif b == 4 then pc.give_item2(52049,1) --Verteidigungswert pc.remove_item(52702,1) --Tiger-Urkunde elseif b == 5 then pc.give_item2(52050,1) --Angriffswert pc.remove_item(52702,1) --Tiger-Urkunde else return end elseif a == 3 then --Keiler-Urkunde if b == 1 then --Start pc.give_item2(52001,1) --Stark gegen Monster pc.remove_item(52703,1) --Keiler-Urkunde elseif b == 2 then pc.give_item2(52002,1) --Erfahrung pc.remove_item(52703,1) --Keiler-Urkunde elseif b == 3 then pc.give_item2(52003,1) --Tp pc.remove_item(52703,1) --Keiler-Urkunde elseif b == 4 then pc.give_item2(52004,1) --Verteidigungswert pc.remove_item(52703,1) --Keiler-Urkunde elseif b == 5 then pc.give_item2(52005,1) --Angriffswert pc.remove_item(52703,1) --Keiler-Urkunde else return end elseif a == 4 then --Wolfs-Urkunde if b == 1 then --Start pc.give_item2(52016,1) --Stark gegen Monster pc.remove_item(52704,1) --Wolfs-Urkunde elseif b == 2 then pc.give_item2(52017,1) --Erfahrung pc.remove_item(52704,1) --Wolfs-Urkunde elseif b == 3 then pc.give_item2(52018,1) --Tp pc.remove_item(52704,1) --Wolfs-Urkunde elseif b == 4 then pc.give_item2(52019,1) --Verteidigungswert pc.remove_item(52704,1) --Wolfs-Urkunde elseif b == 5 then pc.give_item2(52020,1) --Angriffswert pc.remove_item(52704,1) --Wolfs-Urkunde else return end elseif a == 5 then --Rentier-Urkunde m if b == 1 then --Start pc.give_item2(52016,1) --Stark gegen Monster pc.remove_item(52705,1) --Rentier-Urkunde elseif b == 2 then pc.give_item2(52062,1) --Erfahrung pc.remove_item(52705,1) --Rentier-Urkunde elseif b == 3 then pc.give_item2(52063,1) --Tp pc.remove_item(52705,1) --Rentier-Urkunde elseif b == 4 then pc.give_item2(52064,1) --Verteidigungswert pc.remove_item(52705,1) --Rentier-Urkunde elseif b == 5 then pc.give_item2(52065,1) --Angriffswert pc.remove_item(52705,1) --Rentier-Urkunde else return end elseif a == 6 then --Rentier-Urkunde w if b == 1 then --Start pc.give_item2(52076,1) --Stark gegen Monster pc.remove_item(52706,1) --Rentier-Urkunde elseif b == 2 then pc.give_item2(52077,1) --Erfahrung pc.remove_item(52706,1) --Rentier-Urkunde elseif b == 3 then pc.give_item2(52078,1) --Tp pc.remove_item(52706,1) --Rentier-Urkunde elseif b == 4 then pc.give_item2(52079,1) --Verteidigungswert pc.remove_item(52706,1) --Rentier-Urkunde elseif b == 5 then pc.give_item2(52080,1) --Angriffswert pc.remove_item(52706,1) --Rentier-Urkunde else return end end end when 52001.use or 52002.use or 52003.use or 52004.use or 52005.use or 52006.use or 52007.use or 52008.use or 52009.use or 52010.use or 52011.use or 52012.use or 52013.use or 52014.use or 52015.use or 52016.use or 52017.use or 52018.use or 52019.use or 52020.use or 52021.use or 52022.use or 52023.use or 52024.use or 52025.use or 52026.use or 52027.use or 52028.use or 52029.use or 52030.use or 52031.use or 52032.use or 52033.use or 52034.use or 52035.use or 52036.use or 52037.use or 52038.use or 52039.use or 52040.use or 52041.use or 52042.use or 52043.use or 52044.use or 52045.use or 52046.use or 52047.use or 52048.use or 52049.use or 52050.use or 52051.use or 52052.use or 52053.use or 52054.use or 52055.use or 52056.use or 52057.use or 52058.use or 52059.use or 52060.use or 52061.use or 52062.use or 52063.use or 52064.use or 52065.use or 52066.use or 52067.use or 52068.use or 52069.use or 52070.use or 52071.use or 52072.use or 52073.use or 52074.use or 52075.use or 52076.use or 52077.use or 52078.use or 52079.use or 52080.use or 52081.use or 52082.use or 52083.use or 52084.use or 52085.use or 52086.use or 52087.use or 52088.use or 52089.use or 52090.use begin local vnum = item.get_vnum() local mounts_horse_lvl = horse.get_level() local player_level = pc.get_level() chat("#debug active pet: "..pc.getf("pets","pet_active").."") chat("#debug active pet: "..pc.getf("pets","old_horse_level").."") if pc.getf("pets","pet_active") == 1 or horse.is_summon() and horse.get_level() >= 22 then mounts_horse_lvl = pc.getf("pets","old_horse_level") end if pc.is_polymorphed() then say("Du kannst nicht reiten während du Verwandelt bist!") return elseif pc.is_mount() then pc.unmount() return end if vnum >= 52006 and vnum <= 52010 or vnum >= 52021 and vnum <= 52025 or vnum >= 52036 and vnum <= 52040 or vnum >= 52051 and vnum <= 52055 or vnum >= 52066 and vnum <= 52070 or vnum >= 52081 and vnum <= 52085 then --Wilde Mounts if player_level < 35 then syschat("Dein Level ist zu niedrig um dieses Mount zu benutzen!") chat("#debug# If 1") return end if mounts_horse_lvl < 11 then syschat("Dein Pferde-level ist zu niedrig um dieses Mount zu benutzen! #debug# "..mounts_horse_lvl.."") chat("#debug# If 1") return end elseif vnum >= 52011 and vnum <= 52015 or vnum >= 52026 and vnum <= 52030 or vnum >= 52041 and vnum <= 52045 or vnum >= 52056 and vnum <= 52060 or vnum >= 52071 and vnum <= 52075 or vnum >= 52086 and vnum <= 52090 then --Tapferere Mounts if player_level < 50 then syschat("Dein Level ist zu niedrig um dieses Mount zu benutzen!") chat("#debug# If 1") return end if mounts_horse_lvl < 21 then syschat("Dein Pferde-level ist zu niedrig um dieses Mount zu benutzen! #debug# "..mounts_horse_lvl.."") chat("#debug# If 1") return end end local check = p_mount.give_mount_bonus(vnum) if check == true then local timee = 3600 --item.get_socket(2)*60 syschat("Dein Mount wurde erfolgreich gerufen.") else syschat("Es ist ein Fehler aufgetreten als du dein Mount rufen wolltest.") end end function give_mount_bonus(a) pc.delqf("mount") local vnum = a local mounts_bonus = { [20201] = { 20201,'NO_SKILL',0}, --Junger Keiler [52002] = { 20201,'NO_SKILL',0}, --Junger Keiler [52003] = { 20201,'NO_SKILL',0}, --Junger Keiler [52004] = { 20201,'NO_SKILL',0}, --Junger Keiler [52005] = { 20201,'NO_SKILL',0}, --Junger Keiler [52006] = { 20205,apply.ATTBONUS_MONSTER,3}, --Wilder Keiler [52007] = { 20205,apply.EXP_DOUBLE_BONUS,3}, --Wilder Keiler [52008] = { 20205,apply.MAX_HP,250}, --Wilder Keiler [52009] = { 20205,apply.DEF_GRADE_BONUS,50}, --Wilder Keiler [52010] = { 20205,apply.ATT_GRADE_BONUS,30}, --Wilder Keiler [52011] = { 20209,apply.ATTBONUS_MONSTER,5}, --Tapferer Keiler [52012] = { 20209,apply.EXP_DOUBLE_BONUS,5}, --Tapferer Keiler [52013] = { 20209,apply.MAX_HP,500}, --Tapferer Keiler [52014] = { 20209,apply.DEF_GRADE_BONUS,150}, --Tapferer Keiler [52015] = { 20209,apply.ATT_GRADE_BONUS,100}, --Tapferer Keiler [52016] = { 20202,'NO_SKILL',0}, --Junger Wolf [52017] = { 20202,'NO_SKILL',0}, --Junger Wolf [52018] = { 20202,'NO_SKILL',0}, --Junger Wolf [52019] = { 20202,'NO_SKILL',0}, --Junger Wolf [52020] = { 20202,'NO_SKILL',0}, --Junger Wolf [52021] = { 20206,apply.ATTBONUS_MONSTER,3}, --Wilder Wolf [52022] = { 20206,apply.EXP_DOUBLE_BONUS,3}, --Wilder Wolf [52023] = { 20206,apply.MAX_HP,250}, --Wilder Wolf [52024] = { 20206,apply.DEF_GRADE_BONUS,50}, --Wilder Wolf [52025] = { 20206,apply.ATT_GRADE_BONUS,30}, --Wilder Wolf [52026] = { 20210,apply.ATTBONUS_MONSTER,5}, --Tapferer Wolf [52027] = { 20210,apply.EXP_DOUBLE_BONUS,5}, --Tapferer Wolf [52028] = { 20210,apply.MAX_HP,500}, --Tapferer Wolf [52029] = { 20210,apply.DEF_GRADE_BONUS,150}, --Tapferer Wolf [52030] = { 20210,apply.ATT_GRADE_BONUS,100}, --Tapferer Wolf [52031] = { 20204,'NO_SKILL',0}, --Junger Löwe [52032] = { 20204,'NO_SKILL',0}, --Junger Löwe [52033] = { 20204,'NO_SKILL',0}, --Junger Löwe [52034] = { 20204,'NO_SKILL',0}, --Junger Löwe [52035] = { 20204,'NO_SKILL',0}, --Junger Löwe [52036] = { 20208,apply.ATTBONUS_MONSTER,3}, --Wilder Löwe [52037] = { 20208,apply.EXP_DOUBLE_BONUS,3}, --Wilder Löwe [52038] = { 20208,apply.MAX_HP,250}, --Wilder Löwe [52039] = { 20208,apply.DEF_GRADE_BONUS,50}, --Wilder Löwe [52040] = { 20208,apply.ATT_GRADE_BONUS,30}, --Wilder Löwe [52041] = { 20212,apply.ATTBONUS_MONSTER,5}, --Tapferer Löwe [52042] = { 20212,apply.EXP_DOUBLE_BONUS,5}, --Tapferer Löwe [52043] = { 20212,apply.MAX_HP,500}, --Tapferer Löwe [52044] = { 20212,apply.DEF_GRADE_BONUS,150}, --Tapferer Löwe [52045] = { 20212,apply.ATT_GRADE_BONUS,100}, --Tapferer Löwe [52046] = { 20203,'NO_SKILL',0}, --Junger Tiger [52047] = { 20203,'NO_SKILL',0}, --Junger Tiger [52048] = { 20203,'NO_SKILL',0}, --Junger Tiger [52049] = { 20203,'NO_SKILL',0}, --Junger Tiger [52050] = { 20203,'NO_SKILL',0}, --Junger Tiger [52051] = { 20207,apply.ATTBONUS_MONSTER,3}, --Wilder Tiger [52052] = { 20207,apply.EXP_DOUBLE_BONUS,3}, --Wilder Tiger [52053] = { 20207,apply.MAX_HP,250}, --Wilder Tiger [52054] = { 20207,apply.DEF_GRADE_BONUS,50}, --Wilder Tiger [52055] = { 20207,apply.ATT_GRADE_BONUS,30}, --Wilder Tiger [52056] = { 20211,apply.ATTBONUS_MONSTER,5}, --Tapferer Tiger [52057] = { 20211,apply.EXP_DOUBLE_BONUS,5}, --Tapferer Tiger [52058] = { 20211,apply.MAX_HP,500}, --Tapferer Tiger [52059] = { 20211,apply.DEF_GRADE_BONUS,150}, --Tapferer Tiger [52060] = { 20211,apply.ATT_GRADE_BONUS,100}, --Tapferer Tiger [52061] = { 20213,'NO_SKILL',0}, --Junger Rentier-Siegel (m) [52062] = { 20213,'NO_SKILL',0}, --Junger Rentier-Siegel (m) [52063] = { 20213,'NO_SKILL',0}, --Junger Rentier-Siegel (m) [52064] = { 20213,'NO_SKILL',0}, --Junger Rentier-Siegel (m) [52065] = { 20213,'NO_SKILL',0}, --Junger Rentier-Siegel (m) [52066] = { 20214,apply.ATTBONUS_MONSTER,3}, --Wilder Rentier-Siegel (m) [52067] = { 20214,apply.EXP_DOUBLE_BONUS,3}, --Wilder Rentier-Siegel (m) [52068] = { 20214,apply.MAX_HP,250}, --Wilder Rentier-Siegel (m) [52069] = { 20214,apply.DEF_GRADE_BONUS,50}, --Wilder Rentier-Siegel (m) [52070] = { 20214,apply.ATT_GRADE_BONUS,30}, --Wilder Rentier-Siegel (m) [52071] = { 20215,apply.ATTBONUS_MONSTER,5}, --Tapferer Rentier-Siegel (m) [52072] = { 20215,apply.EXP_DOUBLE_BONUS,5}, --Tapferer Rentier-Siegel (m) [52073] = { 20215,apply.MAX_HP,500}, --Tapferer Rentier-Siegel (m) [52074] = { 20215,apply.DEF_GRADE_BONUS,150}, --Tapferer Rentier-Siegel (m) [52075] = { 20215,apply.ATT_GRADE_BONUS,100}, --Tapferer Rentier-Siegel (m) [52076] = { 20216,'NO_SKILL',0}, --Junger Rentier-Siegel (w) [52077] = { 20216,'NO_SKILL',0}, --Junger Rentier-Siegel (w) [52078] = { 20216,'NO_SKILL',0}, --Junger Rentier-Siegel (w) [52079] = { 20216,'NO_SKILL',0}, --Junger Rentier-Siegel (w) [52080] = { 20216,'NO_SKILL',0}, --Junger Rentier-Siegel (w) [52081] = { 20217,apply.ATTBONUS_MONSTER,3}, --Wilder Rentier-Siegel (w) [52082] = { 20217,apply.EXP_DOUBLE_BONUS,3}, --Wilder Rentier-Siegel (w) [52083] = { 20217,apply.MAX_HP,250}, --Wilder Rentier-Siegel (w) [52084] = { 20217,apply.DEF_GRADE_BONUS,50}, --Wilder Rentier-Siegel (w) [52085] = { 20217,apply.ATT_GRADE_BONUS,30}, --Wilder Rentier-Siegel (w) [52086] = { 20218,apply.ATTBONUS_MONSTER,5}, --Tapferer Rentier-Siegel (w) [52087] = { 20218,apply.EXP_DOUBLE_BONUS,5}, --Tapferer Rentier-Siegel (w) [52088] = { 20218,apply.MAX_HP,500}, --Tapferer Rentier-Siegel (w) [52089] = { 20218,apply.DEF_GRADE_BONUS,150}, --Tapferer Rentier-Siegel (w) [52090] = { 20218,apply.ATT_GRADE_BONUS,100} --Tapferer Rentier-Siegel (w) --20201 boar_0 --junger --20202 dog_god_0 --junger --20203 fire_tiger_0 --junger --20204 lion_0 --junger --20205 boar_2 --Wilder --20206 dog_god_2 --Wilder --20207 fire_tiger_2 --Wilder --20208 lion_2 --Wilder --20209 boar_3 --Tapfer --20210 dog_god_3 --Tapfer --20211 fire_tiger_3 --Tapfer --20212 lion_3 --Tapfer --Tapfer --20213 reindeer_male1 --junger --20214 reindeer_male2 --Wilder --20215 reindeer_male3 --20216 reindeer_female1 --junger --20217 reindeer_female2 --Wilder --20218 reindeer_female3 --Tapfer } local ride_npc = mounts_bonus[a][1] local ride_time = 60*60*5 --item.get_socket(2)*60 local ride_skill = mounts_bonus[a][2] local ride_value = mounts_bonus[a][3] pc.mount(ride_npc,ride_time) chat("#debug#ride_npc "..ride_npc.."") chat("#debug#ride_time "..ride_time.."") chat("#debug#ride_skill "..ride_skill.."") chat("#debug#ride_value "..ride_value.."") chat("debug#vnum "..vnum.."") if vnum >= 52001 and vnum <= 52005 or vnum >= 52016 and vnum <= 52020 or vnum >= 52031 and vnum <= 52035 or vnum >= 52046 and vnum <= 52050 or vnum >= 52061 and vnum <= 52065 or vnum >= 52076 and vnum <= 52080 then --Junge Mounts (30+ Bewegungspeed) pc.mount_bonus(apply.MOV_SPEED, 30, ride_time ) chat("debug# 30 speed") return true elseif vnum >= 52006 and vnum <= 52010 or vnum >= 52021 and vnum <= 52025 or vnum >= 52036 and vnum <= 52040 or vnum >= 52051 and vnum <= 52055 or vnum >= 52066 and vnum <= 52070 or vnum >= 52081 and vnum <= 52085 then --Wilde Mounts (40+ Bewegungspeed) pc.mount_bonus(apply.MOV_SPEED, 40, ride_time ) pc.mount_bonus(ride_skill, ride_value, ride_time) chat("debug# 40 speed") return true elseif vnum >= 52011 and vnum <= 52015 or vnum >= 52026 and vnum <= 52030 or vnum >= 52041 and vnum <= 52045 or vnum >= 52056 and vnum <= 52060 or vnum >= 52071 and vnum <= 52075 or vnum >= 52086 and vnum <= 52090 then --Tapferere Mounts (50+ Bewegungspeed) pc.mount_bonus(apply.MOV_SPEED, 50, ride_time) pc.mount_bonus(ride_skill, ride_value, ride_time ) chat("debug# 50 speed") return true else syschat("Power Mount: FEHLERCODE #00123#") return false end end end end
-
You have to connect to your database, select 'player' then select your table 'item_attr', now you have to add for each column a value.
-
uiTaskbar.py there will be the functionality of the buttons, for the images and positions you have to look in locale_xx/locale/ui/taskbar.py
- 1
-
uiInventory.py class InventoryWindow
-
Hey guys,
i need a Hint about how to bind the interface of the Safebox into the SpecialStorage like this :
i tried through RefreshBagSlotWindow by calling the safebox function but it's not working.
Here is my code(uiSpecialStorage.py):
Spoilerimport ui import player import mouseModule import net import app import snd import item import chat import uiScriptLocale import uiCommon import uiPrivateShopBuilder import uiPickMoney import localeInfo import constInfo if app.ENABLE_EXTEND_INVEN_SYSTEM: EX_INVEN_COVER_IMG_OPEN = "d:/ymir work/ui/ex_inven_cover_button_open.sub" EX_INVEN_COVER_IMG_CLOSE = "d:/ymir work/ui/ex_inven_cover_button_close.sub" class SpecialStorageWindow(ui.ScriptWindow): STORAGE_TYPE = 0 ITEMSHOP_TYPE = 1 UPGRADE_TYPE = 2 BOOK_TYPE = 3 STONE_TYPE = 4 SORT_UPGRADE = 0 SORT_BOOK = 1 SORT_STONE = 2 SLOT_WINDOW_TYPE = { STORAGE_TYPE : {"window" : player.SAFEBOX, "slot" : player.SLOT_TYPE_SAFEBOX}, ITEMSHOP_TYPE : {"window" : player.MALL, "slot" : player.SLOT_TYPE_MALL}, UPGRADE_TYPE : {"window" : player.UPGRADE_INVENTORY, "slot" : player.SLOT_TYPE_UPGRADE_INVENTORY}, BOOK_TYPE : {"window" : player.BOOK_INVENTORY, "slot" : player.SLOT_TYPE_BOOK_INVENTORY}, STONE_TYPE : {"window" : player.STONE_INVENTORY, "slot" : player.SLOT_TYPE_STONE_INVENTORY} } WINDOW_NAMES = { STORAGE_TYPE : "Lager", ITEMSHOP_TYPE : "Itemshop", UPGRADE_TYPE : "Upgrade", BOOK_TYPE : "Books", STONE_TYPE : "Steine" } COMMANDS = { SORT_UPGRADE : "/sort_special_inventory 0", SORT_BOOK : "/sort_special_inventory 1", SORT_STONE : "/sort_special_inventory 2" } def __init__(self): ui.ScriptWindow.__init__(self) self.questionDialog = None self.tooltipItem = None self.dlgSplitItems = None self.sellingSlotNumber = -1 self.isLoaded = 0 self.inventoryPageIndex = 0 self.categoryPageIndex = 0 self.SetWindowName("SpecialStorageWindow") self.__LoadWindow() def __del__(self): ui.ScriptWindow.__del__(self) def Show(self): self.__LoadWindow() ui.ScriptWindow.Show(self) def __LoadWindow(self): if self.isLoaded == 1: return self.isLoaded = 1 try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/SpecialStorageWindow.py") except: import exception exception.Abort("SpecialStorageWindow.LoadWindow.LoadObject") try: wndItem = self.GetChild("ItemSlot") self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close)) self.titleName = self.GetChild("TitleName") self.inventoryTab = [] self.inventoryTab.append(self.GetChild("Inventory_Tab_01")) self.inventoryTab.append(self.GetChild("Inventory_Tab_02")) self.inventoryTab.append(self.GetChild("Inventory_Tab_03")) self.inventoryTab.append(self.GetChild("Inventory_Tab_04")) self.inventoryTab.append(self.GetChild("Inventory_Tab_05")) self.categoryTab = [] self.categoryTab.append(self.GetChild("Category_Tab_01")) self.categoryTab.append(self.GetChild("Category_Tab_02")) self.categoryTab.append(self.GetChild("Category_Tab_03")) self.categoryTab.append(self.GetChild("Category_Tab_04")) self.categoryTab.append(self.GetChild("Category_Tab_05")) self.sortSpecialInventoryButton = self.GetChild2("SortSpecialButton") if app.ENABLE_EXTEND_INVEN_SYSTEM: self.__CreateExtendInvenButton() self.ExInvenQuestionDlg = uiCommon.QuestionDialog() self.ExInvenQuestionDlg.Close() self.pop = None except: import exception exception.Abort("SpecialStorageWindow.LoadWindow.BindObject") ## Item wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem)) wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot)) wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot)) wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot)) wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot)) ##SPECIAL STORAGE SORT BUTTON self.sortSpecialInventoryButton.SetEvent(ui.__mem_func__(self.ClickSortSpecialInventory)) ## Grade button self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg)) self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg)) self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg)) self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg)) self.inventoryTab[4].SetEvent(lambda arg=4: self.SetInventoryPage(arg)) self.inventoryTab[0].Down() self.categoryTab[0].SetEvent(lambda arg=0: self.SetCategoryPage(arg)) self.categoryTab[1].SetEvent(lambda arg=1: self.SetCategoryPage(arg)) self.categoryTab[2].SetEvent(lambda arg=2: self.SetCategoryPage(arg)) self.categoryTab[3].SetEvent(lambda arg=3: self.SetCategoryPage(arg)) self.categoryTab[4].SetEvent(lambda arg=4: self.SetCategoryPage(arg)) self.categoryTab[0].Down() ## Etc self.wndItem = wndItem self.wndPopupDialog = uiCommon.PopupDialog() self.dlgSplitItems = uiPickMoney.PickMoneyDialog() self.dlgSplitItems.LoadDialog() self.dlgSplitItems.Hide() if app.ENABLE_HIGHLIGHT_SYSTEM: self.listHighlightedSlot = [] self.SetInventoryPage(0) self.SetCategoryPage(0) self.RefreshItemSlot() self.RefreshBagSlotWindow() def Destroy(self): self.ClearDictionary() self.tooltipItem = None self.wndItem = 0 self.questionDialog = None self.dlgSplitItems.Destroy() self.dlgSplitItems = None self.inventoryTab = [] self.categoryTab = [] self.titleName = None if app.ENABLE_EXTEND_INVEN_SYSTEM: self.ExInvenButton = [] if self.ExInvenQuestionDlg: self.ExInvenQuestionDlg.Close() def Close(self): if None != self.tooltipItem: self.tooltipItem.HideToolTip() if self.dlgSplitItems: self.dlgSplitItems.Close() self.Hide() def ClickSortSpecialInventory(self): net.SendChatPacket(self.COMMANDS[self.categoryPageIndex]) if app.ENABLE_HIGHLIGHT_SYSTEM: def HighlightSlot(self, slot): if not slot in self.listHighlightedSlot: self.listHighlightedSlot.append(slot) def SetInventoryPage(self, page): self.inventoryTab[self.inventoryPageIndex].SetUp() self.inventoryPageIndex = page self.inventoryTab[self.inventoryPageIndex].Down() self.RefreshBagSlotWindow() if app.ENABLE_EXTEND_INVEN_SYSTEM: def __CreateExtendInvenButton(self): parent = self.GetChild("board") self.ExInvenButton = [] start_x = 8 start_y = 34 img_height = 32 for button_index in range(player.INVENTORY_LOCKED_PAGE_COUNT*9): ex_inven_button = ui.Button() increase_y = img_height * (button_index % 9) ex_inven_button.SetParent(parent) ex_inven_button.SetPosition(start_x, start_y + increase_y ) ex_inven_button.SetUpVisual(EX_INVEN_COVER_IMG_CLOSE) ex_inven_button.SetOverVisual(EX_INVEN_COVER_IMG_CLOSE) ex_inven_button.SetDownVisual(EX_INVEN_COVER_IMG_CLOSE) ex_inven_button.SetDisableVisual(EX_INVEN_COVER_IMG_CLOSE) ex_inven_button.SetEvent(ui.__mem_func__(self.__ClickExtendInvenButton), button_index) ex_inven_button.Hide() self.ExInvenButton.append(ex_inven_button) def __ClickExtendInvenButton(self, index): if index >= len(self.ExInvenButton): self.__OpenExInvenMsgDlg(localeInfo.EXINVEN_USE_ITEM_FAIL_FOURTH_PAGE_STAGE_MAX) return if self.ExInvenQuestionDlg and index == player.GetExtendInvenStage(): needkeys = [] for n in range(player.INVENTORY_NEED_KEY_START, (player.INVENTORY_LOCKED_PAGE_COUNT*player.INVENTORY_NEED_KEY_INCREASE)+2): for i in range(3): needkeys.append(n) self.ExInvenQuestionDlg.SetText(localeInfo.EXINVEN_USE_ITEM_QUESTION % needkeys[index]) self.ExInvenQuestionDlg.SetAcceptEvent(ui.__mem_func__(self.__AcceptExInvenItemUse)) self.ExInvenQuestionDlg.SetCancelEvent(ui.__mem_func__(self.__CancelExInvenItemUse)) w,h = self.ExInvenQuestionDlg.GetTextSize() self.ExInvenQuestionDlg.SetWidth( w + 40 ) self.ExInvenQuestionDlg.Open() def __HideAllExtendInvenButton(self): for index in range( len(self.ExInvenButton) ): self.ExInvenButton[index].Hide() def __ShowExtendInvenButton(self, cur_stage): if self.inventoryPageIndex < player.INVENTORY_OPEN_PAGE_COUNT: return count = 9 min_range = (self.inventoryPageIndex - player.INVENTORY_OPEN_PAGE_COUNT) * count max_range = min_range + count for button_index in range(min_range, max_range): if button_index == cur_stage: self.ExInvenButton[button_index].SetUpVisual(EX_INVEN_COVER_IMG_OPEN) self.ExInvenButton[button_index].SetOverVisual(EX_INVEN_COVER_IMG_OPEN) self.ExInvenButton[button_index].SetDownVisual(EX_INVEN_COVER_IMG_OPEN) self.ExInvenButton[button_index].SetDisableVisual(EX_INVEN_COVER_IMG_OPEN) if button_index < cur_stage: self.ExInvenButton[button_index].Hide() else: self.ExInvenButton[button_index].Show() def __RefreshExinvenCoverSlot(self): self.__HideAllExtendInvenButton() self.__ShowExtendInvenButton(player.GetExtendInvenStage()) def __AcceptExInvenItemUse(self): net.Envanter_genislet() self.ExInvenQuestionDlg.Close() def __CancelExInvenItemUse(self): self.ExInvenQuestionDlg.Close() def __OpenExInvenMsgDlg(self, msg): popup = uiCommon.PopupDialog() popup.SetText(msg) popup.SetAcceptEvent(self.__OnClosePopupDialog) w,h = popup.GetTextSize() popup.SetWidth( w + 40 ) popup.Open() if self.pop: self.pop.Destroy() self.pop = popup def OpenExInvenFallShortCountMsgDlg(self, enough_count): popup = uiCommon.PopupDialog() popup.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FALL_SHORT % int(enough_count) ) popup.SetAcceptEvent(self.__OnClosePopupDialog) popup.Open() if self.pop: self.pop.Destroy() self.pop = popup def SetCategoryPage(self, page): self.categoryTab[self.categoryPageIndex].SetUp() self.categoryPageIndex = page self.categoryTab[self.categoryPageIndex].Down() self.titleName.SetText(self.WINDOW_NAMES[self.categoryPageIndex]) self.RefreshBagSlotWindow() def SetItemToolTip(self, tooltipItem): self.tooltipItem = tooltipItem def RefreshItemSlot(self): self.RefreshBagSlotWindow() def RefreshStatus(self): self.RefreshItemSlot() def __InventoryLocalSlotPosToGlobalSlotPos(self, localSlotPos): return self.inventoryPageIndex * player.SPECIAL_PAGE_SIZE + localSlotPos def RefreshBagSlotWindow(self): getItemVNum=player.GetItemIndex getItemCount=player.GetItemCount setItemVnum=self.wndItem.SetItemSlot for i in xrange(player.SPECIAL_PAGE_SIZE): self.wndItem.EnableSlot(i) slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i) itemCount = getItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotNumber) itemVnum = getItemVNum(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotNumber) if 0 == itemCount: self.wndItem.ClearSlot(i) continue elif 1 == itemCount: itemCount = 0 setItemVnum(i, itemVnum, itemCount) if app.ENABLE_HIGHLIGHT_SYSTEM: if slotNumber in self.listHighlightedSlot: self.wndItem.ActivateSlot(i) self.wndItem.RefreshSlot() if app.ENABLE_EXTEND_INVEN_SYSTEM: self.__RefreshExinvenCoverSlot() def ShowToolTip(self, slotIndex): if None != self.tooltipItem: self.tooltipItem.SetInventoryItem(slotIndex, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"]) def OnPressEscapeKey(self): self.Close() return True def OnTop(self): if None != self.tooltipItem: self.tooltipItem.SetTop() def OverOutItem(self): self.wndItem.SetUsableItem(False) if None != self.tooltipItem: self.tooltipItem.HideToolTip() def OverInItem(self, overSlotPos): if app.ENABLE_HIGHLIGHT_SYSTEM: stat = 0 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos) itemVnum = player.GetItemIndex(slotNumber) if constInfo.IS_AUTO_POTION(itemVnum): metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)] if slotNumber >= player.SPECIAL_PAGE_SIZE: slotNumber -= player.SPECIAL_PAGE_SIZE isActivated = 0 != metinSocket[0] if isActivated: stat = 1 if not stat: self.wndItem.DeactivateSlot(overSlotPos) try: self.listHighlightedSlot.remove(slotNumber) except: pass overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos) self.wndItem.SetUsableItem(False) self.ShowToolTip(overSlotPos) def OnPickItem(self, count): itemSlotIndex = self.dlgSplitItems.itemGlobalSlotIndex selectedItemVNum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex) mouseModule.mouseController.AttachObject(self, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["slot"], itemSlotIndex, selectedItemVNum, count) def SelectItemSlot(self, itemSlotIndex): if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1: return itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex) selectedItemVNum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex) itemCount = player.GetItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex) if mouseModule.mouseController.isAttached(): attachedSlotType = mouseModule.mouseController.GetAttachedType() attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex() attachedItemCount = mouseModule.mouseController.GetAttachedItemCount() if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["slot"] == attachedSlotType: if attachedItemVID == selectedItemVNum: net.SendItemMovePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex, 0) #This modifi: last value: attachedItemCount else: net.SendItemUseToItemPacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex) mouseModule.mouseController.DeattachObject() else: curCursorNum = app.GetCursor() if app.SELL == curCursorNum: self.__SellItem(itemSlotIndex) elif app.BUY == curCursorNum: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO) elif app.IsPressed(app.DIK_LALT): link = player.GetItemLink(itemSlotIndex) ime.PasteString(link) elif app.IsPressed(app.DIK_LSHIFT): if itemCount > 1: self.dlgSplitItems.SetTitleName(localeInfo.PICK_ITEM_TITLE) self.dlgSplitItems.SetAcceptEvent(ui.__mem_func__(self.OnPickItem)) self.dlgSplitItems.Open(itemCount) self.dlgSplitItems.itemGlobalSlotIndex = itemSlotIndex else: mouseModule.mouseController.AttachObject(self, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["slot"], itemSlotIndex, selectedItemVNum, itemCount) self.wndItem.SetUseMode(False) snd.PlaySound("sound/ui/pick.wav") def __SellItem(self, itemSlotPos): self.sellingSlotNumber = itemSlotPos itemIndex = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotPos) itemCount = player.GetItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotPos) item.SelectItem(itemIndex) if item.IsAntiFlag(item.ANTIFLAG_SELL): popup = uiCommon.PopupDialog() popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM) popup.SetAcceptEvent(self.__OnClosePopupDialog) popup.Open() self.popup = popup return itemPrice = item.GetISellItemPrice() if item.Is1GoldItem(): itemPrice = itemCount / itemPrice / 5 else: itemPrice = itemPrice * itemCount / 5 item.GetItemName(itemIndex) itemName = item.GetItemName() self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice)) self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem)) self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open() self.questionDialog.count = itemCount def SellItem(self): net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"]) snd.PlaySound("sound/ui/money.wav") self.OnCloseQuestionDialog() def OnCloseQuestionDialog(self): if not self.questionDialog: return self.questionDialog.Close() self.questionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) def __OnClosePopupDialog(self): self.pop = None def SelectEmptySlot(self, selectedSlotPos): if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1: return selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos) if mouseModule.mouseController.isAttached(): attachedSlotType = mouseModule.mouseController.GetAttachedType() attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemCount = mouseModule.mouseController.GetAttachedItemCount() attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex() attachedInvenType = player.SlotTypeToInvenType(attachedSlotType) if player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType: mouseModule.mouseController.RunCallBack("INVENTORY") elif player.SLOT_TYPE_SHOP == attachedSlotType: net.SendShopBuyPacket(attachedSlotPos) elif player.SLOT_TYPE_SAFEBOX == attachedSlotType: net.SendSafeboxCheckoutPacket(attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], selectedSlotPos) elif player.SLOT_TYPE_MALL == attachedSlotType: net.SendMallCheckoutPacket(attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], selectedSlotPos) elif player.RESERVED_WINDOW != attachedInvenType: itemCount = player.GetItemCount(attachedInvenType, attachedSlotPos) attachedCount = mouseModule.mouseController.GetAttachedItemCount() self.__SendMoveItemPacket(attachedInvenType, attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], selectedSlotPos, attachedCount) mouseModule.mouseController.DeattachObject() def UseItemSlot(self, slotIndex): if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS(): return slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex) #self.__UseItem(slotIndex) net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex) mouseModule.mouseController.DeattachObject() self.OverOutItem() def __UseItem(self, slotIndex): ItemVNum = player.GetItemIndex(slotIndex) item.SelectItem(ItemVNum) if player.IsExtendInvenKey(ItemVNum) and app.ENABLE_EXTEND_INVEN_SYSTEM: self.__ClickExtendInvenButton(player.GetExtendInvenStage()) def __SendMoveItemPacket(self, srcSlotWindow, srcSlotPos, dstSlotWindow, dstSlotPos, srcItemCount): if uiPrivateShopBuilder.IsBuildingPrivateShop(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP) return net.SendItemMovePacket(srcSlotWindow , srcSlotPos, dstSlotWindow, dstSlotPos, srcItemCount)
I would really appreciate if someone can help me doing that.
Solved!
- 1
Hyperlinks Encoding
in Community Support - Questions & Answers
Posted
bump