Loading...   

  • Created By Uleat On: 06:01 PM January 26, 2019
  • Link

 zone/bot.cpp                  | 252 +++++++++++++++++++++++++++++++++---------
 zone/bot.h                    |   2 +
 zone/mob_movement_manager.cpp |  16 +++
 3 files changed, 215 insertions(+), 55 deletions(-)

diff --git a/zone/bot.cpp b/zone/bot.cpp
index 4076eafe..ab9d1abb 100644
--- a/zone/bot.cpp
+++ b/zone/bot.cpp
@@ -29,7 +29,7 @@
 extern volatile bool is_zone_loaded;
 
 // This constructor is used during the bot create command
-Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1) {
+Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm::vec4(), GravityBehavior::Ground, false), rest_timer(1) {
 	if(botOwner) {
 		this->SetBotOwner(botOwner);
 		this->_botOwnerCharacterID = botOwner->CharacterID();
@@ -105,7 +105,7 @@ Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm
 
 // This constructor is used when the bot is loaded out of the database
 Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType npcTypeData) 
-	: NPC(&npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1)
+	: NPC(&npcTypeData, nullptr, glm::vec4(), GravityBehavior::Ground, false), rest_timer(1)
 {
 	this->_botOwnerCharacterID = botOwnerCharacterID;
 	if(this->_botOwnerCharacterID > 0)
@@ -225,6 +225,8 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
 		current_mana = max_mana;
 
 	cur_end = max_end;
+
+	SetFlyMode(GravityBehavior::Ground);
 }
 
 Bot::~Bot() {
@@ -316,37 +318,41 @@ bool Bot::IsStanding() {
 NPCType Bot::FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender, float size, uint32 face, uint32 hairStyle, uint32 hairColor, uint32 eyeColor, uint32 eyeColor2, uint32 beardColor, uint32 beard, uint32 drakkinHeritage, uint32 drakkinTattoo, uint32 drakkinDetails, int32 hp, int32 mana, int32 mr, int32 cr, int32 dr, int32 fr, int32 pr, int32 corrup, int32 ac, uint32 str, uint32 sta, uint32 dex, uint32 agi, uint32 _int, uint32 wis, uint32 cha, uint32 attack) {
 	NPCType BotNPCType;
 	int CopyLength = 0;
+
 	CopyLength = botName.copy(BotNPCType.name, 63);
 	BotNPCType.name[CopyLength] = '\0';
 	CopyLength = 0;
+
 	CopyLength = botLastName.copy(BotNPCType.lastname, 69);
 	BotNPCType.lastname[CopyLength] = '\0';
 	CopyLength = 0;
-	BotNPCType.npc_spells_id = botSpellsID;
-	BotNPCType.level = botLevel;
+
+	BotNPCType.current_hp = hp;
+	BotNPCType.max_hp = hp; // added
+	BotNPCType.size = size;
+	BotNPCType.runspeed = 0.7f;
+	BotNPCType.gender = gender;
 	BotNPCType.race = botRace;
 	BotNPCType.class_ = botClass;
-	BotNPCType.gender = gender;
-	BotNPCType.size = size;
-	BotNPCType.luclinface = face;
-	BotNPCType.hairstyle = hairStyle;
-	BotNPCType.haircolor = hairColor;
-	BotNPCType.eyecolor1 = eyeColor;
-	BotNPCType.eyecolor2 = eyeColor2;
-	BotNPCType.beardcolor = beardColor;
-	BotNPCType.beard = beard;
-	BotNPCType.drakkin_heritage = drakkinHeritage;
-	BotNPCType.drakkin_tattoo = drakkinTattoo;
-	BotNPCType.drakkin_details = drakkinDetails;
-	BotNPCType.current_hp = hp;
-	BotNPCType.Mana = mana;
-	BotNPCType.MR = mr;
-	BotNPCType.CR = cr;
-	BotNPCType.DR = dr;
-	BotNPCType.FR = fr;
-	BotNPCType.PR = pr;
-	BotNPCType.Corrup = corrup;
+	BotNPCType.bodytype = 1;
+	BotNPCType.deity = EQEmu::deity::DeityUnknown; // added
+	BotNPCType.level = botLevel;
+	BotNPCType.npc_id = 0;
+	BotNPCType.texture = 0;
+	BotNPCType.helmtexture = 0; // added
+	BotNPCType.herosforgemodel = 0; // added
+	BotNPCType.loottable_id = 0; // added
+	BotNPCType.npc_spells_id = botSpellsID;
+	BotNPCType.npc_spells_effects_id = 0; // added
+	BotNPCType.npc_faction_id = 0; // added
+	BotNPCType.merchanttype = 0; // added
+	BotNPCType.alt_currency_type = 0; // added
+	BotNPCType.adventure_template = 0; // added
+	BotNPCType.trap_template = 0; // added
+	BotNPCType.light = 0; // due to the way that bots are coded..this is sent post-spawn
 	BotNPCType.AC = ac;
+	BotNPCType.Mana = mana;
+	BotNPCType.ATK = attack;
 	BotNPCType.STR = str;
 	BotNPCType.STA = sta;
 	BotNPCType.DEX = dex;
@@ -354,55 +360,123 @@ NPCType Bot::FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::str
 	BotNPCType.INT = _int;
 	BotNPCType.WIS = wis;
 	BotNPCType.CHA = cha;
-	BotNPCType.ATK = attack;
-	BotNPCType.npc_id = 0;
-	BotNPCType.texture = 0;
+	BotNPCType.MR = mr;
+	BotNPCType.FR = fr;
+	BotNPCType.CR = cr;
+	BotNPCType.PR = pr;
+	BotNPCType.DR = dr;
+	BotNPCType.Corrup = corrup;
+	BotNPCType.PhR = 0; // added (probably needs be adjusted...)
+	BotNPCType.haircolor = hairColor;
+	BotNPCType.beardcolor = beardColor;
+	BotNPCType.eyecolor1 = eyeColor;
+	BotNPCType.eyecolor2 = eyeColor2;
+	BotNPCType.hairstyle = hairStyle;
+	BotNPCType.luclinface = face;
+	BotNPCType.beard = beard;
+	BotNPCType.drakkin_heritage = drakkinHeritage;
+	BotNPCType.drakkin_tattoo = drakkinTattoo;
+	BotNPCType.drakkin_details = drakkinDetails;
+	BotNPCType.armor_tint = { 0 };
+	BotNPCType.min_dmg = 0; // added
+	BotNPCType.max_dmg = 0; // added
+	BotNPCType.charm_ac = 0; // added
+	BotNPCType.charm_min_dmg = 0; // added
+	BotNPCType.charm_max_dmg = 0; // added
+	BotNPCType.charm_attack_delay = 0; // added
+	BotNPCType.charm_accuracy_rating = 0; // added
+	BotNPCType.charm_avoidance_rating = 0; // added
+	BotNPCType.charm_atk = 0; // added
+	BotNPCType.attack_count = 0; // added
+	BotNPCType.special_abilities[512] = { 0 }; // added
 	BotNPCType.d_melee_texture1 = 0;
 	BotNPCType.d_melee_texture2 = 0;
-	BotNPCType.qglobal = false;
-	BotNPCType.attack_speed = 0;
-	BotNPCType.runspeed = 0.7f;
-	BotNPCType.bodytype = 1;
-	BotNPCType.findable = 0;
+	BotNPCType.ammo_idfile[30] = { 0 }; // added
+	BotNPCType.prim_melee_type = 0; // added
+	BotNPCType.sec_melee_type = 0; // added
+	BotNPCType.ranged_type = 0; // added
 	BotNPCType.hp_regen = 1;
 	BotNPCType.mana_regen = 1;
+	BotNPCType.aggroradius = 0; // added
+	BotNPCType.assistradius = 0; // added
+	BotNPCType.see_invis = 0; // added
+	BotNPCType.see_invis_undead = false; // added
+	BotNPCType.see_hide = false; // added
+	BotNPCType.see_improved_hide = false; // added
+	BotNPCType.qglobal = false;
+	BotNPCType.npc_aggro = false; // added
+	BotNPCType.spawn_limit = 0; // added
+	BotNPCType.mount_color = 0; // added
+	BotNPCType.attack_speed = 0;
+	BotNPCType.attack_delay = 0; // added
+	BotNPCType.accuracy_rating = 0; // added
+	BotNPCType.avoidance_rating = 0; // added
+	BotNPCType.findable = false;
+	BotNPCType.trackable = true; // added
+	BotNPCType.slow_mitigation = 0; // added
 	BotNPCType.maxlevel = botLevel;
-	BotNPCType.light = 0; // due to the way that bots are coded..this is sent post-spawn
+	BotNPCType.scalerate = 0; // added
+	BotNPCType.private_corpse = false; // added
+	BotNPCType.unique_spawn_by_name = false; // added
+	BotNPCType.underwater = false; // added
+	BotNPCType.emoteid = 0; // added
+	BotNPCType.spellscale = 0.0f; // added
+	BotNPCType.healscale = 0.0f; // added
+	BotNPCType.no_target_hotkey = false; // added
+	BotNPCType.raid_target = false; // added
+	BotNPCType.armtexture = 0; // added
+	BotNPCType.bracertexture = 0; // added
+	BotNPCType.handtexture = 0; // added
+	BotNPCType.legtexture = 0; // added
+	BotNPCType.feettexture = 0; // added
+	BotNPCType.ignore_despawn = 0; // added
+	BotNPCType.show_name = true; // added
+	BotNPCType.untargetable = false; // added
+	BotNPCType.skip_global_loot = true; // added
+	BotNPCType.rare_spawn = false; // added
+	BotNPCType.stuck_behavior = GravityBehavior::Flying; // added
+	
 	return BotNPCType;
 }
 
 NPCType Bot::CreateDefaultNPCTypeStructForBot(std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender) {
 	NPCType Result;
 	int CopyLength = 0;
+
 	CopyLength = botName.copy(Result.name, 63);
 	Result.name[CopyLength] = '\0';
 	CopyLength = 0;
+
 	CopyLength = botLastName.copy(Result.lastname, 69);
 	Result.lastname[CopyLength] = '\0';
 	CopyLength = 0;
-	Result.level = botLevel;
-	Result.race = botRace;
-	Result.class_ = botClass;
-	Result.gender = gender;
-	// default values
-	Result.maxlevel = botLevel;
-	Result.size = 6.0;
-	Result.npc_id = 0;
+
 	Result.current_hp = 0;
-	Result.drakkin_details = 0;
-	Result.drakkin_heritage = 0;
-	Result.drakkin_tattoo = 0;
+	Result.max_hp = 0; // added
+	Result.size = 6.0;
 	Result.runspeed = 0.7f;
+	Result.gender = gender;
+	Result.race = botRace;
+	Result.class_ = botClass;
 	Result.bodytype = 1;
-	Result.findable = 0;
-	Result.hp_regen = 1;
-	Result.mana_regen = 1;
+	Result.deity = EQEmu::deity::DeityUnknown; // added
+	Result.level = botLevel;
+	Result.npc_id = 0;
 	Result.texture = 0;
-	Result.d_melee_texture1 = 0;
-	Result.d_melee_texture2 = 0;
-	Result.qglobal = false;
+	Result.helmtexture = 0; // added
+	Result.herosforgemodel = 0; // added
+	Result.loottable_id = 0; // added
 	Result.npc_spells_id = 0;
-	Result.attack_speed = 0;
+	Result.npc_spells_effects_id = 0; // added
+	Result.npc_faction_id = 0; // added
+	Result.merchanttype = 0; // added
+	Result.alt_currency_type = 0; // added
+	Result.adventure_template = 0; // added
+	Result.trap_template = 0; // added
+	Result.light = 0; // added
+	Result.AC = 12;
+	Result.Mana = 0; // added
+	Result.ATK = 75;
 	Result.STR = 75;
 	Result.STA = 75;
 	Result.DEX = 75;
@@ -410,14 +484,82 @@ NPCType Bot::CreateDefaultNPCTypeStructForBot(std::string botName, std::string b
 	Result.WIS = 75;
 	Result.INT = 75;
 	Result.CHA = 75;
-	Result.ATK = 75;
 	Result.MR = 25;
 	Result.FR = 25;
-	Result.DR = 15;
-	Result.PR = 15;
 	Result.CR = 25;
+	Result.PR = 15;
+	Result.DR = 15;
 	Result.Corrup = 15;
-	Result.AC = 12;
+	Result.PhR = 0; // added (probably needs be adjusted...)
+	Result.haircolor = 0; // added
+	Result.beardcolor = 0; // added
+	Result.eyecolor1 = 0; // added
+	Result.eyecolor2 = 0; // added
+	Result.hairstyle = 0; // added
+	Result.luclinface = 0; // added
+	Result.beard = 0; // added
+	Result.drakkin_heritage = 0;
+	Result.drakkin_tattoo = 0;
+	Result.drakkin_details = 0;
+	Result.armor_tint = { 0 }; // added
+	Result.min_dmg = 0; // added
+	Result.max_dmg = 0; // added
+	Result.charm_ac = 0; // added
+	Result.charm_min_dmg = 0; // added
+	Result.charm_max_dmg = 0; // added
+	Result.charm_attack_delay = 0; // added
+	Result.charm_accuracy_rating = 0; // added
+	Result.charm_avoidance_rating = 0; // added
+	Result.charm_atk = 0; // added
+	Result.attack_count = 0; // added
+	Result.special_abilities[512] = { 0 }; // added
+	Result.d_melee_texture1 = 0;
+	Result.d_melee_texture2 = 0;
+	Result.ammo_idfile[30] = { 0 }; // added
+	Result.prim_melee_type = 0; // added
+	Result.sec_melee_type = 0; // added
+	Result.ranged_type = 0; // added
+	Result.hp_regen = 1;
+	Result.mana_regen = 1;
+	Result.aggroradius = 0; // added
+	Result.assistradius = 0; // added
+	Result.see_invis = 0; // added
+	Result.see_invis_undead = false; // added
+	Result.see_hide = false; // added
+	Result.see_improved_hide = false; // added
+	Result.qglobal = false;
+	Result.npc_aggro = false; // added
+	Result.spawn_limit = 0; // added
+	Result.mount_color = 0; // added
+	Result.attack_speed = 0;
+	Result.attack_delay = 0; // added
+	Result.accuracy_rating = 0; // added
+	Result.avoidance_rating = 0; // added
+	Result.findable = false;
+	Result.trackable = true; // added
+	Result.slow_mitigation = 0; // added
+	Result.maxlevel = botLevel;
+	Result.scalerate = 0; // added
+	Result.private_corpse = false; // added
+	Result.unique_spawn_by_name = false; // added
+	Result.underwater = false; // added
+	Result.emoteid = 0; // added
+	Result.spellscale = 0.0f; // added
+	Result.healscale = 0.0f; // added
+	Result.no_target_hotkey = false; // added
+	Result.raid_target = false; // added
+	Result.armtexture = 0; // added
+	Result.bracertexture = 0; // added
+	Result.handtexture = 0; // added
+	Result.legtexture = 0; // added
+	Result.feettexture = 0; // added
+	Result.ignore_despawn = 0; // added
+	Result.show_name = true; // added
+	Result.untargetable = false; // added
+	Result.skip_global_loot = true; // added
+	Result.rare_spawn = false; // added
+	Result.stuck_behavior = GravityBehavior::Flying; // added
+
 	return Result;
 }
 
diff --git a/zone/bot.h b/zone/bot.h
index 6a528a4e..22bbcec5 100644
--- a/zone/bot.h
+++ b/zone/bot.h
@@ -398,6 +398,8 @@ public:
 	void DoEnduranceRegen();	//This Regenerates endurance
 	void DoEnduranceUpkeep();	//does the endurance upkeep
 
+	//virtual const bool IsUnderwaterOnly() const { return false; }
+
 	// AI Methods
 	virtual bool AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes);
 	virtual bool AI_EngagedCastCheck();
diff --git a/zone/mob_movement_manager.cpp b/zone/mob_movement_manager.cpp
index 43746828..0c20e21b 100644
--- a/zone/mob_movement_manager.cpp
+++ b/zone/mob_movement_manager.cpp
@@ -770,15 +770,25 @@ void MobMovementManager::UpdatePath(Mob *who, float x, float y, float z, MobMove
 	
 		PushMoveTo(ent.second, x, y, z, mode);
 		PushStopMoving(ent.second);
+
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePath: !zone->HasMap() || !zone->HasWaterMap()");
+
 		return;
 	}
 	
 	if (who->IsBoat()) {
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePath: UpdatePathBoat");
 		UpdatePathBoat(who, x, y, z, mode);
 	} else if (who->IsUnderwaterOnly()) {
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePath: UpdatePathUnderwater");
 		UpdatePathUnderwater(who, x, y, z, mode);
 	}
 	else {
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePath: UpdatePathGround");
 		UpdatePathGround(who, x, y, z, mode);
 	}
 }
@@ -806,6 +816,8 @@ void MobMovementManager::UpdatePathGround(Mob * who, float x, float y, float z,
 
 	if (route.size() == 0) {
 		HandleStuckBehavior(who, x, y, z, mode);
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePathGround: route.size() == 0");
 		return;
 	}
 
@@ -853,9 +865,13 @@ void MobMovementManager::UpdatePathGround(Mob * who, float x, float y, float z,
 	}
 
 	if (stuck) {
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePathGround: stuck - HandleStuckBehavior(...)");
 		HandleStuckBehavior(who, x, y, z, mode);
 	}
 	else {
+		if (who->IsBot())
+			Log(Logs::General, Logs::Error, "UpdatePathGround: !stuck - PushStopMoving(...)");
 		PushStopMoving(ent.second);
 	}
 }

Raw Paste Data