/* We need to initialize this class with Aux data */
void Equipable::PullAuxData()
{
    m_ItemBase = g_ItemBaseMgr->GetItem(m_AuxEquipItem->GetItemTemplateID());

    if (!m_ItemBase)
    {
        return;
    }

    m_UsesAmmo = (m_ItemBase->SubCategory() == 101 || m_ItemBase->SubCategory() == 102);

	m_ItemInstance = m_ItemBase->GetItemInstance(m_AuxEquipItem->GetInstanceInfo());

	if (m_UsesAmmo && m_AuxAmmoItem->GetItemTemplateID() > 0)
	{
		if (m_AmmoBase = g_ItemBaseMgr->GetItem(m_AuxAmmoItem->GetItemTemplateID()))
		{
			m_AmmoInstance = m_AmmoBase->GetAmmoInstance(m_AuxAmmoItem->GetInstanceInfo());
		}
	}

    //TODO: Once server is stable, this needs to check if ReadyTime < GetNet7TickCount() first
    m_AuxEquipItem->SetReadyTime(GetNet7TickCount());

    /* Only reactors, engines and shields have stats. Other items only have effects */
    //if (m_Slot < 3)
    //{
        SetStats();
    //}

    //AddEffects();
}
示例#2
0
// Loads member's data from database.
// If member has broken fields (level, class) returns false.
// In this case member has to be removed from guild.
bool Guild::Member::LoadFromDB(Field* fields)
{
    m_publicNote  = fields[3].GetString();
    m_officerNote = fields[4].GetString();

    for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS; ++i)
        m_bankWithdraw[i] = fields[5 + i].GetUInt32();

    SetStats(fields[12].GetString(),
             fields[13].GetUInt8(),                         // characters.level
             fields[14].GetUInt8(),                         // characters.class
             fields[15].GetUInt16(),                        // characters.zone
             fields[16].GetUInt32());                       // characters.account
    m_logoutTime = fields[17].GetUInt32();                  // characters.logout_time

    if (!CheckStats())
        return false;

    if (!m_zoneId)
    {
        TC_LOG_ERROR(LOG_FILTER_GUILD, "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid));
        m_zoneId = Player::GetZoneIdFromDB(m_guid);
    }
    ResetFlags();
    return true;
}
示例#3
0
// check if player can level up
bool CPlayer::CheckPlayerLevelUP( )
{
	if (CharInfo->Exp >= GetLevelEXP())
    {
	    CharInfo->Exp -= GetLevelEXP();
	    Stats->Level++;
	    Stats->HP = GetMaxHP( );
	    Stats->MP = GetMaxMP( );
	    CharInfo->StatPoints += int((Stats->Level * 0.8) + 10);
	    //if(Stats->Level>=10)
        CharInfo->SkillPoints += ((Stats->Level + 2) / 2);


		BEGINPACKET( pak, 0x79e );
		ADDWORD( pak, clientid );
		ADDWORD( pak, Stats->Level );
		ADDDWORD( pak, CharInfo->Exp );
		ADDWORD( pak, CharInfo->StatPoints );
		ADDWORD( pak, CharInfo->SkillPoints );
		client->SendPacket( &pak );

		RESETPACKET( pak, 0x79e );
		ADDWORD( pak, clientid );
		GServer->SendToVisible( &pak, this );
		SetStats( );
        //SendLevelUPtoChar(this);
        return true;
	}
	return false;
}
void pawsGroupWindow::Draw()
{
    GEMClientActor* player = psengine->GetCelClient()->GetMainPlayer();

    player->GetVitalMgr()->Predict( csGetTicks(),"Self" );

    if (memberList->GetRowCount()>0)
        SetStats( player );
    pawsWidget::Draw();
}
示例#5
0
Radiant::Radiant(int lvl)
{
	//m_hImage = SGD::GraphicsManager::GetInstance()->LoadTexture("resources/graphics/radiant.png");
	m_szSize = {  64, 64 };
	level = lvl;
	rateOfAttack = (100 - dexterity) * 0.01f;
	attackTimer = rateOfAttack;
	SetStats();
	charAnim.SetCurrAnimation("Rad_Idle");

	SetWeapon(new Pistol(Pistol::PistolType::spittle));	
	weapon->Release();
}
void Equipable::FinishInstall()
{
    /* Remove our time node */
    RemoveTimeNode();

    /* Set the ItemState */
    if (!(m_AuxEquipItem->GetItemState() & ITEM_STATE_NO_AMMO))
    {
        RemoveItemStateFlag(ITEM_STATE_DISABLED);
    }

    /* Add the item's stats, if needed */
    SetStats();

    AddEffects();
    m_Player->SendAuxShip();
}
示例#7
0
// check if player can level up
bool CPlayer::CheckPlayerLevelUP( )
{
	if (CharInfo->Exp >= GetLevelEXP())
    {
	    CharInfo->Exp -= GetLevelEXP();
	    Stats->Level++;
	    Stats->HP = GetMaxHP( );
	    Stats->MP = GetMaxMP( );
	    CharInfo->StatPoints += int((Stats->Level*0.8)+10);
      // Proper skill point distribution for Pre-Evo
      switch (Stats->Level) {
        case 10:
        case 14:
          CharInfo->SkillPoints += 2;
        break;
        case 18:
          CharInfo->SkillPoints += 3;
        break;
        case 22:
          CharInfo->SkillPoints += 4;
        break;
      }
      // 5 skill points every 4 levels from 22
      if (Stats->Level > 22 && Stats->Level < 99 && ((Stats->Level - 22) % 4) == 0)
        CharInfo->SkillPoints += 5;
      // 5 skill points every 2 levels from 98
      if (Stats->Level > 98 && (Stats->Level % 2) == 0)
        CharInfo->SkillPoints += 5;

		BEGINPACKET( pak, 0x79e );
		ADDWORD( pak, clientid );
		ADDWORD( pak, Stats->Level );
		ADDDWORD( pak, CharInfo->Exp );
		ADDWORD( pak, CharInfo->StatPoints );
		ADDWORD( pak, CharInfo->SkillPoints );
		client->SendPacket( &pak );

		RESETPACKET( pak, 0x79e );
		ADDWORD( pak, clientid );
		GServer->SendToVisible( &pak, this );
		SetStats( );
        //SendLevelUPtoChar(this);
        return true;
	}
	return false;
}
/* This returns the item thats un-equiped as its possible to unequip ammo and leave launcher */
_Item Equipable::Equip(_Item * NewItem)
{
    /* NOTE: This item has already passed equip checks */
    if (NewItem->ItemTemplateID == -2)
    {
        return *NewItem;
    }

    /* Check to see if we are equiping ammo */
    if (CorrectAmmo(NewItem))
    {
		return EquipAmmo(NewItem);
    }

    /* Unequip item */
    if (NewItem->ItemTemplateID == -1)
    {
        RemoveEffects();
		SetStats(true);		// Remove old Stats

        _Item OldItem = *m_AuxEquipItem->GetItemData();

        m_AuxEquipItem->SetItemData(NewItem);
        m_ItemBase = 0;
        m_AmmoBase = 0;
        m_UsesAmmo = false;

        /* If this was a weapon, remove the Asset */
        if (m_Type == EQUIP_WEAPON)
        {
            m_Player->ShipIndex()->Lego.Attachments.Attachment[m_Slot-3].Clear();
        }

		m_Player->SaveEquipmentChange(m_Slot, NewItem);

        return OldItem;
    }

	/* If we have ammo, it gets removed with the launcher */
	if (m_UsesAmmo && m_AuxAmmoItem->GetItemTemplateID() > 0)
	{
        m_Player->CargoAddItem(m_AuxAmmoItem->GetData());
        m_AuxAmmoItem->Clear();
        m_AmmoBase = 0;
		m_Player->SaveAmmoChange(m_Slot, m_AuxAmmoItem->GetData());
	}

	// Make sure we are calculating quality on item
	m_Player->QualityCalculator(NewItem);

    ItemBase * NewItemBase = g_ItemBaseMgr->GetItem(NewItem->ItemTemplateID);

    /* Make sure we have an itembase, if not, return the item back */
    if (!NewItemBase)
    {
        LogMessage("Could not find ItemBase for ItemID %d\n",NewItem->ItemTemplateID);
        return *NewItem;
    }

    /* Begin equip process */
    RemoveEffects();
	SetStats(true);		// Remove old Stats

	m_ItemBase = NewItemBase;
    m_ItemInstance = m_ItemBase->GetItemInstance(NewItem->InstanceInfo);

    /* If this is a launcher set the Ammo flag */
    m_UsesAmmo = (m_ItemBase->SubCategory() == 101 || m_ItemBase->SubCategory() == 102);

    /* For now, make equip time be 10 seconds for each activatable effect, plus weapon reload time */
    unsigned long EquipTime = (unsigned long)(m_ItemBase->ActivatableCount() * 10000) +
							  (unsigned long)(m_ItemInstance.WeaponReload * 1000.0f);

    _Item OldItem = *m_AuxEquipItem->GetItemData();

    /* Install this item */
    m_AuxEquipItem->SetItemData(NewItem);

    /* If this was a weapon, set the Asset */
    if (m_Type == EQUIP_WEAPON)
    {
        m_Player->ShipIndex()->Lego.Attachments.Attachment[m_Slot-3].Clear();
        m_Player->ShipIndex()->Lego.Attachments.Attachment[m_Slot-3].SetAsset(m_ItemBase->GameBaseAsset());
        m_Player->ShipIndex()->Lego.Attachments.Attachment[m_Slot-3].SetType(2);
        m_Player->ShipIndex()->Lego.Attachments.Attachment[m_Slot-3].SetBoneName(m_Player->ShipIndex()->Inventory.MountBones.GetMountBoneName(m_Slot));

        /* Turn on autofire for this item */
        m_AuxEquipItem->SetItemState(m_AuxEquipItem->GetItemState() | ITEM_STATE_AUTO_FIRE_ENABLE);
    }


    Install(EquipTime);

	m_Player->SaveEquipmentChange(m_Slot, NewItem);

    return OldItem;
}