Ejemplo n.º 1
0
def gifts():
  results = sqlrelay.execute_results("""
SELECT
   P_ID
 , TYPE
 , VALUE
 , TITLE
 , MESSAGE 
FROM
   ARPG_BT_PRESENT 
""")

  gift_list = OrderedDict()
  for r in results:
    p_id = int(r[0])
    type = int(r[1])
    value = int(r[2])
    title = from_utf8(r[3])
    message = from_utf8(r[4])

    gift_list[p_id] = {
      'type': type,
      'value': value,
      'title': title,
      'message': message,
    }

  return gift_list
Ejemplo n.º 2
0
def _product_make_result(result):
    r = cycle(result)
    return {
       'app_id': r.next(),
       'product_id': r.next(),
       'product_name': from_utf8(r.next()),
       'product_detail': from_utf8(r.next()),
       'product_price': from_utf8(r.next()),
       'inapp_id': from_utf8(r.next()),
       'service_platform': _service_platform(r.next()),
       'currency': _currency_type(r.next()),
       'status': _product_status(r.next()),
       'reg_date': r.next(),
    }
Ejemplo n.º 3
0
def _app_make_result(result):
    r = cycle(result)
    return {
       'app_id': r.next(),
       'app_key': r.next(),
       'app_secret': r.next(),
       'app_name': from_utf8(r.next()),
       'support_android': get_support(r.next()),
       'support_ios': get_support(r.next()),
       'support_playstore': get_support(r.next()),
       'support_appstore': get_support(r.next()),
       'support_gameflier': get_support(r.next()),
       'playstore_url': r.next(),
       'appstore_url': r.next(),
       'gameflier_url': r.next(),
       'gcm_sender_id': r.next(),
       'gcm_server_api_key': r.next(),
       'gcm_config_path': r.next(),
       'facebook_app_name': r.next(),
       'facebook_app_id': r.next(),
       'facebook_app_secret': r.next(),
       'facebook_api_version': r.next(),
       'status': _app_status(r.next()),
       'reg_date': r.next(),
    }
Ejemplo n.º 4
0
def survival_buffs():
  results = sqlrelay.execute_results("""
SELECT 
   BUFF_ID
 , UNLOCK_WAVE
 , NAME
 , PRICE
 , BOOST
 , START_WAVE 
FROM
  ARPG_BT_SURVIVAL_BUFF
""")

  survival_buff_list = OrderedDict()
  for r in results:
    buff_id = int(r[0])
    unlock_wave = int(r[1])
    name = from_utf8(r[2])
    price = int(r[3])
    boost = r[4]
    start_wave = int(r[5])

    survival_buff_list[buff_id] = {
      'unlock_wave': unlock_wave,
      'name': name,
      'price': price,
      'boost': boost,
      'start_wave': start_wave
    }

  return survival_buff_list
Ejemplo n.º 5
0
def costumes():
  results = sqlrelay.execute_results("""
SELECT
   COSTUME_ID
 , NAME
 , JOB
 , TO_CHAR(PROMOTION_START, 'YYYY/MM/DD HH24:MI:SS')
 , TO_CHAR(PROMOTION_END, 'YYYY/MM/DD HH24:MI:SS')
 , UG_PROPERTIES
 , UG_HONBUL
 , UG_CASH
 , MATERIAL
 , MARKET_PRICE
 , MAKE_HONBUL 
FROM
   ARPG_BT_COSTUME 
ORDER BY
   COSTUME_ID
""")

  costume_list = defaultdict()
  costume_list[common_pb2.JOB_SWORD] = OrderedDict()
  costume_list[common_pb2.JOB_ARCHER] = OrderedDict()
  costume_list[common_pb2.JOB_SHAMAN] = OrderedDict()

  for r in results:
    costume_id = int(r[0])
    name = from_utf8(r[1])
    job = int(r[2])
    promotion_start = None if r[3] == '' else datetime.strptime(r[3], "%Y/%m/%d %H:%M:%S")
    promotion_end = None if r[4] == '' else datetime.strptime(r[4], "%Y/%m/%d %H:%M:%S")
    ug_properties = r[5]
    ug_honbul = r[6]
    ug_cash = int(r[7])
    material = []
    for infos in r[8].split(','):
      parts = infos.split('|')
      if len(parts) == 2:
        material.append({
          'parts_id': int(parts[0]),
          'stage_id': int(parts[1]),
        })
    market_price = int(r[9])
    make_honbul = int(r[10])

    costume = costume_list[job]
    costume[costume_id] = {
      'name': name,
      'promotion_start': promotion_start,
      'promotion_end': promotion_end,
      'ug_properties': ug_properties,
      'ug_honbul': ug_honbul,
      'ug_cash': ug_cash,
      'material': material,
      'market_price': market_price,
      'make_honbul': make_honbul,
    }

  return costume_list
