void Player::MorphFit(bool value) { if (!IsPlayingNative() && value) { if (GetOTeam() == HORDE) { if (getGender() == GENDER_MALE) { SetDisplayId(19723); SetNativeDisplayId(19723); } else { SetDisplayId(19724); SetNativeDisplayId(19724); } } else { if (getGender() == GENDER_MALE) { SetDisplayId(20578); SetNativeDisplayId(20578); } else { SetDisplayId(20579); SetNativeDisplayId(20579); } } } else InitDisplayIds(); }
void player::printPlayer(WINDOW*& window) { char firstLetter = name.at(0); init_pair(7, COLOR_MAGENTA, COLOR_BLACK); init_pair(8, COLOR_BLUE, COLOR_BLACK); if(getGender() == 'M') { mvwaddch(window, getYCoord(), getXCoord(), firstLetter | COLOR_PAIR(8)); } else if(getGender() == 'F') { mvwaddch(window, getYCoord(), getXCoord(), firstLetter | COLOR_PAIR(7)); } wrefresh(window); }
void Being::showName() { delete mDispName; mDispName = 0; std::string mDisplayName(mName); Being* player = static_cast<Being*>(this); if (player) { if (config.getBoolValue("showgender")) { if (getGender() == GENDER_FEMALE) mDisplayName += " \u2640"; else if (getGender() == GENDER_MALE) mDisplayName += " \u2642"; } // Display the IP when under tmw-Athena (GM only). if (Net::getNetworkType() == ServerInfo::TMWATHENA && local_player && local_player->getShowIp() && player->getIp()) { mDisplayName += strprintf(" %s", ipToString(player->getIp())); } } if (getType() == MONSTER) { if (config.getBoolValue("showMonstersTakedDamage")) { mDisplayName += ", " + toString(getDamageTaken()); } } gcn::Font *font = 0; if (local_player && local_player->getTarget() == this && getType() != MONSTER) { font = boldFont; } mDispName = new FlashText(mDisplayName, getPixelX(), getPixelY(), gcn::Graphics::CENTER, mNameColor, font); updateCoords(); }
/** * Figure out the gender of samples based on the number of het calls on * chromosome X. This is all very human centric... */ std::vector<affx::Gender> GenoSeed::getGenders() { std::vector<affx::Gender> genders; /* Loop through and decide if we are male or female. */ for(unsigned int i = 0; i < getChipCount(); i++) { genders.push_back(getGender(i)); } return genders; }
void CPlayer::SetFakeValues() { m_oRace = GetByteValue(UNIT_FIELD_BYTES_0, 0); m_oFaction = GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); m_fRace = sCustom.PickFakeRace(getClass(), GetOTeam()); m_fFaction = Player::getFactionForRace(m_fRace); m_oPlayerBytes = GetUInt32Value(PLAYER_BYTES); m_oPlayerBytes2 = GetUInt32Value(PLAYER_BYTES_2); m_fPlayerBytes = sCustom.GetFakePlayerBytes(m_fRace, getGender()); m_fPlayerBytes2 = sCustom.GetFakePlayerBytes2(m_fRace, getGender()); if (!m_fPlayerBytes) m_fPlayerBytes = m_oPlayerBytes; if (!m_fPlayerBytes2) m_fPlayerBytes2 = m_oPlayerBytes2; }
void Player::SetFakeRaceAndMorph() { if (getClass() == CLASS_DRUID) { if (GetOTeam() == ALLIANCE) { m_FakeMorph = getGender() == GENDER_MALE ? FAKE_M_TAUREN : FAKE_F_TAUREN; m_FakeRace = RACE_TAUREN; } else if (getGender() == GENDER_MALE) // HORDE PLAYER, ONLY HAVE MALE NELF ID { m_FakeMorph = FAKE_M_NELF; m_FakeRace = RACE_NIGHTELF; } else m_FakeRace = GetOTeam() == ALLIANCE ? RACE_BLOODELF : RACE_HUMAN; } else if (getClass() == CLASS_SHAMAN && GetOTeam() == HORDE && getGender() == GENDER_FEMALE) { m_FakeMorph = FAKE_F_DRANAEI; // Female Draenei m_FakeRace = RACE_DRAENEI; } else { m_FakeRace = GetOTeam() == ALLIANCE ? RACE_BLOODELF : RACE_HUMAN; if (GetOTeam() == HORDE) { if (getGender() == GENDER_MALE) m_FakeMorph = 19723; else m_FakeMorph = 19724; } else { if (getGender() == GENDER_MALE) m_FakeMorph = 20578; else m_FakeMorph = 20579; } } }
WorldPacket CPlayer::BuildNameQuery() { WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 4 + 4 + 4 + 10)); data << GetObjectGuid(); // player guid data << GetName(); // player name data << uint8(0); // realm name data << uint32(getRace()); // player race data << uint32(getGender()); // player gender data << uint32(getClass()); // player class data << uint8(0); // is not declined return data; }
bool Player::SendRealNameQuery() { if (IsPlayingNative()) return false; WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 1 + 1 + 1 + 1 + 10)); data.appendPackGUID(GetGUID()); // player guid data << uint8(0); // added in 3.1; if > 1, then end of packet data << GetName(); // played name data << uint8(0); // realm name for cross realm BG usage data << uint8(getORace()); data << uint8(getGender()); data << uint8(getClass()); data << uint8(0); // is not declined return true; }
void CPlayer::FakeDisplayID() { if (NativeTeam()) return; PlayerInfo const* info = sObjectMgr.GetPlayerInfo(getRace(), getClass()); if (!info) { for (auto i = 0; i < MAX_CLASSES; ++i) { info = sObjectMgr.GetPlayerInfo(getRace(), i); if (info) break; } } if (!info) { sLog.outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); return; } // reset scale before reapply auras SetObjectScale(DEFAULT_OBJECT_SCALE); uint8 gender = getGender(); switch (gender) { case GENDER_FEMALE: SetDisplayId(info->displayId_f); SetNativeDisplayId(info->displayId_f); break; case GENDER_MALE: SetDisplayId(info->displayId_m); SetNativeDisplayId(info->displayId_m); break; default: sLog.outError("Invalid gender %u for player", gender); return; } SetUInt32Value(PLAYER_BYTES, getFPlayerBytes()); SetUInt32Value(PLAYER_BYTES_2, getFPlayerBytes2()); }
void MonsterManager::initialize() { XML::Document doc(mMonsterReferenceFile); xmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters")) { LOG_ERROR("Monster Manager: Error while parsing monster database (" << mMonsterReferenceFile << ")!"); return; } LOG_INFO("Loading monster reference: " << mMonsterReferenceFile); int nbMonsters = 0; for_each_xml_child_node(node, rootNode) { if (!xmlStrEqual(node->name, BAD_CAST "monster")) continue; int id = XML::getProperty(node, "id", 0); std::string name = XML::getProperty(node, "name", std::string()); if (id < 1) { LOG_WARN("Monster Manager: Ignoring monster (" << name << ") without Id in " << mMonsterReferenceFile << "! It has been ignored."); continue; } MonsterClasses::iterator i = mMonsterClasses.find(id); if (i != mMonsterClasses.end()) { LOG_WARN("Monster Manager: Ignoring duplicate definition of " "monster '" << id << "'!"); continue; } MonsterClass *monster = new MonsterClass(id); mMonsterClasses[id] = monster; if (!name.empty()) { monster->setName(name); if (mMonsterClassesByName.contains(name)) LOG_WARN("Monster Manager: Name not unique for monster " << id); else mMonsterClassesByName.insert(name, monster); } MonsterDrops drops; bool attributesSet = false; bool behaviorSet = false; for_each_xml_child_node(subnode, node) { if (xmlStrEqual(subnode->name, BAD_CAST "drop")) { MonsterDrop drop; drop.item = itemManager->getItem( XML::getProperty(subnode, "item", 0)); drop.probability = XML::getFloatProperty(subnode, "percent", 0.0) * 100 + 0.5; if (drop.item && drop.probability) drops.push_back(drop); } else if (xmlStrEqual(subnode->name, BAD_CAST "attributes")) { attributesSet = true; const int hp = XML::getProperty(subnode, "hp", -1); monster->setAttribute(ATTR_MAX_HP, hp); monster->setAttribute(ATTR_HP, hp); monster->setAttribute(MOB_ATTR_PHY_ATK_MIN, XML::getProperty(subnode, "attack-min", -1)); monster->setAttribute(MOB_ATTR_PHY_ATK_DELTA, XML::getProperty(subnode, "attack-delta", -1)); monster->setAttribute(MOB_ATTR_MAG_ATK, XML::getProperty(subnode, "attack-magic", -1)); monster->setAttribute(ATTR_DODGE, XML::getProperty(subnode, "evade", -1)); monster->setAttribute(ATTR_MAGIC_DODGE, XML::getProperty(subnode, "magic-evade", -1)); monster->setAttribute(ATTR_ACCURACY, XML::getProperty(subnode, "hit", -1)); monster->setAttribute(ATTR_DEFENSE, XML::getProperty(subnode, "physical-defence", -1)); monster->setAttribute(ATTR_MAGIC_DEFENSE, XML::getProperty(subnode, "magical-defence", -1)); monster->setSize(XML::getProperty(subnode, "size", -1)); float speed = (XML::getFloatProperty(subnode, "speed", -1.0f)); monster->setMutation(XML::getProperty(subnode, "mutation", 0)); std::string genderString = XML::getProperty(subnode, "gender", std::string()); monster->setGender(getGender(genderString)); // Checking attributes for completeness and plausibility if (monster->getMutation() > MAX_MUTATION) { LOG_WARN(mMonsterReferenceFile << ": Mutation of monster Id:" << id << " more than " << MAX_MUTATION << "%. Defaulted to 0."); monster->setMutation(0); } bool attributesComplete = true; const AttributeManager::AttributeScope &mobAttr = attributeManager->getAttributeScope(MonsterScope); for (AttributeManager::AttributeScope::const_iterator it = mobAttr.begin(), it_end = mobAttr.end(); it != it_end; ++it) { if (!monster->mAttributes.count(it->first)) { LOG_WARN(mMonsterReferenceFile << ": No attribute " << it->first << " for monster Id: " << id << ". Defaulted to 0."); attributesComplete = false; monster->setAttribute(it->first, 0); } } if (monster->getSize() == -1) { LOG_WARN(mMonsterReferenceFile << ": No size set for monster Id:" << id << ". " << "Defaulted to " << DEFAULT_MONSTER_SIZE << " pixels."); monster->setSize(DEFAULT_MONSTER_SIZE); attributesComplete = false; } if (speed == -1.0f) { LOG_WARN(mMonsterReferenceFile << ": No speed set for monster Id:" << id << ". " << "Defaulted to " << DEFAULT_MONSTER_SPEED << " tiles/second."); speed = DEFAULT_MONSTER_SPEED; attributesComplete = false; } monster->setAttribute(ATTR_MOVE_SPEED_TPS, speed); if (!attributesComplete) { LOG_WARN(mMonsterReferenceFile << ": Attributes incomplete for monster Id:" << id << ". Defaults values may have been applied!"); } } else if (xmlStrEqual(subnode->name, BAD_CAST "exp")) { xmlChar *exp = subnode->xmlChildrenNode->content; monster->setExp(atoi((const char*)exp)); monster->setOptimalLevel(XML::getProperty(subnode, "level", 0)); } else if (xmlStrEqual(subnode->name, BAD_CAST "behavior")) { behaviorSet = true; if (XML::getBoolProperty(subnode, "aggressive", false)) monster->setAggressive(true); monster->setTrackRange( XML::getProperty(subnode, "track-range", 1)); monster->setStrollRange( XML::getProperty(subnode, "stroll-range", 0)); monster->setAttackDistance( XML::getProperty(subnode, "attack-distance", 0)); } else if (xmlStrEqual(subnode->name, BAD_CAST "attack")) { MonsterAttack *att = new MonsterAttack; att->id = XML::getProperty(subnode, "id", 0); att->priority = XML::getProperty(subnode, "priority", 1); att->damageFactor = XML::getFloatProperty(subnode, "damage-factor", 1.0f); att->preDelay = XML::getProperty(subnode, "pre-delay", 1); att->aftDelay = XML::getProperty(subnode, "aft-delay", 0); att->range = XML::getProperty(subnode, "range", 0); att->scriptEvent = XML::getProperty(subnode, "script-event", std::string()); std::string sElement = XML::getProperty(subnode, "element", "neutral"); att->element = elementFromString(sElement); std::string sType = XML::getProperty(subnode, "type", "physical"); bool validMonsterAttack = true; if (sType == "physical") { att->type = DAMAGE_PHYSICAL; } else if (sType == "magical" || sType == "magic") { att->type = DAMAGE_MAGICAL; } else if (sType == "other") { att->type = DAMAGE_OTHER; } else { LOG_WARN("Monster manager " << mMonsterReferenceFile << ": unknown damage type '" << sType << "'."); validMonsterAttack = false; } if (att->id < 1) { LOG_WARN(mMonsterReferenceFile << ": Attack without ID for monster Id:" << id << " (" << name << ") - attack ignored"); validMonsterAttack = false; } else if (att->element == ELEMENT_ILLEGAL) { LOG_WARN(mMonsterReferenceFile << ": Attack with unknown element \"" << sElement << "\" for monster Id:" << id << " (" << name << ") - attack ignored"); validMonsterAttack = false; } else if (att->type == -1) { LOG_WARN(mMonsterReferenceFile << ": Attack with unknown type \"" << sType << "\"" << " for monster Id:" << id << " (" << name << ")"); validMonsterAttack = false; } if (validMonsterAttack) { monster->addAttack(att); } else { delete att; att = 0; } } else if (xmlStrEqual(subnode->name, BAD_CAST "script")) { xmlChar *filename = subnode->xmlChildrenNode->content; std::string val = (char *)filename; monster->setScript(val); } } monster->setDrops(drops); if (!attributesSet) { LOG_WARN(mMonsterReferenceFile << ": No attributes defined for monster Id:" << id << " (" << name << ")"); } if (!behaviorSet) { LOG_WARN(mMonsterReferenceFile << ": No behavior defined for monster Id:" << id << " (" << name << ")"); } if (monster->getExp() == -1) { LOG_WARN(mMonsterReferenceFile << ": No experience defined for monster Id:" << id << " (" << name << ")"); monster->setExp(0); } ++nbMonsters; } LOG_INFO("Loaded " << nbMonsters << " monsters from " << mMonsterReferenceFile << '.'); }
void Player::save(){ char sql[10000]; sprintf_s(sql, 10000, "update keymap set "); for(int i=0; i<90; i++){ char temp[100]; if(i!=89) sprintf_s(temp, 100, "pos%d=%d, ", i, keys[i]); else sprintf_s(temp, 100, "pos%d=%d where charid=%d; ", i, keys[i], getPlayerid()); strcat_s(sql, 10000, temp); } MySQL::insert(sql); sprintf_s(sql, 10000, "update characters set level=%d, job=%d, str=%d, dex=%d, intt=%d, luk=%d, chp=%d, mhp=%d, cmp=%d, mmp=%d, ap=%d, sp=%d, exp=%d, fame=%d, map=%d, gender=%d, skin=%d, eyes=%d, hair=%d, mesos=%d where id=%d", getLevel(), getJob(), getStr(), getDex(), getInt(), getLuk(), getHP(), getRMHP(), getMP(), getRMMP(), getAp(), getSp(), getExp(), getFame(), getMap(), getGender(), getSkin(), getEyes(), getHair(), inv->getMesos() ,getPlayerid()); MySQL::insert(sql); char temp[1000]; sprintf_s(sql, 10000, "delete from equip where charid=%d;", getPlayerid()); MySQL::insert(sql); bool firstrun = true; for(int i=0; i<inv->getEquipNum(); i++){ if(firstrun == true){ sprintf_s(sql, 10000, "INSERT INTO equip VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", inv->getEquip(i)->id, Drops::equips[inv->getEquip(i)->id].type ,getPlayerid(), inv->getEquipPos(i), inv->getEquip(i)->slots, inv->getEquip(i)->scrolls, inv->getEquip(i)->istr, inv->getEquip(i)->idex, inv->getEquip(i)->iint, inv->getEquip(i)->iluk, inv->getEquip(i)->ihp, inv->getEquip(i)->imp, inv->getEquip(i)->iwatk, inv->getEquip(i)->imatk, inv->getEquip(i)->iwdef, inv->getEquip(i)->imdef, inv->getEquip(i)->iacc, inv->getEquip(i)->iavo, inv->getEquip(i)->ihand, inv->getEquip(i)->ijump, inv->getEquip(i)->ispeed); firstrun = false; } else{ sprintf_s(temp, 1000, ",(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", inv->getEquip(i)->id, Drops::equips[inv->getEquip(i)->id].type ,getPlayerid(), inv->getEquipPos(i), inv->getEquip(i)->slots, inv->getEquip(i)->scrolls, inv->getEquip(i)->istr, inv->getEquip(i)->idex, inv->getEquip(i)->iint, inv->getEquip(i)->iluk, inv->getEquip(i)->ihp, inv->getEquip(i)->imp, inv->getEquip(i)->iwatk, inv->getEquip(i)->imatk, inv->getEquip(i)->iwdef, inv->getEquip(i)->imdef, inv->getEquip(i)->iacc, inv->getEquip(i)->iavo, inv->getEquip(i)->ihand, inv->getEquip(i)->ijump, inv->getEquip(i)->ispeed); strcat_s(sql, 10000, temp); } } MySQL::insert(sql); sprintf_s(sql, 10000, "delete from skills where charid=%d;", getPlayerid()); MySQL::insert(sql); firstrun = true; for(int i=0; i<skills->getSkillsNum(); i++){ if(firstrun == true){ sprintf_s(sql, 10000, "INSERT INTO skills VALUES (%d, %d, %d)", getPlayerid(), skills->getSkillID(i), skills->getSkillLevel(skills->getSkillID(i))); firstrun = false; } else{ sprintf_s(temp, 1000, ",(%d, %d, %d)", getPlayerid(), skills->getSkillID(i), skills->getSkillLevel(skills->getSkillID(i))); strcat_s(sql, 10000, temp); } } MySQL::insert(sql); sprintf_s(sql, 10000, "DELETE FROM items WHERE charid=%d;", getPlayerid()); MySQL::insert(sql); firstrun = true; for(int i=0; i<inv->getItemNum(); i++){ if(firstrun == true){ sprintf_s(sql, 10000, "INSERT INTO items VALUES (%d, %d, %d, %d, %d)", inv->getItem(i)->id, getPlayerid() ,inv->getItem(i)->inv, inv->getItem(i)->pos, inv->getItem(i)->amount); firstrun = false; } else{ sprintf_s(temp, 1000, ",(%d, %d, %d, %d, %d)", inv->getItem(i)->id, getPlayerid() ,inv->getItem(i)->inv, inv->getItem(i)->pos, inv->getItem(i)->amount); strcat_s(sql, 10000, temp); } } MySQL::insert(sql); }
void ServerPlayer::playCardEffect(const QString &card_name) const{ QString gender = getGender() == General::Male ? "M" : "F"; room->broadcastInvoke("playCardEffect", QString("%1:%2").arg(card_name).arg(gender)); }
void ServerPlayer::playCardEffect(const QString &card_name) const { QJsonArray arg; arg.append(card_name); arg.append(getGender() == General::Male); room->broadcastNotification(BP::PlayCardEffect, arg); }
void main(int argc, char *argv[]) #endif { char szText[160]; bool bSuccess; short nTries = 0; // Set results of what happens when a call to new fails set_new_handler(badNew); // Call the startup function #ifdef OD32 startup(lpszCmdLine); #else startup(argc, argv); #endif Sleep(500); do { // Attempt to start up the door server process. (No need to check if the door server process is already // running; it does that on its own and shuts down extra copies as needed) bSuccess = CreateProcess(DOOR_SERVER_EXE, NULL, NULL, NULL, false, DETACHED_PROCESS, NULL, NULL, new STARTUPINFO, new PROCESS_INFORMATION); Sleep(1000); nTries++; } while ( bSuccess == false && nTries < 5 ); // Get a handle on the door server's input mailslot hInputSlot = openSlot(-1); // Create this node's output mailslot. hOutputSlot = createSlot( getNode() ); // If unable to open input slot, re-try up to 5 times (intial failure seems to happen on WinXP randomly) // If still failure, this indicates the door server is not running and could not be started, so shut down. nTries = 0; while (hInputSlot == INVALID_HANDLE_VALUE ) { Sleep(500); hInputSlot = openSlot(-1); if ( ++nTries > 5 ) { local("Unable to start door: IPC error"); exitDoor(1); } } // If the output slot for this node is already open, it means the node is already running the door. if ( hOutputSlot == INVALID_HANDLE_VALUE ) { local("Unable to start door: This node is already in use!"); pausePrompt(); exitDoor(1); } // Now that the mailslot handles were successful, call setupExitFunction() to register beforeExit() as the // function called upon exit. setupExitFunction(); // Send an input message to the server, to tell it a user is trying to enter the game. The user's info is // passed as a string in the format below. sprintf(szText, "%d&%c&%d&%s&%s", isSysop(), getGender(), getPlatform(), getAlias(), getRealName()); sendInput(szText, IP_ENTER_GAME); // Handle I/O for the user while (1) { performIO(); } }