Exemplo n.º 1
0
        private void ParseTextMessage(InputMessage message)
        {
            MessageModes mode = (MessageModes)message.GetU8();

            try {
                switch (mode)
                {
                case MessageModes.ChannelManagment:
                    int    channelID = message.GetU16();
                    string text      = message.GetString();
                    // TODO name filter
                    //var regex = new System.Text.RegularExpressions.Regex(@"^(.+?) invites you to |^You have been excluded from the channel ([^']+)'s Channel\.$");
                    //var match = regex.Match(text);
                    //string speaker = match != null && match.Success ? match.Value : null;

                    m_WorldMapStorage.AddOnscreenMessage(null, -1, null, 0, mode, text);
                    m_ChatStorage.AddChannelMessage(channelID, -1, null, 0, mode, text);
                    break;

                case MessageModes.Guild:
                case MessageModes.PartyManagement:
                case MessageModes.Party:
                    channelID = message.GetU16();
                    text      = message.GetString();
                    m_WorldMapStorage.AddOnscreenMessage(null, -1, null, 0, mode, text);
                    m_ChatStorage.AddChannelMessage(channelID, -1, null, 0, mode, text);
                    break;

                case MessageModes.Login:
                case MessageModes.Admin:
                case MessageModes.Game:
                case MessageModes.GameHighlight:
                case MessageModes.Failure:
                case MessageModes.Look:
                case MessageModes.Status:
                case MessageModes.Loot:
                case MessageModes.TradeNpc:
                case MessageModes.HotkeyUse:
                    channelID = -1;
                    text      = message.GetString();
                    m_WorldMapStorage.AddOnscreenMessage(null, -1, null, 0, mode, text);
                    m_ChatStorage.AddChannelMessage(channelID, -1, null, 0, mode, text);
                    break;

                case MessageModes.Market:
                    text = message.GetString();
                    // TODO: market
                    break;

                case MessageModes.Report:
                    // TODO
                    //ReportWidget.s_ReportTimestampReset();
                    text = message.GetString();
                    m_WorldMapStorage.AddOnscreenMessage(null, -1, null, 0, mode, text);
                    m_ChatStorage.AddChannelMessage(-1, -1, null, 0, mode, text);
                    break;

                case MessageModes.DamageDealed:
                case MessageModes.DamageReceived:
                case MessageModes.DamageOthers:
                    Vector3Int position = message.GetPosition();
                    uint       value    = message.GetU32();
                    uint       color    = message.GetU8();
                    if (value > 0)
                    {
                        m_WorldMapStorage.AddOnscreenMessage(position, -1, null, 0, mode, (int)value, color);
                    }

                    value = message.GetU32();
                    color = message.GetU8();
                    if (value > 0)
                    {
                        m_WorldMapStorage.AddOnscreenMessage(position, -1, null, 0, mode, (int)value, color);
                    }

                    text = message.GetString();
                    m_ChatStorage.AddChannelMessage(-1, -1, null, 0, mode, text);
                    break;

                case MessageModes.Heal:
                case MessageModes.Mana:
                case MessageModes.Exp:
                case MessageModes.HealOthers:
                case MessageModes.ExpOthers:
                    position = message.GetPosition();
                    value    = message.GetU32();
                    color    = message.GetU8();
                    m_WorldMapStorage.AddOnscreenMessage(position, -1, null, 0, mode, (int)value, color);

                    text = message.GetString();
                    m_ChatStorage.AddChannelMessage(-1, -1, null, 0, mode, text);
                    break;

                default:
                    throw new System.Exception("Invalid message mode " + mode + ".");
                }
            } catch (System.Exception e) {
                throw new System.Exception("Connection.readSMESSAGE: Failed to add message of type " + mode + ": " + e.Message + "\n" + e.StackTrace);
            }
        }
Exemplo n.º 2
0
        private void ParseTalk(InputMessage message)
        {
            uint   statementID  = message.GetU32();
            string speaker      = message.GetString();
            ushort speakerLevel = message.GetU16();

            MessageModes mode = (MessageModes)message.GetU8();

            Vector3Int?absolutePosition = null;

            Utility.UnionStrInt channelID = null;

            switch (mode)
            {
            case MessageModes.Say:
            case MessageModes.Whisper:
            case MessageModes.Yell:
                absolutePosition = message.GetPosition();
                channelID        = Chat.ChatStorage.LocalChannelID;
                break;

            case MessageModes.PrivateFrom:
                channelID = speaker;
                break;

            case MessageModes.Channel:
            case MessageModes.ChannelHighlight:
                channelID = message.GetU16();
                break;

            case MessageModes.Spell:
                absolutePosition = message.GetPosition();
                channelID        = Chat.ChatStorage.LocalChannelID;
                break;

            case MessageModes.NpcFromStartBlock:
                absolutePosition = message.GetPosition();
                break;

            case MessageModes.GamemasterBroadcast:
                break;

            case MessageModes.GamemasterChannel:
                channelID = message.GetU16();
                break;

            case MessageModes.GamemasterPrivateFrom:
                channelID = speaker;
                break;

            case MessageModes.BarkLow:
            case MessageModes.BarkLoud:
                absolutePosition = message.GetPosition();
                channelID        = -1;
                break;

            case MessageModes.Game:
                break;

            default:
                throw new System.Exception("ProtocolGame.ParseTalk: invalid message mode.");
            }

            string text = message.GetString();

            if (mode != MessageModes.NpcFromStartBlock && mode != MessageModes.NpcFrom)
            {
                try {
                    m_WorldMapStorage.AddOnscreenMessage(absolutePosition, (int)statementID, speaker, speakerLevel, mode, text);
                    m_ChatStorage.AddChannelMessage(channelID, (int)statementID, speaker, speakerLevel, mode, text);
                } catch (System.Exception e) {
                    throw new System.Exception("ProtocolGame.ParseTalk: Failed to add message: " + e.Message + "\n" + e.StackTrace);
                }
            }
            else if (mode == MessageModes.NpcFromStartBlock)
            {
                m_MessageStorage.StartMessageBlock(speaker, absolutePosition, text);
            }
            else if (mode == MessageModes.NpcFrom)
            {
                m_MessageStorage.AddTextToBlock(speaker, text);
            }
        }
Exemplo n.º 3
0
        private void ParsePrivateChannel(InputMessage message)
        {
            string channelName = message.GetString();

            m_ChatStorage.AddChannel(channelName, channelName, MessageModes.PrivateFrom);
        }
Exemplo n.º 4
0
        private void ParseCloseChannel(InputMessage message)
        {
            int channelID = message.GetU16();

            m_ChatStorage.CloseChannel(channelID);
        }
Exemplo n.º 5
0
 private void ParseCloseContainer(InputMessage message)
 {
     byte containerId = message.GetU8();
 }
