Jump to content

Domniq

Premium
  • Posts

    136
  • Joined

  • Last visited

  • Days Won

    7
  • Feedback

    0%

Posts posted by Domniq

  1. Hey, nice release. Glad you share it with us ?

    Here's small improvement for bool CItem::IsMythDragonSoul()

    bool CItem::IsMythDragonSoul()
    {
    	return ((GetVnum() > 115000 && GetVnum() <= 115099)
    		|| (GetVnum() > 115100 && GetVnum() <= 115199)
    		|| (GetVnum() > 115200 && GetVnum() <= 115299)
    		|| (GetVnum() > 115300 && GetVnum() <= 115399)
    		|| (GetVnum() > 115400 && GetVnum() <= 115499)
    		|| (GetVnum() > 125000 && GetVnum() <= 125099)
    		|| (GetVnum() > 125100 && GetVnum() <= 125199)
    		|| (GetVnum() > 125200 && GetVnum() <= 125299)
    		|| (GetVnum() > 125300 && GetVnum() <= 125399)
    		|| (GetVnum() > 125400 && GetVnum() <= 125499)
    		|| (GetVnum() > 135000 && GetVnum() <= 135099)
    		|| (GetVnum() > 135100 && GetVnum() <= 135199)
    		|| (GetVnum() > 135200 && GetVnum() <= 135299)
    		|| (GetVnum() > 135300 && GetVnum() <= 135399)
    		|| (GetVnum() > 135400 && GetVnum() <= 135499)
    		|| (GetVnum() > 145000 && GetVnum() <= 145099)
    		|| (GetVnum() > 145100 && GetVnum() <= 145199)
    		|| (GetVnum() > 145200 && GetVnum() <= 145299)
    		|| (GetVnum() > 145300 && GetVnum() <= 145399)
    		|| (GetVnum() > 145400 && GetVnum() <= 145499)
    		|| (GetVnum() > 155000 && GetVnum() <= 155099)
    		|| (GetVnum() > 155100 && GetVnum() <= 155199)
    		|| (GetVnum() > 155200 && GetVnum() <= 155299)
    		|| (GetVnum() > 155300 && GetVnum() <= 155399)
    		|| (GetVnum() > 155400 && GetVnum() <= 155499)
    		|| (GetVnum() > 165000 && GetVnum() <= 165099)
    		|| (GetVnum() > 165100 && GetVnum() <= 165199)
    		|| (GetVnum() > 165200 && GetVnum() <= 165299)
    		|| (GetVnum() > 165300 && GetVnum() <= 165399)
    		|| (GetVnum() > 165400 && GetVnum() <= 165499)
    	);
    }

    replace with this

    bool CItem::IsMythDragonSoul()
    {
    	bool bMyth = ((GetVnum() / 1000) % 10) == 5 ? true : false;
    	return bMyth;
    }

     

    • Love 1
  2. There you go

    //char_battle.cpp find
    	if (GetHP() <= 0)
    	{
    // replace Stun(); or comment it and add bellow
    		if (!IsDead())
    		{
    			if (!IsPC() && m_pkParty)
    			{
    				m_pkParty->SendMessage(this, PM_ATTACKED_BY, 0, 0);
    			}
    
    			sys_log(1, "%s: Stun %p", GetName(), this);
    
    			PointChange(POINT_HP_RECOVERY, -GetPoint(POINT_HP_RECOVERY));
    			PointChange(POINT_SP_RECOVERY, -GetPoint(POINT_SP_RECOVERY));
    
    			CloseMyShop();
    
    			event_cancel(&m_pkRecoveryEvent); // ȸşą ŔĚşĄĆ®¸¦ Á×ŔδŮ.
    
    			SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_STUN);
    
    			if (!m_pkStunEvent)
    			{
    				char_event_info* info = AllocEventInfo<char_event_info>();
    				info->ch = this;
    
    				m_pkStunEvent = event_create(StunEvent, info, PASSES_PER_SEC(0));
    			}
    		}

    #edit2

    • Love 1
  3. That's my way I did year ago, same ingame output as gf

    There are 2 additional images covering the button so you can just disable "mouse over" for this elements (3 lines of code instead of creating functions etc.)B)

            for i in xrange(len(self.NameList)):
                self.SelectBtnFaceList[i].AddFlag("not_pick")
                self.SelectBtnNameList[i].AddFlag("not_pick")

     

  4. #add in localeinfo.py
    def NumberToString(n) :
    	if n <= 0 :
    		return "0"
    
    	return ('.'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]))
    self.GetChild("Exp_Value").SetText(localeInfo.NumberToString(str(unsigned32(player.GetEXP()))))

     

    • Love 1
  5. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Heya, as title says it's party dice system self written (without CHAT_TYPE_DICE_INFO, it's up to you)

    https://metin2.download/picture/C4ti9F2CYsYFODoIKlh3B9Ipin0XDARX/.gifv (sry for laggs - "wooden pc" ^^)

    You can test possibility of same score there: https://repl.it/@Nevisor/Dice-FORINFOR

     

    char_battle.cpp

    //find
    					if (ch->GetParty())
    						ch = ch->GetParty()->GetNextOwnership(ch, GetX(), GetY());
    //replace with
    					if (ch->GetParty())
    					{
    						ch = ch->GetParty()->GetNextOwnership(ch, GetX(), GetY());
    
    #ifdef __ENABLE_DICE_SYSTEM__
    						ch = ch->GetParty()->Dice(ch, GetX(), GetY(), item->GetName());
    #endif
    					}

    party.cpp

    //at the end of file add
    #ifdef __ENABLE_DICE_SYSTEM__
    LPCHARACTER CParty::Dice(LPCHARACTER ch, long x, long y, const char * szName) //item name
    {
    	for (TMemberMap::iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it)
    	{
    		if (it->second.pCharacter->GetDesc() && DISTANCE_APPROX(it->second.pCharacter->GetX() - x, it->second.pCharacter->GetY() - y) < PARTY_DEFAULT_RANGE)
    		{
    			ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffffe6ba*** Rolling for the following item: %s ***", szName);
    
    			while (1)
    			{
    				LPCHARACTER pkWinner;
    				int iDice = 0;
    				int iDraw = 0;
    
    				for (TMemberMap::iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it)
    					if (it->second.pCharacter->GetDesc() && DISTANCE_APPROX(it->second.pCharacter->GetX() - x, it->second.pCharacter->GetY() - y) < PARTY_DEFAULT_RANGE)
    					{
    						int iScore = number(1, 10000);
    
    						if (iScore == iDice)
    							iDraw == iScore;
    						else if (iDice == 0 || iScore > iDice)
    						{
    							pkWinner = it->second.pCharacter;
    							iDice = iScore;
    						}
    
    						ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffffe6ba*** ->\t\t\t\t\t%s - Dice score: %d ***", it->second.pCharacter->GetName(), iScore);
    					}
    
    				if (iDice != iDraw)
    				{	
    					ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffbb00ff*** Winner of the item %s is: %s ***", szName, pkWinner->GetName());
    					return pkWinner;
    				}
    				else 
    				{
    					ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "");
    					ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffffe6ba*** Rolling again for the following item: %s ***", szName);
    				}
    			}
    		}
    	}
    
    	return ch;
    }
    #endif

    party.h

    //find
    		void		P2PSetMemberLevel(DWORD pid, BYTE level);
    //or
    		bool		IsPartyInDungeon(int mapIndex);
    //add bellow
    #ifdef __ENABLE_DICE_SYSTEM__
    		LPCHARACTER	Dice(LPCHARACTER ch, long x, long y, const char * szName);
    #endif

    length.h

    enum EChatType
    {
    	CHAT_TYPE_TALKING,	/* 그냥 채팅 */
    	CHAT_TYPE_INFO,	/* 정보 (아이템을 집었다, 경험치를 얻었다. 등) */
    	CHAT_TYPE_NOTICE,	/* 공지사항 */
    	CHAT_TYPE_PARTY,	/* 파티말 */
    	CHAT_TYPE_GUILD,	/* 길드말 */
    	CHAT_TYPE_COMMAND,	/* 일반 명령 */
    	CHAT_TYPE_SHOUT,	/* 외치기 */
    	CHAT_TYPE_WHISPER,
    	CHAT_TYPE_BIG_NOTICE,
    	CHAT_TYPE_MONARCH_NOTICE,
    #ifdef __ENABLE_DICE_SYSTEM__
    	CHAT_TYPE_DICE_INFO,
    #endif
    	CHAT_TYPE_MAX_NUM
    };

     

    • Metin2 Dev 26
    • Think 1
    • Confused 1
    • Good 4
    • Love 3
    • Love 21
  6. Dnia 4.01.2018 o 23:50, Dimitar napisał:

    Hi, please, everything is Ok but i cant see tooltip at top of item in new drop dialog. I use unedited nevisor's class, can anyone help me? I think problem is there:

    
    		for i in xrange(min(3, ySlotCount)):
    			self.slotList[i].SetPosition(0, 30 + ySlotCount*32 - i*32)
    			if vnum != 1:
    				self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(arg) ####HEREEEEE
    				self.slotList[i].OnMouseOverOut = lambda arg = self.tooltipItem: self.OverOutItem(arg)
    			else:
    				self.slotList[i].OnMouseOverIn = lambda arg = localeInfo.MONETARY_UNIT0: self.OverInToolTip(arg)
    				self.slotList[i].OnMouseOverOut = lambda: self.OverOutToolTip()
    			self.slotList[i].Show()

    I tried edit it to:

    
    self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(vnum)

    But it still dont work, sysser is clear and tooltip works with yangs.

    Thanks

     

    Dnia 10.12.2017 o 22:04, Nevisor napisał:

    itemQuestionDialog.window_type = "inv" #for inventory

    itemQuestionDialog.window_type = "shop" #for shops

     

  7. M2 Download Center

    This is the hidden content, please
    ( Internal )

    https://metin2.download/picture/kUj102rSyOr1IH9fsQwNY3zH8FO2DrIL/.gifv

    uiCommon.py

    class ItemQuestionDialog(ui.ScriptWindow):
    	def __init__(self):
    		ui.ScriptWindow.__init__(self)
    		self.__CreateDialog()
    		
    		self.tooltipItem = uiToolTip.ItemToolTip()
    		self.toolTip = uiToolTip.ToolTip()
    		
    		self.window_type = 0
    		self.count = 0
    	
    		self.dropType = 0
    		self.dropCount = 0
    		self.dropNumber = 0
    
    	def __del__(self):
    		ui.ScriptWindow.__del__(self)
    
    	def __CreateDialog(self):
    		pyScrLoader = ui.PythonScriptLoader()
    		pyScrLoader.LoadScriptFile(self, "QuestionDialog.py")
    
    		self.board = self.GetChild("board")
    		self.textLine = self.GetChild("message")
    		self.acceptButton = self.GetChild("accept")
    		self.cancelButton = self.GetChild("cancel")
    
    		self.titleBar = ui.TitleBar()
    		self.titleBar.SetParent(self.board)
    		self.titleBar.MakeTitleBar(244, "yellow")
    		self.titleBar.SetPosition(8, 7)
    		self.titleBar.Show()
    
    		self.titleName = ui.TextLine()
    		self.titleName.SetParent(self.titleBar)
    		self.titleName.SetPosition(0, 4)
    		self.titleName.SetWindowHorizontalAlignCenter()
    		self.titleName.SetHorizontalAlignCenter()
    		self.titleName.Show()
    
    		self.slotList = []
    		for i in xrange(3):
    			slot = ui.ImageBox()
    			slot.LoadImage("d:/ymir work/ui/public/slot_base.sub")
    			slot.SetParent(self)
    			slot.SetWindowHorizontalAlignCenter()
    			self.slotList.append(slot)
    
    	def Open(self, vnum, slot = None, price = None):
    		item.SelectItem(vnum)
    		xSlotCount, ySlotCount = item.GetItemSize()
    
    		try:
    			if self.window_type == "inv":
    				metinSlot = [player.GetItemMetinSocket(player.INVENTORY, slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
    			elif self.window_type == "shop":
    				metinSlot = [shop.GetItemMetinSocket(slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
    		except:
    			pass
    
    		if vnum in (50300, 70037):
    			self.titleName.SetText("%s %s" % (skill.GetSkillName(metinSlot[0]), item.GetItemName()))
    		elif vnum == 70104:
    			self.titleName.SetText("%s %s" % (nonplayer.GetMonsterName(metinSlot[0]), item.GetItemName()))
    		else:
    			self.titleName.SetText(item.GetItemName())
    
    		newHeight = 0	
    			
    		if price:
    			newHeight = 20
    		
    			itemPrice = ui.TextLine()
    			itemPrice.SetPosition(0, 77 + 32*ySlotCount)
    			itemPrice.SetWindowHorizontalAlignCenter()
    			itemPrice.SetHorizontalAlignCenter()
    			itemPrice.SetVerticalAlignCenter()
    			itemPrice.SetParent(self.board)
    			if str(price).isdigit():
    				itemPrice.SetText(localeInfo.NumberToMoneyString(price))
    			else:
    				itemPrice.SetText(price)
    			itemPrice.Show()
    			self.itemPrice = itemPrice
    
    		slotGrid = ui.SlotWindow()
    		slotGrid.SetParent(self)
    		slotGrid.SetPosition(-16, 62)
    		slotGrid.SetWindowHorizontalAlignCenter()
    		slotGrid.AppendSlot(0, 0, 0, 32*xSlotCount, 32*ySlotCount)
    		slotGrid.AddFlag("not_pick")
    		slotGrid.Show()
    		self.slotGrid = slotGrid
    
    		if self.count > 1 and vnum != 1:
    			self.slotGrid.SetItemSlot(0, vnum, self.count)
    		else:
    			self.slotGrid.SetItemSlot(0, vnum)
    				
    		self.SetSize(260, 110 + 32*ySlotCount + newHeight)
    		self.board.SetSize(260, 110 + 32*ySlotCount + newHeight)
    		self.textLine.SetPosition(0, 44)
    
    		for i in xrange(min(3, ySlotCount)):
    			self.slotList[i].SetPosition(0, 30 + ySlotCount*32 - i*32)
    			if vnum != 1:
    				self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(arg)
    				self.slotList[i].OnMouseOverOut = lambda arg = self.tooltipItem: self.OverOutItem(arg)
    			else:
    				self.slotList[i].OnMouseOverIn = lambda arg = localeInfo.MONETARY_UNIT0: self.OverInToolTip(arg)
    				self.slotList[i].OnMouseOverOut = lambda: self.OverOutToolTip()
    			self.slotList[i].Show()
    
    		self.GetChild("accept").SetPosition(-40, 74 + 32*ySlotCount + newHeight)
    		self.GetChild("cancel").SetPosition(40, 74 + 32*ySlotCount + newHeight)
    
    		self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
    		
    		self.SetCenterPosition()
    		self.SetTop()
    		self.Show()
    
    	def SetCloseEvent(self, event):
    		self.titleBar.SetCloseEvent(event)
    		
    	def SetMessage(self, text):
    		self.textLine.SetText(text)
    
    	def OverInToolTip(self, arg):
    		self.toolTip.ClearToolTip()
    		self.toolTip.AppendTextLine(arg, 0xffffff00)
    		self.toolTip.Show()
    	
    	def OverOutToolTip(self):
    		self.toolTip.Hide()
    		
    	def OverInItem(self, slot):
    		if self.window_type == "shop":
    			self.tooltipItem.SetShopItem(slot)
    		elif self.window_type == "inv":
    			self.tooltipItem.SetInventoryItem(slot)
    		
    	def OverOutItem(self, tooltipItem):
    		if None != tooltipItem:
    			self.tooltipItem.HideToolTip()
    			self.tooltipItem.ClearToolTip()
    	
    	def Close(self):
    		self.ClearDictionary()
    		self.slotList = []
    		self.titleBar = None
    		self.titleName = None
    		self.itemPrice = None
    		self.slotGrid = None
    		
    		self.toolTip = None
    		self.tooltipItem = None
    		self.Hide()
    		
    		constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
    		
    	def SetWidth(self, width):
    		height = self.GetHeight()
    		self.SetSize(width, height)
    		self.board.SetSize(width, height)
    		self.SetCenterPosition()
    		self.UpdateRect()
    
    	def SAFE_SetAcceptEvent(self, event):
    		self.acceptButton.SAFE_SetEvent(event)
    
    	def SAFE_SetCancelEvent(self, event):
    		self.cancelButton.SAFE_SetEvent(event)
    
    	def SetAcceptEvent(self, event):
    		self.acceptButton.SetEvent(event)
    
    	def SetCancelEvent(self, event):
    		self.cancelButton.SetEvent(event)
    
    	def SetText(self, text):
    		self.textLine.SetText(text)
    
    	def SetAcceptText(self, text):
    		self.acceptButton.SetText(text)
    
    	def SetCancelText(self, text):
    		self.cancelButton.SetText(text)
    
    	def OnPressEscapeKey(self):
    		self.Close()
    		
    		return True

    add imports

    import constInfo
    import skill
    import nonplayer

     

    This is just a class, now you just have to call it

    itemQuestionDialog = uiCommon.ItemQuestionDialog()
    
    itemQuestionDialog.window_type = "inv" #for inventory
    itemQuestionDialog.window_type = "shop" #for shops
    
    itemQuestionDialog.count = ...
    
    drop 		MONEY 		itemQuestionDialog.Open(1, "", attachedMoney)
    drop 		ITEM		itemQuestionDialog.Open(itemVNum, slotNumber)
    buy&sell 	ITEM		itemQuestionDialog.Open(itemVNum, slotNumber, price)
    Spoiler

    I wont help with further implementation, it's your task to do ^^

     

    • Metin2 Dev 20
    • Eyes 1
    • Good 4
    • Love 1
    • Love 22
  8. 8 godzin temu, thespeedy napisał:

    How-To translate Client in German?

    As example use locale/en/:

    In pack/index add

    locale/de/
    locale

    Replace in locale.cfg 'en' to 'de'

    Replace item_proto & mob_proto with yours

    Replace .txt files in locale/en/ with official gf server EXCEPT: atlasinfo.txt, item_list.txt and guildbuildinglist.txt

    Replace .dds, .tga, .jpg files in locale/en/ui/ with official gf server

    Rename folder from 'en' to 'de'

    • Love 1
×
×
  • 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.