Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

Closed Thread
 
Thread Tools Display Modes
  #751  
Old 09-25-2008, 09:37 PM
hayward6
Forum Guide
 
Join Date: Jul 2005
Posts: 468
Default

Quote:
Originally Posted by Congdar View Post
Substitute EQBOTS for SPELL_EFFECT_SPAM in the instructions below and these will work for VS2005/2008 for windows compiles. If you are compiling on linux it's different.
Yeah, I'm running Linux
__________________
Sayin Silverwolf
Server Op of The Sandbox (Non-Legit)
  #752  
Old 09-25-2008, 09:49 PM
Flare83
Sarnak
 
Join Date: Aug 2008
Location: usa
Posts: 43
Default

I'm trying to compile but i'm getting this error =*(

Code:
Generating Code...
Linking...
npc.obj : error LNK2019: unresolved external symbol "public: void __thiscall Mob::PET_Process(void)" (?PET_Process@Mob@@QAEXXZ) referenced in function "public: virtual bool __thiscall NPC::Process(void)" (?Process@NPC@@UAE_NXZ)
.\../Build/Zone.exe : fatal error LNK1120: 1 unresolved externals
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.50727
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://e:\EQEmu\Build\Zone\Release\BuildLog.htm"
Zone - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
__________________
thenameless.site88.net
  #753  
Old 09-26-2008, 09:52 AM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

I don't know the linux commands but the botai.cpp, botraids.cpp, botraids.h and petai.cpp need to be added to the project.
  #754  
Old 09-26-2008, 10:32 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Quote:
Originally Posted by Flare83 View Post
I'm trying to compile but i'm getting this error =*(

Code:
Generating Code...
Linking...
npc.obj : error LNK2019: unresolved external symbol "public: void __thiscall Mob::PET_Process(void)" (?PET_Process@Mob@@QAEXXZ) referenced in function "public: virtual bool __thiscall NPC::Process(void)" (?Process@NPC@@UAE_NXZ)
.\../Build/Zone.exe : fatal error LNK1120: 1 unresolved externals
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.50727
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://e:\EQEmu\Build\Zone\Release\BuildLog.htm"
Zone - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Look on page 26 of this thread, post 381 and 382. That might get you going.
  #755  
Old 09-26-2008, 01:19 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

I downloaded one of these kits posted here; Kits were made opyrus , I have the VS2008 one, never had any problems.
I copy pasted my source/zone, world, etc. from my Linux machine which has bot code, and it all still worked fine.
Someone needs to sticky this thread, this install really works well.
The only thing you have to keep in mind is not the change/overwrite the /source/server.sln that comes with the package.
  #756  
Old 09-26-2008, 01:44 PM
Flare83
Sarnak
 
Join Date: Aug 2008
Location: usa
Posts: 43
Default

Quote:
Originally Posted by Angelox View Post

I copy pasted my source/zone, world, etc. from my Linux machine which has bot code, and it all still worked fine.

The only thing you have to keep in mind is not the change/overwrite the /source/server.sln that comes with the package.

Thanks angelox =)
__________________
thenameless.site88.net
  #757  
Old 09-28-2008, 08:41 PM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

ok i found the problem i was having with groups not sticking after zoneing its in my bot code can anyone see if they can help me fix it? what happens is they zone and stay in group but it seems its clearing them from the database or the group itself.. then when they zone back into the zone it kills the group and everyone has to reform.

Code:
void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {

#ifdef EQBOTS

	// EQoffline: Remove the group if the leader is grouped
	Mob *clientmob = CastToMob();
	if(clientmob) {
		int16 cmid = clientmob->GetID();
		if(clientmob->IsBotRaiding()) {
			BotRaids* br = entity_list.GetBotRaidByMob(clientmob);
			if(br) {
				br->RemoveRaidBots();
				br = NULL;
			}
		}
		if(clientmob->IsGrouped()) {
			Group *g = entity_list.GetGroupByMob(clientmob);
			if(g) {
				for(int i=5; i>=0; i--) {
					if(g->members[i] && g->members[i]->IsBot()) {
						g->members[i]->Kill();
					}
				}
				if(g->BotGroupCount() <= 1) {
					g->DisbandGroup();
				}
			}
		}
		database.CleanBotLeader(cmid);
	}

#endif //EQBOTS

	zoning = true;
	if (app->size != sizeof(ZoneChange_Struct)) {
		LogFile->write(EQEMuLog::Debug, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct));
		return;
	}

#if EQDEBUG >= 5
	LogFile->write(EQEMuLog::Debug, "Zone request from %s", GetName());
	DumpPacket(app);
#endif
	ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer;

	uint16 target_zone_id = 0;
	ZonePoint* zone_point = NULL;

	//figure out where they are going.
	if(zc->zoneID == 0) {
		//client dosent know where they are going...
		//try to figure it out for them.
		
		switch(zone_mode) {
		case EvacToSafeCoords:
		case ZoneToSafeCoords:
			//going to safe coords, but client dosent know where?
			//assume it is this zone for now.
			cheat_timer.Start(35000,false);
			target_zone_id = zone->GetZoneID();
			break;
		case GMSummon:
			target_zone_id = zonesummon_id;
			break;
		case GateToBindPoint:
			target_zone_id = m_pp.binds[0].zoneId;
			break;
		case ZoneToBindPoint:
			target_zone_id = m_pp.binds[0].zoneId;
			break;
		case ZoneSolicited:  //we told the client to zone somewhere, so we know where they are going.
			cheat_timer.Start(35000,false);
			target_zone_id = zonesummon_id;
			break;
		case ZoneUnsolicited:   //client came up with this on its own.
			zone_point = zone->GetClosestZonePointWithoutZone(GetX(), GetY(), GetZ(), ZONEPOINT_NOZONE_RANGE);
			if(zone_point) {
				//we found a zone point, which is a reasonable distance away
				//assume that is the one were going with.
				target_zone_id = zone_point->target_zone_id;
			} else {
				//unable to find a zone point... is there anything else
				//that can be a valid un-zolicited zone request?
				
				CheatDetected(MQZone);
				Message(13, "Invalid unsolicited zone request.");
				LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
				SendZoneCancel(zc);
				return;
			}
			break;
		};
	}
	else {
		// This is to allow both 6.2 and Titanium clients to perform a proper zoning of the client when evac/succor
		// WildcardX 27 January 2008
		if(zone_mode == EvacToSafeCoords && zonesummon_id > 0)
			target_zone_id = zonesummon_id;
		else
		target_zone_id = zc->zoneID;
		
		//if we are zoning to a specific zone unsolicied,
		//then until otherwise determined, they must be zoning
		//on a zone line.
		if(zone_mode == ZoneUnsolicited) {
			zone_point = zone->GetClosestZonePoint(GetX(), GetY(), GetZ(), target_zone_id, ZONEPOINT_ZONE_RANGE);
			//if we didnt get a zone point, or its to a different zone,
			//then we assume this is invalid.
			if(!zone_point || zone_point->target_zone_id != target_zone_id) {
				Message(13, "Invalid unsolicited zone request.");
				LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
				if ((cheat_timer.GetRemainingTime())<1 || (!cheat_timer.Enabled())){ //Lieka:  Disable MQGate Detector if timer is active.
					CheatDetected(MQGate);
				}					
				SendZoneCancel(zc);
				return;
			}
		}
	}


	//make sure its a valid zone.
	const char *target_zone_name = database.GetZoneName(target_zone_id);
	if(target_zone_name == NULL) {
		//invalid zone...
		Message(13, "Invalid target zone ID.");
		LogFile->write(EQEMuLog::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id);
		SendZoneCancel(zc);
		return;
	}

	//load up the safe coords, restrictions, and verify the zone name
	float safe_x, safe_y, safe_z;
	sint16 minstatus = 0;
	int8 minlevel = 0;
	char flag_needed[128];
	if(!database.GetSafePoints(target_zone_name, &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) {
		//invalid zone...
		Message(13, "Invalid target zone while getting safe points.");
		LogFile->write(EQEMuLog::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name);
		SendZoneCancel(zc);
		return;
	}

#ifdef EMBPERL
		char buf[10];
		snprintf(buf, 9, "%d", target_zone_id);
		buf[9] = '\0';
		((PerlembParser*)parse)->Event(EVENT_ZONE, 0, buf, (NPC*)NULL, this);
#endif

	//handle circumvention of zone restrictions
	//we need the value when creating the outgoing packet as well.
	int8 ignorerestrictions = zonesummon_ignorerestrictions;
	zonesummon_ignorerestrictions = 0;

	float dest_x=0, dest_y=0, dest_z=0, dest_h;
	dest_h = GetHeading();
	switch(zone_mode) {
	case EvacToSafeCoords:
	case ZoneToSafeCoords:
		LogFile->write(EQEMuLog::Debug, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id);
		dest_x = safe_x;
		dest_y = safe_y;
		dest_z = safe_z;
		break;
	case GMSummon:
		dest_x = zonesummon_x;
		dest_y = zonesummon_y;
		dest_z = zonesummon_z;
		ignorerestrictions = 1;
		break;
	case GateToBindPoint:
		dest_x = m_pp.binds[0].x;
		dest_y = m_pp.binds[0].y;
		dest_z = m_pp.binds[0].z;
		break;
	case ZoneToBindPoint:
		dest_x = m_pp.binds[0].x;
		dest_y = m_pp.binds[0].y;
		dest_z = m_pp.binds[0].z;
		ignorerestrictions = 1;	//can always get to our bind point? seems exploitable
		break;
	case ZoneSolicited:  //we told the client to zone somewhere, so we know where they are going.
		//recycle zonesummon variables
		cheat_timer.Start(3500,false);
		dest_x = zonesummon_x;
		dest_y = zonesummon_y;
		dest_z = zonesummon_z;
		break;
	case ZoneUnsolicited:   //client came up with this on its own.
		//client requested a zoning... what are the cases when this could happen?
		
		//Handle zone point case:
		if(zone_point != NULL) {
			//they are zoning using a valid zone point, figure out coords
			
			//999999 is a placeholder for 'same as where they were from'
			if(zone_point->target_x == 999999)
				dest_x = GetX();
			else
				dest_x = zone_point->target_x;
			if(zone_point->target_y == 999999)
				dest_y = GetY();
			else
				dest_y = zone_point->target_y;
			if(zone_point->target_z == 999999)
				dest_z=GetZ();
			else
				dest_z = zone_point->target_z;
			if(zone_point->target_heading == 999)
				dest_h = GetHeading();
			else
				dest_h = zone_point->target_heading;
			
			break;
		}
		
		//for now, there are no other cases...
		
		//could not find a valid reason for them to be zoning, stop it.
		CheatDetected(MQZone);
		Message(13, "Invalid unsolicited zone request.");
		LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name);
		SendZoneCancel(zc);
		return;
	};

	//OK, now we should know where were going...

	//Check some rules first.
	sint8 myerror = 1;		//1 is succes

	//not sure when we would use ZONE_ERROR_NOTREADY

	//enforce min status and level
	if (!ignorerestrictions && (Admin() < minstatus || GetLevel() < minlevel)) {
		cheat_timer.Start(3500,false); //Lieka:  Don't set off warp detector for when a player is moved to the safe-spot for trying to access a zone without the appropriate level or status requirements (i.e. zoning into FearPlane at level 30, etc)
		myerror = ZONE_ERROR_NOEXPERIENCE;
		}
	
	if(!ignorerestrictions && flag_needed[0] != '\0') {
		//the flag needed string is not empty, meaning a flag is required.
		if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(target_zone_id)) {
			Message(13, "You must have the flag %s to enter this zone.");
			myerror = ZONE_ERROR_NOEXPERIENCE;
			cheat_timer.Start(3500,false);
		}
	}
	
	//Enforce ldon doungeon entrance rules
	if(myerror == 1 && database.IsLDoNDungeon(target_zone_id)
	// && !ignorerestrictions
	) {
		//this zone is an ldon dungeon
		int advid = GetAdventureID();
		if(advid > 0){
			//we are in an adventure... make sure its the right one
			AdventureInfo ai = database.GetAdventureInfo(advid);
			if(target_zone_id != ai.zonedungeonid) {
				Message(13, "You are not allowed to enter this dungeon!");
				LogFile->write(EQEMuLog::Error, "Zoning %s: Not allowed to enter dungeon '%s' (%d). Not in the right adventure.", GetName(), target_zone_name, target_zone_id);
				SendZoneCancel(zc);
				return;
			}
		} else {
			Message(13, "You are not allowed to enter this dungeon!");
			LogFile->write(EQEMuLog::Error, "Zoning %s: Not allowed to enter dungeon '%s' (%d). Not in any adventure.", GetName(), target_zone_name, target_zone_id);
			SendZoneCancel(zc);
			return;
		}
	}

	if(myerror == 1) {
		//we have successfully zoned
		DoZoneSuccess(zc, target_zone_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions);
	} else {
		LogFile->write(EQEMuLog::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name);
		SendZoneError(zc, myerror);
	}
}
the problem is the remove bots call if i comment it out and don't have bots the group stays intact if i have bots it destroys the group on zoneing and leaves the bots in the last zone.

