|
Posted by steve on 12/09/07 01:09
Hi, i'm running into a few problems trying to modify the script below...basicly i'm trying to have it also look up
the 'raid_note' in the 'raids' table, and if it contains a certain word it doesnt increase the [kc].
Here's the code:
function bc_fetch_bi($bzone, $data, $bb_conf, $bb_pboss) {
$delim = array (
'rnote' => '/'.$bb_conf['noteDelim'].'/',
'rname' => '/'.$bb_conf['nameDelim'].'/'
);
$bossInfo = $bb_conf['bossInfo'];
#Get data from the raids tables
##################################################
$sql = bc_get_sql_data_string($bb_conf['tables']);
$result = mysql_query($sql) or message_die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
foreach ($bzone as $zone => $bosses){
# Get bossinfo from current row
################################
if ($delim[$bossInfo] != "//"){
$boss_element = preg_split($delim[$bossInfo], $row[$bossInfo], -1, PREG_SPLIT_NO_EMPTY);
} else {
$boss_element = array($row[$bossInfo]);
}
foreach ($boss_element as $raid){
foreach ($bosses as $boss){
$bparseList = preg_split("/\', \'/", trim($bb_pboss['pb_'.$boss], "\' "));
if (in_array(trim($raid), $bparseList)) {
$data[$zone][bosses][$boss][kc]++;
}
}
}
}
}
mysql_free_result($result);
return $data;
}
I did find a seperate batch of code that reads the raid_note nad looks for the 'boss' in it, so I thought
that might help a bit.
Here's the code:
(from http://forums.eqdkp.com/index.php?showtopic=4085&pid=21486&mode=threaded&start=0#entry21486 )
$sql= "SELECT raid_note FROM " . RAIDS_TABLE . ";";
$result = $db->query($sql);
if (!$result)
return null;
foreach ($boss_raid_note as $boss) {
$kill_counter[$boss] = 0; }
while ( list($raid_note) = $db->fetch_record($result) ) {
if(strpos($raid_note, ",") !== false) {
$raid_note_element = explode(",", $raid_note);
foreach($raid_note_element as $raid) {
if (in_array(trim($raid), $boss_raid_note))
$kill_counter[trim($raid)]++;
}
}
else {
if (in_array($raid_note, $boss_raid_note)) {
$kill_counter[$raid_note]++; }
}
}
$db->free_result($result);
What I was trying to do, is make it so that (in the first batch of code) when it finds the boss, and goes to
$data[$zone][bosses][$boss][kc]++; , it checks the raid_note of it first for a certain word, say, "first", and
if it finds it, does $data[$zone][bosses][$boss][kc]--; instead of $data[$zone][bosses][$boss][kc]++; .
Been trying to do this for a day or so with no success. I don't have much experiance with PHP, so any
help would be appreciated.
Navigation:
[Reply to this message]
|