Exemplo n.º 6
0
        private Creatures.Creature ReadCreatureInstance(InputMessage message, int type          = -1,
                                                        UnityEngine.Vector3Int?absolutePosition = null)
        {
            if (type == -1)
            {
                type = message.GetU16();
            }

            if (type != AppearanceInstance.Creature && type != AppearanceInstance.OutdatedCreature && type != AppearanceInstance.UnknownCreature)
            {
                throw new System.Exception("ProtocolGame.ReadCreatureInstance: Invalid creature type");
            }

            var gameManager = OpenTibiaUnity.GameManager;

            Creatures.Creature creature;
            switch (type)
            {
            case AppearanceInstance.UnknownCreature:
            case AppearanceInstance.OutdatedCreature:
                if (type == AppearanceInstance.UnknownCreature)
                {
                    uint removeID = message.GetU32();
                    uint newID    = message.GetU32();
                    int  creatureType;

                    if (gameManager.ClientVersion >= 910)
                    {
                        creatureType = message.GetU8();
                    }
                    else
                    {
                        if (newID >= Constants.PlayerStartID && newID < Constants.PlayerEndID)
                        {
                            creatureType = (int)CreatureTypes.Player;
                        }
                        else if (newID >= Constants.MonsterStartID && newID < Constants.MonsterEndID)
                        {
                            creatureType = (int)CreatureTypes.Monster;
                        }
                        else
                        {
                            creatureType = (int)CreatureTypes.NPC;
                        }
                    }

                    if (newID == m_Player.ID)
                    {
                        creature = m_Player;
                    }
                    else
                    {
                        creature = new Creatures.Creature(newID);
                    }

                    creature = m_CreatureStorage.ReplaceCreature(creature, removeID);
                    if (!creature)
                    {
                        throw new System.Exception("ProtocolGame.ReadCreatureInstance: Failed to append creature.");
                    }

                    creature.Type = (CreatureTypes)creatureType;

                    creature.Name = message.GetString();
                }
                else
                {
                    creature = m_CreatureStorage.GetCreature(message.GetU32());
                    if (!creature)
                    {
                        throw new System.Exception("ProtocolGame.ReadCreatureInstance: Outdated creature not found.");
                    }
                }

                creature.SetSkill(SkillTypes.HealthPercent, message.GetU8());
                creature.Direction   = (Directions)message.GetU8();
                creature.Outfit      = ReadCreatureOutfit(message, creature.Outfit);
                creature.MountOutfit = ReadMountOutfit(message, creature.MountOutfit);
                creature.Brightness  = message.GetU8();
                creature.LightColor  = Colors.ColorFrom8Bit(message.GetU8());
                creature.SetSkill(SkillTypes.Speed, message.GetU16());
                creature.SetPKFlag((PKFlags)message.GetU8());
                creature.SetPartyFlag((PartyFlags)message.GetU8());

                if (gameManager.GetFeature(GameFeatures.GameCreatureEmblems) && type == AppearanceInstance.UnknownCreature)
                {
                    creature.SetGuildFlag((GuildFlags)message.GetU8());
                }

                if (gameManager.GetFeature(GameFeatures.GameThingMarks))
                {
                    creature.Type = (CreatureTypes)message.GetU8();
                }

                // TODO, idk what version this respects to //
                //if (creature.IsSummon) {
                //    creature.SetSummonerID(message.GetU32());
                //} else {
                //    creature.SetSummonerID(0);
                //}

                if (gameManager.GetFeature(GameFeatures.GameCreatureIcons))
                {
                    creature.SetSpeechCategory((SpeechCategories)message.GetU8());
                }

                if (gameManager.GetFeature(GameFeatures.GameThingMarks))
                {
                    creature.Marks.SetMark(Appearances.Marks.MarkType_Permenant, message.GetU8());

                    // TODO insspection state
                    //message.GetU8(); // inspection state

                    creature.NumberOfPvPHelpers = message.GetU16();
                }

                if (gameManager.ClientVersion >= 854)
                {
                    creature.Unpassable = message.GetU8() != 0;
                }
                break;

            case AppearanceInstance.Creature:
                creature = m_CreatureStorage.GetCreature(message.GetU32());
                if (!creature)
                {
                    throw new System.Exception("ProtocolGame.ReadCreatureInstance: Known creature not found.");
                }

                creature.Direction = (Directions)message.GetU8();

                if (gameManager.ClientVersion >= 953)
                {
                    creature.Unpassable = message.GetU8() != 0;
                }
                break;

            default:
                throw new System.Exception("ProtocolGame.ReadCreatureInstance: unknown creature identity type.");
            }

            if (absolutePosition.HasValue)
            {
                creature.Position = absolutePosition.Value;
            }

            m_CreatureStorage.MarkOpponentVisible(creature, true);
            m_CreatureStorage.InvalidateOpponents();
            return(creature);
        }
Exemplo n.º 7
0
 public CharacterList(InputMessage message)
 {
     Parse(message);
 }
Exemplo n.º 8
0
        protected override void OnRecv(InputMessage message)
        {
            try {
                base.OnRecv(message);
            } catch (System.Exception e) {
                UnityEngine.Debug.LogWarning(e.Message);
            }

            OpenTibiaUnity.GameManager.InvokeOnMainThread(() => {
                while (message.CanRead(1))
                {
                    byte opcode = message.GetU8();
                    switch (opcode)
                    {
                    case LoginServerOpCodes.LoginRetry:
                        break;

                    case LoginServerOpCodes.LoginError:
                        string error = message.GetString();
                        onLoginError.Invoke(error);
                        break;

                    case LoginServerOpCodes.LoginTokenSuccess:
                        message.GetU8();     // Ok...
                        break;

                    case LoginServerOpCodes.LoginTokenError:
                        byte unknown = message.GetU8();
                        onLoginTokenError.Invoke(unknown);
                        break;

                    case LoginServerOpCodes.LoginMotd:
                        string[] motdinfo = message.GetString().Split('\n');
                        if (motdinfo.Length == 2)
                        {
                            int number;
                            int.TryParse(motdinfo[0], out number);
                            onMotd.Invoke(number, motdinfo[1]);
                        }
                        break;

                    case LoginServerOpCodes.UpdateRequired:
                        onUpdateRequired.Invoke();
                        break;

                    case LoginServerOpCodes.LoginSessionKey:
                        string sessionKey = message.GetString();
                        onSessionKey.Invoke(sessionKey);
                        break;

                    case LoginServerOpCodes.LoginCharacterList:
                        CharacterList characterList = new CharacterList(message);
                        onCharacterList.Invoke(characterList);
                        break;

                    default:
                        break;
                    }
                }
            });
        }
