mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Profiler/ArenaTeams
* remove profiles from existing teams of the same type they are going to be added to. * should prevent characters being stuck in old teams.
This commit is contained in:
@@ -758,6 +758,16 @@ class Profiler
|
|||||||
'personalRating' => $t['personalRating']
|
'personalRating' => $t['personalRating']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Delete members from other teams of the same type
|
||||||
|
DB::Aowow()->query(
|
||||||
|
'DELETE atm
|
||||||
|
FROM ?_profiler_arena_team_member atm
|
||||||
|
JOIN ?_profiler_arena_team at ON atm.`arenaTeamId` = at.`id` AND at.`type` = ?d
|
||||||
|
WHERE atm.`profileId` = ?d',
|
||||||
|
$t['type'],
|
||||||
|
$profileId
|
||||||
|
);
|
||||||
|
|
||||||
DB::Aowow()->query('INSERT INTO ?_profiler_arena_team_member (?#) VALUES (?a) ON DUPLICATE KEY UPDATE ?a', array_keys($member), array_values($member), array_slice($member, 2));
|
DB::Aowow()->query('INSERT INTO ?_profiler_arena_team_member (?#) VALUES (?a) ON DUPLICATE KEY UPDATE ?a', array_keys($member), array_values($member), array_slice($member, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,11 +925,21 @@ class Profiler
|
|||||||
$members[$mGuid]['profileId'] = $mProfiles->getField('id');
|
$members[$mGuid]['profileId'] = $mProfiles->getField('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete members from other teams of the same type...
|
||||||
|
DB::Aowow()->query(
|
||||||
|
'DELETE atm
|
||||||
|
FROM ?_profiler_arena_team_member atm
|
||||||
|
JOIN ?_profiler_arena_team at ON atm.`arenaTeamId` = at.`id` AND at.`type` = ?d
|
||||||
|
WHERE atm.`profileId` IN (?a)',
|
||||||
|
$team['type'],
|
||||||
|
array_column($members, 'profileId')
|
||||||
|
);
|
||||||
|
|
||||||
|
// ...and purge this teams member
|
||||||
DB::Aowow()->query('DELETE FROM ?_profiler_arena_team_member WHERE arenaTeamId = ?d', $teamId);
|
DB::Aowow()->query('DELETE FROM ?_profiler_arena_team_member WHERE arenaTeamId = ?d', $teamId);
|
||||||
|
|
||||||
foreach (Util::createSqlBatchInsert($members) as $m)
|
foreach (Util::createSqlBatchInsert($members) as $m)
|
||||||
DB::Aowow()->query('INSERT INTO ?_profiler_arena_team_member (?#) VALUES '.$m, array_keys(reset($members)));
|
DB::Aowow()->query('INSERT INTO ?_profiler_arena_team_member (?#) VALUES '.$m, array_keys(reset($members)));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -287,12 +287,28 @@ class RemoteArenaTeamList extends ArenaTeamList
|
|||||||
|
|
||||||
$memberData = [];
|
$memberData = [];
|
||||||
foreach ($teams as $teamId => $team)
|
foreach ($teams as $teamId => $team)
|
||||||
|
{
|
||||||
|
$clearMembers = [];
|
||||||
foreach ($team as $memberId => $member)
|
foreach ($team as $memberId => $member)
|
||||||
$memberData[] = array(
|
{
|
||||||
|
$clearMembers[] = $profiles[$realmId]->getEntry($realmId.':'.$memberId)['id'];
|
||||||
|
$memberData[] = array(
|
||||||
'arenaTeamId' => $localIds[$realmId.':'.$teamId],
|
'arenaTeamId' => $localIds[$realmId.':'.$teamId],
|
||||||
'profileId' => $profiles[$realmId]->getEntry($realmId.':'.$memberId)['id'],
|
'profileId' => $profiles[$realmId]->getEntry($realmId.':'.$memberId)['id'],
|
||||||
'captain' => $member[2]
|
'captain' => $member[2]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete members from other teams of the same type
|
||||||
|
DB::Aowow()->query(
|
||||||
|
'DELETE atm
|
||||||
|
FROM ?_profiler_arena_team_member atm
|
||||||
|
JOIN ?_profiler_arena_team at ON atm.`arenaTeamId` = at.`id` AND at.`type` = ?d
|
||||||
|
WHERE atm.`profileId` IN (?a)',
|
||||||
|
$data[$realmId.':'.$teamId]['type'] ?? 0,
|
||||||
|
$clearMembers
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Util::createSqlBatchInsert($memberData) as $ins)
|
foreach (Util::createSqlBatchInsert($memberData) as $ins)
|
||||||
DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_arena_team_member (?#) VALUES '.$ins, array_keys(reset($memberData)));
|
DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_arena_team_member (?#) VALUES '.$ins, array_keys(reset($memberData)));
|
||||||
|
|||||||
Reference in New Issue
Block a user