added the restrictions and bonus features for clan level

main
hecht 13 years ago
parent f1e637413f
commit 7fc421699a

@ -209,6 +209,7 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
</tr> </tr>
<?php <?php
if($ownclan) { if($ownclan) {
if(isClanNewsletterAvailable($clan['id'])) {
?> ?>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
@ -236,6 +237,17 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
</td> </td>
</tr> </tr>
<?php <?php
}
else {
?>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<th height="18" valign="top" width="603" colspan="2" class="content">Clannachrichten erst ab Level <?php echo CLAN_LVL_NEWSLETTER;?> verf&uuml;gbar</th>
</tr>
<?php
}
} }
?> ?>
</table> </table>
@ -385,33 +397,48 @@ function displayClanProfileEditable($clan, $userid){
href="javascript:if(confirm('Wirklich aufl&ouml;sen? der Clan kann ggf. durch jemand &uuml;bernommen werden!')==true) window.location.href='index.php?as=clan/clan_info&action=kill'">Clan href="javascript:if(confirm('Wirklich aufl&ouml;sen? der Clan kann ggf. durch jemand &uuml;bernommen werden!')==true) window.location.href='index.php?as=clan/clan_info&action=kill'">Clan
aufl&ouml;sen (Achtung! Clans ggf. nur geleert!)</a></td> aufl&ouml;sen (Achtung! Clans ggf. nur geleert!)</a></td>
</tr> </tr>
<tr> <?php
<td>&nbsp;</td> if(isClanNewsletterAvailable($clan['id'])) {
</tr> ?>
<tr> <tr>
<td colspan="2"> <td>&nbsp;</td>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET"> </tr>
<input type="hidden" name="as" value="clan/clan_info"> <input <tr>
type="hidden" name="action" value="newsletter"> <td colspan="2">
<table cellpadding="0" cellspacing="0" width="100%" height="69"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<tr> <input type="hidden" name="as" value="clan/clan_info"> <input
<th height="18" valign="top" width="603" colspan="2" type="hidden" name="action" value="newsletter">
class="content">Nachricht an alle Clanmember schicken</th> <table cellpadding="0" cellspacing="0" width="100%" height="69">
</tr> <tr>
<tr> <th height="18" valign="top" width="603" colspan="2"
<td height="25" valign="top" colspan="2" align="center">&nbsp;<textarea class="content">Nachricht an alle Clanmember schicken</th>
class="input" rows="8" name="text" cols="40"></textarea></td> </tr>
</tr> <tr>
<tr> <td height="25" valign="top" colspan="2" align="center">&nbsp;<textarea
<td height="25" valign="top" colspan="2" align="center">&nbsp;<input class="input" rows="8" name="text" cols="40"></textarea></td>
class="input" type="submit" value="abschicken"></td> </tr>
</tr> <tr>
</table> <td height="25" valign="top" colspan="2" align="center">&nbsp;<input
</form> class="input" type="submit" value="abschicken"></td>
</td> </tr>
</tr> </table>
</form>
</table> </td>
</tr>
<?php
}
else {
?>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<th height="18" valign="top" width="603" colspan="2" class="content">Clannachrichten erst ab Level <?php echo CLAN_LVL_NEWSLETTER;?> verf&uuml;gbar</th>
</tr>
<?php
}
?>
</table>
<?php <?php
} }
@ -482,7 +509,7 @@ function setProfile($user, $what, $value1, $value2, $clanid, $rootlvl){
// okay, now apply the changes!! --> first filter the values of value2 that are in value1 // okay, now apply the changes!! --> first filter the values of value2 that are in value1
$value2 = array_diff($value2, $value1); $value2 = array_diff($value2, $value1);
$clan = getClan($clanid); $clan = getClan($clanid);
// now kick some asses ;) // now kick some asses ;)
foreach($value1 as $member) { foreach($value1 as $member) {
if($clan['leader'] == $member || $clan['coleader'] == $member) { if($clan['leader'] == $member || $clan['coleader'] == $member) {
@ -492,7 +519,7 @@ function setProfile($user, $what, $value1, $value2, $clanid, $rootlvl){
fireMember($user, $member); fireMember($user, $member);
} }
updateAuthorizedClanfightCoordinators($clanid, $value2); updateAuthorizedClanfightCoordinators($clanid, $value2);
displayEdit($what, $clanid, $rootlvl); displayEdit($what, $clanid, $rootlvl);
return NULL; return NULL;
default: default:
@ -563,20 +590,20 @@ function displayEdit($what, $clanid, $rootlvl){
$member[] = $row; $member[] = $row;
} }
} }
$i = 0; $i = 0;
// Kay, first display the chief // Kay, first display the chief
if($leader != NULL) { if($leader != NULL) {
$content .= '<tr><td align="center">' . $leader['nickname'] . '</td><td align="center"><input name="value1['.$i.']" type="checkbox" disabled="disabled" value="'. $leader['id'] .'" /></td><td align="center"><input name="value2['.$i.']" type="checkbox" disabled="disabled" checked="checked" value="'. $leader['id'] .'" /></td></tr>'.PHP_EOL; $content .= '<tr><td align="center">' . $leader['nickname'] . '</td><td align="center"><input name="value1['.$i.']" type="checkbox" disabled="disabled" value="'. $leader['id'] .'" /></td><td align="center"><input name="value2['.$i.']" type="checkbox" disabled="disabled" checked="checked" value="'. $leader['id'] .'" /></td></tr>'.PHP_EOL;
$i++; $i++;
} }
if($coleader != null) { if($coleader != null) {
$content .= '<tr><td align="center">' . $coleader['nickname'] . '</td><td align="center"><input name="value1['.$i.']" type="checkbox" disabled="disabled" value="'. $coleader['id'] .'" /></td><td align="center"><input name="value2['.$i.']" type="checkbox" disabled="disabled" checked="checked" value="'. $coleader['id'] .'" /></td></tr>'.PHP_EOL; $content .= '<tr><td align="center">' . $coleader['nickname'] . '</td><td align="center"><input name="value1['.$i.']" type="checkbox" disabled="disabled" value="'. $coleader['id'] .'" /></td><td align="center"><input name="value2['.$i.']" type="checkbox" disabled="disabled" checked="checked" value="'. $coleader['id'] .'" /></td></tr>'.PHP_EOL;
$i++; $i++;
} }
foreach($member as $memb) { foreach($member as $memb) {
if(in_array($memb['id'], $authorized)) { if(in_array($memb['id'], $authorized)) {
$checked = 'checked="checked"'; $checked = 'checked="checked"';
@ -585,11 +612,11 @@ function displayEdit($what, $clanid, $rootlvl){
} }
$content .= '<tr><td align="center">' . $memb['nickname'] . '</td><td align="center"><input name="value1['.$i.']" value="'.$memb['id'].'" type="checkbox"/></td><td align="center"><input name="value2['.$i.']" value="'.$memb['id'].'" type="checkbox" '.$checked.'/></td></tr>'.PHP_EOL; $content .= '<tr><td align="center">' . $memb['nickname'] . '</td><td align="center"><input name="value1['.$i.']" value="'.$memb['id'].'" type="checkbox"/></td><td align="center"><input name="value2['.$i.']" value="'.$memb['id'].'" type="checkbox" '.$checked.'/></td></tr>'.PHP_EOL;
$i++; $i++;
} }
$content .= '<tr><td align="center" colspan="3"><hr /></td></tr>'.PHP_EOL; $content .= '<tr><td align="center" colspan="3"><hr /></td></tr>'.PHP_EOL;
$content .= '</table>'.PHP_EOL.'</td></tr>'; $content .= '</table>'.PHP_EOL.'</td></tr>';
break; break;
case 'ERROR': case 'ERROR':
break; break;

@ -9,7 +9,10 @@
include_once (ROOT_PATH . '/include/defines.inc.php'); include_once (ROOT_PATH . '/include/defines.inc.php');
include_once (ROOT_PATH . '/include/clan_fights.inc.php'); include_once (ROOT_PATH . '/include/clan_fights.inc.php');
include_once (ROOT_PATH . '/include/exp.inc.php'); include_once (ROOT_PATH . '/include/exp.inc.php');
include_once (ROOT_PATH . '/include/messagefunctions.inc.php');
include_once (ROOT_PATH . '/include/designfunctions.inc.php');
defineIfNotDefined('CLAN_LVL_NEWSLETTER', 2);
defineIfNotDefined('MAX_CHARS_CLANSIGN', 8); defineIfNotDefined('MAX_CHARS_CLANSIGN', 8);
$GLOBALS['clan_buffered_instances'] = array (); $GLOBALS['clan_buffered_instances'] = array ();
@ -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) { function getMaximumMembers($clanid) {
// okay, this is a more tricky calculation as this requires the information (are leader and co_leader the same person??) // 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 // 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){ function isClanNewsletterAvailable($clanid) {
$qry = mysql_query('SELECT * FROM clan WHERE id = ' . $user['clan']); $clan = getClan($clanid);
$clan = mysql_fetch_assoc($qry); 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!', '<a href="index.php?as=clan/clan_info">weiter...</a>');
return;
}
$errors = FALSE; $errors = FALSE;
$sql = 'SELECT id FROM user WHERE clan='.$user['clan']; $sql = 'SELECT id FROM user WHERE clan='.$user['clan'];
$clans = mysql_query($sql); $clans = mysql_query($sql);
@ -328,6 +353,7 @@ function sendClanNewsletter($user, $text){
} }
function addClanExp($clan_id, $exp) { function addClanExp($clan_id, $exp) {
$clan = getClan($clan_id, false); $clan = getClan($clan_id, false);
if($clan['level'] == 18) 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']); 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) { 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&auml;ren ' . $n_exp . ' bei level ' .$n_level; echo 'Fehler beim zuweisen der Clanexp, dadurch sind dem Clan mit der ID ' . $clan['level'] . ' ' .$exp . ' exp fl&omul;ten gegangen!! Neue exp w&auml;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 );
}
} }
} }
?> ?>

Loading…
Cancel
Save