@ -209,6 +209,7 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
</tr>
<?php
if($ownclan) {
if(isClanNewsletterAvailable($clan['id'])) {
?>
<tr>
<td> </td>
@ -236,6 +237,17 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
</td>
</tr>
<?php
}
else {
?>
<tr>
<td> </td>
</tr>
<tr>
<thheight="18"valign="top"width="603"colspan="2"class="content">Clannachrichten erst ab Level <?phpechoCLAN_LVL_NEWSLETTER;?> verfügbar</th>
</tr>
<?php
}
}
?>
</table>
@ -385,33 +397,48 @@ function displayClanProfileEditable($clan, $userid){
href="javascript:if(confirm('Wirklich auflösen? der Clan kann ggf. durch jemand übernommen werden!')==true) window.location.href='index.php?as=clan/clan_info&action=kill'">Clan
auflösen (Achtung! Clans ggf. nur geleert!)</a></td>
@ -67,6 +70,21 @@ function getClanMemberBonusByLevel($level) {
}
}
function getMoneyBonusByLevel($level) {
switch($level) {
case 12:
case 14:
case 16:
case 17:
return 100000;
default:
return 0;
}
}
function getMaximumMembers($clanid) {
// okay, this is a more tricky calculation as this requires the information (are leader and co_leader the same person??)
// the second parameter is the clan level. Each 2 levels (where the maximum clan level is about 20) one more member can
@ -310,10 +328,17 @@ function setMeAsLeader($user){
}
function sendClanNewsletter($user, $text){
$qry = mysql_query('SELECT * FROM clan WHERE id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
function isClanNewsletterAvailable($clanid) {
$clan = getClan($clanid);
return $clan['level'] >= CLAN_LVL_NEWSLETTER;
}
function sendClanNewsletter($user, $text){
$clan = getClan($user['clan']);
if(!isClanNewsletterAvailable($clan['id'])) {
displayErrorMessage(NULL,'Dein Clan hat noch nicht das ausreichende Level um Clannachrichten zu senden!', '<ahref="index.php?as=clan/clan_info">weiter...</a>');
return;
}
$errors = FALSE;
$sql = 'SELECT id FROM user WHERE clan='.$user['clan'];
$clans = mysql_query($sql);
@ -328,6 +353,7 @@ function sendClanNewsletter($user, $text){
}
function addClanExp($clan_id, $exp) {
$clan = getClan($clan_id, false);
if($clan['level'] == 18)
@ -342,8 +368,14 @@ function addClanExp($clan_id, $exp) {
mysql_query('UPDATE clan SET exp = ' .$n_exp. ', level = ' .$n_level . ' WHERE id = ' .$clan_id . ' AND exp = ' .$clan['exp'] . ' AND level = ' .$clan['level']);
if(mysql_affected_rows() == 0) {
echo 'Fehler beim zuweisen der Clanexp, dadurch sind dem Clan mit der ID ' . $clan['level'] . ' ' .$exp . ' exp fl&omul;ten gegangen!! Neue exp wären ' . $n_exp . ' bei level ' .$n_level;
} else {
$money = getMoneyBonusByLevel($n_level);
if($money > 0) {
// nice we can give the clan some money :D
insertClanTickerMessage($clan_id, 'Durch Erreichen von Level ' .$n_level . ' habt ihr ' . displayMoney($money) . ' bekommen!!');
mysql_query('UPDATE clan SET geld = geld + ' . $money . ' WHERE id = ' .$clan_id );