signed char MessageIn::readInt8(const char *const str) { signed char value = CAST_S8(-1); if (mPos < mLength) value = CAST_S8(mData[mPos]); DEBUGLOG2("readInt8: " + toStringPrint(CAST_U32( CAST_U8(value))), mPos, str); mPos += 1; PacketCounters::incInBytes(1); return value; }
void PlayerHandler::shortcutShiftRow(const int row) const { if (serverVersion != 0 && serverVersion < 11) return; createOutPacket(CMSG_SHORTCUTS_ROW_SHIFT); outMsg.writeInt8(CAST_S8(row), "row"); }
void InventoryHandler::selectCart(const BeingId accountId, const int type) const { createOutPacket(CMSG_SELECT_CART); outMsg.writeBeingId(accountId, "account id"); outMsg.writeInt8(CAST_S8(type), "type"); }
void PartyHandler::inviteResponse(const int partyId, const bool accept) const { if (localPlayer != nullptr) { createOutPacket(CMSG_PARTY_INVITED2); outMsg.writeInt32(partyId, "party id"); outMsg.writeInt8(CAST_S8(accept ? 1 : 0), "accept"); } }
void MercenaryHandler::attack(const BeingId targetId, const Keep keep) const { const BeingId id = PlayerInfo::getMercenaryId(); if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_ATTACK); outMsg.writeBeingId(id, "mercenary id"); outMsg.writeBeingId(targetId, "target id"); outMsg.writeInt8(CAST_S8(keep == Keep_true ? 1 : 0), "keep"); }
void PlayerHandler::setShortcut(const int idx, const uint8_t type, const int id, const int level) const { createOutPacket(CMSG_SET_SHORTCUTS); outMsg.writeInt16(CAST_S16(idx), "index"); outMsg.writeInt8(CAST_S8(type), "type"); outMsg.writeInt32(id, "id"); outMsg.writeInt16(CAST_S16(level), "level"); }
std::string UserPalette::getConfigName(const std::string &typeName) { std::string res("Color" + typeName); size_t pos = 5; for (size_t i = 0; i < typeName.length(); i++) { if (i == 0 || typeName[i] == '_') { if (i > 0) i++; res[pos] = typeName[i]; } else { res[pos] = CAST_S8(tolower(typeName[i])); } pos ++; } res.erase(pos, res.length() - pos); return res; }
void PartyHandler::allowInvite(const bool allow) const { createOutPacket(CMSG_PARTY_ALLOW_INVITES); outMsg.writeInt8(CAST_S8(allow ? 1 : 0), "allow"); }