Count Stones

Originally created by ElpiJudo on the old forum. If you’re still around create a new thread with the plugin and I’ll delete my thread.

from phBot import *
import QtBind

gui = QtBind.init(__name__,'CountStones')

lAttStones = QtBind.createLabel(gui,'ATTRIBUTE STONES',11,10)
lCourage = QtBind.createLabel(gui,'Courage',11,25)
lPhilosophy = QtBind.createLabel(gui,'Philosophy',11,40)
lFocus = QtBind.createLabel(gui,'Focus',11,55)
lChallenge = QtBind.createLabel(gui,'Challenge',11,70)
lAgility = QtBind.createLabel(gui,'Agility',11,85)
lWarriors = QtBind.createLabel(gui,'Warriors',11,100)
lMeditation = QtBind.createLabel(gui,'Meditation',11,115)
lFlesh = QtBind.createLabel(gui,'Flesh',11,130)
lMind = QtBind.createLabel(gui,'Mind',11,145)
lDodging = QtBind.createLabel(gui,'Dodging',11,160)
lLife = QtBind.createLabel(gui,'Life',11,175)
lSpirit = QtBind.createLabel(gui,'Spirit',11,190)
lTraining = QtBind.createLabel(gui,'Training',11,205)
lPrayer = QtBind.createLabel(gui,'Prayer',11,220)
qcourage = QtBind.createLabel(gui,'0',100,25)
qphilosophy = QtBind.createLabel(gui,'0',100,40)
qfocus = QtBind.createLabel(gui,'0',100,55)
qchallenge = QtBind.createLabel(gui,'0',100,70)
qagility = QtBind.createLabel(gui,'0',100,85)
qwarriors = QtBind.createLabel(gui,'0',100,100)
qmeditation = QtBind.createLabel(gui,'0',100,115)
qflesh = QtBind.createLabel(gui,'0',100,130)
qmind = QtBind.createLabel(gui,'0',100,145)
qdodging = QtBind.createLabel(gui,'0',100,160)
qlife = QtBind.createLabel(gui,'0',100,175)
qspirit = QtBind.createLabel(gui,'0',100,190)
qtraining = QtBind.createLabel(gui,'0',100,205)
qprayer = QtBind.createLabel(gui,'0',100,220)

lMagStones = QtBind.createLabel(gui,'MAGIC STONES',175,10)
lSTR = QtBind.createLabel(gui,'Str',175,25)
lINT = QtBind.createLabel(gui,'Int',175,40)
lMaster = QtBind.createLabel(gui,'Master',175,55)
lStrikes = QtBind.createLabel(gui,'Strikes',175,70)
lDiscipline = QtBind.createLabel(gui,'Discipline',175,85)
lPenetration = QtBind.createLabel(gui,'Penetration',175,100)
lDodging2 = QtBind.createLabel(gui,'Dodging',175,115)
lStamina = QtBind.createLabel(gui,'Stamina',175,130)
lMagic = QtBind.createLabel(gui,'Magic',175,145)
lFogs = QtBind.createLabel(gui,'Fogs',175,160)
lAir = QtBind.createLabel(gui,'Air',175,175)
lFire = QtBind.createLabel(gui,'Fire',175,190)
lImmunity = QtBind.createLabel(gui,'Immunity',175,205)
lRevival = QtBind.createLabel(gui,'Revival',175,220)
lLuck = QtBind.createLabel(gui,'Luck',175,235)
lSteady = QtBind.createLabel(gui,'Steady',175,250)
qstr = QtBind.createLabel(gui,'0',245,25)
qint = QtBind.createLabel(gui,'0',245,40)
qmaster = QtBind.createLabel(gui,'0',245,55)
qstrikes = QtBind.createLabel(gui,'0',245,70)
qdiscipline = QtBind.createLabel(gui,'0',245,85)
qpenetration = QtBind.createLabel(gui,'0',245,100)
qdodging2 = QtBind.createLabel(gui,'0',245,115)
qstamina = QtBind.createLabel(gui,'0',245,130)
qmagic = QtBind.createLabel(gui,'0',245,145)
qfogs = QtBind.createLabel(gui,'0',245,160)
qair = QtBind.createLabel(gui,'0',245,175)
qfire = QtBind.createLabel(gui,'0',245,190)
qimmunity = QtBind.createLabel(gui,'0',245,205)
qrevival = QtBind.createLabel(gui,'0',245,220)
qluck = QtBind.createLabel(gui,'0',245,235)
qsteady = QtBind.createLabel(gui,'0',245,250)

