コード例 #1
0
ファイル: LoggedInState.cpp プロジェクト: Chimangoo/ember
bool LoggedInState::createCharacter(const std::string& name, const std::string& sex, const std::string& type, const std::string& description, const std::string& spawnName, const Atlas::Message::MapType& extraProperties)
{
	ConsoleBackend::getSingleton().pushMessage("Creating char...", "important");
	std::string msg;
	msg = "Creating character of type '" + type + "' with name '" + name + "' and sex '" + sex + "'.";
	ConsoleBackend::getSingleton().pushMessage(msg, "info");

	S_LOG_INFO("Creating character.");
	Atlas::Objects::Entity::RootEntity character;
	for (auto& property : extraProperties) {
		character->setAttr(property.first, property.second);
	}

	character->setParentsAsList(Atlas::Message::ListType(1, type));
	character->setName(name);
	character->setAttr("sex", sex);
	character->setAttr("description", description);
	if (spawnName != "") {
		character->setAttr("spawn_name", spawnName);
	}


	try {
		mAccount.createCharacter(character);
	} catch (const std::exception& except) {
		S_LOG_WARNING("Got Eris error on character creation." << except);
		return false;
	} catch (...) {
		S_LOG_WARNING("Got unknown error on character creation.");
		return false;
	}
	S_LOG_INFO("Done creating character.");

	return true;
}
コード例 #2
0
ファイル: Location.cpp プロジェクト: alriddoch/cyphesis
void Location::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
{
    if (m_loc!=NULL) {
        ent->setLoc(m_loc->getId());
    }
    if (pos().isValid()) {
        ::addToEntity(pos(), ent->modifyPos());
    }
    if (velocity().isValid()) {
        ::addToEntity(velocity(), ent->modifyVelocity());
    }
    if (orientation().isValid()) {
        ent->setAttr("orientation", orientation().toAtlas());
    }
    if (bBox().isValid()) {
        ent->setAttr("bbox", bBox().toAtlas());
    }
}
コード例 #3
0
ファイル: Admin.cpp プロジェクト: mrceresa/cyphesis
void Admin::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
{
    Account::addToEntity(ent);
    ListType typeList;
    Root character_type = Inheritance::instance().getClass("character");
    if (character_type.isValid()) {
        addTypeToList(character_type, typeList);
    }
    ent->setAttr("character_types", typeList);
}
コード例 #4
0
ファイル: Container.cpp プロジェクト: 9cat/cyphesis
void StdContainer::addToEntity(const std::string & key,
                               const Atlas::Objects::Entity::RootEntity & ent) const
{
    Atlas::Message::Element v = Atlas::Message::ListType();
    Atlas::Message::ListType & contlist = v.asList();
    EntitySet::const_iterator Iend = m_entities.end();
    for (EntitySet::const_iterator I = m_entities.begin(); I != Iend; ++I) {
        contlist.push_back((*I)->getId());
    }
    ent->setAttr(key, v);
}
コード例 #5
0
ファイル: Player.cpp プロジェクト: 9cat/cyphesis
void Player::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
{
    Account::addToEntity(ent);
    ListType typeList;
    std::set<std::string>::const_iterator I = Player::playableTypes.begin();
    std::set<std::string>::const_iterator Iend = Player::playableTypes.end();
    for (; I != Iend; ++I) {
        typeList.push_back(Element(*I));
    }
    ent->setAttr("character_types", typeList);
}
コード例 #6
0
void ExternalProperty::add(const std::string & s,
                           const Atlas::Objects::Entity::RootEntity & ent) const
{
    ent->setAttr(s, (m_data == 0) ? 0 : 1);
}