コード例 #1
0
ファイル: db.py プロジェクト: zzragida/PythonExamples
def make_pp_user(game_id, kakao_id, hashed_kakao_id):
  con, cur = sqlrelay.client_cursor()
  cur.prepareQuery("""
BEGIN
  ARPG.MAKE_PP_USER(
    :game_id,
    :kakao_id,
    :inventory_size,
    :heart,
    :hashed_kakao_id,
    :user_id
  );
END;
""")
  cur.inputBind("game_id", game_id)
  cur.inputBind("kakao_id", kakao_id)
  cur.inputBind("inventory_size", Properties.MAX_INVENTORY_SIZE)
  cur.inputBind("heart", Properties.MAX_HEART)
  cur.inputBind("hashed_kakao_id", hashed_kakao_id)
  cur.defineOutputBindInteger("user_id")
  cur.executeQuery()

  sqlrelay.client_close(cur, con)

  user_id = cur.getOutputBindInteger("user_id")
  return user_id
コード例 #2
0
ファイル: db.py プロジェクト: zzragida/PythonExamples
def make_hero(user_id, job):
  con, cur = sqlrelay.client_cursor()
  cur.prepareQuery("""
BEGIN
  ARPG.MAKE_HERO(
    :user_id,
    :job,
    :hero_id,
    :button_a,
    :button_b,
    :button_c,
    :costume_id,
    :costume_level,
    :talisman
  );
END;
""")

  cur.inputBind("user_id", user_id)
  cur.inputBind("job", job)
  cur.defineOutputBindInteger("hero_id")
  cur.defineOutputBindInteger("button_a")
  cur.defineOutputBindInteger("button_b")
  cur.defineOutputBindInteger("button_c")
  cur.defineOutputBindInteger("costume_id")
  cur.defineOutputBindInteger("costume_level")
  cur.defineOutputBindInteger("talisman")
  cur.executeQuery()

  sqlrelay.client_close(cur, con)

  r = OrderedDict()
  r['hero_id'] = cur.getOutputBindInteger("hero_id")
  r['button_a'] = cur.getOutputBindInteger("button_a")
  r['button_b'] = cur.getOutputBindInteger("button_b")
  r['button_c'] = cur.getOutputBindInteger("button_c")
  r['costume_id'] = cur.getOutputBindInteger("costume_id")
  r['costume_level'] = cur.getOutputBindInteger("costume_level")
  r['tailsman'] = cur.getOutputBindInteger("talisman")

  h = None

  if r['hero_id'] > 0:
    h = hero(r['hero_id'])

  return h
コード例 #3
0
ファイル: db.py プロジェクト: zzragida/PythonExamples
def change_nickname(user_id, nickname):
  nickname = to_utf8(nickname)

  con, cur = sqlrelay.client_cursor()
  cur.prepareQuery("""
BEGIN
  ARPG.CHANGE_NICKNAME(
    :user_id,
    :nickname
  );
END;
""")
  cur.inputBind("user_id", user_id)
  cur.inputBind("nickname", nickname)
  cur.executeQuery()

  sqlrelay.client_close(cur, con)
  return True
コード例 #4
0
ファイル: db.py プロジェクト: zzragida/PythonExamples
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