lElixir = QtBind.createLabel(gui,'INTENSIFING ELIXIR',330,190)
lWeapon = QtBind.createLabel(gui,'Weapon',330,205)
lProtector = QtBind.createLabel(gui,'Protector',330,220)
lAccessory = QtBind.createLabel(gui,'Accessory',330,235)
lShield = QtBind.createLabel(gui,'Shield',330,250)
qweapon = QtBind.createLabel(gui,'0',424,205)
qprotector = QtBind.createLabel(gui,'0',424,220)
qaccessory = QtBind.createLabel(gui,'0',424,235)
qshield = QtBind.createLabel(gui,'0',424,250)

leDegree = QtBind.createLineEdit(gui,"15",330,10,19,19)
lDegree = QtBind.createLabel(gui,'Degree',352,13)
btnStorage = QtBind.createButton(gui,'btnStorage_clicked',"  Refresh Storage  ",330,70)
btnGuildStorage = QtBind.createButton(gui,'btnGuildStorage_clicked',"  Refresh Guild Storage  ",330,100)
btnInventory = QtBind.createButton(gui,'btnInventory_clicked',"  Refresh Inventory  ",330,130)

def btnStorage_clicked():
	countIn = 'Storage'
	countItems(countIn)

def btnGuildStorage_clicked():
	countIn = 'GuildStorage'
	countItems(countIn)

def btnInventory_clicked():
	countIn = 'Inventory'
	countItems(countIn)

