Exemplo n.º 1
0
        /// <summary>
        /// Sends the age up packets to the given client
        /// </summary>
        /// <param name="player"></param>
        /// <param name="ageMod"></param>
        public static void AgeInfo(MabiPC player)
        {
            StatsAgeUpInfo statInfo = MabiData.StatsAgeUpDb.Find(player.Race, player.Age);
            if (statInfo == null)
            {
                if (player.Age < 25) //Can't find bonuses that should be there. Let's give a warning.
                    Logger.Warning("Could not find age up stat bonuses for age {0}.", player.Age);

                Send.AgeIncrease((player.Client as WorldClient), player, player.Age); //different after 25?
                return;
            }

            if (statInfo.AP > 0)
                player.Client.Send(PacketCreator.AcquireAp(player, statInfo.AP));
            if (statInfo.Life > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "life", statInfo.Life));
            if (statInfo.Mana > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "mana", statInfo.Mana));
            if (statInfo.Stamina > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "stamina", statInfo.Stamina));
            if (statInfo.Str > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "str", statInfo.Str));
            if (statInfo.Int > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "int", statInfo.Int));
            if (statInfo.Dex > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "dex", statInfo.Dex));
            if (statInfo.Will > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "will", statInfo.Will));
            if (statInfo.Luck > 0)
                player.Client.Send(PacketCreator.AcquireStat(player, "luck", statInfo.Luck));

            Send.AgeIncrease((player.Client as WorldClient), player, player.Age);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends Age Increase Packet
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        /// <param name="age"></param>
        public static void AgeIncrease(WorldClient client, MabiPC player, ushort age)
        {
            var p = new MabiPacket(Op.AgeIncrease, player.Id);
            p.PutShort(age);

            client.Send(p);
        }
Exemplo n.º 3
0
 public void OnTouch(WorldClient c, MabiPC cr, MabiProp pr)
 {
     var r = RandomProvider.Get();
     var p = _revivalLocations[r.Next(_revivalLocations.Length)];
     // Just warp them for now
     c.Warp(29, p.X, p.Y);
 }
Exemplo n.º 4
0
        public static void QuestNew(MabiPC character, MabiQuest quest)
        {
            var packet = new MabiPacket(Op.QuestNew, character.Id);
            packet.AddQuest(quest);

            character.Client.Send(packet);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Starts a quest. Yep. That's it.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="id"></param>
        public void StartQuest(MabiPC character, uint id)
        {
            // This would prevent restarting of quests.
            //if (this.HasQuest(client, id))
            //{
            //    Logger.Warning("Trying to start quest '{0}' for '{1}' twice.", id, client.Character.Name);
            //    return;
            //}

            // Remove quest if it's aleady there and not completed,
            // or it will be shown twice till next relog.
            var exiQuest = character.GetQuestOrNull(id);
            if (exiQuest != null && exiQuest.State < MabiQuestState.Complete)
                WorldManager.Instance.CreatureCompletesQuest(character, character.Quests[id], false);

            // Check here, before we add a quest that doesn't even exist.
            if (!MabiData.QuestDb.Exists(id))
            {
                Logger.Warning("Quest '{0}' does not exist.", id);
                return;
            }

            var quest = new MabiQuest(id);
            character.Quests[id] = quest;

            // Owl
            WorldManager.Instance.Broadcast(new MabiPacket(Op.QuestOwlNew, character.Id).PutLong(quest.Id), SendTargets.Range, character);

            // Quest item (required to complete quests)
            Send.ItemInfo(character.Client, character, quest.QuestItem);

            // Quest info
            Send.QuestNew(character, quest);
        }
Exemplo n.º 6
0
    public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
    {
        // Wand
        if(cr.RightHand != null && cr.RightHand.Info.Class >= 40038 && cr.RightHand.Info.Class <= 40041)
            return true;

        return false;
    }
Exemplo n.º 7
0
        public override bool Met(MabiPC character)
        {
            foreach (var p in this.Prerequisites)
            {
                if (p.Met(character))
                    return true;
            }

            return false;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Sends character info (5209). Response is negative if character is null.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="character"></param>
        public static void CharacterInfo(Client client, MabiPC character)
        {
            var packet = new MabiPacket(Op.WorldCharInfoRequestR, Id.World);
            if (character != null)
            {
                packet.PutByte(true);
                packet.AddCreatureInfo(character, CreaturePacketType.Private);
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Exemplo n.º 9
0
    public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
    {
        // Must have 13+ ranks of Archery Skills
        int rank = 0;
        foreach(var skill in cr.Skills.List.Values)
        {
            if(
                skill.Id != SkillConst.RangedCombatMastery &&
                skill.Id != SkillConst.MagnumShot &&
                skill.Id != SkillConst.ArrowRevolver &&
                skill.Id != SkillConst.ArrowRevolver2 &&
                skill.Id != SkillConst.SupportShot &&
                skill.Id != SkillConst.MirageMissile
            )
                continue;

            if((rank += skill.Info.Rank) >= 13)
                return true;
        }

        return false;
    }
Exemplo n.º 10
0
    public void OpenMapWindow(WorldClient c, MabiPC cr, MabiProp pr)
    {
        var gate = _gates.Values.FirstOrDefault(a => a.Region == cr.Region);
        if (gate == null || gate.Prop.State == "closed")
            return;

        if(!cr.Keywords.Contains(gate.KeywordId))
            cr.Keywords.Add(gate.KeywordId);

        var mygates = _gates.Values.Where(a => cr.Keywords.Contains(a.KeywordId) || _freeRoaming || cr.Keywords.Contains(10142));

        var p = new MabiPacket(Op.MoonGateMap, cr.Id);
        p.PutInt(2);
        p.PutString(gate.Ident);
        p.PutByte((byte)mygates.Count());
        foreach (var g in mygates)
        {
            p.PutShort(g.KeywordId);
            p.PutByte(1);
            p.PutInts(g.Region, g.X, g.Y);
        }
        c.Send(p);
    }
Exemplo n.º 11
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10006] = true; // the Bangor Breaker
 }
Exemplo n.º 12
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10068] = true; // the Abb Neagh Seal Breaker
 }
