Beispiel #1
0
                $Player_ID = monster_data('ID');
                exec_db("UPDATE Caranille_Accounts SET Account_Notoriety= Account_Notoriety + 1 WHERE Account_ID= {$Player_ID}");
            }
            if ($_SESSION['Dungeon_Battle'] == 1) {
                $Town_Price_INN = htmlspecialchars(addslashes($information_Town['Town_Price_INN']));
                $message = 'Vous êtes morts...<br />Vous avez été emmené d\'urgence à l\'auberge et les soins vous ont été facturé ' . $Town_Price_INN . ' Pièce d\'or<br />';
                $HP_recup = $full_life;
            }
            if ($_SESSION['Chapter_Battle'] == 1) {
                $HP_recup = $full_life * ($percent_life_restore_chapter / 100);
                debug_log("HP_recup::{$HP_recup} = {$full_life}*({$percent_life_restore_chapter}/100)");
                $_final .= $Chapter_Level['Chapter_Defeate'];
            }
            if ($_SESSION['Mission_Battle'] == 1) {
                $Town_Price_INN = htmlspecialchars(addslashes($information_Town['Town_Price_INN']));
                $_final .= $Mission['Mission_Defeate'];
                $_final .= '<br />Vous avez été emmené d\'urgence à l\'auberge et les soins vous ont été facturé ' . $Town_Price_INN . ' Pièce d\'or<br />';
            }
            if (isset($message)) {
                add_diary($message);
                $_final .= $message;
            }
            user_set('Account_HP_Remaining', $HP_recup);
            $_final .= '<br /><br /><form method="POST" action="' . $return . '">';
            $_final .= '<input type="submit" name="End" value="Continuer">';
            $_final .= '</form>';
        }
        user_record();
        // mise à jour en base du joueur
    }
}
Beispiel #2
0
     } elseif ($Magic_Type == "Health") {
         //non utilisé ???
         //$Monster_MIN_Defense = htmlspecialchars(addslashes($_SESSION['Monster_Defense'])) / $bonus_malus_battle;
         //$Monster_MAX_Defense = htmlspecialchars(addslashes($_SESSION['Monster_Defense'])) * $bonus_malus_battle;
         $Player_Health = mt_rand($MIN_Magic, $MAX_Magic) + $Magic_Effect;
         $Life_Difference = perso_data('HP_Total') - htmlspecialchars(addslashes($_SESSION['HP']));
         if ($Player_Health >= $Life_Difference) {
             $_SESSION['HP'] = htmlspecialchars(addslashes($_SESSION['HP'])) + htmlspecialchars(addslashes($Life_Difference));
             $Player_Health = htmlspecialchars(addslashes($Player_Health));
         } else {
             $_SESSION['HP'] = htmlspecialchars(addslashes($_SESSION['HP'])) + htmlspecialchars(addslashes($Player_Health));
         }
         $Monster_Image = monster_data('Image');
         $message = "{$Magic_Choice} vous a soigné de {$Player_Health} <br /><br />";
     }
     user_set('Account_MP_Remaining', $Remaining_MP);
     user_record();
     $Total_Damage_Monster = getMonsterDamage();
     $message .= "Le " . monster_data('Name') . " vous a infligé {$Total_Damage_Monster} HP de dégat<br /><br />";
     add_diary($message);
     $roaster_action = true;
 } else {
     $message = 'Vous n\'avez pas assez de MP';
 }
 /**
 					echo "<img src=\"$Monster_Image\"/><br />";
 					echo $message ;
 					echo '<form method="POST" action="'.get_link('Battle','Game').'">';
 					echo '<input type="submit" name="Continue" value="continuer">';
 					echo '</form>';
 				**/
Beispiel #3
0
/**
 * Vérification pour savoir si le joueur monte de niveau
 */
