Beispiel #1
0
Character::Character(MessageIn &msg):
    Being(OBJECT_CHARACTER),
    mClient(NULL),
    mConnected(true),
    mTransactionHandler(NULL),
    mSpecialUpdateNeeded(false),
    mDatabaseID(-1),
    mHairStyle(0),
    mHairColor(0),
    mLevel(1),
    mLevelProgress(0),
    mUpdateLevelProgress(false),
    mRecalculateLevel(true),
    mParty(0),
    mTransaction(TRANS_NONE),
    mTalkNpcId(0),
    mNpcThread(0),
    mKnuckleAttackInfo(0)
{
    const AttributeManager::AttributeScope &attr =
                           attributeManager->getAttributeScope(CharacterScope);
    LOG_DEBUG("Character creation: initialisation of "
              << attr.size() << " attributes.");
    for (AttributeManager::AttributeScope::const_iterator it1 = attr.begin(),
         it1_end = attr.end(); it1 != it1_end; ++it1)
        mAttributes.insert(std::make_pair(it1->first, Attribute(*it1->second)));

    setWalkMask(Map::BLOCKMASK_WALL);
    setBlockType(BLOCKTYPE_CHARACTER);

    // Get character data.
    mDatabaseID = msg.readInt32();
    setName(msg.readString());
    deserializeCharacterData(*this, msg);
    mOld = getPosition();
    Inventory(this).initialize();
    modifiedAllAttribute();
    setSize(16);

    // Default knuckle attack
    int damageBase = this->getModifiedAttribute(ATTR_STR);
    int damageDelta = damageBase / 2;
    Damage knuckleDamage;
    knuckleDamage.skill = skillManager->getDefaultSkillId();
    knuckleDamage.base = damageBase;
    knuckleDamage.delta = damageDelta;
    knuckleDamage.cth = 2;
    knuckleDamage.element = ELEMENT_NEUTRAL;
    knuckleDamage.type = DAMAGE_PHYSICAL;
    knuckleDamage.range = DEFAULT_TILE_LENGTH;

    mKnuckleAttackInfo = new AttackInfo(0, knuckleDamage, 7, 3, 0);
    addAttack(mKnuckleAttackInfo);
}
Beispiel #2
0
Character::Character(MessageIn &msg):
    Being(OBJECT_CHARACTER),
    mClient(NULL),
    mConnected(true),
    mTransactionHandler(NULL),
    mSpecialUpdateNeeded(false),
    mDatabaseID(-1),
    mHairStyle(0),
    mHairColor(0),
    mLevel(1),
    mLevelProgress(0),
    mUpdateLevelProgress(false),
    mRecalculateLevel(true),
    mParty(0),
    mTransaction(TRANS_NONE),
    mTalkNpcId(0),
    mNpcThread(0)
{
    const AttributeManager::AttributeScope &attr =
                           attributeManager->getAttributeScope(CharacterScope);
    LOG_DEBUG("Character creation: initialisation of "
              << attr.size() << " attributes.");
    for (AttributeManager::AttributeScope::const_iterator it1 = attr.begin(),
         it1_end = attr.end(); it1 != it1_end; ++it1)
        mAttributes.insert(std::make_pair(it1->first, Attribute(*it1->second)));

    setWalkMask(Map::BLOCKMASK_WALL | Map::BLOCKMASK_MONSTER);

    // Get character data.
    mDatabaseID = msg.readInt32();
    setName(msg.readString());
    deserializeCharacterData(*this, msg);
    mOld = getPosition();
    Inventory(this).initialize();
    modifiedAllAttribute();
    setSize(16);
}