|
@@ -0,0 +1,102 @@
|
|
|
+import winsound
|
|
|
+
|
|
|
+# ---------------------------------------------------------------------
|
|
|
+# CONFIGURE SECTION
|
|
|
+# ---------------------------------------------------------------------
|
|
|
+
|
|
|
+# Enable alerts for specified conditions
|
|
|
+ALERT_ON_LOW_DURABILITY = True
|
|
|
+ALERT_ON_AFK = True
|
|
|
+ALERT_ON_LOW_LIFE = True
|
|
|
+
|
|
|
+# LAYERS_TO_CHECK defines all the items slots the should be checked
|
|
|
+# for low durability.
|
|
|
+#
|
|
|
+# Possible values (string):
|
|
|
+# RightHand, LeftHand, Shoes, Pants, Shirt, Head, Gloves, Ring,
|
|
|
+# Neck, Hair, Waist, InnerTorso, Bracelet, FacialHair, MiddleTorso,
|
|
|
+# Earrings, Arms, Cloak, OuterTorso, OuterLegs, InnerLegs, Talisman
|
|
|
+LAYERS_TO_CHECK = ["Head",
|
|
|
+ "Gloves",
|
|
|
+ "Ring",
|
|
|
+ "Neck",
|
|
|
+ "Hair",
|
|
|
+ "Waist",
|
|
|
+ "InnerTorso",
|
|
|
+ "Bracelet",
|
|
|
+ "MiddleTorso",
|
|
|
+ "Earrings",
|
|
|
+ "Cloak",
|
|
|
+ "OuterTorso",
|
|
|
+ "OuterLegs",
|
|
|
+ "InnerLegs"]
|
|
|
+
|
|
|
+# LAYERS_LOW_DURABILITY_TRESHOLD defines the treshold value for
|
|
|
+# acoustic alert on low durability.
|
|
|
+LAYERS_DURABILITY_ALERT_VALUE = 3
|
|
|
+
|
|
|
+# AFK_GUMP_SEARCH defined the a search string to look for in current
|
|
|
+# gump. When found there will be an acoustic alert.
|
|
|
+AFK_GUMP_SEARCH = 'AFK'
|
|
|
+
|
|
|
+
|
|
|
+# AFK_JOURNAL_SEARCH defined the a search string to look for in journal.
|
|
|
+# When found there will be an acoustic alert.
|
|
|
+AFK_JOURNAL_SEARCH = 'You cannot fight while being afk checked.'
|
|
|
+
|
|
|
+# HITPOINTS_ALERT_VALUE defines the treshold value for acoustic
|
|
|
+# acoustic alert on low life.
|
|
|
+HITPOINTS_ALERT_VALUE = 100
|
|
|
+
|
|
|
+
|
|
|
+# ---------------------------------------------------------------------
|
|
|
+# SCRIPT SECTION - DO NOT EDIT BELOW HERE
|
|
|
+# ---------------------------------------------------------------------
|
|
|
+
|
|
|
+# cold start until player is logged in
|
|
|
+if not Player.Connected:
|
|
|
+ while not Player.Connected:
|
|
|
+ Misc.Pause(5000)
|
|
|
+
|
|
|
+
|
|
|
+def start():
|
|
|
+ while Player.Connected:
|
|
|
+ Journal.Clear()
|
|
|
+ # check for AFK in Gump
|
|
|
+ if ALERT_ON_AFK and Gumps.LastGumpTextExist("AFK"):
|
|
|
+ print("there is an AFK check!")
|
|
|
+ winsound.Beep(2800, 1000)
|
|
|
+
|
|
|
+ # check for low life
|
|
|
+ if ALERT_ON_LOW_LIFE and Player.Hits < 100:
|
|
|
+ winsound.Beep(1800, 1000)
|
|
|
+
|
|
|
+ # check for dura
|
|
|
+ if ALERT_ON_LOW_DURABILITY:
|
|
|
+ for layer in LAYERS_TO_CHECK:
|
|
|
+ myitem = Player.GetItemOnLayer(layer)
|
|
|
+ if myitem:
|
|
|
+ #print(f"{layer}:{myitem.Name}")
|
|
|
+ for p in myitem.Properties:
|
|
|
+ if p.ToString().startswith("durability"):
|
|
|
+ [current_dur, max_dur] = p.Args.split()
|
|
|
+ if int(current_dur) <= LAYERS_DURABILITY_ALERT_VALUE:
|
|
|
+ winsound.Beep(1400, 300)
|
|
|
+ Misc.Pause(200)
|
|
|
+ winsound.Beep(1500, 300)
|
|
|
+ Misc.Pause(200)
|
|
|
+ winsound.Beep(1600, 300)
|
|
|
+ Misc.Pause(200)
|
|
|
+ break
|
|
|
+
|
|
|
+ # lets pause for a while, we dont need to check all the time
|
|
|
+ Misc.Pause(2500)
|
|
|
+
|
|
|
+ # lastly, we check the journal for AFK messages
|
|
|
+ if ALERT_ON_AFK:
|
|
|
+ if Journal.Search('You cannot fight while being afk checked.'):
|
|
|
+ winsound.Beep(2800, 1000)
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ start()
|