Exemplo n.º 1
0
$nick = $argv[2];
$dest = $argv[3];
$alias = $argv[4];
$syntax = "syntax: ~remind value min|m|sec|s [optional msg to display]";
$parts = explode(" ", $trailing);
if (count($parts) < 2) {
    privmsg("error: incorrect number of parameters");
    privmsg($syntax);
    return;
}
$value = $parts[0];
$unit = $parts[1];
array_shift($parts);
array_shift($parts);
$msg = implode(" ", $parts);
if (exec_is_integer($value) == False or $value == "" or $value < 0 or $value > 99990) {
    privmsg("error: value must be a positive integer");
    privmsg($syntax);
    return;
}
switch (strtolower($unit)) {
    case "min":
    case "m":
        $value = $value * 60;
        break;
    case "sec":
    case "s":
        break;
    default:
        privmsg("error: invalid unit");
        privmsg($syntax);
Exemplo n.º 2
0
            } elseif ($cid > $last_cid) {
                $count_new++;
                $msg = "*** new comment: {$user_uid} {$score} " . chr(3) . "02" . $subject . chr(3) . " - {$title_output} - {$comment_body_len} chars -" . chr(3) . "04 {$url}";
                if ($parent_url != "") {
                    $msg = $msg . " " . chr(3) . "(parent: {$parent_url})";
                }
                $msg = clean_text($msg);
                output($record, $msg);
                output($record, chr(3) . "08└─" . $comment_body, False);
            }
        }
    }
}
$new_last_cid = $last_cid;
for ($i = 0; $i < count($cids); $i++) {
    if (exec_is_integer($cids[$i]) == True) {
        if ($cids[$i] > $new_last_cid) {
            $new_last_cid = $cids[$i];
        }
    }
}
file_put_contents(COMMENTS_CID_FILE, $new_last_cid);
$msg = "count new = {$count_new}";
pm(MAIN_FEED_CHANNEL, $msg);
$msg = "count top = {$count_top}";
pm(MAIN_FEED_CHANNEL, $msg);
$msg = chr(3) . "08" . "********** " . chr(3) . "03" . "END FEED" . chr(3) . "08" . " **********";
pm(MAIN_FEED_CHANNEL, $msg);
#####################################################################################################
function output($record, $msg, $show_filter = True)
{
Exemplo n.º 3
0
     $data_changed = True;
     privmsg("script line removed");
     break;
 case "insert":
     # ~x insert [L]5 while (True) { privmsg("flooding++"); }
     $line_no = $parts[0];
     array_shift($parts);
     $trailing = trim(implode(" ", $parts));
     if ($line_no == "") {
         privmsg("error: line number not specified");
         break;
     }
     if (strtoupper($line_no[0]) == "L") {
         $line_no = substr($line_no, 1);
     }
     if (exec_is_integer($line_no) == False) {
         privmsg("error: invalid line number");
         break;
     }
     if (isset($script_lines[$line_no - 1]) == False) {
         privmsg("error: line number not found");
         break;
     }
     if ($trailing == "") {
         privmsg("error: no code to insert");
         break;
     }
     array_splice($script_lines, $line_no - 1, 0, $trailing);
     $data_changed = True;
     privmsg("script line inserted");
     break;
Exemplo n.º 4
0
function status($account, $params = "")
{
    global $player_data;
    global $map_data;
    global $dest;
    if (player_ready($account) == False) {
        return;
    }
    $public = False;
    if (isset($player_data[$account]["flags"]["public_status"]) == True) {
        $public = True;
    }
    if ($params != "") {
        $params = explode(" ", $params);
        if (count($params) != 2) {
            status_msg($account, "syntax: [~civ] status [x y]", $public);
            return;
        }
        $x = $params[0];
        $y = $params[1];
        if (exec_is_integer($x) == False or exec_is_integer($y) == False) {
            status_msg($account, "error: coordinates must be two positive integers", $public);
            return;
        }
        if ($x < 0 or $x >= $map_data["cols"] or $y < 0 or $y >= $map_data["rows"]) {
            status_msg($account, "error: coordinate {$x},{$y} is outside the map", $public);
            return;
        }
        $terrain = $map_data["coords"][map_coord($map_data["cols"], $x, $y)];
        if (is_fogged($account, $x, $y) == True) {
            status_msg($account, "coordinate {$x},{$y} is fogged", $public);
            return;
        }
        $owner = "";
        $units = array();
        foreach ($player_data as $player => $data) {
            for ($i = 0; $i < count($player_data[$player]["units"]); $i++) {
                $unit = $player_data[$player]["units"][$i];
                if ($unit["x"] == $x and $unit["y"] == $y) {
                    if ($owner == "") {
                        $owner = $player;
                    } elseif ($owner != $player) {
                        status_msg($account, "error: multiple players have assets at {$x},{$y}", $public);
                        return;
                    }
                    $units[] = $unit;
                }
            }
        }
        $cities = array();
        foreach ($player_data as $player => $data) {
            for ($i = 0; $i < count($player_data[$player]["cities"]); $i++) {
                $city = $player_data[$player]["cities"][$i];
                if ($city["x"] == $x and $city["y"] == $y) {
                    if ($owner == "") {
                        $owner = $player;
                    } elseif ($owner != $player) {
                        status_msg($account, "error: multiple players have assets at {$x},{$y}", $public);
                        return;
                    }
                    $cities[] = $city;
                }
            }
        }
        if (count($cities) == 0 and count($units) == 0) {
            status_msg($account, "coordinate {$x},{$y} ({$terrain}) is currently unoccupied", $public);
            return;
        }
        if (count($cities) > 1) {
            status_msg($account, "error: multiple cities at {$x},{$y}", $public);
            return;
        }
        status_msg($account, "status for coordinate {$x},{$y} ({$terrain}): occupied by {$owner}", $public);
        if (count($cities) > 0) {
            status_msg($account, "city: " . $cities[0]["name"], $public);
        }
        status_msg($account, "units: " . count($units), $public);
    } else {
        $i = $player_data[$account]["active"];
        $unit = $player_data[$account]["units"][$i];
        $index = $unit["index"];
        $type = $unit["type"];
        $health = $unit["health"];
        $x = $unit["x"];
        $y = $unit["y"];
        $n = count($player_data[$account]["units"]);
        if (isset($player_data[$account]["status_messages"]) == True) {
            $unique_messages = array_count_values($player_data[$account]["status_messages"]);
            foreach ($unique_messages as $msg => $count) {
                if ($count > 1) {
                    $msg = $msg . " (x{$count})";
                }
                status_msg($account, $dest . " {$account} => {$msg}", $public);
            }
            unset($player_data[$account]["status_messages"]);
        }
        status_msg($account, $dest . " {$account} => {$index}/{$n}, {$type}, +{$health}, ({$x},{$y})", $public);
    }
}