Jump to content

Editing the text position of guild grade


Go to solution Solved by Sandworks,

Recommended Posts

Hello Guys, I have edited all the text positions of the guild authority page as you can see but i can't edit the text position of the guild grade name on the slot

I hope you can help me and thanks in advance ❤️

 

wtrY74E.jpg

 

and this is Uiguild_new.py

import ui
import net
import chr
import player
import wndMgr
import item
import emotion
import uiCommon
import app
import uiUploadMark
import guild
import quest
import mouseModule
import chat
import playerSettingModule
import uiToolTip
import uiPickMoney_Guild
import localeInfo
import constInfo
import dbg
import skill
import uiScriptLocale
import time
import snd
import event
from _weakref import proxy

def unsigned32(n):
	return n & 0xFFFFFFFFL

info_guildPage = 1
comment_guildPage = 0
authority_guildPage = 0
skill_guildPage = 0
grade_guildPage = 0

NAME_CLASS_I = "COMMENT_PAGE"

FACE_IMAGE_DICT = {
	playerSettingModule.RACE_WARRIOR_M	: "d:/ymir work/interface/faces/small/icon_mwarrior.tga",
	playerSettingModule.RACE_WARRIOR_W	: "d:/ymir work/interface/faces/small/icon_wwarrior.tga",
	playerSettingModule.RACE_ASSASSIN_M	: "d:/ymir work/interface/faces/small/icon_mninja.tga",
	playerSettingModule.RACE_ASSASSIN_W	: "d:/ymir work/interface/faces/small/icon_wninja.tga",
	playerSettingModule.RACE_SURA_M		: "d:/ymir work/interface/faces/small/icon_msura.tga",
	playerSettingModule.RACE_SURA_W		: "d:/ymir work/interface/faces/small/icon_wsura.tga",
	playerSettingModule.RACE_SHAMAN_M	: "d:/ymir work/interface/faces/small/icon_mshaman.tga",
	playerSettingModule.RACE_SHAMAN_W	: "d:/ymir work/interface/faces/small/icon_wshaman.tga",
}

GRADE_ADD_MEMBER_AUTHORITY = 1
GRADE_REMOVE_MEMBER_AUTHORITY = 2
GRADE_NOTICE_AUTHORITY = 3
GRADE_SKILL_AUTHORITY = 4

class DeclareGuildWarDialog(ui.ScriptWindow):

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

		self.type=0
		self.__CreateDialog()

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

	def Open(self):
		self.inputValue.SetFocus()
		self.SetCenterPosition()
		self.SetTop()
		self.Show()

	def Close(self):
		self.ClearDictionary()
		self.board = None
		self.acceptButton = None
		self.cancelButton = None
		self.inputSlot = None
		self.inputValue = None
		self.Hide()

	def __CreateDialog(self):

		try:
			pyScrLoader = ui.PythonScriptLoader()

			if localeInfo.IsVIETNAM() :
				pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "declareguildwardialog.py")
			else:
				pyScrLoader.LoadScriptFile(self, "uiscript/declareguildwardialog.py")

		except:
			import exception
			exception.Abort("DeclareGuildWarWindow.__CreateDialog - LoadScript")

		try:
			getObject = self.GetChild
			self.board = getObject("Board")

			self.typeButtonList=[]
			self.typeButtonList.append(getObject("NormalButton"))
			self.typeButtonList.append(getObject("WarpButton"))
			self.typeButtonList.append(getObject("CTFButton"))

			self.acceptButton = getObject("AcceptButton")
			self.cancelButton = getObject("CancelButton")
			self.inputSlot = getObject("InputSlot")
			self.inputValue = getObject("InputValue")

			gameType=getObject("GameType")

		except:
			import exception
			exception.Abort("DeclareGuildWarWindow.__CreateDialog - BindObject")

		if constInfo.GUILD_WAR_TYPE_SELECT_ENABLE==0:
			gameType.Hide()

		self.typeButtonList[0].SAFE_SetEvent(self.__OnClickTypeButtonNormal)
		self.typeButtonList[1].SAFE_SetEvent(self.__OnClickTypeButtonWarp)
		self.typeButtonList[2].SAFE_SetEvent(self.__OnClickTypeButtonCTF)

		self.typeButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_NORMAL_TITLE, localeInfo.GUILDWAR_NORMAL_DESCLIST))
		self.typeButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_WARP_TITLE, localeInfo.GUILDWAR_WARP_DESCLIST))
		self.typeButtonList[2].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_CTF_TITLE, localeInfo.GUILDWAR_CTF_DESCLIST))

		self.__ClickRadioButton(self.typeButtonList, 0)

		self.SetAcceptEvent(ui.__mem_func__(self.__OnOK))
		self.SetCancelEvent(ui.__mem_func__(self.__OnCancel))

	def __OnOK(self):
		text = self.GetText()
		type = self.GetType()

		if ""==text:
			return

		net.SendChatPacket("/war %s %d" % (text, type))
		self.Close()

		return 1

	def __OnCancel(self):
		self.Close()
		return 1

	def __OnClickTypeButtonNormal(self):
		self.__ClickTypeRadioButton(0)

	def __OnClickTypeButtonWarp(self):
		self.__ClickTypeRadioButton(1)

	def __OnClickTypeButtonCTF(self):
		self.__ClickTypeRadioButton(2)

	def __ClickTypeRadioButton(self, type):
		self.__ClickRadioButton(self.typeButtonList, type)
		self.type=type

	def __ClickRadioButton(self, buttonList, buttonIndex):
		try:
			selButton=buttonList[buttonIndex]
		except IndexError:
			return

		for eachButton in buttonList:
			eachButton.SetUp()

		selButton.Down()

	def SetTitle(self, name):
		self.board.SetTitleName(name)

	def SetNumberMode(self):
		self.inputValue.SetNumberMode()

	def SetSecretMode(self):
		self.inputValue.SetSecret()

	def SetFocus(self):
		self.inputValue.SetFocus()

	def SetMaxLength(self, length):
		width = length * 6 + 10
		self.inputValue.SetMax(length)
		self.SetSlotWidth(width)
		self.SetBoardWidth(max(width + 50, 160))

	def SetSlotWidth(self, width):
		self.inputSlot.SetSize(width, self.inputSlot.GetHeight())
		self.inputValue.SetSize(width, self.inputValue.GetHeight())

	def SetBoardWidth(self, width):
		self.board.SetSize(max(width + 50, 160), self.GetHeight())
		self.SetSize(max(width + 50, 160), self.GetHeight())
		self.UpdateRect()

	def SetAcceptEvent(self, event):
		self.acceptButton.SetEvent(event)
		self.inputValue.OnIMEReturn = event

	def SetCancelEvent(self, event):
		self.board.SetCloseEvent(event)
		self.cancelButton.SetEvent(event)
		self.inputValue.OnPressEscapeKey = event

	def GetType(self):
		return self.type

	def GetText(self):
		return self.inputValue.GetText()

	def __CreateGameTypeToolTip(self, title, descList):
		toolTip = uiToolTip.ToolTip()
		toolTip.SetTitle(title)
		toolTip.AppendSpace(5)

		for desc in descList:
			toolTip.AutoAppendTextLine(desc)

		toolTip.AlignHorizonalCenter()
		return toolTip


