Ok i was looking for someting i could fix/add with my knowledge of eqemu source code. I figured /guildwar would be easy. So i added some code to make /guildwar work. It works just fine except for if there are more than 2 sets of guilds warring it doesnt work. I think i've fixed it i'll include what i think will fix that problem but i havent been on yet to check it because it requires 2 people to get on and check its a little harder than jsut logging on.
database.h Line 179 right after #endif
Code:
bool SetGuildWar(int32 guildid, int32 gildid2);
bool CheckGuildWar(int32 guildid, int32 guildid2);
client_process.cpp around Line 1845
insert this code into "case OP_GuildWar: { break; }"
Code:
GuildCommand_Struct* gc = (GuildCommand_Struct*) app->pBuffer;
Client* client=entity_list.GetClientByName(gc->othername);
if ((GuildRank() == 2) && (client->GuildRank() == 2)) // If both clients are guild leaders
{
if(!database.SetGuildWar(GuildDBID(), client->GuildDBID()))
Message(0, "And error occured while writing to Database");
}
else if (client->GuildRank() != 2)
Message(0, "Error: Your target is not a guild leader!");
else if (client->GuildDBID == 0)
Message(0, "Error: Your target is not in a guild!");
else if (GuildRank() !=2)
Message(0, "Error: You arent the guild leader!");
else if (!worldserver.Connected())
Message(0, "Error: World server disconnected");
else if (client->GuildDBID() == GuildDBID())
Message(0,"You are in the same guild, what do you think you are doing?");
else if (guilddbid == 0)
Message(0, "Error: You arent in a guild!");
break;
database.cpp line 740
after bool Database::SetGMSpeed(int32 account_id, int8 gmspeed) function
Code:
bool Database::SetGuildWar(int32 guildid, int32 guildid2)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO guildwar SET guildid1=%i, guildid2=%i;", guildid, guildid2), errbuf))
{
cerr << "Error in SetGuildWar Query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
return false;
}
else
{
safe_delete_array(query);
return true;
}
}
bool Database::CheckGuildWar(int32 guildid1, int32 guildid2)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int x;
if (!RunQuery(query, MakeAnyLenString(&query, "SELECT guildid2 FROM guildwar WHERE guildid1='%i';", guildid1), errbuf, &result))
{
cerr << "Error in CheckGuildWar Query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
return false;
}
else
{
//********************************************************
//Possible Fix for having more than one set of guilds warring at same time
// for(x = 0; x <= result; x++)
// {
// row = mysql_fetch_row(x);
// int32 guildid2_match = atoi(row[x]);
//
// mysql_free_result(x);
//
// if(guildid2_match == guildid2)
// return true;
// }
//********************************************************
if (mysql_num_rows(result) == 1)
{
row = mysql_fetch_row(result);
int32 guildid2_match = atoi(row[0]);
mysql_free_result(result);
if(guildid2_match == guildid2)
return true;
}
}
return false;
}
mob.cpp Line 2080
inside the if(_CLIENT(mob2)) statment should read.
Code:
c1 = mob1->CastToClient();
c2 = mob2->CastToClient();
if // if both are pvp they can fight
(
c1->GetPVP() &&
c2->GetPVP()
)
return true;
else if // if they're dueling they can go at it
(
c1->IsDueling() &&
c2->IsDueling() &&
c1->GetDuelTarget() == c2->GetID() &&
c2->GetDuelTarget() == c1->GetID()
)
return true;
// If the two guilds are at war and not in same guild
else if ((c1->GuildDBID() != 0) && (c2->GuildDBID() != 0) || (c1->GuildDBID() == c2->GuildDBID()))
{
if(!database.CheckGuildWar(c1->GuildDBID(), c2->GuildDBID()) || !database.CheckGuildWar(c2->GuildDBID(), c1->GuildDBID()))
{
Message(0, "You do not have permission to attack that player");
return false;
}
else
return true;
}
else
return false;
I think that is all of it however if it doesnt complile i didnt get all of it i didnt get any errors compiling and it worked fine in game in alot of testing.