void GroupObjectImplementation::calcGroupLevel() { int highestPlayer = 0; groupLevel = 0; for (int i = 0; i < getGroupSize(); i++) { Reference<SceneObject*> member = getGroupMember(i); if (member->isPet()) { CreatureObject* creature = cast<CreatureObject*>(member.get()); groupLevel += creature->getLevel() / 5; } else if (member->isPlayerCreature()) { CreatureObject* creature = cast<CreatureObject*>(member.get()); int memberLevel = creature->getLevel(); if (memberLevel > highestPlayer) { groupLevel += (memberLevel - highestPlayer + (highestPlayer / 5)); highestPlayer = memberLevel; } else { groupLevel += memberLevel / 5; } } } GroupObjectDeltaMessage6* msg = new GroupObjectDeltaMessage6(_this.getReferenceUnsafeStaticCast()); msg->updateLevel(this->groupLevel); msg->close(); broadcastMessage(msg); }
bool BuildingObject::isAllowed(CreatureObject const &who) const { if (who.getMasterId() != NetworkId::cms_invalid) { ServerObject const *master = ServerWorld::findObjectByNetworkId(who.getMasterId()); if (master && master != &who && master->asCreatureObject()) return isAllowed(*master->asCreatureObject()); } if (!playersWithAlignedEnemyFlagsAllowed() && (Pvp::hasAnyAlignedTimedEnemyFlag(who) || Pvp::hasAnyBountyDuelEnemyFlag(who))) return false; if (getIsPublic()) return !CellPermissions::isOnList(m_banned.get(), who); else { // allow non-player-controlled creatures in private buildings with no owner if (!who.isPlayerControlled() && getOwnerId() == NetworkId::cms_invalid) return true; // allow vendor-creatures to be placed in the building if (who.hasCondition(static_cast<int>(ServerTangibleObjectTemplate::C_vendor))) return true; // JU_TODO: test #if 1 // allow non-player-controlled creatures in private buildings if the *creature* has no owner if (!who.isPlayerControlled() && who.getMasterId() == NetworkId::cms_invalid && who.getLevel() < 10 // temp change to < 0 after testing holo item ) { return true; } #endif // JU_TODO: end test return CellPermissions::isOnList(m_allowed.get(), who); } }
void GroupObjectImplementation::calcGroupLevel() { groupLevel = 0; for (int i = 0; i < getGroupSize(); i++) { SceneObject* member = getGroupMember(i); if (member->isCreatureObject()) { CreatureObject* creature = cast<CreatureObject*>(member); int currentlevel = groupLevel - getGroupSize(); int memberlevel = creature->getLevel(); if (memberlevel > currentlevel) groupLevel = memberlevel + getGroupSize(); } } GroupObjectDeltaMessage6* msg = new GroupObjectDeltaMessage6(_this.get()); msg->updateLevel(this->groupLevel); msg->close(); broadcastMessage(msg); }