[Python] Features tooltip on objects

01/11/2017 03:05 VegaS ♆#1
Gallery photo:
[Only registered and activated users can see links. Click Here To Register...]

For who want to see how it works code:​
Code:
#root/uiToolTip.py
#1.) Search for:
	def __SetSpecialItemTitle(self):
		self.AppendTextLine(item.GetItemName(), self.SPECIAL_TITLE_COLOR)
#2.) Add after:		
	def __SetFeaturesToolTip(self, itemVnum):
		######################################################
		# title_name        : Features tooltip on objects
		# date_created      : 2017.01.11
		# author            : VegaS

		image = ui.ImageBox()
		image.SetParent(self)
		image.Show()			

		self.main = {
			"vnums" : [
				140, 150, 3130, 270, 12010, 12020, 12030, 12040, 480, 460, 470, 5120, 7120, 20250, 20750, 20000, 180, 190]
		}
		######################################################################################################
		# Example: vnums[480] = 480, 481, 482, 483, 484, 485, 486, 487, 488, 489 Put more items (need only first index from +0, and automatically will be increment from +0 to +9.)
					
		for k in xrange(10):
			for v in xrange(len(self.main["vnums"])):
				tokens, index, iterator = self.main["vnums"][v], str(itemVnum)[-1:], str(k)

				if ((tokens <= itemVnum and itemVnum <= tokens + 9) and (index == iterator)):
					image.LoadImage("icon/item/features_tooltip/%d.tga" % (k))

					image.SetPosition(self.toolTipWidth/2 - 75, self.toolTipHeight)
					self.toolTipHeight += 18
					self.childrenList.append(image)
					self.ResizeToolTip()

#1.) Search in def AddItemData(.......)
		self.__AdjustMaxWidth(attrSlot, itemDesc)
		self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
#2.) Add after:
		self.__SetFeaturesToolTip(itemVnum)
01/11/2017 06:25 Nadellia#2
I think, the two is good, type of equipement and with vnum.

Like this is, if you want only put this for special equipement (like difficult for up to +9), you can make difference color for the stars.

The release look nice, and is a good idea ;)
01/11/2017 06:28 VegaS ♆#3
Quote:
Originally Posted by Exygo View Post
Hey, you can actually make it with type condition for equipment only instead of inserting them in list, and get only the last digit of the vnum
Welcome on epvp
____________________________________
I write this as request of one guy from skype and i made via teamviewer on him pc in some minutes, i not spend my time to do the best method for one release, but code works ok and nothing "is so bad", be happy is for free, because some people try to sell things like this shit for money, and also i not request your money for that, is a simple release, you not need to say 'Hey noob' because you not like method or release, exist button exit and leave this page.

When a release is posted free is not importantly method what you used If them do same.
In programming exist a lot a method for make one thing, so you not need to be sad about that, go to sleep and all is done.

I not will continue with this circle, have fun.
01/11/2017 10:48 GrünesUniversum#4
Dont work :/
01/11/2017 15:09 VegaS ♆#5
Quote:
Originally Posted by Exygo View Post
And why would you do this :
[Only registered and activated users can see links. Click Here To Register...]

on every item's tooltip LOL ?
I write this as request of one guy from skype and i made via teamviewer on him pc in some minutes, i not spend my time to do the best method for one release, but code works ok and nothing "is so bad", be happy is for free, because some people try to sell things like this shit for money, and also i not request your money for that, is a simple release, you not need to say 'Hey noob' because you not like method or release, exist button exit and leave this page.

This is him server and him client, and he added rest of vnums in list not me, because i not tested nothing on my pc because my dedicated server is offline since 5 days. ^^

Quote:
Originally Posted by Exygo View Post
And the final code:
Code:
	# Exygo append item quality
	def AppendItemQualityRate(self, vnum):
		itemType = item.GetItemType()

		if itemType in (item.ITEM_TYPE_WEAPON,item.ITEM_TYPE_ARMOR):
			max_quality = 9 # +9

			# window
			xPosStep = 0
			yPosStep = self.toolTipHeight

			# stars
			xPos = 0

			window = ui.MakeWindow(self,xPosStep,yPosStep,17*max_quality,17)
			window.SetWindowHorizontalAlignCenter()

			for n in xrange(max_quality):
				if n < int(str(vnum)[-1:]):
					image = ui.MakeImageBox(window,"exygo/icon/stars/1.tga",xPos,0)
				else:
					image = ui.MakeImageBox(window,"exygo/icon/stars/0.tga",xPos,0)
				xPos += 17
				self.childrenList.append(image)

			self.childrenList.append(window)

			self.toolTipHeight += self.TEXT_LINE_HEIGHT
			self.ResizeToolTip()
Ohh br0..
  • You can test execution timer and you will get a rekt alone.
    If you not understand how it works code and what he do, no try to speak about that.
    Your method is a best of shit what i see in my life.
    Stop to kill python again.
I could easily do what you want to say, but it sucks.

This feature has no charm if for all items.
This feature is only for some special items to be highlighted more than their value, it is a matter of design something that helps players way because players can see the extent of the item in the name of that item.
So this is the method to be used by any server.

With my code they can add what theywant.
Example, you need only to add the first element from vnum what you want to start stars and automatically will up by range vnum min/max, you need only to declare the first element (that means min) and will be up to max.
I did this because the guy for what i make he not was want for all items or special category, he was want only for specials items from list (items what can be evolution), and as i say you can put in list for bracelet, index: [14205], and automatically will be work only for [14205 -> 14209] and will show you corectly stars.

Ok now i will explain you how it works this code.

Code:
for k in xrange(player.MAX_REFINE_VNUM + 1): # Make a loop from +MIN to +MAX.
for v in xrange(len(vnums)): # Returns the number of elements(vnums) in the list.

