Advertisement
Kovitikus

Function not defined.

Aug 8th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.93 KB | None | 0 0
  1. '''
  2. Server restart initiated ...
  3. Traceback (most recent call last):
  4.  File "d:\muddev\evennia\evennia\commands\cmdsethandler.py", line 174, in import_cmdset
  5.    module = import_module(modpath, package="evennia")
  6.  File "C:\Programming\Python3\lib\importlib\__init__.py", line 127, in import_module
  7.    return _bootstrap._gcd_import(name[level:], package, level)
  8.  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  9.  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  10.  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  11.  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  12.  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  13.  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  14.  File ".\commands\default_cmdsets.py", line 18, in <module>
  15.    from commands import command
  16.  File ".\commands\command.py", line 10, in <module>
  17.    from world.skillsets import training
  18.  File "D:\muddev\hecate\world\skillsets.py", line 7, in <module>
  19.    rb = skill_level(i, 'easy')
  20. NameError: name 'skill_level' is not defined
  21.  
  22. Compile/Run error when loading cmdset 'commands.default_cmdsets.SessionCmdSet'.",
  23. (Traceback was logged 19-08-08 03:54:57-04)
  24.  
  25. Error encountered for cmdset at path 'commands.default_cmdsets.SessionCmdSet'.
  26. Replacing with fallback 'evennia.commands.default.cmdset_session.SessionCmdSet'.
  27. ... Server restarted.
  28. '''
  29.  
  30. # In mygame\world\skillsets.py
  31. easy_rb = []
  32. average_rb = []
  33. difficult_rb = []
  34. impossible_rb = []
  35.  
  36. for i in range(1, 1_001):
  37.     rb = skill_level(i, 'easy')
  38.     easy_rb.append(rb)
  39.  
  40.     rb = skill_level(i, 'average')
  41.     average_rb.append(rb)
  42.  
  43.     rb = skill_level(i, 'difficult')
  44.     difficult_rb.append(rb)
  45.  
  46.     rb = skill_level(i, 'impossible')
  47.     impossible_rb.append(rb)
  48.  
  49. def skill_level(self, rank, difficulty):
  50.     '''
  51.    RANK += RANK BONUS PER RANK
  52.    --------------------------
  53.    1 to 10 += 3
  54.    11 to 30 += 2
  55.    31 to 50 += 1
  56.    51 to 100 += 0.5
  57.    101 to 150 += 0.25
  58.    151 to 200 += 0.125
  59.    201 to 500 += 0.0625
  60.    501 to 1,000 += 0.025
  61.    1,001 to infinity += 0.01
  62.    '''
  63.     #Temp Values
  64.     rb = 0
  65.     rank = 100
  66.  
  67.     #Formula
  68.     if rank:
  69.         r = rank if rank < 10 else 10
  70.         rb += (3 * r)
  71.         if rank >= 11:
  72.             r = rank - 10 if rank < 30 else 10
  73.             rb += (2 * r)
  74.             if rank >= 31:
  75.                 r = rank - 30 if rank < 50 else 20
  76.                 rb += (1 * r)
  77.                 if rank >= 51:
  78.                     r = rank - 50 if rank < 100 else 50
  79.                     rb += (0.5 * r)
  80.                     if rank >= 101:
  81.                         r = rank - 100 if rank < 150 else 50
  82.                         rb += (0.25 * r)
  83.                         if rank >= 151:
  84.                             r = rank - 150 if rank < 200 else 50
  85.                             rb += (0.125 * r)
  86.                             if rank >= 201:
  87.                                 r = rank - 200 if rank < 500 else 300
  88.                                 rb += (0.0625 * r)
  89.                                 if rank >= 501:
  90.                                     r = rank - 500 if rank < 1000 else 500
  91.                                     rb += (0.025 * r)
  92.                                     if rank >= 1001:
  93.                                         r = rank - 1000
  94.                                         rb += (0.01 * r)
  95.         '''
  96.        15% RB loss per difficulty.
  97.        At rank 100:
  98.        Easy(100%) 115 RB
  99.        Average(85%) 97.75 RB
  100.        Difficult(70%) 80.5 RB
  101.        Impossible(55%) 63.25 RB
  102.        '''
  103.         if difficulty == 'easy':
  104.             rb *= 1
  105.         elif difficulty == 'average':
  106.             rb *= 0.85
  107.         elif difficulty == 'difficult':
  108.             rb *= 0.7
  109.         elif difficulty == 'impossible':
  110.             rb *= 0.55
  111.         return rb # Return if any rank.
  112.     return None # Return if no rank.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement