コード例 #1
0
        public void RPC_SlayBountyTarget(long sender, ZPackage pkg, string monsterID, bool isAdd)
        {
            var isServer = Common.Utils.IsServer();

            if (isServer)
            {
                EpicLoot.LogWarning($"SERVER: RPC_SlayBountyTarget: {monsterID} ({(isAdd ? "minion" : "target")})");
                ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SlayBountyTargetFromServer", pkg, monsterID, isAdd);
            }
            else
            {
                EpicLoot.LogWarning($"CLIENT: RPC_SlayBountyTarget: {monsterID} ({(isAdd ? "minion" : "target")})");
            }

            var bounty = BountyInfo.FromPackage(pkg);

            if (isServer)
            {
                AddSlainBountyTargetToLedger(bounty, monsterID, isAdd);
            }

            if (Player.m_localPlayer == null || bounty.PlayerID != Player.m_localPlayer.GetPlayerID())
            {
                // Not my bounty
                return;
            }

            OnBountyTargetSlain(bounty.ID, monsterID, isAdd);
        }
コード例 #2
0
        private void AddSlainBountyTargetToLedger(BountyInfo bounty, string monsterID, bool isAdd)
        {
            if (!Common.Utils.IsServer())
            {
                return;
            }

            if (BountyLedger == null)
            {
                EpicLoot.LogError("[BountyLedger] Server tried to add kill log to bounty ledger but BountyLedger was null");
                return;
            }

            if (Player.m_localPlayer != null && Player.m_localPlayer.GetPlayerID() == bounty.PlayerID)
            {
                EpicLoot.Log($"[BountyLedger] This player ({bounty.PlayerID}) is the local player");
                return;
            }

            var characterZdos  = ZNet.instance.GetAllCharacterZDOS();
            var playerIsOnline = characterZdos.Select(zdo => zdo.GetLong("playerID")).Any(playerID => playerID == bounty.PlayerID);

            if (playerIsOnline)
            {
                EpicLoot.Log($"[BountyLedger] This player ({bounty.PlayerID}) is connected to server, don't log the kill, they'll get the RPC");
                return;
            }

            BountyLedger.AddKillLog(bounty.PlayerID, bounty.ID, monsterID, isAdd);
            SaveBountyLedger();
        }
コード例 #3
0
        public void ClaimBountyReward(BountyInfo bountyInfo)
        {
            var player = Player.m_localPlayer;

            if (player == null)
            {
                return;
            }

            var saveData = player.GetAdventureSaveData();

            if (!saveData.HasAcceptedBounty(bountyInfo.Interval, bountyInfo.ID) || bountyInfo.State != BountyState.Complete)
            {
                return;
            }

            bountyInfo.State = BountyState.Claimed;
            player.SaveAdventureSaveData();

            MessageHud.instance.ShowBiomeFoundMsg("$mod_epicloot_bounties_claimedmsg", true);

            var inventory = player.GetInventory();

            if (bountyInfo.RewardIron > 0)
            {
                inventory.AddItem("IronBountyToken", bountyInfo.RewardIron, 1, 0, 0, string.Empty);
            }
            if (bountyInfo.RewardGold > 0)
            {
                inventory.AddItem("GoldBountyToken", bountyInfo.RewardGold, 1, 0, 0, string.Empty);
            }
        }
コード例 #4
0
        public static BountyQuestType GetQuestType(BountyInfo bountyInfo)
        {
            var questType  = BountyQuestType.Unknown;
            var objectives = bountyInfo.Info.QuestRecord.Steps.First().QuestStepObjectiveSet.QuestStepObjectives;

            if (objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.EnterLevelArea) &&
                objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.KillAllMonstersInWorld))
            {
                questType = BountyQuestType.ClearZone;
            }
            else if (objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.KillMonster) && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("Kill "))
            {
                questType = BountyQuestType.KillMonster;
            }
            else if (objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.KillGroup) &&
                     objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.InteractWithActor) &&
                     objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.EventReceived)
                     )
            {
                questType = BountyQuestType.GuardedGizmo;
            }
            else if (bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("The Cursed") && bountyInfo.Quest != SNOQuest.X1_Bounty_A5_PandExt_Event_CursedCrystals)
            {
                questType = BountyQuestType.ClearCurse;
            }
            else if (bountyInfo.Quest.ToString().Contains("_Event_") && objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.CompleteQuest))
            {
                questType = BountyQuestType.SpecialEvent;
            }
            return(questType);
        }
コード例 #5
0
 public static BountyQuestType GetQuestType(BountyInfo bountyInfo)
 {
     var questType = BountyQuestType.Unknown;
     var objectives = bountyInfo.Info.QuestRecord.Steps.First().QuestStepObjectiveSet.QuestStepObjectives;
     if (objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.EnterLevelArea) &&
         objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.KillAllMonstersInWorld))
     {
         questType = BountyQuestType.ClearZone;
     }
     else if (objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.KillMonster) && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("Kill "))
     {
         questType = BountyQuestType.KillMonster;
     }
     else if (objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.KillGroup) &&
              objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.InteractWithActor) &&
              objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.EventReceived)
         )
     {
         questType = BountyQuestType.GuardedGizmo;
     }
     else if (bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("The Cursed") && bountyInfo.Quest != SNOQuest.X1_Bounty_A5_PandExt_Event_CursedCrystals)
     {
         questType = BountyQuestType.ClearCurse;
     }
     else if (bountyInfo.Quest.ToString().Contains("_Event_") && objectives.Any(qo => qo.ObjectiveType == QuestStepObjectiveType.CompleteQuest))
     {
         questType = BountyQuestType.SpecialEvent;
     }
     return questType;
 }
コード例 #6
0
        public void AbandonBounty(BountyInfo bountyInfo)
        {
            var saveData = Player.m_localPlayer?.GetAdventureSaveData();

            if (saveData != null && bountyInfo != null && saveData.BountyIsInProgress(bountyInfo.Interval, bountyInfo.ID))
            {
                saveData.AbandonedBounty(bountyInfo.ID);
                Player.m_localPlayer.SaveAdventureSaveData();
            }
        }
コード例 #7
0
 public BountyInfoCache(BountyInfo b)
 {
     try
     {
         Act      = b.Act;
         State    = b.State;
         QuestSNO = b.Info.QuestSNO;
     }
     catch (Exception ex)
     {
         Logger.DBLog.DebugFormat("Failure to create BountyInfoCache \r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
     }
 }
コード例 #8
0
ファイル: Bounties.cs プロジェクト: sbtoonz/ValheimMods
        public void RPC_SlayBountyTargetFromBountyId(long sender, string monsterID, bool isAdd, string bountyID)
        {
            EpicLoot.LogWarning($"CLIENT: RPC_SlayBountyTargetFromBountyId: {monsterID} ({(isAdd ? "minion" : "target")})");

            var bounty = BountyInfo.FromBountyID(bountyID);

            if (Player.m_localPlayer == null || bounty.PlayerID != Player.m_localPlayer.GetPlayerID())
            {
                // Not my bounty
                return;
            }

            OnBountyTargetSlain(bounty.ID, monsterID, isAdd);
        }
コード例 #9
0
ファイル: Bounty.cs プロジェクト: Zafford/EliteHook
        internal static void EliteAPI_BountyEvent(object sender, BountyInfo e)
        {
            EmbedBuilder embed = new EmbedBuilder();

            embed.WithAuthor("Recieved a bounty");
            embed.WithTitle("Bounty information");
            embed.WithDescription($"Total: {string.Format("{0:n0}", e.TotalReward)} CR");
            foreach (var item in e.Rewards)
            {
                embed.AddField(item.Faction, $"{string.Format("{0:n0}", item.RewardReward)} CR", true);
            }

            Main.Send(embed);
        }
コード例 #10
0
ファイル: TakeWaypointTag.cs プロジェクト: xinhuaer/Trinity
 private static void DumpBountyInfo(BountyInfo bountyInfo)
 {
     Core.Logger.Raw("// {0} - {1} ({2})", bountyInfo.Act, bountyInfo.Info.DisplayName, (int)bountyInfo.Quest);
     Core.Logger.Raw("Bounties.Add(new BountyData");
     Core.Logger.Raw("{");
     Core.Logger.Raw("    QuestId = {0},", (int)bountyInfo.Quest);
     Core.Logger.Raw("    Act = Act.{0},", bountyInfo.Act);
     Core.Logger.Raw("    WorldId = 0, // Enter the final worldId here");
     Core.Logger.Raw("    QuestType = BountyQuestType.SpecialEvent,");
     Core.Logger.Raw("    WaypointLevelAreaId = {0},", (int)bountyInfo.StartingLevelArea);
     Core.Logger.Raw("    Coroutines = new List<ISubroutine>");
     Core.Logger.Raw("    {");
     Core.Logger.Raw("        // Coroutines goes here");
     Core.Logger.Raw("    }");
     Core.Logger.Raw("});");
     Core.Logger.Raw(" ");
 }
コード例 #11
0
        public static Act GetBountyAct(this BountyInfo bountyInfo)
        {
            string name      = bountyInfo.Quest.ToString();
            var    nameMatch = bountyTypeExtract.Match(name);
            string type      = "";

            if (nameMatch.Groups.Count == 7)
            {
                type = nameMatch.Groups[ACT_INDEX].Value;
            }

            Act result;

            if (Enum.TryParse(type, out result))
            {
                return(result);
            }

            return(Act.Invalid);
        }
コード例 #12
0
        private static void SpawnBountyTargets(BountyInfo bounty, Vector3 spawnPoint, Vector3 offset)
        {
            var prefabNames = new List <string>()
            {
                bounty.Target.MonsterID
            };

            foreach (var addConfig in bounty.Adds)
            {
                for (var i = 0; i < addConfig.Count; i++)
                {
                    prefabNames.Add(addConfig.MonsterID);
                }
            }

            for (var index = 0; index < prefabNames.Count; index++)
            {
                var prefabName = prefabNames[index];
                var isAdd      = index > 0;

                var prefab       = ZNetScene.instance.GetPrefab(prefabName);
                var creature     = Object.Instantiate(prefab, spawnPoint, Quaternion.identity);
                var bountyTarget = creature.AddComponent <BountyTarget>();
                bountyTarget.Initialize(bounty, prefabName, isAdd);

                var randomSpacing = UnityEngine.Random.insideUnitSphere * 4;
                spawnPoint += randomSpacing;
                ZoneSystem.instance.FindFloor(spawnPoint, out var floorHeight);
                spawnPoint.y = floorHeight;
            }

            Minimap.instance.ShowPointOnMap(spawnPoint + offset);

            var pkg = new ZPackage();

            bounty.ToPackage(pkg);
            ZRoutedRpc.instance.InvokeRoutedRPC("SpawnBounties", pkg);
        }
コード例 #13
0
ファイル: Bounties.cs プロジェクト: sbtoonz/ValheimMods
        public void RPC_SlayBountyTarget(long sender, ZPackage pkg, string monsterID, bool isAdd)
        {
            var isServer = Common.Utils.IsServer();

            if (isServer)
            {
                ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SlayBountyTargetFromServer", pkg, monsterID, isAdd);
            }

            var bounty = BountyInfo.FromPackage(pkg);

            if (isServer)
            {
                AddSlainBountyTargetToLedger(bounty, monsterID, isAdd);
            }

            if (Player.m_localPlayer == null || bounty.PlayerID != Player.m_localPlayer.GetPlayerID())
            {
                // Not my bounty
                return;
            }

            OnBountyTargetSlain(bounty.ID, monsterID, isAdd);
        }
コード例 #14
0
        public IEnumerator AcceptBounty(Player player, BountyInfo bounty, Action <bool, Vector3> callback)
        {
            player.Message(MessageHud.MessageType.Center, "$mod_epicloot_bounties_locatingmsg");
            var saveData = player.GetAdventureSaveData();

            yield return(GetRandomPointInBiome(bounty.Biome, saveData, (success, spawnPoint, _) =>
            {
                if (success)
                {
                    var offset2 = UnityEngine.Random.insideUnitCircle * AdventureDataManager.Config.TreasureMap.MinimapAreaRadius;
                    var offset = new Vector3(offset2.x, 0, offset2.y);
                    saveData.AcceptedBounty(bounty, spawnPoint, offset);
                    saveData.NumberOfTreasureMapsOrBountiesStarted++;
                    player.SaveAdventureSaveData();

                    // Spawn Monster
                    SpawnBountyTargets(bounty, spawnPoint, offset);
                }
                else
                {
                    callback?.Invoke(false, Vector3.zero);
                }
            }));
        }
コード例 #15
0
        ///<summary>
        ///Sets Active Bounty
        ///</summary>
        public void UpdateActiveBounty()
        {
            var activeBounty = new BountyInfoCache();

            BountyInfo ZetaActiveBounty = null;

            using (ZetaDia.Memory.AcquireFrame())
            {
                ZetaActiveBounty = ZetaDia.ActInfo.ActiveBounty;
            }

            if (ZetaActiveBounty != null)
            {
                activeBounty = new BountyInfoCache(ZetaDia.ActInfo.ActiveBounty);


                if ((ActiveBounty == null || ActiveBounty.QuestSNO != activeBounty.QuestSNO) && activeBounty.QuestSNO != 0)
                {
                    ActiveBounty = activeBounty;
                    Logger.Write(LogLevel.Bounty, "Active Bounty Changed To {0}", ActiveBounty.QuestSNO);
                    //nullify Cache Entry then set it if Cache contains it.
                    CurrentBountyCacheEntry = null;
                }
                else if (activeBounty.QuestSNO == 0)
                {                //nullify when active bounty is nothing
                    ActiveBounty = null;
                }

                return;
            }

            RefreshActiveQuests();

            if (ActiveQuests.ContainsKey(ADVENTUREMODE_RIFTID) && ActiveQuests[ADVENTUREMODE_RIFTID].State != QuestState.NotStarted)
            {
                if (ActiveBounty != null && ActiveBounty.QuestSNO == ADVENTUREMODE_RIFTID)
                {
                    ((QuestInfoCache)ActiveBounty).Refresh();
                }
                else
                {
                    ActiveBounty = ActiveQuests[ADVENTUREMODE_RIFTID];
                    Logger.Write(LogLevel.Bounty, "Active Bounty Changed To Rifting");
                }
            }
            else if (ActiveQuests.ContainsKey(ADVENTUREMODE_GREATERRIFT_TRIAL) && ActiveQuests[ADVENTUREMODE_GREATERRIFT_TRIAL].State != QuestState.NotStarted)
            {
                if (ActiveBounty != null && ActiveBounty.QuestSNO == ADVENTUREMODE_GREATERRIFT_TRIAL)
                {
                    ((QuestInfoCache)ActiveBounty).Refresh();
                }
                else
                {
                    ActiveBounty = ActiveQuests[ADVENTUREMODE_GREATERRIFT_TRIAL];
                    Logger.Write(LogLevel.Bounty, "Active Bounty Changed To Rift Trial");
                }
            }
            else
            {
                Logger.Write(LogLevel.Bounty, "Active Bounty Is Null!");
            }
        }
コード例 #16
0
        public static BountyCoroutine GetBounty(BountyInfo bountyInfo)
        {
            if (bountyInfo == null)
            {
                return null;
            }

            var bountyData = BountyDataFactory.GetBountyData((int)bountyInfo.Quest);
            if (bountyData == null)
            {
                Logger.Info("Unsupported bounty: {0} - {1}", (int)bountyInfo.Quest, bountyInfo.Info.DisplayName);
                return null;
            }
            //if (bountyData.QuestType != BountyQuestType.SpecialEvent)
            //{
            //    Logger.Debug("Skipping bounty: {0} - {1}", (int)bountyInfo.Quest, bountyInfo.Info.DisplayName);
            //    return null;
            //}

            //if (QuestDataFactory.QuestDatas.ContainsKey((int)bountyInfo.Quest)) return null;

            BountyCoroutine bounty = null;
            //var bountyType = BountyHelpers.GetQuestType(bountyInfo);
            //if (bountyType != BountyQuestType.SpecialEvent)
            //{
            //    return null;
            //}

            //if (Bounties.TryGetValue((int)bountyInfo.Quest, out bounty))
            //{
            //    Logger.Debug("[BountyFactory] Returning hardcoded bounty:" + bounty.QuestData.Name);
            //}

            // Try to get the kill bounty


            //// Try to get the kill bounty
            //if (bounty == null && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("Kill ") && TryGetKillBounty((int)bountyInfo.Quest, out bounty))
            //{
            //    Logger.Debug("[BountyFactory] Returning generated bounty:" + bounty.QuestData.Name);
            //}

            // Try to get the clear bounty
            //if (bounty == null && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("Clear ") && TryGetClearBounty((int)bountyInfo.Quest, out bounty))
            //{
            //    Logger.Debug("[BountyFactory] Returning generated bounty:" + bounty.QuestData.Name);
            //}

            //// Try to get the curse bounty
            //if (bounty == null && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("The Cursed") && bountyInfo.Quest != SNOQuest.X1_Bounty_A5_PandExt_Event_CursedCrystals && TryGetCursedBounty((int)bountyInfo.Quest, out bounty))
            //{
            //    Logger.Debug("[BountyFactory] Returning generated bounty:" + bounty.QuestData.Name);
            //}

            if (bounty == null)
            {
                bounty = new GenericBountyCoroutine((int)bountyInfo.Quest);
                //if (bounty.QuestData.Steps.First().Objectives.Any(o => o.ObjectiveType == QuestStepObjectiveType.EnterLevelArea)) 
                //    return null;
                //if (bounty.QuestData.QuestType != BountyQuestType.KillMonster && bounty.QuestData.QuestType != BountyQuestType.ClearZone)
                //    return null;
                Logger.Debug("[BountyFactory] Returning generic bounty:" + bounty.QuestData.Name);
            }

            if (bounty != null)
            {
                bounty.Reset();
                //if (bounty.QuestData.IsDataComplete)
                //{
                //    return null;
                //}
            }
            return bounty;
        }
コード例 #17
0
ファイル: DeveloperUI.cs プロジェクト: dachidahu/AutoFollow
        static void DumpBountyInfo(BountyInfo bountyInfo, int waypointNumber)
        {
            Logger.Raw("// {0} - {1} ({2})", bountyInfo.Act, bountyInfo.Info.DisplayName, (int)bountyInfo.Quest);
            Logger.Raw("Bounties.Add(new BountyData");
            Logger.Raw("{");
            Logger.Raw("    QuestId = {0},", (int)bountyInfo.Quest);
            Logger.Raw("    Act = Act.{0},", bountyInfo.Act);
            Logger.Raw("    WorldId = 0, // Enter the final worldId here");
            Logger.Raw("    QuestType = BountyQuestType.SpecialEvent,");
            Logger.Raw("    StartingLevelAreaId = {0},", AdvDia.CurrentLevelAreaId);
            //Logger.Raw("    WaypointNumber = {0},", waypointNumber);
            Logger.Raw("    Coroutines = new List<ISubroutine>");
            Logger.Raw("    {");
            Logger.Raw("        // Coroutines goes here");
            Logger.Raw("    }");
            Logger.Raw("});");
            Logger.Raw(" ");

        }
コード例 #18
0
ファイル: Bounty.cs プロジェクト: herbfunk/Funky
            public BountyInfoCache(BountyInfo b)
            {
                try
                {
                    Act = b.Act;
                    State = b.State;
                    QuestSNO = b.Info.QuestSNO;

                }
                catch (Exception ex)
                {
                    Logger.DBLog.DebugFormat("Failure to create BountyInfoCache \r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
                }
            }
コード例 #19
0
        public static BountyCoroutine GetBounty(BountyInfo bountyInfo)
        {
            if (bountyInfo == null)
            {
                return(null);
            }

            var bountyData = BountyDataFactory.GetBountyData((int)bountyInfo.Quest);

            if (bountyData == null)
            {
                Core.Logger.Log("Unsupported bounty: {0} - {1}", (int)bountyInfo.Quest, bountyInfo.Info.DisplayName);
                return(null);
            }
            //if (bountyData.QuestType != BountyQuestType.SpecialEvent)
            //{
            //    Core.Logger.Debug("Skipping bounty: {0} - {1}", (int)bountyInfo.Quest, bountyInfo.Info.DisplayName);
            //    return null;
            //}

            //if (QuestDataFactory.QuestDatas.ContainsKey((int)bountyInfo.Quest)) return null;

            BountyCoroutine bounty = null;

            //var bountyType = BountyHelpers.GetQuestType(bountyInfo);
            //if (bountyType != BountyQuestType.SpecialEvent)
            //{
            //    return null;
            //}

            //if (Bounties.TryGetValue((int)bountyInfo.Quest, out bounty))
            //{
            //    Core.Logger.Debug("[BountyFactory] Returning hardcoded bounty:" + bounty.QuestData.Name);
            //}

            // Try to get the kill bounty

            //// Try to get the kill bounty
            //if (bounty == null && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("Kill ") && TryGetKillBounty((int)bountyInfo.Quest, out bounty))
            //{
            //    Core.Logger.Debug("[BountyFactory] Returning generated bounty:" + bounty.QuestData.Name);
            //}

            // Try to get the clear bounty
            //if (bounty == null && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("Clear ") && TryGetClearBounty((int)bountyInfo.Quest, out bounty))
            //{
            //    Core.Logger.Debug("[BountyFactory] Returning generated bounty:" + bounty.QuestData.Name);
            //}

            //// Try to get the curse bounty
            //if (bounty == null && bountyInfo.Info.DisplayName.Replace("Bounty: ", string.Empty).StartsWith("The Cursed") && bountyInfo.Quest != SNOQuest.X1_Bounty_A5_PandExt_Event_CursedCrystals && TryGetCursedBounty((int)bountyInfo.Quest, out bounty))
            //{
            //    Core.Logger.Debug("[BountyFactory] Returning generated bounty:" + bounty.QuestData.Name);
            //}

            if (bounty == null)
            {
                bounty = new GenericBountyCoroutine((int)bountyInfo.Quest);
                //if (bounty.QuestData.Steps.First().Objectives.Any(o => o.ObjectiveType == QuestStepObjectiveType.EnterLevelArea))
                //    return null;
                //if (bounty.QuestData.QuestType != BountyQuestType.KillMonster && bounty.QuestData.QuestType != BountyQuestType.ClearZone)
                //    return null;
                Core.Logger.Debug("[BountyFactory] Returning generic bounty:" + bounty.QuestData.Name);
            }

            if (bounty != null)
            {
                bounty.Reset();
                //if (bounty.QuestData.IsDataComplete)
                //{
                //    return null;
                //}
            }
            return(bounty);
        }