Skip to content

Commit

Permalink
[games][dr] XMLData - adding dr_active_spells
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtraDR committed Oct 30, 2024
1 parent 9f0cd5f commit 4d5a525
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/xmlparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class XMLParser

def initialize
@buffer = String.new
@unescape = { 'lt' => '<', 'gt' => '>', 'quot' => '"', 'apos' => "'", 'amp' => '&' }
# @unescape = { 'lt' => '<', 'gt' => '>', 'quot' => '"', 'apos' => "'", 'amp' => '&' }
@bold = false
@active_tags = Array.new
@active_ids = Array.new
Expand Down Expand Up @@ -194,7 +194,6 @@ def make_scar_gsl
end

# def parse(line)
# Lich.log(line)
# @buffer.concat(line)
# loop {
# if (str = @buffer.slice!(/^[^<]+/))
Expand Down Expand Up @@ -233,6 +232,8 @@ def parse_psm3_progressbar(kind, attributes)
PSM_3_DIALOG_IDS = ["Buffs", "Active Spells", "Debuffs", "Cooldowns"]

def tag_start(name, attributes)
# This is called once per element by REXML in games.rb
# https://ruby-doc.org/stdlib-2.6.1/libdoc/rexml/rdoc/REXML/StreamListener.html
begin
@active_tags.push(name)
@active_ids.push(attributes['id'].to_s)
Expand Down Expand Up @@ -628,6 +629,8 @@ def tag_start(name, attributes)
end

def text(text_string)
# This is called once per element with text in it by REXML in games.rb
# https://ruby-doc.org/stdlib-2.6.1/libdoc/rexml/rdoc/REXML/StreamListener.html
begin
# fixme: /<stream id="Spells">.*?<\/stream>/m
# $_CLIENT_.write(text_string) unless ($frontend != 'suks') or (@current_stream =~ /^(?:spellfront|inv|bounty|society)$/) or @active_tags.any? { |tag| tag =~ /^(?:compDef|inv|component|right|left|spell)$/ } or (@active_tags.include?('stream') and @active_ids.include?('Spells')) or (text_string == "\n" and (@last_tag =~ /^(?:popStream|prompt|compDef|dialogData|openDialog|switchQuickBar|component)$/))
Expand Down Expand Up @@ -675,10 +678,7 @@ def text(text_string)
spell.strip!
if spell
@dr_active_spells[spell] = duration
# @dr_active_spells.refresh_data[spell] = true
end

# @dr_active_spells << text_string.strip.sub(" ", ' ')
end

if @current_style == 'roomName'
Expand Down Expand Up @@ -845,6 +845,8 @@ def text(text_string)
end

def tag_end(name)
# This is called once per element by REXML in games.rb
# https://ruby-doc.org/stdlib-2.6.1/libdoc/rexml/rdoc/REXML/StreamListener.html
begin
if @game =~ /^DR/
if name == 'compass' and $nav_seen
Expand Down

0 comments on commit 4d5a525

Please sign in to comment.