Implement group mentor, leadership exp sharing (SoF+ only)

Currently only works in normal groups
Some decisions: the EXP will be rounded in the favor of the group leader
No idea how live actually handles it.
This commit is contained in:
Michael Cook (mackal)
2014-10-18 00:17:46 -04:00
parent 223d06645d
commit e8eb774458
17 changed files with 131 additions and 15 deletions
+28 -4
View File
@@ -234,6 +234,7 @@ void MapOpcodes()
ConnectedOpcodes[OP_GroupInvite] = &Client::Handle_OP_GroupInvite;
ConnectedOpcodes[OP_GroupInvite2] = &Client::Handle_OP_GroupInvite2;
ConnectedOpcodes[OP_GroupMakeLeader] = &Client::Handle_OP_GroupMakeLeader;
ConnectedOpcodes[OP_GroupMentor] = &Client::Handle_OP_GroupMentor;
ConnectedOpcodes[OP_GroupRoles] = &Client::Handle_OP_GroupRoles;
ConnectedOpcodes[OP_GroupUpdate] = &Client::Handle_OP_GroupUpdate;
ConnectedOpcodes[OP_GuildBank] = &Client::Handle_OP_GuildBank;
@@ -1635,9 +1636,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
}
} //else, somebody from our group is already here...
if (group)
group->UpdatePlayer(this);
else
if (!group)
database.SetGroupID(GetName(), 0, CharacterID()); //cannot re-establish group, kill it
}
@@ -1656,9 +1655,11 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
char AssistName[64];
char PullerName[64];
char NPCMarkerName[64];
char mentoree_name[64];
int mentor_percent;
GroupLeadershipAA_Struct GLAA;
memset(ln, 0, 64);
strcpy(ln, database.GetGroupLeadershipInfo(group->GetID(), ln, MainTankName, AssistName, PullerName, NPCMarkerName, &GLAA));
strcpy(ln, database.GetGroupLeadershipInfo(group->GetID(), ln, MainTankName, AssistName, PullerName, NPCMarkerName, mentoree_name, &mentor_percent, &GLAA));
Client *c = entity_list.GetClientByName(ln);
if (c)
group->SetLeader(c);
@@ -1668,6 +1669,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
group->SetPuller(PullerName);
group->SetNPCMarker(NPCMarkerName);
group->SetGroupAAs(&GLAA);
group->SetGroupMentor(mentor_percent, mentoree_name);
//group->NotifyMainTank(this, 1);
//group->NotifyMainAssist(this, 1);
@@ -1679,6 +1681,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
group->SendLeadershipAAUpdate();
}
group->UpdatePlayer(this);
LFG = false;
}
@@ -6858,6 +6861,27 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app)
}
}
void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app)
{
if (app->size != sizeof(GroupMentor_Struct)) {
LogFile->write(EQEMuLog::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct));
DumpPacket(app);
return;
}
GroupMentor_Struct *gms = (GroupMentor_Struct *)app->pBuffer;
Group *group = GetGroup();
if (!group)
return;
gms->name[63] = '\0';
if (strlen(gms->name))
group->SetGroupMentor(gms->percent, gms->name);
else
group->ClearGroupMentor();
return;
}
void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app)
{
if (app->size != sizeof(GroupRole_Struct)) {