class GuildWindow(ui.ScriptWindow):
	
	GUILD_SKILL_PASSIVE_SLOT = 0
	GUILD_SKILL_ACTIVE_SLOT = 1
	GUILD_SKILL_AFFECT_SLOT = 2


	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.state = "INFO_GUILD"
		self.isLoaded = 0

		self.__Initialize()
		self.__LoadWindow()

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

	def __Initialize(self):
		self.tabButtonDict = None
		self.pageDict = None
		self.titleBarDict = None

		self.commentBoard = None
		self.can_continue = 1
		self.objPos = 0
		self.objPos2 = 0
		self.objPos3 = 0
		self.tooltip_in = 0
		
	def CanOpen(self):
		return guild.IsGuildEnable()
	
	def Show(self):
		self.__LoadWindow()
		ui.ScriptWindow.Show(self)
		

	def __LoadScript(self, fileName):
		pyScrLoader = ui.PythonScriptLoader()
		pyScrLoader.LoadScriptFile(self, fileName)	
		
	def __BindObject(self):
		self.tooltipSkill = uiToolTip.SkillToolTip()
		self.tooltipSkill.Hide()
		
		
		self.markSelectDialog=uiUploadMark.MarkSelectDialog()
		self.markSelectDialog.SAFE_SetSelectEvent(self.__OnSelectMark)
		
		
		self.GetChild("Expand").SetEvent(self.Functie_glisare_max)
		self.GetChild("Minimize").SetEvent(self.Functie_glisare_min)
		self.GetChild("Minimize").Hide()
	
	
		self.TabButton1 = self.GetChild("Tab_Button_01")
		self.TabButton2 = self.GetChild("Tab_Button_02")
		self.TabButton3 = self.GetChild("Tab_Button_03")
		self.TabButton4 = self.GetChild("Tab_Button_04")
		self.TabButton5 = self.GetChild("Tab_Button_05")
		
		self.Button1Text = self.GetChild("Button1_Name")
		self.Button1Text.Hide()
		self.Button2Text = self.GetChild("Button2_Name")
		self.Button2Text.Hide()
		self.Button3Text = self.GetChild("Button3_Name")
		self.Button3Text.Hide()
		self.Button4Text = self.GetChild("Button4_Name")
		self.Button4Text.Hide()
		self.Button5Text = self.GetChild("Button5_Name")
		self.Button5Text.Hide()

		self.tabButtonDict = {
			"INFO_GUILD"	: self.GetChild("Tab_Button_01"),
			"COMMENT_PAGE"		: self.GetChild("Tab_Button_02"),
			"AUTHORITY_PAGE"		: self.GetChild("Tab_Button_03"),
			"SKILL_PAGE"	: self.GetChild("Tab_Button_04"),
			"GRADE_PAGE"		: self.GetChild("Tab_Button_05")
		}

		self.pageDict = {
			"INFO_GUILD"	: self.GetChild("Info_Guild"),
			"COMMENT_PAGE"	: self.GetChild("Comment_GuildPage"),
			"AUTHORITY_PAGE"		: self.GetChild("Authority_GuildPage"),
			"SKILL_PAGE"	: self.GetChild("Skill_Page"),
			"GRADE_PAGE"		: self.GetChild("Grade_Page")
		}

		self.titleBarDict = {
			"INFO_GUILD"	: self.GetChild("Info_TitleBar"),
			"COMMENT_PAGE"	: self.GetChild("Comment_TitleBar"),
			"AUTHORITY_PAGE"		: self.GetChild("Authority_TitleBar"),
			"SKILL_PAGE"	: self.GetChild("Skill_TitleBar"),
			"GRADE_PAGE"		: self.GetChild("Grade_TitleBar")
		}
		#first_page
		self.info_guildPage()
		
		self.offerDialog = uiPickMoney_Guild.PickMoneyDialog_Guild()
		self.offerDialog.LoadDialog()
		self.offerDialog.SetMax(9)
		self.offerDialog.SetTitleName(localeInfo.GUILD_OFFER_EXP)
		self.offerDialog.SetAcceptEvent(ui.__mem_func__(self.OnOffer))
		
		#second_page
		self.comment_guildPage()
	
		#3'th page
		self.authority_guildPage()
		
		#4'th page
		self.skill_guildPage()
		
		#5'th page
		self.grade_guildPage()
		
	def info_guildPage(self):
		#-1
		self.mark = self.GetChild("LargeGuildMark")
		self.mark_change = self.GetChild("GuildMark")
		self.mark_change.SetEvent(lambda : self.__OnClickSelectGuildMarkButton())
		
		self.guild_level = self.GetChild("GuildLevelValue")
		self.guild_name = self.GetChild("GuildNameValue")
		self.guild_leader = self.GetChild("GuildMasterNameValue")
		self.level_percent = self.GetChild("PercentExp")
		self.curr_exp = self.GetChild("CurrentExperienceValue")
		self.exp_img = self.GetChild("ExpImgFull")
		#-2
		self.guild_members = self.GetChild("GuildMemberCountValue")
		self.guild_members_level = self.GetChild("GuildMemberLevelAverageValue")
		self.guild_members_level = self.GetChild("GuildMemberLevelAverageValue")
		
		self.guild_donate_exp = self.GetChild("OfferButton")
		self.guild_donate_exp.SetEvent(lambda : self.__OnClickOfferButton())
		
		self.guild_declare_war = self.GetChild("DeclareWarButton")
		self.guild_declare_war.SetEvent(lambda : self.__OnClickDeclareWarButton())
		

	def __OnSelectMark(self, markFileName):
		ret = net.UploadMark("upload/"+markFileName)

		# MARK_BUG_FIX
		if net.ERROR_MARK_UPLOAD_NEED_RECONNECT == ret:
			chat.AppendChat(1,localeInfo.UPLOAD_MARK_UPLOAD_NEED_RECONNECT)
		return ret
		
	def __OnClickSelectGuildMarkButton(self):
		if guild.GetGuildLevel() < int(localeInfo.GUILD_MARK_MIN_LEVEL):
			chat.AppendChat(1,localeInfo.GUILD_MARK_NOT_ENOUGH_LEVEL)
		elif not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE):
			chat.AppendChat(1,localeInfo.GUILD_NO_NOTICE_PERMISSION)
		else:
			self.markSelectDialog.Open()
	
	def __OnClickOfferButton(self):

		curEXP = unsigned32(player.GetStatus(player.EXP))

		if curEXP <= 100:
			chat.AppendChat(1,localeInfo.GUILD_SHORT_EXP)
			return

		self.offerDialog.Open(curEXP, 100)

	def OnOffer(self, exp):
		net.SendGuildOfferPacket(exp)
	
	def __OnClickDeclareWarButton(self):
		inputDialog = DeclareGuildWarDialog()
		inputDialog.Open()
		self.inputDialog = inputDialog
	
	
	#~~~~~~~ 2 Page
	
	def comment_guildPage(self):
		self.commentBoard = self.GetChild("CommentBoard")
		
		self.scrollbar = ui.ScrollBarNewDesign()
		self.scrollbar.SetParent(self.GetChild("Comment_GuildPage"))
		self.scrollbar.SetPosition(342,14)
		self.scrollbar.SetScrollBarSize(210)
		self.scrollbar.SetScrollEvent(self.__OnScroll)
		self.scrollbar.Show()
		
		self.commentSlot = ui.SpecialEditLine()
		self.commentSlot.SetParent(self.GetChild("CommentBoard"))
		self.commentSlot.SetPosition(220,16)
		self.commentSlot.SetSize(121,25)
		self.commentSlot.SetMax(35)
		self.commentSlot.OnIMEReturn = ui.__mem_func__(self.OnPostComment)
		self.commentSlot.SetIMEFlag(0)
		self.commentSlot.SetPlaceHolderText("قم بكتابة الرسالة...")
		self.commentSlot.SetPackedFontColor(0xffa07970)
		self.commentSlot.Show()
		
		self.objPos = 0
		self.scrollbar.SetPos(0)
		self.LoadScroll()
	#~~~~~~~ 3 Page
	
	def authority_guildPage(self):
		textsAuthority = {1 : uiScriptLocale.SELECT_NAME,2 : uiScriptLocale.GUILD_RASA,3 : uiScriptLocale.GUILD_MEMBER_LEVEL, 4 : uiScriptLocale.GUILD_MEMBER_SPECIFIC_GRAVITY,5 : uiScriptLocale.GUILD_MEMBER_RANK,}
		self.players_Authority,u = {}, 0
		for i in xrange(5):
			self.players_Authority[i] = ui.TextLine()
			self.players_Authority[i].SetParent(self.GetChild("Authority_Info_3"))
			self.players_Authority[i].SetPosition(60+u,17)
			self.players_Authority[i].SetText(textsAuthority[i+1])
			self.players_Authority[i].SetFontColor(0.902, 0.816, 0.635)
			self.players_Authority[i].Show()
			if i == 0:
				u += 60
			elif i == 1 or i == 2:
				u += 45
			else:
				u+= 60
				
		self.scrollbarAuthority = ui.ScrollBarNewDesign()
		self.scrollbarAuthority.SetParent(self.GetChild("Authority_Info_2"))
		self.scrollbarAuthority.SetPosition(344,15)
		self.scrollbarAuthority.SetScrollBarSize(210)
		self.scrollbarAuthority.SetScrollEvent(self.__OnScroll2)
		# self.scrollbar.Show()
		
		self.objPos2 = 0
		self.scrollbarAuthority.SetPos(0)
		self.LoadScroll2()
		pass

	def LoadScroll2(self):
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		pos = self.objPos2
		if curMemberCount >= 5:
			self.obj_count2 = 5
			self.scrollbarAuthority.Show()
		else:
			self.obj_count2 = curMemberCount
			self.scrollbarAuthority.Hide()
		z=0

		self.players, u = {}, 0
		self.namesAuthority,self.imgs,self.levels,self.inverts,self.pos = {},{},{},{},{}

		for i in xrange(self.obj_count2):
			realPos = pos+i
			
			pid, name, grade, race, level, offer, general = guild.GetMemberData(realPos)

			if not name or name == "":
				break
				
			guildExperienceSummary = guild.GetGuildExperienceSummary()

			offerPercentage = 0
			if guildExperienceSummary > 0:
				offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0)
				
			self.players[i] = ui.ImageBox()
			self.players[i].SetParent(self.GetChild("Authority_Info_2"))
			self.players[i].SetPosition(25,20+u)
			self.players[i].LoadImage("d:/ymir work/interface/guild/dialog_member_slot.tga")
			self.players[i].Show()
			
			self.pos[i] = ui.NewComboBox()
			self.pos[i].SetParent(self.players[i])
			self.pos[i].SetPosition(218,3)
			self.pos[i].SetSize(90,23)
			self.pos[i].SetCurrentItem(guild.GetGradeName(grade))
			masterName = guild.GetGuildMasterName()
			mainCharacterName = player.GetMainCharacterName()
			if mainCharacterName == masterName:
				self.pos[i].Enable()
				self.pos[i].SetEvent(lambda gradeNumber, lineIndex=realPos, argSelf=proxy(self): argSelf.OnChangeMemberGrade(lineIndex, gradeNumber))
			self.pos[i].Show()
	
			self.pos[i].ClearItem()
			for e in xrange(14):
				self.pos[i].InsertItem(e+2, guild.GetGradeName(e+2))
				self.pos[i].SetCurrentItem(guild.GetGradeName(grade))

			self.namesAuthority[i] = ui.TextLine()
			self.namesAuthority[i].SetParent(self.players[i])
			self.namesAuthority[i].SetPosition(50,7)
			self.namesAuthority[i].SetText(name)
			self.namesAuthority[i].SetFontColor(0.902, 0.816, 0.635)
			self.namesAuthority[i].Show()
			
			self.imgs[i] = ui.ImageBox()
			self.imgs[i].SetParent(self.players[i])
			self.imgs[i].SetPosition(93,2)
			self.imgs[i].LoadImage(FACE_IMAGE_DICT[race])
			self.imgs[i].Show()
			
			self.levels[i] = ui.TextLine()
			self.levels[i].SetParent(self.players[i])
			self.levels[i].SetPosition(160,7)
			self.levels[i].SetText(str(level))
			self.levels[i].SetFontColor(0.424, 0.337, 0.329)
			self.levels[i].Show()
			
			self.inverts[i] = ui.TextLine()
			self.inverts[i].SetParent(self.players[i])
			self.inverts[i].SetPosition(195,7)
			self.inverts[i].SetText(str(offerPercentage)+"%")
			self.inverts[i].SetFontColor(0.424, 0.337, 0.329)
			self.inverts[i].Show()

			u+= 30
		
	def __OnScroll2(self):
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		self.objPos2 = self.scrollbarAuthority.GetPos() * (curMemberCount-6)
		self.LoadScroll2()
	
	def OnChangeMemberGrade(self, id, gradeNumber):
		PID = guild.MemberIndexToPID(id)
		net.SendGuildChangeMemberGradePacket(PID, gradeNumber)
		
		self.objPos2 = 0
		self.scrollbarAuthority.SetPos(0)
		self.LoadScroll2()
	
	def RefAuthMember(self):
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		if curMemberCount >= 5:
			self.obj_count2 = 5
		else:
			self.obj_count2 = curMemberCount
		pos = self.objPos2
		
		for i in xrange(self.obj_count2):
			realPos = pos+i
			pid, name, grade, race, level, offer, general = guild.GetMemberData(realPos)
			if not name or name == "":
				break
				
			guildExperienceSummary = guild.GetGuildExperienceSummary()

			offerPercentage = 0
			if guildExperienceSummary > 0:
				offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0)
			if self.inverts[i] != 0:
				self.inverts[i].SetText(str(offerPercentage)+"%")

			self.pos[i].SetCurrentItem(guild.GetGradeName(grade))
			
			if self.pos[int(realPos)].CheckOpen() == 1:
				self.open = 1
				for e in xrange(self.obj_count2):
					self.pos[e].Hide()
				self.pos[int(realPos)].Show()
				
	def skill_guildPage(self):
		self.skillPoints = self.GetChild("Skill_Plus_Value")
		self.energy = self.GetChild("Dragon_God_Power_Value")
		self.energyBar = self.GetChild("EnergyFull")
		self.donate_energy = self.GetChild("DonateEnergyButton")
		self.donate_energy.SetEvent(lambda : self.__OnOpenHealGSPBoard())
		
		
		
		self.backSlot = ui.GridSlotWindow()
		self.backSlot.SetParent(self.GetChild("Skill_Page"))
		self.backSlot.SetPosition(30-25,80)
		self.backSlot.ArrangeSlot(210, 6, 1, 40, 40,3,0)
		self.backSlot.SetSlotBaseImage("d:/ymir work/interface/slot/slot3.tga",1.0,1.0,1.0,1.0)
		self.backSlot.SetWindowHorizontalAlignCenter()
		self.backSlot.Show()
		
		self.activeSlot = ui.GridSlotWindow()
		self.activeSlot.SetParent(self.GetChild("Skill_Page"))
		self.activeSlot.SetPosition(34-25,84)
		self.activeSlot.ArrangeSlot(210, 6, 1, 40, 40,3,0)
		self.activeSlot.SetSlotBaseImage("d:/ymir work/ui/slot.tga",1.0,1.0,1.0,1.0)
		self.activeSlot.SetWindowHorizontalAlignCenter()
		self.activeSlot.Show()
		
		self.activeSlot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
		self.activeSlot.SetOverInItemEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OverInItem(slotNumber, type))
		self.activeSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
		self.activeSlot.SetSelectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnPickUpGuildSkill(slotNumber, type))
		self.activeSlot.SetUnselectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUseGuildSkill(slotNumber, type))
		self.activeSlot.SetPressedSlotButtonEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUpGuildSkill(slotNumber, type))
		self.activeSlot.AppendSlotButton("d:/ymir work/interface/button/char_buttons/plus_01_normal.tga",\
										"d:/ymir work/interface/button/char_buttons/plus_02_hover.tga",\
										"d:/ymir work/interface/button/char_buttons/plus_03_active.tga")


		## Active
		for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)):

			slotIndex = self.activeSlot.GetStartIndex()+i
			skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i]

			self.activeSlot.SetSkillSlot(slotIndex, skillIndex, 0)
			self.activeSlot.SetCoverButton(slotIndex)
			self.activeSlot.RefreshSlot()
			guild.SetSkillIndex(slotIndex, len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)+i)
	
	def RefreshGuildSkillPage(self):

		if 0 != 0:
			return

		# page = self.pageDict["MUSIC"]

		curPoint, maxPoint = guild.GetDragonPowerPoint()
		maxPoint = max(maxPoint, 1)
		self.energy.SetText("|cffa08784"+uiScriptLocale.CHARACTER_PSTATUS+ "|cfff8d090 "  +str(curPoint) + " / " + str(maxPoint))

		percentage = ( (float(curPoint / max(1, float(maxPoint))) * 100))
		self.energyBar.SetPercentage(curPoint,maxPoint)

		skillPoint = guild.GetGuildSkillPoint()
		self.skillPoints.SetText("|cffa08784"+uiScriptLocale.CHARACTER_PSTATUS + "|cfff8d090 " +str(skillPoint))

		# page.passiveSlot.HideAllSlotButton()
		self.activeSlot.HideAllSlotButton()

		## Active
		for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)):

			slotIndex = self.activeSlot.GetStartIndex()+i
			skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i]
			skillLevel = guild.GetSkillLevel(slotIndex)
			skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)

			self.activeSlot.SetSlotCount(slotIndex, skillLevel)

			if skillLevel <= 0:
				self.activeSlot.DisableCoverButton(slotIndex)
			else:
				self.activeSlot.EnableCoverButton(slotIndex)

			if skillPoint > 0:
				if skillLevel < skillMaxLevel:
					self.activeSlot.ShowSlotButton(slotIndex)
	
	def OnPickUpGuildSkill(self, skillSlotIndex, type):

		mouseController = mouseModule.mouseController

		if False == mouseController.isAttached():

			skillIndex = player.GetSkillIndex(skillSlotIndex)
			skillLevel = guild.GetSkillLevel(skillSlotIndex)

			if skill.CanUseSkill(skillIndex) and skillLevel > 0:

				if app.IsPressed(app.DIK_LCONTROL):

					player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, skillSlotIndex)
					return

				mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, skillSlotIndex, skillIndex)

		else:
			mouseController.DeattachObject()

	def OnUseGuildSkill(self, slotNumber, type):
		skillIndex = player.GetSkillIndex(slotNumber)
		skillLevel = guild.GetSkillLevel(slotNumber)

		if skillLevel <= 0:
			return

		player.UseGuildSkill(slotNumber)

	def OnUpGuildSkill(self, slotNumber, type):
		skillIndex = player.GetSkillIndex(slotNumber)
		net.SendChatPacket("/gskillup " + str(skillIndex))

	def OnUseSkill(self, slotNumber, coolTime):

		if 0 != 0:
			return
		# self.activeSlot = ui.GridSlotWindow()
		if self.activeSlot.HasSlot(slotNumber):
			self.activeSlot.SetSlotCoolTime(slotNumber, coolTime)

	def OverInItem(self, slotNumber, type):

		if mouseModule.mouseController.isAttached():
			return

		if None != self.tooltipSkill:
			skillIndex = player.GetSkillIndex(slotNumber)
			skillLevel = guild.GetSkillLevel(slotNumber)

			self.tooltipSkill.SetSkill(skillIndex, skillLevel)

	def OverOutItem(self):
		self.tooltipSkill.HideToolTip()
		self.tooltip_in = 0
		
	def SetSkillToolTip(self, tooltipSkill):
		self.tooltipSkill = tooltipSkill
	
	def __OnOpenHealGSPBoard(self):

		curPoint, maxPoint = guild.GetDragonPowerPoint()

		if maxPoint - curPoint <= 0:
			chat.AppendChat(1,localeInfo.GUILD_CANNOT_HEAL_GSP_ANYMORE)
			return

		pickDialog = uiPickMoney_Guild.PickMoneyDialog_Guild()
		pickDialog.LoadDialog()
		pickDialog.SetMax(9)
		pickDialog.SetTitleName(localeInfo.GUILD_HEAL_GSP)
		pickDialog.SetAcceptEvent(ui.__mem_func__(self.__OnOpenHealGSPQuestionDialog))
		pickDialog.Open(maxPoint - curPoint, 1)
		self.pickDialog = pickDialog

	def __OnOpenHealGSPQuestionDialog(self, healGSP):

		money = healGSP * constInfo.GUILD_MONEY_PER_GSP

		questionDialog = uiCommon.QuestionDialog()
		questionDialog.SetText(localeInfo.GUILD_DO_YOU_HEAL_GSP % (money, healGSP))
		questionDialog.SetAcceptEvent(ui.__mem_func__(self.__OnHealGSP))
		questionDialog.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog))
		questionDialog.SetWidth(400)
		questionDialog.Open()
		questionDialog.healGSP = healGSP
		self.questionDialog = questionDialog

	def __OnHealGSP(self):
		net.SendGuildChargeGSPPacket(self.questionDialog.healGSP)
		self.__OnCloseQuestionDialog()
		
	def __OnCloseQuestionDialog(self):
		if self.questionDialog:
			self.questionDialog.Close()
		self.questionDialog = None
	
	def grade_guildPage(self):
		
		textsGrade = {0 : "رقم.", 1 : uiScriptLocale.SELECT_NAME,2 : uiScriptLocale.GUILD_GRADE_PERMISSION_JOIN,3 : uiScriptLocale.GUILD_GRADE_PERMISSION_DELETE, 4 : uiScriptLocale.GUILD_GRADE_PERMISSION_NOTICE,5 : uiScriptLocale.GUILD_GRADE_PERMISSION_SKILL,}
		self.players_t,u = {}, 0
		for i in xrange(6):

			self.players_t[i] = ui.TextLine()
			self.players_t[i].SetParent(self.GetChild("Grade_Page"))
			self.players_t[i].SetPosition(30+u,17)
			self.players_t[i].SetText(textsGrade[i])
			self.players_t[i].SetFontColor(0.902, 0.816, 0.635)
			self.players_t[i].Show()
			if i == 0:
				u += 45
			elif i == 1:
				u += 65
			elif i == 2:
				u += 40
			elif i == 3:
				u+= 65
			else:
				u+= 45
			
		self.status11 = ui.NewBoard()
		self.status11.SetParent(self.GetChild("Grade_Page"))
		self.status11.SetSize(363,265)
		self.status11.SetPosition(0,33+12)
		self.status11.Show()

		self.scrollbarGrade = ui.ScrollBarNewDesign()
		self.scrollbarGrade.SetParent(self.status11)
		self.scrollbarGrade.SetPosition(342,15)
		self.scrollbarGrade.SetScrollBarSize(243)
		self.scrollbarGrade.SetScrollEvent(self.__OnScroll3)
		self.scrollbarGrade.Show()
		
		self.objPos3 = 0
		self.scrollbarGrade.SetPos(0)
		self.LoadScroll3()

	def RefGradeGuild(self):
		if 11 >= 9:
			self.obj_count3 = 9
		else:
			self.obj_count3 = 13
			
		pos = self.objPos3
		for i in xrange(1,self.obj_count3):
			realPos = pos+i
			name, authority = guild.GetGradeData(int(realPos))
			
			self.checkbox[i].SetCheck(authority & guild.AUTH_ADD_MEMBER)
			self.checkbox4[i].SetCheck(authority & guild.AUTH_SKILL)
			self.checkbox3[i].SetCheck(authority & guild.AUTH_NOTICE)
			self.checkbox2[i].SetCheck(authority & guild.AUTH_REMOVE_MEMBER)
			self.namesGrage[i].SetText(name)
	
	def LoadScroll3(self):
		total = 13
		
		pos = self.objPos3
		if total >= 9:
			self.obj_count3 = 9
		else:
			self.obj_count3 = total
		z=0
		
		self.img_rank, u = {}, 0
		self.idx = {}
		self.checkbox,self.checkbox2,self.checkbox3,self.checkbox4 = {},{},{},{}
		self.namesGrage = {}

		for i in xrange(1,self.obj_count3):
			realPos = pos+i
			
			name, authority = guild.GetGradeData(int(realPos))
			
			self.img_rank[i] = ui.ExpandedImageBox()
			self.img_rank[i].SetParent(self.status11)
			self.img_rank[i].SetPosition(20,12+u)
			self.img_rank[i].LoadImage("d:/ymir work/interface/guild/dialog_rank_slot.tga")
			self.img_rank[i].Show()
			
			self.idx[i] = ui.TextLine()
			self.idx[i].SetParent(self.img_rank[i])
			self.idx[i].SetPosition(10,6)
			self.idx[i].SetText(str(int(realPos))+".")
			self.idx[i].SetPackedFontColor(0xffcaa76f)
			self.idx[i].Show()
			
			self.namesGrage[i] = ui.EditableTextSlot(self.img_rank[i], 30, 2)
			self.namesGrage[i].SetEvent(ui.__mem_func__(self.OnOpenChangeGradeName), i)
			self.namesGrage[i].SetText(name)
			self.namesGrage[i].Show()

			event1 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<0: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			event2 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<1: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			event3 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<2: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			event4 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<3: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			self.checkbox[i] = ui.CheckBox(self.img_rank[i],122,3,event1)
			self.checkbox2[i] = ui.CheckBox(self.img_rank[i],173,3,event2)
			self.checkbox3[i] = ui.CheckBox(self.img_rank[i],225,3,event3)
			self.checkbox4[i] = ui.CheckBox(self.img_rank[i],275,3,event4)
			
			self.checkbox[i].SetCheck(authority & guild.AUTH_ADD_MEMBER)
			self.checkbox4[i].SetCheck(authority & guild.AUTH_SKILL)
			self.checkbox3[i].SetCheck(authority & guild.AUTH_NOTICE)
			self.checkbox2[i].SetCheck(authority & guild.AUTH_REMOVE_MEMBER)
			u += 30

	def __OnScroll3(self):
		self.objPos3 = self.scrollbarGrade.GetPos() * (14-10)
		self.LoadScroll3()
	
	def OnCheckAuthority(self, argIndex, argAuthority):
		name, authority = guild.GetGradeData(argIndex)
		net.SendGuildChangeGradeAuthorityPacket(argIndex, authority ^ argAuthority)

	def OnChangeGradeName(self, gradeNumber):
		if len(gradeName) == 0:
			gradeName = localeInfo.GUILD_DEFAULT_GRADE

		net.SendGuildChangeGradeNamePacket(gradeNumber, gradeName)
		return TRUE
		
	def OnOpenChangeGradeName(self, arg):
		self.cambiar = arg
		self.a = uiCommon.InputDialog()
		self.a.SetTitle("تغيير الرتبة")
		self.a.SetAcceptEvent(ui.__mem_func__(self.__OnchangeName))
		self.a.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog2))
		self.a.Open()
		
	def __OnchangeName(self):
		gradeName = self.a.GetText()
		if len(gradeName) == 0:
			gradeName = localeInfo.GUILD_DEFAULT_GRADE

		net.SendGuildChangeGradeNamePacket(self.cambiar, gradeName)
		self.__OnCloseQuestionDialog2()

	def __OnCloseQuestionDialog2(self):
		if self.a:
			self.a.Close()
		self.cambiar = None
		self.a = None
	
	def OnUpdate(self):
	#-1
		self.mark.SetIndex(net.GetGuildID())
		self.mark.SetScale(3.3)
		self.guild_level.SetText(str(guild.GetGuildLevel()))
		self.guild_name.SetText(guild.GetGuildName())
		self.guild_leader.SetText(player.GetName())
		curExp, lastExp = guild.GetGuildExperience()
		curExp *= 100
		lastExp *= 100
		total = curExp + lastExp
		self.exp_img.SetPercentage(curExp,total)
		self.curr_exp.SetText("EXP:   "+str(curExp)+ "       " +uiScriptLocale.CHARACTER_FROM +"       "+str(total))
		self.level_percent.SetText("%s %.2f%%" % ("", float(curExp) / max(1, float(total)) * 100))
	#-1
	#-2
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		self.guild_members.SetText(str(curMemberCount)+" / "+str(maxMemberCount))
		self.guild_members_level.SetText(str(guild.GetGuildMemberLevelAverage()))
	#-2	
	#-4
	
		self.RefAuthMember()
	#-4
	#-5
		self.RefreshGuildSkillPage()
	#-5
	#-6
		self.RefGradeGuild()
		pass
		
	def Functie_glisare_max(self):
		latime = self.GetChild("board").GetWidth()
		latime2 = self.GetChild("TabButtonsBoard").GetWidth()
		if latime < 467+48+39:
			latime = latime+2
			latime2 = latime2+2
			self.SetSize(latime,300)
			self.GetChild("board").SetSize(latime,340+10)
			self.GetChild("TabButtonsBoard").SetSize(latime2,300+10)
			self.GetChild("Authority_TitleBar").SetWidth(latime-15)
			self.GetChild("Skill_TitleBar").SetWidth(latime-15)
			self.GetChild("Grade_TitleBar").SetWidth(latime-15)
			self.GetChild("Comment_TitleBar").SetWidth(latime-15)
			self.GetChild("Info_TitleBar").SetWidth(latime-15)
			self.GetChild("Expand").SetPosition(latime-15-70, 10)
			self.GetChild("Minimize").SetPosition(latime-15-70, 10)
			self.GetChild("TitleName").SetPosition(0, 12-172)
			self.glisare = WaitingDialog()
			self.glisare.Open(0.0)
			self.glisare.SAFE_SetTimeOverEvent(self.Functie_glisare_max)
		else:
			self.TabButton1.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton1.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton2.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton2.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton3.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton3.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton4.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton4.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton5.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton5.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			if info_guildPage == 1:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if comment_guildPage == 1:
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if authority_guildPage == 1:
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if skill_guildPage == 1:
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if grade_guildPage == 1:
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			self.Button1Text.Show()
			self.Button2Text.Show()
			self.Button3Text.Show()
			self.Button4Text.Show()
			self.Button5Text.Show()
			self.GetChild("Minimize").Show()
			self.GetChild("Expand").Hide()

	def Functie_glisare_min(self):
		latime = self.GetChild("board").GetWidth()
		latime2 = self.GetChild("TabButtonsBoard").GetWidth()
		self.TabButton1.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton1.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton2.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton2.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton3.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton3.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton4.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton4.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton5.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton5.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		if info_guildPage == 1:
			self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if comment_guildPage == 1:
			self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if authority_guildPage == 1:
			self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if skill_guildPage == 1:
			self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if grade_guildPage == 1:
			self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		self.Button1Text.Hide()
		self.Button2Text.Hide()
		self.Button3Text.Hide()
		self.Button4Text.Hide()
		self.Button5Text.Hide()
		if latime>340+47+39:
			latime = latime-2
			latime2 = latime2-2
			self.SetSize(latime,300)
			self.GetChild("board").SetSize(latime,340+10)
			self.GetChild("TabButtonsBoard").SetSize(latime2,300+10)
			self.GetChild("Authority_TitleBar").SetWidth(latime-15)
			self.GetChild("Skill_TitleBar").SetWidth(latime-15)
			self.GetChild("Grade_TitleBar").SetWidth(latime-15)
			self.GetChild("Comment_TitleBar").SetWidth(latime-15)
			self.GetChild("Info_TitleBar").SetWidth(latime-15)
			self.GetChild("Expand").SetPosition(latime-15-70, 10)
			self.GetChild("Minimize").SetPosition(latime-15-70, 10)
			self.GetChild("TitleName").SetPosition(0, 12-172)
			self.glisare = WaitingDialog()
			self.glisare.Open(0.0)
			self.glisare.SAFE_SetTimeOverEvent(self.Functie_glisare_min)
		else:
			self.GetChild("Expand").Show()
			self.GetChild("Minimize").Hide()
			

	def __BindEvent(self):
		
		for (tabKey, tabButton) in self.tabButtonDict.items():
			tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey)
			
		for titleBarValue in self.titleBarDict.itervalues():
			titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))

	def __LoadWindow(self):
		if self.isLoaded == 1:
			return

		self.isLoaded = 1

		try:
			if localeInfo.IsARABIC() or localeInfo.IsVIETNAM() or localeInfo.IsJAPAN():
				self.__LoadScript("uiscript/GuildWindow.py")
			else:
				self.__LoadScript("uiscript/GuildWindow.py")
				
			self.__BindObject()
			self.__BindEvent()
		except:
			import exception
			exception.Abort("OptionWindow.__LoadWindow")

		self.SetState("INFO_GUILD")
		

	def Destroy(self):
		self.ClearDictionary()
		self.__Initialize()

	def Close(self):
		self.Hide()

	def __OnClickTabButton(self, stateKey):
		global info_guildPage,comment_guildPage,authority_guildPage,skill_guildPage,grade_guildPage
		latime = self.GetWidth()
		if stateKey == "INFO_GUILD":
			info_guildPage = 1
			comment_guildPage = 0
			authority_guildPage = 0
			skill_guildPage = 0
			grade_guildPage = 0
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "COMMENT_PAGE":

			info_guildPage = 0
			comment_guildPage = 1
			authority_guildPage = 0
			skill_guildPage = 0
			grade_guildPage = 0
			if latime == 468+48+39:
				net.SendGuildRefreshCommentsPacket(0)
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "AUTHORITY_PAGE":
			info_guildPage = 0
			comment_guildPage = 0
			authority_guildPage = 1
			skill_guildPage = 0
			grade_guildPage = 0
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "SKILL_PAGE":
			info_guildPage = 0
			comment_guildPage = 0
			authority_guildPage = 0
			skill_guildPage = 1
			grade_guildPage = 0
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "GRADE_PAGE":
			info_guildPage = 0
			comment_guildPage = 0
			authority_guildPage = 0
			skill_guildPage = 0
			grade_guildPage = 1
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_5)
				
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.SetState(stateKey)

	def SetState(self, stateKey):
		self.state = stateKey

		if constInfo.ENABLE_FIX_CHARACTER_PAGE:		
			if stateKey == NAME_CLASS_I:
				self.OnRefreshComments()

		for (tabKey, tabButton) in self.tabButtonDict.items():
			if stateKey!=tabKey:
				tabButton.SetUp()

		for pageValue in self.pageDict.itervalues():
			pageValue.Hide()

		for titleBarValue in self.titleBarDict.itervalues():
			titleBarValue.Hide()

		self.titleBarDict[stateKey].Show()
		self.pageDict[stateKey].Show()
		
	def __GetGuildBoardCommentData(self, index):
		commentID, chrName, comment = guild.GetGuildBoardCommentData(index)
		if 0==commentID:
			if ""==chrName:
				chrName=localeInfo.UI_NONAME
			if ""==comment:
				comment=localeInfo.UI_NOCONTENTS

		return commentID, chrName, comment
		
	def OnPostComment(self):
		text = self.commentSlot.GetText()
		if not text:
			return FALSE
		if not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE):
			chat.AppendChat(1,localeInfo.GUILD_NO_NOTICE_PERMISSION)
			return

		net.SendGuildPostCommentPacket(text[:50])
		self.commentSlot.SetText("")
		self.objPos = 0
		self.scrollbar.SetPos(0)
		self.LoadScroll()
		return TRUE

	def OnDeleteComment(self, index):
		commentID, chrName, comment = self.__GetGuildBoardCommentData(index)
		net.SendGuildDeleteCommentPacket(commentID)
		self.LoadScroll()

	def OnRefreshComments(self):
		net.SendGuildRefreshCommentsPacket(0)

	def __OnScroll(self):
		self.OnRefreshComments()
		self.objPos = self.scrollbar.GetPos() * (guild.GetGuildBoardCommentCount()-6)
		self.LoadScroll()
	
	
	def LoadScroll(self):
		net.SendGuildRefreshCommentsPacket(0)
		pos = self.objPos
		if guild.GetGuildBoardCommentCount() >= 6:
			self.obj_count = 6
			self.scrollbar.Show()
		else:
			self.obj_count = guild.GetGuildBoardCommentCount()
			self.scrollbar.Hide()
		
		self.delete,self.important, self.spaces,self.namesCommand,self.comments, u = {},{},{},{},{}, 0

		for i in xrange(self.obj_count):
			realPos = pos+i
	
			commentID, chrName, comment = self.__GetGuildBoardCommentData(realPos)
			if chrName == "Noname":
				break
				
			self.spaces[i] = ui.ImageBox()
			self.spaces[i].SetParent(self.GetChild("Comment_GuildPage"))
			self.spaces[i].SetPosition(20,20+u)
			self.spaces[i].LoadImage("d:/ymir work/interface/guild/dialog_message_slot.tga")
			self.spaces[i].Show()

			self.namesCommand[i] = ui.TextLine()
			self.namesCommand[i].SetParent(self.spaces[i])
			self.namesCommand[i].SetPosition(50,8)
			self.namesCommand[i].SetText(chrName)
			self.namesCommand[i].SetPackedFontColor(0xffcaa76f)
			self.namesCommand[i].Show()
			
			self.important[i] = ui.ImageBox()
			self.important[i].SetParent(self.spaces[i])
			self.important[i].SetPosition(87,8)
			self.important[i].LoadImage("d:/ymir work/interface/guild/dialog_message_importantmsg.tga")
		
			self.comments[i] = ui.TextLine()
			self.comments[i].SetParent(self.spaces[i])
			self.comments[i].SetPosition(310,8)
			if "!" == comment[0]:
				self.comments[i].SetText(comment[1:])
				self.comments[i].SetPackedFontColor(0xffdb9b93)
				self.important[i].Show()
			else:
				self.comments[i].SetText(comment)
				self.comments[i].SetPackedFontColor(0xffa08784)
				
			self.comments[i].Show()
			
			masterName = guild.GetGuildMasterName()
			mainCharacterName = player.GetMainCharacterName()
			
			if mainCharacterName == chrName or (masterName == mainCharacterName):
				self.delete[i] = ui.Button()
				self.delete[i].SetParent(self.spaces[i])
				self.delete[i].SetPosition(305,7)
				self.delete[i].SetUpVisual("d:/ymir work/interface/guild/close_mini_01_normal.tga")
				self.delete[i].SetOverVisual("d:/ymir work/interface/guild/close_mini_02_hover.tga")
				self.delete[i].SetDownVisual("d:/ymir work/interface/guild/close_mini_03_active.tga")
				self.delete[i].SetEvent(lambda x = realPos: self.OnDeleteComment(x))
				self.delete[i].Show()
		
			u += 35
	

	def GetState(self):
		return self.state
		
	def OnPressExitKey(self):
		self.Close()
		return TRUE
	
	def OnPressEscapeKey(self):
		self.Close()
		return TRUE