so i cant just comment it out i have to fix it.

any suggestions?
  #758  
Old 09-28-2008, 09:23 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

If you have more than one PC in the group, the Bots should be invited last. Maybe that will help with the group issue.

The bots have been coded such that they cannot zone with you because it would crash the zone when I tried. It was easier for me to make it that way than to figure out how to make them zone with you. If you really want to make bots zone with you there's a ton of other zone/teleport/group teleport code that will need to be changed as well. I recommend living with this restriction.
  #759  
Old 09-28-2008, 09:34 PM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

no thats not it.. i don't care if they zone or not.. the problem is this code is making it so when you zone.. with or without a bot. and your grouped. then your group breaks up. i think its removing you from the new group ids database and not adding you back with or without a bot.

example.. your in a group no bots and die.. your still in group but then you zone back to rejoin your group the group is disbanded and you have to reform.. i tried with all the bot code removed and the code for groups works add it back and it breaks.. remove this peace and it works but if you have bots it breaks the group soon as you zone.
  #760  
Old 09-28-2008, 11:16 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

ok, thanks for clearing that up... try this and let me know if it works. Just replace the entire ifdef
Code:
#ifdef EQBOTS

	// EQoffline: Remove the group if the leader is grouped
	Mob *clientmob = CastToMob();
	if(clientmob) {
		int16 cmid = GetID();
		if(clientmob->IsBotRaiding()) {
			BotRaids* br = entity_list.GetBotRaidByMob(clientmob);
			if(br) {
				br->RemoveRaidBots();
				br = NULL;
			}
		}
		if(clientmob->IsGrouped()) {
			Group *g = entity_list.GetGroupByMob(clientmob);
			if(g) {
				bool hasBots = false;
				for(int i=5; i>=0; i--) {
					if(g->members[i] && g->members[i]->IsBot()) {
						hasBots = true;
						g->members[i]->Kill();
					}
				}
				if(hasBots) {
					if(g->BotGroupCount() <= 1) {
						g->DisbandGroup();
					}
				}
			}
		}
		database.CleanBotLeader(cmid);
	}