Ejemplo n.º 6
0
def avaliable_admin(admin_id, password):
    admin = None
    con, cur = sqlrelay_cursor()
    cur.execute("""
SELECT 
   COUNT(0) 
FROM
   ms_admin 
WHERE
   admin_id = '%s' AND PASSWORD = PASSWORD('%s')
""" % (escape(from_utf8(admin_id)), escape(from_utf8(password))))

    if int(cur.fetchone()[0]) == 1:
        admin = admin_id

    sqlrelay_close(cur, con)
    return admin
Ejemplo n.º 7
0
def cash_shops():
  results = sqlrelay.execute_results("""
SELECT 
   CATEGORY
 , CASH
 , TALISMAN
 , STONE
 , COIN
 , HEART
 , HONBUL
 , SALE_MARK
 , MESSAGE 
FROM
  ARPG_BT_CASH_SHOP 
ORDER BY
  CATEGORY
""")

  cash_shop_list = OrderedDict()
  for r in results:
    category = int(r[0])
    cash = int(r[1])
    talisman = int(r[2])
    stone = int(r[3])
    coin = int(r[4])
    heart = int(r[5])
    honbul = int(r[6])
    sale_mark = int(r[7])
    message = from_utf8(r[8])

    if cash_shop_list.has_key(category):
      cash_shop = cash_shop_list[category]
    else:
      cash_shop = OrderedDict()
      cash_shop_list[category] = cash_shop

    cash_shop[cash] = {
      'talisman': talisman,
      'stone': stone,
      'coin': coin,
      'heart': heart,
      'honbul': honbul,
      'sale_mark': sale_mark,
      'message': message,
    }

  return cash_shop_list
Ejemplo n.º 8
0
def stage_waves():
  results = sqlrelay.execute_results("""
SELECT 
   a.STAGE_ID
 , a.WAVE_SEQ
 , b.DIFFICULTY
 , a.TIME_LIMIT
 , a.DESCRIPTION
 , b.MONSTERS
 , b.REGION 
FROM
   ARPG_BT_WAVE a 
   LEFT JOIN ARPG_BT_SPAWN b ON a.SPAWN_ID = b.SPAWN_ID 
ORDER BY 
   a.STAGE_ID, a.WAVE_SEQ, b.DIFFICULTY
""")

  stage_wave_list = OrderedDict()
  for r in results:
    stage_id = int(r[0])
    wave_seq = int(r[1])
    difficulty = int(r[2])
    time_limit = int(r[3])
    description = from_utf8(r[4])
    monsters = []
    for infos in r[5].split(','):
      mon = infos.split('|')
      monsters.append({
        'monster_id': int(mon[0]),
        'level': int(mon[1]),
        'count': int(mon[2]),
      })
    region = r[6]

    stage_wave_list[stage_id] = {
      'stage_id': stage_id,
      'wave_seq': wave_seq,
      'description': description,
      'time_limit': time_limit,
      'monsters': monsters,
      'region': region,
    }

  return stage_wave_list