class WaitingDialog(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventTimeOver = lambda *arg: None
		self.eventExit = lambda *arg: None

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

	def Open(self, waitTime):
		import time
		curTime = time.clock()
		self.endTime = curTime + waitTime

		self.Show()		

	def Close(self):
		self.Hide()

	def Destroy(self):
		self.Hide()

	def SAFE_SetTimeOverEvent(self, event):
		self.eventTimeOver = ui.__mem_func__(event)

	def SAFE_SetExitEvent(self, event):
		self.eventExit = ui.__mem_func__(event)
		
	def OnUpdate(self):
		import time
		lastTime = max(0, self.endTime - time.clock())
		if 0 == lastTime:
			self.Close()
			self.eventTimeOver()
		else:
			return
	def OnPressEscapeKey(self):
		self.Close()
		return TRUE
		
	def OnPressExitKey(self):
		self.Close()
		return TRUE

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium
  • Solution
18 hours ago, Ahmed said:

Hello Guys, I have edited all the text positions of the guild authority page as you can see but i can't edit the text position of the guild grade name on the slot

I hope you can help me and thanks in advance ❤️

 

wtrY74E.jpg

 

and this is Uiguild_new.py

import ui import net import chr import player import wndMgr import item import emotion import uiCommon import app import uiUploadMark import guild import quest import mouseModule import chat import playerSettingModule import uiToolTip import uiPickMoney_Guild import localeInfo import constInfo import dbg import skill import uiScriptLocale import time import snd import event from _weakref import proxy def unsigned32(n): return n & 0xFFFFFFFFL info_guildPage = 1 comment_guildPage = 0 authority_guildPage = 0 skill_guildPage = 0 grade_guildPage = 0 NAME_CLASS_I = "COMMENT_PAGE" FACE_IMAGE_DICT = { playerSettingModule.RACE_WARRIOR_M : "d:/ymir work/interface/faces/small/icon_mwarrior.tga", playerSettingModule.RACE_WARRIOR_W : "d:/ymir work/interface/faces/small/icon_wwarrior.tga", playerSettingModule.RACE_ASSASSIN_M : "d:/ymir work/interface/faces/small/icon_mninja.tga", playerSettingModule.RACE_ASSASSIN_W : "d:/ymir work/interface/faces/small/icon_wninja.tga", playerSettingModule.RACE_SURA_M : "d:/ymir work/interface/faces/small/icon_msura.tga", playerSettingModule.RACE_SURA_W : "d:/ymir work/interface/faces/small/icon_wsura.tga", playerSettingModule.RACE_SHAMAN_M : "d:/ymir work/interface/faces/small/icon_mshaman.tga", playerSettingModule.RACE_SHAMAN_W : "d:/ymir work/interface/faces/small/icon_wshaman.tga", } GRADE_ADD_MEMBER_AUTHORITY = 1 GRADE_REMOVE_MEMBER_AUTHORITY = 2 GRADE_NOTICE_AUTHORITY = 3 GRADE_SKILL_AUTHORITY = 4 class DeclareGuildWarDialog(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.type=0 self.__CreateDialog() def __del__(self): ui.ScriptWindow.__del__(self) def Open(self): self.inputValue.SetFocus() self.SetCenterPosition() self.SetTop() self.Show() def Close(self): self.ClearDictionary() self.board = None self.acceptButton = None self.cancelButton = None self.inputSlot = None self.inputValue = None self.Hide() def __CreateDialog(self): try: pyScrLoader = ui.PythonScriptLoader() if localeInfo.IsVIETNAM() : pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "declareguildwardialog.py") else: pyScrLoader.LoadScriptFile(self, "uiscript/declareguildwardialog.py") except: import exception exception.Abort("DeclareGuildWarWindow.__CreateDialog - LoadScript") try: getObject = self.GetChild self.board = getObject("Board") self.typeButtonList=[] self.typeButtonList.append(getObject("NormalButton")) self.typeButtonList.append(getObject("WarpButton")) self.typeButtonList.append(getObject("CTFButton")) self.acceptButton = getObject("AcceptButton") self.cancelButton = getObject("CancelButton") self.inputSlot = getObject("InputSlot") self.inputValue = getObject("InputValue") gameType=getObject("GameType") except: import exception exception.Abort("DeclareGuildWarWindow.__CreateDialog - BindObject") if constInfo.GUILD_WAR_TYPE_SELECT_ENABLE==0: gameType.Hide() self.typeButtonList[0].SAFE_SetEvent(self.__OnClickTypeButtonNormal) self.typeButtonList[1].SAFE_SetEvent(self.__OnClickTypeButtonWarp) self.typeButtonList[2].SAFE_SetEvent(self.__OnClickTypeButtonCTF) self.typeButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_NORMAL_TITLE, localeInfo.GUILDWAR_NORMAL_DESCLIST)) self.typeButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_WARP_TITLE, localeInfo.GUILDWAR_WARP_DESCLIST)) self.typeButtonList[2].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_CTF_TITLE, localeInfo.GUILDWAR_CTF_DESCLIST)) self.__ClickRadioButton(self.typeButtonList, 0) self.SetAcceptEvent(ui.__mem_func__(self.__OnOK)) self.SetCancelEvent(ui.__mem_func__(self.__OnCancel)) def __OnOK(self): text = self.GetText() type = self.GetType() if ""==text: return net.SendChatPacket("/war %s %d" % (text, type)) self.Close() return 1 def __OnCancel(self): self.Close() return 1 def __OnClickTypeButtonNormal(self): self.__ClickTypeRadioButton(0) def __OnClickTypeButtonWarp(self): self.__ClickTypeRadioButton(1) def __OnClickTypeButtonCTF(self): self.__ClickTypeRadioButton(2) def __ClickTypeRadioButton(self, type): self.__ClickRadioButton(self.typeButtonList, type) self.type=type def __ClickRadioButton(self, buttonList, buttonIndex): try: selButton=buttonList[buttonIndex] except IndexError: return for eachButton in buttonList: eachButton.SetUp() selButton.Down() def SetTitle(self, name): self.board.SetTitleName(name) def SetNumberMode(self): self.inputValue.SetNumberMode() def SetSecretMode(self): self.inputValue.SetSecret() def SetFocus(self): self.inputValue.SetFocus() def SetMaxLength(self, length): width = length * 6 + 10 self.inputValue.SetMax(length) self.SetSlotWidth(width) self.SetBoardWidth(max(width + 50, 160)) def SetSlotWidth(self, width): self.inputSlot.SetSize(width, self.inputSlot.GetHeight()) self.inputValue.SetSize(width, self.inputValue.GetHeight()) def SetBoardWidth(self, width): self.board.SetSize(max(width + 50, 160), self.GetHeight()) self.SetSize(max(width + 50, 160), self.GetHeight()) self.UpdateRect() def SetAcceptEvent(self, event): self.acceptButton.SetEvent(event) self.inputValue.OnIMEReturn = event def SetCancelEvent(self, event): self.board.SetCloseEvent(event) self.cancelButton.SetEvent(event) self.inputValue.OnPressEscapeKey = event def GetType(self): return self.type def GetText(self): return self.inputValue.GetText() def __CreateGameTypeToolTip(self, title, descList): toolTip = uiToolTip.ToolTip() toolTip.SetTitle(title) toolTip.AppendSpace(5) for desc in descList: toolTip.AutoAppendTextLine(desc) toolTip.AlignHorizonalCenter() return toolTip class GuildWindow(ui.ScriptWindow): GUILD_SKILL_PASSIVE_SLOT = 0 GUILD_SKILL_ACTIVE_SLOT = 1 GUILD_SKILL_AFFECT_SLOT = 2 def __init__(self): ui.ScriptWindow.__init__(self) self.state = "INFO_GUILD" self.isLoaded = 0 self.__Initialize() self.__LoadWindow() def __del__(self): ui.ScriptWindow.__del__(self) def __Initialize(self): self.tabButtonDict = None self.pageDict = None self.titleBarDict = None self.commentBoard = None self.can_continue = 1 self.objPos = 0 self.objPos2 = 0 self.objPos3 = 0 self.tooltip_in = 0 def CanOpen(self): return guild.IsGuildEnable() def Show(self): self.__LoadWindow() ui.ScriptWindow.Show(self) def __LoadScript(self, fileName): pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, fileName) def __BindObject(self): self.tooltipSkill = uiToolTip.SkillToolTip() self.tooltipSkill.Hide() self.markSelectDialog=uiUploadMark.MarkSelectDialog() self.markSelectDialog.SAFE_SetSelectEvent(self.__OnSelectMark) self.GetChild("Expand").SetEvent(self.Functie_glisare_max) self.GetChild("Minimize").SetEvent(self.Functie_glisare_min) self.GetChild("Minimize").Hide() self.TabButton1 = self.GetChild("Tab_Button_01") self.TabButton2 = self.GetChild("Tab_Button_02") self.TabButton3 = self.GetChild("Tab_Button_03") self.TabButton4 = self.GetChild("Tab_Button_04") self.TabButton5 = self.GetChild("Tab_Button_05") self.Button1Text = self.GetChild("Button1_Name") self.Button1Text.Hide() self.Button2Text = self.GetChild("Button2_Name") self.Button2Text.Hide() self.Button3Text = self.GetChild("Button3_Name") self.Button3Text.Hide() self.Button4Text = self.GetChild("Button4_Name") self.Button4Text.Hide() self.Button5Text = self.GetChild("Button5_Name") self.Button5Text.Hide() self.tabButtonDict = { "INFO_GUILD" : self.GetChild("Tab_Button_01"), "COMMENT_PAGE" : self.GetChild("Tab_Button_02"), "AUTHORITY_PAGE" : self.GetChild("Tab_Button_03"), "SKILL_PAGE" : self.GetChild("Tab_Button_04"), "GRADE_PAGE" : self.GetChild("Tab_Button_05") } self.pageDict = { "INFO_GUILD" : self.GetChild("Info_Guild"), "COMMENT_PAGE" : self.GetChild("Comment_GuildPage"), "AUTHORITY_PAGE" : self.GetChild("Authority_GuildPage"), "SKILL_PAGE" : self.GetChild("Skill_Page"), "GRADE_PAGE" : self.GetChild("Grade_Page") } self.titleBarDict = { "INFO_GUILD" : self.GetChild("Info_TitleBar"), "COMMENT_PAGE" : self.GetChild("Comment_TitleBar"), "AUTHORITY_PAGE" : self.GetChild("Authority_TitleBar"), "SKILL_PAGE" : self.GetChild("Skill_TitleBar"), "GRADE_PAGE" : self.GetChild("Grade_TitleBar") } #first_page self.info_guildPage() self.offerDialog = uiPickMoney_Guild.PickMoneyDialog_Guild() self.offerDialog.LoadDialog() self.offerDialog.SetMax(9) self.offerDialog.SetTitleName(localeInfo.GUILD_OFFER_EXP) self.offerDialog.SetAcceptEvent(ui.__mem_func__(self.OnOffer)) #second_page self.comment_guildPage() #3'th page self.authority_guildPage() #4'th page self.skill_guildPage() #5'th page self.grade_guildPage() def info_guildPage(self): #-1 self.mark = self.GetChild("LargeGuildMark") self.mark_change = self.GetChild("GuildMark") self.mark_change.SetEvent(lambda : self.__OnClickSelectGuildMarkButton()) self.guild_level = self.GetChild("GuildLevelValue") self.guild_name = self.GetChild("GuildNameValue") self.guild_leader = self.GetChild("GuildMasterNameValue") self.level_percent = self.GetChild("PercentExp") self.curr_exp = self.GetChild("CurrentExperienceValue") self.exp_img = self.GetChild("ExpImgFull") #-2 self.guild_members = self.GetChild("GuildMemberCountValue") self.guild_members_level = self.GetChild("GuildMemberLevelAverageValue") self.guild_members_level = self.GetChild("GuildMemberLevelAverageValue") self.guild_donate_exp = self.GetChild("OfferButton") self.guild_donate_exp.SetEvent(lambda : self.__OnClickOfferButton()) self.guild_declare_war = self.GetChild("DeclareWarButton") self.guild_declare_war.SetEvent(lambda : self.__OnClickDeclareWarButton()) def __OnSelectMark(self, markFileName): ret = net.UploadMark("upload/"+markFileName) # MARK_BUG_FIX if net.ERROR_MARK_UPLOAD_NEED_RECONNECT == ret: chat.AppendChat(1,localeInfo.UPLOAD_MARK_UPLOAD_NEED_RECONNECT) return ret def __OnClickSelectGuildMarkButton(self): if guild.GetGuildLevel() < int(localeInfo.GUILD_MARK_MIN_LEVEL): chat.AppendChat(1,localeInfo.GUILD_MARK_NOT_ENOUGH_LEVEL) elif not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE): chat.AppendChat(1,localeInfo.GUILD_NO_NOTICE_PERMISSION) else: self.markSelectDialog.Open() def __OnClickOfferButton(self): curEXP = unsigned32(player.GetStatus(player.EXP)) if curEXP <= 100: chat.AppendChat(1,localeInfo.GUILD_SHORT_EXP) return self.offerDialog.Open(curEXP, 100) def OnOffer(self, exp): net.SendGuildOfferPacket(exp) def __OnClickDeclareWarButton(self): inputDialog = DeclareGuildWarDialog() inputDialog.Open() self.inputDialog = inputDialog #~~~~~~~ 2 Page def comment_guildPage(self): self.commentBoard = self.GetChild("CommentBoard") self.scrollbar = ui.ScrollBarNewDesign() self.scrollbar.SetParent(self.GetChild("Comment_GuildPage")) self.scrollbar.SetPosition(342,14) self.scrollbar.SetScrollBarSize(210) self.scrollbar.SetScrollEvent(self.__OnScroll) self.scrollbar.Show() self.commentSlot = ui.SpecialEditLine() self.commentSlot.SetParent(self.GetChild("CommentBoard")) self.commentSlot.SetPosition(220,16) self.commentSlot.SetSize(121,25) self.commentSlot.SetMax(35) self.commentSlot.OnIMEReturn = ui.__mem_func__(self.OnPostComment) self.commentSlot.SetIMEFlag(0) self.commentSlot.SetPlaceHolderText("قم بكتابة الرسالة...") self.commentSlot.SetPackedFontColor(0xffa07970) self.commentSlot.Show() self.objPos = 0 self.scrollbar.SetPos(0) self.LoadScroll() #~~~~~~~ 3 Page def authority_guildPage(self): textsAuthority = {1 : uiScriptLocale.SELECT_NAME,2 : uiScriptLocale.GUILD_RASA,3 : uiScriptLocale.GUILD_MEMBER_LEVEL, 4 : uiScriptLocale.GUILD_MEMBER_SPECIFIC_GRAVITY,5 : uiScriptLocale.GUILD_MEMBER_RANK,} self.players_Authority,u = {}, 0 for i in xrange(5): self.players_Authority = ui.TextLine() self.players_Authority.SetParent(self.GetChild("Authority_Info_3")) self.players_Authority.SetPosition(60+u,17) self.players_Authority.SetText(textsAuthority[i+1]) self.players_Authority.SetFontColor(0.902, 0.816, 0.635) self.players_Authority.Show() if i == 0: u += 60 elif i == 1 or i == 2: u += 45 else: u+= 60 self.scrollbarAuthority = ui.ScrollBarNewDesign() self.scrollbarAuthority.SetParent(self.GetChild("Authority_Info_2")) self.scrollbarAuthority.SetPosition(344,15) self.scrollbarAuthority.SetScrollBarSize(210) self.scrollbarAuthority.SetScrollEvent(self.__OnScroll2) # self.scrollbar.Show() self.objPos2 = 0 self.scrollbarAuthority.SetPos(0) self.LoadScroll2() pass def LoadScroll2(self): curMemberCount, maxMemberCount = guild.GetGuildMemberCount() pos = self.objPos2 if curMemberCount >= 5: self.obj_count2 = 5 self.scrollbarAuthority.Show() else: self.obj_count2 = curMemberCount self.scrollbarAuthority.Hide() z=0 self.players, u = {}, 0 self.namesAuthority,self.imgs,self.levels,self.inverts,self.pos = {},{},{},{},{} for i in xrange(self.obj_count2): realPos = pos+i pid, name, grade, race, level, offer, general = guild.GetMemberData(realPos) if not name or name == "": break guildExperienceSummary = guild.GetGuildExperienceSummary() offerPercentage = 0 if guildExperienceSummary > 0: offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0) self.players = ui.ImageBox() self.players.SetParent(self.GetChild("Authority_Info_2")) self.players.SetPosition(25,20+u) self.players.LoadImage("d:/ymir work/interface/guild/dialog_member_slot.tga") self.players.Show() self.pos = ui.NewComboBox() self.pos.SetParent(self.players) self.pos.SetPosition(218,3) self.pos.SetSize(90,23) self.pos.SetCurrentItem(guild.GetGradeName(grade)) masterName = guild.GetGuildMasterName() mainCharacterName = player.GetMainCharacterName() if mainCharacterName == masterName: self.pos.Enable() self.pos.SetEvent(lambda gradeNumber, lineIndex=realPos, argSelf=proxy(self): argSelf.OnChangeMemberGrade(lineIndex, gradeNumber)) self.pos.Show() self.pos.ClearItem() for e in xrange(14): self.pos.InsertItem(e+2, guild.GetGradeName(e+2)) self.pos.SetCurrentItem(guild.GetGradeName(grade)) self.namesAuthority = ui.TextLine() self.namesAuthority.SetParent(self.players) self.namesAuthority.SetPosition(50,7) self.namesAuthority.SetText(name) self.namesAuthority.SetFontColor(0.902, 0.816, 0.635) self.namesAuthority.Show() self.imgs = ui.ImageBox() self.imgs.SetParent(self.players) self.imgs.SetPosition(93,2) self.imgs.LoadImage(FACE_IMAGE_DICT[race]) self.imgs.Show() self.levels = ui.TextLine() self.levels.SetParent(self.players) self.levels.SetPosition(160,7) self.levels.SetText(str(level)) self.levels.SetFontColor(0.424, 0.337, 0.329) self.levels.Show() self.inverts = ui.TextLine() self.inverts.SetParent(self.players) self.inverts.SetPosition(195,7) self.inverts.SetText(str(offerPercentage)+"%") self.inverts.SetFontColor(0.424, 0.337, 0.329) self.inverts.Show() u+= 30 def __OnScroll2(self): curMemberCount, maxMemberCount = guild.GetGuildMemberCount() self.objPos2 = self.scrollbarAuthority.GetPos() * (curMemberCount-6) self.LoadScroll2() def OnChangeMemberGrade(self, id, gradeNumber): PID = guild.MemberIndexToPID(id) net.SendGuildChangeMemberGradePacket(PID, gradeNumber) self.objPos2 = 0 self.scrollbarAuthority.SetPos(0) self.LoadScroll2() def RefAuthMember(self): curMemberCount, maxMemberCount = guild.GetGuildMemberCount() if curMemberCount >= 5: self.obj_count2 = 5 else: self.obj_count2 = curMemberCount pos = self.objPos2 for i in xrange(self.obj_count2): realPos = pos+i pid, name, grade, race, level, offer, general = guild.GetMemberData(realPos) if not name or name == "": break guildExperienceSummary = guild.GetGuildExperienceSummary() offerPercentage = 0 if guildExperienceSummary > 0: offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0) if self.inverts != 0: self.inverts.SetText(str(offerPercentage)+"%") self.pos.SetCurrentItem(guild.GetGradeName(grade)) if self.pos[int(realPos)].CheckOpen() == 1: self.open = 1 for e in xrange(self.obj_count2): self.pos[e].Hide() self.pos[int(realPos)].Show() def skill_guildPage(self): self.skillPoints = self.GetChild("Skill_Plus_Value") self.energy = self.GetChild("Dragon_God_Power_Value") self.energyBar = self.GetChild("EnergyFull") self.donate_energy = self.GetChild("DonateEnergyButton") self.donate_energy.SetEvent(lambda : self.__OnOpenHealGSPBoard()) self.backSlot = ui.GridSlotWindow() self.backSlot.SetParent(self.GetChild("Skill_Page")) self.backSlot.SetPosition(30-25,80) self.backSlot.ArrangeSlot(210, 6, 1, 40, 40,3,0) self.backSlot.SetSlotBaseImage("d:/ymir work/interface/slot/slot3.tga",1.0,1.0,1.0,1.0) self.backSlot.SetWindowHorizontalAlignCenter() self.backSlot.Show() self.activeSlot = ui.GridSlotWindow() self.activeSlot.SetParent(self.GetChild("Skill_Page")) self.activeSlot.SetPosition(34-25,84) self.activeSlot.ArrangeSlot(210, 6, 1, 40, 40,3,0) self.activeSlot.SetSlotBaseImage("d:/ymir work/ui/slot.tga",1.0,1.0,1.0,1.0) self.activeSlot.SetWindowHorizontalAlignCenter() self.activeSlot.Show() self.activeSlot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE) self.activeSlot.SetOverInItemEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OverInItem(slotNumber, type)) self.activeSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) self.activeSlot.SetSelectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnPickUpGuildSkill(slotNumber, type)) self.activeSlot.SetUnselectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUseGuildSkill(slotNumber, type)) self.activeSlot.SetPressedSlotButtonEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUpGuildSkill(slotNumber, type)) self.activeSlot.AppendSlotButton("d:/ymir work/interface/button/char_buttons/plus_01_normal.tga",\ "d:/ymir work/interface/button/char_buttons/plus_02_hover.tga",\ "d:/ymir work/interface/button/char_buttons/plus_03_active.tga") ## Active for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)): slotIndex = self.activeSlot.GetStartIndex()+i skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST self.activeSlot.SetSkillSlot(slotIndex, skillIndex, 0) self.activeSlot.SetCoverButton(slotIndex) self.activeSlot.RefreshSlot() guild.SetSkillIndex(slotIndex, len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)+i) def RefreshGuildSkillPage(self): if 0 != 0: return # page = self.pageDict["MUSIC"] curPoint, maxPoint = guild.GetDragonPowerPoint() maxPoint = max(maxPoint, 1) self.energy.SetText("|cffa08784"+uiScriptLocale.CHARACTER_PSTATUS+ "|cfff8d090 " +str(curPoint) + " / " + str(maxPoint)) percentage = ( (float(curPoint / max(1, float(maxPoint))) * 100)) self.energyBar.SetPercentage(curPoint,maxPoint) skillPoint = guild.GetGuildSkillPoint() self.skillPoints.SetText("|cffa08784"+uiScriptLocale.CHARACTER_PSTATUS + "|cfff8d090 " +str(skillPoint)) # page.passiveSlot.HideAllSlotButton() self.activeSlot.HideAllSlotButton() ## Active for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)): slotIndex = self.activeSlot.GetStartIndex()+i skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST skillLevel = guild.GetSkillLevel(slotIndex) skillMaxLevel = skill.GetSkillMaxLevel(skillIndex) self.activeSlot.SetSlotCount(slotIndex, skillLevel) if skillLevel <= 0: self.activeSlot.DisableCoverButton(slotIndex) else: self.activeSlot.EnableCoverButton(slotIndex) if skillPoint > 0: if skillLevel < skillMaxLevel: self.activeSlot.ShowSlotButton(slotIndex) def OnPickUpGuildSkill(self, skillSlotIndex, type): mouseController = mouseModule.mouseController if False == mouseController.isAttached(): skillIndex = player.GetSkillIndex(skillSlotIndex) skillLevel = guild.GetSkillLevel(skillSlotIndex) if skill.CanUseSkill(skillIndex) and skillLevel > 0: if app.IsPressed(app.DIK_LCONTROL): player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, skillSlotIndex) return mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, skillSlotIndex, skillIndex) else: mouseController.DeattachObject() def OnUseGuildSkill(self, slotNumber, type): skillIndex = player.GetSkillIndex(slotNumber) skillLevel = guild.GetSkillLevel(slotNumber) if skillLevel <= 0: return player.UseGuildSkill(slotNumber) def OnUpGuildSkill(self, slotNumber, type): skillIndex = player.GetSkillIndex(slotNumber) net.SendChatPacket("/gskillup " + str(skillIndex)) def OnUseSkill(self, slotNumber, coolTime): if 0 != 0: return # self.activeSlot = ui.GridSlotWindow() if self.activeSlot.HasSlot(slotNumber): self.activeSlot.SetSlotCoolTime(slotNumber, coolTime) def OverInItem(self, slotNumber, type): if mouseModule.mouseController.isAttached(): return if None != self.tooltipSkill: skillIndex = player.GetSkillIndex(slotNumber) skillLevel = guild.GetSkillLevel(slotNumber) self.tooltipSkill.SetSkill(skillIndex, skillLevel) def OverOutItem(self): self.tooltipSkill.HideToolTip() self.tooltip_in = 0 def SetSkillToolTip(self, tooltipSkill): self.tooltipSkill = tooltipSkill def __OnOpenHealGSPBoard(self): curPoint, maxPoint = guild.GetDragonPowerPoint() if maxPoint - curPoint <= 0: chat.AppendChat(1,localeInfo.GUILD_CANNOT_HEAL_GSP_ANYMORE) return pickDialog = uiPickMoney_Guild.PickMoneyDialog_Guild() pickDialog.LoadDialog() pickDialog.SetMax(9) pickDialog.SetTitleName(localeInfo.GUILD_HEAL_GSP) pickDialog.SetAcceptEvent(ui.__mem_func__(self.__OnOpenHealGSPQuestionDialog)) pickDialog.Open(maxPoint - curPoint, 1) self.pickDialog = pickDialog def __OnOpenHealGSPQuestionDialog(self, healGSP): money = healGSP * constInfo.GUILD_MONEY_PER_GSP questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.GUILD_DO_YOU_HEAL_GSP % (money, healGSP)) questionDialog.SetAcceptEvent(ui.__mem_func__(self.__OnHealGSP)) questionDialog.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog)) questionDialog.SetWidth(400) questionDialog.Open() questionDialog.healGSP = healGSP self.questionDialog = questionDialog def __OnHealGSP(self): net.SendGuildChargeGSPPacket(self.questionDialog.healGSP) self.__OnCloseQuestionDialog() def __OnCloseQuestionDialog(self): if self.questionDialog: self.questionDialog.Close() self.questionDialog = None def grade_guildPage(self): textsGrade = {0 : "رقم.", 1 : uiScriptLocale.SELECT_NAME,2 : uiScriptLocale.GUILD_GRADE_PERMISSION_JOIN,3 : uiScriptLocale.GUILD_GRADE_PERMISSION_DELETE, 4 : uiScriptLocale.GUILD_GRADE_PERMISSION_NOTICE,5 : uiScriptLocale.GUILD_GRADE_PERMISSION_SKILL,} self.players_t,u = {}, 0 for i in xrange(6): self.players_t = ui.TextLine() self.players_t.SetParent(self.GetChild("Grade_Page")) self.players_t.SetPosition(30+u,17) self.players_t.SetText(textsGrade) self.players_t.SetFontColor(0.902, 0.816, 0.635) self.players_t.Show() if i == 0: u += 45 elif i == 1: u += 65 elif i == 2: u += 40 elif i == 3: u+= 65 else: u+= 45 self.status11 = ui.NewBoard() self.status11.SetParent(self.GetChild("Grade_Page")) self.status11.SetSize(363,265) self.status11.SetPosition(0,33+12) self.status11.Show() self.scrollbarGrade = ui.ScrollBarNewDesign() self.scrollbarGrade.SetParent(self.status11) self.scrollbarGrade.SetPosition(342,15) self.scrollbarGrade.SetScrollBarSize(243) self.scrollbarGrade.SetScrollEvent(self.__OnScroll3) self.scrollbarGrade.Show() self.objPos3 = 0 self.scrollbarGrade.SetPos(0) self.LoadScroll3() def RefGradeGuild(self): if 11 >= 9: self.obj_count3 = 9 else: self.obj_count3 = 13 pos = self.objPos3 for i in xrange(1,self.obj_count3): realPos = pos+i name, authority = guild.GetGradeData(int(realPos)) self.checkbox.SetCheck(authority & guild.AUTH_ADD_MEMBER) self.checkbox4.SetCheck(authority & guild.AUTH_SKILL) self.checkbox3.SetCheck(authority & guild.AUTH_NOTICE) self.checkbox2.SetCheck(authority & guild.AUTH_REMOVE_MEMBER) self.namesGrage.SetText(name) def LoadScroll3(self): total = 13 pos = self.objPos3 if total >= 9: self.obj_count3 = 9 else: self.obj_count3 = total z=0 self.img_rank, u = {}, 0 self.idx = {} self.checkbox,self.checkbox2,self.checkbox3,self.checkbox4 = {},{},{},{} self.namesGrage = {} for i in xrange(1,self.obj_count3): realPos = pos+i name, authority = guild.GetGradeData(int(realPos)) self.img_rank = ui.ExpandedImageBox() self.img_rank.SetParent(self.status11) self.img_rank.SetPosition(20,12+u) self.img_rank.LoadImage("d:/ymir work/interface/guild/dialog_rank_slot.tga") self.img_rank.Show() self.idx = ui.TextLine() self.idx.SetParent(self.img_rank) self.idx.SetPosition(10,6) self.idx.SetText(str(int(realPos))+".") self.idx.SetPackedFontColor(0xffcaa76f) self.idx.Show() self.namesGrage = ui.EditableTextSlot(self.img_rank, 30, 2) self.namesGrage.SetEvent(ui.__mem_func__(self.OnOpenChangeGradeName), i) self.namesGrage.SetText(name) self.namesGrage.Show() event1 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<0: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) event2 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<1: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) event3 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<2: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) event4 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<3: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) self.checkbox = ui.CheckBox(self.img_rank,122,3,event1) self.checkbox2 = ui.CheckBox(self.img_rank,173,3,event2) self.checkbox3 = ui.CheckBox(self.img_rank,225,3,event3) self.checkbox4 = ui.CheckBox(self.img_rank,275,3,event4) self.checkbox.SetCheck(authority & guild.AUTH_ADD_MEMBER) self.checkbox4.SetCheck(authority & guild.AUTH_SKILL) self.checkbox3.SetCheck(authority & guild.AUTH_NOTICE) self.checkbox2.SetCheck(authority & guild.AUTH_REMOVE_MEMBER) u += 30 def __OnScroll3(self): self.objPos3 = self.scrollbarGrade.GetPos() * (14-10) self.LoadScroll3() def OnCheckAuthority(self, argIndex, argAuthority): name, authority = guild.GetGradeData(argIndex) net.SendGuildChangeGradeAuthorityPacket(argIndex, authority ^ argAuthority) def OnChangeGradeName(self, gradeNumber): if len(gradeName) == 0: gradeName = localeInfo.GUILD_DEFAULT_GRADE net.SendGuildChangeGradeNamePacket(gradeNumber, gradeName) return TRUE def OnOpenChangeGradeName(self, arg): self.cambiar = arg self.a = uiCommon.InputDialog() self.a.SetTitle("تغيير الرتبة") self.a.SetAcceptEvent(ui.__mem_func__(self.__OnchangeName)) self.a.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog2)) self.a.Open() def __OnchangeName(self): gradeName = self.a.GetText() if len(gradeName) == 0: gradeName = localeInfo.GUILD_DEFAULT_GRADE net.SendGuildChangeGradeNamePacket(self.cambiar, gradeName) self.__OnCloseQuestionDialog2() def __OnCloseQuestionDialog2(self): if self.a: self.a.Close() self.cambiar = None self.a = None def OnUpdate(self): #-1 self.mark.SetIndex(net.GetGuildID()) self.mark.SetScale(3.3) self.guild_level.SetText(str(guild.GetGuildLevel())) self.guild_name.SetText(guild.GetGuildName()) self.guild_leader.SetText(player.GetName()) curExp, lastExp = guild.GetGuildExperience() curExp *= 100 lastExp *= 100 total = curExp + lastExp self.exp_img.SetPercentage(curExp,total) self.curr_exp.SetText("EXP: "+str(curExp)+ " " +uiScriptLocale.CHARACTER_FROM +" "+str(total)) self.level_percent.SetText("%s %.2f%%" % ("", float(curExp) / max(1, float(total)) * 100)) #-1 #-2 curMemberCount, maxMemberCount = guild.GetGuildMemberCount() self.guild_members.SetText(str(curMemberCount)+" / "+str(maxMemberCount)) self.guild_members_level.SetText(str(guild.GetGuildMemberLevelAverage())) #-2 #-4 self.RefAuthMember() #-4 #-5 self.RefreshGuildSkillPage() #-5 #-6 self.RefGradeGuild() pass def Functie_glisare_max(self): latime = self.GetChild("board").GetWidth() latime2 = self.GetChild("TabButtonsBoard").GetWidth() if latime < 467+48+39: latime = latime+2 latime2 = latime2+2 self.SetSize(latime,300) self.GetChild("board").SetSize(latime,340+10) self.GetChild("TabButtonsBoard").SetSize(latime2,300+10) self.GetChild("Authority_TitleBar").SetWidth(latime-15) self.GetChild("Skill_TitleBar").SetWidth(latime-15) self.GetChild("Grade_TitleBar").SetWidth(latime-15) self.GetChild("Comment_TitleBar").SetWidth(latime-15) self.GetChild("Info_TitleBar").SetWidth(latime-15) self.GetChild("Expand").SetPosition(latime-15-70, 10) self.GetChild("Minimize").SetPosition(latime-15-70, 10) self.GetChild("TitleName").SetPosition(0, 12-172) self.glisare = WaitingDialog() self.glisare.Open(0.0) self.glisare.SAFE_SetTimeOverEvent(self.Functie_glisare_max) else: self.TabButton1.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton1.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton2.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton2.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton3.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton3.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton4.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton4.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton5.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton5.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") if info_guildPage == 1: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") if comment_guildPage == 1: self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") else: self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") if authority_guildPage == 1: self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") else: self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") if skill_guildPage == 1: self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") else: self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") if grade_guildPage == 1: self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") else: self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.Button1Text.Show() self.Button2Text.Show() self.Button3Text.Show() self.Button4Text.Show() self.Button5Text.Show() self.GetChild("Minimize").Show() self.GetChild("Expand").Hide() def Functie_glisare_min(self): latime = self.GetChild("board").GetWidth() latime2 = self.GetChild("TabButtonsBoard").GetWidth() self.TabButton1.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton1.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton2.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton2.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton3.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton3.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton4.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton4.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton5.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton5.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") if info_guildPage == 1: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if comment_guildPage == 1: self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") else: self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if authority_guildPage == 1: self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") else: self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if skill_guildPage == 1: self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") else: self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if grade_guildPage == 1: self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") else: self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.Button1Text.Hide() self.Button2Text.Hide() self.Button3Text.Hide() self.Button4Text.Hide() self.Button5Text.Hide() if latime>340+47+39: latime = latime-2 latime2 = latime2-2 self.SetSize(latime,300) self.GetChild("board").SetSize(latime,340+10) self.GetChild("TabButtonsBoard").SetSize(latime2,300+10) self.GetChild("Authority_TitleBar").SetWidth(latime-15) self.GetChild("Skill_TitleBar").SetWidth(latime-15) self.GetChild("Grade_TitleBar").SetWidth(latime-15) self.GetChild("Comment_TitleBar").SetWidth(latime-15) self.GetChild("Info_TitleBar").SetWidth(latime-15) self.GetChild("Expand").SetPosition(latime-15-70, 10) self.GetChild("Minimize").SetPosition(latime-15-70, 10) self.GetChild("TitleName").SetPosition(0, 12-172) self.glisare = WaitingDialog() self.glisare.Open(0.0) self.glisare.SAFE_SetTimeOverEvent(self.Functie_glisare_min) else: self.GetChild("Expand").Show() self.GetChild("Minimize").Hide() def __BindEvent(self): for (tabKey, tabButton) in self.tabButtonDict.items(): tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey) for titleBarValue in self.titleBarDict.itervalues(): titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide)) def __LoadWindow(self): if self.isLoaded == 1: return self.isLoaded = 1 try: if localeInfo.IsARABIC() or localeInfo.IsVIETNAM() or localeInfo.IsJAPAN(): self.__LoadScript("uiscript/GuildWindow.py") else: self.__LoadScript("uiscript/GuildWindow.py") self.__BindObject() self.__BindEvent() except: import exception exception.Abort("OptionWindow.__LoadWindow") self.SetState("INFO_GUILD") def Destroy(self): self.ClearDictionary() self.__Initialize() def Close(self): self.Hide() def __OnClickTabButton(self, stateKey): global info_guildPage,comment_guildPage,authority_guildPage,skill_guildPage,grade_guildPage latime = self.GetWidth() if stateKey == "INFO_GUILD": info_guildPage = 1 comment_guildPage = 0 authority_guildPage = 0 skill_guildPage = 0 grade_guildPage = 0 if latime == 468+48+39: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.Button1Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_1) self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2) self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3) self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4) self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5) else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if stateKey == "COMMENT_PAGE": info_guildPage = 0 comment_guildPage = 1 authority_guildPage = 0 skill_guildPage = 0 grade_guildPage = 0 if latime == 468+48+39: net.SendGuildRefreshCommentsPacket(0) self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1) self.Button2Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_2) self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3) self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4) self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5) else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if stateKey == "AUTHORITY_PAGE": info_guildPage = 0 comment_guildPage = 0 authority_guildPage = 1 skill_guildPage = 0 grade_guildPage = 0 if latime == 468+48+39: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1) self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2) self.Button3Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_3) self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4) self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5) else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if stateKey == "SKILL_PAGE": info_guildPage = 0 comment_guildPage = 0 authority_guildPage = 0 skill_guildPage = 1 grade_guildPage = 0 if latime == 468+48+39: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1) self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2) self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3) self.Button4Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_4) self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5) else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") if stateKey == "GRADE_PAGE": info_guildPage = 0 comment_guildPage = 0 authority_guildPage = 0 skill_guildPage = 0 grade_guildPage = 1 if latime == 468+48+39: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga") self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1) self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2) self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3) self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4) self.Button5Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_5) else: self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga") self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga") self.SetState(stateKey) def SetState(self, stateKey): self.state = stateKey if constInfo.ENABLE_FIX_CHARACTER_PAGE: if stateKey == NAME_CLASS_I: self.OnRefreshComments() for (tabKey, tabButton) in self.tabButtonDict.items(): if stateKey!=tabKey: tabButton.SetUp() for pageValue in self.pageDict.itervalues(): pageValue.Hide() for titleBarValue in self.titleBarDict.itervalues(): titleBarValue.Hide() self.titleBarDict[stateKey].Show() self.pageDict[stateKey].Show() def __GetGuildBoardCommentData(self, index): commentID, chrName, comment = guild.GetGuildBoardCommentData(index) if 0==commentID: if ""==chrName: chrName=localeInfo.UI_NONAME if ""==comment: comment=localeInfo.UI_NOCONTENTS return commentID, chrName, comment def OnPostComment(self): text = self.commentSlot.GetText() if not text: return FALSE if not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE): chat.AppendChat(1,localeInfo.GUILD_NO_NOTICE_PERMISSION) return net.SendGuildPostCommentPacket(text[:50]) self.commentSlot.SetText("") self.objPos = 0 self.scrollbar.SetPos(0) self.LoadScroll() return TRUE def OnDeleteComment(self, index): commentID, chrName, comment = self.__GetGuildBoardCommentData(index) net.SendGuildDeleteCommentPacket(commentID) self.LoadScroll() def OnRefreshComments(self): net.SendGuildRefreshCommentsPacket(0) def __OnScroll(self): self.OnRefreshComments() self.objPos = self.scrollbar.GetPos() * (guild.GetGuildBoardCommentCount()-6) self.LoadScroll() def LoadScroll(self): net.SendGuildRefreshCommentsPacket(0) pos = self.objPos if guild.GetGuildBoardCommentCount() >= 6: self.obj_count = 6 self.scrollbar.Show() else: self.obj_count = guild.GetGuildBoardCommentCount() self.scrollbar.Hide() self.delete,self.important, self.spaces,self.namesCommand,self.comments, u = {},{},{},{},{}, 0 for i in xrange(self.obj_count): realPos = pos+i commentID, chrName, comment = self.__GetGuildBoardCommentData(realPos) if chrName == "Noname": break self.spaces = ui.ImageBox() self.spaces.SetParent(self.GetChild("Comment_GuildPage")) self.spaces.SetPosition(20,20+u) self.spaces.LoadImage("d:/ymir work/interface/guild/dialog_message_slot.tga") self.spaces.Show() self.namesCommand = ui.TextLine() self.namesCommand.SetParent(self.spaces) self.namesCommand.SetPosition(50,8) self.namesCommand.SetText(chrName) self.namesCommand.SetPackedFontColor(0xffcaa76f) self.namesCommand.Show() self.important = ui.ImageBox() self.important.SetParent(self.spaces) self.important.SetPosition(87,8) self.important.LoadImage("d:/ymir work/interface/guild/dialog_message_importantmsg.tga") self.comments = ui.TextLine() self.comments.SetParent(self.spaces) self.comments.SetPosition(310,8) if "!" == comment[0]: self.comments.SetText(comment[1:]) self.comments.SetPackedFontColor(0xffdb9b93) self.important.Show() else: self.comments.SetText(comment) self.comments.SetPackedFontColor(0xffa08784) self.comments.Show() masterName = guild.GetGuildMasterName() mainCharacterName = player.GetMainCharacterName() if mainCharacterName == chrName or (masterName == mainCharacterName): self.delete = ui.Button() self.delete.SetParent(self.spaces) self.delete.SetPosition(305,7) self.delete.SetUpVisual("d:/ymir work/interface/guild/close_mini_01_normal.tga") self.delete.SetOverVisual("d:/ymir work/interface/guild/close_mini_02_hover.tga") self.delete.SetDownVisual("d:/ymir work/interface/guild/close_mini_03_active.tga") self.delete.SetEvent(lambda x = realPos: self.OnDeleteComment(x)) self.delete.Show() u += 35 def GetState(self): return self.state def OnPressExitKey(self): self.Close() return TRUE def OnPressEscapeKey(self): self.Close() return TRUE class WaitingDialog(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.eventTimeOver = lambda *arg: None self.eventExit = lambda *arg: None def __del__(self): ui.ScriptWindow.__del__(self) def Open(self, waitTime): import time curTime = time.clock() self.endTime = curTime + waitTime self.Show() def Close(self): self.Hide() def Destroy(self): self.Hide() def SAFE_SetTimeOverEvent(self, event): self.eventTimeOver = ui.__mem_func__(event) def SAFE_SetExitEvent(self, event): self.eventExit = ui.__mem_func__(event) def OnUpdate(self): import time lastTime = max(0, self.endTime - time.clock()) if 0 == lastTime: self.Close() self.eventTimeOver() else: return def OnPressEscapeKey(self): self.Close() return TRUE def OnPressExitKey(self): self.Close() return TRUE


import ui
import net
import chr
import player
import wndMgr
import item
import emotion
import uiCommon
import app
import uiUploadMark
import guild
import quest
import mouseModule
import chat
import playerSettingModule
import uiToolTip
import uiPickMoney_Guild
import localeInfo
import constInfo
import dbg
import skill
import uiScriptLocale
import time
import snd
import event
from _weakref import proxy

def unsigned32(n):
	return n & 0xFFFFFFFFL

info_guildPage = 1
comment_guildPage = 0
authority_guildPage = 0
skill_guildPage = 0
grade_guildPage = 0

NAME_CLASS_I = "COMMENT_PAGE"

FACE_IMAGE_DICT = {
	playerSettingModule.RACE_WARRIOR_M	: "d:/ymir work/interface/faces/small/icon_mwarrior.tga",
	playerSettingModule.RACE_WARRIOR_W	: "d:/ymir work/interface/faces/small/icon_wwarrior.tga",
	playerSettingModule.RACE_ASSASSIN_M	: "d:/ymir work/interface/faces/small/icon_mninja.tga",
	playerSettingModule.RACE_ASSASSIN_W	: "d:/ymir work/interface/faces/small/icon_wninja.tga",
	playerSettingModule.RACE_SURA_M		: "d:/ymir work/interface/faces/small/icon_msura.tga",
	playerSettingModule.RACE_SURA_W		: "d:/ymir work/interface/faces/small/icon_wsura.tga",
	playerSettingModule.RACE_SHAMAN_M	: "d:/ymir work/interface/faces/small/icon_mshaman.tga",
	playerSettingModule.RACE_SHAMAN_W	: "d:/ymir work/interface/faces/small/icon_wshaman.tga",
}

