Merge branch 'generic-gameplay'

feature/prepare-cross-merge
Ulukyn 5 years ago committed by kaetemi
parent 887dbdad0d
commit be3c81aa80
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -327,7 +327,7 @@ void CPetSpawnMsgImp::callback(std::string const& name, NLNET::TServiceId id)
CEntityId id = botPet->getSpawn()->getEntityId(); CEntityId id = botPet->getSpawn()->getEntityId();
float t = 0; float t = 0;
uint8 cont = 0; uint8 cont = 0;
uint8 one = 1; uint8 one = 0;
sint32 x = position.x(); sint32 x = position.x();
sint32 y = position.y(); sint32 y = position.y();
sint32 z = position.h(); sint32 z = position.h();

@ -4255,8 +4255,9 @@ ENTITY_VARIABLE(Invisible, "Invisibility of a player")
CCharacter *c = dynamic_cast<CCharacter*>(e); CCharacter *c = dynamic_cast<CCharacter*>(e);
uint64 val; uint64 val;
bool isVisible = R2_VISION::isEntityVisibleToPlayers(e->getWhoSeesMe());
if (value=="1" || value=="on" || strlwr(value)=="true" ) if (value=="1" || value=="on" || strlwr(value)=="true" || (strlwr(value)=="toggle" && isVisible))
{ {
if (c != NULL) if (c != NULL)
c->setInvisibility(true); c->setInvisibility(true);
@ -4283,7 +4284,7 @@ ENTITY_VARIABLE(Invisible, "Invisibility of a player")
val=0; val=0;
} }
} }
else if (value=="0" || value=="off" || strlwr(value)=="false" ) else if (value=="0" || value=="off" || strlwr(value)=="false" || strlwr(value)=="toggle")
{ {
if (c != NULL) if (c != NULL)
c->setInvisibility(false); c->setInvisibility(false);
@ -4443,15 +4444,17 @@ ENTITY_VARIABLE (God, "God mode, invulnerability")
} }
else else
{ {
if (value=="1" || value=="on" || strlwr(value)=="god" || strlwr(value)=="true" ) if (value=="1" || value=="on" || strlwr(value)=="god" || strlwr(value)=="true" || (strlwr(value)=="toggle" && !c->godMode()))
{ {
c->setGodModeSave(true); c->setGodModeSave(true);
c->setGodMode(true); c->setGodMode(true);
c->setBonusMalusName("god", c->addEffectInDB(CSheetId("berserk.sbrick"), true));
} }
else if (value=="0" || value=="off" || strlwr(value)=="false" ) else if (value=="0" || value=="off" || strlwr(value)=="false" || strlwr(value)=="toggle")
{ {
c->setGodModeSave(false); c->setGodModeSave(false);
c->setGodMode(false); c->setGodMode(false);
c->removeEffectInDB(c->getBonusMalusName("god"), true);
} }
nlinfo ("%s %s now in god mode", entity.toString().c_str(), c->godMode()?"is":"isn't"); nlinfo ("%s %s now in god mode", entity.toString().c_str(), c->godMode()?"is":"isn't");
} }
@ -4468,13 +4471,15 @@ ENTITY_VARIABLE (Invulnerable, "Invulnerable mode, invulnerability too all")
} }
else else
{ {
if (value=="1" || value=="on" || strlwr(value)=="invulnerable" || strlwr(value)=="true" ) if (value=="1" || value=="on" || strlwr(value)=="invulnerable" || strlwr(value)=="true" || (strlwr(value)=="toggle" && !c->invulnerableMode()))
{ {
c->setInvulnerableMode(true); c->setInvulnerableMode(true);
c->setBonusMalusName("invulnerability", c->addEffectInDB(CSheetId("invulnerability.sbrick"), true));
} }
else if (value=="0" || value=="off" || strlwr(value)=="false" ) else if (value=="0" || value=="off" || strlwr(value)=="false" || strlwr(value)=="toggle")
{ {
c->setInvulnerableMode(false); c->setInvulnerableMode(false);
c->removeEffectInDB(c->getBonusMalusName("invulnerability"), true);
} }
nlinfo ("%s %s now in invulnerable mode", entity.toString().c_str(), c->invulnerableMode()?"is":"isn't"); nlinfo ("%s %s now in invulnerable mode", entity.toString().c_str(), c->invulnerableMode()?"is":"isn't");
} }

@ -919,6 +919,21 @@ public:
void setEventSpeedVariationModifier(float value) { _EventSpeedVariationModifier = value; } void setEventSpeedVariationModifier(float value) { _EventSpeedVariationModifier = value; }
float getEventSpeedVariationModifier() { return _EventSpeedVariationModifier; } float getEventSpeedVariationModifier() { return _EventSpeedVariationModifier; }
void setBonusMalusName(const std::string& name, sint8 id)
{
if (id == -1)
_BonusMalusNames.erase(name);
else
_BonusMalusNames[name] = id;
}
sint8 getBonusMalusName(const std::string& name)
{
if (_BonusMalusNames.find(name) != _BonusMalusNames.end())
return _BonusMalusNames[name];
return -1;
}
/// change the outpost alias /// change the outpost alias
virtual void setOutpostAlias( uint32 id ); virtual void setOutpostAlias( uint32 id );
/// get the outpost alias /// get the outpost alias
@ -1072,6 +1087,8 @@ protected:
} IdAndSide; } IdAndSide;
}; };
CMirrorPropValueAlice< uint16, CPropLocationPacked<2> > _OutpostInfos; CMirrorPropValueAlice< uint16, CPropLocationPacked<2> > _OutpostInfos;
std::map<std::string, uint16> _BonusMalusNames;
}; };

@ -704,6 +704,14 @@ void finalizeClientReady( uint32 userId, uint32 index )
delete CmdDisplayer; delete CmdDisplayer;
delete CmdLogger; delete CmdLogger;
} }
if (c->godMode())
c->setBonusMalusName("god", c->addEffectInDB(CSheetId("berserk.sbrick"), true));
if (c->invulnerableMode())
c->setBonusMalusName("invulnerability", c->addEffectInDB(CSheetId("invulnerability.sbrick"), true));
c->setFinalized(true); c->setFinalized(true);
} // finalizeClientReady // } // finalizeClientReady //

@ -7590,6 +7590,7 @@ void CCharacter::sendAnimalCommand(uint8 petIndexCode, uint8 command)
{ {
case ANIMALS_ORDERS::ENTER_BAG: case ANIMALS_ORDERS::ENTER_BAG:
_PlayerPets[petIndex].PetStatus = CPetAnimal::in_bag;
if (_PlayerPets[petIndex].IsInBag) if (_PlayerPets[petIndex].IsInBag)
continue; continue;

@ -313,7 +313,7 @@ struct CPetAnimal
DECLARE_PERSISTENCE_METHODS DECLARE_PERSISTENCE_METHODS
enum TStatus { db_unknown = -1, not_present = 0, waiting_spawn, landscape, stable, death, tp_continent }; enum TStatus { db_unknown = -1, not_present = 0, waiting_spawn, landscape, stable, death, tp_continent, in_bag };
TStatus PetStatus; TStatus PetStatus;
NLMISC::CSheetId TicketPetSheetId; NLMISC::CSheetId TicketPetSheetId;

@ -727,6 +727,7 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
LPROP(bool,IsFollowing,if(IsFollowing))\ LPROP(bool,IsFollowing,if(IsFollowing))\
LPROP(bool,IsMounted,if(IsMounted))\ LPROP(bool,IsMounted,if(IsMounted))\
PROP(bool,IsTpAllowed)\ PROP(bool,IsTpAllowed)\
PROP(bool,IsInBag)\
PROP(TSatiety,Satiety)\ PROP(TSatiety,Satiety)\
PROP2(CustomName, ucstring, CustomName, CustomName = val)\ PROP2(CustomName, ucstring, CustomName, CustomName = val)\

Loading…
Cancel
Save