void CapDect::OnClicked(CagButton* aBtn) { if (aBtn == iLess) { SetLevel(iLevel - 1); } else { SetLevel(iLevel + 1); } }
Character::Character(std::string fromString) { std::vector<std::string> tokens = utils::Tokenfy(fromString, '|'); if (tokens[0] == "PLAYER_OBJECT") { SetName(tokens[57]); SetLastname(tokens[58]); SetRace(tokens[59]); SetGender(tokens[60]); SetFace(tokens[61]); SetSkin(tokens[62]); SetZone(tokens[63]); SetLevel(std::stoi(tokens[64])); SetHp(std::stoi(tokens[65])); SetMaxHp(std::stoi(tokens[66])); SetBp(std::stoi(tokens[67])); SetMaxBp(std::stoi(tokens[68])); SetMp(std::stoi(tokens[69])); SetMaxMp(std::stoi(tokens[70])); SetEp(std::stoi(tokens[71])); SetMaxEp(std::stoi(tokens[72])); SetStrength(std::stoi(tokens[73])); SetConstitution(std::stoi(tokens[74])); SetIntelligence(std::stoi(tokens[75])); SetDexterity(std::stoi(tokens[76])); SetX(std::stof(tokens[77])); SetY(std::stof(tokens[78])); SetZ(std::stof(tokens[79])); SetPitch(std::stof(tokens[80])); SetYaw(std::stof(tokens[81])); } // if (tokens[0] == "NPC_OBJECT") { // // } }
Log::Log(int mode, int level, char *filename, bool append) { m_lastLogTime = 0; m_filename = NULL; m_append = false; hlogfile = NULL; m_todebug = false; m_toconsole = false; m_tofile = false; SetFile(filename, append); SetMode(mode); SetLevel(level); // If the compiler returns full path names in __FILE__, // remember the path prefix, to remove it from the log messages. char *path = __FILE__; char *ptr = strrchr(path, '\\'); if (ptr != NULL) { m_prefix_len = ptr + 1 - path; m_prefix = (char *)malloc(m_prefix_len + 1); memcpy(m_prefix, path, m_prefix_len); m_prefix[m_prefix_len] = '\0'; } }
void Creature::SelectLevel(const CreatureInfo *cinfo) { uint32 minlevel = min(cinfo->maxlevel, cinfo->minlevel); uint32 maxlevel = max(cinfo->maxlevel, cinfo->minlevel); uint32 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel); SetLevel(level); float rellevel = maxlevel == minlevel ? 0 : (float(level - minlevel))/(maxlevel - minlevel); uint32 minhealth = min(cinfo->maxhealth, cinfo->minhealth); uint32 maxhealth = max(cinfo->maxhealth, cinfo->minhealth); uint32 health = uint32(_GetHealthMod(isPet() ? 0 : cinfo->rank) * (minhealth + uint32(rellevel*(maxhealth - minhealth)))); SetMaxHealth(health); SetUInt32Value(UNIT_FIELD_BASE_HEALTH,health); SetHealth(health); uint32 minmana = min(cinfo->maxmana, cinfo->minmana); uint32 maxmana = max(cinfo->maxmana, cinfo->minmana); uint32 mana = minmana + uint32(rellevel*(maxmana - minmana)); SetMaxPower(POWER_MANA, mana); //MAX Mana SetUInt32Value(UNIT_FIELD_BASE_MANA, mana); SetPower(POWER_MANA, mana); }
void CTurtle::Update(float fElapsedTime) { m_vAnimations[m_nCurrAnimation].Update(fElapsedTime); if(GetExperience() >= (100 * GetLevel())) { CBattleMap::GetInstance()->PlaySFX(CAssets::GetInstance()->aBMcowabungaSnd); SetExperience(0/*GetExperience()-(100* GetLevel())*/); SetLevel(GetLevel() + 1); SetHealthMax((int)((float)GetMaxHealth() * 1.25f)); SetHealth((int)((float)GetMaxHealth())); SetBaseAP(GetBaseAP()+2); SetStrength( (int)( (float)GetStrength() * 1.2f ) ); SetDefense( (int) ( (float)GetDefense() * 1.2f ) ); SetAccuracy( (int) ( (float)GetAccuracy() * 1.2f ) ); SetSpeed( (int) ( (float)GetSpeed() * 1.2f ) ); } if( GetHealth() <= 0) { if(GetAlive() == true) { CBattleMap::GetInstance()->DecrementNumChars(); CBattleMap::GetInstance()->DecrementNumTurtles(); CBattleMap::GetInstance()->SetTurtleDead(); SetAlive(false); if(GetCurrAnimNum() != 9) SetCurrAnim(9); SetPosZ(0.9f); } } }
void Totem::SetOwner(Unit* owner) { SetCreatorGuid(owner->GetObjectGuid()); SetOwnerGuid(owner->GetObjectGuid()); setFaction(owner->getFaction()); SetLevel(owner->getLevel()); }
void cEnchantments::Add(const cEnchantments & a_Other) { for (cEnchantments::cMap::const_iterator itr = a_Other.m_Enchantments.begin(), end = a_Other.m_Enchantments.end(); itr != end; ++itr) { SetLevel(itr->first, itr->second); } // for itr - a_Other.m_Enchantments[] }
// 加载数据 bool CPlayer::LoadData(Msg *pMsg) { svrData::LoadPlayerData msg; _CHECK_PARSE_(pMsg, msg) false; if (!UnPackData(msg.data().c_str(), msg.data().size())) return false; SetAccount(msg.account()); SetName(msg.name().c_str()); SetGuid(msg.nguid()); SetSex(msg.nsex()); SetJob(msg.njob()); SetLevel(msg.nlevel()); SetCreateTime(msg.ncreatetime()); SetLoginTime(msg.nlogintime()); SetMapID(msg.nmapid()); SetNowPos(msg.nx(), msg.ny(), msg.nz()); m_LastSaveTime = CTimer::GetTime() + CRandomPool::GetOneLess(60); RunStateLog("加载玩家:%s数据成功!账号:%s", GetName(), msg.account().c_str()); if (!msg.bchangeline()) { svrData::AddPlayerToCenter SendMsg; SendMsg.set_nguid(GetGuid()); SendMsg.set_ngameid(GetGameID()); SendMsg.set_nclientid(GetClientID()); SendMsg.set_ngateid(GetGateID()); SendMsg.set_account(GetAccount()); FuncUti::SendMsgToCenter(this, SendMsg, SERVER_TYPE_MAIN, SVR_SUB_ADD_PLAYER_TO_CENTER); } m_LoadDataSucc = true; return true; }
void IBuff::SerializeLevel( CAr & ar ) { if( ar.IsStoring() ) { #ifdef __DBSERVER if( GetType() == BUFF_ITEM2 ) { time_t t = static_cast<time_t>( GetLevel() ) - time_null(); ar << t; } else { ar << m_dwLevel; } #else // __DBSERVER ar << m_dwLevel; #endif // __DBSERVER } else { #ifdef __DBSERVER if( GetType() == BUFF_ITEM2 ) { time_t t; ar >> t; SetLevel( time_null() + t ); } else {
void Totem::InitStats(uint32 duration) { Minion::InitStats(duration); CreatureInfo const *cinfo = GetCreatureInfo(); if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } // Get spell casted by totem SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell()); if (totemSpell) { // If spell have cast time -> so its active totem if (GetSpellCastTime(totemSpell)) m_type = TOTEM_ACTIVE; } if(GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
void Totem::SetOwner(Unit* owner) { SetCreatorGUID(owner->GetGUID()); SetOwnerGUID(owner->GetGUID()); setFaction(owner->getFaction()); SetLevel(owner->getLevel()); }
// ------------------------------------------------------------------------------------------------------------------------------------------------------ int PartyClass::AddMember(int Number, int UserNum, int DBNum, int Level) { if ( IsParty(Number) == FALSE ) return -1; // ----- for ( int i = 0; i<MAX_USER_IN_PARTY ; i++) { if ( (m_PartyInfo[Number].Number[i] >= 0) && (m_PartyInfo[Number].Number[i] == UserNum) && (m_PartyInfo[Number].DbNumber[i] == DBNum) ) { return -2; } } // ----- for (int i = 0; i<MAX_USER_IN_PARTY ; ++i) { if ( m_PartyInfo[Number].Number[i] == -1 ) { m_PartyInfo[Number].Number[i] = UserNum; m_PartyInfo[Number].DbNumber[i] = DBNum; m_PartyInfo[Number].Count++; // ----- SetLevel(Number, Level); // ----- return i; } } // ----- return -1; }
void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem if (Player* owner = GetOwner()->ToPlayer()) { if (m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) { WorldPackets::Totem::TotemCreated data; data.Totem = GetGUID(); data.Slot = m_Properties->Slot - SUMMON_SLOT_TOTEM; data.Duration = duration; data.SpellID = GetUInt32Value(UNIT_CREATED_BY_SPELL); owner->SendDirectMessage(data.Write()); } // set display id depending on caster's race if (uint32 totemDisplayId = sSpellMgr->GetModelForTotem(GetUInt32Value(UNIT_CREATED_BY_SPELL), owner->getRace())) SetDisplayId(totemDisplayId); } Minion::InitStats(duration); // Get spell cast by totem if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell())) if (totemSpell->CalcCastTime(getLevel())) // If spell has cast time -> its an active totem m_type = TOTEM_ACTIVE; m_duration = duration; SetLevel(GetOwner()->getLevel()); }
void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem if (GetOwner()->GetTypeId() == TYPEID_PLAYER && m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) { ObjectGuid TotemGUID = GetGUID(); uint32 SpellID = GetUInt32Value(UNIT_FIELD_CREATED_BY_SPELL); uint8 Slot = uint8(m_Properties->Slot - 1); GetOwner()->ToPlayer()->GetSession()->SendTotemCreated(TotemGUID, duration, SpellID, Slot); // set display id depending on caster's race SetDisplayId(GetOwner()->GetModelForTotem(PlayerTotemType(m_Properties->Id))); } Minion::InitStats(duration); // Get spell cast by totem if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell())) if (totemSpell->CalcCastTime(getLevel())) // If spell has cast time -> its an active totem m_type = TOTEM_ACTIVE; m_duration = duration; SetLevel(GetOwner()->getLevel()); }
void H223LowerLayer::InitParams() { iMinTimerResolution = TIMER_RES; iState = 0; iStateVal = 0; iBitrate = DEFAULT_BITRATE; iUseAnnexA = true; iUseAnnexADoubleFlag = true; iUseAnnexB = true; iUseAnnexBwithHeader = true; for (uint16 level = H223_LEVEL0; level < H223_LEVEL_UNKNOWN; level++) { iStuffingSz[level] = (uint16)H223GetMuxStuffingSz((TPVH223Level)level); } UpdatePduSize(); InitRuntimeParams(); SetLevel(H223_LEVEL_DEFAULT); iDemuxBufferSize = 0; iSyncCheckCount = CHECKSIZE; SetLoopbackMode(iLoopbackMode); iSkipLevelCheck = false; }
bool Transporter::CreateAsTransporter(uint32 EntryID, const char* Name, int32 Time) { // Lookup GameobjectInfo if (!CreateFromProto(EntryID, 0, 0, 0, 0, 0)) return false; // Override these flags to avoid mistakes in proto SetFlags(40); SetAnimProgress(100); //Maybe this would be the perfect way, so there would be no extra checks in Object.cpp: //but these fields seems to change often and between server flavours (ArcEmu, Aspire, name another one) - by: VLack aka. VLsoft if (pInfo) pInfo->Type = GAMEOBJECT_TYPE_TRANSPORT; else LOG_ERROR("Transporter id[%i] name[%s] - can't set GAMEOBJECT_TYPE - it will behave badly!", EntryID, Name); m_overrides = GAMEOBJECT_INFVIS | GAMEOBJECT_ONMOVEWIDE; //Make it forever visible on the same map // Set period m_period = Time; // Generate waypoints if (!GenerateWaypoints()) return false; // Set position SetMapId(m_WayPoints[0].mapid); SetPosition(m_WayPoints[0].x, m_WayPoints[0].y, m_WayPoints[0].z, 0); SetLevel(m_period); // Add to world AddToWorld(); return true; }
void GiSTnode::Unpack(const char *page) { const GiSTheader *h = (const GiSTheader *) page; Reset(); SetLevel(h->level); SetSibling(h->sibling); if (!packedNode) packedNode = new char[tree->Store()->PageSize()]; memcpy(packedNode, page, tree->Store()->PageSize()); Expand(h->numEntries); SetNumEntries(h->numEntries); for (int i=0; i<h->numEntries; i++) { GiSTcompressedEntry tmpentry = Entry(i); GiSTentry *e = CreateEntry(); e->SetLevel(Level()); e->SetPosition(i); e->SetNode(this); e->Decompress(tmpentry); // be tidy if (tmpentry.key) delete tmpentry.key; // Append the body with the entry entries[i] = e; } }
void Totem::InitStats(uint32 duration) { Minion::InitStats(duration); CreatureTemplate const *cinfo = GetCreatureInfo(); if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 displayID = sObjectMgr->ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo); sObjectMgr->GetCreatureModelRandomGender(&displayID); switch (m_owner->ToPlayer()->GetTeam()) { case ALLIANCE: displayID = cinfo->Modelid1; break; case HORDE: if (cinfo->Modelid3) displayID = cinfo->Modelid3; else displayID = cinfo->Modelid1; switch (((Player*)m_owner)->getRace()) { case RACE_ORC: if (cinfo->Modelid2) displayID = cinfo->Modelid2; else displayID = cinfo->Modelid1; break; case RACE_TROLL: if (cinfo->Modelid4) displayID = cinfo->Modelid4; else displayID = cinfo->Modelid1; break; default: break; } break; default: break; } SetDisplayId(displayID); } // Get spell casted by totem SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell()); if (totemSpell) { // If spell have cast time -> so its active totem if (GetSpellCastTime(totemSpell)) m_type = TOTEM_ACTIVE; } if (GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem if (m_owner->GetTypeId() == TYPEID_PLAYER && m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) { WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); data << uint8(m_Properties->Slot - 1); data << uint64(GetGUID()); data << uint32(duration); data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); m_owner->ToPlayer()->SendDirectMessage(&data); // set display id depending on caster's race SetDisplayId(m_owner->GetModelForTotem(PlayerTotemType(m_Properties->Id))); } Minion::InitStats(duration); // Get spell cast by totem if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell())) if (totemSpell->CalcCastTime()) // If spell has cast time -> its an active totem m_type = TOTEM_ACTIVE; if (GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
void GPIOInterface::WriteLevel(int ipin, bool level) { if (level) SetLevel(ipin); else ClrLevel(ipin); }
void StoryModeHUD::PerformLevelUp() { //levelCounter->Increment(); //levelCounter++; //SetLevel(levelCounter->GetCount() + 1); SetLevel(m_currLevel + 1); ResetResourceBars(); }
void Totem::InitStats(uint32 duration) { if (m_owner->GetTypeId() == TYPEID_PLAYER && m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) { WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); data << uint8(m_Properties->Slot - 1); data << uint64(GetGUID()); data << uint32(duration); data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); m_owner->ToPlayer()->SendDirectMessage(&data); CreatureInfo const* cinfo = GetCreatureTemplate(); if (cinfo) { uint32 modelid = 0; if (m_owner->ToPlayer()->GetTeam() == HORDE) { if (cinfo->modelid3) modelid = cinfo->modelid3; else if (cinfo->modelid4) modelid = cinfo->modelid4; } else { if (cinfo->modelid1) modelid = cinfo->modelid1; else if (cinfo->modelid2) modelid = cinfo->modelid2; } if (modelid) SetDisplayId(modelid); else sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.", GetEntry(), m_owner->ToPlayer()->GetTeam()); } } Minion::InitStats(duration); // Get spell casted by totem SpellEntry const* totemSpell = sSpellStore.LookupEntry(GetSpell()); if (totemSpell) { // If spell have cast time -> so its active totem if (GetSpellCastTime(totemSpell)) m_type = TOTEM_ACTIVE; } if (GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
void Totem::SetOwner(uint64 guid) { SetCreatorGUID(guid); SetOwnerGUID(guid); if (Unit *owner = GetOwner()) { setFaction(owner->getFaction()); SetLevel(owner->getLevel()); } }
void CMemPmBasicPage::SetExp() { if(!m_ppc) return; SetDlgItemInt(IDC_EXP, m_ppc->GetExp(), FALSE); // level SetLevel(); }
static void ProcessGameOver(struct BALL *Ball, struct PADDLE *Paddle) { char OutBuf[255]; snprintf(OutBuf, sizeof OutBuf, "GAME OVER! Score is %d. Hit ESC to exit or space to play again.", Score); Lives = 0; DrawStats(); Lives = 3; Score = 0; DrawMessage(OutBuf); cbreak(); AskAgain: switch (getch()) { case 27: /*27 is ESC.*/ endwin(); exit(0); break; case ' ': break; default: goto AskAgain; } halfdelay(1); DeleteMessage(); DeleteBall(Ball); DeletePaddle(Paddle); DeleteAllBricks(); DeleteAllCharms(); SetLevel(1); /*Set back to the default level again.*/ ResetPaddle(Paddle); ResetBricks(); DrawPaddle(Paddle); DrawAllBricks(); DrawStats(); /*Assume they want to play again.*/ WaitForUserLaunch(); ResetBall(Ball); DrawBall(Ball); DrawAllBricks(); /*Redraw to fix WaitForUserLaunch() goofing.*/ }
Log::Log(int mode, int level, LPCTSTR filename, bool append) { m_lastLogTime = 0; hlogfile = INVALID_HANDLE_VALUE; m_todebug = false; m_toconsole = false; m_tofile = false; InitializeCriticalSection( &m_criLock ); SetLevel( level ); SetMode(mode); if( mode&ToFile && filename ) SetFile(filename, append); }
// ------------------------------------------------------------------------------------------------------------------------------------------------------ int PartyClass::Create(int usernumber, int dbnumber, int level) { int n = m_PartyCount; // ----- int LoopCount = 0; // ----- while ( true ) { if ( m_PartyInfo[n].Count == 0 ) { m_PartyInfo[n].Count = 1; m_PartyInfo[n].Number[0] = usernumber; m_PartyInfo[n].DbNumber[0] = dbnumber; // ----- for ( int i=1;i<MAX_USER_IN_PARTY;i++) { m_PartyInfo[n].DbNumber[i] = -1; m_PartyInfo[n].Number[i] = -1; } // ----- m_PartyCount++; m_PartyInfo[n].m_MaxLevel = 0; m_PartyInfo[n].m_MinLevel = 0; SetLevel(n, level); // ----- if ( m_PartyCount >= OBJMAX ) { m_PartyCount=0; } // ----- return n; } // ----- n++; // ----- if ( n >= OBJMAX ) { n=0; } // ----- LoopCount++; // ----- if ( LoopCount >= OBJMAX ) { break; } } // ----- return -1; }
void CTurtle::SetAttributes(int ap,int hp,int strength,int defense,int accuracy,int speed,int level, int experience,int range) { SetBaseAP(ap); SetCurrAP(ap); SetHealthMax(hp); SetHealth(hp); SetStrength(strength); SetDefense(defense); SetAccuracy(accuracy); SetSpeed(speed); SetLevel(level); SetExperience(experience); SetRange(range); }
void PitchBendWT::Init(int n, float *f) { if (n > 0) SetLevel(AmpValue(f[0])); if (n > 1) SetWavetable((int) f[1]); if (n > 2) SetDuration(FrqValue(f[2])); if (n > 3) SetDelay(FrqValue(f[3])); if (n > 4) SetMode((int)f[4]); Reset(0); }
void CMemPmBasicPage::GetExp() { if(!m_ppc) return; DWORD dwExp; CString szText; GetDlgItemText(IDC_EXP, szText); dwExp = _tcstoul(szText, 0, 0); m_ppc->SetExp(dwExp); // level SetLevel(); }