void ReputationMgr::SetInactive(RepListID repListID, bool on) { FactionStateList::iterator itr = m_factions.find(repListID); if (itr == m_factions.end()) return; SetInactive(&itr->second, on); }
// win func that gets called automatically by update endbetattempt func bool CBettingGuy::Win() { printf("CBettingGuy::Win\n"); CGoalManager* pGoalManager = GetGoalManager(); Dbg_Assert( pGoalManager ); pGoalManager->AddCash( m_betAmount ); Reset(); RunCallbackScript( vSUCCESS ); m_numBetsWon++; m_straightWins++; if ( m_straightWins > 3 && m_currentDifficulty < 3 ) { m_currentDifficulty++; m_straightWins = 0; } m_straightLosses = 0; m_shouldMove = true; SetInactive(); return true; }
void ReputationMgr::LoadFromDB(PreparedQueryResult result) { // Set initial reputations (so everything is nifty before DB data load) Initialize(); //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow()); if (result) { do { Field* fields = result->Fetch(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16()); if (factionEntry && (factionEntry->reputationListID >= 0)) { FactionState* faction = &_factions[factionEntry->reputationListID]; // update standing to current faction->Standing = fields[1].GetInt32(); // update counters int32 BaseRep = GetBaseReputation(factionEntry); ReputationRank old_rank = ReputationToRank(BaseRep); ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing); UpdateRankCounters(old_rank, new_rank); uint32 dbFactionFlags = fields[2].GetUInt16(); if (dbFactionFlags & FACTION_FLAG_VISIBLE) SetVisible(faction); // have internal checks for forced invisibility if (dbFactionFlags & FACTION_FLAG_INACTIVE) SetInactive(faction, true); // have internal checks for visibility requirement if (dbFactionFlags & FACTION_FLAG_AT_WAR) // DB at war SetAtWar(faction, true); // have internal checks for FACTION_FLAG_PEACE_FORCED else // DB not at war { // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN) if (faction->Flags & FACTION_FLAG_VISIBLE) SetAtWar(faction, false); // have internal checks for FACTION_FLAG_PEACE_FORCED } // set atWar for hostile if (GetRank(factionEntry) <= REP_HOSTILE) SetAtWar(faction, true); // reset changed flag if values similar to saved in DB if (faction->Flags == dbFactionFlags) { faction->needSend = false; faction->needSave = false; } } } while (result->NextRow()); } }
void ReputationMgr::SetInactive(RepListID FactionIndex, bool Status) { FactionStateList::iterator itr = _factions.find(FactionIndex); if (itr == _factions.end()) return; SetInactive(&itr->second, Status); }
bool DynamicWorldObject::TrySetInactiveFrom (const String& state) { if (GetState () != state) return false; SetInactive (); return true; }
void CVibrationComponent::SetActiveState ( bool state ) { if (state == m_active_state) return; if (state) { SetActive(); } else { SetInactive(); } }
void ReputationMgr::LoadFromDB(QueryResult* result) { // Set initial reputations (so everything is nifty before DB data load) Initialize(); // QueryResult *result = CharacterDatabase.PQuery("SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'",GetGUIDLow()); if (result) { do { Field* fields = result->Fetch(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32()); if (factionEntry && factionEntry->HasReputation()) { FactionState* faction = &m_factions[factionEntry->reputationListID]; // update standing to current faction->Standing = int32(fields[1].GetUInt32()); uint32 dbFactionFlags = fields[2].GetUInt32(); if (dbFactionFlags & FACTION_FLAG_VISIBLE) SetVisible(faction); // have internal checks for forced invisibility if (dbFactionFlags & FACTION_FLAG_INACTIVE) SetInactive(faction, true); // have internal checks for visibility requirement if (dbFactionFlags & FACTION_FLAG_AT_WAR) // DB at war SetAtWar(faction, true); // have internal checks for FACTION_FLAG_PEACE_FORCED else // DB not at war { // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN) if (faction->Flags & FACTION_FLAG_VISIBLE) SetAtWar(faction, false); // have internal checks for FACTION_FLAG_PEACE_FORCED } // set atWar for hostile ForcedReactions::const_iterator forceItr = m_forcedReactions.find(factionEntry->ID); if (forceItr != m_forcedReactions.end()) { if (forceItr->second <= REP_HOSTILE) SetAtWar(faction, true); } else if (GetRank(factionEntry) <= REP_HOSTILE) SetAtWar(faction, true); // reset changed flag if values similar to saved in DB if (faction->Flags == dbFactionFlags) { faction->needSend = false; faction->needSave = false; } } } while (result->NextRow()); delete result; } }