void Game_Actor::ChangeExp(int exp, bool level_up_message) { int new_level = GetLevel(); int new_exp = min(max(exp, 0), max_exp_value()); if (new_exp > GetExp()) { for (int i = GetLevel() + 1; i <= GetMaxLevel(); ++i) { if (GetNextExp(new_level) != -1 && GetNextExp(new_level) > new_exp) { break; } new_level++; } } else if (new_exp < GetExp()) { for (int i = GetLevel(); i > 1; --i) { if (new_exp >= GetNextExp(i - 1)) { break; } new_level--; } } SetExp(new_exp); if (new_level != GetLevel()) { ChangeLevel(new_level, level_up_message); } }
// agebreak : 이 구현은 캐릭터가 아닌, Mob에게 있어야 하지 않을까? void CCharacter::Killed(CCharacter* chr) { CLog::Add("몬스터를 죽였습니다."); char buf[100]; sprintf_s(buf, "%d경험치를 얻었습니다.", GetExp()); CLog::Add(buf); chr->AddExp(GetExp()); }
void Game_Actor::ChangeLevel(int new_level, bool level_up_message) { const std::vector<RPG::Learning>* skills; if (GetData().class_id > 0) { skills = &GetClass()->skills; } else { skills = &GetActor().skills; } bool level_up = false; int old_level = GetLevel(); SetLevel(new_level); new_level = GetLevel(); // Level adjusted to max if (new_level > old_level) { if (level_up_message) { Game_Message::texts.push_back(GetLevelUpMessage(new_level)); level_up = true; } // Learn new skills for (const RPG::Learning& learn : *skills) { // Skill learning, up to current level if (learn.level > old_level && learn.level <= new_level) { LearnSkill(learn.skill_id); if (level_up_message) { Game_Message::texts.push_back(GetLearningMessage(learn)); level_up = true; } } } if (level_up) { Game_Message::texts.back().append("\f"); Game_Message::message_waiting = true; } // Experience adjustment: // At least level minimum SetExp(max(GetBaseExp(), GetExp())); } else if (new_level < old_level) { // Experience adjustment: // Level minimum if higher then Level maximum if (GetExp() >= GetNextExp()) { SetExp(GetBaseExp()); } } }
CNode* Math::GetPas() { CNode* tmp; if (*S == '(') { S++; tmp = GetExp(); try { if (*S != ')') throw string ("Expected ')'. Please correct expression\n"); } catch(string ex) { cout << ex << endl; exit(1); } S++; } else if (*S == 'x') //пока считаем, что переменная только x( потом добавить все переменные) { S++; tmp = new CNode('x'); } else if (((*S >= 'a') && (*S <= 'z'))) { tmp = GetFunc(); } else { tmp = GetNum(); } return tmp; }
bool psServerVitals::SendStatDRMessage(uint32_t clientnum, EID eid, int flags, csRef<PlayerGroup> group) { bool backup=0; if (flags) { backup = statsDirty ? true : false; statsDirty = flags; } else if (version % 10 == 0) // every 10th msg to this person, send everything statsDirty = DIRTY_VITAL_ALL; if (!statsDirty) return false; csArray<float> fVitals; csArray<uint32_t> uiVitals; if (statsDirty & DIRTY_VITAL_HP) fVitals.Push(PERCENT_VALUE(VITAL_HITPOINTS)); if (statsDirty & DIRTY_VITAL_HP_RATE) fVitals.Push(PERCENT_RATE(VITAL_HITPOINTS)); if (statsDirty & DIRTY_VITAL_MANA) fVitals.Push(PERCENT_VALUE(VITAL_MANA)); if (statsDirty & DIRTY_VITAL_MANA_RATE) fVitals.Push(PERCENT_RATE(VITAL_MANA)); // Physical Stamina if (statsDirty & DIRTY_VITAL_PYSSTAMINA) fVitals.Push(PERCENT_VALUE(VITAL_PYSSTAMINA)); if (statsDirty & DIRTY_VITAL_PYSSTAMINA_RATE) fVitals.Push(PERCENT_RATE(VITAL_PYSSTAMINA)); // Mental Stamina if (statsDirty & DIRTY_VITAL_MENSTAMINA) fVitals.Push(PERCENT_VALUE(VITAL_MENSTAMINA)); if (statsDirty & DIRTY_VITAL_MENSTAMINA_RATE) fVitals.Push(PERCENT_RATE(VITAL_MENSTAMINA)); if (statsDirty & DIRTY_VITAL_EXPERIENCE) uiVitals.Push(GetExp()); if (statsDirty & DIRTY_VITAL_PROGRESSION) uiVitals.Push(GetPP()); psStatDRMessage msg(clientnum, eid, fVitals, uiVitals, ++version, statsDirty); if (group == NULL) msg.SendMessage(); else group->Broadcast(msg.msg); statsDirty = backup; return true; }
CNode* Math::GetFunc() { CNode* tmp; string f; while(*S != '(') { f += *S; S++; } S++; try { if (strcmp(f.c_str(), "sin") == 0) { tmp = new CNode("sin", GetExp()); } else if (strcmp(f.c_str(), "cos") == 0) { tmp = new CNode("cos", GetExp()); } else if (strcmp(f.c_str(), "ln") == 0) { tmp = new CNode("ln", GetExp()); } else if (strcmp(f.c_str(), "tg") == 0) { tmp = new CNode("tg", GetExp()); } else { throw string ("This function not exist. Please correct expression\n"); } S++; } catch (string ex) { cout << ex << endl; exit(1); } return tmp; }
void cPlayer::Send_PlayerInfo() { MyPlayerInfoAq* pInfo = (MyPlayerInfoAq*)PrepareSendPacket( sizeof( MyPlayerInfoAq ) ); if( NULL == pInfo ) return; pInfo->s_sType = MyPlayerInfo_Aq; pInfo->s_byDur = GetDur(); pInfo->s_byLevel = GetLevel(); pInfo->s_byStr = GetStr(); pInfo->s_dwExp = GetExp(); pInfo->s_dwHp = GetHp(); pInfo->s_dwPKey = GetPKey(); pInfo->s_dwPos = GetPos(); strncpy( pInfo->s_szId , GetId() , MAX_ID_LENGTH ); strncpy( pInfo->s_szName , GetName() , MAX_NAME_LENGTH ); strncpy( pInfo->s_szNickName , GetNickName() , MAX_NICKNAME_LENGTH ); SendPost( sizeof( MyPlayerInfoAq ) ); }
void Game_Actor::SetClass(int _class_id) { if (_class_id != 0) { const RPG::Class* cls = ReaderUtil::GetElement(Data::classes, _class_id); if (!cls) { Output::Warning("Actor %d: Can't change to invalid class %d", GetId(), _class_id); return; } } GetData().class_id = _class_id; GetData().changed_battle_commands = true; // Any change counts as a battle commands change. // The class settings are not applied when the actor has a class on startup // but only when the "Change Class" event command is used. if (_class_id > 0) { GetData().super_guard = GetClass()->super_guard; GetData().lock_equipment = GetClass()->lock_equipment; GetData().two_weapon = GetClass()->two_weapon; GetData().auto_battle = GetClass()->auto_battle; GetData().battler_animation = GetClass()->battler_animation; GetData().battle_commands = GetClass()->battle_commands; } else { GetData().super_guard = GetActor().super_guard; GetData().lock_equipment = GetActor().lock_equipment; GetData().two_weapon = GetActor().two_weapon; GetData().auto_battle = GetActor().auto_battle; GetData().battler_animation = 0; GetData().battle_commands = GetActor().battle_commands; } MakeExpList(); // Set EXP to at least minimum value if (GetExp() < GetBaseExp()) { SetExp(GetBaseExp()); } }
void EQEmu::ItemInstance::ScaleItem() { if (!m_item) return; if (m_scaledItem) { memcpy(m_scaledItem, m_item, sizeof(ItemData)); } else { m_scaledItem = new ItemData(*m_item); } float Mult = (float)(GetExp()) / 10000; // scaling is determined by exp, with 10,000 being full stats m_scaledItem->AStr = (int8)((float)m_item->AStr*Mult); m_scaledItem->ASta = (int8)((float)m_item->ASta*Mult); m_scaledItem->AAgi = (int8)((float)m_item->AAgi*Mult); m_scaledItem->ADex = (int8)((float)m_item->ADex*Mult); m_scaledItem->AInt = (int8)((float)m_item->AInt*Mult); m_scaledItem->AWis = (int8)((float)m_item->AWis*Mult); m_scaledItem->ACha = (int8)((float)m_item->ACha*Mult); m_scaledItem->MR = (int8)((float)m_item->MR*Mult); m_scaledItem->PR = (int8)((float)m_item->PR*Mult); m_scaledItem->DR = (int8)((float)m_item->DR*Mult); m_scaledItem->CR = (int8)((float)m_item->CR*Mult); m_scaledItem->FR = (int8)((float)m_item->FR*Mult); m_scaledItem->HP = (int32)((float)m_item->HP*Mult); m_scaledItem->Mana = (int32)((float)m_item->Mana*Mult); m_scaledItem->AC = (int32)((float)m_item->AC*Mult); // check these..some may not need to be modified (really need to check all stats/bonuses) //m_scaledItem->SkillModValue = (int32)((float)m_item->SkillModValue*Mult); //m_scaledItem->BaneDmgAmt = (int8)((float)m_item->BaneDmgAmt*Mult); // watch (10 entries with charmfileid) m_scaledItem->BardValue = (int32)((float)m_item->BardValue*Mult); // watch (no entries with charmfileid) m_scaledItem->ElemDmgAmt = (uint8)((float)m_item->ElemDmgAmt*Mult); // watch (no entries with charmfileid) m_scaledItem->Damage = (uint32)((float)m_item->Damage*Mult); // watch m_scaledItem->CombatEffects = (int8)((float)m_item->CombatEffects*Mult); m_scaledItem->Shielding = (int8)((float)m_item->Shielding*Mult); m_scaledItem->StunResist = (int8)((float)m_item->StunResist*Mult); m_scaledItem->StrikeThrough = (int8)((float)m_item->StrikeThrough*Mult); m_scaledItem->ExtraDmgAmt = (uint32)((float)m_item->ExtraDmgAmt*Mult); m_scaledItem->SpellShield = (int8)((float)m_item->SpellShield*Mult); m_scaledItem->Avoidance = (int8)((float)m_item->Avoidance*Mult); m_scaledItem->Accuracy = (int8)((float)m_item->Accuracy*Mult); m_scaledItem->FactionAmt1 = (int32)((float)m_item->FactionAmt1*Mult); m_scaledItem->FactionAmt2 = (int32)((float)m_item->FactionAmt2*Mult); m_scaledItem->FactionAmt3 = (int32)((float)m_item->FactionAmt3*Mult); m_scaledItem->FactionAmt4 = (int32)((float)m_item->FactionAmt4*Mult); m_scaledItem->Endur = (uint32)((float)m_item->Endur*Mult); m_scaledItem->DotShielding = (uint32)((float)m_item->DotShielding*Mult); m_scaledItem->Attack = (uint32)((float)m_item->Attack*Mult); m_scaledItem->Regen = (uint32)((float)m_item->Regen*Mult); m_scaledItem->ManaRegen = (uint32)((float)m_item->ManaRegen*Mult); m_scaledItem->EnduranceRegen = (uint32)((float)m_item->EnduranceRegen*Mult); m_scaledItem->Haste = (uint32)((float)m_item->Haste*Mult); m_scaledItem->DamageShield = (uint32)((float)m_item->DamageShield*Mult); m_scaledItem->Purity = (uint32)((float)m_item->Purity*Mult); m_scaledItem->BackstabDmg = (uint32)((float)m_item->BackstabDmg*Mult); m_scaledItem->DSMitigation = (uint32)((float)m_item->DSMitigation*Mult); m_scaledItem->HeroicStr = (int32)((float)m_item->HeroicStr*Mult); m_scaledItem->HeroicInt = (int32)((float)m_item->HeroicInt*Mult); m_scaledItem->HeroicWis = (int32)((float)m_item->HeroicWis*Mult); m_scaledItem->HeroicAgi = (int32)((float)m_item->HeroicAgi*Mult); m_scaledItem->HeroicDex = (int32)((float)m_item->HeroicDex*Mult); m_scaledItem->HeroicSta = (int32)((float)m_item->HeroicSta*Mult); m_scaledItem->HeroicCha = (int32)((float)m_item->HeroicCha*Mult); m_scaledItem->HeroicMR = (int32)((float)m_item->HeroicMR*Mult); m_scaledItem->HeroicFR = (int32)((float)m_item->HeroicFR*Mult); m_scaledItem->HeroicCR = (int32)((float)m_item->HeroicCR*Mult); m_scaledItem->HeroicDR = (int32)((float)m_item->HeroicDR*Mult); m_scaledItem->HeroicPR = (int32)((float)m_item->HeroicPR*Mult); m_scaledItem->HeroicSVCorrup = (int32)((float)m_item->HeroicSVCorrup*Mult); m_scaledItem->HealAmt = (int32)((float)m_item->HealAmt*Mult); m_scaledItem->SpellDmg = (int32)((float)m_item->SpellDmg*Mult); m_scaledItem->Clairvoyance = (uint32)((float)m_item->Clairvoyance*Mult); m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself. }
ExposantItteratif::operator double() const { return CalculExpItteratif(GetBase(), GetExp()); }
std::string Game_Actor::GetExpString() const { std::stringstream ss; ss << GetExp(); return ss.str(); }