Example #1
0
        public async Task CBloodCastleMove(GSSession session, CBloodCastleMove message)
        {
            var plr   = session.Player;
            var @char = session.Player.Character;

            var invisibleCloack = @char.Inventory.Get(message.ItemPos);
            var itemLevel       = BloodCastles.GetNeededLevel(plr);

            if (invisibleCloack.Plus != message.Bridge && invisibleCloack.Number != ItemNumber.FromTypeIndex(13, 47))
            {
                await session.SendAsync(new SBloodCastleMove(1));

                return;
            }

            if (itemLevel != invisibleCloack.Plus)
            {
                await session.SendAsync(new SBloodCastleMove((byte)(itemLevel > invisibleCloack.Plus ? 4 : 3)));

                return;
            }

            if (!BloodCastles.TryAdd(message.Bridge, plr))
            {
                await session.SendAsync(new SBloodCastleMove(5));

                return;
            }

            @char.Inventory.Delete(message.ItemPos);
        }
Example #2
0
        public void CEventRemainTime(GSSession session, CEventRemainTime message)
        {
            var res = new SEventRemainTime {
                EventType = message.EventType
            };

            switch (message.EventType)
            {
            case EventEnterType.DevilSquare:
                res.RemainTime = 0;
                break;

            case EventEnterType.BloodCastle:
                res.RemainTime = BloodCastles.RemainTime();
                break;

            case EventEnterType.ChaosCastle:
                res.RemainTime = 0;
                break;

            case EventEnterType.IllusionTemple:
                res.RemainTime = 0;
                break;
            }

            session.SendAsync(res);
        }
Example #3
0
 private static async void WorkerEvents()
 {
     while (true)
     {
         try
         {
             BloodCastles.Update();
             Thread.Sleep(1000);
         }
         catch (Exception e)
         {
             Logger.Error(e, DateTime.Now.ToString());
         }
     }
 }
Example #4
0
 static void EventInitialize()
 {
     LuckyCoins.Initialize();
     EventChips.Initialize();
     BloodCastles.Initialize();
 }
Example #5
0
        public async Task CTalk(GSSession session, CTalk message)
        {
            var npcs        = ResourceCache.Instance.GetNPCs();
            var ObjectIndex = message.Number.ShufleEnding();
            var obj         = MonstersMng.Instance.GetMonster(ObjectIndex);
            var @char       = session.Player.Character;

            if (npcs.TryGetValue(obj.Info.Monster, out var npc))
            {
                if (npc.Shop != null)
                {
                    session.Player.Window = npc.Shop.Storage;
                    await session.SendAsync(new STalk { Result = 0 });

                    await session.SendAsync(new SShopItemList(npc.Shop.Storage.GetInventory()) { ListType = 0 });

                    await session.SendAsync(new STax { Type = TaxType.Shop, Rate = 4 });
                }
                else if (npc.Warehouse)
                {
                    session.Player.Window = session.Player.Account.Vault;
                    session.Player.Character.Inventory.Lock = true;

                    await session.SendAsync(new SNotice(NoticeType.Blue, $"Active Vault: " + (session.Player.Account.ActiveVault + 1)));

                    await session.SendAsync(new STalk { Result = 2 });

                    await session.SendAsync(new SShopItemList(session.Player.Account.Vault.GetInventory()));

                    await session.SendAsync(new SWarehouseMoney(session.Player.Account.VaultMoney, session.Player.Character.Money));
                }
                else if (npc.GuildMaster)
                {
                    GuildManager.NPCTalk(session.Player);
                }
                else if (npc.EventChips)
                {
                    EventChips.NPCTalk(session.Player);
                }
                else if (npc.MessengerAngel)
                {
                    BloodCastles.MessengerAngelTalk(session.Player);
                }
                else if (npc.KingAngel)
                {
                    BloodCastles.AngelKingTalk(session.Player);
                }
                else if (npc.Window != 0)
                {
                    await session.SendAsync(new STalk { Result = npc.Window });

                    if (npc.Window == 3) // ChaosMachine
                    {
                        session.Player.Character.Inventory.Lock = true;
                        session.Player.Window = session.Player.Character.Inventory.ChaosBox;
                    }
                }
                else if (npc.Buff != 0)
                {
                    @char.Spells.SetBuff((SkillStates)npc.Buff, TimeSpan.FromSeconds(120));
                }
                else if (npc.Quest != 0xffff)
                {
                    var quest = @char.Quests.Find(obj.Info.Monster);

                    if (quest == null)
                    {
                        await session.SendAsync(new SChatTarget(ObjectIndex, "I don't have Quest for you"));

                        return;
                    }

                    var details = quest.Details;
                    Logger.ForAccount(session)
                    .Information("Talk to QuestNPC: {0}, Found Quest:{1}, State:{2}", obj.Info.Name, details.Name, quest.State);
                    await session.SendAsync(new SSetQuest { Index = (byte)quest.Index, State = quest.StateByte });
                }
            }
            else
            {
                Logger.ForAccount(session)
                .Debug("Talk to unasigned NPC {0}", obj.Info.Monster);
                await session.SendAsync(new SChatTarget(ObjectIndex, "Have a good day"));
            }
        }