Esempio n. 1
0
        public void OnQuestComplete(FishQuestObjective obj)
        {
            foreach (KeyValuePair <Type, int[]> kvp in obj.Line)
            {
                Type type = kvp.Key;

                int index = FishQuestHelper.GetIndexForType(type);

                if (m_HaveFished.ContainsKey(index))
                {
                    if (m_HaveFished[index] >= 20)
                    {
                        m_HaveFished[index] = 10;
                    }
                    else
                    {
                        m_HaveFished[index] += 5;
                    }
                }
                else
                {
                    m_HaveFished.Add(index, 15);
                }

                if (!m_TimesFished.ContainsKey(index))
                {
                    m_TimesFished[index] = 0;
                }

                m_TimesFished[index]++;
            }
        }
Esempio n. 2
0
        public double GetPointsAwarded(FishQuestObjective obj)
        {
            double toAward = 0.0;

            foreach (KeyValuePair <Type, int[]> kvp in obj.Line)
            {
                Type type  = kvp.Key;
                int  value = kvp.Value[1];

                if (FishQuestHelper.IsShallowWaterFish(type))
                {
                    toAward += value;
                }
                else if (FishQuestHelper.IsCrustacean(type) || FishQuestHelper.IsDeepWaterFish(type))
                {
                    toAward += value * 2;
                }
                else if (FishQuestHelper.IsDungeonFish(type))
                {
                    toAward += value * 3;
                }

                m_Reputation += toAward;
            }

            return(toAward);
        }
Esempio n. 3
0
        public override void OnResign(bool resignChain)
        {
            if (Owner != null)
            {
                PlayerFishingEntry entry = PlayerFishingEntry.GetEntry(Owner);

                if (entry != null)
                {
                    FishQuestObjective obj = GetObjective();

                    if (obj != null)
                    {
                        foreach (KeyValuePair <Type, int[]> kvp in obj.Line)
                        {
                            entry.OnQuestResign(kvp.Key);
                        }
                    }
                }
            }

            if (m_Crate != null)
            {
                m_Crate.Quest = null;
                m_Crate.Delete();
            }

            base.OnResign(resignChain);
        }
Esempio n. 4
0
        public double GetPointsAwarded(FishQuestObjective obj)
        {
            double toAward = 0.0;

            foreach (KeyValuePair<Type, int[]> kvp in obj.Line)
            {
                Type type = kvp.Key;
                int value = kvp.Value[1];

                if (FishQuestHelper.IsShallowWaterFish(type))
                    toAward += value;
                else if (FishQuestHelper.IsCrustacean(type) || FishQuestHelper.IsDeepWaterFish(type))
                    toAward += value * 2;
                else if (FishQuestHelper.IsDungeonFish(type))
                    toAward += value * 3;

                m_Reputation += toAward;
            }
 
            return toAward;
        }
Esempio n. 5
0
        public void DeleteQuestItems()
        {
            if (m_Crate == null)
            {
                return;
            }

            Container hold = null;

            if (m_Crate.RootParent is Container)
            {
                hold = (Container)m_Crate.RootParent;
            }

            //Deletes quest reqeust
            FishQuestObjective obj = GetObjective();

            if (obj != null)
            {
                foreach (KeyValuePair <Type, int[]> kvp in obj.Line)
                {
                    m_Crate.ConsumeTotal(kvp.Key, kvp.Value[1]);
                }
            }

            //then moves any extras to the hold
            if (hold != null)
            {
                foreach (Item item in new List <Item>(m_Crate.Items))
                {
                    hold.DropItem(item);
                }
            }

            if (m_Crate != null)
            {
                m_Crate.Delete();
            }
        }
Esempio n. 6
0
        public override void GiveRewards()
        {
            if (Owner != null)
            {
                PlayerFishingEntry entry = PlayerFishingEntry.GetEntry(Owner);

                if (entry != null)
                {
                    double             pointsAwarded = 0;
                    FishQuestObjective obj           = GetObjective();

                    if (obj != null)
                    {
                        pointsAwarded += entry.GetPointsAwarded(obj);
                        entry.OnQuestComplete(obj);
                    }

                    FishQuestHelper.GiveRewards(Owner, entry, pointsAwarded);
                }
            }

            DeleteQuestItems();
            base.GiveRewards();
        }
Esempio n. 7
0
        public void OnQuestComplete(FishQuestObjective obj)
        {
            foreach (KeyValuePair<Type, int[]> kvp in obj.Line)
            {
                Type type = kvp.Key;

                int index = FishQuestHelper.GetIndexForType(type);

                if (m_HaveFished.ContainsKey(index))
                {
                    if (m_HaveFished[index] >= 20)
                        m_HaveFished[index] = 10;
                    else
                        m_HaveFished[index] += 5;
                }
                else
                    m_HaveFished.Add(index, 15);

                if (!m_TimesFished.ContainsKey(index))
                    m_TimesFished[index] = 0;

                m_TimesFished[index]++;
            }
        }