Пример #1
0
        public void PlayerChallenge(string playerName)
        {
            if (!Config.Instance.EnableConflict || Core.NexusDetected)
            {
                Context.Respond("Conflict is not enabled");
                return;
            }

            if (string.IsNullOrEmpty(playerName))
            {
                Context.Respond("Command requires the name of the player you wish to challenge");
            }

            var id = Context.Player.IdentityId;

            if (id == 0)
            {
                Context.Respond("This command can only be used ingame");
                return;
            }

            var subjectId = Utilities.IdentityUtility.GetPlayerId(playerName);

            if (subjectId == 0)
            {
                Context.Respond("Challenge failed. Player with name " + playerName + " not found or not online");
                return;
            }

            ConflictPairModule.IssueChallenge(id, subjectId, ConflictPairModule.ConflictType.Player, Context.Player.SteamUserId);
        }
Пример #2
0
 private static bool ChangeRequest(MyFactionStateChange action, long fromFactionId, long toFactionId, long playerId)
 {
     if (MySession.Static.Factions.IsNpcFaction(fromFactionId) ||
         MySession.Static.Factions.IsNpcFaction(toFactionId) ||
         MySession.Static.Players.IdentityIsNpc(playerId))
     {
         return(true);
     }
     if (action != MyFactionStateChange.DeclareWar)
     {
         return(true);
     }
     if (Config.Instance.EnableConflict && ConflictPairModule.InConflict(fromFactionId, toFactionId, out var foundPair) && foundPair.CurrentConflictState == ConflictPairModule.ConflictState.Active)
     {
         return(true);
     }
     ConflictPairModule.IssueChallenge(fromFactionId, toFactionId, ConflictPairModule.ConflictType.Faction, MyEventContext.Current.Sender.Value);
     Core.RequestFactionChange(MyFactionStateChange.AcceptPeace, fromFactionId, toFactionId, playerId);
     return(false);
 }
Пример #3
0
        public void FactionChallenge(string factionNameOrTag)
        {
            if (!Config.Instance.EnableConflict || Core.NexusDetected)
            {
                Context.Respond("Conflict is not enabled");
                return;
            }

            if (string.IsNullOrEmpty(factionNameOrTag))
            {
                Context.Respond("Command requires the faction name or tag you wish to challenge");
            }

            var playerId = Context.Player.IdentityId;

            if (playerId == 0)
            {
                Context.Respond("This command can only be used ingame");
                return;
            }

            var playerFaction = MySession.Static.Factions.GetPlayerFaction(Context.Player.IdentityId);
            var subjectId     = Utilities.IdentityUtility.GetFactionId(factionNameOrTag);

            if (subjectId == 0 || playerFaction == null || (!playerFaction.IsLeader(playerId) && !playerFaction.IsFounder(playerId)))
            {
                Context.Respond("Faction error. This command requires you to be the founder or leader of your faction and a valid faction name or tag to issue challenge");
                return;
            }

            if (MySession.Static.Factions.IsNpcFaction(subjectId))
            {
                Context.Respond("Command cannot be used with NPC faction");
                return;
            }

            ConflictPairModule.IssueChallenge(playerFaction.FactionId, subjectId, ConflictPairModule.ConflictType.Faction, Context.Player.SteamUserId);
        }