Exemplo n.º 1
0
def check_in_and_get_notices(heroPk,accountPk,checkinTimeUtc,utcOffset):
  """
    this should be called on page load and should be used to get any notices
    for the use

    args:
      heroPk:
        we want a  pymongo objectId for the hero table
      accountPk:
        we want a  pymongo objectId for the hero table
      checkinTimeUtc:
        this needs to be that the user check in and it needs to be utc
      utcOffset:
         the time-zone offset from UTC, in minutes, for the current locale.

    returns:
      we return a dict with two elements: 'story' which will be a list of 
      huge things of text and 'zoneChoice' which is a list of dicts each
      of which contain 'zonePk','description'
      but zoneChoice may be none.

  """
  from Hero import Hero
  from Account import Account
  hero = Hero.construct_model_from_pk(heroPk)
  account = Account.construct_model_from_pk(accountPk)

  lastCheckinTime = account.lastCheckInTime
  account.lastCheckInTime = checkinTimeUtc
  account.save_changes()

  if not lastCheckinTime:
    messages = build_first_time_checkin_messages(hero)
    
    hero.save_changes()
    return messages

  if hero.isInZoneLimbo:
    autoPickedZoneDict = random.choice(hero.zone.nextZoneReferenceList)
    hero.zone = Zone.construct_model_from_dict(autoPickedZoneDict)
    hero.monster = Monster.construct_new_monster(hero.zone.definitionKey,hero.zone.lvl)
    

  timeDiffInDays = (checkinTimeUtc - lastCheckinTime)/(60*60*24)
  if timeDiffInDays >= 1:
    pass
Exemplo n.º 2
0
def check_in_and_get_notices(heroPk, accountPk, checkinTimeUtc, utcOffset):
    """
    this should be called on page load and should be used to get any notices
    for the use

    args:
      heroPk:
        we want a  pymongo objectId for the hero table
      accountPk:
        we want a  pymongo objectId for the hero table
      checkinTimeUtc:
        this needs to be that the user check in and it needs to be utc
      utcOffset:
         the time-zone offset from UTC, in minutes, for the current locale.

    returns:
      we return a dict with two elements: 'story' which will be a list of 
      huge things of text and 'zoneChoice' which is a list of dicts each
      of which contain 'zonePk','description'
      but zoneChoice may be none.

  """
    from Hero import Hero
    from Account import Account
    hero = Hero.construct_model_from_pk(heroPk)
    account = Account.construct_model_from_pk(accountPk)

    lastCheckinTime = account.lastCheckInTime
    account.lastCheckInTime = checkinTimeUtc
    account.save_changes()

    if not lastCheckinTime:
        messages = build_first_time_checkin_messages(hero)

        hero.save_changes()
        return messages

    if hero.isInZoneLimbo:
        autoPickedZoneDict = random.choice(hero.zone.nextZoneReferenceList)
        hero.zone = Zone.construct_model_from_dict(autoPickedZoneDict)
        hero.monster = Monster.construct_new_monster(hero.zone.definitionKey,
                                                     hero.zone.lvl)

    timeDiffInDays = (checkinTimeUtc - lastCheckinTime) / (60 * 60 * 24)
    if timeDiffInDays >= 1:
        pass
Exemplo n.º 3
0
 def disable_popups(self):
   accountPk = cherrypy.session.get(BaseFields.ACCOUNT_PK_KEY)
   account = Account.construct_model_from_pk(accountPk)
   account.preventPopups = True
   account.save_changes()
Exemplo n.º 4
0
 def disable_popups(self):
     accountPk = cherrypy.session.get(BaseFields.ACCOUNT_PK_KEY)
     account = Account.construct_model_from_pk(accountPk)
     account.preventPopups = True
     account.save_changes()