Mercurial > eagle-eye
comparison inactive-map.pl @ 116:da0dd597401c
fixed the x/y position
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 29 Oct 2008 23:08:38 +0800 |
parents | e992576ac97c |
children |
comparison
equal
deleted
inserted
replaced
111:8155f9328396 | 116:da0dd597401c |
---|---|
8 | 8 |
9 Ikariam::User->has_many(cities => 'Ikariam::Cities'); | 9 Ikariam::User->has_many(cities => 'Ikariam::Cities'); |
10 Ikariam::User->set_sql(inactivity => qq { | 10 Ikariam::User->set_sql(inactivity => qq { |
11 SELECT user.id | 11 SELECT user.id |
12 FROM user, cities, island | 12 FROM user, cities, island |
13 WHERE user.id == cities.user | 13 WHERE user.id = cities.user |
14 AND cities.island == island.id | 14 AND cities.island = island.id |
15 AND island.x <= ? | 15 AND island.x <= ? |
16 AND island.x >= ? | 16 AND island.x >= ? |
17 AND island.y <= ? | 17 AND island.y <= ? |
18 AND island.y >= ? | 18 AND island.y >= ? |
19 AND cities.status == 'i' | 19 AND cities.status = 'i' |
20 } | 20 } |
21 ); | 21 ); |
22 #Ikariam::User->set_sql(sheeps => qq { | 22 #Ikariam::User->set_sql(sheeps => qq { |
23 # SELECT user.id | 23 # SELECT user.id |
24 # FROM user, cities, island | 24 # FROM user, cities, island |
34 #); | 34 #); |
35 | 35 |
36 Ikariam::User->set_sql(sheeps => qq { | 36 Ikariam::User->set_sql(sheeps => qq { |
37 SELECT user.id | 37 SELECT user.id |
38 FROM user, cities | 38 FROM user, cities |
39 WHERE user.id == cities.user | 39 WHERE user.id = cities.user |
40 AND cities.status == 'i' | 40 AND cities.status = 'i' |
41 AND user.trader_score_secondary >= 50000 | 41 AND user.trader_score_secondary >= 50000 |
42 AND user.army_score_main <= 40 | 42 AND user.army_score_main <= 40 |
43 } | 43 } |
44 ); | 44 ); |
45 | 45 |
46 listSheeps(Ikariam::User->search_sheeps()); | 46 listSheeps(Ikariam::User->search_sheeps()); |
67 my $island = Ikariam::Island->retrieve($c->island); | 67 my $island = Ikariam::Island->retrieve($c->island); |
68 | 68 |
69 # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000 | 69 # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000 |
70 my $robbery = $c->citylevel * ($c->citylevel - 1) * $sheep->trader_score_secondary / 10000; | 70 my $robbery = $c->citylevel * ($c->citylevel - 1) * $sheep->trader_score_secondary / 10000; |
71 | 71 |
72 next if($robbery < 2000); | 72 next if($robbery < 1000); |
73 | 73 |
74 $maps{$island->x}{$island->y}{'id'} = $island->id; | 74 $maps{$island->x}{$island->y}{'id'} = $island->id; |
75 $maps{$island->x}{$island->y}{'density'} += 1; | 75 $maps{$island->x}{$island->y}{'density'} += 1; |
76 | 76 |
77 $x1 = min ($x1, $island->x); | 77 $x1 = min ($x1, $island->x); |
93 border-collapse: collapse; | 93 border-collapse: collapse; |
94 background-color: white; | 94 background-color: white; |
95 } | 95 } |
96 </style></head><body><table border=1>"); | 96 </style></head><body><table border=1>"); |
97 | 97 |
98 foreach my $x ($x1..$x2) | 98 foreach my $y($y1..$y2) |
99 { | 99 { |
100 print(OUT "<tr>"); | 100 print(OUT "<tr>"); |
101 foreach my $y($y1..$y2) | 101 foreach my $x ($x1..$x2) |
102 { | 102 { |
103 # printf("<div stlye='float:left; background-color: black; padding: 0; Display:inline;'>o</div>"); | 103 # printf("<div stlye='float:left; background-color: black; padding: 0; Display:inline;'>o</div>"); |
104 if(defined($maps{$x}{$y}{'density'})) { | 104 if(defined($maps{$x}{$y}{'density'})) { |
105 my $c = 255 - (15 * $maps{$x}{$y}{'density'}); | 105 my $c = 255 - (15 * $maps{$x}{$y}{'density'}); |
106 printf(OUT "<td style=\"background-color: rgb(255,%d,%d);\"><a href=\"http://s2.ikariam.tw/index.php?view=island&id=%d\" title=\"[%d,%d] (%d)\">[%d,%d]</a></td>", | 106 printf(OUT "<td style=\"background-color: rgb(255,%d,%d);\"><a href=\"http://%s/index.php?view=island&id=%d\" title=\"[%d,%d] (%d)\">[%d,%d]</a></td>", |
107 $c, $c, $maps{$x}{$y}{'id'}, $x, $y, $maps{$x}{$y}{'density'}, $x, $y); | 107 $c, $c, $::server, $maps{$x}{$y}{'id'}, $x, $y, $maps{$x}{$y}{'density'}, $x, $y); |
108 } else { | 108 } else { |
109 printf(OUT "<td style=\"background-color: rgb(255,255,255);\">[%d,%d]</td>", $x, $y); | 109 printf(OUT "<td style=\"background-color: rgb(255,255,255);\">[%d,%d]</td>", $x, $y); |
110 } | 110 } |
111 } | 111 } |
112 print(OUT "</tr>"); | 112 print(OUT "</tr>"); |