Ejemplo n.º 9
0
def eshops():
  results = sqlrelay.execute_results("""
SELECT 
   CASH
 , PRODUCT_ID
 , PMANG_ID
 , SALE_MARK
 , MESSAGE
 , MARKET 
 , SALE 
FROM
  ARPG_BT_ESHOP 
""")

  eshop_list = OrderedDict()
  event_eshop_list = OrderedDict()

  for r in results:
    cash = int(r[0])
    product_id = r[1]
    pmang_id = r[2]
    sale_mark = int(r[3])
    message = from_utf8(r[4])
    market = int(r[5])
    sale = True if r[6] == '1' else False

    if sale:
      event_eshop_list[product_id] = {
        'cash': cash,
        'pmang_id': pmang_id,
        'sale_mark': sale_mark,
        'message': message,
        'market': market,
      }
    else:
      eshop_list[product_id] = {
        'cash': cash,
        'pmang_id': pmang_id,
        'sale_mark': sale_mark,
        'message': message,
        'market': market,
      }

  return (eshop_list, event_eshop_list)
Ejemplo n.º 10
0
def survival_waves():
  results = sqlrelay.execute_results("""
SELECT 
   WAVE_ID
 , MONSTERS
 , REGION
 , TIME_LIMIT
 , REWARD_GROUP_ID
 , DESCRIPTION
 , SCENE 
FROM
   ARPG_BT_SURVIVAL_WAVE 
ORDER BY 
   WAVE_ID
""")

  survival_wave_list = OrderedDict()
  for r in results:
    wave_id = int(r[0])
    monsters = []
    for infos in r[1].split(','):
      mon = infos.split('|')
      monsters.append({
        'monster_id': int(mon[0]),
        'level': int(mon[1]),
        'count': int(mon[2]),
      })
    region = r[2]
    time_limit = int(r[3])
    reward_group_id = int(r[4])
    description = from_utf8(r[5])
    scene = r[6]

    survival_wave_list[wave_id] = {
      'monsters': monsters,
      'region': region,
      'time_limit': time_limit,
      'reward_group_id': reward_group_id,
      'description': description,
      'scene': scene,
    }

  return survival_wave_list
Ejemplo n.º 11
0
  def _load(self):
    results = sqlrelay.execute_results("""
SELECT
   NAME
 , VALUE
FROM
   ARPG_BT_PROPERTIES
""")

    properties = {}
    for r in results:
      name = from_utf8(r[0])
      if r[1].isdigit():
        value = int(r[1])
      else:
        try:
          value = float(r[1])
        except ValueError:
          value = r[1]
      properties[name] = value
    return properties
Ejemplo n.º 12
0
def combinations():
  results = sqlrelay.execute_results("""
SELECT
   COMBI_ID
 , NAME
 , PROPERTIES 
FROM
   ARPG_BT_ITEM_COMBI
""")

  combination_list = defaultdict()
  for r in results:
    combi_id = int(r[0])
    name = from_utf8(r[1])
    properties = r[2].split(',')

    combination_list[combi_id] = {
      'name': name,
      'properties': properties,
    }
  
  return combination_list
Ejemplo n.º 13
0
def blueprints():
  results = sqlrelay.execute_results("""
SELECT
   BP_ID
 , NAME
 , ITEMS
 , MATERIALS 
FROM
   ARPG_BT_BLUEPRINT
""")

  blueprint_list = OrderedDict()
  for r in results:
    bp_id = int(r[0])
    name = from_utf8(r[1])
    items = []
    for infos in r[2].split(','):
      item = infos.split('|')
      items.append({
        'item_id': int(item[0]),
        'count': int(item[1]),
      })
    materials = []
    for infos in r[3].split(','):
      material = infos.split('|')
      materials.append({
        'item_id': int(material[0]),
        'count': int(material[1]),
        'stage_id': int(material[2]),
      })

    blueprint_list[bp_id] = {
      'name': name,
      'items': items,
      'materials': materials,
    }
  
  return blueprint_list
Ejemplo n.º 14
0
def items():
  results = sqlrelay.execute_results("""
SELECT
   E_ID
 , TYPE
 , STONE
 , JOB
 , REQ_LV
 , COMBI
 , PROPERTIES
 , STACK
 , NAME
 , UG_SUCCESS
 , UG_STONE
 , UG_STONE_SAFE
 , CRASH
 , UG_PROPERTIES
 , FIX
 , HONBUL
 , UG_HONBUL
 , SORT_ORDER 
FROM
   ARPG_BT_EQUIPMENT
""")

  item_list = OrderedDict()
  for r in results:
    item_no = int(r[0])
    type = int(r[1])
    stone_rate = int(r[2])
    job = int(r[3])
    required_lv = int(r[4])
    combi = int(r[5])
    properties = r[6].split(',')
    stack = True if r[7] == '1' else False
    name = from_utf8(r[8])
    ug_success = r[9]
    ug_stone = r[10]
    ug_stone_safe = r[11]
    crash = r[12]
    ug_properties = r[13]
    fix = r[14]
    honbul = r[15]
    ug_honbul = r[16]
    sort_order = int(r[17])

    item_list[item_no] = {
      'type': type,
      'stone_rate': stone_rate,
      'job': job,
      'required_lv': required_lv,
      'combi': combi,
      'properties': properties,
      'stack': stack,
      'name': name,
      'ug_success': ug_success,
      'ug_stone': ug_stone,
      'ug_stone_safe': ug_stone_safe,
      'crash': crash,
      'ug_properties': ug_properties,
      'fix': fix,
      'honbul': honbul,
      'ug_honbul': ug_honbul,
      'sort_order': sort_order,
    }

  return item_list
Ejemplo n.º 15
0
def monsters():
  results = sqlrelay.execute_results("""
SELECT
   a.MONSTER_ID
 , a.NAME
 , b.LV
 , b.HP
 , b.MP
 , b.ATK
 , b.DEF
 , b.EXP
 , b.HIT_RATE
 , b.CTR
 , b.CTD
 , b.HONBUL
 , b.EVASION_RATE
 , b.COUNTER_RATE
 , b.EVASION_SKILL
 , b.COUNTER_SKILL
 , b.AI_0
 , b.AI_1
 , b.AI_2
 , b.AI_3
 , b.AI_4
 , b.AI_5
 , b.AI_6
 , b.AI_7
 , b.AI_8
 , b.AI_9
 , b.AI_10
 , b.ITEM 
FROM
   ARPG_BT_MONSTER a 
   LEFT JOIN ARPG_BT_MONSTER_LEVEL b ON a.MONSTER_ID = b.MONSTER_ID
""")

  monster_list = OrderedDict()
  for r in results:
    if r[2] == '': continue
    monster_id = int(r[0])
    name = from_utf8(r[1])
    level = int(r[2])
    hp = int(r[3])
    mp = int(r[4])
    atk = int(r[5])
    attr_def = int(r[6])
    exp = int(r[7])
    hit_rate = float(r[8])
    ctr = float(r[9])
    ctd = float(r[10])
    honbul = int(r[11])
    evasion_rate = float(r[12])
    counter_rate = float(r[13])
    evasion_skill = int(r[14])
    counter_skill = int(r[15])
    ai_0 = float(r[16])
    ai_1 = float(r[17])
    ai_2 = float(r[18])
    ai_3 = float(r[19])
    ai_4 = float(r[20])
    ai_5 = float(r[21])
    ai_6 = float(r[22])
    ai_7 = float(r[23])
    ai_8 = float(r[24])
    ai_9 = float(r[25])
    ai_10 = float(r[26])
    item = int(r[27])

    monster_list[monster_id] = {
      'name': name,
      'level': level,
      'hp': hp,
      'mp': mp,
      'atk': atk,
      'def': attr_def,
      'exp': exp,
      'hit_rate': hit_rate,
      'ctr': ctr,
      'ctd': ctd,
      'honbul': honbul,
      'evasion_rate': evasion_rate,
      'counter_rate': counter_rate,
      'evasion_skill': evasion_skill,
      'counter_skill': counter_skill,
      'ai_0': ai_0,
      'ai_1': ai_1,
      'ai_2': ai_2,
      'ai_3': ai_3,
      'ai_4': ai_4,
      'ai_5': ai_5,
      'ai_6': ai_6,
      'ai_7': ai_7,
      'ai_8': ai_8,
      'ai_9': ai_9,
      'ai_10': ai_10,
      'item': item,
    }

  return monster_list
