mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
#1470 initial EGS with achievements
This commit is contained in:
parent
24d386a9d2
commit
c521b9e080
5 changed files with 195 additions and 0 deletions
|
@ -147,6 +147,8 @@
|
|||
#include "server_share/log_character_gen.h"
|
||||
#include "server_share/log_item_gen.h"
|
||||
|
||||
#include "player_manager/character_achievements.h"
|
||||
|
||||
///////////
|
||||
// USING //
|
||||
///////////
|
||||
|
@ -600,6 +602,7 @@ CCharacter::CCharacter(): CEntityBase(false),
|
|||
_CurrentParrySkill = BarehandCombatSkill;
|
||||
|
||||
_EncycloChar = new CCharacterEncyclopedia(*this);
|
||||
_AchievementsChar = new CCharacterAchievements(*this);
|
||||
_GameEvent = new CCharacterGameEvent(*this);
|
||||
_RespawnPoints = new CCharacterRespawnPoints(*this);
|
||||
_PlayerRoom = new CPlayerRoomInterface;
|
||||
|
@ -1520,6 +1523,8 @@ uint32 CCharacter::tickUpdate()
|
|||
nextUpdate = 8;
|
||||
}
|
||||
|
||||
_AchievementsPlayer->tickUpdate();
|
||||
|
||||
return nextUpdate;
|
||||
} // tickUpdate //
|
||||
|
||||
|
@ -2777,6 +2782,7 @@ CCharacter::~CCharacter()
|
|||
_BarUpdateTimer.reset();
|
||||
|
||||
delete _EncycloChar;
|
||||
delete _AchievementsChar;
|
||||
delete _GameEvent;
|
||||
delete _RespawnPoints;
|
||||
delete _PlayerRoom;
|
||||
|
@ -2793,6 +2799,12 @@ CCharacter::~CCharacter()
|
|||
// NLMEMORY::StatisticsReport( "egs_memory_report.csv", false );
|
||||
} // destructor //
|
||||
|
||||
|
||||
void CCharacter::mobKill(TDataSetRow creatureRowId)
|
||||
{
|
||||
_AchievementsChar->mobKill(creatureRowId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
// prepareToLoad: method called before applying a pdr save record
|
||||
//
|
||||
|
@ -13030,7 +13042,10 @@ void CCharacter::setPlaces(const std::vector<const CPlace*> & places)
|
|||
const uint size = (uint)places.size();
|
||||
_Places.resize(places.size());
|
||||
for ( uint i = 0; i < size; i++ )
|
||||
{
|
||||
_Places[i] = places[i]->getId();
|
||||
_AchievementsChar->inPlace(places[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
|
@ -14087,6 +14102,11 @@ void CCharacter::sendCloseTempInventoryImpulsion()
|
|||
//-----------------------------------------------
|
||||
void CCharacter::setFameValuePlayer(uint32 factionIndex, sint32 playerFame, sint32 fameMax, uint16 fameTrend)
|
||||
{
|
||||
if (playerFame != NO_FAME)
|
||||
{
|
||||
_AchievementsChar->fameValue(factionIndex, playerFame);
|
||||
}
|
||||
|
||||
uint32 firstTribeFameIndex = CStaticFames::getInstance().getFirstTribeFameIndex();
|
||||
uint32 firstTribeDbIndex = CStaticFames::getInstance().getDatabaseIndex( firstTribeFameIndex );
|
||||
uint32 fameIndexInDatabase = CStaticFames::getInstance().getDatabaseIndex( factionIndex );
|
||||
|
|
|
@ -115,6 +115,7 @@ class CMissionEvent;
|
|||
class CMissionSolo;
|
||||
class CCharacterVersionAdapter;
|
||||
class CCharacterEncyclopedia;
|
||||
class CCharacterAchievements;
|
||||
class CCharacterGameEvent;
|
||||
class CCharacterRespawnPoints;
|
||||
class CCharacterShoppingList;
|
||||
|
@ -435,6 +436,8 @@ private:
|
|||
NL_INSTANCE_COUNTER_DECL(CCharacter);
|
||||
public:
|
||||
|
||||
void mobKill(TDataSetRow creatureRowId);
|
||||
|
||||
// Start by declaring methods for persistent load/ save operations
|
||||
// The following macro is defined in persistent_data.h
|
||||
// At time of writing it evaluated to:
|
||||
|
@ -3442,6 +3445,8 @@ private:
|
|||
|
||||
CCharacterEncyclopedia *_EncycloChar;
|
||||
|
||||
CCharacterAchievements *_AchievementsChar;
|
||||
|
||||
CCharacterGameEvent *_GameEvent;
|
||||
|
||||
CCharacterRespawnPoints *_RespawnPoints;
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// includes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "stdpch.h"
|
||||
//#include "egs_sheets/egs_sheets.h"
|
||||
//#include "egs_sheets/egs_static_encyclo.h"
|
||||
//#include "game_share/msg_encyclopedia.h"
|
||||
//#include "game_share/string_manager_sender.h"
|
||||
//#include "player_manager/player_manager.h"
|
||||
//#include "player_manager/player.h"
|
||||
//#include "mission_manager/mission_manager.h"
|
||||
#include "player_manager/character_achievements.h"
|
||||
#include "player_manager/character.h"
|
||||
#include "phrase_manager/phrase_utilities_functions.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// namespaces
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
NL_INSTANCE_COUNTER_IMPL(CCharacterAchievements);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// methods CCharacterEncyclopedia
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
CCharacterAchievements::CCharacterAchievements(CCharacter &c) : _Char(c)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CCharacterAchievements::init()
|
||||
{
|
||||
nlinfo("hello achievements");
|
||||
//load atoms
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CCharacterAchievements::clear()
|
||||
{
|
||||
//clear atoms
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CCharacterAchievements::mobKill(TDataSetRow creatureRowId)
|
||||
{
|
||||
const CCreature *creature = CreatureManager.getCreature(creatureRowId);
|
||||
if (creature)
|
||||
{
|
||||
nlinfo("player has killed a mob: %s!",creature->getType().toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CCharacterAchievements::inPlace(const CPlace *region)
|
||||
{
|
||||
nlinfo("player in region %u",region->getId());
|
||||
}
|
||||
|
||||
void CCharacterAchievements::fameValue(uint32 factionIndex, sint32 playerFame)
|
||||
{
|
||||
nlinfo("fame: f(%u)=>v(%u)",factionIndex,playerFame);
|
||||
}
|
||||
|
||||
void CCharacterAchievements::tickUpdate()
|
||||
{
|
||||
//evaluate atoms
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef EGS_CHARACTER_ACHIEVEMENTS_H
|
||||
#define EGS_CHARACTER_ACHIEVEMENTS_H
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// includes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// game share
|
||||
//#include "game_share/persistent_data.h"
|
||||
#include "zone_manager.h"
|
||||
#include "creature_manager/creature.h"
|
||||
#include "creature_manager/creature_manager.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class CCharacter;
|
||||
|
||||
/**
|
||||
* Dynamic part of the encyclopedia stored in a character
|
||||
* This structure is optimized for size because its stored directly in the player persistant data stuff
|
||||
* We use CEncyMsgXXX for sending info to the player
|
||||
* \author Matthieu 'Trap' Besson
|
||||
* \author Nevrax France
|
||||
* \date November 2004
|
||||
*/
|
||||
class CCharacterAchievements
|
||||
{
|
||||
NL_INSTANCE_COUNTER_DECL(CCharacterAchievements);
|
||||
public:
|
||||
|
||||
CCharacterAchievements(CCharacter &c);
|
||||
|
||||
// Construct the encyclopedia album structure from the static sheet that defines encyclopedia
|
||||
// This method ensure that we have at least the same number of album and the same number of thema by album
|
||||
// as in the sheets defines the encyclopedia
|
||||
void init();
|
||||
|
||||
// remove all
|
||||
void clear();
|
||||
|
||||
void mobKill(TDataSetRow creatureRowId);
|
||||
|
||||
void inPlace(const CPlace *region);
|
||||
|
||||
void fameValue(uint32 factionIndex, sint32 playerFame);
|
||||
|
||||
void tickUpdate();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// The parent class
|
||||
CCharacter &_Char;
|
||||
|
||||
};
|
||||
|
||||
#endif // EGS_CHARACTER_ACHIEVEMENTS_H
|
|
@ -1980,6 +1980,8 @@ bool CCharacterActions::dispatchXpGain( TDataSetRow actor, TDataSetRow creatureR
|
|||
// compute xp gain on creature, cap xp gain per player to MaxXPGainPerPlayer
|
||||
const float xpGainPerOpponent = min( MaxXPGainPerPlayer.get(), float(xpFactor * maxXPGain / equivalentXpMembers) );
|
||||
|
||||
c->mobKill(creatureRowId);
|
||||
|
||||
TSkillProgressPerOpponentContainer::iterator it = _SkillProgressPerOpponent.find( creatureRowId );
|
||||
if( it != _SkillProgressPerOpponent.end() )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue