This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/beta5/tech/library/makeOffer.inc

29 lines
722 B
PHP

<?php
class beta5_tech_makeOffer {
function beta5_tech_makeOffer($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
$this->msg = $this->lib->game->getLib('beta5/msg');
}
// Makes a research offer
function run($cpid, $tpid, $tid, $pr) {
$tm = time();
$this->db->query(
"INSERT INTO research_assistance(player,price,offer_to,moment" . (is_null($tid) ? "" : ",technology") . ")"
. " VALUES($cpid,$pr,$tpid,$tm" . (is_null($tid) ? "" : ",$tid") . ")"
);
$q = $this->db->query("SELECT id FROM research_assistance WHERE player=$cpid AND moment=$tm");
list($aid) = dbFetchArray($q);
$this->msg->call('send', $tpid, 'resdipl', array(
'offer' => $aid,
'msg_id' => 0
));
}
}
?>