예제 #1
0
        private void ReadCyclopediaCharacterInfoRecentDeaths(Internal.CommunicationStream message)
        {
            ushort count = message.ReadUnsignedShort();

            for (int i = 0; i < count; i++)
            {
                uint   time  = message.ReadUnsignedInt();
                string cause = message.ReadString();
            }
        }
예제 #2
0
        private void ParseBuddyState(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            byte state      = 1;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameLoginPending))
            {
                state = message.ReadUnsignedByte();
            }
        }
예제 #3
0
        private void ParseStoreOffers(Internal.CommunicationStream message)
        {
            var    gameManager  = OpenTibiaUnity.GameManager;
            string categoryName = message.ReadString();

            if (gameManager.ClientVersion >= 1180)
            {
                uint selectedOfferId = message.ReadUnsignedInt();
                var  sortType        = message.ReadEnum <StoreOfferSortType>();
                int  filterCount     = message.ReadUnsignedByte();
                for (int i = 0; i < filterCount; i++)
                {
                    string filter = message.ReadString();
                }

                if (gameManager.ClientVersion >= 1185)
                {
                    // if a filter is not included, then if "Show all" is not selected
                    // the offer will be hidden until then..
                    // if the offer has no filter, then this value won't affect it

                    int shownFiltersCount = message.ReadUnsignedShort();
                    for (int i = 0; i < shownFiltersCount; i++)
                    {
                        int filterIndex = message.ReadUnsignedByte();
                    }
                }
            }

            var storeCategory = OpenTibiaUnity.StoreStorage.FindCategory(categoryName);

            int offerCount = message.ReadUnsignedShort();

            for (int i = 0; i < offerCount; i++)
            {
                var offer = ReadStoreOffer(message);

                // server may be sending information about non-existant category
                if (storeCategory != null)
                {
                    storeCategory.AddOffer(offer);
                }
            }

            if (gameManager.ClientVersion >= 1180 && categoryName == Constants.StoreHomeCategoryName)
            {
                byte featuredOfferCount = message.ReadUnsignedByte();
                for (int i = 0; i < featuredOfferCount; i++)
                {
                    var storeFeaturedOffer = ReadStoreFeaturedOffer(message);
                }

                byte unknown = message.ReadUnsignedByte();
            }
        }
예제 #4
0
        private void ReadCyclopediaCharacterInfoRecentPvpKills(Internal.CommunicationStream message)
        {
            ushort count = message.ReadUnsignedShort();

            for (int i = 0; i < count; i++)
            {
                uint   time        = message.ReadUnsignedInt();
                string description = message.ReadString();
                var    status      = message.ReadEnum <CyclopediaPvpKillStatus>();
            }
        }
예제 #5
0
        private Market.Offer ReadMarketOffer(Internal.CommunicationStream message, MarketOfferType offerType, ushort var)
        {
            uint   timestamp = message.ReadUnsignedInt();
            ushort counter   = message.ReadUnsignedShort();

            ushort objectId;

            switch (var)
            {
            case Constants.MarketRequestOwnOffers:
            case Constants.MarketRequestOwnHistory:
                objectId = message.ReadUnsignedShort();
                break;

            default:
                objectId = var;
                break;
            }

            ushort amount     = message.ReadUnsignedShort();
            uint   piecePrice = message.ReadUnsignedInt();

            MarketOfferState state     = MarketOfferState.Active;
            string           character = null;

            switch (var)
            {
            case Constants.MarketRequestOwnOffers:
                break;

            case Constants.MarketRequestOwnHistory:
                state = (MarketOfferState)message.ReadUnsignedByte();
                break;

            default:
                character = message.ReadString();
                break;
            }

            return(new Market.Offer(new Market.OfferId(counter, timestamp), offerType, objectId, amount, piecePrice, character, state));
        }
