本文整理汇总了C++中CreaturePtr::setOutfit方法的典型用法代码示例。如果您正苦于以下问题:C++ CreaturePtr::setOutfit方法的具体用法?C++ CreaturePtr::setOutfit怎么用?C++ CreaturePtr::setOutfit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreaturePtr
的用法示例。
在下文中一共展示了CreaturePtr::setOutfit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseCreatureOutfit
void ProtocolGame::parseCreatureOutfit(InputMessage& msg)
{
uint id = msg.getU32();
Outfit outfit = internalGetOutfit(msg);
CreaturePtr creature = g_map.getCreatureById(id);
if(creature)
creature->setOutfit(outfit);
}
示例2: parseOutfitWindow
void ProtocolGame::parseOutfitWindow(InputMessage& msg)
{
Outfit outfit = internalGetOutfit(msg);
typedef std::tuple<int, std::string, int> OutfitInfo;
std::vector<OutfitInfo> outfitList;
uint8 outfitCount = msg.getU8();
for(int i = 0; i < outfitCount; i++) {
uint16 outfitId = msg.getU16();
std::string outfitName = msg.getString();
uint8 outfitAddons = msg.getU8();
outfitList.push_back(OutfitInfo(outfitId, outfitName, outfitAddons));
}
CreaturePtr creature = CreaturePtr(new Creature);
creature->setXPattern(2);
creature->setOutfit(outfit);
g_lua.callGlobalField("Game", "onOpenOutfitWindow", creature, outfitList);
}
示例3: internalGetThing
ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
{
ThingPtr thing;
int thingId = msg.getU16();
assert(thingId != 0);
if(thingId == 0x0061 || thingId == 0x0062) { // add new creature
CreaturePtr creature;
if(thingId == 0x0062) { //creature is known
uint id = msg.getU32();
CreaturePtr knownCreature = g_map.getCreatureById(id);
if(knownCreature)
creature = knownCreature;
else
logTraceError("server says creature is known, but its not on creatures list");
} else if(thingId == 0x0061) { //creature is not known
uint removeId = msg.getU32();
uint id = msg.getU32();
std::string name = msg.getString();
if(name.length() > 0) // every creature name must start with a capital letter
name[0] = toupper(name[0]);
g_map.removeCreatureById(removeId);
if(id == m_localPlayer->getId())
creature = m_localPlayer;
else if(id >= Proto::PlayerStartId && id < Proto::PlayerEndId)
creature = PlayerPtr(new Player);
else if(id >= Proto::MonsterStartId && id < Proto::MonsterEndId)
creature = MonsterPtr(new Monster);
else if(id >= Proto::NpcStartId && id < Proto::NpcEndId)
creature = NpcPtr(new Npc);
else
logTraceError("creature id is invalid");
creature->setId(id);
creature->setName(name);
}
uint8 healthPercent = msg.getU8();
Otc::Direction direction = (Otc::Direction)msg.getU8();
Outfit outfit = internalGetOutfit(msg);
Light light;
light.intensity = msg.getU8();
light.color = msg.getU8();
int speed = msg.getU16();
int skull = msg.getU8();
int shield = msg.getU8();
int emblem = -1;
if(thingId == 0x0061) // emblem is sent only in packet type 0x61
emblem = msg.getU8();
bool passable = (msg.getU8() == 0);
if(creature) {
creature->setHealthPercent(healthPercent);
creature->setDirection(direction);
creature->setOutfit(outfit);
creature->setLight(light);
creature->setSpeed(speed);
creature->setSkull(skull);
creature->setShield(shield);
if(emblem != -1)
creature->setEmblem(emblem);
creature->setPassable(passable);
creature->setDirection(direction);
if(creature == m_localPlayer) {
m_localPlayer->setKnown(true);
}
}
thing = creature;
} else if(thingId == 0x0063) { // creature turn
parseCreatureTurn(msg);
} else // item
thing = internalGetItem(msg, thingId);
return thing;
}