From f30196b6cb4a096922770a0c425929f9dec0ba72 Mon Sep 17 00:00:00 2001 From: hecht Date: Tue, 6 Sep 2011 20:53:43 +0000 Subject: [PATCH] added the "interfaces" for the clan fights --- ag/include/char.inc.php | 13 +++++++++++-- ag/include/clan.inc.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/ag/include/char.inc.php b/ag/include/char.inc.php index e1b25fe..710629a 100644 --- a/ag/include/char.inc.php +++ b/ag/include/char.inc.php @@ -297,7 +297,7 @@ function getAttacksforChar($charid, $mode = 0) { // $sql = 'select a.name, a.id, a.level, if(find_in_set(\'0\', req_atk) = 0, a.req_atk, substr(a.req_atk, 1, locate(\',0\', a.req_atk) - 1)) as req_atk , geld, ifnull((select l.benutzt from lernen l where l.besitzer = '.$char['id'].' and at_id = a.id),0) as benutzt, a.id not in (select l.at_id from lernen l where l.besitzer = '.$char['id'].') as unknown from attacken a where find_in_set('.$char_race.', a.rassen) order by level'; $sql_append = ''; - + if($char['frucht'] !== NULL) { $sql_append1 = ' OR (frucht = (Select id from wochen_markt where item = \''.$char['frucht'].'\')) '; $sql_append2 = ' AND (frucht <> (Select id from wochen_markt where item = \''.$char['frucht'].'\')) '; @@ -310,7 +310,7 @@ function getAttacksforChar($charid, $mode = 0) { // make a union out of both (TODO: maybe an outer join would result into the same result) $sql = '('.$sql.') union distinct ('.$sql2.') order by level'; - + $qry = mysql_query($sql); if($qry === FALSE) // print sql on error echo '
'.$sql.'
'; @@ -380,5 +380,14 @@ function getAttacksforChar($charid, $mode = 0) { return $overview; } +/** + * This function reads out the attack set of the char + * @param string $name + * @param int $char_id + */ +function getAttackenSet($name, $char_id) { + // TODO: Further implementation + return NULL; +} ?> diff --git a/ag/include/clan.inc.php b/ag/include/clan.inc.php index 3b8d03f..d5e6045 100644 --- a/ag/include/clan.inc.php +++ b/ag/include/clan.inc.php @@ -78,4 +78,33 @@ function inviteUser(array $user, $userid, array $clan = NULL){ } } + + +function challengeClan(array $user, array $charids, $clanid, $validTime = 24) { + if($clan === NULL) { + $qry = mysql_query('Select * from clan where id = ' . $user['clan']); + $clan = mysql_fetch_assoc($qry); + } + + if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){ + return 'Nur der Leader, bzw. der Co-Leader kann andere Clans herausfordern!!'; + } + // TODO: Further implementation + return NULL; +} + +function acceptChallenge(array $user, array $charids) { + if($clan === NULL) { + $qry = mysql_query('Select * from clan where id = ' . $user['clan']); + $clan = mysql_fetch_assoc($qry); + } + + if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){ + return 'Nur der Leader, bzw. der Co-Leader kann herausforderungen anderer Clans annehmen!!'; + } + // TODO: Further implementation + return NULL; + +} + ?> \ No newline at end of file