Enhanced Razor 바드버프관리 UI
페이지 정보
작성자 LastEnvoy 작성일 24-02-14 22:10 조회 114 댓글 1본문
UI 설명
좌측 하단의 아이콘이 MANUAL일 때는 스킬 버튼을 누르면 스킬이 사용되고, 빨간 원을 클릭하면 초록색으로 바뀌며,
MANUAL을 클릭하면 AUTO로 변경되어 버프가 꺼질 때마다 재시전합니다.
from System.Collections.Generic import List
from System import Int32
setX = 25
setY = 50
WAITING = 100
class SpellFn:
MAGERY = Spells.CastMagery
NECROMENCY = Spells.CastNecro
SPELLWEAVING = Spells.CastSpellweaving
MASTERY = Spells.CastMastery
class SpellInfo:
def __init__(self, name, mana_cost, btn_id, delay_in_ms, image_id, when_to_cast, spell_fn, check_loop, targeting=None):
self.name = name
self._mana_cost = mana_cost
self.btn_id = btn_id
self._delay_in_ms = delay_in_ms
self.image_id = image_id
self.when_to_cast = when_to_cast
self._spell_fn = spell_fn
self.check_loop = check_loop
self._targeting = targeting
def cast(self, target=None):
self._spell_fn(self.name)
if self._targeting != None:
Target.WaitForTarget(WAITING + self._delay_in_ms,True)
Target.TargetExecute(self._targeting)
elif target != None:
Target.WaitForTarget(WAITING + self._delay_in_ms,True)
Target.TargetExecute(target)
Misc.Pause(WAITING)
def has_mana(self):
return int(self._mana_cost) <= Player.Mana
def set_loop(self, loop):
self.check_loop = loop
class CastInfo:
def __init__(self):
self.castlist = [SpellInfo('Inspire', 20, 1, 2500, 2373, self._cond_inspire, SpellFn.MASTERY, 0),
SpellInfo('Invigorate', 20, 2, 2500, 2374, self._cond_invigorate, SpellFn.MASTERY, 0),
SpellInfo('Resilience', 20, 3, 2500, 2375, self._cond_resilience, SpellFn.MASTERY, 0),
SpellInfo('Perseverance', 20, 4, 2500, 2376, self._cond_perseverance, SpellFn.MASTERY, 0)]
def _cond_inspire(self):
return not Player.BuffsExist('Inspire') and self.castlist[0].has_mana()
def _cond_invigorate(self):
return not Player.BuffsExist('Invigorate') and self.castlist[1].has_mana()
def _cond_resilience(self):
return not Player.BuffsExist('Resilience') and self.castlist[2].has_mana()
def _cond_perseverance(self):
return not Player.BuffsExist('Perseverance') and self.castlist[3].has_mana()
class masteryGump:
def __init__(self):
self.is_auto = False
def sendgump(self):
self.gd = Gumps.CreateGump(movable=True)
Gumps.AddPage(self.gd, 0)
Gumps.AddBackground(self.gd, 0, 0, 12 + 42*(len(spells.castlist)), 125, 30546)
#Gumps.AddImage(gd,0, 0, 1563)
Gumps.AddAlphaRegion(self.gd,0,0, 12 + 42*(len(spells.castlist)),125)
for i in range(len(spells.castlist)):
Gumps.AddButton(self.gd, 5 + 42*i, 5, spells.castlist[i].image_id, spells.castlist[i].image_id, spells.castlist[i].btn_id, not self.is_auto, 0)
Gumps.AddTooltip(self.gd, f"{spells.castlist[i].name}")
Gumps.AddCheck(self.gd, 20 + 42*i, 55, 2360, 2361, spells.castlist[i].check_loop, spells.castlist[i].btn_id)
Gumps.AddTooltip(self.gd, f"{spells.castlist[i].name}")
Gumps.AddButton(self.gd, 40*i, 95, 2124, 2123, 99, 1, 0)
if self.is_auto:
Gumps.AddButton(self.gd,5,95,2113,2112, 98, 1, 0)
else:
Gumps.AddButton(self.gd,5,95,2116,2115, 98, 1, 0)
Gumps.SendGump(987654, Player.Serial, setX, setY, self.gd.gumpDefinition, self.gd.gumpStrings)
self.buttoncheck()
def buttoncheck(self):
gd = Gumps.GetGumpData(987654)
if not self.is_auto:
Gumps.WaitForGump(987654, 60000)
Gumps.CloseGump(987654)
for spell in spells.castlist:
if spell.btn_id == gd.buttonid:
spell.cast()
else:
Gumps.WaitForGump(987654, 1000)
if gd.buttonid == 98 and len(gd.switches) == 0:
Player.HeadMessage(33, '마스터리 스킬을 선택하고 적용하세요.')
if gd.buttonid == 98 and len(gd.switches) != 0:
self.is_auto = not self.is_auto
self.checkrun()
elif gd.buttonid == 99:
self.checkrun()
def checkrun(self):
gd = Gumps.GetGumpData(987654)
for spell in spells.castlist:
if spell.btn_id in gd.switches:
spell.set_loop(1)
else:
spell.set_loop(0)
def checkbuff(self):
if not self.is_auto:
return
for spell in spells.castlist:
if spell.check_loop == 1 and spell.when_to_cast():
#print(spell.when_to_cast())
spell.cast()
spells = CastInfo()
gump = masteryGump()
while Player.Connected:
gump.sendgump()
gump.checkbuff()
Misc.Pause(200)
minigo님의 댓글
minigo 작성일와 감사합니다. 잘쓰겠습니다.