コード例 #1
0
        public static bool AddCredits(long playerId, long creditsToAdd, bool addToFaction = true)
        {
            // Session should be active to continue.
            if (MySession.Static == null)
            {
                return(false);
            }

            // Get player.
            var player = PlayerUtils.GetPlayer(playerId);

            if (player == null)
            {
                return(false);
            }

            // Try to add to the faction first the player has one.
            if (addToFaction)
            {
                var faction = FactionUtils.GetFaction(playerId);
                if (faction != null)
                {
                    faction.RequestChangeBalance(creditsToAdd);
                    return(true);
                }
            }

            player.RequestChangeBalance(creditsToAdd);
            return(true);
        }
コード例 #2
0
        public static long GetFactionBalance(string factionTag)
        {
            long balance = 0;
            var  faction = FactionUtils.GetFaction(factionTag);

            if (faction != null)
            {
                faction.TryGetBalanceInfo(out balance);
            }
            return(balance);
        }
コード例 #3
0
 public static long GetFactionBalance(long factionId)
 {
     return(GetFactionBalance(FactionUtils.GetFaction(factionId)));
 }