Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2614:3bfbed8919b6
+csv
author | ARAKI Tsuyohito <c113007@e.koeki-u.ac.jp> |
---|---|
date | Sat, 24 Oct 2015 08:32:26 +0900 |
parents | d476b2cf82ea |
children | 407cd06d2b73 |
files | opencampus2015/.sqliterc opencampus2015/accountcheck.rb opencampus2015/list.csv opencampus2015/list3.csv opencampus2015/prof.rb opencampus2015/profeel.css opencampus2015/quest.rb |
diffstat | 7 files changed, 127 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/opencampus2015/.sqliterc Fri Oct 23 17:13:44 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -.header on -.mode html
--- a/opencampus2015/accountcheck.rb Fri Oct 23 17:13:44 2015 +0900 +++ b/opencampus2015/accountcheck.rb Sat Oct 24 08:32:26 2015 +0900 @@ -95,7 +95,7 @@ db.execute(toi, id) # db.execute(item, id) db.execute(numup, id, cd) - db.execute(ins8,id,no1,t1.to_i/5,t1) + db.execute(ins8,id,no1,t1.to_i/5,t1.to_i/5) end # srand(id.to_i) # id2 = rand(1000000)
--- a/opencampus2015/list.csv Fri Oct 23 17:13:44 2015 +0900 +++ b/opencampus2015/list.csv Sat Oct 24 08:32:26 2015 +0900 @@ -1,9 +1,9 @@ -1,inazuma,30,10,25,45,60 -2,inu,25,8,15,25,35 -3,ito,10,3,6,9,12 -4,kamon,20,10,15,20,25 -5,kinoko,10,2,5,10,15 -6,medama,20,15,17,21,24 -7,momen,15,5,10,15,20 -8,snake,25,3,10,20,40 -9,tako,20,5,13,18,23 +1,inazuma,30,20,50,90,120 +2,inu,25,16,30,50,70 +3,ito,10,6,12,18,24 +4,kamon,20,20,30,40,50 +5,kinoko,10,4,10,20,30 +6,medama,20,30,34,42,48 +7,momen,15,10,20,30,40 +8,snake,25,6,20,40,80 +9,tako,20,10,26,36,46
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/opencampus2015/list3.csv Sat Oct 24 08:32:26 2015 +0900 @@ -0,0 +1,9 @@ +1,inazuma,30,10,25,45,60 +2,inu,25,8,15,25,35 +3,ito,10,3,6,9,12 +4,kamon,20,10,15,20,25 +5,kinoko,10,2,5,10,15 +6,medama,20,15,17,21,24 +7,momen,15,5,10,15,20 +8,snake,25,3,10,20,40 +9,tako,20,5,13,18,23
--- a/opencampus2015/prof.rb Fri Oct 23 17:13:44 2015 +0900 +++ b/opencampus2015/prof.rb Sat Oct 24 08:32:26 2015 +0900 @@ -56,9 +56,9 @@ <body> <header></header> -<h1>データがみつかりません!</h1><h2>クッキーを消してやりなおしてください!</h2> -<div class="f1"><a href="index.html"><div class="lets"><span>とうろく画面へ!</span></div></a></div> -<div class="f1"><a href="cookie.rb"><div class="lets"><span>くっきーをけす!</span></div></a></div> +<h1>記録が無くなったようだ...</h1><h2>記憶も消してやりなおしたまえ......</h2> +<div class="f1"><a href="index.html"><div class="lets"><span>新規記憶の作成</span></div></a></div> +<div class="f1"><a href="cookie.rb"><div class="lets"><span>作成前に記憶を消す</span></div></a></div> <address>skip@xxxx.co.jp</address> <footer></footer> </body> @@ -102,16 +102,7 @@ jikan2 = db.execute(jikan1, "j") now1 = jikan2[0][1] rescue - db.execute(ins4, "a") - db.execute(ins4, "b") - db.execute(ins4, "c") - db.execute(ins4, "d") - db.execute(ins4, "e") - db.execute(ins4, "f") - db.execute(ins4, "g") - db.execute(ins4, "h") - db.execute(ins4, "i") - db.execute(ins4, "j") + ("a".."j").each{|x| db.execute(ins4,x)} end @@ -204,6 +195,28 @@ ########################~ここまでpt処理~################### ####################################################### +##################################レベル処理する#### +e1 = db.execute("select e1 from box where id = ?",id)[0].to_i#じぶんのidのboxにある一体目の経験値 +no1 = db.execute("select no1 from box where id = ?",id) +wlv = "select ? from zukan where no = ?" +lv2 = db.execute(wlv,lv2,no1)[0].to_i +lv3 = db.execute(wlv,lv3,no1)[0].to_i +lv4 = db.execute(wlv,lv4,no1)[0].to_i +lv5 = db.execute(wlv,lv5,no1)[0].to_i +if e1 < lv2 +lv = 1 +elsif e1 >= lv5 +lv = 5 +elsif e1 >= lv4 +lv = 4 +elsif e1 >= lv3 +lv = 3 +elsif e1 >= lv2 +lv = 2 +end +################################################## + + m1 = "馬小屋" mimg1 = "./img/food.png" m2 = "客室" @@ -232,9 +245,12 @@ #expの1の位*10で、次のレベルアップに必要な経験値の割合が出る。 #(exp=12の場合、2*10=『20%』、次のレベルアップまであと80%が必要、と分かる。) #(exp=35の場合、5*10=『50%』、次のレベルアップまであと50%が必要、と分かる。) +#exppoint = "select e1 from box where id = ?" #じぶんのidのboxにある一体目の経験値 +#expp = db.execute(exppoint,id) +#exp = expp[0][0].to_i gage = 0 -gage2 = db.execute("select no1 from box where id = ?",id) -exp2 = exp +#gage2 = db.execute("select no1 from box where id = ?",id) +#exp2 = exp #esa = "<br><br><br>" @@ -317,6 +333,8 @@ </form> <p>coin:%d$</p> <table><tr><td> + +<!-- <form method="POST" action="gohan.rb"> <label><input type="checkbox" name="hdn">宿屋<div><br> <label><input type="radio" name="gohan" value="g1">%s:0$<img src=%s width="16" height="16"></label><br> @@ -324,6 +342,8 @@ <input type="reset" value="やめる"> <input type="submit" value="泊まる"></div></label><br> +--> + </div></label></form> </td><td> </form> @@ -333,4 +353,4 @@ </html> _EOS_ -print "#{gage2}" +print "#{expp}"
--- a/opencampus2015/profeel.css Fri Oct 23 17:13:44 2015 +0900 +++ b/opencampus2015/profeel.css Sat Oct 24 08:32:26 2015 +0900 @@ -57,7 +57,7 @@ margin:1em 17em;} div.lets{ border:solid 2px #fa0; -background:#faf; +background:#aaa; padding:1% 0%; #margin:1em 17em; }
--- a/opencampus2015/quest.rb Fri Oct 23 17:13:44 2015 +0900 +++ b/opencampus2015/quest.rb Sat Oct 24 08:32:26 2015 +0900 @@ -10,20 +10,78 @@ id = c.cookies["id"][0].to_i cmps = c["cmps"] - +x = 0 +newone = "" +################################## #card = "select " 設定してる予定のi1,i2,i3を選びたい。どこから? メインテーブル? それようのテーブル? exppoint = "select e1 from box where id = ?" #じぶんのidのboxにある一体目の経験値 expup = "update box set e1 = ? where id = ?" exp2 = db.execute(exppoint,id) exp = exp2[0][0].to_i +srand if cmps == "↑" -exp += 2 + exp += 2 + x = rand(2)+1 +elsif cmps == "→" + exp += 1 + x = rand(3)+1 +#################### +elsif cmps == "←" ##当たりルート + no1 = db.execute("select no1 from box where id = ?",id)[0][0] + no2 = db.execute("select no2 from box where id = ?",id)[0][0] + no3 = db.execute("select no3 from box where id = ?",id)[0][0] + number = rand(8)+1 +while number == no1.to_i + number = rand(8)+1 +end +##############2 + if no2 == 0 + newcal = db.execute('select * from zukan where no = ?',"#{number}") + no2 = newcal[0][0] + calname = newcal[0][1] + t2 = newcal[0][2].to_i/5 + db.execute("update box set no2 = ?, t2 = ?, tm2 = ? where id = ?",no2,t2,t2,id) + newone = "#{calname}が現われた!<br>#{calname}が仲間になった!" +##############3 + elsif no3 == 0 + while number == no1.to_i || number == no2.to_i + number = rand(8)+1 + end + newcal = db.execute('select * from zukan where no = ?',"#{number}") + no3 = newcal[0][0] + calname = newcal[0][1] + t3 = newcal[0][2].to_i/5 + db.execute("update box set no3 = ?, t3 = ?, tm3 = ? where id = ?",no3,t3,t3,id) + newone = "#{calname}が現われた!<br>#{calname}が仲間になった!" +############## + else + x = 49 + end +end +db.execute(expup,exp,id) +coin = db.execute("select pt from test where id = ?",id)[0][0] +coin += x +db.execute("update test set pt = ?",coin) +############################################ + + +if x > 0 + xs = x.to_s + "$get!" +else + xs = "" end -db.execute(expup,exp,id) - - -printf(<<_EOS_,cmps,exp2) +x = rand(33) +if x == 0 +cmpsget ='<input type="submit" name="cmps" value="←"> +<input type="submit" name="cmps" value="↑"> +<input type="submit" name="cmps" value="→">' +else +cmpsget ='<input type="submit" name="cmps" value="←" disabled> +<input type="submit" name="cmps" value="↑"> +<input type="submit" name="cmps" value="→">' +end +printf(<<_EOS_,cmps,xs,newone,cmpsget) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" @@ -52,19 +110,18 @@ <body> <h1>だぁんじょん%s</h1> -<p>%s</p> +<p>%s %s</p> <div class="gage"> <p class="gage">exp</p> </div> -<p>こうえきポイント:</p> + <form method="POST" action="quest.rb"> -<input type="submit" name="cmps" value="←" disabled> -<input type="submit" name="cmps" value="↑"> -<input type="submit" name="cmps" value="→"> +%s </form> - - - +<div class="f1"> +<div class="lets"> +<a href="prof.rb">出る...</a> +</div></div> <footer></footer> </body> </html>