void MissionObjectImplementation::updateMissionLocation() { if (getMissionObjective() == NULL || getMissionObjective()->getPlayerOwner() == NULL) { return; } CreatureObject* playerCreature = getMissionObjective()->getPlayerOwner().castTo<CreatureObject*>(); ManagedReference<WaypointObject* > waypointToMission = this->waypointToMission; if (playerCreature != NULL && waypointToMission != NULL) { MissionObjectDeltaMessage3* dmiso3 = new MissionObjectDeltaMessage3(_this.get()); dmiso3->updateWaypoint(waypointToMission); dmiso3->close(); playerCreature->sendMessage(dmiso3); if (playerCreature->isGrouped() && playerCreature->getGroup() != NULL) { GroupObject* group = playerCreature->getGroup(); group->scheduleUpdateNearestMissionForGroup(playerCreature->getPlanetCRC()); } } }
CreatureObject* ThreatMap::getHighestDamageGroupLeader() { Locker locker(&lockMutex); VectorMap<uint64,uint32> groupDamageMap; int64 highestGroupDmg = 0; //Logger::Logger tlog("Threat"); ManagedReference<CreatureObject*> leaderCreature = NULL; for (int i = 0; i < size(); ++i) { ThreatMapEntry* entry = &elementAt(i).getValue(); uint32 totalDamage = entry->getTotalDamage(); CreatureObject* creature = elementAt(i).getKey(); //tlog.info("Group id is " + String::valueOf(creature->getGroupID()),true); if (creature->isGrouped()) { Reference<CreatureObject*> thisleader = creature->getGroup()->getLeader(); //tlog.info("leader is " + thisleader->getFirstName(),true); if (thisleader == NULL || !thisleader->isPlayerCreature()) break; if (!groupDamageMap.contains(creature->getGroupID())) { //tlog.info("first dmg for group " + String::valueOf(creature->getGroupID()) + " dmg: " + String::valueOf(totalDamage), true); groupDamageMap.put(creature->getGroupID(),totalDamage); } else { groupDamageMap.get(creature->getGroupID()) += totalDamage; //tlog.info("adding to group " + String::valueOf(creature->getGroupID()) + " dmg total: " + String::valueOf(groupDamageMap.get(creature->getGroupID())) + " this player dmg: " + String::valueOf(totalDamage),true); } if (groupDamageMap.get(creature->getGroupID()) > highestGroupDmg) { highestGroupDmg = groupDamageMap.get(creature->getGroupID()); leaderCreature = thisleader; } } else if (creature->isPet()) { CreatureObject* owner = creature->getLinkedCreature().get(); if (owner != NULL && owner->isPlayerCreature()) { if (owner->isGrouped()) { Reference<CreatureObject*> thisleader = owner->getGroup()->getLeader(); if (thisleader == NULL || !thisleader->isPlayerCreature()) break; if (!groupDamageMap.contains(owner->getGroupID())) { groupDamageMap.put(owner->getGroupID(),totalDamage); } else { groupDamageMap.get(owner->getGroupID()) += totalDamage; } if (groupDamageMap.get(owner->getGroupID()) > highestGroupDmg) { highestGroupDmg = groupDamageMap.get(owner->getGroupID()); leaderCreature = thisleader; } } else { if (!groupDamageMap.contains(owner->getObjectID())) { groupDamageMap.put(owner->getObjectID(),totalDamage); } else { groupDamageMap.get(owner->getObjectID()) += totalDamage; } if (totalDamage > highestGroupDmg) { highestGroupDmg = totalDamage; leaderCreature = owner; } } } } else { //tlog.info("adding single creature damage " + String::valueOf(totalDamage),true); groupDamageMap.put(creature->getObjectID(),totalDamage); if (totalDamage > highestGroupDmg) { highestGroupDmg = totalDamage; leaderCreature = creature; } } } //tlog.info("highest group is " + leaderCreature->getFirstName() + " damage of " + String::valueOf(highestGroupDmg),true); return leaderCreature; }