コード例 #1
0
 def add_user(self, newdn):
     FOUND = False
     for user in self.userlist.keys():
         if user == newdn:
             FOUND = True
             raise UserPresent
     if not FOUND:
         newuser = user_class.user()
         newuser['dn'] = newdn
         self.userlist[newdn] = newuser
コード例 #2
0
ファイル: wmsdata_class.py プロジェクト: danido/WMSMonitor
 def add_user(self,newdn):
    FOUND = False
    for user in self.userlist:
       if user['dn'] == newdn:
          FOUND = True
          raise UserPresent
    if not FOUND:
       newuser = user_class.user()
       newuser['dn'] = newdn
       self.userlist.append(newuser)
コード例 #3
0
ファイル: Sobreviure_save.py プロジェクト: frg100/Sobreviure
               "arrow": 0.5,
               "meat": 2.5,
               "fur" : 0.25,
               "string" : 0.25,
               "sword" : 50,
               "dagger" : 10}

weapon_levels = {"hand" : 0,
                 "bow" : 1,
                 "sword" : 1}
hours = 0
encounter = 0

name_input = str(raw_input("\nWhat is your name? >>"))
print_slow("So my name is %s"  %name_input)
player = user()

def save():
    db = TinyDB('db.json')
    player_stats = db.table(name_input)
    if db.get(where('name') == name_input):
        player_stats.update({'time_advance' : player.time_advance}, eids=[1])
        player_stats.update({'bow_message': player.bow_message}, eids=[2])
        player_stats.update({'hunt_message': player.hunt_message}, eids=[3])
        player_stats.update({'can_hunt': player.can_hunt}, eids=[4])
        player_stats.update({'exploration1_message': player.exploration1_message}, eids=[5])
        player_stats.update({'sword_message': player.sword_message}, eids=[6])
        player_stats.update({'can_go_to_town': player.can_go_to_town}, eids=[7])
        player_stats.update({'health': player.health}, eids=[8])
        player_stats.update({'weapon': player.weapon}, eids=[9])
        player_stats.update({'energy': player.energy}, eids=[10])