But otclient_dx9.exe be a file from download, not compiled in CodeBlocks. If you know what I mean.
#edit
SS with CMake:
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.getProtocolVersion() >= 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
int emblem = -1;
bool unpass = true;
if(g_game.getFeature(Otc::GameCreatureEmblems) && !known)
emblem = msg->getU8();
if(g_game.getProtocolVersion() >= 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(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.getProtocolVersion() >= 953) {
bool unpass = msg->getU8();
if(creature)
creature->setPassable(!unpass);
}
} else {
stdext::throw_exception("invalid creature opcode");
}
return creature;
}
int healthPercent = msg->getU8();
Yes, you're right. Thanks you ^^
But I've next question. I've protocolgameparse.cpp into client source and function:
How can I get a mana? Health declaration is here:PHP: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.getProtocolVersion() >= 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 int emblem = -1; bool unpass = true; if(g_game.getFeature(Otc::GameCreatureEmblems) && !known) emblem = msg->getU8(); if(g_game.getProtocolVersion() >= 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(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.getProtocolVersion() >= 953) { bool unpass = msg->getU8(); if(creature) creature->setPassable(!unpass); } } else { stdext::throw_exception("invalid creature opcode"); } return creature; }
But I don't know where can I found mana.PHP:int healthPercent = msg->getU8();
Same here, tried with this config:
http://speedy*****malware.localhost/Fpbxe/CodeBlocks.rar
case Proto::GameServerCreatureHealth:
parseCreatureHealth(msg);
break;
Got same CB as in your package.I've wrongs CodeBlocks libs. When I get same folder with CodeBlocks from my friend, then I compiled good.
ERROR: ...aryInventory/mercenary_inventory.otui:33: [@onClose]:2: attempt to index global 'mods' (a nil value)
@onClose: mods.mercenaryInventory.onMiniWindowClose()
function onMiniWindowClose()
mercenaryButton:setOn(false)
end