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