예제 #6
0
        private void ParseMarketDetail(Internal.CommunicationStream message)
        {
            ushort objectId = message.ReadUnsignedShort();

            var last = MarketDetail.Weight;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameImbuing))
            {
                last = MarketDetail.ImbuementSlots;
            }

            Dictionary <MarketDetail, string> details = new Dictionary <MarketDetail, string>();

            for (var i = MarketDetail.First; i <= last; i++)
            {
                int strLen = message.ReadUnsignedShort();
                if (strLen == 0)
                {
                    continue;
                }

                details.Add(i, message.ReadString(strLen));
            }

            int time  = DateTime.Now.Second / 1000 * Constants.SecondsPerDay;
            int ctime = time;

            int count = message.ReadUnsignedByte();

            for (int i = 0; i < count; i++)
            {
                uint transactions = message.ReadUnsignedInt();
                uint totalPrice   = message.ReadUnsignedInt();
                uint maximumPrice = message.ReadUnsignedInt();
                uint minimumPrice = message.ReadUnsignedInt();

                ctime -= Constants.SecondsPerDay;
            }

            ctime = time;
            count = message.ReadUnsignedByte();
            for (int i = 0; i < count; i++)
            {
                uint transactions = message.ReadUnsignedInt();
                uint totalPrice   = message.ReadUnsignedInt();
                uint maximumPrice = message.ReadUnsignedInt();
                uint minimumPrice = message.ReadUnsignedInt();

                ctime -= Constants.SecondsPerDay;
            }
        }
예제 #7
0
        public StoreOpenParameters ReadStoreOpenParameters(Internal.CommunicationStream message)
        {
            var openAction = message.ReadEnum <StoreOpenParameterAction>();

            Store.OpenParameters.IStoreOpenParamater openParam = null;
            switch (openAction)
            {
            case StoreOpenParameterAction.Invalid: {
                break;
            }

            case StoreOpenParameterAction.CategoryType: {
                var categoryType = message.ReadEnum <StoreCategoryType>();
                openParam = new Store.OpenParameters.StoreCategoryTypeOpenParamater(categoryType);
                break;
            }

            case StoreOpenParameterAction.CategoryAndFilter: {
                var categoryAndFilter = ReadStoreCategoryAndFilter(message);
                openParam = new Store.OpenParameters.StoreCategoryAndFilterOpenParamater(categoryAndFilter);
                break;
            }

            case StoreOpenParameterAction.OfferType: {
                var offerType = message.ReadEnum <StoreOfferType>();
                openParam = new Store.OpenParameters.StoreOfferTypeOpenParamater(offerType);
                break;
            }

            case StoreOpenParameterAction.OfferId: {
                var offerId = message.ReadUnsignedInt();
                openParam = new Store.OpenParameters.StoreOfferIdOpenParamater(offerId);
                break;
            }

            case StoreOpenParameterAction.CategoryName: {
                var categoryName = message.ReadString();
                openParam = new Store.OpenParameters.StoreCategoryNameOpenParamater(categoryName);
                break;
            }
            }

            // enum too, 0, 1, 2, 3
            message.ReadUnsignedByte();

            /**
             * 0: default
             * 1: home
             * // 2, 3?
             */
            message.ReadBoolean(); // 0, 1, 2, 3 (enum)
            return(new StoreOpenParameters(openAction, openParam));
        }
예제 #8
0
        private void ParseCreatureType(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            byte type       = message.ReadUnsignedByte();
            uint master     = 0;

            if (OpenTibiaUnity.GameManager.ClientVersion >= 1120 && type == (int)CreatureType.Summon)
            {
                master = message.ReadUnsignedInt();
            }

            var creature = CreatureStorage.GetCreature(creatureId);

            if (!!creature)
            {
                creature.Type = (CreatureType)type;
                creature.SetSummonerId(master);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureType: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #9
0
        private ObjectInstance ReadObjectInstance(Internal.CommunicationStream message, int id = -1)
        {
            if (id == -1)
            {
                id = message.ReadUnsignedShort();
            }

            if (id == 0)
            {
                return(null);
            }
            else if (id <= AppearanceInstance.Creature)
            {
                throw new System.Exception("ProtocolGameUtility.ReadObjectInstance: Invalid type (id = " + id + ")");
            }

            var @object = AppearanceStorage.CreateObjectInstance((uint)id, 0);

            if (!@object)
            {
                throw new System.Exception("ProtocolGameUtility.ReadObjectInstance: Invalid instance with id " + id);
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameObjectMarks))
            {
                @object.Marks.SetMark(MarkType.Permenant, message.ReadUnsignedByte());
            }

            if (@object.Type.IsStackable || @object.Type.IsFluidContainer || @object.Type.IsSplash)
            {
                @object.Data = message.ReadUnsignedByte();
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameItemAnimationPhase))
            {
                if (@object.Type.FrameGroups[(int)Protobuf.Shared.FrameGroupType.Idle].SpriteInfo.IsAnimation)
                {
                    int phase = message.ReadUnsignedByte();
                    @object.Phase = phase == 0 ? Constants.PhaseAutomatic : phase;
                }
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameQuickLoot) && @object.Type.IsContainer)
            {
                bool assignedToQuickLoot = message.ReadBoolean();
                if (assignedToQuickLoot)
                {
                    uint lootContainers = message.ReadUnsignedInt(); // 1 << ObjectCategory | ....
                }
            }

            return(@object);
        }
예제 #10
0
        private void ParseSupplyStash(Internal.CommunicationStream message)
        {
            int availableItems = message.ReadUnsignedShort();

            for (int i = 0; i < availableItems; i++)
            {
                ushort objectID    = message.ReadUnsignedShort();
                uint   objectCount = message.ReadUnsignedInt();
            }

            int freeSlots = message.ReadUnsignedShort();
        }
예제 #11
0
        private void ParseDailyRewardHistory(Internal.CommunicationStream message)
        {
            int count = message.ReadUnsignedByte();

            for (int i = 0; i < count; i++)
            {
                var timestamp = message.ReadUnsignedInt(); // timestamp
                message.ReadUnsignedByte();                // some state (0: none, 1: active[green])
                message.ReadString();                      // description
                message.ReadUnsignedShort();               // streak
            }
        }
예제 #12
0
        public int Encrypt(Internal.CommunicationStream message, int offset = 0, int length = int.MaxValue)
        {
            length           = Math.Min(length, (int)message.Length - offset);
            message.Position = offset + length;

            int encryptedLength = (int)(Math.Floor((length + BlockSize - 1) / (double)BlockSize) * BlockSize);

            if (encryptedLength > length)
            {
                byte[] tmp = new byte[encryptedLength - length];
                _random.NextBytes(tmp);
                message.Write(tmp, 0, tmp.Length);
                length = encryptedLength;
            }

            int i = offset;

            while (i < offset + length)
            {
                message.Position = i;
                uint v0    = message.ReadUnsignedInt();
                uint v1    = message.ReadUnsignedInt();
                uint delta = 0x61C88647;
                uint sum   = 0;
                for (int r = 0; r < 32; r++)
                {
                    v0  += (v1 << 4 ^ v1 >> 5) + v1 ^ sum + _key[sum & 3];
                    sum -= delta;
                    v1  += (v0 << 4 ^ v0 >> 5) + v0 ^ sum + _key[sum >> 11 & 3];
                }

                message.Position -= BlockSize;
                message.WriteUnsignedInt(v0);
                message.WriteUnsignedInt(v1);

                i += BlockSize;
            }

            return(length);
        }
예제 #13
0
        private void ReadCyclopediaCharacterInfoGeneralStats(Internal.CommunicationStream message)
        {
            ulong  experience   = message.ReadUnsignedLong();
            ushort level        = message.ReadUnsignedShort();
            int    levelPercent = message.ReadUnsignedByte();

            float baseXpGain         = message.ReadUnsignedShort() / 100f;
            float grindingAddend     = message.ReadUnsignedShort() / 100f;
            float storeBoostAddend   = message.ReadUnsignedShort() / 100f;
            float huntingBoostFactor = message.ReadUnsignedShort() / 100f;

            message.ReadUnsignedShort(); // yet unknown
            bool canBuyXpBoost = message.ReadBoolean();

            int health    = message.ReadUnsignedShort();
            int maxHealth = message.ReadUnsignedShort();
            int mana      = message.ReadUnsignedShort();
            int maxMana   = message.ReadUnsignedShort();
            int soul      = message.ReadUnsignedByte();

            int ticks        = OpenTibiaUnity.TicksMillis;
            int stamina      = ticks + 60000 * message.ReadUnsignedShort();
            int regeneration = ticks + 1000 * message.ReadUnsignedShort();
            int training     = ticks + 60000 * message.ReadUnsignedShort();

            int speed     = message.ReadUnsignedShort();
            int baseSpeed = message.ReadUnsignedShort();

            uint totalCapacity = message.ReadUnsignedInt();
            uint baseCapacity  = message.ReadUnsignedInt();
            uint freeCapacity  = message.ReadUnsignedInt();

            int skillCount = message.ReadUnsignedByte();

            for (int i = 0; i < skillCount; i++)
            {
                var skillType = message.ReadEnum <SkillType>();
                var skill     = ReadSkill(message);
            }
        }
