diff --git a/conf/1v1arena.conf.dist b/conf/1v1arena.conf.dist index 4761d04..0b7aedb 100644 --- a/conf/1v1arena.conf.dist +++ b/conf/1v1arena.conf.dist @@ -52,6 +52,14 @@ Arena1v1.VendorRating = 0 Arena1v1.ArenaPointsMulti = 0.64 + +# +# Arena1v1.ArenaPointsMinLevel +# Description: minlevel to get the arena points +# Default: 70 + +Arena1v1.ArenaPointsMinLevel = 70 + # # Arena1v1.PreventHealingTalents # Description: If enabled, it prevents people from having healing talents. diff --git a/src/npc_arena1v1.cpp b/src/npc_arena1v1.cpp index 10b3ae9..a7cc606 100644 --- a/src/npc_arena1v1.cpp +++ b/src/npc_arena1v1.cpp @@ -62,7 +62,7 @@ void deleteTeamArenaForPlayer(Player* player) if (queryPlayerTeam) { CharacterDatabase.Execute("DELETE FROM `arena_team` WHERE `captainGuid`={} AND `type`=1", player->GetGUID().GetCounter()); - CharacterDatabase.Execute("DELETE FROM `arena_team_member` WHERE `guid`={}", player->GetGUID().GetCounter()); + CharacterDatabase.Execute("DELETE FROM `arena_team_member` WHERE `guid`={} AND `type`=1", player->GetGUID().GetCounter()); } } @@ -238,11 +238,19 @@ bool npc_1v1arena::OnGossipSelect(Player* player, Creature* creature, uint32 /*s case NPC_ARENA_1V1_ACTION_DISBAND_ARENA_TEAM: { + uint32 playerHonorPoints = player->GetHonorPoints(); + uint32 playerArenaPoints = player->GetArenaPoints(); + WorldPacket Data; Data << player->GetArenaTeamId(ARENA_SLOT_1V1); player->GetSession()->HandleArenaTeamLeaveOpcode(Data); handler.SendSysMessage("Arenateam deleted!"); CloseGossipMenuFor(player); + + // hackfix: restore points + player->SetHonorPoints(playerHonorPoints); + player->SetArenaPoints(playerArenaPoints); + return true; } @@ -352,12 +360,6 @@ bool npc_1v1arena::CreateArenateam(Player* player, Creature* /* me */) if (slot == 0) return false; - // This disaster is the result of changing the MAX_ARENA_SLOT from 3 to 4. - uint32 playerHonorPoints = player->GetHonorPoints(); - uint32 playerArenaPoints = player->GetArenaPoints(); - player->SetHonorPoints(0); - player->SetArenaPoints(0); - // Check if player is already in an arena team if (player->GetArenaTeamId(slot)) { @@ -365,6 +367,12 @@ bool npc_1v1arena::CreateArenateam(Player* player, Creature* /* me */) return false; } + // This disaster is the result of changing the MAX_ARENA_SLOT from 3 to 4. + uint32 playerHonorPoints = player->GetHonorPoints(); + uint32 playerArenaPoints = player->GetArenaPoints(); + player->SetHonorPoints(0); + player->SetArenaPoints(0); + // This disaster is the result of changing the MAX_ARENA_SLOT from 3 to 4. sArenaTeamMgr->RemoveArenaTeam(player->GetArenaTeamId(ARENA_SLOT_1V1)); deleteTeamArenaForPlayer(player); @@ -374,6 +382,11 @@ bool npc_1v1arena::CreateArenateam(Player* player, Creature* /* me */) if (!arenaTeam->Create(player->GetGUID(), ARENA_TEAM_1V1, player->GetName(), 4283124816, 45, 4294242303, 5, 4294705149)) { delete arenaTeam; + + // hackfix: restore points + player->SetHonorPoints(playerHonorPoints); + player->SetArenaPoints(playerArenaPoints); + return false; } @@ -383,6 +396,7 @@ bool npc_1v1arena::CreateArenateam(Player* player, Creature* /* me */) ChatHandler(player->GetSession()).SendSysMessage("1v1 Arenateam successfully created!"); // This disaster is the result of changing the MAX_ARENA_SLOT from 3 to 4. + // hackfix: restore points player->SetHonorPoints(playerHonorPoints); player->SetArenaPoints(playerArenaPoints); @@ -426,7 +440,13 @@ class team_1v1arena : public ArenaTeamScript { if (at->GetType() == ARENA_TEAM_1V1) { - points *= sConfigMgr->GetOption("Arena1v1.ArenaPointsMulti", 0.64f); + const auto Members = at->GetMembers(); + uint8 playerLevel = sCharacterCache->GetCharacterLevelByGuid(Members.front().Guid); + + if (playerLevel >= sConfigMgr->GetOption("Arena1v1.ArenaPointsMinLevel", 70)) + points *= sConfigMgr->GetOption("Arena1v1.ArenaPointsMulti", 0.64f); + else + points *= 0; } }