Commit acc32e4d authored by winddramon's avatar winddramon

domo, lastgb.htm=san

lastgb slayer desu
parent 538558d4
...@@ -554,7 +554,7 @@ function gameover($time = 0, $mode = '', $winname = '') { ...@@ -554,7 +554,7 @@ function gameover($time = 0, $mode = '', $winname = '') {
rs_sttime();//重置游戏开始时间和当前游戏状态 rs_sttime();//重置游戏开始时间和当前游戏状态
$gamestate = 0; $gamestate = 0;
save_gameinfo(); save_gameinfo();//先保存一次免得后面的处理过程太长,尽可能避免脏数据
//echo '**游戏结束**'; //echo '**游戏结束**';
//$gamestate = 0; //$gamestate = 0;
//addnews($time, "end$winmode" , $winner); //addnews($time, "end$winmode" , $winner);
...@@ -576,6 +576,7 @@ function gameover($time = 0, $mode = '', $winname = '') { ...@@ -576,6 +576,7 @@ function gameover($time = 0, $mode = '', $winname = '') {
//rs_sttime(); //rs_sttime();
//save_gameinfo(); //save_gameinfo();
set_credits(); set_credits();
save_gameinfo();//set_credits()里也有修改$gamevars的需求,再存一次,反正就一条记录读写不可能高并发
return; return;
} }
...@@ -965,10 +966,11 @@ function get_credit_up($data,$winner = '',$winmode = 0){ ...@@ -965,10 +966,11 @@ function get_credit_up($data,$winner = '',$winmode = 0){
return $up; return $up;
} }
//判定赌局结果的烂代码
function get_gambling_result($clist, $winner='',$winmode=''){ function get_gambling_result($clist, $winner='',$winmode=''){
global $db,$tablepre,$gtablepre,$hdamage,$validnum,$now,$areanum,$areaadd; global $db,$tablepre,$gtablepre,$hdamage,$validnum,$now,$areanum,$areaadd,$gamevars;
$gblog = ''; $gblog = '';
$gbfile = GAME_ROOT.TPLDIR.'/lastgb.htm'; //$gbfile = GAME_ROOT.TPLDIR.'/lastgb.htm';
if(!in_array($winmode,Array(2,3,5,7))){//无人获胜,全部赌注被冴冴吃掉 if(!in_array($winmode,Array(2,3,5,7))){//无人获胜,全部赌注被冴冴吃掉
$gblog .= '无人获胜,全部切糕被冴冴吃掉!'; $gblog .= '无人获胜,全部切糕被冴冴吃掉!';
$updatelist = false; $updatelist = false;
...@@ -998,7 +1000,7 @@ function get_gambling_result($clist, $winner='',$winmode=''){ ...@@ -998,7 +1000,7 @@ function get_gambling_result($clist, $winner='',$winmode=''){
if($apm >= 1){$apmnum ++;} if($apm >= 1){$apmnum ++;}
} }
$avrcredit = $creditsum / $validnum;//平均战斗力 $avrcredit = $creditsum / ($validnum > 0 ? $validnum : 1);//平均战斗力
if($avrcredit > 10000){$creditodds = 1.25;}//平均战斗力超过10000则系数为1.25,否则系数减少,平均战斗力为4000时为1.1; if($avrcredit > 10000){$creditodds = 1.25;}//平均战斗力超过10000则系数为1.25,否则系数减少,平均战斗力为4000时为1.1;
else{$creditodds = round((1 + $avrcredit / 40000)*1000)/1000;} else{$creditodds = round((1 + $avrcredit / 40000)*1000)/1000;}
$apmodds = round(pow(1.02,$apmnum)*1000)/1000;//每有一名玩家达到60APM则乘以1.02 $apmodds = round(pow(1.02,$apmnum)*1000)/1000;//每有一名玩家达到60APM则乘以1.02
...@@ -1074,11 +1076,14 @@ function get_gambling_result($clist, $winner='',$winmode=''){ ...@@ -1074,11 +1076,14 @@ function get_gambling_result($clist, $winner='',$winmode=''){
} }
} }
} }
ob_start(); //上一轮赌局结果存入gamevars
include template('gbresult'); $gamevars['gblog'] = $gblog;
$gbresult = ob_get_contents(); $gamevars['bwlist'] = $bwlist;
ob_end_clean(); // ob_start();
writeover($gbfile,$gbresult); // include template('gbresult');
// $gbresult = ob_get_contents();
// ob_end_clean();
// writeover($gbfile,$gbresult);
return $updatelist; return $updatelist;
} }
?> ?>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<!--{if $gamblingon && $gamestate >= 20}--> <!--{if $gamblingon && $gamestate >= 20}-->
<p>{template gambling}</p> <p>{template gambling}</p>
<!--{elseif $gamblingon && $gamestate <= 10}--> <!--{elseif $gamblingon && $gamestate <= 10}-->
<p>{template lastgb}</p> <p>{template gbresult}</p>
<!--{/if}--> <!--{/if}-->
</form> </form>
......
<!--{eval $gblog=$gamevars['gblog'];$bwlist = $gamevars['bwlist'];}-->
<h3 style="font-size:16pt" class="lime">上局切糕情况</h3> <h3 style="font-size:16pt" class="lime">上局切糕情况</h3>
<div class="lime">$gblog</div> <div class="lime">$gblog</div>
<!--{if !empty($bwlist)}--> <!--{if !empty($bwlist)}-->
......
<h3 style="font-size:16pt" class="lime">上局切糕情况</h3>
<div class="lime">无人获胜,全部切糕被冴冴吃掉!</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment