mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-06-09 02:22:54 +00:00
fix: achievement crashes
WARNING: LIKELY TO CLEAR ACHIEVEMENTS THAT YOU HAVE ALREADY ACHIEVED (not that you could get that many with the crashes xd)
This commit is contained in:
parent
b6345b1936
commit
41adc39b28
|
|
@ -103,7 +103,7 @@ public:
|
|||
*/
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
|
||||
#else
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 3*972; // per user
|
||||
#endif
|
||||
unsigned int uiGameDefinedDataChangedBitmask;
|
||||
|
||||
|
|
|
|||
|
|
@ -1063,7 +1063,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
|
|||
// AWARD : Porkchop, cook and eat a porkchop.
|
||||
{
|
||||
Stat *cookPorkchop, *eatPorkchop;
|
||||
cookPorkchop = GenericStats::itemsCrafted(Item::porkChop_cooked_Id);
|
||||
cookPorkchop = GenericStats::itemsSmelted(Item::porkChop_cooked_Id);
|
||||
eatPorkchop = GenericStats::itemsUsed(Item::porkChop_cooked_Id);
|
||||
|
||||
if ( stat == cookPorkchop || stat == eatPorkchop )
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void Achievements::staticCtor()
|
|||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
Achievements::eatPorkChop = (new Achievement(eAward_eatPorkChop, L"eatPorkChop", 0, 0, Tile::treeTrunk, (Achievement *) buildSword))->setAwardLocallyOnly()->postConstruct();
|
||||
#else
|
||||
Achievements::eatPorkChop = (new Achievement(eAward_eatPorkChop, L"eatPorkChop", 0, 0, Tile::treeTrunk, (Achievement *) buildSword, "034", IDS_ACHIEVE_NAME_EAT_PORKCHOP, IDS_ACHIEVE_DESC_EAT_PORKCHOP))->postConstruct();
|
||||
Achievements::eatPorkChop = (new Achievement(eAward_eatPorkChop, L"eatPorkChop", 0, 0, Tile::treeTrunk, (Achievement *) buildSword, "034", IDS_ACHIEVE_NAME_EAT_PORKCHOP, IDS_ACHIEVE_DESC_EAT_PORKCHOP))->setAwardLocallyOnly()->postConstruct();
|
||||
#endif
|
||||
Achievements::play100Days = (new Achievement(eAward_play100Days, L"play100Days", 0, 0, Tile::treeTrunk, (Achievement *) buildSword, "035", IDS_ACHIEVE_NAME_PLAY_100_DAYS, IDS_ACHIEVE_DESC_PLAY_100_DAYS))->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::arrowKillCreeper = (new Achievement(eAward_arrowKillCreeper, L"arrowKillCreeper", 0, 0, Tile::treeTrunk, (Achievement *) buildSword, "036", IDS_ACHIEVE_NAME_ARROW_KILL_CREEPER, IDS_ACHIEVE_DESC_ARROW_KILL_CREEPER))->postConstruct();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ Stat *CommonStats::get_itemsUsed(int itemId)
|
|||
if (itemId == Item::porkChop_cooked_Id) return Stats::blocksPlaced[itemId];
|
||||
#endif
|
||||
if (itemId == Item::porkChop_cooked_Id) return Stats::blocksPlaced[itemId];
|
||||
else return nullptr;
|
||||
//return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void FurnaceResultSlot::checkTakeAchievements(shared_ptr<ItemInstance> carried)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _DURANGO
|
||||
|
||||
if (!player->level->isClientSide && removeCount > 0)
|
||||
{
|
||||
player->awardStat(
|
||||
|
|
@ -85,11 +85,9 @@ void FurnaceResultSlot::checkTakeAchievements(shared_ptr<ItemInstance> carried)
|
|||
GenericStats::param_itemsSmelted(carried->id, carried->getAuxValue(), removeCount)
|
||||
);
|
||||
}
|
||||
#else
|
||||
if (carried->id == Item::ironIngot_Id) player->awardStat(GenericStats::acquireIron(), GenericStats::param_acquireIron());
|
||||
if (carried->id == Item::fish_cooked_Id) player->awardStat(GenericStats::cookFish(), GenericStats::param_cookFish());
|
||||
//if (carried->id == Item::porkChop_cooked_Id) GenericStats::itemsCrafted(Item::porkChop_cooked_Id);
|
||||
#endif
|
||||
|
||||
removeCount = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "Monster.h"
|
||||
|
||||
#include "Item.h"
|
||||
#include "GenericStats.h"
|
||||
|
||||
GenericStats *GenericStats::instance = nullptr;
|
||||
|
|
@ -835,7 +835,10 @@ byteArray GenericStats::param_itemsSmelted(int id, int aux, int count)
|
|||
|
||||
byteArray GenericStats::param_itemsUsed(shared_ptr<Player> plr, shared_ptr<ItemInstance> itm)
|
||||
{
|
||||
if ( (plr != nullptr) && (itm != nullptr) ) return instance->getParam_itemsUsed(plr, itm);
|
||||
if ((plr != nullptr) && (itm != nullptr)) {
|
||||
if (itm->id == Item::porkChop_cooked_Id) return instance->param_eatPorkChop();
|
||||
return instance->getParam_itemsUsed(plr, itm);
|
||||
}
|
||||
else return instance->getParam_noArgs();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2623,7 +2623,7 @@ void Player::startUsingItem(shared_ptr<ItemInstance> instance, int duration)
|
|||
{
|
||||
setUsingItemFlag(true);
|
||||
}
|
||||
|
||||
//if (GenericStats::itemsUsed(instance->getItem()->id)->id < 0) return;
|
||||
// 4J-JEV, hook for ItemUsed event, and ironbelly achievement.
|
||||
awardStat(GenericStats::itemsUsed(instance->getItem()->id),
|
||||
GenericStats::param_itemsUsed(dynamic_pointer_cast<Player>(shared_from_this()),instance));
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ void Stat::_init()
|
|||
awardLocallyOnly = false;
|
||||
}
|
||||
|
||||
Stat::Stat(int id, const wstring& name, StatFormatter *formatter) : id(id), name(name), formatter(formatter)
|
||||
Stat::Stat(int id, const wstring& name1, StatFormatter *formatter) : id(id), name(name1), formatter(formatter)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
||||
Stat::Stat(int id, const wstring& name) : id(id), name(name), formatter(defaultFormatter)
|
||||
Stat::Stat(int id, const wstring& name1) : id(id), name(name1), formatter(defaultFormatter)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -528,8 +528,8 @@ void Stats::buildAdditionalStats()
|
|||
generalStat->postConstruct();
|
||||
}
|
||||
|
||||
biomesVisisted = StatArray(23);
|
||||
for (unsigned int i = 0; i < 23; i++)
|
||||
biomesVisisted = StatArray(170);
|
||||
for (unsigned int i = 0; i < 170; i++)
|
||||
{
|
||||
generalStat = new GeneralStat(offset++, L"biomesVisited." + std::to_wstring(i));
|
||||
generalStats->push_back(generalStat);
|
||||
|
|
|
|||
Loading…
Reference in a new issue