# FETCHADV.INC
#
# fetch all values of any number of characters (same kind of content as fetchcurrentchar.inc)
#
# needs to be fed with $idadv[], character's Id in the table Character
# also calculates secondary values for all characters
# also calculates each character's XP value
# also decrunch the tactic of each character (if any)
?>
# main loop done for each character
for ($i=1; $i <= $nbadv; $i++) {
if ($idadv[$i] < 1000) {
# grabs the row line depending on the id provided
$result = mysql_query("SELECT * FROM Characters WHERE Id=$idadv[$i]");
} else {
$result = mysql_query("SELECT * FROM Monsters WHERE Id=$idadv[$i]-1000");
}
$row = mysql_fetch_array($result);
# extracts all the basic values (stored)
$nameadv[$i] = $row["Name"];
# echo "p".$i."=".$nameadv[$i]."
";
$useradv[$i] = $row["User"];
$imageadv[$i] = $row["Image"];
$creationdateadv[$i] = $row["CreationDate"];
$lastusedadv[$i] = $row["LastUsed"];
$FPadv[$i] = $row["FP"];
$FWadv[$i] = $row["FW"];
$reportadv[$i] = $row["Report"];
$classadv[$i] = $row["Class"];
$classnameadv[$i] = $Tclass[$classadv[$i]];
$leveladv[$i] = $row["Level"];
$raceadv[$i] = $row["Race"];
$racenameadv[$i] = $Trace[$raceadv[$i]];
$backgroundadv[$i] = $row["Background"];
$attadv[$i][1] = $row["Str"];
$attadv[$i][2] = $row["Dex"];
$attadv[$i][3] = $row["Con"];
$attadv[$i][4] = $row["Inte"];
$attadv[$i][5] = $row["Wis"];
$attadv[$i][6] = $row["Cha"];
$hpmaxadv[$i] = $row["HPmax"];
$hpadv[$i] = $row["HP"];
$acadv[$i] = $row["AC"];
$xpadv[$i] = $row["XP"];
$goldadv[1][$i] = $row["PP"];
$goldadv[2][$i] = $row["GP"];
$goldadv[3][$i] = $row["SP"];
$goldadv[4][$i] = $row["CP"];
$weaponadv[$i] = $row["Weapon"];
$armoradv[$i] = $row["Armor"];
$shieldadv[$i] = $row["Shield"];
$armorplusadv[$i] = $row["ArmorPLus"];
$shieldplusadv[$i] = $row["ShieldPlus"];
$equipmentadv[$i] = $row["Equipment"];
$spellsadv[$i] = $row["Spells"];
$visitadv[$i] = $row["Visit"];
$deadpenadv[$i] = $row["Dead"];
$sizeadv[$i] = $row["Size"];
$xpvalueadv[$i] = $row["XPvalue"];
$treasureadv[$i] = $row["Treasure"];
# calculates other values
$dexbonus = $Tattmod[$attadv[$i][2]];
if (($armoradv[$i] <> 0) and ($dexbonus > $Tamaxdexbonus[$armoradv[$i]])) {
$dexbonus = $Tamaxdexbonus[$armoradv[$i]];
}
$acadv[$i] = $acadv[$i] + $dexbonus + $Tabonus[$armoradv[$i]] + $Tabonus[$shieldadv[$i]] + $Tacsizemod[$sizeadv[$i]];
# decrunch the talents
$ti = -1;
$talentsnbadv = 0;
/* if (strlen($talentsadv[$i]) > 0) {
do {
$talentsnbadv++;
$quote = "";
do {
$ti++;
$c = substr($talentsadv[$i], $ti, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".") and ($c <> "/")) {
$quote = $quote.$c;}
} while ($c <> ",");
$talentsid = $quote*1;
$quote = "";
do {
$ti++;
$c = substr($talentsadv[$i], $ti, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".") and ($c <> "/")) {
$quote = $quote.$c;}
} while (($c <> ";") and ($c <> "."));
$talentsrankadv[$i][$talentsid] = $quote*1;
} while ($c <> ".");
}*/
# decrunch the death penalty
$di = -1;
$deathpenaltyadv[$i] = 0;
if (strlen($deadpenadv[$i]) > 0) {
do {
$deathpenaltyadv[$i]++;
$quote = "";
do {
$di++;
$c = substr($deadpenadv[$i], $di, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".") and ($c <> "/")) {
$quote = $quote.$c;
}
} while ($c <> ".");
$deathrecoveradv[$i][$deathpenaltyadv[$i]] = $quote*1;
} while ($di < strlen($deadpenadv[$i])-2);
}
# calculate XP value
if ($xpvalueadv[$i] == 0) {
$xpvalueadv[$i] = $Txpvalueglobal[$leveladv[$i]];
}
if ($treasureadv[$i] == 0) {
if ($xpvalueadv[$i] <> 0) {
$treasureadv[$i] = $xpvalueadv[$i];
} else {
$treasureadv[$i] = $Ttreasurevalue[$leveladv[$i]];
}
}
# decrunch the battle tactic (stances)
$tacticdecisionsadv[$i] = 0;
/* if ($tacticadv[$i] <> 0) {
$result = mysql_query("SELECT * FROM Tactics WHERE Id = $tacticadv[$i]");
$row=mysql_fetch_array($result);
$tacticnameadv[$i] = $row["Name"];
# $report = $report.$nameadv[$i]." is using stance tactic ".$tacticnameadv[$i]."
";
echo $nameadv[$i]." is using stance tactic ".$tacticnameadv[$i]."
";
$tacticnotesadv[$i] = $row["Notes"];
$tacticstring = $row["Tactic"];
$ti = -1;
$n = 0;
do {
# one more set of actions
$n++;
# decrunch a condition ...
$quote = "";
do {
$ti++;
$c = substr($tacticstring, $ti, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;}
} while (($c <> ",") and ($c <> ";") and ($c <> ".") and ($ti < strlen($tacticstring)));
$tacticconditionadv[$i][$n] = $quote*1;
# ... and the corresponding reaction
$quote = "";
do {
$ti++;
$c = substr($tacticstring, $ti, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;}
} while (($c <> ",") and ($c <> ";") and ($c <> ".") and ($ti < strlen($tacticstring)));
$tacticreactionadv[$i][$n] = $quote*1;
} while (($c <> ".") and ($ti < strlen($tacticstring)));
# number of actions sets
$tacticdecisionsadv[$i] = $n;
} # end of fetch and decrunch tactic
# echo "p".$i."=".$nameadv[$i]."
";
*/
# decrunch the battle tactic (talents)
$tactictaldecisionsadv[$i] = 0;
/* if ($tactictaladv[$i] <> 0) {
$result = mysql_query("SELECT * FROM Tactics WHERE Id = $tactictaladv[$i]");
$row=mysql_fetch_array($result);
$tactictalnameadv[$i] = $row["Name"];
# $report = $report.$nameadv[$i]." is using talent tactic ".$tacticnameadv[$i]."
";
echo $nameadv[$i]." is using talent tactic ".$tactictalnameadv[$i]."
";
$tactictalnotesadv[$i] = $row["Notes"];
$tactictalstring = $row["Tactic"];
$ti = -1;
$n = 0;
do {
# one more set of actions
$n++;
# decrunch a condition ...
$quote = "";
do {
$ti++;
$c = substr($tactictalstring, $ti, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;}
} while (($c <> ",") and ($c <> ";") and ($c <> ".") and ($ti < strlen($tactictalstring)));
$tactictalconditionadv[$i][$n] = $quote*1;
echo $tactictalconditionadv[$i][$n].",";
# ... and the corresponding reaction
$quote = "";
do {
$ti++;
$c = substr($tactictalstring, $ti, 1);
if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;}
} while (($c <> ",") and ($c <> ";") and ($c <> ".") and ($ti < strlen($tactictalstring)));
$tactictalreactionadv[$i][$n] = $quote*1;
echo $tactictalreactionadv[$i][$n].".";
} while (($c <> ".") and ($ti < strlen($tactictalstring)));
# number of actions sets
$tactictaldecisionsadv[$i] = $n;
echo "
";
} # end of fetch and decrunch tactic
# echo "p".$i."=".$nameadv[$i]."
";
*/
}
?>