658 clanCounter = clanCounter + 1 |
658 clanCounter = clanCounter + 1 |
659 else |
659 else |
660 clanID = teamData.clanID |
660 clanID = teamData.clanID |
661 end |
661 end |
662 |
662 |
663 local idx |
663 local realName |
664 if teamData.isMissionTeam then |
664 if teamData.isMissionTeam then |
665 idx = AddMissionTeam(-(clanID+1)) |
665 realName = AddMissionTeam(-(clanID+1)) |
666 _G.sm.playerClan = clanID |
666 _G.sm.playerClan = clanID |
667 else |
667 else |
668 grave = def(teamData.grave, defaultGraves[math.min(teamID, 8)]) |
668 grave = def(teamData.grave, defaultGraves[math.min(teamID, 8)]) |
669 fort = def(teamData.fort, "Castle") |
669 fort = def(teamData.fort, "Castle") |
670 voice = def(teamData.voice, "Default") |
670 voice = def(teamData.voice, "Default") |
671 flag = def(teamData.flag, defaultFlags[math.min(teamID, 8)]) |
671 flag = def(teamData.flag, defaultFlags[math.min(teamID, 8)]) |
672 |
672 |
673 idx = AddTeam(name, -(clanID+1), grave, fort, voice, flag) |
673 realName = AddTeam(name, -(clanID+1), grave, fort, voice, flag) |
674 local realName = GetTeamName(idx) |
674 end |
675 -- Update all teamDefeat goals if the real team name differs from the |
675 |
676 -- team configuration. |
676 -- Update all teamDefeat goals if the real team name differs from the |
677 -- (AddTeam might change the name due to naming collisions) |
677 -- team configuration. |
678 if name ~= realName then |
678 -- (AddTeam might change the name due to naming collisions) |
679 local checks = { params.customGoals, params.customNonGoals } |
679 if name ~= realName then |
680 for c=1, 2 do |
680 local checks = { params.customGoals, params.customNonGoals } |
681 if checks[c] then |
681 for c=1, 2 do |
682 for k,goal in pairs(checks[c]) do |
682 if checks[c] then |
683 if goal.type == "teamDefeat" and goal.teamName == name then |
683 for k,goal in pairs(checks[c]) do |
684 goal.teamName = realName |
684 if goal.type == "teamDefeat" and goal.teamName == name then |
685 end |
685 goal.teamName = realName |
686 end |
686 end |
687 end |
687 end |
688 end |
688 end |
689 end |
689 end |
690 end |
690 end |