예제 #1
0
        public static List <KeyValuePair <string, int> > GetPossibleRequests(GuardianData tg, Player player)
        {
            List <KeyValuePair <string, int> > PossibleRequests = new List <KeyValuePair <string, int> >();

            foreach (string modid in RequestContainers.Keys)
            {
                RequestContainer container = RequestContainers[modid];
                foreach (int id in container.Requests.Keys)
                {
                    if (container.Requests[id].CanGetRequest(player, tg))
                    {
                        PossibleRequests.Add(new KeyValuePair <string, int>(modid, id));
                    }
                }
            }
            return(PossibleRequests);
        }
예제 #2
0
 public void SpawnRequest(string ModID, int ID, Player player)
 {
     RequestModID = ModID;
     RequestID    = ID;
     Base         = RequestContainer.GetRequest(ID, ModID);
     if (Base == null)
     {
         SetRequestOnCooldown(true);
         return;
     }
     ObjectiveCount    = 0;
     MaxObjectiveCount = Base.GetRequestObjectiveCount(RequestGiver.FriendshipLevel);
     Failed            = false;
     state             = RequestState.WaitingAccept;
     RequestTimeLeft   = Main.rand.Next(72 * 3600, 120 * 3600);
     GenerateRewards(player);
 }
예제 #3
0
 public void Load(Terraria.ModLoader.IO.TagCompound writer, string UniqueID, int ModVersion)
 {
     RequestID         = writer.GetInt(UniqueID + "_ID");
     RequestModID      = writer.GetString(UniqueID + "_ModID");
     state             = (RequestState)writer.GetByte(UniqueID + "_State");
     ObjectiveCount    = writer.GetInt(UniqueID + "_ObjectiveCount");
     MaxObjectiveCount = writer.GetInt(UniqueID + "_MaxObjectiveCount");
     RequestTimeLeft   = writer.GetInt(UniqueID + "_TimeLeft");
     for (byte i = 0; i < 3; i++)
     {
         string            RewardID = UniqueID + "_rwi" + i;
         ThisRequestReward reward   = Rewards[i];
         reward.item  = writer.Get <Item>(RewardID + "_item");
         reward.value = writer.GetInt(RewardID + "_value");
     }
     if (state != RequestState.Cooldown)
     {
         Base = RequestContainer.GetRequest(RequestID, RequestModID);
     }
 }