예제 #14
0
        public int Decrypt(Internal.CommunicationStream message, int offset = 0, int length = int.MaxValue)
        {
            length  = Math.Min(length, (int)message.Length - offset);
            length -= length % BlockSize;
            int i = offset;

            while (i < offset + length)
            {
                message.Position = i;
                uint v0    = message.ReadUnsignedInt();
                uint v1    = message.ReadUnsignedInt();
                uint delta = 0x61C88647;
                uint sum   = 0xC6EF3720;
                for (int r = 0; r < 32; r++)
                {
                    v1  -= (v0 << 4 ^ v0 >> 5) + v0 ^ sum + _key[sum >> 11 & 3];
                    sum += delta;
                    v0  -= (v1 << 4 ^ v1 >> 5) + v1 ^ sum + _key[sum & 3];
                }
                message.Position -= BlockSize;
                message.WriteUnsignedInt(v0);
                message.WriteUnsignedInt(v1);
                i += BlockSize;
            }

            message.Position = offset;
            int payloadLength = message.ReadUnsignedShort();
            int messageLength = payloadLength + Internal.Connection.PacketLengthSize;

            int lengthDelta = messageLength - length;

            if (lengthDelta > 0 || -lengthDelta > length)
            {
                return(0);
            }

            message.SetLength(message.Length + lengthDelta);
            return(length);
        }
예제 #15
0
        public StoreOfferQuantityConfiguration ReadStoreOfferQuantityConfiguration(Internal.CommunicationStream message)
        {
            uint   offerId = message.ReadUnsignedInt();
            ushort amount  = message.ReadUnsignedShort();
            uint   price   = message.ReadUnsignedInt();
            bool   useTransferableCoins = message.ReadBoolean();

            bool disabled        = message.ReadBoolean();
            var  disabledReasons = new List <string>();

            if (disabled)
            {
                int errorCount = message.ReadUnsignedByte();
                for (int i = 0; i < errorCount; i++)
                {
                    disabledReasons.Add(message.ReadString());
                }
            }

            var highlightState = message.ReadEnum <StoreHighlightState>();

            if (highlightState == StoreHighlightState.Sale)
            {
                uint saleValidUntilTimestamp = message.ReadUnsignedInt();
                uint basePrice = message.ReadUnsignedInt();
            }

            var quantityConfiguration = new StoreOfferQuantityConfiguration(offerId, price, amount, highlightState, useTransferableCoins);

            quantityConfiguration.DisabledReasons.AddRange(disabledReasons);

            if (disabled)
            {
                quantityConfiguration.DisabledState = StoreOfferDisableState.Disabled;
            }

            return(quantityConfiguration);
        }