Ejemplo n.º 16
0
def stages():
  results = sqlrelay.execute_results("""
SELECT 
   STAGE_ID
 , NAME
 , NEXT_STAGE_ID
 , DUNGEON_ID
 , MAX_PLAYER
 , TYPE
 , UNLOCK_CASH
 , UNLOCKED
 , SCENE
 , HEART
 , COOLTIME
 , COOLTIME_COUNT
 , COOLTIME_RESET_CASH
 , REWARD_HONBUL
 , REWARD_MATERIAL
 , REWARD_BOX_EASY
 , REWARD_BOX_NORMAL
 , REWARD_BOX_HARD 
FROM
   ARPG_BT_STAGE 
ORDER BY
   STAGE_ID
""")

  stage_list = OrderedDict()
  for r in results:
    stage_id = int(r[0])
    name = from_utf8(r[1])
    next_stage_id = int(r[2])
    dungeon_id = int(r[3])
    max_player = int(r[4])
    type = int(r[5])
    unlock_cash = int(r[6])
    unlocked = True if r[7] == '1' else False
    scene = r[8]
    heart = int(r[9])
    cooltime = int(r[10])
    cooltime_count = int(r[11])
    cooltime_cash = int(r[12])
    reward_honbul = r[13]
    reward_material = r[14]
    reward_box_easy = r[15]
    reward_box_normal = r[16]
    reward_box_hard = r[17]

    stage_list[stage_id] = {
      'stage_id': stage_id,
      'name': name,
      'next_stage_id': next_stage_id,
      'dungeon_id': dungeon_id,
      'max_player': max_player,
      'type': type,
      'unlock_cash': unlock_cash,
      'unlocked': unlocked,
      'scene': scene,
      'heart': heart,
      'cooltime': cooltime,
      'cooltime_count': cooltime_count,
      'cooltime_cash': cooltime_cash,
      'reward_honbul': reward_honbul,
      'reward_material': reward_material,
      'reward_box_easy': reward_box_easy,
      'reward_box_normal': reward_box_normal,
      'reward_box_hard': reward_box_hard,
    }

  return stage_list
Ejemplo n.º 17
0
def user(user_id):
  con, cur = sqlrelay.client_cursor()
  cur.prepareQuery("""
BEGIN
  ARPG.USER_INFO(
    :user_id
  , :nickname
  , :honbul
  , :cash
  , :talisman
  , :stone
  , :coin
  , :selected_hero
  , :heart
  , :heart_date
  , :current_date
  , :inventory_size
  , :searchable
  , :tutorial1
  , :tutorial2
  , :tutorial3
  , :tutorial4
  , :tutorial5
  , :tutorial6
  , :tutorial7
  , :terminate_abnormally
  , :dailystamp
  , :dailystamp_update
  , :today_quest
  , :today_quest_count
  , :material_count
  , :material_reset_count
  , :material_date
  , :promoted
  , :promotion_count
  , :break_up_count
  , :break_up_date
  , :kakao_heart_count
  , :kakao_heart_date
  , :kakao_id
  , :reg_date
  , :no_kakao_message
  , :no_kakao_profile
  , :review
  , :by_kakao_invitation
  );
END;
""")

  cur.inputBind("user_id", user_id)
  cur.defineOutputBindString("nickname", 256)
  cur.defineOutputBindInteger("honbul")
  cur.defineOutputBindInteger("cash")
  cur.defineOutputBindInteger("talisman")
  cur.defineOutputBindInteger("stone")
  cur.defineOutputBindInteger("coin")
  cur.defineOutputBindInteger("selected_hero")
  cur.defineOutputBindInteger("heart")
  cur.defineOutputBindString("heart_date", 20)
  cur.defineOutputBindString("current_date", 20)
  cur.defineOutputBindInteger("inventory_size")
  cur.defineOutputBindInteger("searchable")
  cur.defineOutputBindInteger("tutorial1")
  cur.defineOutputBindInteger("tutorial2")
  cur.defineOutputBindInteger("tutorial3")
  cur.defineOutputBindInteger("tutorial4")
  cur.defineOutputBindInteger("tutorial5")
  cur.defineOutputBindInteger("tutorial6")
  cur.defineOutputBindInteger("tutorial7")
  cur.defineOutputBindInteger("terminate_abnormally")
  cur.defineOutputBindInteger("dailystamp")
  cur.defineOutputBindInteger("dailystamp_update")
  cur.defineOutputBindInteger("today_quest")
  cur.defineOutputBindInteger("today_quest_count")
  cur.defineOutputBindInteger("material_count")
  cur.defineOutputBindInteger("material_reset_count")
  cur.defineOutputBindString("material_date", 20)
  cur.defineOutputBindInteger("promoted")
  cur.defineOutputBindInteger("promotion_count")
  cur.defineOutputBindInteger("break_up_count")
  cur.defineOutputBindString("break_up_date", 20)
  cur.defineOutputBindInteger("kakao_heart_count")
  cur.defineOutputBindString("kakao_heart_date", 20)
  cur.defineOutputBindInteger("kakao_id")
  cur.defineOutputBindString("reg_date", 20)
  cur.defineOutputBindInteger("no_kakao_message")
  cur.defineOutputBindInteger("no_kakao_profile")
  cur.defineOutputBindInteger("review")
  cur.defineOutputBindInteger("by_kakao_invitation")
  cur.executeQuery()

  sqlrelay.client_close(cur, con)

  nickname = cur.getOutputBindString("nickname")
  if nickname: nickname = from_utf8(nickname)
  honbul = cur.getOutputBindInteger("honbul")
  cash = cur.getOutputBindInteger("cash")
  talisman = cur.getOutputBindInteger("talisman")
  stone = cur.getOutputBindInteger("stone")
  coin = cur.getOutputBindInteger("coin")
  selected_hero = cur.getOutputBindInteger("selected_hero")
  heart = cur.getOutputBindInteger("heart")
  inventory_size = cur.getOutputBindInteger("inventory_size")
  searchable = True if cur.getOutputBindInteger("searchable") == 1 else False
  tutorial1 = True if cur.getOutputBindInteger("tutorial1") == 1 else False
  tutorial2 = True if cur.getOutputBindInteger("tutorial2") == 1 else False
  tutorial3 = True if cur.getOutputBindInteger("tutorial3") == 1 else False
  tutorial4 = True if cur.getOutputBindInteger("tutorial4") == 1 else False
  tutorial5 = True if cur.getOutputBindInteger("tutorial5") == 1 else False
  tutorial6 = True if cur.getOutputBindInteger("tutorial6") == 1 else False
  tutorial7 = True if cur.getOutputBindInteger("tutorial7") == 1 else False
  dailystamp = cur.getOutputBindInteger("dailystamp")
  kakao_id = cur.getOutputBindInteger("kakao_id")
  no_kakao_message = True if cur.getOutputBindInteger("no_kakao_message") == 1 else False
  no_kakao_profile = True if cur.getOutputBindInteger("no_kakao_profile") == 1 else False
  review = True if cur.getOutputBindInteger("review") == 1 else False
  by_kakao_invitation = True if cur.getOutputBindInteger("by_kakao_invitation") == 1 else False
 
  user = {
    'kakao_id': kakao_id,
    'nickname': nickname,
    'honbul': honbul,
    'cash': cash,
    'talisman': talisman,
    'stone': stone,
    'coin': coin,
    'heart': heart,
    'selected_hero': selected_hero,
    'inventory_size': inventory_size,
    'searchable': searchable,
    'dailystamp': dailystamp,
    'review': review,
    'by_kakao_invitation': by_kakao_invitation,
    'tutorial1': tutorial1,
    'tutorial2': tutorial2,
    'tutorial3': tutorial3,
    'tutorial4': tutorial4,
    'tutorial5': tutorial5,
    'tutorial6': tutorial6,
    'tutorial7': tutorial7,
    'no_kakao_message': no_kakao_message,
    'no_kakao_profile': no_kakao_profile,
    'review': review,
  } 

  return user