function get_new_level()
{
    global $Account_Data;
    $Next_Level = 2;
    $Account_Level = 1;
    $Experience = 0;
    $Level_Experience_Required = 0;
    if (empty($Account_Data)) {
        get_perso(logged_data('Account_Pseudo'));
    }
    if (verif_connect(true)) {
        if (user_has('Account_Experience')) {
            $Experience = user_data('Account_Experience');
        }
        if (user_has('Level_Experience_Required')) {
            $Level_Experience_Required = user_data('Level_Experience_Required');
        }
        if (user_has('Account_Level')) {
            $Account_Level = user_data('Account_Level');
        }
        if ($Experience < 0) {
            $Experience = 0;
        }
        $gain = 0;
        if ($Experience >= $Level_Experience_Required) {
            while ($Experience >= $Level_Experience_Required) {
                $Level_Data = get_db('get_level_exp_req', array('Account_Level' => $Account_Level + 1));
                if (!empty($Level_Data)) {
                    $Level_Experience_Required = $Level_Data['Level_Experience_Required'];
                    $gain++;
                    debug_log("theorical calcul level :: (" . ($Account_Level + $gain));
                    if ($Experience < $Level_Experience_Required) {
                        break;
                    }
                } else {
                    debug_log("level max");
                    break;
                }
            }
            user_set('Level_Experience_Required', $Level_Experience_Required);
            $message = "Votre personnage vient de gagner [" . $gain . "] niveau\\nIl est maintenant au niveau : {$Account_Level}";
            add_diary($message);
        }
        update_db('Caranille_Accounts', array('Account_Level' => $Account_Level + $gain, 'Account_Experience' => $Experience, 'Account_ID' => user_data('Account_ID')));
        $Next_Level = user_data('Level_Experience_Required') - $Experience;
        if (isset($message) && !empty($message)) {
            echo "<script type=\"text/javascript\"> alert(\"{$message}\"); </script>";
        }
    }
    return $Next_Level;
}
Beispiel #4
0
<?php

if (request_confirm('engage')) {
    if (verifier_token(60, get_link('Roaster', 'Game'), 'roaster-engage-' . $_POST['Account_ID'])) {
        if (user_data('Account_Roaster_ID') == 0) {
            $_POST['Account_Roaster_ID'] = insert_db('Caranille_Roaster', array('Roaster_Member_1' => user_data('Account_ID')));
            user_set('Account_Roaster_ID', $_POST['Account_Roaster_ID']);
            user_record();
        }
        update_db('Caranille_Accounts', stripslashes_r($_POST));
    }
}
Beispiel #5
0
$r = user_delete_avatar($name);
dump($r);
$r = user_create($name, $password, $mail, $locale, $website);
dump($r);
$user_id = user_find($name);
dump($user_id);
if (!$user_id) {
    exit;
}
$r = user_id($user_id);
dump($r);
$r = user_get($user_id);
dump($r);
$mail = '*****@*****.**';
$website = 'www.izend.org';
$r = user_set($user_id, $name, $mail, $website, $locale);
dump($r);
$r = user_get($user_id);
dump($r);
$lastname = 'iZend';
$firstname = 'BarFoo';
$r = user_set_info($user_id, $lastname, $firstname);
dump($r);
$firstname = 'Bar-Foo';
$r = user_set_info($user_id, $lastname, $firstname);
dump($r);
$r = user_get_info($user_id);
dump($r);
$r = user_set_status($user_id, true, false);
dump($r);
$r = user_get_role($user_id);
Beispiel #6
0
function useredit($lang, $user_id)
{
    global $system_languages, $supported_roles;
    $is_admin = user_has_role('administrator');
    $is_owner = $user_id == user_profile('id');
    $with_name = true;
    $with_status = ($user_id != 1 and $is_admin);
    $with_delete = ($user_id != 1 and $is_admin and !$is_owner);
    $with_newpassword = false;
    // ($user_id != 1 and $is_owner);
    $with_locale = count($system_languages) > 1 ? true : false;
    $with_role = ($user_id != 1 and $is_admin);
    $with_timezone = ($user_id != 1 and $is_admin);
    $with_website = true;
    $with_info = false;
    $confirmed = false;
    $action = 'init';
    if (isset($_POST['useredit_modify'])) {
        $action = 'modify';
    }
    if ($with_newpassword) {
        if (isset($_POST['useredit_change'])) {
            $action = 'change';
        }
    }
    if ($with_delete) {
        if (isset($_POST['useredit_delete'])) {
            $action = 'delete';
        } else {
            if (isset($_POST['useredit_confirmdelete'])) {
                $action = 'delete';
                $confirmed = true;
            } else {
                if (isset($_POST['useredit_cancel'])) {
                    $action = 'cancel';
                }
            }
        }
    }
    $user_name = $user_mail = $user_locale = $user_timezone = false;
    $user_website = false;
    $user_active = $user_banned = false;
    $user_accessed = false;
    $user_role = false;
    $user_newpassword = false;
    $user_lastname = $user_firstname = false;
    $token = false;
    switch ($action) {
        case 'init':
        case 'reset':
            $r = user_get($user_id);
            if ($r) {
                extract($r);
                /* user_name user_password user_newpassword user_seed user_mail user_timezone user_website user_created user_modified user_accessed user_locale user_active user_banned */
            }
            $user_newpassword = false;
            if ($with_info) {
                $r = user_get_info($user_id);
                if ($r) {
                    extract($r);
                    /* user_lastname, user_firstname */
                }
            }
            if ($with_role) {
                $user_role = user_get_role($user_id);
            }
            break;
        case 'modify':
        case 'change':
        case 'delete':
        case 'cancel':
            if ($with_info) {
                if (isset($_POST['useredit_lastname'])) {
                    $user_lastname = readarg($_POST['useredit_lastname']);
                }
                if (isset($_POST['useredit_firstname'])) {
                    $user_firstname = readarg($_POST['useredit_firstname']);
                }
            }
            if (isset($_POST['useredit_name'])) {
                $user_name = strtolower(strflat(readarg($_POST['useredit_name'])));
            }
            if (isset($_POST['useredit_mail'])) {
                $user_mail = strtolower(strflat(readarg($_POST['useredit_mail'])));
            }
            if (isset($_POST['useredit_website'])) {
                $user_website = strtolower(strflat(readarg($_POST['useredit_website'])));
            }
            if (isset($_POST['useredit_timezone'])) {
                $user_timezone = readarg($_POST['useredit_timezone']);
            }
            if (isset($_POST['useredit_locale'])) {
                $user_locale = readarg($_POST['useredit_locale']);
            }
            if ($with_role) {
                if (isset($_POST['useredit_role'])) {
                    $user_role = readarg($_POST['useredit_role']);
                }
            }
            if ($with_status) {
                if (isset($_POST['useredit_active'])) {
                    $user_active = readarg($_POST['useredit_active']) == 'on';
                }
                if (isset($_POST['useredit_banned'])) {
                    $user_banned = readarg($_POST['useredit_banned']) == 'on';
                }
                if (isset($_POST['useredit_accessed'])) {
                    $user_accessed = (int) readarg($_POST['useredit_accessed']);
                }
            }
            if ($with_newpassword) {
                if (isset($_POST['useredit_newpassword'])) {
                    $user_newpassword = readarg($_POST['useredit_newpassword']);
                }
            }
            if (isset($_POST['useredit_token'])) {
                $token = readarg($_POST['useredit_token']);
            }
            break;
        default:
            break;
    }
    $bad_token = false;
    $missing_lastname = false;
    $missing_firstname = false;
    $missing_name = false;
    $bad_name = false;
    $duplicated_name = false;
    $missing_mail = false;
    $bad_mail = false;
    $duplicated_mail = false;
    $bad_role = false;
    $bad_website = false;
    $missing_locale = false;
    $bad_locale = false;
    $bad_timezone = false;
    $missing_newpassword = false;
    $bad_newpassword = false;
    $account_modified = false;
    $password_changed = false;
    $internal_error = false;
    $contact_page = false;
    switch ($action) {
        case 'modify':
            if (!isset($_SESSION['useredit_token']) or $token != $_SESSION['useredit_token']) {
                $bad_token = true;
            }
            if ($with_info) {
                if (!$user_lastname) {
                    $missing_lastname = true;
                }
                if (!$user_firstname) {
                    $missing_firstname = true;
                }
            }
            if ($with_name and !$user_name) {
                $missing_name = true;
            }
            if ($user_name) {
                if (!validate_user_name($user_name)) {
                    $bad_name = true;
                } else {
                    if (!user_check_name($user_name, $user_id)) {
                        $duplicated_name = true;
                    }
                }
            }
            if (!$user_mail) {
                $missing_mail = true;
            } else {
                if (!validate_mail($user_mail)) {
                    $bad_mail = true;
                } else {
                    if (!user_check_mail($user_mail, $user_id)) {
                        $duplicated_mail = true;
                    }
                }
            }
            if ($user_role) {
                foreach ($user_role as $role) {
                    if (!validate_role($role)) {
                        $bad_role = true;
                        break;
                    }
                }
            }
            if ($user_website) {
                if (!validate_website($user_website)) {
                    $bad_website = true;
                } else {
                    $user_website = normalize_website($user_website);
                }
            }
            if ($user_timezone) {
                if (!validate_timezone($user_timezone)) {
                    $bad_timezone = true;
                }
            }
            if ($with_locale and !$user_locale) {
                $missing_locale = true;
            }
            if ($user_locale) {
                if (!validate_locale($user_locale)) {
                    $bad_locale = true;
                }
            }
            break;
        case 'change':
            if (!$user_newpassword) {
                $missing_newpassword = true;
            } else {
                if (!validate_password($user_newpassword)) {
                    $bad_newpassword = true;
                }
            }
            break;
        default:
            break;
    }
    $confirm_delete = false;
    switch ($action) {
        case 'modify':
            if ($bad_token or $missing_name or $bad_name or $duplicated_name or $missing_mail or $bad_mail or $duplicated_mail or $bad_role or $bad_website or $bad_timezone or $missing_locale or $bad_locale or $missing_lastname or $missing_firstname) {
                break;
            }
            $r = user_set($user_id, $user_name, $user_mail, $user_website, $user_locale, $user_timezone);
            if (!$r) {
                $internal_error = true;
                break;
            }
            if ($is_owner) {
                $_SESSION['user']['name'] = $user_name;
                $_SESSION['user']['mail'] = $user_mail;
                $_SESSION['user']['website'] = $user_website;
                $_SESSION['user']['locale'] = $user_locale;
                $_SESSION['user']['timezone'] = $user_timezone;
            }
            if ($with_info) {
                $r = user_set_info($user_id, $user_lastname, $user_firstname);
                if (!$r) {
                    $internal_error = true;
                    break;
                }
                if ($is_owner) {
                    $_SESSION['user']['lastname'] = $user_lastname;
                    $_SESSION['user']['firstname'] = $user_firstname;
                }
            }
            if ($with_role) {
                $r = user_set_role($user_id, $user_role);
                if (!$r) {
                    $internal_error = true;
                    break;
                }
            }
            if ($with_status) {
                $r = user_set_status($user_id, $user_active, $user_banned);
                if (!$r) {
                    $internal_error = true;
                    break;
                }
            }
            $account_modified = true;
            break;
        case 'change':
            if ($missing_newpassword or $bad_newpassword) {
                break;
            }
            $r = user_set_newpassword($user_id, $user_newpassword);
            if (!$r) {
                $internal_error = true;
                break;
            }
            $password_changed = true;
            break;
        case 'delete':
            if (!$confirmed) {
                $confirm_delete = true;
                break;
            }
            $r = user_delete($user_id);
            if (!$r) {
                $internal_error = true;
                break;
            }
            return false;
        default:
            break;
    }
    $user_newpassword = false;
    if ($internal_error) {
        $contact_page = url('contact', $lang);
    }
    $_SESSION['useredit_token'] = $token = token_id();
    $errors = compact('missing_name', 'bad_name', 'duplicated_name', 'missing_mail', 'bad_mail', 'duplicated_mail', 'bad_timezone', 'bad_website', 'missing_locale', 'bad_locale', 'missing_newpassword', 'bad_newpassword', 'missing_lastname', 'missing_firstname', 'internal_error', 'contact_page');
    $infos = compact('account_modified', 'password_changed');
    $output = view('useredit', $lang, compact('token', 'errors', 'infos', 'with_name', 'user_name', 'user_mail', 'with_timezone', 'user_timezone', 'with_website', 'user_website', 'with_role', 'user_role', 'supported_roles', 'with_locale', 'user_locale', 'with_status', 'user_banned', 'user_active', 'user_accessed', 'with_newpassword', 'user_newpassword', 'with_info', 'user_lastname', 'user_firstname', 'with_delete', 'confirm_delete'));
    return $output;
}
Beispiel #7
0
//include_once(path_source("Index","Battle","Battle"));
include_once "Battle/Index.php";
//path_source("Index","Battle"));
$title = "Affrontement";
$ID = user_data('Account_ID');
if (verif_connect()) {
    //Si le joueur est dans une ville, on regarde si il est actuellement en combat
    if (verif_battle()) {
        $roaster_action = false;
        //Si l'utilisateur à choisit la fuite
        if (request_confirm('Escape')) {
            $message = "Vous avez fuit le combat";
            if ($_SESSION['Arena_Battle'] == 1) {
                $message .= "Votre fuite de l'arène vous fait perdre 1 points de notorieté<br />";
                user_set('Account_Notoriety', user_data('Account_Notoriety') - 1);
                $Player_ID = monster_data('ID');
                exec_db("UPDATE Caranille_Accounts SET Account_Notoriety= Account_Notoriety + 1 WHERE Account_ID= {$Player_ID};");
            }
            close_battle();
        }
        //Si l'utilisateur continue le combat on vérifie si il y a un gagnant ou un perdant
        if (request_confirm('Continue')) {
            include_once "Battle/Continue.php";
            //include_once(path_source('Continue','Battle','Battle'));
            include_once "Battle/Roaster-continue.php";
            //
        }
        //Si l'utilisateur à choisit attaquer
        if (request_confirm('Attack')) {
            include_once "Battle/Attack.php";
Beispiel #8
0
/** return les degats causé par l'adversaire dans un tour **/
function getMonsterDamage()
{
    global $bonus_malus_battle;
    //Si le joueur est dans une ville, on regarde si il est actuellement en combat
    if (verif_battle(true)) {
        $Monster_MIN_Strength = monster_data('Strength') / $bonus_malus_battle;
        $Monster_MAX_Strength = monster_data('Strength') * $bonus_malus_battle;
        $MIN_Defense = perso_data('Defense_Total') / $bonus_malus_battle;
        $MAX_Defense = perso_data('Defense_Total') * $bonus_malus_battle;
        $Monster_Positive_Damage = mt_rand($Monster_MIN_Strength, $Monster_MAX_Strength);
        $Monster_Negative_Damage = mt_rand($MIN_Defense, $MAX_Defense);
        $Total_Damage_Monster = htmlspecialchars(addslashes($Monster_Positive_Damage)) - htmlspecialchars(addslashes($Monster_Negative_Damage));
        //Si les dégats du monstre sont égal ou inférieur à zero
        if ($Total_Damage_Monster <= 0) {
            $Total_Damage_Monster = 0;
        }
        //$Remaining_HP = htmlspecialchars(addslashes(user_data('Account_HP_Remaining'))) - htmlspecialchars(addslashes($Total_Damage_Monster));
        //update_db('Caranille_Accounts',array('Account_HP_Remaining'=> $Remaining_HP, 'Account_ID'=> user_data('Account_ID') ));
        user_set('Account_HP_Remaining', user_data('Account_HP_Remaining') - $Total_Damage_Monster);
        user_record();
        return $Total_Damage_Monster;
    }
    return 0;
}
Beispiel #9
0
<?php

/** rien à faire ici **/
load_css('corps.css', 'corps');
if (verif_connect()) {
    // action dans l'inventaire
    if (request_confirm('chara-design')) {
        if (request_confirm('Roaster')) {
            user_set('Account_Roaster_Accept', $_POST['Roaster']);
        }
        user_record();
    }
}
Beispiel #10
0
     $extension_upload = strtolower(substr(strrchr($_FILES['avatar']['name'], '.'), 1));
     if (!in_array($extension_upload, $extensions_valides)) {
         $i++;
         $e_av = true;
         $avatar_erreur3 = "Extension de l'avatar incorrecte";
     }
     if (!$e_av) {
         $ft = fopen($_FILES['avatar']['tmp_name'], "r");
         $imgbinary = fread($ft, filesize($_FILES['avatar']['tmp_name']));
         $data = base64_encode($imgbinary);
         $nomavatar = 'data:' . $_FILES['avatar']['type'] . ';base64,' . $data;
         //move_avatar($_FILES['avatar']);
         user_set('Account_Avatar', $nomavatar);
     }
 } elseif (request_confirm('delete')) {
     user_set('Account_Avatar', "");
 }
 $_return .= '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Modification du profil';
 $_return .= '<h1>Modification d\'un profil</h1>';
 if ($i == 0) {
     $_return .= '<h1>Modification terminée</h1>';
     $_return .= '<p>Votre profil a été modifié avec succès !</p>';
     $_return .= '<p>Cliquez <a href="./index.php">ici</a> pour revenir à la page d accueil</p>';
 } else {
     $_return .= '<h1>Modification interrompue</h1>';
     $_return .= '<p>Une ou plusieurs erreurs se sont produites pendant la modification du profil</p>';
     $_return .= '<p>' . $i . ' erreur(s)</p>';
     $_return .= '<p>' . $signature_erreur . '</p>';
     $_return .= '<p>' . $avatar_erreur . '</p>';
     $_return .= '<p>' . $avatar_erreur1 . '</p>';
     $_return .= '<p>' . $avatar_erreur2 . '</p>';