Beispiel #1
0
 internal void SetInfo(int aid, NpcSvrNpcInfo npcInfo)
 {
     Id      = aid;
     Type    = npcInfo.Type;
     Name    = npcInfo.Name;
     NpcType = npcInfo.NpcType;
     Mapname = npcInfo.Zone;
 }
Beispiel #2
0
        private int FuncNpc2(NpcSvrNpcInfo npcInfo)
        {
            // find zone by map
            var aid = id++;

            _npcId = aid;
            var npc = NpcMgr.Add(aid);

            npc.SetInfo(aid, npcInfo);
            ScriptEventHandler.AddNpc(aid, npcInfo, npcInfo.Zone);
            return(aid);
        }
Beispiel #3
0
        public override bool OnFunc(int func, Deque <TokenData> parm, ref TokenData ret)
        {
            switch (func)
            {
            case (int)Std._return:
                return(true);

            case (int)Std.trace:
                return(FuncTrace(parm[0].GetStr()));

            case (int)Std.rand:     // trace
                return(true);

            case (int)Std.lot:     // lot
                return(FuncLot(parm[0].GetNum(), parm[1].GetNum()));

            case (int)Std.OnInit:     // OnInit
                return(FuncLabel(NPCACTION.ONINIT, parm));

            case (int)Std.OnClick:     // OnClick
                return(FuncLabel(NPCACTION.ONCLICK, parm));

            case (int)Std.OnTouch:     // OnTouch
                return(FuncLabel(NPCACTION.ONTOUCH, parm));

            case (int)Std.OnMyMobDead:     // OnMyMobDead
                return(FuncLabel(NPCACTION.ONMYMOBDEAD, parm));

            case (int)Std.OnTimer:     // OnTimer
                return(FuncLabel(NPCACTION.ONTIMER, parm));

            case (int)Std.OnCommand:     // OnCommand
                return(FuncLabel(NPCACTION.ONCOMMAND, parm));

            case (int)Std.OnStartArena:     // OnStartArena
                return(FuncLabel(NPCACTION.ONSTARTARENA, parm));

            case (int)Std.OnTouchNPC:     // OnTouchNPC
                return(FuncLabel(NPCACTION.ONTOUCHNPC, parm));

            case (int)Std.OnTouch2:     // OnTouch2
                return(FuncLabel(NPCACTION.ONTOUCH2, parm));

            case (int)Std.OnMoveNpcCmd_XXX:     // OnMoveNpcCmd:_XXX
                return(FuncLabel(NPCACTION.ONMOVENPCCMD, parm));

            case (int)Std.OnCampCommand:     // OnCampCommand
                return(FuncLabel(NPCACTION.ONCAMPCOMMAND, parm));

            case (int)Std.OnCampCommand2:     // OnCampCommand2
                return(FuncLabel(NPCACTION.ONCAMPCOMMAND2, parm));

            case (int)Std.OnAgitInvest:     // OnAgitInvest
                return(FuncLabel(NPCACTION.ONAGITINVEST, parm));

            case (int)Std.OnMyMobDead_NPC:     // OnMyMobDead_NPC
                return(FuncLabel(NPCACTION.ONMYMOBDEAD_NPC, parm));

            case (int)Std.OnPlayerDead:     // OnPlayerDead
                return(FuncLabel(NPCACTION.ONPLAYERDEAD, parm));

            case (int)Std.npc:     // npc
            {
                var npcInfo = new NpcSvrNpcInfo
                {
                    Zone      = parm[0].GetStr(),
                    Name      = parm[1].GetStr(),
                    Sprite    = parm[2].GetNum(),
                    X         = parm[3].GetNum(),
                    Y         = parm[4].GetNum(),
                    Direction = parm[5].GetNum(),
                    W         = parm[6].GetNum(),
                    H         = parm[7].GetNum()
                };
                return(FuncNpc(npcInfo));
            }

            case (int)Std.mob:
                return(true);

            case (int)Std.warp:
            {
                var npcInfo = new NpcSvrNpcInfo
                {
                    Zone = parm[0].GetStr(),
                    Name = parm[1].GetStr(),
                    X    = parm[2].GetNum(),
                    Y    = parm[3].GetNum(),
                    W    = parm[4].GetNum(),
                    H    = parm[5].GetNum()
                };
                return(FuncNpc(npcInfo));
            }

            case (int)Std.dialog:
                Debug.Print($"dialog \"{parm[0].GetStr()}\"");
                return(true);

            case (int)Std.moveto:
                return(true);

            case (int)Std.wait:
                _waitType = 1;
                _waitTime = DateTime.UtcNow.AddMinutes(1);
                return(true);

            case (int)Std.close:
                return(true);

            case (int)Std.checkpoint:
                return(true);

            case (int)Std.DisableItemMove:
                return(FuncDisableItemMove());

            case (int)Std.EnableItemMove:
                return(FuncEnableItemMove());
            }

            //bool result = false;
            //if (_npcId != null)
            //    result = DefaultNpcFunc(_npcId, parm, func, ret);
            //else
            //    result = GlobalFunc(func, parm, v4, ret);

            Debug.Print($"Missing function: {func.ToString()}");
            return(true);
        }
Beispiel #4
0
 private bool FuncNpc(NpcSvrNpcInfo npcInfo)
 {
     return(FuncNpc2(npcInfo) >= 1);
 }