Пример #1
0
        private void SetJobTo(CharacterConstants.Job value)
        {
            job = value;

            if (!Parent.IsInitialized)
            {
                return;
            }

            CharacterStats.Update(Parent, CharacterConstants.StatisticType.Job);

            CharacterBuffs.ShowLocalUserEffect(Parent, CharacterConstants.UserEffect.JobChanged);
            //CharacterBuffs.ShowRemoteUserEffect(Parent, CharacterConstants.UserEffect.JobChanged); // TODO: crashes client
        }
Пример #2
0
        public void Complete(Quest quest, int selection)
        {
            foreach (KeyValuePair <int, short> item in quest.PostRequiredItems)
            {
                this.Parent.Items.Remove(item.Key, item.Value);
            }

            this.Parent.Experience += quest.ExperienceReward[1];

            using (Packet oPacket = new Packet(ServerOperationCode.Message))
            {
                oPacket
                .WriteByte((byte)MessageType.IncreaseEXP)
                .WriteBool(true)
                .WriteInt(quest.ExperienceReward[1])
                .WriteBool(true)
                .WriteInt()     // NOTE: Monster Book bonus.
                .WriteShort()   // NOTE: Unknown.
                .WriteInt()     // NOTE: Wedding bonus.
                .WriteByte()    // NOTE: Party bonus.
                .WriteInt()     // NOTE: Party bonus.
                .WriteInt()     // NOTE: Equip bonus.
                .WriteInt()     // NOTE: Internet Cafe bonus.
                .WriteInt()     // NOTE: Rainbow Week bonus.
                .WriteByte();   // NOTE: Unknown.

                this.Parent.Client.Send(oPacket);
            }

            this.Parent.Fame += (short)quest.FameReward[1];

            // TODO: Fame gain packet in chat.

            this.Parent.Meso += quest.MesoReward[1] * WvsGame.MesoRate;

            // TODO: Meso gain packet in chat.

            foreach (KeyValuePair <Skill, Job> skill in quest.PostSkillRewards)
            {
                if (this.Parent.Job == skill.Value)
                {
                    this.Parent.Skills.Add(skill.Key);

                    // TODO: Skill update packet.
                }
            }

            // TODO: Pet rewards.

            if (selection != -1) // NOTE: Selective reward.
            {
                //if (selection == -1) // NOTE: Randomized reward.
                //{
                //    KeyValuePair<int, short> item = quest.PostItemRewards.ElementAt(Constants.Random.Next(0, quest.PostItemRewards.Count));

                //    this.Parent.Items.Add(new Item(item.Key, item.Value));

                //    using (Packet oPacket = new Packet(ServerOperationCode.Effect))
                //    {
                //        oPacket
                //            .WriteByte((byte)UserEffect.Quest)
                //            .WriteByte(1)
                //            .WriteInt(item.Key)
                //            .WriteInt(item.Value);

                //        this.Parent.Client.Send(oPacket);
                //    }
                //}
                //else
                //{
                //    // TODO: Selective reward based on selection.
                //}
            }
            else
            {
                foreach (KeyValuePair <int, short> item in quest.PostItemRewards)
                {
                    if (item.Value > 0)
                    {
                        this.Parent.Items.Add(new Item(item.Key, item.Value));
                    }
                    else if (item.Value < 0)
                    {
                        this.Parent.Items.Remove(item.Key, Math.Abs(item.Value));
                    }

                    using (Packet oPacket = new Packet(ServerOperationCode.Effect))
                    {
                        oPacket
                        .WriteByte((byte)UserEffect.Quest)
                        .WriteByte(1)
                        .WriteInt(item.Key)
                        .WriteInt(item.Value);

                        this.Parent.Client.Send(oPacket);
                    }
                }
            }

            this.Update(quest.MapleID, QuestStatus.Complete);

            this.Delete(quest.MapleID);

            this.Completed.Add(quest.MapleID, DateTime.UtcNow);

            CharacterBuffs.ShowLocalUserEffect(this.Parent, UserEffect.QuestComplete);
            CharacterBuffs.ShowRemoteEffect(this.Parent, UserEffect.QuestComplete, true);
        }