Runes
hey! not to bump this topic back up, but would one of you god heads of BFR give me an answer about this?
all about FAVRE, come on...you know you want to click it
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
~Beatles..."I'm sorry, but I really can't see anything redeeming in your philosophy other than that dinosaurs are cute."
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
- bjornredtail
- Warbands Admin
- Posts: 821
- Joined: Tue Apr 20, 2004 12:07 am
- Contact:
Seems like an intresting project to get started on... What should the base price be? Or, should we even offer it on the private market? This might acctually be within my (nonexistant) codeing abilities.
0===)=B=j=o=r=n==R=e=d=t=a=i=l==>
Warbands Admin
"Program testing can be used to show the presence of bugs, but never to show their absence!"-Edsger W. Dijkstra
Warbands Admin
"Program testing can be used to show the presence of bugs, but never to show their absence!"-Edsger W. Dijkstra
- Freenhult
- 13th Division Captain
- Posts: 3380
- Joined: Mon Jan 02, 2006 2:30 am
- Location: Valparaiso
- Contact:
That would be a good starting point to figuring out base price.Nohc wrote: How about someone checks how much money you make with 1000 markets and compare how many runes you make with 1000 huts?
Nami kotogotoku, waga tate to nare. Ikazuchi kotogotoku, waga yaiba to nare. Sōgyo no Kotowari!
波悉く我が盾となれ雷悉く我が刃となれ,双魚の理 !
Every wave be my shield, every lightning become my blade!
波悉く我が盾となれ雷悉く我が刃となれ,双魚の理 !
Every wave be my shield, every lightning become my blade!
- Ruddertail
- Promi Diplomacy ate my homework...
- Posts: 4510
- Joined: Wed May 12, 2004 11:39 pm
- Location: Chances are, playing FAF.
- Contact:
Er, just make sure that you don't make them availible on the Bazzar. Or, if you do, make the cost per rune higher then the amount of cash you could generate using that rune in the cash spell, or hawkers will have a limitless supply of cash while they have turns...
Empires:
WOA: Attila the Hun(#13)
BFR: ?
Founder and Leader of Hungry Huns (HH)
WOA: Attila the Hun(#13)
BFR: ?
Founder and Leader of Hungry Huns (HH)
- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
- Ruddertail
- Promi Diplomacy ate my homework...
- Posts: 4510
- Joined: Wed May 12, 2004 11:39 pm
- Location: Chances are, playing FAF.
- Contact:
bravo BoatButt!
and thank you all for listening.
and thank you all for listening.
all about FAVRE, come on...you know you want to click it
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
~Beatles..."I'm sorry, but I really can't see anything redeeming in your philosophy other than that dinosaurs are cute."
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
I have this feature pretty much completed but just one hang up. When you go to the pub market the price is not being generated for the runes. With an undefined price you always get the "you can't sell runes for that high of a price". I will post my entire pubmarketsell.php for anyone that wants to take a look. Its a bit long so sorry if that bothers anyone.
I have added $config['runes_sell'] to the config, so that is not the issue. The problem I'm thinking lies with the getCosts function somehow, but I am just a newbie when it comes to the FAF game code. At times it seems to be very cryptic and some things are just down right strange.
code: Select all
<?
include_once("header.php");
include("lib/marketcron.php");
if ($lockdb)
TheEnd("Public market currently disabled!");
if(!defined('CLAN'))
define('CLAN', 0);
if(!defined('SCRIPT'))
define('SCRIPT', 'pubmarketbuy');
if(!defined('SCRIPT2'))
define('SCRIPT2', 'pubmarketsell');
$trooplst = array();
foreach($config['troop'] as $num => $mktcost)
$trooplst[] = "troop$num";
$trooplst[] = 'food';
$trooplst[] = 'runes';
$commission = 0;
if($users['networth'] < 10000000)
$commission = 0.9;
else if($users['networth'] < 20000000)
$commission = 0.85;
else if($users['networth'] < 50000000)
$commission = 0.8;
else if($users['networth'] < 100000000)
$commission = 0.75;
else
$commission = 0.7;
foreach($config['troop'] as $num => $mktcost) {
getCosts("troop$num", $num);
}
getCosts(food);
getCosts(runes);
function printRow ($type, $num=-1){
global $users, $uera, $costs, $basket;
if($num != -1) {
$owned = $users['troop'][$num];
$type = "troop$num";
} else
$owned = $users[$type];
?>
<tr><td><?=$uera[$type]?></td>
<td class="aright"><?=commas(gamefactor($owned))?></td>
<td class="aright"><?=commas(gamefactor($basket[$type]))?></td>
<td class="aright">$<input type="text" name="sellprice[<?=$type?>]" value="<?=$costs[$type]?>" size="5"></td>
<td class="aright"><input type="text" name="sell[<?=$type?>]" value="0" size="8"></td>
<td class="aright"><input type="checkbox" name="max[<?=$type?>]" value="<?=$type?>"></td></tr>
<?
}
function getCosts ($type, $num=0){
global $marketdb, $config, $users, $costs, $time;
sqlQuotes($type);
$market = mysql_fetch_array(mysql_safe_query("SELECT * FROM $marketdb WHERE type='$type' AND seller!=$users[num] AND time<=$time AND clan=".CLAN."
ORDER BY price ASC, time ASC LIMIT 1;"));
if ($market['price'])
$costs[$type] = $market['price'];
else {
if(strlen($type) >= 6 && substr($type, 0, 5) == 'troop')
$costs[$type] = $config['troop'][$num];
else
$costs[$type] = $config[$type."_sell"];
}
}
function calcBasket ($type, $percent, $num=0){
global $marketdb, $users, $uera, $basket, $config, $time, $authstr;
$ts = $type;
if($type == 'troop')
$ts = "troop$num";
$onsale = 0;
sqlQuotes($ts);
$goods = mysql_safe_query("SELECT * FROM $marketdb WHERE type='$ts' AND seller=$users[num] ORDER BY amount DESC;");
while ($market = mysql_fetch_array($goods)) {
$onsale += $market['amount'];
if($market['clan'] == CLAN) {
?>
<tr><td><?=$uera[$ts]?></td>
<td class="aright"><?=commas(gamefactor($market['amount']))?></td>
<td class="aright">$<?=commas($market['price'])?></td>
<td class="aright"><?
if (($market['time'] -= $time) < 0){
?>On Sale for <?=round($market['time']/-3600,1)?> hour(s) - <a href="?<?=SCRIPT2?>&do_removeunits=yes&remove_id=<?=$market['id']?><?=$authstr?>">Remove</a><?
} else {
$bwidth = round($market['time']/3600,1)*10;
if($bwidth > 50)
$bwidth = 50;
$gwidth = 50 - $bwidth;
$factor = 3;
$bwidth *= $factor; $gwidth *= $factor;
echo "<table width='150' cellpadding='0' cellspacing='0'><tr><td>
<img src='img/greenfade.gif' height='15' width='$gwidth' border='0' align='middle'><img src='img/redfade.gif' height='15' width='$bwidth' border='0' align='middle'>
</td></tr></table>";
}
?></td></tr>
<?
}
}
if($type == 'troop')
$basket[$ts] = round(($users['troop'][$num] + $onsale) * $percent) - $onsale;
else
$basket[$type] = round(($users[$type] + $onsale) * $percent) - $onsale;
$type = $ts;
if ($basket[$type] < 0)
$basket[$type] = 0;
}
function sellUnits ($type, $num=-1) {
global $marketdb, $users, $uera, $sell, $sellprice, $config, $basket, $time, $max;
if($num != -1)
$type = $type.$num;
if($num != -1) {
$minprice = $config['troop'][$num] * 0.2;
$maxprice = $config['troop'][$num] * 2.5;
} else {
$minprice = $config[$type] * 0.2;
$maxprice = $config[$type] * 2.5;
}
$amount = $sell[$type];
fixInputNum($amount);
$amount = invfactor($amount);
if(isset($max[$type]))
$amount = $basket[$type];
$price = $sellprice[$type];
fixInputNum($price);
global $costs;
if (($amount == 0) || ($price == 0))
return;
if ($amount < 0)
print "Cannot sell a negative number of $uera[$type]!<br>\n";
elseif ($amount > $basket[$type])
print "Cannot sell that many $uera[$type]!<br>\n";
elseif ($price < $minprice)
print "Cannot sell $uera[$type] that cheap!<br>\n";
elseif ($price > $maxprice)
print "Cannot sell $uera[$type] for that high of a price!<br>\n";
else
{
if($num != -1) {
$users['troop'][$num] -= $amount;
$basket[$ts] -= $amount;
} else {
$users[$type] -= $amount;
$basket[$type] -= $amount;
}
sqlQuotes($type);
fixInputNum($amount);
fixInputNum($price);
mysql_safe_query("INSERT INTO $marketdb (type,seller,amount,price,time,clan) VALUES ('$type',$users[num],$amount,$price,$time+3600*$config[market],".CLAN.");");
?>
<tr><td><?=$uera[$type]?></td>
<td class="aright"><?=commas(gamefactor($amount))?></td>
<td class="aright">$<?=commas($price)?></td>
<td class="aright"><?
$bwidth = 50;
$gwidth = 50 - $bwidth;
$factor = 3;
$bwidth *= $factor; $gwidth *= $factor;
echo "<table width='1' cellpadding='0' cellspacing='0'><tr><td><nobr>
<img src='img/greenfade.gif' height='15' width='$gwidth' border='0'>
</td><td>
<img src='img/redfade.gif' height='15' width='$bwidth' border='0'>
</nobr></td></tr></table>";
?></td></tr><?
}
}
function removeUnits($id) {
global $marketdb, $users, $uera, $commission;
fixInputNum($id);
$market = @mysql_fetch_array(mysql_safe_query("SELECT * FROM $marketdb WHERE id=$id AND clan=".CLAN.";"));
if ($market['seller'] != $users[num]) {
print "No such shipment!<br>\n";
} else {
$amount = $market['amount'];
$type = $market['type'];
@mysql_safe_query("DELETE FROM $marketdb WHERE id=$id AND clan=".CLAN.";");
$ts = $type;
if(strlen($type) >= 6 && substr($type, 0, 5) == 'troop') {
$type = substr($type, 5, 1);
$users['troop'][$type] += floor($market['amount'] * $commission);
}
else
$users[$type] += floor($market['amount'] * $commission);
print "You have removed ".commas(gamefactor($amount))." $uera[$ts] from the market.<br>\n";
saveUserData($users,"networth troops food runes");
}
}
if ($users['turnsused'] <= $config['protection'])
TheEnd("Cannot trade on the public market while under protection!");
if ($do_removeunits)
removeUnits($remove_id);
?>
<table class="inputtable">
<tr><td colspan="4"><center>On the market or on the way we have:</center></td></tr>
<tr><th class="aleft">Unit</th>
<th class="aright">Quantity</th>
<th class="aright">Price</th>
<th class="aright">Status</th></tr>
<?
foreach($config['troop'] as $num => $mktcost)
calcBasket('troop',0.9, $num);
calcBasket(food,0.100);
calcBasket(runes,0.250);
if ($do_sell) {
foreach($config['troop'] as $num => $mktcost)
sellUnits('troop', $num);
sellUnits('food');
sellUnits('runes');
saveUserData($users,"networth troops food runes");
}
?>
<tr><td colspan="4"><hr></td></tr>
</table>
<script language="JavaScript">
function checkAll (check){
var path = document.pvmb;
for (var i=0;i<path.elements.length;i++) {
e = path.elements[i];
checkname = "maxall";
if(check==2) checkname = "maxall2";
if( (e.name!=checkname) && (e.type=="checkbox") ) {
e.checked = path.maxall.checked;
if(check==2) e.checked = path.maxall2.checked;
}
}
}
</script>
Also see: <a href="?guide§ion=military&era=<?=$users[era]?><?=$authstr?>"><?=$gamename?> Guide: Military</a><br>
It will take <?=$config[market]?> hours for your goods to reach the market.<br>
<form method="post" action="?<?=SCRIPT2?><?=$authstr?>" name="pvmb">
<table class="inputtable">
<tr><td colspan="2"><a href="?<?=SCRIPT?><?=$authstr?>">Buy Goods</a></td>
<td> </td>
<td colspan="3" class="aright"><a href="?<?=SCRIPT2?><?=$authstr?>">Sell Goods</a></td></tr>
<tr><th class="aleft">Unit</th>
<th class="aright">Owned</th>
<th class="aright">Can Sell</th>
<th class="aright">Price</th>
<th class="aright">Sell</th>
<th class="aright">Max <input type="checkbox" name="maxall" onClick="checkAll(1)"></th></tr>
<?
ob_start();
foreach($config['troop'] as $num => $mktcost)
calcBasket('troop',0.9, $num);
calcBasket(food,0.100);
calcBasket(runes,0.100);
ob_end_clean();
foreach($config['troop'] as $num => $mktcost)
printRow(troop, $num);
printRow(food);
printRow(runes);
?>
<tr><td colspan="5" class="acenter"><input type="submit" name="do_sell" value="Sell Goods"></td></tr>
</table>
</form>
<?
TheEnd("");
?>- The Beatles
- Fear me for I am root
- Posts: 6285
- Joined: Tue May 24, 2005 8:12 pm
The problem is we started with a pretty badly-written codebase. So here and there there are kludges tying the new system to the old one for backward compatibility.
You will note that it tries to access $config[type]. Now see conf-proc.php. After the line,
add
I think that should fix it.
~B
You will note that it tries to access $config[type]. Now see conf-proc.php. After the line,
code: Select all
$config['food'] = $config['food_sell'];code: Select all
$config['runes'] = $config['runes_sell'];~B
:wq
Yes that was it
Tested and seems to work just fine. Thank you again Mr. Beatles. I was going to attach the files to this post but I guess you can't do that. Did you guys want the new files? If so I can email them I guess or whatever you would like.
The only debate left is what is a fair price for the runes on the market? Should be a little pricey since magers are going to be able to buy them now.
The only debate left is what is a fair price for the runes on the market? Should be a little pricey since magers are going to be able to buy them now.
*aaa a aaa aaAAAAACCCHHOOOOOOOOOOOOOOoooooooooo!!!!!!!!
oh...heh....excuse me....seems i bumped up this topic when sneezed.......
oh...heh....excuse me....seems i bumped up this topic when sneezed.......
all about FAVRE, come on...you know you want to click it
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
~Beatles..."I'm sorry, but I really can't see anything redeeming in your philosophy other than that dinosaurs are cute."
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
- Freenhult
- 13th Division Captain
- Posts: 3380
- Joined: Mon Jan 02, 2006 2:30 am
- Location: Valparaiso
- Contact:
Thanks Kraken... This idea is will be under review once I get everyone after the Beta is out going. Beta-->Bugs--> New Stuffs.
Our goal is to make 2 groups (Mine is atleast) and work in 2 parts. One group works in this topic idea, and the other tackles what we have in the Lunch.
Our goal is to make 2 groups (Mine is atleast) and work in 2 parts. One group works in this topic idea, and the other tackles what we have in the Lunch.
Nami kotogotoku, waga tate to nare. Ikazuchi kotogotoku, waga yaiba to nare. Sōgyo no Kotowari!
波悉く我が盾となれ雷悉く我が刃となれ,双魚の理 !
Every wave be my shield, every lightning become my blade!
波悉く我が盾となれ雷悉く我が刃となれ,双魚の理 !
Every wave be my shield, every lightning become my blade!
and thank you freeny!
all about FAVRE, come on...you know you want to click it
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
~Beatles..."I'm sorry, but I really can't see anything redeeming in your philosophy other than that dinosaurs are cute."
The Kraken, which is found primarily in Scandinavian myth, was a huge sea creature. It was said to lie at the bottom of the sea for a long time and then it would rest at the surface....Like the Midgard serpent in the Norse myths, the Kraken was supposed to rise to the surface at the end of the world.
-
Members connected in real time
