Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less items. Closes #291 #292

Open
wants to merge 3 commits into
base: master
from

Conversation

@iliakonnov
Copy link

commented Jun 29, 2018

Надеюсь, багов нет =)

logger = logging.getLogger('rg')


class item_info(object):

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

Useless inheritance

return self.context is None or len(self.context) == 0

def __repr__(self):
return "<item {g}/{n} x {cnt}{ctx}".format(

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

bad naming

if item is None:
return None
item = check_item(item, name, buff)
item.count=count

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

Formatting

import config
from items import item_info

for i in os.listdir(config.USERS_PATH):

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

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], '..', '..')))

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

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

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

ternary operator will be better therer

This comment has been minimized.

Copy link
@iliakonnov

iliakonnov Jul 2, 2018

Author

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')

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

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 (

This comment has been minimized.

Copy link
@YogurtTheHorse
for i in items:
if i.name == name:
return i
found = _find_item_by_name(items, name)

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner
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):

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

Rename get_items to get_item_infos

This comment has been minimized.

Copy link
@iliakonnov

iliakonnov Jul 2, 2018

Author

It returns items, not item_infos.


def remove_item(self, code_name):
def remove_item(self, code_name, count=1):

This comment has been minimized.

Copy link
@YogurtTheHorse

YogurtTheHorse Jul 2, 2018

Owner

if we will have some item of one code_name with and without context it won't work right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.