#endif //EQBOTS
  #761  
Old 09-29-2008, 12:11 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

ok that worked great.. now the bots leave group and group stays in tact now 1 more problem.. the player that owns the bots invites a player.. spawns bots and zones out and back bots gone group intact. so then i respawn the bots and try to invite them. says only leader can invite bots and kills them. but then i log on another char and try to invite them and it lets me..

so basically what happens is now the bots cant find the leader of the group even though the owner is still the group leader according to the game.

any ideals?
  #762  
Old 09-29-2008, 02:33 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

i fixed it i just removed the group leader check when inviting bots.. i don't care if anyone in group can invite them leader or not.. and it seems to e working now. but i would still like to see a fix to the problem in case i decide to put leader check back in or if anyone else needs it
  #763  
Old 09-29-2008, 06:59 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

I fixed a few exploits on mine;
for players who make armies of Bots and invite them as they fight and loose bots;
in command.cpp around line 8161;
replace

Code:
	if(!strcasecmp(sep->arg[1], "group") && !strcasecmp(sep->arg[2], "add"))
    {
		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || !c->GetTarget()->IsBot())
        {
            c->Message(15, "You must target a bot!");
			return;
		}
With this;
Code:
	if(!strcasecmp(sep->arg[1], "group") && !strcasecmp(sep->arg[2], "add"))
    {
		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || !c->GetTarget()->IsBot() || (c->IsEngaged())) //Angelox
        {
            c->Message(15, "You must target a bot and can't be engaged!");
			return;
		}
for players who kill players or any mob with the '#bot raid group create';
in command.cpp around line 8645;
replace
Code:
					c->Message(15, "You must have created your raid and your group must be full before doing that!");
				Mob* kmob = c->GetTarget();
				if(kmob != NULL) {
					kmob->Kill();
				}
With
Code:
				c->Message(15, "You must have created your raid and your group must be full before doing that!");
				Mob* kmob = c->GetTarget();
				if(kmob != NULL) {
					kmob->GetTarget();  //Problem? kmob->Kill() was here b4 Angelox
				}
And finally, Since th '#Bot update as it really doesn't work right (at least for me and what I got it doesn't), and is an exploit for no down time (this full heals the bot), I just quoted it out (I'm content to updates when zoning/re-logging the bot);
command.cpp, line 7202 replace;
Code:
c->Message(15, "#bot update [target] - you must type that command once you gain a level.");
with
Code:
	c->Message(15, "#bot update You must zone or re-log to see updated Bot"); //Angelox: removed for exploit (doesn't work right anyways
and quote out lines 8462 - 8486 (more or less)
Code:
/*	if(!strcasecmp(sep->arg[1], "update")) {
//        // Congdar: add IsEngaged check for exploit to keep bots alive by repeatedly using #bot update.
//	  // Angelox: Disabled it totally as it is an exploit for no down time 
        if(c->GetTarget() != NULL)
        {
            if(c->GetTarget()->IsBot() && (c->GetTarget()->BotOwner == c->CastToMob()) && !c->GetTarget()->IsEngaged()) {
                Mob *bot = c->GetTarget();
                bot->SetLevel(c->GetLevel());
				bot->CalcBotStats();
            }
            else {
				if(c->GetTarget()->IsEngaged()) {
					c->Message(15, "You cannot update while engaged.");
				}
				else {
					c->Message(15, "You must target a bot first");
				}
            }
        }
        else {
			c->Message(15, "You must target a bot first");
        }
        return;
	}
*/
This fixes are tested and running on a few mini-login servers, mad by request of the owners.
  #764  
Old 09-29-2008, 07:53 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

wow nice fixes i did not even know that was doable but tested and yes that does kill players or npcs so thanks for that fix its in mine now.
  #765  
Old 09-29-2008, 09:05 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Quote:
Originally Posted by spider661 View Post
i fixed it i just removed the group leader check when inviting bots.. i don't care if anyone in group can invite them leader or not.. and it seems to e working now. but i would still like to see a fix to the problem in case i decide to put leader check back in or if anyone else needs it
The group fix by Congdar is great!
Tell me what you did to remove the group leader check.
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:18 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3