예제 #16
0
        private void ParseCreatureHealth(Internal.CommunicationStream message)
        {
            uint creatureId    = message.ReadUnsignedInt();
            byte healthPercent = message.ReadUnsignedByte();

            var creature = CreatureStorage.GetCreatureById(creatureId);

            if (!!creature)
            {
                creature.SetSkill(SkillType.HealthPercent, healthPercent);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureHealth: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #17
0
        private void ParseCreatureSkull(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            byte pkFlag     = message.ReadUnsignedByte();

            var creature = CreatureStorage.GetCreatureById(creatureId);

            if (!!creature)
            {
                creature.SetPKFlag((PkFlag)pkFlag);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureSkull: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #18
0
        private void ParseCreatureMark(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            byte mark       = message.ReadUnsignedByte();

            var creature = CreatureStorage.GetCreatureById(creatureId);

            if (!!creature)
            {
                creature.Marks.SetMark(MarkType.OneSecondTemp, mark);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureMark: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #19
0
        private void ParseCreatureShield(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            var  partyFlag  = message.ReadEnum <PartyFlag>();

            var creature = CreatureStorage.GetCreatureById(creatureId);

            if (!!creature)
            {
                creature.SetPartyFlag(partyFlag);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureShield: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #20
0
        private void ParseCreatureUnpass(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            bool unpass     = message.ReadBoolean();

            var creature = CreatureStorage.GetCreature(creatureId);

            if (!!creature)
            {
                creature.Unpassable = unpass;
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureUnpass: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #21
0
 private void ParsePlayerStates(Internal.CommunicationStream message)
 {
     if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GamePlayerStateU32))
     {
         Player.StateFlags = message.ReadUnsignedInt();
     }
     else if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GamePlayerStateU16))
     {
         Player.StateFlags = message.ReadUnsignedShort();
     }
     else
     {
         Player.StateFlags = message.ReadUnsignedByte();
     }
 }
예제 #22
0
        private void ParsePlayerHelpers(Internal.CommunicationStream message)
        {
            uint   creatureId = message.ReadUnsignedInt();
            ushort helpers    = message.ReadUnsignedShort();

            var creature = CreatureStorage.GetCreature(creatureId);

            if (!!creature)
            {
                creature.NumberOfPvPHelpers = helpers;
            }

            /*else
             *  throw new System.Exception("ProtocolGame.ParsePlayerHelpers: Unknown creature id: " + creatureId);*/
        }
예제 #23
0
        private void ParseCreatureLight(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();

            byte intensity = message.ReadUnsignedByte();
            byte color     = message.ReadUnsignedByte();

            var creature = CreatureStorage.GetCreature(creatureId);

            if (!!creature)
            {
                creature.Brightness = intensity;
                creature.LightColor = Colors.ColorFrom8Bit(color);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureLight: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #24
0
        private void ParseTrappers(Internal.CommunicationStream message)
        {
            int n = message.ReadUnsignedByte();
            List <Creatures.Creature> trappers = new List <Creatures.Creature>();

            for (int i = 0; i < n; i++)
            {
                var creatureId = message.ReadUnsignedInt();
                var creature   = CreatureStorage.GetCreature(creatureId);
                if (creature)
                {
                    trappers.Add(creature);
                }
            }

            CreatureStorage.SetTrappers(trappers);
        }
예제 #25
0
        private void ParseCreatureOutfit(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            var  outfit     = ProtocolGameExtentions.ReadCreatureOutfit(message);

            var creature = CreatureStorage.GetCreature(creatureId);

            if (!!creature)
            {
                creature.Outfit = outfit;
                if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GamePlayerMounts))
                {
                    creature.MountOutfit = ProtocolGameExtentions.ReadMountOutfit(message, creature.MountOutfit);
                }
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureOutfit: Unknown creature id: " + creatureId);
              * }*/
        }
예제 #26
0
        private void ParseLoginSuccess(Internal.CommunicationStream message)
        {
            Player.Id = message.ReadUnsignedInt();

#if !UNITY_EDITOR && UNITY_STANDALONE_WIN
            string title = string.Format("{0} - {1}", Application.productName, CharacterName);
            OpenTibiaUnity.GameManager.SetApplicationTitle(title);
#endif

            BeatDuration = message.ReadUnsignedShort();
            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameNewSpeedLaw))
            {
                Creatures.Creature.SpeedA = message.ReadDouble();
                Creatures.Creature.SpeedB = message.ReadDouble();
                Creatures.Creature.SpeedC = message.ReadDouble();
            }

            BugReportsAllowed = message.ReadBoolean();
            if (OpenTibiaUnity.GameManager.ClientVersion >= 1054)
            {
                bool canChangePvPFrameRate = message.ReadBoolean();
            }

            if (OpenTibiaUnity.GameManager.ClientVersion >= 1058)
            {
                bool exportPvPEnabled = message.ReadBoolean();
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameIngameStore))
            {
                string storeLink        = message.ReadString();
                ushort storePackageSize = message.ReadUnsignedShort();
            }

            if (OpenTibiaUnity.GameManager.ClientVersion >= 1149 && OpenTibiaUnity.GameManager.BuildVersion >= 6018)
            {
                bool exivaRestrictions = message.ReadBoolean();
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameTournament))
            {
                bool tournamentActivated = message.ReadBoolean();
            }
        }
예제 #27
0
        private void ParseClearTarget(Internal.CommunicationStream message)
        {
            uint creatureId = 0;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameAttackSeq))
            {
                creatureId = message.ReadUnsignedInt();
            }

            Creatures.Creature creature;
            if (!!(creature = CreatureStorage.AttackTarget) && (creature.Id == creatureId || creatureId == 0))
            {
                CreatureStorage.SetAttackTarget(null, false);
            }
            else if (!!(creature = CreatureStorage.FollowTarget) && (creature.Id == creatureId || creatureId == 0))
            {
                CreatureStorage.SetFollowTarget(null, false);
            }
        }
