[Server] Place getters and setters in consistent order

new-script-api
David Cernat 7 years ago
parent 947b3f76be
commit 010a80ceca

@ -15,10 +15,10 @@ void Object::Init(LuaState &lua)
"refId", sol::property(&BaseObject::getRefId, &BaseObject::setRefId),
"refNum", sol::property(&BaseObject::getRefNum, &BaseObject::setRefNum),
"mpNum", sol::property(&BaseObject::getMpNum, &BaseObject::setMpNum),
"setPosition", &Object::setPosition,
"getPosition", &Object::getPosition,
"setRotation", &Object::setRotation,
"setPosition", &Object::setPosition,
"getRotation", &Object::getRotation,
"setRotation", &Object::setRotation,
"count", sol::property(&Object::getCount, &Object::setCount),
"goldValue", sol::property(&Object::getGoldValue, &Object::setGoldValue),
"scale", sol::property(&Object::getScale, &Object::setScale),

@ -28,7 +28,6 @@ void Player::Init(LuaState &lua)
"getCell", &NetActor::getCell,
"getInventory", &NetActor::getInventory,
"getPreviousCellPos", &Player::getPreviousCellPos,
"kick", &Player::kick,
@ -219,19 +218,14 @@ void Player::setId(unsigned short id)
this->id = id;
}
void Player::setHandshake()
{
handshakeState = true;
}
bool Player::isHandshaked()
{
return handshakeState;
}
void Player::setLoadState(int state)
void Player::setHandshake()
{
loadState = state;
handshakeState = true;
}
int Player::getLoadState()
@ -239,28 +233,14 @@ int Player::getLoadState()
return loadState;
}
CellController::TContainer *Player::getCells()
void Player::setLoadState(int state)
{
return &cells;
loadState = state;
}
void Player::sendToLoaded(mwmp::PlayerPacket *myPacket)
CellController::TContainer *Player::getCells()
{
std::list <Player*> plList;
for (auto cell : cells)
for (auto pl : *cell)
plList.push_back(pl);
plList.sort();
plList.unique();
for (auto pl : plList)
{
if (pl == this) continue;
myPacket->setPlayer(this);
myPacket->Send(pl->guid);
}
return &cells;
}
void Player::forEachLoaded(std::function<void(Player *pl, Player *other)> func)
@ -286,6 +266,25 @@ void Player::forEachLoaded(std::function<void(Player *pl, Player *other)> func)
}
}
void Player::sendToLoaded(mwmp::PlayerPacket *myPacket)
{
std::list <Player*> plList;
for (auto cell : cells)
for (auto pl : *cell)
plList.push_back(pl);
plList.sort();
plList.unique();
for (auto pl : plList)
{
if (pl == this) continue;
myPacket->setPlayer(this);
myPacket->Send(pl->guid);
}
}
void Player::kick() const
{
mwmp::Networking::getPtr()->kickPlayer(guid);
@ -318,15 +317,15 @@ int Player::getAvgPing()
return mwmp::Networking::get().getAvgPing(guid);
}
void Player::setName(const std::string &name)
std::string Player::getName()
{
npc.mName = name;
baseInfoChanged = true;
return npc.mName;
}
std::string Player::getName()
void Player::setName(const std::string &name)
{
return npc.mName;
npc.mName = name;
baseInfoChanged = true;
}
void Player::setCharGenStages(int currentStage, int endStage)
@ -352,15 +351,20 @@ void Player::message(const std::string &message, bool toAll)
packet->Send(true);
}
int Player::getLevel() const
{
return creatureStats.mLevel;
}
void Player::setLevel(int level)
{
creatureStats.mLevel = level;
levelChanged = true;
}
int Player::getLevel() const
int Player::getGender() const
{
return creatureStats.mLevel;
return npc.isMale();
}
void Player::setGender(int gender)
@ -369,9 +373,9 @@ void Player::setGender(int gender)
baseInfoChanged = true;
}
int Player::getGender() const
std::string Player::getRace() const
{
return npc.isMale();
return npc.mRace;
}
void Player::setRace(const std::string &race)
@ -382,9 +386,9 @@ void Player::setRace(const std::string &race)
baseInfoChanged = true;
}
std::string Player::getRace() const
std::string Player::getHead() const
{
return npc.mRace;
return npc.mHead;
}
void Player::setHead(const std::string &head)
@ -393,9 +397,9 @@ void Player::setHead(const std::string &head)
baseInfoChanged = true;
}
std::string Player::getHead() const
std::string Player::getHair() const
{
return npc.mHead;
return npc.mHair;
}
void Player::setHair(const std::string &hair)
@ -404,11 +408,6 @@ void Player::setHair(const std::string &hair)
baseInfoChanged = true;
}
std::string Player::getHair() const
{
return npc.mHair;
}
std::string Player::getBirthsign() const
{
return birthsign;
@ -434,15 +433,20 @@ void Player::setBounty(int bounty)
packet->Send(true);
}
int Player::getLevelProgress() const
{
return npcStats.mLevelProgress;
}
void Player::setLevelProgress(int progress)
{
npcStats.mLevelProgress = progress;
skillsChanged = true;
}
int Player::getLevelProgress() const
std::string Player::getCreatureModel() const
{
return npcStats.mLevelProgress;
return creatureModel;
}
void Player::setCreatureModel(const std::string &model)
@ -451,11 +455,6 @@ void Player::setCreatureModel(const std::string &model)
baseInfoChanged = true;
}
std::string Player::getCreatureModel() const
{
return creatureModel;
}
void Player::creatureName(bool useName)
{
useCreatureName = useName;
@ -591,6 +590,11 @@ void Player::jail(int jailDays, bool ignoreJailTeleportation, bool ignoreJailSki
packet->Send(false);
}
bool Player::getWerewolfState() const
{
return isWerewolf;
}
void Player::setWerewolfState(bool state)
{
isWerewolf = state;
@ -601,11 +605,6 @@ void Player::setWerewolfState(bool state)
packet->Send(true);
}
bool Player::getWerewolfState() const
{
return isWerewolf;
}
size_t Player::cellStateSize() const
{
return cellStateChanges.cellStates.size();

@ -59,8 +59,8 @@ public:
bool isHandshaked();
void setHandshake();
void setLoadState(int state);
int getLoadState();
void setLoadState(int state);
virtual ~Player();
@ -78,27 +78,27 @@ public:
int getAvgPing();
void setName(const std::string &name);
std::string getName();
void setName(const std::string &name);
void setCharGenStages(int currentStage, int endStage);
void message(const std::string &message, bool toAll = false);
void setGender(int gender);
int getGender() const;
void setRace(const std::string &race);
void setGender(int gender);
std::string getRace() const;
void setHead(const std::string &head);
void setRace(const std::string &race);
std::string getHead() const;
void setHair(const std::string &hair);
void setHead(const std::string &head);
std::string getHair() const;
void setHair(const std::string &hair);
std::string getBirthsign() const;
void setBirthsign(const std::string &sign);
int getBounty() const;
void setBounty(int bounty);
void setLevel(int level);
int getLevel() const;
void setLevelProgress(int progress);
void setLevel(int level);
int getLevelProgress() const;
void setLevelProgress(int progress);
/**
* \brief Send a PlayerResurrect packet about a player.
@ -130,12 +130,11 @@ public:
void jail(int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases,
const std::string &jailProgressText, const std::string &jailEndText);
void setWerewolfState(bool state);
bool getWerewolfState() const;
void setWerewolfState(bool state);
void setCreatureModel(const std::string &model);
std::string getCreatureModel() const;
void setCreatureModel(const std::string &model);
void creatureName(bool useName);
bool isCreatureName() const;

Loading…
Cancel
Save