Example #1
0
function ModCliForn($array, $ToMod, $db)
{
    // Converte la lettera iniziale in maiuscolo:
    foreach ($array as $key => $field) {
        $array[$key] = ucfirst($field);
    }
    $Tipo = $array['id_tipo'];
    $array['id_tipo'] = GetIdTipo($array['id_tipo'], $db);
    if (trim($array['rag_soc']) == "") {
        $array['rag_soc'] = $array['nome'] . ' ' . $array['cognome'];
    }
    /*
     * Compongo la query con i dati provenienti dall'array del post:
     */
    $q = "UPDATE tab_anagrafica SET ";
    foreach ($array as $key => $field) {
        if ($key != "salva") {
            $q .= "{$key}='{$field}', ";
        }
    }
    $q .= "WHERE id_anag='{$ToMod}'";
    $q = str_replace(", WHERE", "WHERE", $q);
    /*
     * Query completata.
     */
    $r = mysql_query($q, $db) or die(StampaErr($q, '[ModCliForn] '));
    $status = "<label class=\"ok\">Il {$Tipo} รจ stato modificato correttamente.</label>";
    return $status;
}
Example #2
0
function LeggiIdentificazioneAnathema($Text)
{
    global $d;
    $Identificazione = array();
    //~OK Gimnir ti dice 'Informazioni su una cintura di pelle di troll:'
    //~NO Gimnir ti dice 'Keywords: una cintura'
    //~OK Gimnir ti dice 'Tipo: armor'
    //~OK Gimnir ti dice 'Questo oggetto e': none' // extra FLAG
    //~OK Gimnir ti dice 'Questo oggetto ha le seguenti capacita' magiche: none' // magic flag
    //~OK Gimnir ti dice 'Questo oggetto e' di livello: 7 e costa d'affitto: 0.'
    //~OK Gimnir ti dice che la classe armatura base dell'oggetto e' 0.
    //~OK Effetti:       pf regen  per   1.
    //~OK Gimnir ti dice 'Informazioni su una bisaccia ingioiellata:'
    //~NO Gimnir ti dice 'Keywords: bisaccia ingioiellata'
    //~OK Gimnir ti dice 'Tipo: armor'
    //~OK Gimnir ti dice 'Questo oggetto e': magico antineutrale anticombattenti organico'
    //~OK Gimnir ti dice 'Questo oggetto ha le seguenti capacita' magiche: none'
    //~OK Gimnir ti dice 'Questo oggetto e' di livello: 51 e costa d'affitto: 0.'
    //~OK Gimnir ti dice che la classe armatura base dell'oggetto e' 8.
    $Identificazione['ac'] = "-";
    $Identificazione['danno'] = "-";
    $Identificazione['prop'] = "-";
    $Identificazione['modi'] = "-";
    $Identificazione['id_slot'] = "21";
    if (preg_match("(Gimnir ti dice (.*))", $Text, $Match)) {
        if (preg_match("(Gimnir ti dice 'Informazioni su (.*):)", $Text, $Match)) {
            $Identificazione['nome'] = $Match[1];
        }
        if (preg_match("(Gimnir ti dice 'Tipo: (.*)')", $Text, $Match)) {
            $Identificazione['id_tipo'] = GetIdTipo(trim($Match[1]));
        }
        if (preg_match("(Gimnir ti dice 'Questo oggetto e': (.*)')", $Text, $Match)) {
            $Identificazione['prop'] = $Match[1];
        }
        if (preg_match("(Gimnir ti dice 'Questo oggetto ha le seguenti capacita' magiche: (.*)')", $Text, $Match)) {
            $Identificazione['magic_flag'] = $Match[1];
        }
        if (preg_match("(Gimnir ti dice 'Questo oggetto e' di livello: (.*) e costa d'affitto: (.*)\\.')", $Text, $Match)) {
            $Identificazione['liv'] = trim($Match[1]);
            $Identificazione['rent'] = trim($Match[2]);
        }
        if (preg_match("(Gimnir ti dice che la classe armatura base dell'oggetto e' (.*)\\.)", $Text, $Match)) {
            $Identificazione['ac'] = $Match[1];
        }
    } else {
        if (preg_match("(Oggetto: (.*)\n)", $Text, $Match)) {
            $Identificazione['nome'] = ucfirst($Match[1]);
        }
        if (preg_match("(Vnum: (.*)\n)", $Text, $Match)) {
            $Identificazione['vnum'] = $Match[1];
        }
        if (preg_match("(Tipo: (.*)\n)", $Text, $Match)) {
            $Identificazione['id_tipo'] = GetIdTipo(trim($Match[1]));
        }
        if (preg_match("(Extra Flag: (.*)\n)", $Text, $Match)) {
            $Identificazione['prop'] = $Match[1];
        }
        if (preg_match("(Flag Magici: (.*)\n)", $Text, $Match)) {
            $Identificazione['magic_flag'] = $Match[1];
        }
        if (preg_match("(Affitto: (.*) Livello: (.*))", $Text, $Match)) {
            $Identificazione['rent'] = trim($Match[1]);
            $Identificazione['liv'] = trim($Match[2]);
        }
        if (preg_match("(Classe armatura: (.*))", $Text, $Match)) {
            $Identificazione['ac'] = $Match[1];
        }
    }
    if (preg_match("(Si indossa : prendibile (.*)\n)", $Text, $Match)) {
        $temp_var = $d->GetRows("*", "tab_slot", "slot LIKE '%" . trim($Match[1]) . "%'", "", "", 1);
        $Identificazione['id_slot'] = $temp_var[0]['id_slot'];
    }
    if (preg_match_all("(Effetti: (.*))", $Text, $Match)) {
        $Identificazione['modi'] = "";
        foreach ($Match[1] as $key => $field) {
            $Identificazione['modi'] .= trim(str_replace(".", "", $field)) . ".\n";
        }
        //~ $Identificazione['modi'] = join(".\n", $Match[1]);
    }
    if (preg_match("(Spazi per le rune: (.*)\n)", $Text, $Match)) {
        $Identificazione['spazi_rune'] = $Match[1];
    }
    if (preg_match("(Il danno va (.*)\\.)", $Text, $Match)) {
        $Identificazione['danno'] = $Match[1];
    }
    if (preg_match("(Abilita' richiesta: (.*))", $Text, $Match)) {
        $Identificazione['skill_required'] = $Match[1];
    }
    if (preg_match("(Tipo di danno: (.*))", $Text, $Match)) {
        $temp_var = $d->GetRows("*", "tab_tipo_danni", "tipo_danno LIKE '%" . trim($Match[1]) . "%'", "", "", 1);
        $Identificazione['id_tipo_danno'] = $temp_var[0]['id_tipo_danno'];
    }
    if (preg_match_all("(Lancia l'incantesimo: '(.*)')", $Text, $Match)) {
        //~ $Identificazione['modi'] = "";
        //~ foreach ($Match[1] as $key => $field)
        //~ {
        //~ $Identificazione['modi'] .= trim($field) . ".\n";
        //~ }
        $Identificazione['casta'] = join(".\n", $Match[1]);
    }
    //~ echo "<pre>";
    //~ print_r($Identificazione);
    //~ echo "</pre>";
    return $Identificazione;
}