Exemplo n.º 13
0
 public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
 {
     return (cr.Titles.Count >= 18);
 }
Exemplo n.º 14
0
 public virtual void OnBreak(MabiPC cr)
 {
 }
Exemplo n.º 15
0
    public void OnHit(WorldClient c, MabiPC cr, MabiProp pr)
    {
        lock(_ident)
        {
            if(_hits > _required)
                return;

            if(_locked)
            {
                Send.Notice(c, "This seal stone cannot be broken yet.");
                return;
            }

            // You can only become breaker once officially.
            if(IsBreaker(cr) && !AllowMultiple)
            {
                Send.Notice(c, "Unable to break the Seal.\nYou already hold the title of a Seal Breaker.");
                return;
            }

            // Fulfilling the requirements?
            if(!Check(c, cr, pr))
            {
                Send.Notice(c, _help);
                return;
            }

            _hits++;

            bool update = false;

            // Done
            if(_hits == _required)
            {
                SetBreaker(pr, cr.Id, cr.Name);

                Global.Vars.Perm["SealStoneId" + _ident] = cr.Id;
                Global.Vars.Perm["SealStoneName" + _ident] = cr.Name;

                OnBreak(cr);

                Send.PropUpdate(pr);
                Send.RegionNotice(cr.Region, "{0} successfully broke {1} apart.", cr.Name, _name);
            }
            // Cracks after half.
            else if(_hits == Math.Floor(_required / 2f))
            {
                pr.State = "state2";

                Send.PropUpdate(pr);
                Send.RegionNotice(cr.Region, "{0} has started breaking {1} apart.", cr.Name, _name);
            }
        }
    }
Exemplo n.º 16
0
 protected bool HasQuest(MabiPC character, uint id)
 {
     return character.Quests.ContainsKey(id);
 }
Exemplo n.º 17
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10004] = true; // the Rabbie Seal Breaker
 }
