Mercurial > eagle-eye
comparison Ikariam.pm @ 8:e4b3168d0319
implemented sheep and enemy scripts.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 08 Oct 2008 04:23:01 +0800 |
parents | 2040ccc95670 |
children | ae412d1f7761 |
comparison
equal
deleted
inserted
replaced
7:2040ccc95670 | 8:e4b3168d0319 |
---|---|
1 #!/usr/bin/env perl | 1 #!/usr/bin/env perl |
2 | 2 |
3 use Class::DBI::AutoLoader ( | 3 use Class::DBI::AutoLoader ( |
4 dsn => 'dbi:SQLite:dbname=ikariam.sqlite', | 4 dsn => 'dbi:SQLite:dbname=ikariam.sqlite', |
5 options => { RaiseError => 1 }, | 5 options => { RaiseError => 1 }, |
6 tables => ['cities', 'island', 'users'], | 6 tables => ['cities', 'island', 'user'], |
7 use_base => 'Class::DBI::SQLite', | 7 use_base => 'Class::DBI::SQLite', |
8 namespace => 'Ikariam', | 8 namespace => 'Ikariam', |
9 ); | 9 ); |
10 | 10 |
11 package Ikariam; | 11 package Ikariam; |
66 my %user; | 66 my %user; |
67 | 67 |
68 $e = getElementsByAttribute($elem, "class", "action"); | 68 $e = getElementsByAttribute($elem, "class", "action"); |
69 $e = getElementsByTagName($e, "a"); | 69 $e = getElementsByTagName($e, "a"); |
70 | 70 |
71 if($e->getAttribute('href') =~ /index\.php\?view=sendMessage&with=(\d+)&oldView=highscore/) | 71 if(defined ($e) && $e->getAttribute('href') =~ /index\.php\?view=sendMessage&with=(\d+)&oldView=highscore/) |
72 { | 72 { |
73 $user{'id'} = $1; | 73 $user{'id'} = $1; |
74 | 74 |
75 $e = getElementsByAttribute($elem, "class", "name"); | 75 $e = getElementsByAttribute($elem, "class", "name"); |
76 $user{'name'} = $e->innerText(); | 76 $user{'name'} = $e->innerText(); |
198 delete($info{'ally'}) if($info{'ally'} eq '-'); | 198 delete($info{'ally'}) if($info{'ally'} eq '-'); |
199 | 199 |
200 @e = getElementsByAttribute($elem, "class", "messageSend"); | 200 @e = getElementsByAttribute($elem, "class", "messageSend"); |
201 if ( $e[0]->getAttribute("href") =~ /with=(\d+)&destinationCityId=(\d+)/) | 201 if ( $e[0]->getAttribute("href") =~ /with=(\d+)&destinationCityId=(\d+)/) |
202 { | 202 { |
203 $info{'ownerId'} = $1; | 203 $info{'user'} = $1; |
204 $info{'cityId'} = $2; | 204 $info{'cityId'} = $2; |
205 } | 205 } |
206 push @cities, \%info; | 206 push @cities, \%info; |
207 } | 207 } |
208 | 208 |