Duck hunt
Share Code Nông Trại Cho WapEgo | Wapego | Góc wap/webmaster -
Hi, Phòng khách!
Gợi ý : Hãy * Đăng nhập Hoặc Đăng ký tài khoản để sử dụng hết chức năng của diễn đàn !

Share Code Nông Trại Cho WapEgo Share Code Nông Trại Cho WapEgo


Đánh giá: 100%
tcm
100/ 100 100 bình chọn
Bài viết 19-09-2015
* KhanhSociu
Cấp bậc: mem
Hôm nay nhân dịp có người hỏi về code nông trại nên lục lại. Code này cũng hơn 1 năm rồi, nay đưa ra cho anh em tham khảo. Nông trại trên ego thì làm mem chơi cho vui thôi chứ code không thể chặt chẽ quá được. Sau đây là hướng dẫn:

Đầu tiên, vào thông tin người dùng tạo một shoutbox. Shoutbox này chính là một ô đất trong nông trại. Và lấy ID của Shoutbox này, tôi gọi là A.

Code ô 1:
{% if message_list=="" or message_list==null %}
  <img src="/files/154586/bare_landx.png"/>
Cấp 2
200$
  {% if api.r.get("uid")==api.user_id %}
    
<form action="main.php?id=ch_topic_h&uid=73261&uuid=[user_id]&back_url=%2Fuser_info.php%3Fuid%3D[user_id]%26view%3Dcharacter" style="display:inline" method="post"><input type="hidden" name="text" value="bare_land"/><input type="submit" class="nobutton" value="Mua"/></form>
  {%endif%}
{%else%}
  {{message_list}}
{%endif%}
Copy code

Code ô 2:
{# Tính thời gian trồng cây #}
{% set time,date=message_date|split(" ")[1],message_date|split(" ")[0] %}
{% set s,m,h,d,mo,y=time|split(":")[2],time|split(":")[1],time|split(":")[0],date|split("-")[2],date|split("-")[1],date|split("-")[0] %}
{% set htg=post.published_at|date_modify("- "~y~" years - "~(mo-1)~" months - "~(d-1)~" days - "~h~" hours - "~m~" minutes - "~s~" seconds")|date("H:i:s d/m/Y") %}
{% set atime,adate=htg|split(" ")[0],htg|split(" ")[1] %}
{% set as,am,ah,ad,amo,ay=atime|split(":")[2],atime|split(":")[1],atime|split(":")[0],adate|split("/")[0],adate|split("/")[1],adate|split("/")[2] %}
{% if ad < 2 and amo < 2 and ay < 1 %}
 {% set ktg = as+am*60+ah*3600 %}
 {% set tl=10800-ktg %}
{% else %}
 {% set ktg = 999999 %}
{% endif %}
{# Ô đất trống #}
{% if message=="bare_land" %}
  {% if api.r.get("uid")==api.user_id %}{# chính chủ #}
    <a href="/main.php?f=2786531&farm_id=73261&p=1" title="Trồng cây">
      <img src="/files/154586/{{message}}.png" alt="Ô 1"/>
    </a>
{% if api.r.get("farm_id")=="73261"%}Đã thu!{%else%}Đất trống!{%endif%}
  {%else%} {# Khách cmnr #}
    <img src="/files/154586/{{message}}.png" alt="Ô 1"/>
  {%endif%}
{% endif %}
{# Hiện ô đất, tên cây #}
{% if ktg < 10800 and message!="bare_land" %}
{% if message=="eggplant" %}<img src="/files/154586/growing.png"/>
Cà tím {% endif %}
{% if message=="lettuce" %}<img src="/files/154586/growing.png"/>
Rau diếp {% endif %}
{% if message=="hay" %}<img src="/files/154586/growing.png"/>
Cỏ {% endif %}
{% if message=="peppers" %}<img src="/files/154586/growing.png"/>
Ớt {% endif %}
{% if message=="tomato" %}<img src="/files/154586/growing.png"/>
Cà chua {% endif %}
{# Thời gian còn lại #}
{% autoescape false %}{{ '
<font color="blue">[</font><font color="yellow">'~(tl//3600)~'h'~((tl-(tl//3600)*3600)//60)~'</font><font color="blue">]</font>'}} {% endautoescape %}
{% endif %}
{# Thu hoạch #}
{% if (message=="eggplant" or message=="lettuce" or message=="hay" or message=="peppers" or message=="tomato") and (ktg >= 10800) and (ktg < 21600) %}
  {% if api.r.get("uid")==api.user_id %}{# Chính cmn chủ #}
    <form action="main.php?id=ch_topic_h&uid=73261&uuid=[user_id]&back_url=%2Fmain.php%3Ff%3D2800396" style="display:inline" method="post">
      <input type="hidden" name="text" value="bare_land"/>
      <input type="image" src="/files/154586/{{message}}.png" alt="Thu" width="32" height="32" class="nobutton"/>
</form>
Đã chín
  {%else%} {# Khách cmn rồi #}
<img src="/files/154586/{{message}}.png" alt="Thu" width="32" height="32"/>
Đã chín
  {%endif%}
{%endif%}
{# Cây chết :v #}
{%if ktg > 21600 and message!="bare_land" %}
{% if api.r.get("uid")==api.user_id %}{# Chính cmn chủ #}
<a href="/main.php?f=2786531&farm_id=73261&p=1" title="Trồng cây">
  <img src="/files/154586/{{message}}.png" alt="Ô 1"/>
</a>
{%else%}{# Khách #}
<img src="/files/154586/{{message}}.png" alt="Ô 1"/>
{%endif%}

Đã chết
{% endif %}
Copy code

Các bạn nhớ thay 73261 thành uid chat box dùng làm nông trại, 2786531 thành id trang mua cây trồng, 2800396 thành id trang thu hoạch.

Code trang mua cây trồng:
<form action="main.php?id=ch_topic_h&uid={{api.r.get("farm_id")}}&uuid=[user_id]&back_url=%2Fuser_info.php%3Fuid%3D[user_id]%26view%3Dcharacter" method="post"><input type="radio" name="text" value="eggplant"/>Cà tím
<input type="radio" name="text" value="hay"/>Cỏ khô
<input type="radio" name="text" value="lettuce"/>Rau diếp
<input type="radio" name="text" value="peppers"/>Ớt
<input type="radio" name="text" value="tomato"/>Cà chua
<input type="submit" value="Trồng"/></form>
Copy code

Code trang thu hoạch: phần thưởng khối
<span>%points%<span>
<style type="text/css">body{display:none!important}</style>
<script type="text/javascript">window.location.replace("http://sharecode.wap.mu/user_info.php?uid=[user_id]&view=character&farm_id=73261");</script>
<meta http-equiv="refresh" content="0,url=/user_info.php?uid=[user_id]&view=character&farm_id=73261"/>
Copy code

Thay 73261 thành ID shuotbox.

CHÚ Ý:
- Giá mở đất và trồng cây là giá của Shoutbox
- Level của Shuotbox là level có thể mở ô đất
- Với mỗi ô đất phải làm 1 trang trồng cây và thu hoạch khác nhau tùy theo giá mở ô đất và số tiền thu hoạch được.
- Nhớ thay các ID như hướng dẫn.

Chúc các bạn thành công!
Code bởi MrKen
Share Code Nông Trại Cho WapEgo Tổng số: 1
Chia sẻ:Google Plus Twitter Facebook
BBCode:

Link:
Từ khóa: WapEgo , Nông , Cho , Trại , Share , Code
Trực tuyến
- BOT , 1 khách ghé thăm