GRADE_ADD_MEMBER_AUTHORITY = 1
GRADE_REMOVE_MEMBER_AUTHORITY = 2
GRADE_NOTICE_AUTHORITY = 3
GRADE_SKILL_AUTHORITY = 4

class DeclareGuildWarDialog(ui.ScriptWindow):

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

		self.type=0
		self.__CreateDialog()

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

	def Open(self):
		self.inputValue.SetFocus()
		self.SetCenterPosition()
		self.SetTop()
		self.Show()

	def Close(self):
		self.ClearDictionary()
		self.board = None
		self.acceptButton = None
		self.cancelButton = None
		self.inputSlot = None
		self.inputValue = None
		self.Hide()

	def __CreateDialog(self):

		try:
			pyScrLoader = ui.PythonScriptLoader()

			if localeInfo.IsVIETNAM() :
				pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "declareguildwardialog.py")
			else:
				pyScrLoader.LoadScriptFile(self, "uiscript/declareguildwardialog.py")

		except:
			import exception
			exception.Abort("DeclareGuildWarWindow.__CreateDialog - LoadScript")

		try:
			getObject = self.GetChild
			self.board = getObject("Board")

			self.typeButtonList=[]
			self.typeButtonList.append(getObject("NormalButton"))
			self.typeButtonList.append(getObject("WarpButton"))
			self.typeButtonList.append(getObject("CTFButton"))

			self.acceptButton = getObject("AcceptButton")
			self.cancelButton = getObject("CancelButton")
			self.inputSlot = getObject("InputSlot")
			self.inputValue = getObject("InputValue")

			gameType=getObject("GameType")

		except:
			import exception
			exception.Abort("DeclareGuildWarWindow.__CreateDialog - BindObject")

		if constInfo.GUILD_WAR_TYPE_SELECT_ENABLE==0:
			gameType.Hide()

		self.typeButtonList[0].SAFE_SetEvent(self.__OnClickTypeButtonNormal)
		self.typeButtonList[1].SAFE_SetEvent(self.__OnClickTypeButtonWarp)
		self.typeButtonList[2].SAFE_SetEvent(self.__OnClickTypeButtonCTF)

		self.typeButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_NORMAL_TITLE, localeInfo.GUILDWAR_NORMAL_DESCLIST))
		self.typeButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_WARP_TITLE, localeInfo.GUILDWAR_WARP_DESCLIST))
		self.typeButtonList[2].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_CTF_TITLE, localeInfo.GUILDWAR_CTF_DESCLIST))

		self.__ClickRadioButton(self.typeButtonList, 0)

		self.SetAcceptEvent(ui.__mem_func__(self.__OnOK))
		self.SetCancelEvent(ui.__mem_func__(self.__OnCancel))

	def __OnOK(self):
		text = self.GetText()
		type = self.GetType()

		if ""==text:
			return

		net.SendChatPacket("/war %s %d" % (text, type))
		self.Close()

		return 1

	def __OnCancel(self):
		self.Close()
		return 1

	def __OnClickTypeButtonNormal(self):
		self.__ClickTypeRadioButton(0)

	def __OnClickTypeButtonWarp(self):
		self.__ClickTypeRadioButton(1)

	def __OnClickTypeButtonCTF(self):
		self.__ClickTypeRadioButton(2)

	def __ClickTypeRadioButton(self, type):
		self.__ClickRadioButton(self.typeButtonList, type)
		self.type=type

	def __ClickRadioButton(self, buttonList, buttonIndex):
		try:
			selButton=buttonList[buttonIndex]
		except IndexError:
			return

		for eachButton in buttonList:
			eachButton.SetUp()

		selButton.Down()

	def SetTitle(self, name):
		self.board.SetTitleName(name)

	def SetNumberMode(self):
		self.inputValue.SetNumberMode()

	def SetSecretMode(self):
		self.inputValue.SetSecret()

	def SetFocus(self):
		self.inputValue.SetFocus()

	def SetMaxLength(self, length):
		width = length * 6 + 10
		self.inputValue.SetMax(length)
		self.SetSlotWidth(width)
		self.SetBoardWidth(max(width + 50, 160))

	def SetSlotWidth(self, width):
		self.inputSlot.SetSize(width, self.inputSlot.GetHeight())
		self.inputValue.SetSize(width, self.inputValue.GetHeight())

	def SetBoardWidth(self, width):
		self.board.SetSize(max(width + 50, 160), self.GetHeight())
		self.SetSize(max(width + 50, 160), self.GetHeight())
		self.UpdateRect()

	def SetAcceptEvent(self, event):
		self.acceptButton.SetEvent(event)
		self.inputValue.OnIMEReturn = event

	def SetCancelEvent(self, event):
		self.board.SetCloseEvent(event)
		self.cancelButton.SetEvent(event)
		self.inputValue.OnPressEscapeKey = event

	def GetType(self):
		return self.type

	def GetText(self):
		return self.inputValue.GetText()

	def __CreateGameTypeToolTip(self, title, descList):
		toolTip = uiToolTip.ToolTip()
		toolTip.SetTitle(title)
		toolTip.AppendSpace(5)

		for desc in descList:
			toolTip.AutoAppendTextLine(desc)

		toolTip.AlignHorizonalCenter()
		return toolTip


class GuildWindow(ui.ScriptWindow):
	
	GUILD_SKILL_PASSIVE_SLOT = 0
	GUILD_SKILL_ACTIVE_SLOT = 1
	GUILD_SKILL_AFFECT_SLOT = 2


	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.state = "INFO_GUILD"
		self.isLoaded = 0

		self.__Initialize()
		self.__LoadWindow()

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

	def __Initialize(self):
		self.tabButtonDict = None
		self.pageDict = None
		self.titleBarDict = None

		self.commentBoard = None
		self.can_continue = 1
		self.objPos = 0
		self.objPos2 = 0
		self.objPos3 = 0
		self.tooltip_in = 0
		
	def CanOpen(self):
		return guild.IsGuildEnable()
	
	def Show(self):
		self.__LoadWindow()
		ui.ScriptWindow.Show(self)
		

	def __LoadScript(self, fileName):
		pyScrLoader = ui.PythonScriptLoader()
		pyScrLoader.LoadScriptFile(self, fileName)	
		
	def __BindObject(self):
		self.tooltipSkill = uiToolTip.SkillToolTip()
		self.tooltipSkill.Hide()
		
		
		self.markSelectDialog=uiUploadMark.MarkSelectDialog()
		self.markSelectDialog.SAFE_SetSelectEvent(self.__OnSelectMark)
		
		
		self.GetChild("Expand").SetEvent(self.Functie_glisare_max)
		self.GetChild("Minimize").SetEvent(self.Functie_glisare_min)
		self.GetChild("Minimize").Hide()
	
	
		self.TabButton1 = self.GetChild("Tab_Button_01")
		self.TabButton2 = self.GetChild("Tab_Button_02")
		self.TabButton3 = self.GetChild("Tab_Button_03")
		self.TabButton4 = self.GetChild("Tab_Button_04")
		self.TabButton5 = self.GetChild("Tab_Button_05")
		
		self.Button1Text = self.GetChild("Button1_Name")
		self.Button1Text.Hide()
		self.Button2Text = self.GetChild("Button2_Name")
		self.Button2Text.Hide()
		self.Button3Text = self.GetChild("Button3_Name")
		self.Button3Text.Hide()
		self.Button4Text = self.GetChild("Button4_Name")
		self.Button4Text.Hide()
		self.Button5Text = self.GetChild("Button5_Name")
		self.Button5Text.Hide()

		self.tabButtonDict = {
			"INFO_GUILD"	: self.GetChild("Tab_Button_01"),
			"COMMENT_PAGE"		: self.GetChild("Tab_Button_02"),
			"AUTHORITY_PAGE"		: self.GetChild("Tab_Button_03"),
			"SKILL_PAGE"	: self.GetChild("Tab_Button_04"),
			"GRADE_PAGE"		: self.GetChild("Tab_Button_05")
		}

		self.pageDict = {
			"INFO_GUILD"	: self.GetChild("Info_Guild"),
			"COMMENT_PAGE"	: self.GetChild("Comment_GuildPage"),
			"AUTHORITY_PAGE"		: self.GetChild("Authority_GuildPage"),
			"SKILL_PAGE"	: self.GetChild("Skill_Page"),
			"GRADE_PAGE"		: self.GetChild("Grade_Page")
		}

		self.titleBarDict = {
			"INFO_GUILD"	: self.GetChild("Info_TitleBar"),
			"COMMENT_PAGE"	: self.GetChild("Comment_TitleBar"),
			"AUTHORITY_PAGE"		: self.GetChild("Authority_TitleBar"),
			"SKILL_PAGE"	: self.GetChild("Skill_TitleBar"),
			"GRADE_PAGE"		: self.GetChild("Grade_TitleBar")
		}
		#first_page
		self.info_guildPage()
		
		self.offerDialog = uiPickMoney_Guild.PickMoneyDialog_Guild()
		self.offerDialog.LoadDialog()
		self.offerDialog.SetMax(9)
		self.offerDialog.SetTitleName(localeInfo.GUILD_OFFER_EXP)
		self.offerDialog.SetAcceptEvent(ui.__mem_func__(self.OnOffer))
		
		#second_page
		self.comment_guildPage()
	
		#3'th page
		self.authority_guildPage()
		
		#4'th page
		self.skill_guildPage()
		
		#5'th page
		self.grade_guildPage()
		
	def info_guildPage(self):
		#-1
		self.mark = self.GetChild("LargeGuildMark")
		self.mark_change = self.GetChild("GuildMark")
		self.mark_change.SetEvent(lambda : self.__OnClickSelectGuildMarkButton())
		
		self.guild_level = self.GetChild("GuildLevelValue")
		self.guild_name = self.GetChild("GuildNameValue")
		self.guild_leader = self.GetChild("GuildMasterNameValue")
		self.level_percent = self.GetChild("PercentExp")
		self.curr_exp = self.GetChild("CurrentExperienceValue")
		self.exp_img = self.GetChild("ExpImgFull")
		#-2
		self.guild_members = self.GetChild("GuildMemberCountValue")
		self.guild_members_level = self.GetChild("GuildMemberLevelAverageValue")
		self.guild_members_level = self.GetChild("GuildMemberLevelAverageValue")
		
		self.guild_donate_exp = self.GetChild("OfferButton")
		self.guild_donate_exp.SetEvent(lambda : self.__OnClickOfferButton())
		
		self.guild_declare_war = self.GetChild("DeclareWarButton")
		self.guild_declare_war.SetEvent(lambda : self.__OnClickDeclareWarButton())
		

	def __OnSelectMark(self, markFileName):
		ret = net.UploadMark("upload/"+markFileName)

		# MARK_BUG_FIX
		if net.ERROR_MARK_UPLOAD_NEED_RECONNECT == ret:
			chat.AppendChat(1,localeInfo.UPLOAD_MARK_UPLOAD_NEED_RECONNECT)
		return ret
		
	def __OnClickSelectGuildMarkButton(self):
		if guild.GetGuildLevel() < int(localeInfo.GUILD_MARK_MIN_LEVEL):
			chat.AppendChat(1,localeInfo.GUILD_MARK_NOT_ENOUGH_LEVEL)
		elif not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE):
			chat.AppendChat(1,localeInfo.GUILD_NO_NOTICE_PERMISSION)
		else:
			self.markSelectDialog.Open()
	
	def __OnClickOfferButton(self):

		curEXP = unsigned32(player.GetStatus(player.EXP))

		if curEXP <= 100:
			chat.AppendChat(1,localeInfo.GUILD_SHORT_EXP)
			return

		self.offerDialog.Open(curEXP, 100)

	def OnOffer(self, exp):
		net.SendGuildOfferPacket(exp)
	
	def __OnClickDeclareWarButton(self):
		inputDialog = DeclareGuildWarDialog()
		inputDialog.Open()
		self.inputDialog = inputDialog
	
	
	#~~~~~~~ 2 Page
	
	def comment_guildPage(self):
		self.commentBoard = self.GetChild("CommentBoard")
		
		self.scrollbar = ui.ScrollBarNewDesign()
		self.scrollbar.SetParent(self.GetChild("Comment_GuildPage"))
		self.scrollbar.SetPosition(342,14)
		self.scrollbar.SetScrollBarSize(210)
		self.scrollbar.SetScrollEvent(self.__OnScroll)
		self.scrollbar.Show()
		
		self.commentSlot = ui.SpecialEditLine()
		self.commentSlot.SetParent(self.GetChild("CommentBoard"))
		self.commentSlot.SetPosition(220,16)
		self.commentSlot.SetSize(121,25)
		self.commentSlot.SetMax(35)
		self.commentSlot.OnIMEReturn = ui.__mem_func__(self.OnPostComment)
		self.commentSlot.SetIMEFlag(0)
		self.commentSlot.SetPlaceHolderText("قم بكتابة الرسالة...")
		self.commentSlot.SetPackedFontColor(0xffa07970)
		self.commentSlot.Show()
		
		self.objPos = 0
		self.scrollbar.SetPos(0)
		self.LoadScroll()
	#~~~~~~~ 3 Page
	
	def authority_guildPage(self):
		textsAuthority = {1 : uiScriptLocale.SELECT_NAME,2 : uiScriptLocale.GUILD_RASA,3 : uiScriptLocale.GUILD_MEMBER_LEVEL, 4 : uiScriptLocale.GUILD_MEMBER_SPECIFIC_GRAVITY,5 : uiScriptLocale.GUILD_MEMBER_RANK,}
		self.players_Authority,u = {}, 0
		for i in xrange(5):
			self.players_Authority[i] = ui.TextLine()
			self.players_Authority[i].SetParent(self.GetChild("Authority_Info_3"))
			self.players_Authority[i].SetPosition(60+u,17)
			self.players_Authority[i].SetText(textsAuthority[i+1])
			self.players_Authority[i].SetFontColor(0.902, 0.816, 0.635)
			self.players_Authority[i].Show()
			if i == 0:
				u += 60
			elif i == 1 or i == 2:
				u += 45
			else:
				u+= 60
				
		self.scrollbarAuthority = ui.ScrollBarNewDesign()
		self.scrollbarAuthority.SetParent(self.GetChild("Authority_Info_2"))
		self.scrollbarAuthority.SetPosition(344,15)
		self.scrollbarAuthority.SetScrollBarSize(210)
		self.scrollbarAuthority.SetScrollEvent(self.__OnScroll2)
		# self.scrollbar.Show()
		
		self.objPos2 = 0
		self.scrollbarAuthority.SetPos(0)
		self.LoadScroll2()
		pass

	def LoadScroll2(self):
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		pos = self.objPos2
		if curMemberCount >= 5:
			self.obj_count2 = 5
			self.scrollbarAuthority.Show()
		else:
			self.obj_count2 = curMemberCount
			self.scrollbarAuthority.Hide()
		z=0

		self.players, u = {}, 0
		self.namesAuthority,self.imgs,self.levels,self.inverts,self.pos = {},{},{},{},{}

		for i in xrange(self.obj_count2):
			realPos = pos+i
			
			pid, name, grade, race, level, offer, general = guild.GetMemberData(realPos)

			if not name or name == "":
				break
				
			guildExperienceSummary = guild.GetGuildExperienceSummary()

			offerPercentage = 0
			if guildExperienceSummary > 0:
				offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0)
				
			self.players[i] = ui.ImageBox()
			self.players[i].SetParent(self.GetChild("Authority_Info_2"))
			self.players[i].SetPosition(25,20+u)
			self.players[i].LoadImage("d:/ymir work/interface/guild/dialog_member_slot.tga")
			self.players[i].Show()
			
			self.pos[i] = ui.NewComboBox()
			self.pos[i].SetParent(self.players[i])
			self.pos[i].SetPosition(218,3)
			self.pos[i].SetSize(90,23)
			self.pos[i].SetCurrentItem(guild.GetGradeName(grade))
			masterName = guild.GetGuildMasterName()
			mainCharacterName = player.GetMainCharacterName()
			if mainCharacterName == masterName:
				self.pos[i].Enable()
				self.pos[i].SetEvent(lambda gradeNumber, lineIndex=realPos, argSelf=proxy(self): argSelf.OnChangeMemberGrade(lineIndex, gradeNumber))
			self.pos[i].Show()
	
			self.pos[i].ClearItem()
			for e in xrange(14):
				self.pos[i].InsertItem(e+2, guild.GetGradeName(e+2))
				self.pos[i].SetCurrentItem(guild.GetGradeName(grade))

			self.namesAuthority[i] = ui.TextLine()
			self.namesAuthority[i].SetParent(self.players[i])
			self.namesAuthority[i].SetPosition(50,7)
			self.namesAuthority[i].SetText(name)
			self.namesAuthority[i].SetFontColor(0.902, 0.816, 0.635)
			self.namesAuthority[i].Show()
			
			self.imgs[i] = ui.ImageBox()
			self.imgs[i].SetParent(self.players[i])
			self.imgs[i].SetPosition(93,2)
			self.imgs[i].LoadImage(FACE_IMAGE_DICT[race])
			self.imgs[i].Show()
			
			self.levels[i] = ui.TextLine()
			self.levels[i].SetParent(self.players[i])
			self.levels[i].SetPosition(160,7)
			self.levels[i].SetText(str(level))
			self.levels[i].SetFontColor(0.424, 0.337, 0.329)
			self.levels[i].Show()
			
			self.inverts[i] = ui.TextLine()
			self.inverts[i].SetParent(self.players[i])
			self.inverts[i].SetPosition(195,7)
			self.inverts[i].SetText(str(offerPercentage)+"%")
			self.inverts[i].SetFontColor(0.424, 0.337, 0.329)
			self.inverts[i].Show()

			u+= 30
		
	def __OnScroll2(self):
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		self.objPos2 = self.scrollbarAuthority.GetPos() * (curMemberCount-6)
		self.LoadScroll2()
	
	def OnChangeMemberGrade(self, id, gradeNumber):
		PID = guild.MemberIndexToPID(id)
		net.SendGuildChangeMemberGradePacket(PID, gradeNumber)
		
		self.objPos2 = 0
		self.scrollbarAuthority.SetPos(0)
		self.LoadScroll2()
	
	def RefAuthMember(self):
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		if curMemberCount >= 5:
			self.obj_count2 = 5
		else:
			self.obj_count2 = curMemberCount
		pos = self.objPos2
		
		for i in xrange(self.obj_count2):
			realPos = pos+i
			pid, name, grade, race, level, offer, general = guild.GetMemberData(realPos)
			if not name or name == "":
				break
				
			guildExperienceSummary = guild.GetGuildExperienceSummary()

			offerPercentage = 0
			if guildExperienceSummary > 0:
				offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0)
			if self.inverts[i] != 0:
				self.inverts[i].SetText(str(offerPercentage)+"%")

			self.pos[i].SetCurrentItem(guild.GetGradeName(grade))
			
			if self.pos[int(realPos)].CheckOpen() == 1:
				self.open = 1
				for e in xrange(self.obj_count2):
					self.pos[e].Hide()
				self.pos[int(realPos)].Show()
				
	def skill_guildPage(self):
		self.skillPoints = self.GetChild("Skill_Plus_Value")
		self.energy = self.GetChild("Dragon_God_Power_Value")
		self.energyBar = self.GetChild("EnergyFull")
		self.donate_energy = self.GetChild("DonateEnergyButton")
		self.donate_energy.SetEvent(lambda : self.__OnOpenHealGSPBoard())
		
		
		
		self.backSlot = ui.GridSlotWindow()
		self.backSlot.SetParent(self.GetChild("Skill_Page"))
		self.backSlot.SetPosition(30-25,80)
		self.backSlot.ArrangeSlot(210, 6, 1, 40, 40,3,0)
		self.backSlot.SetSlotBaseImage("d:/ymir work/interface/slot/slot3.tga",1.0,1.0,1.0,1.0)
		self.backSlot.SetWindowHorizontalAlignCenter()
		self.backSlot.Show()
		
		self.activeSlot = ui.GridSlotWindow()
		self.activeSlot.SetParent(self.GetChild("Skill_Page"))
		self.activeSlot.SetPosition(34-25,84)
		self.activeSlot.ArrangeSlot(210, 6, 1, 40, 40,3,0)
		self.activeSlot.SetSlotBaseImage("d:/ymir work/ui/slot.tga",1.0,1.0,1.0,1.0)
		self.activeSlot.SetWindowHorizontalAlignCenter()
		self.activeSlot.Show()
		
		self.activeSlot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
		self.activeSlot.SetOverInItemEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OverInItem(slotNumber, type))
		self.activeSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
		self.activeSlot.SetSelectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnPickUpGuildSkill(slotNumber, type))
		self.activeSlot.SetUnselectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUseGuildSkill(slotNumber, type))
		self.activeSlot.SetPressedSlotButtonEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUpGuildSkill(slotNumber, type))
		self.activeSlot.AppendSlotButton("d:/ymir work/interface/button/char_buttons/plus_01_normal.tga",\
										"d:/ymir work/interface/button/char_buttons/plus_02_hover.tga",\
										"d:/ymir work/interface/button/char_buttons/plus_03_active.tga")


		## Active
		for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)):

			slotIndex = self.activeSlot.GetStartIndex()+i
			skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i]

			self.activeSlot.SetSkillSlot(slotIndex, skillIndex, 0)
			self.activeSlot.SetCoverButton(slotIndex)
			self.activeSlot.RefreshSlot()
			guild.SetSkillIndex(slotIndex, len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)+i)
	
	def RefreshGuildSkillPage(self):

		if 0 != 0:
			return

		# page = self.pageDict["MUSIC"]

		curPoint, maxPoint = guild.GetDragonPowerPoint()
		maxPoint = max(maxPoint, 1)
		self.energy.SetText("|cffa08784"+uiScriptLocale.CHARACTER_PSTATUS+ "|cfff8d090 "  +str(curPoint) + " / " + str(maxPoint))

		percentage = ( (float(curPoint / max(1, float(maxPoint))) * 100))
		self.energyBar.SetPercentage(curPoint,maxPoint)

		skillPoint = guild.GetGuildSkillPoint()
		self.skillPoints.SetText("|cffa08784"+uiScriptLocale.CHARACTER_PSTATUS + "|cfff8d090 " +str(skillPoint))

		# page.passiveSlot.HideAllSlotButton()
		self.activeSlot.HideAllSlotButton()

		## Active
		for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)):

			slotIndex = self.activeSlot.GetStartIndex()+i
			skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i]
			skillLevel = guild.GetSkillLevel(slotIndex)
			skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)

			self.activeSlot.SetSlotCount(slotIndex, skillLevel)

			if skillLevel <= 0:
				self.activeSlot.DisableCoverButton(slotIndex)
			else:
				self.activeSlot.EnableCoverButton(slotIndex)

			if skillPoint > 0:
				if skillLevel < skillMaxLevel:
					self.activeSlot.ShowSlotButton(slotIndex)
	
	def OnPickUpGuildSkill(self, skillSlotIndex, type):

		mouseController = mouseModule.mouseController

		if False == mouseController.isAttached():

			skillIndex = player.GetSkillIndex(skillSlotIndex)
			skillLevel = guild.GetSkillLevel(skillSlotIndex)

			if skill.CanUseSkill(skillIndex) and skillLevel > 0:

				if app.IsPressed(app.DIK_LCONTROL):

					player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, skillSlotIndex)
					return

				mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, skillSlotIndex, skillIndex)

		else:
			mouseController.DeattachObject()

	def OnUseGuildSkill(self, slotNumber, type):
		skillIndex = player.GetSkillIndex(slotNumber)
		skillLevel = guild.GetSkillLevel(slotNumber)

		if skillLevel <= 0:
			return

		player.UseGuildSkill(slotNumber)

	def OnUpGuildSkill(self, slotNumber, type):
		skillIndex = player.GetSkillIndex(slotNumber)
		net.SendChatPacket("/gskillup " + str(skillIndex))

	def OnUseSkill(self, slotNumber, coolTime):

		if 0 != 0:
			return
		# self.activeSlot = ui.GridSlotWindow()
		if self.activeSlot.HasSlot(slotNumber):
			self.activeSlot.SetSlotCoolTime(slotNumber, coolTime)

	def OverInItem(self, slotNumber, type):

		if mouseModule.mouseController.isAttached():
			return

		if None != self.tooltipSkill:
			skillIndex = player.GetSkillIndex(slotNumber)
			skillLevel = guild.GetSkillLevel(slotNumber)

			self.tooltipSkill.SetSkill(skillIndex, skillLevel)

	def OverOutItem(self):
		self.tooltipSkill.HideToolTip()
		self.tooltip_in = 0
		
	def SetSkillToolTip(self, tooltipSkill):
		self.tooltipSkill = tooltipSkill
	
	def __OnOpenHealGSPBoard(self):

		curPoint, maxPoint = guild.GetDragonPowerPoint()

		if maxPoint - curPoint <= 0:
			chat.AppendChat(1,localeInfo.GUILD_CANNOT_HEAL_GSP_ANYMORE)
			return

		pickDialog = uiPickMoney_Guild.PickMoneyDialog_Guild()
		pickDialog.LoadDialog()
		pickDialog.SetMax(9)
		pickDialog.SetTitleName(localeInfo.GUILD_HEAL_GSP)
		pickDialog.SetAcceptEvent(ui.__mem_func__(self.__OnOpenHealGSPQuestionDialog))
		pickDialog.Open(maxPoint - curPoint, 1)
		self.pickDialog = pickDialog

	def __OnOpenHealGSPQuestionDialog(self, healGSP):

		money = healGSP * constInfo.GUILD_MONEY_PER_GSP

		questionDialog = uiCommon.QuestionDialog()
		questionDialog.SetText(localeInfo.GUILD_DO_YOU_HEAL_GSP % (money, healGSP))
		questionDialog.SetAcceptEvent(ui.__mem_func__(self.__OnHealGSP))
		questionDialog.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog))
		questionDialog.SetWidth(400)
		questionDialog.Open()
		questionDialog.healGSP = healGSP
		self.questionDialog = questionDialog

	def __OnHealGSP(self):
		net.SendGuildChargeGSPPacket(self.questionDialog.healGSP)
		self.__OnCloseQuestionDialog()
		
	def __OnCloseQuestionDialog(self):
		if self.questionDialog:
			self.questionDialog.Close()
		self.questionDialog = None
	
	def grade_guildPage(self):
		
		textsGrade = {0 : "رقم.", 1 : uiScriptLocale.SELECT_NAME,2 : uiScriptLocale.GUILD_GRADE_PERMISSION_JOIN,3 : uiScriptLocale.GUILD_GRADE_PERMISSION_DELETE, 4 : uiScriptLocale.GUILD_GRADE_PERMISSION_NOTICE,5 : uiScriptLocale.GUILD_GRADE_PERMISSION_SKILL,}
		self.players_t,u = {}, 0
		for i in xrange(6):

			self.players_t[i] = ui.TextLine()
			self.players_t[i].SetParent(self.GetChild("Grade_Page"))
			self.players_t[i].SetPosition(30+u,17)
			self.players_t[i].SetText(textsGrade[i])
			self.players_t[i].SetFontColor(0.902, 0.816, 0.635)
			self.players_t[i].Show()
			if i == 0:
				u += 45
			elif i == 1:
				u += 65
			elif i == 2:
				u += 40
			elif i == 3:
				u+= 65
			else:
				u+= 45
			
		self.status11 = ui.NewBoard()
		self.status11.SetParent(self.GetChild("Grade_Page"))
		self.status11.SetSize(363,265)
		self.status11.SetPosition(0,33+12)
		self.status11.Show()

		self.scrollbarGrade = ui.ScrollBarNewDesign()
		self.scrollbarGrade.SetParent(self.status11)
		self.scrollbarGrade.SetPosition(342,15)
		self.scrollbarGrade.SetScrollBarSize(243)
		self.scrollbarGrade.SetScrollEvent(self.__OnScroll3)
		self.scrollbarGrade.Show()
		
		self.objPos3 = 0
		self.scrollbarGrade.SetPos(0)
		self.LoadScroll3()

	def RefGradeGuild(self):
		if 11 >= 9:
			self.obj_count3 = 9
		else:
			self.obj_count3 = 13
			
		pos = self.objPos3
		for i in xrange(1,self.obj_count3):
			realPos = pos+i
			name, authority = guild.GetGradeData(int(realPos))
			
			self.checkbox[i].SetCheck(authority & guild.AUTH_ADD_MEMBER)
			self.checkbox4[i].SetCheck(authority & guild.AUTH_SKILL)
			self.checkbox3[i].SetCheck(authority & guild.AUTH_NOTICE)
			self.checkbox2[i].SetCheck(authority & guild.AUTH_REMOVE_MEMBER)
			self.namesGrage[i].SetText(name)
	
	def LoadScroll3(self):
		total = 13
		
		pos = self.objPos3
		if total >= 9:
			self.obj_count3 = 9
		else:
			self.obj_count3 = total
		z=0
		
		self.img_rank, u = {}, 0
		self.idx = {}
		self.checkbox,self.checkbox2,self.checkbox3,self.checkbox4 = {},{},{},{}
		self.namesGrage = {}

		for i in xrange(1,self.obj_count3):
			realPos = pos+i
			
			name, authority = guild.GetGradeData(int(realPos))
			
			self.img_rank[i] = ui.ExpandedImageBox()
			self.img_rank[i].SetParent(self.status11)
			self.img_rank[i].SetPosition(20,12+u)
			self.img_rank[i].LoadImage("d:/ymir work/interface/guild/dialog_rank_slot.tga")
			self.img_rank[i].Show()
			
			self.idx[i] = ui.TextLine()
			self.idx[i].SetParent(self.img_rank[i])
			self.idx[i].SetPosition(10,6)
			self.idx[i].SetText(str(int(realPos))+".")
			self.idx[i].SetPackedFontColor(0xffcaa76f)
			self.idx[i].Show()
			
			self.namesGrage[i] = ui.EditableTextSlot(self.img_rank[i], 30, 2)
			self.namesGrage[i].SetEvent(ui.__mem_func__(self.OnOpenChangeGradeName), i)
			self.namesGrage[i].SetText(name)
			self.namesGrage[i].Show()

			event1 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<0: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			event2 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<1: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			event3 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<2: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			event4 = lambda argSelf=proxy(self), argIndex=int(realPos), argAuthority=1<<3: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
			self.checkbox[i] = ui.CheckBox(self.img_rank[i],122,3,event1)
			self.checkbox2[i] = ui.CheckBox(self.img_rank[i],173,3,event2)
			self.checkbox3[i] = ui.CheckBox(self.img_rank[i],225,3,event3)
			self.checkbox4[i] = ui.CheckBox(self.img_rank[i],275,3,event4)
			
			self.checkbox[i].SetCheck(authority & guild.AUTH_ADD_MEMBER)
			self.checkbox4[i].SetCheck(authority & guild.AUTH_SKILL)
			self.checkbox3[i].SetCheck(authority & guild.AUTH_NOTICE)
			self.checkbox2[i].SetCheck(authority & guild.AUTH_REMOVE_MEMBER)
			u += 30

	def __OnScroll3(self):
		self.objPos3 = self.scrollbarGrade.GetPos() * (14-10)
		self.LoadScroll3()
	
	def OnCheckAuthority(self, argIndex, argAuthority):
		name, authority = guild.GetGradeData(argIndex)
		net.SendGuildChangeGradeAuthorityPacket(argIndex, authority ^ argAuthority)

	def OnChangeGradeName(self, gradeNumber):
		if len(gradeName) == 0:
			gradeName = localeInfo.GUILD_DEFAULT_GRADE

		net.SendGuildChangeGradeNamePacket(gradeNumber, gradeName)
		return TRUE
		
	def OnOpenChangeGradeName(self, arg):
		self.cambiar = arg
		self.a = uiCommon.InputDialog()
		self.a.SetTitle("تغيير الرتبة")
		self.a.SetAcceptEvent(ui.__mem_func__(self.__OnchangeName))
		self.a.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog2))
		self.a.Open()
		
	def __OnchangeName(self):
		gradeName = self.a.GetText()
		if len(gradeName) == 0:
			gradeName = localeInfo.GUILD_DEFAULT_GRADE

		net.SendGuildChangeGradeNamePacket(self.cambiar, gradeName)
		self.__OnCloseQuestionDialog2()

	def __OnCloseQuestionDialog2(self):
		if self.a:
			self.a.Close()
		self.cambiar = None
		self.a = None
	
	def OnUpdate(self):
	#-1
		self.mark.SetIndex(net.GetGuildID())
		self.mark.SetScale(3.3)
		self.guild_level.SetText(str(guild.GetGuildLevel()))
		self.guild_name.SetText(guild.GetGuildName())
		self.guild_leader.SetText(player.GetName())
		curExp, lastExp = guild.GetGuildExperience()
		curExp *= 100
		lastExp *= 100
		total = curExp + lastExp
		self.exp_img.SetPercentage(curExp,total)
		self.curr_exp.SetText("EXP:   "+str(curExp)+ "       " +uiScriptLocale.CHARACTER_FROM +"       "+str(total))
		self.level_percent.SetText("%s %.2f%%" % ("", float(curExp) / max(1, float(total)) * 100))
	#-1
	#-2
		curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
		self.guild_members.SetText(str(curMemberCount)+" / "+str(maxMemberCount))
		self.guild_members_level.SetText(str(guild.GetGuildMemberLevelAverage()))
	#-2	
	#-4
	
		self.RefAuthMember()
	#-4
	#-5
		self.RefreshGuildSkillPage()
	#-5
	#-6
		self.RefGradeGuild()
		pass
		
	def Functie_glisare_max(self):
		latime = self.GetChild("board").GetWidth()
		latime2 = self.GetChild("TabButtonsBoard").GetWidth()
		if latime < 467+48+39:
			latime = latime+2
			latime2 = latime2+2
			self.SetSize(latime,300)
			self.GetChild("board").SetSize(latime,340+10)
			self.GetChild("TabButtonsBoard").SetSize(latime2,300+10)
			self.GetChild("Authority_TitleBar").SetWidth(latime-15)
			self.GetChild("Skill_TitleBar").SetWidth(latime-15)
			self.GetChild("Grade_TitleBar").SetWidth(latime-15)
			self.GetChild("Comment_TitleBar").SetWidth(latime-15)
			self.GetChild("Info_TitleBar").SetWidth(latime-15)
			self.GetChild("Expand").SetPosition(latime-15-70, 10)
			self.GetChild("Minimize").SetPosition(latime-15-70, 10)
			self.GetChild("TitleName").SetPosition(0, 12-172)
			self.glisare = WaitingDialog()
			self.glisare.Open(0.0)
			self.glisare.SAFE_SetTimeOverEvent(self.Functie_glisare_max)
		else:
			self.TabButton1.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton1.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton2.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton2.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton3.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton3.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton4.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton4.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton5.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			self.TabButton5.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			if info_guildPage == 1:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if comment_guildPage == 1:
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if authority_guildPage == 1:
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if skill_guildPage == 1:
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			if grade_guildPage == 1:
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
			else:
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
			self.Button1Text.Show()
			self.Button2Text.Show()
			self.Button3Text.Show()
			self.Button4Text.Show()
			self.Button5Text.Show()
			self.GetChild("Minimize").Show()
			self.GetChild("Expand").Hide()

	def Functie_glisare_min(self):
		latime = self.GetChild("board").GetWidth()
		latime2 = self.GetChild("TabButtonsBoard").GetWidth()
		self.TabButton1.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton1.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton2.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton2.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton3.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton3.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton4.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton4.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton5.SetOverVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.TabButton5.SetDownVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		if info_guildPage == 1:
			self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if comment_guildPage == 1:
			self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if authority_guildPage == 1:
			self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if skill_guildPage == 1:
			self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if grade_guildPage == 1:
			self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		else:
			self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		self.Button1Text.Hide()
		self.Button2Text.Hide()
		self.Button3Text.Hide()
		self.Button4Text.Hide()
		self.Button5Text.Hide()
		if latime>340+47+39:
			latime = latime-2
			latime2 = latime2-2
			self.SetSize(latime,300)
			self.GetChild("board").SetSize(latime,340+10)
			self.GetChild("TabButtonsBoard").SetSize(latime2,300+10)
			self.GetChild("Authority_TitleBar").SetWidth(latime-15)
			self.GetChild("Skill_TitleBar").SetWidth(latime-15)
			self.GetChild("Grade_TitleBar").SetWidth(latime-15)
			self.GetChild("Comment_TitleBar").SetWidth(latime-15)
			self.GetChild("Info_TitleBar").SetWidth(latime-15)
			self.GetChild("Expand").SetPosition(latime-15-70, 10)
			self.GetChild("Minimize").SetPosition(latime-15-70, 10)
			self.GetChild("TitleName").SetPosition(0, 12-172)
			self.glisare = WaitingDialog()
			self.glisare.Open(0.0)
			self.glisare.SAFE_SetTimeOverEvent(self.Functie_glisare_min)
		else:
			self.GetChild("Expand").Show()
			self.GetChild("Minimize").Hide()
			

	def __BindEvent(self):
		
		for (tabKey, tabButton) in self.tabButtonDict.items():
			tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey)
			
		for titleBarValue in self.titleBarDict.itervalues():
			titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))

	def __LoadWindow(self):
		if self.isLoaded == 1:
			return

		self.isLoaded = 1

		try:
			if localeInfo.IsARABIC() or localeInfo.IsVIETNAM() or localeInfo.IsJAPAN():
				self.__LoadScript("uiscript/GuildWindow.py")
			else:
				self.__LoadScript("uiscript/GuildWindow.py")
				
			self.__BindObject()
			self.__BindEvent()
		except:
			import exception
			exception.Abort("OptionWindow.__LoadWindow")

		self.SetState("INFO_GUILD")
		

	def Destroy(self):
		self.ClearDictionary()
		self.__Initialize()

	def Close(self):
		self.Hide()

	def __OnClickTabButton(self, stateKey):
		global info_guildPage,comment_guildPage,authority_guildPage,skill_guildPage,grade_guildPage
		latime = self.GetWidth()
		if stateKey == "INFO_GUILD":
			info_guildPage = 1
			comment_guildPage = 0
			authority_guildPage = 0
			skill_guildPage = 0
			grade_guildPage = 0
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "COMMENT_PAGE":

			info_guildPage = 0
			comment_guildPage = 1
			authority_guildPage = 0
			skill_guildPage = 0
			grade_guildPage = 0
			if latime == 468+48+39:
				net.SendGuildRefreshCommentsPacket(0)
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "AUTHORITY_PAGE":
			info_guildPage = 0
			comment_guildPage = 0
			authority_guildPage = 1
			skill_guildPage = 0
			grade_guildPage = 0
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "SKILL_PAGE":
			info_guildPage = 0
			comment_guildPage = 0
			authority_guildPage = 0
			skill_guildPage = 1
			grade_guildPage = 0
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText(uiScriptLocale.GUILD_PAGE_5)
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
		if stateKey == "GRADE_PAGE":
			info_guildPage = 0
			comment_guildPage = 0
			authority_guildPage = 0
			skill_guildPage = 0
			grade_guildPage = 1
			if latime == 468+48+39:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_big_a.tga")
				self.Button1Text.SetText(uiScriptLocale.GUILD_PAGE_1)
				self.Button2Text.SetText(uiScriptLocale.GUILD_PAGE_2)
				self.Button3Text.SetText(uiScriptLocale.GUILD_PAGE_3)
				self.Button4Text.SetText(uiScriptLocale.GUILD_PAGE_4)
				self.Button5Text.SetText("|cfff8d090"+uiScriptLocale.GUILD_PAGE_5)
				
			else:
				self.TabButton1.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton2.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton3.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton4.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_n.tga")
				self.TabButton5.SetUpVisual("d:/ymir work/interface/expand_system/chrbutton_small_a.tga")
		self.SetState(stateKey)

	def SetState(self, stateKey):
		self.state = stateKey

		if constInfo.ENABLE_FIX_CHARACTER_PAGE:		
			if stateKey == NAME_CLASS_I:
				self.OnRefreshComments()

		for (tabKey, tabButton) in self.tabButtonDict.items():
			if stateKey!=tabKey:
				tabButton.SetUp()

		for pageValue in self.pageDict.itervalues():
			pageValue.Hide()

		for titleBarValue in self.titleBarDict.itervalues():
			titleBarValue.Hide()

		self.titleBarDict[stateKey].Show()
		self.pageDict[stateKey].Show()
		
	def __GetGuildBoardCommentData(self, index):
		commentID, chrName, comment = guild.GetGuildBoardCommentData(index)
		if 0==commentID:
			if ""==chrName:
				chrName=localeInfo.UI_NONAME
			if ""==comment:
				comment=localeInfo.UI_NOCONTENTS

		return commentID, chrName, comment
		
	def OnPostComment(self):
		text = self.commentSlot.GetText()
		if not text:
			return FALSE
		if not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE):
			chat.AppendChat(1,localeInfo.GUILD_NO_NOTICE_PERMISSION)
			return

		net.SendGuildPostCommentPacket(text[:50])
		self.commentSlot.SetText("")
		self.objPos = 0
		self.scrollbar.SetPos(0)
		self.LoadScroll()
		return TRUE

	def OnDeleteComment(self, index):
		commentID, chrName, comment = self.__GetGuildBoardCommentData(index)
		net.SendGuildDeleteCommentPacket(commentID)
		self.LoadScroll()

	def OnRefreshComments(self):
		net.SendGuildRefreshCommentsPacket(0)

	def __OnScroll(self):
		self.OnRefreshComments()
		self.objPos = self.scrollbar.GetPos() * (guild.GetGuildBoardCommentCount()-6)
		self.LoadScroll()
	
	
	def LoadScroll(self):
		net.SendGuildRefreshCommentsPacket(0)
		pos = self.objPos
		if guild.GetGuildBoardCommentCount() >= 6:
			self.obj_count = 6
			self.scrollbar.Show()
		else:
			self.obj_count = guild.GetGuildBoardCommentCount()
			self.scrollbar.Hide()
		
		self.delete,self.important, self.spaces,self.namesCommand,self.comments, u = {},{},{},{},{}, 0

		for i in xrange(self.obj_count):
			realPos = pos+i
	
			commentID, chrName, comment = self.__GetGuildBoardCommentData(realPos)
			if chrName == "Noname":
				break
				
			self.spaces[i] = ui.ImageBox()
			self.spaces[i].SetParent(self.GetChild("Comment_GuildPage"))
			self.spaces[i].SetPosition(20,20+u)
			self.spaces[i].LoadImage("d:/ymir work/interface/guild/dialog_message_slot.tga")
			self.spaces[i].Show()

			self.namesCommand[i] = ui.TextLine()
			self.namesCommand[i].SetParent(self.spaces[i])
			self.namesCommand[i].SetPosition(50,8)
			self.namesCommand[i].SetText(chrName)
			self.namesCommand[i].SetPackedFontColor(0xffcaa76f)
			self.namesCommand[i].Show()
			
			self.important[i] = ui.ImageBox()
			self.important[i].SetParent(self.spaces[i])
			self.important[i].SetPosition(87,8)
			self.important[i].LoadImage("d:/ymir work/interface/guild/dialog_message_importantmsg.tga")
		
			self.comments[i] = ui.TextLine()
			self.comments[i].SetParent(self.spaces[i])
			self.comments[i].SetPosition(310,8)
			if "!" == comment[0]:
				self.comments[i].SetText(comment[1:])
				self.comments[i].SetPackedFontColor(0xffdb9b93)
				self.important[i].Show()
			else:
				self.comments[i].SetText(comment)
				self.comments[i].SetPackedFontColor(0xffa08784)
				
			self.comments[i].Show()
			
			masterName = guild.GetGuildMasterName()
			mainCharacterName = player.GetMainCharacterName()
			
			if mainCharacterName == chrName or (masterName == mainCharacterName):
				self.delete[i] = ui.Button()
				self.delete[i].SetParent(self.spaces[i])
				self.delete[i].SetPosition(305,7)
				self.delete[i].SetUpVisual("d:/ymir work/interface/guild/close_mini_01_normal.tga")
				self.delete[i].SetOverVisual("d:/ymir work/interface/guild/close_mini_02_hover.tga")
				self.delete[i].SetDownVisual("d:/ymir work/interface/guild/close_mini_03_active.tga")
				self.delete[i].SetEvent(lambda x = realPos: self.OnDeleteComment(x))
				self.delete[i].Show()
		
			u += 35
	

	def GetState(self):
		return self.state
		
	def OnPressExitKey(self):
		self.Close()
		return TRUE
	
	def OnPressEscapeKey(self):
		self.Close()
		return TRUE


class WaitingDialog(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventTimeOver = lambda *arg: None
		self.eventExit = lambda *arg: None

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

	def Open(self, waitTime):
		import time
		curTime = time.clock()
		self.endTime = curTime + waitTime

		self.Show()		

	def Close(self):
		self.Hide()

	def Destroy(self):
		self.Hide()

	def SAFE_SetTimeOverEvent(self, event):
		self.eventTimeOver = ui.__mem_func__(event)

	def SAFE_SetExitEvent(self, event):
		self.eventExit = ui.__mem_func__(event)
		
	def OnUpdate(self):
		import time
		lastTime = max(0, self.endTime - time.clock())
		if 0 == lastTime:
			self.Close()
			self.eventTimeOver()
		else:
			return
	def OnPressEscapeKey(self):
		self.Close()
		return TRUE
		
	def OnPressExitKey(self):
		self.Close()
		return TRUE

 


Hey, imho it is this self.pos = ui.NewComboBox() class.
Open your ui.py, look for the class NewComboBox() and set the position there.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.