0) { $result = mysql_query("SELECT * FROM Tactics WHERE Id = $chosentactic"); $row=mysql_fetch_array($result); $tacticname = $row["Name"]; $tacticnotes = $row["Notes"]; $tacticstring = $row["Tactic"]; $tactictype = $row["Type"]; # actually decrunch the tactic $i = -1; $n = 0; do { # one more set of tactic $n++; # grabs the condition ... $quote = ""; do { $i++; $c = substr($tacticstring, $i, 1); if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;} } while (($c <> ",") and ($c <> ";") and ($c <> ".")); $tacticcondition[$n] = $quote*1; # ... and the corresponding reaction $quote = ""; do { $i++; $c = substr($tacticstring, $i, 1); if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;} } while (($c <> ",") and ($c <> ";") and ($c <> ".")); $tacticreaction[$n] = $quote*1; } while (($c <> ".") and ($i < strlen($tacticstring))); } # end of complete tactic fetch and decrunch if ($type == 1) { $conditionsknownstring = $conditionsknown; $reactionsknownstring = $reactionsknown; } else { $conditionsknownstring = $conditionsknowntal; $reactionsknownstring = $reactionsknowntal; } # fetch the known conditions (apart from mastered talents !) $conditionsnb = 0; if (strlen($conditionsknownstring) > 0 ) { $i = -1; do { # one more possible condition $conditionsnb++; # actually decrunch the condition number $quote = ""; do { $i++; $c = substr($conditionsknownstring, $i, 1); if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;} } while (($c <> ",") and ($c <> ";") and ($c <> ".") and ($i < strlen($conditionsknownstring))); $possibleconditions[$conditionsnb] = $quote*1; } while (($c <> ".") and ($i < strlen($conditionsknownstring))); } # end of condition fetch and decrunch # fetch the known reactions (apart from mastered talents !) $reactionsnb = 0; if (strlen($reactionsknownstring) > 0 ) { $i = -1; do { # one more possible reaction $reactionsnb++; # actually decrunch the reaction number $quote = ""; do { $i++; $c = substr($reactionsknownstring, $i, 1); if (($c <> ",") and ($c <> ";") and ($c <> ".")) {$quote = $quote.$c;} } while (($c <> ",") and ($c <> ";") and ($c <> ".") and ($i < strlen($conditionsknownstring))); $possiblereactions[$reactionsnb] = $quote*1; } while (($c <> ".") and ($i < strlen($conditionsknownstring))); } # end of reaction fetch and decrunch # account for mastered talents in possible conditions and reactions (for talent tactics) if ($type == 2) { if ($talentsnb > 0) { for ($ti=1; $ti <= $Ttnb; $ti++) { if ($talentsrank[$ti] > 0) { $conditionsnb++; $possibleconditions[$conditionsnb] = $ti; $reactionsnb++; $possiblereactions[$reactionsnb] = $ti; } } if (($nbspell > 0) and ($talentsrank[49] > 0)) { for ($si=1; $si<=$Tspnb; $si++) { if ($spell[$si]) { $reactionsnb++; $possiblereactions[$reactionsnb] = 1100+$si; } } } if ($nbspell > 0) { for ($si=1; $si<=$Tspnb; $si++) { if ($spellthread[$si]) { $reactionsnb++; $possiblereactions[$reactionsnb] = 1200+$si; } } } } if ($talentsseennb > 0) { for ($ti=1; $ti <= $Ttnb; $ti++) { if ($talentsseenrank[$ti] > 0) { $conditionsnb++; $possibleconditions[$conditionsnb] = $ti; } } } } ?>