Exemplo n.º 18
0
    public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
    {
        // Have alchemist clothes, shoes, a Cylinder, and Beginner Alchemist title equipped ?

        if(cr.Title != 26)
            return false;

        // Shoes
        var item = cr.Inventory.GetItemAt(Pocket.Shoe, 0, 0);
        if(item == null || (item.Info.Class != 17138))
            return false;

        // Clothes
        item = cr.Inventory.GetItemAt(Pocket.Armor, 0, 0);
        if(item == null || (item.Info.Class != 15351))
            return false;

        // Cylinder
        if(cr.RightHand != null)
        {
            if(cr.RightHand.Info.Class == 40258) return true;
            if(cr.RightHand.Info.Class == 40270) return true;
            if(cr.RightHand.Info.Class == 40284) return true;
            if(cr.RightHand.Info.Class == 40285) return true;
            if(cr.RightHand.Info.Class == 40286) return true;
            if(cr.RightHand.Info.Class == 40287) return true;
            if(cr.RightHand.Info.Class == 40296) return true;
        }

        return false;
    }
Exemplo n.º 19
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10077] = true; // the Tara Seal Breaker
 }
Exemplo n.º 20
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10008] = true; // the Fiodh Breaker
 }
Exemplo n.º 21
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10009] = true; // the South Emain Macha Seal Breaker
 }
Exemplo n.º 22
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10067] = true; // the Sliab Cuilin Seal Breaker
 }
Exemplo n.º 23
0
 public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
 {
     return (cr.LeftHand != null && cr.LeftHand.Info.Class == 1028); // Tracy's Secret
 }
Exemplo n.º 24
0
 public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
 {
     // Must have rank D Playing Instrument, Composing, and Musical Knowledge
     return (
         (cr.Skills.Has(SkillConst.PlayingInstrument) && cr.Skills.Get(SkillConst.PlayingInstrument).Rank >= SkillRank.RD) &&
         (cr.Skills.Has(SkillConst.Composing) && cr.Skills.Get(SkillConst.Composing).Rank >= SkillRank.RD) &&
         (cr.Skills.Has(SkillConst.MusicalKnowledge) && cr.Skills.Get(SkillConst.MusicalKnowledge).Rank >= SkillRank.RD)
     );
 }
Exemplo n.º 25
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10002] = true; // the Dugald Aisle Seal Breaker
 }
Exemplo n.º 26
0
 public abstract bool Check(WorldClient c, MabiPC cr, MabiProp prop);
Exemplo n.º 27
0
    public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
    {
        // Number Total Skill Ranks over 20
        int rank = 0;
        foreach(var skill in cr.Skills.List.Values)
        {
            if((rank += skill.Info.Rank) >= 20)
                return true;
        }

        return false;
    }
Exemplo n.º 28
0
    public bool IsBreaker(MabiPC cr)
    {
        if(cr.Titles.ContainsKey(10002) && cr.Titles[10002]) return true; // the Dugald Aisle Seal Breaker
        if(cr.Titles.ContainsKey(10003) && cr.Titles[10003]) return true; // the Ciar Seal Breaker
        if(cr.Titles.ContainsKey(10004) && cr.Titles[10004]) return true; // the Rabbie Seal Breaker
        if(cr.Titles.ContainsKey(10005) && cr.Titles[10005]) return true; // the Math Seal Breaker
        if(cr.Titles.ContainsKey(10006) && cr.Titles[10006]) return true; // the Bangor Seal Breaker
        if(cr.Titles.ContainsKey(10008) && cr.Titles[10008]) return true; // the Fiodh Seal Breaker
        if(cr.Titles.ContainsKey(10009) && cr.Titles[10009]) return true; // the South Emain Macha Seal Breaker
        if(cr.Titles.ContainsKey(10025) && cr.Titles[10025]) return true; // the North Emain Macha Seal Breaker
        if(cr.Titles.ContainsKey(10067) && cr.Titles[10067]) return true; // the Sliab Cuilin Seal Breaker
        if(cr.Titles.ContainsKey(10068) && cr.Titles[10068]) return true; // the Abb Neagh Seal Breaker
        if(cr.Titles.ContainsKey(10077) && cr.Titles[10077]) return true; // the Tara Seal Breaker

        return false;
    }
Exemplo n.º 29
0
 public override bool Check(WorldClient c, MabiPC cr, MabiProp prop)
 {
     return (cr.Level >= (cr.Age * 4));
 }
Exemplo n.º 30
0
 public override void OnBreak(MabiPC cr)
 {
     cr.Titles[10005] = true; // the Math Seal Breaker
 }