… | |
… | |
36 | $CFPlus::UI::ROOT->on_refresh ($self => sub { |
36 | $CFPlus::UI::ROOT->on_refresh ($self => sub { |
37 | $self->clear; |
37 | $self->clear; |
38 | |
38 | |
39 | return unless $::CONN; |
39 | return unless $::CONN; |
40 | |
40 | |
|
|
41 | my @add; |
|
|
42 | |
|
|
43 | push @add, |
41 | $self->add (1, 0, new CFPlus::UI::Label text => "Spell Name", @TOOLTIP_NAME); |
44 | 1, 0, (new CFPlus::UI::Label text => "Spell Name", @TOOLTIP_NAME), |
42 | $self->add (2, 0, new CFPlus::UI::Label text => "Skill", @TOOLTIP_SKILL); |
45 | 2, 0, (new CFPlus::UI::Label text => "Skill", @TOOLTIP_SKILL), |
43 | $self->add (3, 0, new CFPlus::UI::Label text => "Lvl" , @TOOLTIP_LVL); |
46 | 3, 0, (new CFPlus::UI::Label text => "Lvl" , @TOOLTIP_LVL), |
44 | $self->add (4, 0, new CFPlus::UI::Label text => "Sp/Gp", @TOOLTIP_SP); |
47 | 4, 0, (new CFPlus::UI::Label text => "Sp/Gp", @TOOLTIP_SP), |
45 | $self->add (5, 0, new CFPlus::UI::Label text => "Dmg" , @TOOLTIP_DMG); |
48 | 5, 0, (new CFPlus::UI::Label text => "Dmg" , @TOOLTIP_DMG), |
|
|
49 | ; |
46 | |
50 | |
47 | my $row = 0; |
51 | my $row = 0; |
48 | |
52 | |
49 | for (sort { $a cmp $b } keys %{ $self->{spell} }) { |
53 | for (sort { $a cmp $b } keys %{ $self->{spell} }) { |
50 | my $spell = $self->{spell}{$_}; |
54 | my $spell = $self->{spell}{$_}; |
… | |
… | |
74 | }; |
78 | }; |
75 | |
79 | |
76 | my $tooltip = (CFPlus::asxml $spell->{message}) . $TOOLTIP_ALL; |
80 | my $tooltip = (CFPlus::asxml $spell->{message}) . $TOOLTIP_ALL; |
77 | |
81 | |
78 | #TODO: add path info to tooltip |
82 | #TODO: add path info to tooltip |
79 | #$self->add (6, $row, new CFPlus::UI::Label text => $spell->{path}); |
83 | #push @add, 6, $row, new CFPlus::UI::Label text => $spell->{path}; |
80 | |
84 | |
81 | $self->add (0, $row, new CFPlus::UI::Face |
85 | push @add, 0, $row, new CFPlus::UI::Face |
82 | face => $spell->{face}, |
86 | face => $spell->{face}, |
83 | can_hover => 1, |
87 | can_hover => 1, |
84 | can_events => 1, |
88 | can_events => 1, |
85 | tooltip => $tooltip, |
89 | tooltip => $tooltip, |
86 | on_button_down => $spell_cb, |
90 | on_button_down => $spell_cb, |
87 | ); |
91 | ; |
88 | |
92 | |
89 | $self->add (1, $row, new CFPlus::UI::Label |
93 | push @add, 1, $row, new CFPlus::UI::Label |
90 | expand => 1, |
94 | expand => 1, |
91 | text => $spell->{name}, |
95 | text => $spell->{name}, |
92 | can_hover => 1, |
96 | can_hover => 1, |
93 | can_events => 1, |
97 | can_events => 1, |
94 | tooltip => $tooltip, |
98 | tooltip => $tooltip, |
95 | on_button_down => $spell_cb, |
99 | on_button_down => $spell_cb, |
96 | ); |
100 | ; |
97 | |
101 | |
|
|
102 | push @add, |
98 | $self->add (2, $row, new CFPlus::UI::Label text => $::CONN->{skill_info}{$spell->{skill}}, @TOOLTIP_SKILL); |
103 | 2, $row, (new CFPlus::UI::Label text => $::CONN->{skill_info}{$spell->{skill}}, @TOOLTIP_SKILL), |
99 | $self->add (3, $row, new CFPlus::UI::Label text => $spell->{level}, @TOOLTIP_LVL); |
104 | 3, $row, (new CFPlus::UI::Label text => $spell->{level}, @TOOLTIP_LVL), |
100 | $self->add (4, $row, new CFPlus::UI::Label text => $spell->{mana} || $spell->{grace}, @TOOLTIP_SP); |
105 | 4, $row, (new CFPlus::UI::Label text => $spell->{mana} || $spell->{grace}, @TOOLTIP_SP), |
101 | $self->add (5, $row, new CFPlus::UI::Label text => $spell->{damage}, @TOOLTIP_DMG); |
106 | 5, $row, (new CFPlus::UI::Label text => $spell->{damage}, @TOOLTIP_DMG), |
|
|
107 | ; |
102 | } |
108 | } |
|
|
109 | |
|
|
110 | $self->add_at (@add); |
103 | }); |
111 | }); |
104 | } |
112 | } |
105 | |
113 | |
106 | sub add_spell { |
114 | sub add_spell { |
107 | my ($self, $spell) = @_; |
115 | my ($self, $spell) = @_; |