def countItems(countIn):
	courage = 0
	philosophy = 0
	focus = 0
	challenge = 0
	agility = 0
	warriors = 0
	meditation = 0
	flesh = 0
	mind = 0
	pdodging = 0
	life = 0
	spirit = 0
	training = 0
	prayer = 0
	Str = 0
	Int = 0
	master = 0
	strikes = 0
	discipline = 0
	penetration = 0
	gdodging = 0
	stamina = 0
	magic = 0
	fogs = 0
	air = 0
	fire = 0
	immunity = 0
	revival = 0
	luck = 0
	steady = 0
	weapon = 0
	protector = 0
	accessory = 0
	shield = 0
	items = []
	if countIn == 'Storage':
		items = get_storage()['items']
	elif countIn == 'GuildStorage':
		items = get_guild_storage()['items']
	elif countIn == 'Inventory':
		items = get_inventory()['items']
	degree = str(QtBind.text(gui,leDegree))
	if items != []:
		for item in items:
			if item != None and degree in item['name'] and 'tablet' not in item['name'] and 'stone' in item['name']:
				if "courage" in item['name']:
					courage += item['quantity']
				elif "philosophy" in item['name']:
					philosophy += item['quantity']
				elif "focus" in item['name']:
					focus += item['quantity']
				elif "challenge" in item['name']:
					challenge += item['quantity']
				elif "agility" in item['name']:
					agility += item['quantity']
				elif "warriors" in item['name']:
					warriors += item['quantity']
				elif "meditation" in item['name']:
					meditation += item['quantity']
				elif "flesh" in item['name']:
					flesh += item['quantity']
				elif "mind" in item['name']:
					mind += item['quantity']
				elif "Attribute stone of dodging" in item['name']:
					pdodging += item['quantity']
				elif "life" in item['name']:
					life += item['quantity']
				elif "spirit" in item['name']:
					spirit += item['quantity']
				elif "training" in item['name']:
					training += item['quantity']
				elif "prayer" in item['name']:
					prayer += item['quantity']
				elif "Str" in item['name']:
					Str += item['quantity']
				elif "Int" in item['name']:
					Int += item['quantity']
				elif "master" in item['name']:
					master += item['quantity']
				elif "strikes" in item['name']:
					strikes += item['quantity']
				elif "discipline" in item['name']:
					discipline += item['quantity']
				elif "penetration" in item['name']:
					penetration += item['quantity']
				elif "Magic stone of dodging" in item['name']:
					gdodging += item['quantity']
				elif "stamina" in item['name']:
					stamina += item['quantity']
				elif "magic" in item['name']:
					magic += item['quantity']
				elif "fogs" in item['name']:
					fogs += item['quantity']
				elif "air" in item['name']:
					air += item['quantity']
				elif "immunity" in item['name']:
					immunity += item['quantity']
				elif "revival" in item['name']:
					revival += item['quantity']
				elif "fire" in item['name']:
					fire += item['quantity']
				elif "steady" in item['name']:
					steady += item['quantity']
				elif "luck" in item['name']:
					luck += item['quantity']
			if item != None and "Intensifing" in item['name'] and "(weapon)" in item['name']:
				weapon += item['quantity']
			if item != None and "Intensifing" in item['name'] and "(protector)" in item['name']:
				protector += item['quantity']
			if item != None and "Intensifing" in item['name'] and "(accessory)" in item['name']:
				accessory += item['quantity']
			if item != None and "Intensifing" in item['name'] and "(Shield)" in item['name']:
				shield += item['quantity']
	QtBind.setText(gui,qcourage,str(courage))
	QtBind.setText(gui,qphilosophy,str(philosophy))
	QtBind.setText(gui,qfocus,str(focus))
	QtBind.setText(gui,qchallenge,str(challenge))
	QtBind.setText(gui,qagility,str(agility))
	QtBind.setText(gui,qwarriors,str(warriors))
	QtBind.setText(gui,qmeditation,str(meditation))
	QtBind.setText(gui,qflesh,str(flesh))
	QtBind.setText(gui,qmind,str(mind))
	QtBind.setText(gui,qdodging,str(pdodging))
	QtBind.setText(gui,qlife,str(life))
	QtBind.setText(gui,qspirit,str(spirit))
	QtBind.setText(gui,qtraining,str(training))
	QtBind.setText(gui,qprayer,str(prayer))
	QtBind.setText(gui,qstr,str(Str))
	QtBind.setText(gui,qint,str(Int))
	QtBind.setText(gui,qmaster,str(master))
	QtBind.setText(gui,qstrikes,str(strikes))
	QtBind.setText(gui,qdiscipline,str(discipline))
	QtBind.setText(gui,qpenetration,str(penetration))
	QtBind.setText(gui,qdodging2,str(gdodging))
	QtBind.setText(gui,qstamina,str(stamina))
	QtBind.setText(gui,qmagic,str(magic))
	QtBind.setText(gui,qfire,str(fire))
	QtBind.setText(gui,qair,str(air))
	QtBind.setText(gui,qfogs,str(fogs))
	QtBind.setText(gui,qrevival,str(revival))
	QtBind.setText(gui,qimmunity,str(immunity))
	QtBind.setText(gui,qluck,str(luck))
	QtBind.setText(gui,qsteady,str(steady))
	QtBind.setText(gui,qweapon,str(weapon))
	QtBind.setText(gui,qprotector,str(protector))
	QtBind.setText(gui,qaccessory,str(accessory))
	QtBind.setText(gui,qshield,str(shield))

log('Plugins: CountStones successfully loaded')

How do i return a pets inventory? Is it the get_pets() ?

Yes, that also gives you the inventory of the pet.

I get python error : items when using it, am i doing it correctly?

	if countIn == 'Storage':
	items = get_storage()['items']
elif countIn == 'GuildStorage':
	items = get_guild_storage()['items']
elif countIn == 'Inventory':
	items = get_inventory()['items']
elif countIn == 'Pet':
	items = get_pets()['items']

No. get_pets will return all pets and their inventories. You need to iterate through them.

The structure is the same except now there is an items key for each pet. Pets - phBot Plugins

Nice to see my old plugin is still around on the new forum. I’ve got a new version, will upload it when I’m back home after holidays

4 Likes

I did a little tweaking of the plugin while you were gone. :slight_smile: