ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI/SpellList.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI/SpellList.pm (file contents):
Revision 1.3 by root, Wed Dec 26 20:46:40 2007 UTC vs.
Revision 1.4 by root, Wed Dec 26 21:03:21 2007 UTC

1package dc::UI::SpellList; 1package DC::UI::SpellList;
2 2
3use strict; 3use strict;
4use utf8; 4use utf8;
5 5
6use dc::Macro; 6use DC::Macro;
7 7
8our @ISA = dc::UI::Table::; 8our @ISA = DC::UI::Table::;
9 9
10sub new { 10sub new {
11 my $class = shift; 11 my $class = shift;
12 12
13 my $self = $class->SUPER::new ( 13 my $self = $class->SUPER::new (
31 "<b>Damage</b>. The amount of damage the spell deals when it hits.$TOOLTIP_ALL"); 31 "<b>Damage</b>. The amount of damage the spell deals when it hits.$TOOLTIP_ALL");
32 32
33sub rebuild_spell_list { 33sub rebuild_spell_list {
34 my ($self) = @_; 34 my ($self) = @_;
35 35
36 $dc::UI::ROOT->on_refresh ($self => sub { 36 $DC::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; 41 my @add;
42 42
43 push @add, 43 push @add,
44 1, 0, (new dc::UI::Label text => "Spell Name", @TOOLTIP_NAME), 44 1, 0, (new DC::UI::Label text => "Spell Name", @TOOLTIP_NAME),
45 2, 0, (new dc::UI::Label text => "Skill", @TOOLTIP_SKILL), 45 2, 0, (new DC::UI::Label text => "Skill", @TOOLTIP_SKILL),
46 3, 0, (new dc::UI::Label text => "Lvl" , @TOOLTIP_LVL), 46 3, 0, (new DC::UI::Label text => "Lvl" , @TOOLTIP_LVL),
47 4, 0, (new dc::UI::Label text => "Sp/Gp", @TOOLTIP_SP), 47 4, 0, (new DC::UI::Label text => "Sp/Gp", @TOOLTIP_SP),
48 5, 0, (new dc::UI::Label text => "Dmg" , @TOOLTIP_DMG), 48 5, 0, (new DC::UI::Label text => "Dmg" , @TOOLTIP_DMG),
49 ; 49 ;
50 50
51 my $row = 0; 51 my $row = 0;
52 52
53 for (sort { $a cmp $b } keys %{ $self->{spell} }) { 53 for (sort { $a cmp $b } keys %{ $self->{spell} }) {
61 if ($ev->{button} == 1) { 61 if ($ev->{button} == 1) {
62 $::CONN->user_send ("cast $spell->{name}"); 62 $::CONN->user_send ("cast $spell->{name}");
63 } elsif ($ev->{button} == 2) { 63 } elsif ($ev->{button} == 2) {
64 $::CONN->user_send ("invoke $spell->{name}"); 64 $::CONN->user_send ("invoke $spell->{name}");
65 } elsif ($ev->{button} == 3) { 65 } elsif ($ev->{button} == 3) {
66 my $shortname = dc::shorten $spell->{name}, 14; 66 my $shortname = DC::shorten $spell->{name}, 14;
67 (new dc::UI::Menu 67 (new DC::UI::Menu
68 items => [ 68 items => [
69 ["bind <i>cast $shortname</i> to a key" => sub { dc::Macro::quick_macro ["cast $spell->{name}"] }], 69 ["bind <i>cast $shortname</i> to a key" => sub { DC::Macro::quick_macro ["cast $spell->{name}"] }],
70 ["bind <i>invoke $shortname</i> to a key" => sub { dc::Macro::quick_macro ["invoke $spell->{name}"] }], 70 ["bind <i>invoke $shortname</i> to a key" => sub { DC::Macro::quick_macro ["invoke $spell->{name}"] }],
71 ], 71 ],
72 )->popup ($ev); 72 )->popup ($ev);
73 } else { 73 } else {
74 return 0; 74 return 0;
75 } 75 }
76 76
77 1 77 1
78 }; 78 };
79 79
80 my $tooltip = (dc::asxml $spell->{message}) . $TOOLTIP_ALL; 80 my $tooltip = (DC::asxml $spell->{message}) . $TOOLTIP_ALL;
81 81
82 #TODO: add path info to tooltip 82 #TODO: add path info to tooltip
83 #push @add, 6, $row, new dc::UI::Label text => $spell->{path}; 83 #push @add, 6, $row, new DC::UI::Label text => $spell->{path};
84 84
85 push @add, 0, $row, new dc::UI::Face 85 push @add, 0, $row, new DC::UI::Face
86 face => $spell->{face}, 86 face => $spell->{face},
87 can_hover => 1, 87 can_hover => 1,
88 can_events => 1, 88 can_events => 1,
89 tooltip => $tooltip, 89 tooltip => $tooltip,
90 on_button_down => $spell_cb, 90 on_button_down => $spell_cb,
91 ; 91 ;
92 92
93 push @add, 1, $row, new dc::UI::Label 93 push @add, 1, $row, new DC::UI::Label
94 expand => 1, 94 expand => 1,
95 text => $spell->{name}, 95 text => $spell->{name},
96 can_hover => 1, 96 can_hover => 1,
97 can_events => 1, 97 can_events => 1,
98 tooltip => $tooltip, 98 tooltip => $tooltip,
99 on_button_down => $spell_cb, 99 on_button_down => $spell_cb,
100 ; 100 ;
101 101
102 push @add, 102 push @add,
103 2, $row, (new dc::UI::Label text => $::CONN->{skill_info}{$spell->{skill}}, @TOOLTIP_SKILL), 103 2, $row, (new DC::UI::Label text => $::CONN->{skill_info}{$spell->{skill}}, @TOOLTIP_SKILL),
104 3, $row, (new dc::UI::Label text => $spell->{level}, @TOOLTIP_LVL), 104 3, $row, (new DC::UI::Label text => $spell->{level}, @TOOLTIP_LVL),
105 4, $row, (new dc::UI::Label text => $spell->{mana} || $spell->{grace}, @TOOLTIP_SP), 105 4, $row, (new DC::UI::Label text => $spell->{mana} || $spell->{grace}, @TOOLTIP_SP),
106 5, $row, (new dc::UI::Label text => $spell->{damage}, @TOOLTIP_DMG), 106 5, $row, (new DC::UI::Label text => $spell->{damage}, @TOOLTIP_DMG),
107 ; 107 ;
108 } 108 }
109 109
110 $self->add_at (@add); 110 $self->add_at (@add);
111 }); 111 });

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines