mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-11-04 06:32:00 +00:00 
			
		
		
		
	Merge branch 'moreMovementAi' of https://github.com/DarkflameUniverse/DarkflameServer into moreMovementAi
This commit is contained in:
		@@ -73,7 +73,7 @@ void MovementAIComponent::HandleWaypointArrived(uint32_t commandIndex) {
 | 
				
			|||||||
			GameMessages::SendPlayNDAudioEmitter(m_Parent, UNASSIGNED_SYSTEM_ADDRESS, data);
 | 
								GameMessages::SendPlayNDAudioEmitter(m_Parent, UNASSIGNED_SYSTEM_ADDRESS, data);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case eWaypointCommandType::BOUNCE:
 | 
							case eWaypointCommandType::BOUNCE:
 | 
				
			||||||
			Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side");
 | 
								Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side!");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case eWaypointCommandType::INVALID:
 | 
							case eWaypointCommandType::INVALID:
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
@@ -111,7 +111,7 @@ void MovementAIComponent::HandleWaypointCommandCastSkill(const std::string& data
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uint32_t skillId = 0;
 | 
						uint32_t skillId = 0;
 | 
				
			||||||
	GeneralUtils::TryParse<uint32_t>(data, skillId);
 | 
						if (!GeneralUtils::TryParse<uint32_t>(data, skillId)) return;
 | 
				
			||||||
	if (skillId != 0) skillComponent->CastSkill(skillId);
 | 
						if (skillId != 0) skillComponent->CastSkill(skillId);
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -149,8 +149,9 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(const std::strin
 | 
				
			|||||||
float MovementAIComponent::HandleWaypointCommandDelay(const std::string& data) {
 | 
					float MovementAIComponent::HandleWaypointCommandDelay(const std::string& data) {
 | 
				
			||||||
	float delay = 0.0f;
 | 
						float delay = 0.0f;
 | 
				
			||||||
	std::string delayString = data;
 | 
						std::string delayString = data;
 | 
				
			||||||
	delayString.erase(std::remove_if(delayString.begin(), delayString.end(), isspace), delayString.end());
 | 
						if (!GeneralUtils::TryParse<float>(delayString, delay)){
 | 
				
			||||||
	GeneralUtils::TryParse<float>(delayString, delay);
 | 
							Game::logger->LogDebug("MovementAIComponentAronwk", "Failed to parse delay %s", data.c_str());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return delay;
 | 
						return delay;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -166,7 +167,7 @@ void MovementAIComponent::HandleWaypointCommandTeleport(const std::string& data)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void MovementAIComponent::HandleWaypointCommandPathSpeed(const std::string& data) {
 | 
					void MovementAIComponent::HandleWaypointCommandPathSpeed(const std::string& data) {
 | 
				
			||||||
	float speed = 0.0;
 | 
						float speed = 0.0;
 | 
				
			||||||
	GeneralUtils::TryParse<float>(data, speed);
 | 
						if (!GeneralUtils::TryParse<float>(data, speed)) return;
 | 
				
			||||||
	SetCurrentSpeed(speed);
 | 
						SetCurrentSpeed(speed);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -187,7 +188,7 @@ void MovementAIComponent::HandleWaypointCommandRemoveNPC(const std::string& data
 | 
				
			|||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		uint32_t factionID = -1;
 | 
							uint32_t factionID = -1;
 | 
				
			||||||
		GeneralUtils::TryParse<uint32_t>(data, factionID);
 | 
							if (!GeneralUtils::TryParse<uint32_t>(data, factionID)) return;
 | 
				
			||||||
		if (destroyableComponent->BelongsToFaction(factionID)) m_Parent->Kill();
 | 
							if (destroyableComponent->BelongsToFaction(factionID)) m_Parent->Kill();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -199,7 +200,7 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string&
 | 
				
			|||||||
	if (data.find(",") != std::string::npos){
 | 
						if (data.find(",") != std::string::npos){
 | 
				
			||||||
		auto datas = GeneralUtils::SplitString(data, ',');
 | 
							auto datas = GeneralUtils::SplitString(data, ',');
 | 
				
			||||||
		path_string = datas.at(0);
 | 
							path_string = datas.at(0);
 | 
				
			||||||
		GeneralUtils::TryParse(datas.at(1), index);
 | 
							if (!GeneralUtils::TryParse(datas.at(1), index)) return;
 | 
				
			||||||
	} else path_string = data;
 | 
						} else path_string = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (path_string != "") {
 | 
						if (path_string != "") {
 | 
				
			||||||
@@ -210,7 +211,7 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string&
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void MovementAIComponent::HandleWaypointCommandSpawnObject(const std::string& data) {
 | 
					void MovementAIComponent::HandleWaypointCommandSpawnObject(const std::string& data) {
 | 
				
			||||||
	LOT newObjectLOT = 0;
 | 
						LOT newObjectLOT = 0;
 | 
				
			||||||
	GeneralUtils::TryParse(data, newObjectLOT);
 | 
						if (!GeneralUtils::TryParse(data, newObjectLOT)) return;
 | 
				
			||||||
	EntityInfo info{};
 | 
						EntityInfo info{};
 | 
				
			||||||
	info.lot = newObjectLOT;
 | 
						info.lot = newObjectLOT;
 | 
				
			||||||
	info.pos = m_Parent->GetPosition();
 | 
						info.pos = m_Parent->GetPosition();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -550,9 +550,10 @@ void Zone::LoadPath(std::istream& file) {
 | 
				
			|||||||
				LDFBaseData* ldfConfig = nullptr;
 | 
									LDFBaseData* ldfConfig = nullptr;
 | 
				
			||||||
				if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) {
 | 
									if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) {
 | 
				
			||||||
					// cause NetDevil puts spaces in things that don't need spaces
 | 
										// cause NetDevil puts spaces in things that don't need spaces
 | 
				
			||||||
					parameter.erase(std::remove_if(parameter.begin(), parameter.end(), isspace), parameter.end());
 | 
										parameter.erase(std::remove_if(parameter.begin(), parameter.end(), ::isspace), parameter.end());
 | 
				
			||||||
					auto waypointCommand = WaypointCommandType::StringToWaypointCommandType(parameter);
 | 
										auto waypointCommand = WaypointCommandType::StringToWaypointCommandType(parameter);
 | 
				
			||||||
					if(waypointCommand != eWaypointCommandType::INVALID) waypoint.commands.push_back(WaypointCommand(waypointCommand, value));
 | 
										if (waypointCommand == eWaypointCommandType::DELAY) value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end());
 | 
				
			||||||
 | 
										if (waypointCommand != eWaypointCommandType::INVALID) waypoint.commands.push_back(WaypointCommand(waypointCommand, value));
 | 
				
			||||||
					else Game::logger->Log("Zone", "Tried to load invalid waypoint command '%s'", parameter.c_str());
 | 
										else Game::logger->Log("Zone", "Tried to load invalid waypoint command '%s'", parameter.c_str());
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value);
 | 
										ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user