Exemplo n.º 9
0
 private void ParseLoginToken(InputMessage message)
 {
     /*byte unknown = */ message.GetU8();
 }
Exemplo n.º 10
0
        private bool ParsePacket(InputMessage message)
        {
            byte opcode = message.GetU8();

            switch (opcode)
            {
            // CUSTOM
            case 76:
                int size = message.GetU8();
                for (int i = 0; i < size; i++)
                {
                    message.GetString();
                    message.GetString();
                    message.GetU16();
                    message.GetU8();
                }

                size = message.GetU8();
                for (int i = 0; i < size; i++)
                {
                    int type = message.GetU8();
                    message.GetU32();
                    message.GetU32();
                    if (message.GetBool() != true)
                    {
                        if (message.GetBool() != true)
                        {
                            message.GetU32();
                        }
                    }

                    if (type == 0)
                    {
                        message.GetU32();
                        message.GetU32();

                        int size2 = message.GetU8();
                        for (int j = 0; j < size2; j++)
                        {
                            message.GetU16();
                            message.GetString();
                            message.GetU32();
                        }
                    }

                    message.GetString();
                    message.GetString();
                }

                break;
            // END CUSTOM

            case GameServerOpCodes.LoginOrPendingState:
                SendEnterGame();
                break;

            case GameServerOpCodes.GMActions:
                ParseGmActions(message);
                break;

            case GameServerOpCodes.WorldEntered:
                ParseWorldEntered(message);
                IsGameRunning = true;
                OpenTibiaUnity.GameManager.ProcessGameStart();
                break;

            case GameServerOpCodes.LoginError:
                ParseLoginError(message);
                break;

            case GameServerOpCodes.LoginAdvice:
                ParseLoginAdvice(message);
                break;

            case GameServerOpCodes.LoginWait:
                ParseLoginWait(message);
                break;

            case GameServerOpCodes.LoginSuccess:
                ParseLoginSuccess(message);
                break;

            case GameServerOpCodes.LoginToken:
                ParseLoginToken(message);
                break;

            case GameServerOpCodes.Ping:
                SendPingBack();
                break;

            case GameServerOpCodes.PingBack:
                SendPing();
                break;

            case GameServerOpCodes.Challenge:
                ParseChallange(message);
                break;

            case GameServerOpCodes.Death:
                ParseDeath(message);
                break;

            case GameServerOpCodes.OTClientOpcode:
                ParseOtclientExtendedOpcode(message);
                break;

            case GameServerOpCodes.FullMap:
                ParseFullMap(message);
                break;

            case GameServerOpCodes.MapTopRow:
                ParseMapTopRow(message);
                break;

            case GameServerOpCodes.MapRightRow:
                ParseMapRightRow(message);
                break;

            case GameServerOpCodes.MapBottomRow:
                ParseMapBottomRow(message);
                break;

            case GameServerOpCodes.MapLeftRow:
                ParseMapLeftRow(message);
                break;

            case GameServerOpCodes.FieldData:
                ParseFieldData(message);
                break;

            case GameServerOpCodes.CreateOnMap:
                ParseCreateOnMap(message);
                break;

            case GameServerOpCodes.ChangeOnMap:
                ParseChangeOnMap(message);
                break;

            case GameServerOpCodes.DeleteOnMap:
                ParseDeleteOnMap(message);
                break;

            case GameServerOpCodes.MoveCreature:
                ParseCreatureMove(message);
                break;

            case GameServerOpCodes.OpenContainer:
                ParseOpenContainer(message);
                break;

            case GameServerOpCodes.CloseContainer:
                ParseCloseContainer(message);
                break;

            case GameServerOpCodes.CreateContainer:
                ParseContainerAddItem(message);
                break;

            case GameServerOpCodes.ChangeInContainer:
                ParseContainerUpdateItem(message);
                break;

            case GameServerOpCodes.DeleteInContainer:
                ParseContainerRemoveItem(message);
                break;

            case GameServerOpCodes.SetInventory:
                ParseSetInventory(message);
                break;

            case GameServerOpCodes.DeleteInventory:
                ParseDeleteInventory(message);
                break;

            case GameServerOpCodes.AmbientLight:
                ParseAmbientLight(message);
                break;

            case GameServerOpCodes.GraphicalEffect:
                ParseGraphicalEffect(message);
                break;

            case GameServerOpCodes.MissleEffect:
                ParseMissleEffect(message);
                break;

            case GameServerOpCodes.CreatureHealth:
                ParseCreatureHealth(message);
                break;

            case GameServerOpCodes.CreatureLight:
                ParseCreatureLight(message);
                break;

            case GameServerOpCodes.CreatureOutfit:
                ParseCreatureOutfit(message);
                break;

            case GameServerOpCodes.CreatureSpeed:
                ParseCreatureSpeed(message);
                break;

            case GameServerOpCodes.CreatureSkull:
                ParseCreatureSkull(message);
                break;

            case GameServerOpCodes.CreatureShield:
                ParseCreatureShield(message);
                break;

            case GameServerOpCodes.CreatureUnpass:
                ParseCreatureUnpass(message);
                break;

            case GameServerOpCodes.CreatureMarks:
                ParseCreatureMarks(message);
                break;

            case GameServerOpCodes.PlayerHelpers:
                ParsePlayerHelpers(message);
                break;

            case GameServerOpCodes.CreatureType:
                ParseCreatureType(message);
                break;

            case GameServerOpCodes.PlayerBlessings:
                ParsePlayerBlessings(message);
                break;

            case GameServerOpCodes.PlayerBasicData:
                ParseBasicData(message);
                break;

            case GameServerOpCodes.PlayerStats:
                ParsePlayerStats(message);
                break;

            case GameServerOpCodes.PlayerSkills:
                ParsePlayerSkills(message);
                break;

            case GameServerOpCodes.PlayerStates:
                ParsePlayerStates(message);
                break;

            case GameServerOpCodes.ClearTarget:
                ParseClearTarget(message);
                break;

            case GameServerOpCodes.SetTactics:
                ParseSetTactics(message);
                break;

            case GameServerOpCodes.Talk:
                ParseTalk(message);
                break;

            case GameServerOpCodes.Channels:
                ParseChannels(message);
                break;

            case GameServerOpCodes.OpenChannel:
                ParseOpenChannel(message);
                break;

            case GameServerOpCodes.PrivateChannel:
                ParsePrivateChannel(message);
                break;

            case GameServerOpCodes.OpenOwnChannel:
                ParseOpenOwnChannel(message);
                break;

            case GameServerOpCodes.CloseChannel:
                ParseCloseChannel(message);
                break;

            case GameServerOpCodes.TextMessage:
                ParseTextMessage(message);
                break;

            case GameServerOpCodes.CancelWalk:
                ParseCancelWalk(message);
                break;

            case GameServerOpCodes.TopFloor:
                ParseMapTopFloor(message);
                break;

            case GameServerOpCodes.BottomFloor:
                ParseMapBottomFloor(message);
                break;

            case GameServerOpCodes.TrackedQuestFlags:
                ParseTrackedQuestFlags(message);
                break;

            case GameServerOpCodes.VipAdd:
                ParseVipAdd(message);
                break;

            case GameServerOpCodes.VipState:
                ParseVipState(message);
                break;

            case GameServerOpCodes.VipLogout:
                ParseVipLogout(message);
                break;

            case GameServerOpCodes.PreyFreeListRerollAvailability:
                ParsePreyFreeListRerollAvailability(message);
                break;

            case GameServerOpCodes.PreyTimeLeft:
                ParsePreyTimeLeft(message);
                break;

            case GameServerOpCodes.PreyData:
                ParsePreyData(message);
                break;

            case GameServerOpCodes.PreyRerollPrice:
                ParsePreyRerollPrice(message);
                break;

            case GameServerOpCodes.ResourceBalance:
                ParsePlayerResource(message);
                break;

            case GameServerOpCodes.ChannelEvent:
                ParseChannelEvent(message);
                break;

            case GameServerOpCodes.PlayerInventory:
                ParsePlayerInventory(message);
                break;

            default:
                string err = string.Format("<ProtocolGame> Unknown Opcode received ({0}). Last Opcode ({1}). Prev Opcode ({2})", opcode, m_LastOpcode, m_PrevOpcode);
                m_ChatStorage.AddDebugMessage(err);
                return(false);
            }

            m_PrevOpcode = m_LastOpcode;
            m_LastOpcode = opcode;
            return(true);
        }
