|
|
|
@ -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();
|
|
|
|
|