예제 #28
0
        private void ParseShowModalDialog(Internal.CommunicationStream message)
        {
            var modalDialog = new ProtocolModalDialog();

            modalDialog.Id      = message.ReadUnsignedInt();
            modalDialog.Title   = message.ReadString();
            modalDialog.Message = message.ReadString();

            byte buttonCount = message.ReadUnsignedByte();

            modalDialog.Buttons = new ProtocolModalDialogEntity[buttonCount];
            for (int i = 0; i < buttonCount; i++)
            {
                string text = message.ReadString();
                byte   id   = message.ReadUnsignedByte();
                modalDialog.Buttons[i] = new ProtocolModalDialogEntity()
                {
                    Id   = id,
                    Text = text
                };
            }

            byte choiceCount = message.ReadUnsignedByte();

            modalDialog.Choices = new ProtocolModalDialogEntity[choiceCount];
            for (int i = 0; i < choiceCount; i++)
            {
                string text = message.ReadString();
                byte   id   = message.ReadUnsignedByte();
                modalDialog.Choices[i] = new ProtocolModalDialogEntity()
                {
                    Id   = id,
                    Text = text
                };
            }

            modalDialog.DefaultEnterButton  = message.ReadUnsignedByte();
            modalDialog.DefaultEscapeButton = message.ReadUnsignedByte();
            modalDialog.Priority            = message.ReadBoolean();

            OpenTibiaUnity.GameManager.onRequestModalDialog.Invoke(modalDialog);
        }
예제 #29
0
        private void ReadCyclopediaCharacterInfoAchievements(Internal.CommunicationStream message)
        {
            ushort totalPoints             = message.ReadUnsignedShort();
            ushort totalSecretAchievements = message.ReadUnsignedShort();

            ushort obtainedAchievements = message.ReadUnsignedShort();

            for (int i = 0; i < obtainedAchievements; i++)
            {
                ushort achievementID = message.ReadUnsignedShort();
                uint   time          = message.ReadUnsignedInt();
                bool   secret        = message.ReadBoolean();
                if (secret)
                {
                    string name        = message.ReadString();
                    string description = message.ReadString();
                    int    grade       = message.ReadUnsignedByte();
                }
            }
        }
예제 #30
0
        private void ParseCreatureSpeed(Internal.CommunicationStream message)
        {
            uint creatureId = message.ReadUnsignedInt();
            int  baseSpeed  = -1;

            if (OpenTibiaUnity.GameManager.ClientVersion >= 1059)
            {
                baseSpeed = message.ReadUnsignedShort();
            }

            int speed = message.ReadUnsignedShort();

            var creature = CreatureStorage.GetCreatureById(creatureId);

            if (!!creature)
            {
                creature.SetSkill(SkillType.Speed, speed, baseSpeed);
            }/*else {
              * throw new System.Exception("ProtocolGame.ParseCreatureSpeed: Unknown creature id: " + creatureId);
              * }*/
        }