Exemplo n.º 11
0
 private void ParseLoginWait(InputMessage message)
 {
     string waitMessage = message.GetString();
     int    time        = message.GetU8();
 }
Exemplo n.º 12
0
 private void ParseLoginAdvice(InputMessage message)
 {
     string messageStr = message.GetString();
 }
Exemplo n.º 13
0
 private void ParseLoginError(InputMessage message)
 {
     string error = message.GetString();
 }
Exemplo n.º 14
0
        private void ParsePlayerStats(InputMessage message)
        {
            int ticks = OpenTibiaUnity.TicksMillis;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameDoubleHealth))
            {
                uint health    = message.GetU32();
                uint maxHealth = message.GetU32();
                m_Player.SetSkill(SkillTypes.Health, (int)health, (int)maxHealth, 0);
            }
            else
            {
                int health    = message.GetU16();
                int maxHealth = message.GetU16();
                m_Player.SetSkill(SkillTypes.Health, health, maxHealth, 0);
            }

            int freeCapacity;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameDoubleFreeCapacity))
            {
                freeCapacity = message.GetS32();
            }
            else
            {
                freeCapacity = message.GetS16();
            }

            int totalCapacity = 0;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameTotalCapacity))
            {
                totalCapacity = message.GetS32();
            }

            m_Player.SetSkill(SkillTypes.Capacity, freeCapacity, totalCapacity, 0);

            long experience;

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameDoubleExperience))
            {
                experience = message.GetS64();
            }
            else
            {
                experience = message.GetS32();
            }

            m_Player.SetSkill(SkillTypes.Experience, (int)experience, 1, 0);

            ushort level        = message.GetU16();
            byte   levelPercent = message.GetU8();

            m_Player.SetSkill(SkillTypes.Level, level, 1, levelPercent);

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameExperienceBonus))
            {
                float baseXpGain         = message.GetU16() / 100f;
                float voucherAddend      = message.GetU16() / 100f;
                float grindingAddend     = message.GetU16() / 100f;
                float storeBoostAddend   = message.GetU16() / 100f;
                float huntingBoostFactor = message.GetU16() / 100f;
                m_Player.ExperienceGainInfo.UpdateGainInfo(baseXpGain, voucherAddend, grindingAddend, storeBoostAddend, huntingBoostFactor);
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameDoubleHealth))
            {
                uint mana    = message.GetU32();
                uint maxMana = message.GetU32();
                m_Player.SetSkill(SkillTypes.Mana, (int)mana, (int)maxMana, 0);
            }
            else
            {
                int mana    = message.GetU16();
                int maxMana = message.GetU16();
                m_Player.SetSkill(SkillTypes.Mana, mana, maxMana, 0);
            }

            byte magicLevel        = message.GetU8();
            byte baseMagicLevel    = OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameSkillsBase) ? message.GetU8() : magicLevel;
            byte magicLevelPercent = message.GetU8();

            m_Player.SetSkill(SkillTypes.MagLevel, magicLevel, baseMagicLevel, magicLevelPercent);

            int soul = message.GetU8();

            m_Player.SetSkill(SkillTypes.SoulPoints, soul, 1, 0);

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GamePlayerStamina))
            {
                int stamina = ticks + 60000 * message.GetU16();
                m_Player.SetSkill(SkillTypes.Stamina, stamina, ticks, 0);
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameSkillsBase))
            {
                ushort baseSpeed = message.GetU16();
                m_Player.SetSkill(SkillTypes.Speed, m_Player.GetSkillValue(SkillTypes.Speed), baseSpeed, 0);
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GamePlayerRegenerationTime))
            {
                int regeneration = ticks + 60000 * message.GetU16();
                m_Player.SetSkill(SkillTypes.Food, regeneration, ticks, 0);
            }

            if (OpenTibiaUnity.GameManager.GetFeature(GameFeatures.GameOfflineTrainingTime))
            {
                int training = ticks + 60000 * message.GetU16();
                m_Player.SetSkill(SkillTypes.OfflineTraining, training, ticks, 0);

                if (OpenTibiaUnity.GameManager.ClientVersion >= 1097)
                {
                    uint remainingSeconds   = message.GetU16();
                    bool canBuyMoreXpBoosts = message.GetBool();
                    m_Player.ExperienceGainInfo.UpdateStoreXpBoost(remainingSeconds, canBuyMoreXpBoosts);
                }
            }
        }
Exemplo n.º 15
0
        private void ParseDeleteInventory(InputMessage message)
        {
            int slot = message.GetU8();

            OpenTibiaUnity.ContainerStorage.BodyContainerView.SetObject((ClothSlots)slot, null);
        }