-
Notifications
You must be signed in to change notification settings - Fork 41
Less items. Closes #291 #292
base: master
Are you sure you want to change the base?
Conversation
logger = logging.getLogger('rg') | ||
|
||
|
||
class item_info(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless inheritance
return self.context is None or len(self.context) == 0 | ||
|
||
def __repr__(self): | ||
return "<item {g}/{n} x {cnt}{ctx}".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad naming
if item is None: | ||
return None | ||
item = check_item(item, name, buff) | ||
item.count=count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
import config | ||
from items import item_info | ||
|
||
for i in os.listdir(config.USERS_PATH): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use usermanager.get_telegram_users
instead
@@ -0,0 +1,23 @@ | |||
import os | |||
import sys | |||
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], '..', '..'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh god.
This type of scripts we need to call from root of the project so, there is no need to add something to path
@@ -23,11 +23,15 @@ def get_actions(user): | |||
return [ 'Зуб', 'Палка', 'Парашок', 'Уйти' ] | |||
|
|||
def action(user, reply, text): | |||
teeths = user.get_item_by_name('tooth') | |||
if teeths is None: | |||
user_teeth_cnt = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ternary operator will be better therer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's impossible here. teeths
variable used two times.
@@ -29,13 +32,13 @@ def enter(user, reply): | |||
reply('Здесь лежат останки игрока {0}'.format(found_user.name), photo='BQADAgADFwkAAmrZzgf5q0m1CmsDggI') | |||
user.set_room_temp('items', found_user.items) | |||
else: | |||
reply('Здесь лежат останки лягушки. Воняет. Ты уходишь отсюда побыстрее.') | |||
reply('Здесь лежат останки лягушки. Воняет. Ты уходишь отсюда побыстрее.', photo='BQADAgADFwkAAmrZzgf5q0m1CmsDggI') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not the part of issue, but thx
|
||
item = self.get_item_by_name(name) | ||
active_item = self.get_active_item_by_name(name) | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh god.
for i in items: | ||
if i.name == name: | ||
return i | ||
found = _find_item_by_name(items, name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i, item = _find_item_by_name(items, name)
return item
found = _find_item_by_name(items, name) | ||
if found is not None: | ||
return found[1] | ||
return None | ||
|
||
def get_items(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename get_items
to get_item_infos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns items, not item_infos.
|
||
def remove_item(self, code_name): | ||
def remove_item(self, code_name, count=1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we will have some item of one code_name with and without context it won't work right
Надеюсь, багов нет =)