Ejemplo n.º 1
0
/** Displays the results of a query for objects returning the 'id' and 'name' fields.
 *  The query must have been done with at least a limit of '$MaxRowsReturned + 1'.
 *  '$MaxObjectsReturned' can be '0', which means the query had no limits (ex: $MaxNpcsReturned).
 *  '$OpenObjectById' must contain the name of the page used to open one of the object (ex: npc.php) by passing it
 *    the ID by GET method.
 *  'IdAttribute' and 'NameAttribute' are the name of the columns retrieved used for ID and Name (ex: 'id' and 'name').
 *  '$ObjectDescription' is the text describing the kind of objects to display (ex: 'NPC'). '$ObjectsDescription' is the plural.
 */
function PrintQueryResults($FoundObjects, $MaxObjectsReturned, $OpenObjectByIdPage, $ObjectDescription, $ObjectsDescription, $IdAttribute, $NameAttribute, $ExtraField, $ExtraFieldDescription, $ExtraSkill)
{
    global $dbskills;
    $ObjectsToShow = mysql_num_rows($FoundObjects);
    if ($ObjectsToShow > LimitToUse($MaxObjectsReturned)) {
        $ObjectsToShow = LimitToUse($MaxObjectsReturned);
        $MoreObjectsExist = True;
    } else {
        $MoreObjectsExist = False;
    }
    if ($ObjectsToShow == 0) {
        echo "<ul><li><b>No " . $ObjectDescription . " found.</b></li></ul>\n";
    } else {
        echo "<ul><li><b>" . $ObjectsToShow . " " . ($ObjectsToShow == 1 ? $ObjectDescription : $ObjectsDescription) . " displayed.";
        if ($MoreObjectsExist) {
            echo " More " . $ObjectsDescription . " exist but you have reached the search limit.";
        }
        echo "</b></li>\n";
        echo "<ul>\n";
        for ($j = 1; $j <= $ObjectsToShow; $j++) {
            $row = mysql_fetch_array($FoundObjects);
            $PrintString = " <li><a href='" . $OpenObjectByIdPage . "?id=" . $row[$IdAttribute] . "'>";
            if ($ObjectDescription == "npc") {
                // Clean up the name for NPCs
                $PrintString .= ReadableNpcName($row[$NameAttribute]);
            } else {
                $PrintString .= $row[$NameAttribute];
            }
            $PrintString .= " (" . $row[$IdAttribute] . ")</a>";
            if ($ExtraField && $ExtraFieldDescription && $ExtraSkill) {
                $PrintString .= " - " . ucfirstwords(str_replace("_", " ", $dbskills[$row[$ExtraSkill]])) . ", {$ExtraFieldDescription} " . $row[$ExtraField];
            }
            echo $PrintString;
            echo "</li>\n";
        }
        echo "</ul>\n</ul>\n";
    }
}
Ejemplo n.º 2
0
             }
             if ($ItemID > 0) {
                 print "<li>Related Item: <a href=item.php?id=" . $ItemID . ">" . $ItemName . "</a></li>";
             }
         }
         // Goal List
         if ($GoalMethod == 1) {
             $Query2 = "SELECT * FROM goallists WHERE listid='" . $GoalID . "'";
             $QueryResult2 = mysql_query($Query2) or message_die('task.php', 'MYSQL_QUERY', $Query2, mysql_error());
             $GoalListString = "";
             if (mysql_num_rows($QueryResult2) > 0) {
                 while ($row2 = mysql_fetch_array($QueryResult2)) {
                     if ($GoalType == "NPCID" && $row2["entry"]) {
                         $NPCID = $row2["entry"];
                         $NPCName = GetFieldByQuery("name", "SELECT name FROM npc_types WHERE id = {$NPCID}");
                         $GoalListString .= "<li>Related NPC: <a href=npc.php?id=" . $NPCID . ">" . ReadableNpcName($NPCName) . "</a></li>";
                     }
                     if ($GoalType == "ItemID" && $row2["entry"]) {
                         $ItemID = $row2["entry"];
                         $ItemName = GetFieldByQuery("name", "SELECT name FROM items WHERE id = {$ItemID}");
                         $GoalListString .= "<li>Related Item: <a href=item.php?id=" . $ItemID . ">" . $ItemName . "</a></li>";
                     }
                 }
             }
             print $GoalListString;
         }
         print "</ul></ul></td></tr>";
     }
 } else {
     print "<tr><td nowrap='1'><b>No Task Activities Listed</b></td></tr>";
 }
Ejemplo n.º 3
0
    }
    if ($irace > 0 && is_numeric($irace)) {
        $query .= " AND {$tbnpctypes}.race={$irace}";
    }
    if ($iname != "") {
        $iname = str_replace('`', '%', str_replace(' ', '%', addslashes($iname)));
        $query .= " AND {$tbnpctypes}.name LIKE '%{$iname}%'";
    }
    if ($HideInvisibleMen == TRUE) {
        $query .= " AND {$tbnpctypes}.race!=127";
    }
    $query .= " ORDER BY {$tbnpctypes}.name";
    $result = mysql_query($query) or message_die('npcs.php', 'MYSQL_QUERY', $query, mysql_error());
    $n = mysql_num_rows($result);
    if ($n > $MaxNpcsReturned) {
        print "{$n} ncps found, showing the {$MaxNpcsReturned} first ones...";
        $query .= " LIMIT {$MaxNpcsReturned}";
        $result = mysql_query($query) or message_die('npcs.php', 'MYSQL_QUERY', $query, mysql_error());
    }
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_array($result)) {
            print "<li><a href=npc.php?id=" . $row["id"] . ">" . ReadableNpcName($row["name"]) . "</a>";
            if ($ishowlevel) {
                print " - level " . $row["level"];
            }
        }
    } else {
        print "<li>No npc found.";
    }
}
include $includes_dir . "footers.php";
Ejemplo n.º 4
0
        print "<tr><td nowrap='1'><b>Special attacks : </b></td><td>" . SpecialAttacks($npc["npcspecialattks"]) . "</td></tr>";
    }
}
print "</td></tr></table>\n";
print "<tr class='myline' height='6'><td colspan='2'></td><tr>\n";
print "<tr valign='top'>";
if ($npc["npc_spells_id"] > 0) {
    $query = "SELECT * FROM {$tbnpcspells} WHERE id=" . $npc["npc_spells_id"];
    $result = mysql_query($query) or message_die('npc.php', 'MYSQL_QUERY', $query, mysql_error());
    if (mysql_num_rows($result) > 0) {
        $g = mysql_fetch_array($result);
        print "<td><table border='0'><tr><td colspan='2' nowrap='1'><b>This NPC casts the following spells : </b><p>";
        $query = "SELECT {$tbnpcspellsentries}.*\n\t\t\t\t\tFROM {$tbnpcspellsentries}\n\t\t\t\t\tWHERE {$tbnpcspellsentries}.npc_spells_id=" . $npc["npc_spells_id"] . "\n\t\t\t\t\tAND {$tbnpcspellsentries}.minlevel<=" . $npc["level"] . "\n\t\t\t\t\tAND {$tbnpcspellsentries}.maxlevel>=" . $npc["level"] . "\n\t\t\t\t\tORDER BY {$tbnpcspellsentries}.priority DESC";
        $result2 = mysql_query($query) or message_die('npc.php', 'MYSQL_QUERY', $query, mysql_error());
        if (mysql_num_rows($result2) > 0) {
            print "</ul><li><b>Listname : </b>" . ReadableNpcName($g["name"]);
            if ($DebugNpc) {
                print " (" . $npc["npc_spells_id"] . ")";
            }
            if ($g["attack_proc"] == 1) {
                print " (Procs)";
            }
            print "<ul>";
            while ($row = mysql_fetch_array($result2)) {
                $spell = getspell($row["spellid"]);
                print "<li><a href='spell.php?id=" . $row["spellid"] . "'>" . $spell["name"] . "</a>";
                print " (" . $dbspelltypes[$row["type"]] . ")";
                if ($DebugNpc) {
                    print " (recast=" . $row["recast_delay"] . ", priority= " . $row["priority"] . ")";
                }
            }
Ejemplo n.º 5
0
        }
        $Query = 'INSERT INTO goallists ( listid, entry ) VALUES ( ' . $goalid . ',  0 )';
        $QueryResult = mysql_query($Query) or message_die('taskbuild.php', 'MYSQL_QUERY', $Query, mysql_error());
        $GoalMessage = '<font ><b>New Entry!</b></font>';
    }
    $Query = 'SELECT listid, entry FROM goallists WHERE listid = ' . $goalid . ' ORDER BY entry';
    $QueryResult = mysql_query($Query) or message_die('taskbuild.php', 'MYSQL_QUERY', $Query, mysql_error());
    $GoalTypeValue = "taskactivitygoalid";
    if ($type == "rewardid") {
        $GoalTypeValue = "rewardid";
    }
    $TaskContent .= '<table align="left" style="margin-left:25px;">';
    while ($row = mysql_fetch_array($QueryResult)) {
        $CurGoalID = $row["listid"];
        $CurGoalEntry = $row["entry"];
        $NPCName = ReadableNpcName(GetFieldByQuery("name", "SELECT name FROM npc_types WHERE id=" . $CurGoalEntry . ""));
        $ItemName = GetFieldByQuery("Name", "SELECT Name FROM items WHERE id=" . $CurGoalEntry . "");
        $TaskContent .= '<tr><td align="right"><b>Goal List ' . $CurGoalID . ' : </b></td><td>
			<input size="11" id="goalentry' . $CurGoalEntry . '" name="goalentry' . $CurGoalEntry . '" type="text" value="' . $CurGoalEntry . '" onchange="changeGoal(' . $CurGoalID . ', \'updategoal\', ' . $CurGoalEntry . ', this.value)"/>';
        $TaskContent .= '<a href="javascript:;" class="btn red btn-xs" onclick="changeGoal(' . $CurGoalID . ', \'deletegoal\', ' . $CurGoalEntry . ')"><i class="fa fa-trash-o"></i> Delete</a>';
        $TaskContent .= ' ';
        if ($ItemName) {
            $TaskContent .= '<a href="' . $root_url . 'item.php?id=' . $CurGoalEntry . '"> ' . $ItemName . '<a/>';
        }
        if ($ItemName && $NPCName && $type == "taskactivitygoalid") {
            $TaskContent .= '<font color="red"><b> OR </b><font>';
        }
        if ($NPCName && $type == "taskactivitygoalid") {
            $TaskContent .= '<a href="' . $root_url . 'npc.php?id=' . $CurGoalEntry . '"> ' . $NPCName . '<a/>';
        }
        if (!$ItemName && !$NPCName) {