tokens = vnums[v] # Get the index vnum from list. 
var = str(itemVnum)[-1:] # Get last digit from vnum [MIN - MAX] and convert in string.
it = str(k) # Convert iterator k [MIN - MAX] in string.
(tokens <= itemVnum and itemVnum <= tokens + 9) # Calculate itemVnum value min/max if exist in range.
(var == it) # When last digit is equal with iterator

image.LoadImage("icon/item/features_tooltip/%d.tga" % (k)) # Append image from iterator [MIN - MAX]

vnums = [14205, 11806, 140, 12012, 184]
# What means this list.
	# Element 14205 means will have check from 14205 to 14209.
	# Element 11802 means will have check from 11802 to 11809.
	# Element 140 means will have check from 140 to 149.
Code:
def __SetFeaturesToolTip(self, itemVnum):
	vnums = [140, 150, 3130, 270, 12010, 12020, 12030, 12040, 480, 460, 470, 5120, 7120, 20250, 20750, 20000, 180, 190]
	
	for k in xrange(player.MAX_REFINE_VNUM + 1):
		for v in xrange(len(vnums)):
			tokens, var, it = vnums[v], str(itemVnum)[-1:], str(k)

			if ((tokens <= itemVnum and itemVnum <= tokens + 9) and (var == it)):
				image.LoadImage("icon/item/features_tooltip/%d.tga" % (k))
Stop this circus you will not get anything already is too off-topic.
Using what method and what code you want, nobody care about you.
Have fun and sorry for my english.
01/11/2017 15:42 VegaS ♆#6
Oh yeah, i did 10 images, what is your problem xD, you can't sleep?
I see you edit your post every 2 seconds, and you make refresh on every one second on this topic, so bad..you are hungry ^^

I notice that despite mills, because you're obsessed, you made 100 reply to showing a shit, which has no a thing about it, it ceases to kill python.

EDIT:
That is all over 35 lines with code shit for what?
Here is better dude, stop to make a post with a lot a things shit what people not will use.

Code:
def __SetFeaturesToolTip(self, itemVnum):
	vnums = [140, 150, 3130, 270, 12010, 12020, 12030, 12040, 480, 460, 470, 5120, 7120, 20250, 20750, 20000, 180, 190]
	
	for k in xrange(player.MAX_REFINE_VNUM + 1):
		for v in xrange(len(vnums)):
			tokens, var, it = vnums[v], str(itemVnum)[-1:], str(k)

			if ((tokens <= itemVnum and itemVnum <= tokens + 9) and (var == it)):
				image.LoadImage("icon/item/features_tooltip/%d.tga" % (k))
Stop to search attention with my name.

As i see you check my profile on some forums in every day and my website, you really have a obsessed for me, thanks.

Using what method and what code you want, nobody care about you.

Stop to try continue conversation with me, if you want to speak with me about personal things like what you did now, you can write me a message private, no need to search attention here, already you get some popularity here from this conversation with me, good luck.
01/11/2017 16:10 ganea21#7
nice release guys
01/11/2017 19:29 Nadellia#8
I just see someone who use code from another to do do someting.

Sorry, but Vegas is not my friend, but since some days ( no, week) I think he is the only one who's always posted something without waiting something from the other.

You cry about his code, but sorry, if the code look really ugly for you, just change it for your server, like some people do without say someting.
01/11/2017 21:17 MaxChri#9
Nice idea I like it :D

Quote:
You did 10 images for each plus =)))
P.S3: Why you do not have real, pro mlg, developer,mature arguments when I humiliate you ?
It's ok dude this isn't such of difference.
01/12/2017 19:24 jma96#10
Nice release. ^^
Thanks
01/16/2017 12:06 xCPx#11
Sorry Guys, but stop beefing.

For me both of your examples arent really good coded. I mean there is allways something to do better. Beeing sad because someone says your code is shit is as stupid as saying his code is shit, mine is better.

So actually just see it as something you could might learn and not as a kinda "i am better than you".

because coding simply isnt about competition. If it works and it works fine, why should you then be sad?

I mean for example i would write it like this:
Code:
def __IsCustomStarVnum(self, vnum):
		customs=[10, 20, 30, 40]
		vnum = int("%s0" % str(vnum)[:-1])
		if vnum in customs:
			return TRUE
		return FALSE
	def __IsCustomStarType(self, vnum):
		allowed_types = [item.ITEM_TYPE_WEAPON,item.ITEM_TYPE_ARMOR]
		return (item.GetItemType() in allowed_types)
		
	def __IsCustomStarItem(self, vnum, type):
		x = self.__IsCustomStarType(vnum)
		y = self.__IsCustomStarVnum(vnum)
		if type == 2:
			return x
		if type == 1:
			return y
		if type == 0:
			return x or y
		return FALSE
		
	def __SetStars(self, vnum, type = 0):
		#0 = use customTypes and Itemtype #1 = Use ItemType #2 = use customtype
		grd = int(str(vnum)[-1:])
		if self.__IsCustomStarItem(vnum, type):
			img = ui.ImageBox()
			img.SetParent(self)
			img.Show()
			mage.LoadImage("icon/item/features_tooltip/%d.tga" % (grd))
			img.SetPosition(self.toolTipWidth/2 - 75, self.toolTipHeight)
			self.toolTipHeight += 18
			self.childrenList.append(img)
			self.ResizeToolTip()

But its up to everyone what he wants to use.

but one thing i actually dont get:

Why do you both use an for loop when there is no need for it?

I mean for rarity 9 you dont need to append all images from 0-9, its enough to show image 9.tga ?

Greetings,
Micha


Btw:
VegaS? We should write more in skype :D