Example #1
0
        protected IEnumerator LearnSkill(Coroutine co, ObjPlayer player)
        {
            var skillId = -1;

            if (player.GetSimpleData().TypeId == 0) //战士
            {
                skillId = 30;
            }
            else if (player.GetSimpleData().TypeId == 1) //法师
            {
                skillId = 133;
            }
            else if (player.GetSimpleData().TypeId == 2) // 弓手
            {
                skillId = 231;
            }

            if (skillId == -1)
            {
                yield break;
            }


            var msg = SceneServer.Instance.LogicAgent.SSLearnSkill(player.ObjId, skillId, 1);

            yield return(msg.SendAndWaitUntilDone(co));

            if (msg.State != MessageState.Reply)
            {
                Logger.Error("SSLearnSkill Xp Failed 1");
                yield break;
            }
            if (msg.ErrorCode != (int)ErrorCodes.OK)
            {
                Logger.Error("SSLearnSkill Xp Failed 2");
                yield break;
            }

            // 加buff  发消息包触发引导
            player.Proxy.NotifyStartXpSkillGuide(0);

            PushActionToAllObj(obj =>
            {
                var tempNpc = obj as ObjNPC;
                if (tempNpc == null)
                {
                    return;
                }
                if (!tempNpc.IsMonster())
                {
                    return;
                }

                tempNpc.AddBuff(buffId, 1, tempNpc);
            });

            yield break;
        }