X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Def.pm;h=1f9c7d92a9d7db90767250975eed523b449323c9;hb=12875f719b2b7283dfc7609fb2d90ecd2016b62e;hp=8f0fca9b8bf7892ee88a9ba2ed0314d36ff403f1;hpb=9e84f393649d1ecbc24a94476352a28f49afa458;p=NDIRC.git diff --git a/Def.pm b/Def.pm index 8f0fca9..1f9c7d9 100644 --- a/Def.pm +++ b/Def.pm @@ -20,6 +20,7 @@ package ND::IRC::Def; use strict; use warnings; use ND::DB; +use ND::Include; use ND::IRC::Access; use ND::IRC::Misc; require Exporter; @@ -52,7 +53,7 @@ SQL sub setType { my ($type,$id,$x,$y,$z) = @_; DB(); - if (dc()){ + if (my $user = dc()){ my $fleet; my $query = qq{ SELECT i.id,call,shiptype, coords(x,y,z),c.landing_tick - tick() FROM incomings i @@ -80,8 +81,7 @@ sub setType { } while (my ($id,$call,$oldtype,$coords,$tick) = $fleet->fetchrow()){ if($ND::DBH->do(q{UPDATE incomings SET shiptype = ? WHERE id = ?},undef,$type,$id) == 1){ - $ND::DBH->do(q{INSERT INTO log (uid,text) VALUES ((SELECT uid FROM - users WHERE hostmask ILIKE ?),?)},undef,$ND::address,"DC set fleet: $id to: $type"); + log_message $user->{uid}, "DC set fleet: $id to: $type"; $ND::server->command("msg $ND::target Set fleet from $coords on call $call to $type (previosly $oldtype)"); if ($tick < 0 && not (defined $x && $x eq 'call')){ $ND::server->command("msg $ND::target This call is old, did you use the call id, instead of inc id by accident? You can use .settypeall callid to set the type on all incs in a call."); @@ -130,17 +130,19 @@ sub defcall { my $call = ""; if ($callnr){ my $st = $ND::DBH->prepare(q{ - SELECT c.landing_tick - (SELECT value::integer FROM misc WHERE id = 'TICK'), concat(i.shiptype||'/') AS shiptype, dc.username + SELECT c.landing_tick - (SELECT value::integer FROM misc WHERE id = 'TICK'), concat(i.shiptype||'/') AS shiptype, p.x FROM calls c JOIN incomings i ON i.call = c.id LEFT OUTER JOIN users dc ON dc.uid = c.dc + JOIN users u ON u.uid = c.member + JOIN current_planet_stats p ON u.planet = p.id WHERE not covered AND c.id = ? - GROUP BY c.id,c.landing_tick,dc.username + GROUP BY c.id,c.landing_tick,p.x ORDER BY c.landing_tick; }); if (my @row = $ND::DBH->selectrow_array($st,undef,$callnr)){ chop($row[1]); - $call = "(Anti $row[1] ETA: $row[0])" + $call = "(Anti $row[1] ETA: $row[0] Cluster: $row[2])" } } $ND::server->command("notice $ND::memchan DEFENSE REQUIRED!! WAKE UP!!");