From 5a2b6db3bb25c9a2e4db2a4844ca3edab80dd31a Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 17 Apr 2020 01:23:52 +0900 Subject: [PATCH] =?UTF-8?q?=ED=88=AC=ED=91=9C=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/c_vote.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hwe/c_vote.php b/hwe/c_vote.php index 0fa70771..5c148f58 100644 --- a/hwe/c_vote.php +++ b/hwe/c_vote.php @@ -22,28 +22,30 @@ $gameStor = KVStorage::getStorage($db, 'game_env'); $admin = $gameStor->getValues(['develcost', 'cost', 'vote_title', 'vote', 'votecomment']); -$me = $db->queryFirstRow('SELECT no,vote,name,nation,horse,weapon,book,item,npc from general where owner=%i', $userID); +$generalID = Session::getGeneralID(); -if($btn == "투표" && $me['vote'] == 0 && $sel > 0) { +$general = General::createGeneralObjFromDB($generalID, ['vote','horse','weapon','book','item'], 1); + +if($btn == "투표" && $general->getVar('vote') == 0 && $sel > 0) { $develcost = $admin['develcost'] * 5; $db->update('general', [ 'gold'=>$db->sqleval('gold + %i', $develcost), 'vote'=>$sel ], 'owner=%i', $userID); - $log = []; - $log = uniqueItem($me, $log, 1); - pushGenLog($me, $log); + if(tryUniqueItemLottery($general, '투표')){ + $general->applyDB($db); + } } else if($btn == "댓글" && trim($comment) != "") { $comment = trim($comment); - $nation = getNationStaticInfo($me['nation']); + $nation = $general->getStaticNation(); if(!$admin['votecomment']){ $admin['votecomment'] = []; } - $admin['votecomment'][] = [$nation['name'],$me['name'],$comment]; + $admin['votecomment'][] = [$nation['name'],$general->getName(),$comment]; $gameStor->votecomment = $admin['votecomment']; }