Exemplo n.º 1
0
def _calculate_trust(life, target_id):
    _knows = brain.knows_alife_by_id(life, target_id)
    _hard_trust = 0
    _soft_trust = 0

    if life["group"] and groups.is_member(life, life["group"], target_id):
        _hard_trust += 1

    for memory in lfe.get_memory(life, matches={"target": target_id, "trust": "*"}):
        _soft_trust += memory["trust"]

    _total_trust = _hard_trust + _soft_trust

    if _hard_trust:
        _total_trust = numbers.clip(_total_trust, _hard_trust, 10)

    return _total_trust
Exemplo n.º 2
0
def _calculate_trust(life, target_id):
	_knows = brain.knows_alife_by_id(life, target_id)
	_hard_trust = 0
	_soft_trust = 0
	
	if life['group'] and groups.is_member(life, life['group'], target_id):
		_hard_trust += 1
	
	for memory in lfe.get_memory(life, matches={'target': target_id, 'trust': '*'}):
		_soft_trust += memory['trust']
	
	_total_trust = _hard_trust+_soft_trust	
	
	if _hard_trust:
		_total_trust = bad_numbers.clip(_total_trust, _hard_trust, 10)
	
	return _total_trust
Exemplo n.º 3
0
def inform_of_group_members(life, life_id, group_id):
    if 'player' in life:
        _dialog_id = lfe.has_dialog_with(life, life_id)
        _menu_items = []

        for target_id in life['know']:
            if target_id == life['id'] or target_id == life_id:
                continue

            if groups.is_member(life, group_id, target_id):
                _colors = (tcod.green, tcod.white)
                _values = ['Member', 'Not Member']
            else:
                _colors = (tcod.red, tcod.white)
                _values = ['Not Member', 'Member']

            _menu_items.append(
                menus.create_item('list',
                                  ' '.join(LIFE[target_id]['name']),
                                  _values,
                                  group=group_id,
                                  target_id=target_id,
                                  members=_menu_items,
                                  color=_colors,
                                  dialog_id=_dialog_id))

        if not _menu_items:
            return False

        _menu = menus.create_menu(menu=_menu_items,
                                  title='Inform of Group Members',
                                  format_str='$k: $v',
                                  on_select=confirm_inform_of_group_members,
                                  close_on_select=True)
        menus.activate_menu(_menu)
    else:
        for target_id in groups.get_group(life, group_id)['members']:
            if life['id'] == target_id:
                continue

            memory.create_question(life,
                                   target_id,
                                   'group_list',
                                   group_id=group_id,
                                   group_list=groups.get_group(
                                       life, group_id)['members'])
Exemplo n.º 4
0
def inform_of_group_members(life, life_id, group_id):
	if 'player' in life:
		_dialog_id = lfe.has_dialog_with(life, life_id)
		_menu_items = []
		
		for target_id in life['know']:
			if target_id == life['id'] or target_id == life_id:
				continue
			
			if groups.is_member(life, group_id, target_id):
				_colors = (tcod.green, tcod.white)
				_values = ['Member', 'Not Member']
			else:
				_colors = (tcod.red, tcod.white)
				_values = ['Not Member', 'Member']
			
			_menu_items.append(menus.create_item('list',
			                                     ' '.join(LIFE[target_id]['name']),
			                                     _values,
			                                     group=group_id,
			                                     target_id=target_id,
			                                     members=_menu_items,
			                                     color=_colors,
			                                     dialog_id=_dialog_id))
		
		if not _menu_items:
			return False
		
		_menu = menus.create_menu(menu=_menu_items,
		                          title='Inform of Group Members',
		                          format_str='$k: $v',
		                          on_select=confirm_inform_of_group_members,
		                          close_on_select=True)
		menus.activate_menu(_menu)
	else:
		for target_id in groups.get_group(life, group_id)['members']:
			if life['id'] == target_id:
				continue
			
			memory.create_question(life, target_id, 'group_list',
				                   group_id=group_id,
				                   group_list=groups.get_group(life, group_id)['members'])
Exemplo n.º 5
0
def wants_group_member(life, life_id):
	if not life['group']:
		return False
	
	if groups.is_member(life, life['group'], life_id):
		return False
	
	if not groups.is_leader(life, life['group'], life['id']):
		return False
	
	if not lfe.execute_raw(life, 'group', 'wants_group_member', life_id=life_id):
		return False
	
	_know = brain.knows_alife_by_id(life, life_id)
	if not _know:
		return False
	
	if not judgement.can_trust(life, life_id):
		return False
	
	return True
Exemplo n.º 6
0
def wants_group_member(life, life_id):
    if not life['group']:
        return False

    if groups.is_member(life, life['group'], life_id):
        return False

    if not groups.is_leader(life, life['group'], life['id']):
        return False

    if not lfe.execute_raw(
            life, 'group', 'wants_group_member', life_id=life_id):
        return False

    _know = brain.knows_alife_by_id(life, life_id)
    if not _know:
        return False

    if not judgement.can_trust(life, life_id):
        return False

    return True