Its only the nickname or health color too? And who will have a different color, all players?Can u help me? :/ Im beginner in coding in OTClient
The OTClient doesnt know the group of the player on the screen, protocol changes on server-side too is needed.I want to only admins (group id 6) get GOLD nickname nad health color too i think its be good, other players will still have an old color
CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
{
if(type == 0)
type = msg->getU16();
CreaturePtr creature;
bool known = (type != Proto::UnknownCreature);
if(type == Proto::OutdatedCreature || type == Proto::UnknownCreature) {
if(known) {
uint id = msg->getU32();
creature = g_map.getCreatureById(id);
if(!creature)
g_logger.traceError("server said that a creature is known, but it's not");
} else {
uint removeId = msg->getU32();
g_map.removeCreatureById(removeId);
uint id = msg->getU32();
int creatureType;
if(g_game.getClientVersion() >= 910)
creatureType = msg->getU8();
else {
if(id >= Proto::PlayerStartId && id < Proto::PlayerEndId)
creatureType = Proto::CreatureTypePlayer;
else if(id >= Proto::MonsterStartId && id < Proto::MonsterEndId)
creatureType = Proto::CreatureTypeMonster;
else
creatureType = Proto::CreatureTypeNpc;
}
std::string name = g_game.formatCreatureName(msg->getString());
if(id == m_localPlayer->getId())
creature = m_localPlayer;
else if(creatureType == Proto::CreatureTypePlayer) {
// fixes a bug server side bug where GameInit is not sent and local player id is unknown
if(m_localPlayer->getId() == 0 && name == m_localPlayer->getName())
creature = m_localPlayer;
else
creature = PlayerPtr(new Player);
}
else if(creatureType == Proto::CreatureTypeMonster)
creature = MonsterPtr(new Monster);
else if(creatureType == Proto::CreatureTypeNpc)
creature = NpcPtr(new Npc);
else
g_logger.traceError("creature type is invalid");
if(creature) {
creature->setId(id);
creature->setName(name);
g_map.addCreature(creature);
}
}
int healthPercent = msg->getU8();
Otc::Direction direction = (Otc::Direction)msg->getU8();
Outfit outfit = getOutfit(msg);
Light light;
light.intensity = msg->getU8();
light.color = msg->getU8();
int speed = msg->getU16();
int skull = msg->getU8();
int shield = msg->getU8();
// emblem is sent only when the creature is not known
int8 emblem = -1;
int8 creatureType = -1;
int8 icon = -1;
bool unpass = true;
uint8 mark;
if(g_game.getFeature(Otc::GameCreatureEmblems) && !known)
emblem = msg->getU8();
if(g_game.getFeature(Otc::GameThingMarks)) {
creatureType = msg->getU8();
}
if(g_game.getFeature(Otc::GameCreatureIcons)) {
icon = msg->getU8();
}
if(g_game.getFeature(Otc::GameThingMarks)) {
mark = msg->getU8(); // mark
msg->getU16(); // helpers
if(creature) {
if(mark == 0xff)
creature->hideStaticSquare();
else
creature->showStaticSquare(Color::from8bit(mark));
}
}
if(g_game.getClientVersion() >= 854)
unpass = msg->getU8();
if(creature) {
creature->setHealthPercent(healthPercent);
creature->setDirection(direction);
creature->setOutfit(outfit);
creature->setSpeed(speed);
creature->setSkull(skull);
creature->setShield(shield);
creature->setPassable(!unpass);
creature->setLight(light);
if(emblem != -1)
creature->setEmblem(emblem);
if(creatureType != -1)
creature->setType(creatureType);
if(icon != -1)
creature->setIcon(icon);
if(creature == m_localPlayer && !m_localPlayer->isKnown())
m_localPlayer->setKnown(true);
}
} else if(type == Proto::Creature) {
uint id = msg->getU32();
creature = g_map.getCreatureById(id);
if(!creature)
g_logger.traceError("invalid creature");
Otc::Direction direction = (Otc::Direction)msg->getU8();
if(creature)
creature->turn(direction);
if(g_game.getClientVersion() >= 953) {
bool unpass = msg->getU8();
if(creature)
creature->setPassable(!unpass);
}
} else {
stdext::throw_exception("invalid creature opcode");
}
return creature;
}
/*
* Copyright (c) 2010-2017 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "protocolgame.h"
#include "game.h"
#include "player.h"
#include "item.h"
#include "localplayer.h"
void ProtocolGame::login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName, const std::string& authenticatorToken, const std::string& sessionKey)
{
m_accountName = accountName;
m_accountPassword = accountPassword;
m_authenticatorToken = authenticatorToken;
m_sessionKey = sessionKey;
m_characterName = characterName;
connect(host, port);
}
void ProtocolGame::onConnect()
{
m_firstRecv = true;
Protocol::onConnect();
m_localPlayer = g_game.getLocalPlayer();
if(g_game.getFeature(Otc::GameProtocolChecksum))
enableChecksum();
if(!g_game.getFeature(Otc::GameChallengeOnLogin))
sendLoginPacket(0, 0);
recv();
}
void ProtocolGame::onRecv(const InputMessagePtr& inputMessage)
{
if(m_firstRecv) {
m_firstRecv = false;
if(g_game.getFeature(Otc::GameMessageSizeCheck)) {
int size = inputMessage->getU16();
if(size != inputMessage->getUnreadSize()) {
g_logger.traceError("invalid message size");
return;
}
}
}
parseMessage(inputMessage);
recv();
}
void ProtocolGame::onError(const boost::system::error_code& error)
{
g_game.processConnectionError(error);
disconnect();
}
////////////// Add common messages
void ProtocolGame::AddCreature(NetworkMessage& msg, const Creature* creature, bool known, uint32_t remove)
{
CreatureType_t creatureType = creature->getType();
const Player* otherPlayer = creature->getPlayer();
if (known) {
msg.add<uint16_t>(0x62);
msg.add<uint32_t>(creature->getID());
} else {
msg.add<uint16_t>(0x61);
msg.add<uint32_t>(remove);
msg.add<uint32_t>(creature->getID());
msg.addByte(creatureType);
msg.addString(creature->getName());
}
if (creature->isHealthHidden()) {
msg.addByte(0x00);
} else {
msg.addByte(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int32_t>(creature->getMaxHealth(), 1)) * 100));
}
msg.addByte(creature->getDirection());
if (!creature->isInGhostMode() && !creature->isInvisible()) {
AddOutfit(msg, creature->getCurrentOutfit());
} else {
static Outfit_t outfit;
AddOutfit(msg, outfit);
}
LightInfo lightInfo = creature->getCreatureLight();
msg.addByte(player->isAccessPlayer() ? 0xFF : lightInfo.level);
msg.addByte(lightInfo.color);
msg.add<uint16_t>(creature->getStepSpeed() / 2);
msg.addByte(player->getSkullClient(creature));
msg.addByte(player->getPartyShield(otherPlayer));
if (!known) {
msg.addByte(player->getGuildEmblem(otherPlayer));
}
if (creatureType == CREATURETYPE_MONSTER) {
const Creature* master = creature->getMaster();
if (master) {
const Player* masterPlayer = master->getPlayer();
if (masterPlayer) {
if (masterPlayer == player) {
creatureType = CREATURETYPE_SUMMON_OWN;
} else {
creatureType = CREATURETYPE_SUMMON_OTHERS;
}
}
}
}
msg.addByte(creatureType); // Type (for summons)
msg.addByte(creature->getSpeechBubble());
msg.addByte(0xFF); // MARK_UNMARKED
if (otherPlayer) {
msg.add<uint16_t>(otherPlayer->getHelpers());
} else {
msg.add<uint16_t>(0x00);
}
msg.addByte(player->canWalkthroughEx(creature) ? 0x00 : 0x01);
}
void ProtocolGame::AddPlayerStats(NetworkMessage& msg)
{
msg.addByte(0xA0);
msg.add<uint16_t>(std::min<int32_t>(player->getHealth(), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(std::min<int32_t>(player->getMaxHealth(), std::numeric_limits<uint16_t>::max()));
msg.add<uint32_t>(player->getFreeCapacity());
msg.add<uint32_t>(player->getCapacity());
msg.add<uint64_t>(player->getExperience());
msg.add<uint16_t>(player->getLevel());
msg.addByte(player->getLevelPercent());
msg.add<uint16_t>(100); // base xp gain rate
msg.add<uint16_t>(0); // xp voucher
msg.add<uint16_t>(0); // low level bonus
msg.add<uint16_t>(0); // xp boost
msg.add<uint16_t>(100); // stamina multiplier (100 = x1.0)
msg.add<uint16_t>(std::min<int32_t>(player->getMana(), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(std::min<int32_t>(player->getMaxMana(), std::numeric_limits<uint16_t>::max()));
msg.addByte(std::min<uint32_t>(player->getMagicLevel(), std::numeric_limits<uint8_t>::max()));
msg.addByte(std::min<uint32_t>(player->getBaseMagicLevel(), std::numeric_limits<uint8_t>::max()));
msg.addByte(player->getMagicLevelPercent());
msg.addByte(player->getSoul());
msg.add<uint16_t>(player->getStaminaMinutes());
msg.add<uint16_t>(player->getBaseSpeed() / 2);
Condition* condition = player->getCondition(CONDITION_REGENERATION);
msg.add<uint16_t>(condition ? condition->getTicks() / 1000 : 0x00);
msg.add<uint16_t>(player->getOfflineTrainingTime() / 60 / 1000);
msg.add<uint16_t>(0); // xp boost time (seconds)
msg.addByte(0); // enables exp boost in the store
}
You dont have the sources from your server? To make this changes you'll need to be able to compile it..Im totally idiot i cant find it :O my server is forgotten server, sorry for me im tottaly confused
Ok paste here your void Creature::draw from creature.cpp (OTC)Its normal fangotten server i can download src and change it
void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView)
{
if(!canBeSeen())
return;
Point animationOffset = animate ? m_walkOffset : Point(0,0);
if(m_showTimedSquare && animate) {
g_painter->setColor(m_timedSquareColor);
g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement() + 2)*scaleFactor, Size(28, 28)*scaleFactor), std::max<int>((int)(2*scaleFactor), 1));
g_painter->setColor(Color::white);
}
if(m_showStaticSquare && animate) {
g_painter->setColor(m_staticSquareColor);
g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement())*scaleFactor, Size(Otc::TILE_PIXELS, Otc::TILE_PIXELS)*scaleFactor), std::max<int>((int)(2*scaleFactor), 1));
g_painter->setColor(Color::white);
}
internalDrawOutfit(dest + animationOffset * scaleFactor, scaleFactor, animate, animate, m_direction);
m_footStepDrawn = true;
if(lightView) {
Light light = rawGetThingType()->getLight();
if(m_light.intensity != light.intensity || m_light.color != light.color)
light = m_light;
// local player always have a minimum light in complete darkness
if(isLocalPlayer() && (g_map.getLight().intensity < 64 || m_position.z > Otc::SEA_FLOOR)) {
light.intensity = std::max<uint8>(light.intensity, 3);
if(light.color == 0 || light.color > 215)
light.color = 215;
}
if(light.intensity > 0)
lightView->addLightSource(dest + (animationOffset + Point(16,16)) * scaleFactor, scaleFactor, light);
}
}
void Creature::drawInformation(const Point& point, bool useGray, const Rect& parentRect, int drawFlags)
{
if(m_healthPercent < 1) // creature is dead
return;
Color fillColor = Color(96, 96, 96);
if(!useGray)
fillColor = m_informationColor;
// calculate main rects
Rect backgroundRect = Rect(point.x-(13.5), point.y, 27, 4);
backgroundRect.bind(parentRect);
Size nameSize = m_nameCache.getTextSize();
Rect textRect = Rect(point.x - nameSize.width() / 2.0, point.y-12, nameSize);
textRect.bind(parentRect);
// distance them
uint32 offset = 12;
if(isLocalPlayer()) {
offset *= 2;
}
if(textRect.top() == parentRect.top())
backgroundRect.moveTop(textRect.top() + offset);
if(backgroundRect.bottom() == parentRect.bottom())
textRect.moveTop(backgroundRect.top() - offset);
// health rect is based on background rect, so no worries
Rect healthRect = backgroundRect.expanded(-1);
healthRect.setWidth((m_healthPercent / 100.0) * 25);
// draw
if(g_game.getFeature(Otc::GameBlueNpcNameColor) && isNpc() && m_healthPercent == 100 && !useGray)
fillColor = Color(0x66, 0xcc, 0xff);
if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
g_painter->setColor(Color::black);
g_painter->drawFilledRect(backgroundRect);
g_painter->setColor(fillColor);
g_painter->drawFilledRect(healthRect);
if(drawFlags & Otc::DrawManaBar && isLocalPlayer()) {
LocalPlayerPtr player = g_game.getLocalPlayer();
if(player) {
backgroundRect.moveTop(backgroundRect.bottom());
g_painter->setColor(Color::black);
g_painter->drawFilledRect(backgroundRect);
Rect manaRect = backgroundRect.expanded(-1);
double maxMana = player->getMaxMana();
if(maxMana == 0) {
manaRect.setWidth(25);
} else {
manaRect.setWidth(player->getMana() / (maxMana * 1.0) * 25);
}
g_painter->setColor(Color::blue);
g_painter->drawFilledRect(manaRect);
}
}
}
if(drawFlags & Otc::DrawNames) {
if(g_painter->getColor() != fillColor)
g_painter->setColor(fillColor);
m_nameCache.draw(textRect);
}
if(m_skull != Otc::SkullNone && m_skullTexture) {
g_painter->setColor(Color::white);
Rect skullRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 5, m_skullTexture->getSize());
g_painter->drawTexturedRect(skullRect, m_skullTexture);
}
if(m_shield != Otc::ShieldNone && m_shieldTexture && m_showShieldTexture) {
g_painter->setColor(Color::white);
Rect shieldRect = Rect(backgroundRect.x() + 13.5, backgroundRect.y() + 5, m_shieldTexture->getSize());
g_painter->drawTexturedRect(shieldRect, m_shieldTexture);
}
if(m_emblem != Otc::EmblemNone && m_emblemTexture) {
g_painter->setColor(Color::white);
Rect emblemRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 16, m_emblemTexture->getSize());
g_painter->drawTexturedRect(emblemRect, m_emblemTexture);
}
if(m_type != Proto::CreatureTypeUnknown && m_typeTexture) {
g_painter->setColor(Color::white);
Rect typeRect = Rect(backgroundRect.x() + 13.5 + 12 + 12, backgroundRect.y() + 16, m_typeTexture->getSize());
g_painter->drawTexturedRect(typeRect, m_typeTexture);
}
if(m_icon != Otc::NpcIconNone && m_iconTexture) {
g_painter->setColor(Color::white);
Rect iconRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 5, m_iconTexture->getSize());
g_painter->drawTexturedRect(iconRect, m_iconTexture);
}
}
CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
{
if(type == 0)
type = msg->getU16();
CreaturePtr creature;
bool known = (type != Proto::UnknownCreature);
if(type == Proto::OutdatedCreature || type == Proto::UnknownCreature) {
if(known) {
uint id = msg->getU32();
creature = g_map.getCreatureById(id);
if(!creature)
g_logger.traceError("server said that a creature is known, but it's not");
} else {
uint removeId = msg->getU32();
g_map.removeCreatureById(removeId);
uint id = msg->getU32();
int creatureType;
if(g_game.getClientVersion() >= 910)
creatureType = msg->getU8();
else {
if(id >= Proto::PlayerStartId && id < Proto::PlayerEndId)
creatureType = Proto::CreatureTypePlayer;
else if(id >= Proto::MonsterStartId && id < Proto::MonsterEndId)
creatureType = Proto::CreatureTypeMonster;
else
creatureType = Proto::CreatureTypeNpc;
}
std::string name = g_game.formatCreatureName(msg->getString());
if(id == m_localPlayer->getId())
creature = m_localPlayer;
else if(creatureType == Proto::CreatureTypePlayer) {
// fixes a bug server side bug where GameInit is not sent and local player id is unknown
if(m_localPlayer->getId() == 0 && name == m_localPlayer->getName())
creature = m_localPlayer;
else
creature = PlayerPtr(new Player);
}
else if(creatureType == Proto::CreatureTypeMonster)
creature = MonsterPtr(new Monster);
else if(creatureType == Proto::CreatureTypeNpc)
creature = NpcPtr(new Npc);
else
g_logger.traceError("creature type is invalid");
if(creature) {
creature->setId(id);
creature->setName(name);
g_map.addCreature(creature);
}
}
int healthPercent = msg->getU8();
Otc::Direction direction = (Otc::Direction)msg->getU8();
Outfit outfit = getOutfit(msg);
Light light;
light.intensity = msg->getU8();
light.color = msg->getU8();
int speed = msg->getU16();
int skull = msg->getU8();
int shield = msg->getU8();
bool haveGroup = msg->getU8(); // new
// emblem is sent only when the creature is not known
int8 emblem = -1;
int8 creatureType = -1;
int8 icon = -1;
bool unpass = true;
uint8 mark;
if(g_game.getFeature(Otc::GameCreatureEmblems) && !known)
emblem = msg->getU8();
if(g_game.getFeature(Otc::GameThingMarks)) {
creatureType = msg->getU8();
}
if(g_game.getFeature(Otc::GameCreatureIcons)) {
icon = msg->getU8();
}
if(g_game.getFeature(Otc::GameThingMarks)) {
mark = msg->getU8(); // mark
msg->getU16(); // helpers
if(creature) {
if(mark == 0xff)
creature->hideStaticSquare();
else
creature->showStaticSquare(Color::from8bit(mark));
}
}
if(g_game.getClientVersion() >= 854)
unpass = msg->getU8();
if(creature) {
creature->setHealthPercent(healthPercent);
creature->setDirection(direction);
creature->setOutfit(outfit);
creature->setSpeed(speed);
creature->setSkull(skull);
creature->setShield(shield);
creature->setHaveGroup(haveGroup); // new
creature->setPassable(!unpass);
creature->setLight(light);
if(emblem != -1)
creature->setEmblem(emblem);
if(creatureType != -1)
creature->setType(creatureType);
if(icon != -1)
creature->setIcon(icon);
if(creature == m_localPlayer && !m_localPlayer->isKnown())
m_localPlayer->setKnown(true);
}
} else if(type == Proto::Creature) {
uint id = msg->getU32();
creature = g_map.getCreatureById(id);
if(!creature)
g_logger.traceError("invalid creature");
Otc::Direction direction = (Otc::Direction)msg->getU8();
if(creature)
creature->turn(direction);
if(g_game.getClientVersion() >= 953) {
bool unpass = msg->getU8();
if(creature)
creature->setPassable(!unpass);
}
} else {
stdext::throw_exception("invalid creature opcode");
}
return creature;
}
void Creature::drawInformation(const Point& point, bool useGray, const Rect& parentRect, int drawFlags)
{
if(m_healthPercent < 1) // creature is dead
return;
Color fillColor = Color(96, 96, 96);
if(!useGray)
fillColor = m_informationColor;
// calculate main rects
Rect backgroundRect = Rect(point.x-(13.5), point.y, 27, 4);
backgroundRect.bind(parentRect);
Size nameSize = m_nameCache.getTextSize();
Rect textRect = Rect(point.x - nameSize.width() / 2.0, point.y-12, nameSize);
textRect.bind(parentRect);
// distance them
uint32 offset = 12;
if(isLocalPlayer()) {
offset *= 2;
}
if(textRect.top() == parentRect.top())
backgroundRect.moveTop(textRect.top() + offset);
if(backgroundRect.bottom() == parentRect.bottom())
textRect.moveTop(backgroundRect.top() - offset);
// health rect is based on background rect, so no worries
Rect healthRect = backgroundRect.expanded(-1);
healthRect.setWidth((m_healthPercent / 100.0) * 25);
// draw
if(g_game.getFeature(Otc::GameBlueNpcNameColor) && isNpc() && m_healthPercent == 100 && !useGray)
fillColor = Color(0x66, 0xcc, 0xff);
if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
g_painter->setColor(Color::black);
g_painter->drawFilledRect(backgroundRect);
g_painter->setColor(fillColor);
g_painter->drawFilledRect(healthRect);
if(drawFlags & Otc::DrawManaBar && isLocalPlayer()) {
LocalPlayerPtr player = g_game.getLocalPlayer();
if(player) {
backgroundRect.moveTop(backgroundRect.bottom());
g_painter->setColor(Color::black);
g_painter->drawFilledRect(backgroundRect);
Rect manaRect = backgroundRect.expanded(-1);
double maxMana = player->getMaxMana();
if(maxMana == 0) {
manaRect.setWidth(25);
} else {
manaRect.setWidth(player->getMana() / (maxMana * 1.0) * 25);
}
g_painter->setColor(Color::blue);
g_painter->drawFilledRect(manaRect);
}
}
}
if(drawFlags & Otc::DrawNames) {
if (m_haveGroup)
fillColor = Color(0xff, 0x6f, 0x52); // the new color for group players
if(g_painter->getColor() != fillColor)
g_painter->setColor(fillColor);
m_nameCache.draw(textRect);
}
if(m_skull != Otc::SkullNone && m_skullTexture) {
g_painter->setColor(Color::white);
Rect skullRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 5, m_skullTexture->getSize());
g_painter->drawTexturedRect(skullRect, m_skullTexture);
}
if(m_shield != Otc::ShieldNone && m_shieldTexture && m_showShieldTexture) {
g_painter->setColor(Color::white);
Rect shieldRect = Rect(backgroundRect.x() + 13.5, backgroundRect.y() + 5, m_shieldTexture->getSize());
g_painter->drawTexturedRect(shieldRect, m_shieldTexture);
}
if(m_emblem != Otc::EmblemNone && m_emblemTexture) {
g_painter->setColor(Color::white);
Rect emblemRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 16, m_emblemTexture->getSize());
g_painter->drawTexturedRect(emblemRect, m_emblemTexture);
}
if(m_type != Proto::CreatureTypeUnknown && m_typeTexture) {
g_painter->setColor(Color::white);
Rect typeRect = Rect(backgroundRect.x() + 13.5 + 12 + 12, backgroundRect.y() + 16, m_typeTexture->getSize());
g_painter->drawTexturedRect(typeRect, m_typeTexture);
}
if(m_icon != Otc::NpcIconNone && m_iconTexture) {
g_painter->setColor(Color::white);
Rect iconRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 5, m_iconTexture->getSize());
g_painter->drawTexturedRect(iconRect, m_iconTexture);
}
}
m_haveGroup = false; // new
void setHaveGroup(bool haveGroup) { m_haveGroup = haveGroup; } // new
bool m_haveGroup; // new
void ProtocolGame::AddCreature(NetworkMessage& msg, const Creature* creature, bool known, uint32_t remove)
{
CreatureType_t creatureType = creature->getType();
const Player* otherPlayer = creature->getPlayer();
if (known) {
msg.add<uint16_t>(0x62);
msg.add<uint32_t>(creature->getID());
} else {
msg.add<uint16_t>(0x61);
msg.add<uint32_t>(remove);
msg.add<uint32_t>(creature->getID());
msg.addByte(creatureType);
msg.addString(creature->getName());
}
if (creature->isHealthHidden()) {
msg.addByte(0x00);
} else {
msg.addByte(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int32_t>(creature->getMaxHealth(), 1)) * 100));
}
msg.addByte(creature->getDirection());
if (!creature->isInGhostMode() && !creature->isInvisible()) {
AddOutfit(msg, creature->getCurrentOutfit());
} else {
static Outfit_t outfit;
AddOutfit(msg, outfit);
}
LightInfo lightInfo = creature->getCreatureLight();
msg.addByte(player->isAccessPlayer() ? 0xFF : lightInfo.level);
msg.addByte(lightInfo.color);
msg.add<uint16_t>(creature->getStepSpeed() / 2);
msg.addByte(player->getSkullClient(creature));
msg.addByte(player->getPartyShield(otherPlayer));
msg.addByte(otherPlayer && otherPlayer->isAccessPlayer() ? 0x01 : 0x00); // new
if (!known) {
msg.addByte(player->getGuildEmblem(otherPlayer));
}
if (creatureType == CREATURETYPE_MONSTER) {
const Creature* master = creature->getMaster();
if (master) {
const Player* masterPlayer = master->getPlayer();
if (masterPlayer) {
if (masterPlayer == player) {
creatureType = CREATURETYPE_SUMMON_OWN;
} else {
creatureType = CREATURETYPE_SUMMON_OTHERS;
}
}
}
}
msg.addByte(creatureType); // Type (for summons)
msg.addByte(creature->getSpeechBubble());
msg.addByte(0xFF); // MARK_UNMARKED
if (otherPlayer) {
msg.add<uint16_t>(otherPlayer->getHelpers());
} else {
msg.add<uint16_t>(0x00);
}
msg.addByte(player->canWalkthroughEx(creature) ? 0x00 : 0x01);
}
Try Compiling TFS 1.0/1.1 latest source. 64 and 32 bits. Pics and lots of explanation.Everywhere, I tried to compile a clean server, forgotten, and there errors themselves, i install all
But still there are many errors
- TFS SDK v3.2
- Boost C++ libraries