Пример #1
0
        public static void UseSummonScrollRequest(IRealmClient client, RealmPacketIn packet)
        {
            packet.Position += 2;
            string    name      = packet.ReadAsdaString(20, Locale.Start);
            Character character = World.GetCharacter(name, false);

            if (character == null)
            {
                client.ActiveCharacter.SendSystemMessage(string.Format("{0} is not in game.", (object)name));
            }
            else if (character.IsAsda2BattlegroundInProgress)
            {
                client.ActiveCharacter.SendSystemMessage(string.Format("{0} is on war.", (object)name));
            }
            else if (client.ActiveCharacter.IsAsda2BattlegroundInProgress)
            {
                client.ActiveCharacter.SendSystemMessage("You cant teleport on war.");
            }
            else if (client.ActiveCharacter.Name == character.Name)
            {
                client.ActiveCharacter.SendSystemMessage("You cant teleport oneself.");
            }
            else
            {
                bool flag = client.ActiveCharacter.Asda2Inventory.UseTeleportScroll(true);
                AchievementProgressRecord progressRecord =
                    client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(90U);
                switch (++progressRecord.Counter)
                {
                case 50:
                    client.ActiveCharacter.Map.CallDelayed(500,
                                                           (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Lonely224)));
                    break;

                case 100:
                    client.ActiveCharacter.Map.CallDelayed(500,
                                                           (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Lonely224)));
                    break;
                }

                progressRecord.SaveAndFlush();
                if (flag)
                {
                    Asda2CharacterHandler.SendSummonChar(client.ActiveCharacter, character);
                }
                else
                {
                    client.ActiveCharacter.SendSystemMessage("You have not summon scroll");
                }
            }
        }