コード例 #1
0
        public void setDirector(string directorType, bool sendPackets)
        {
            if (directorType.Equals("openingDirector"))
            {
                currentDirector = new OpeningDirector(this, 0x46080012);
            }
            else if (directorType.Equals("QuestDirectorMan0l001"))
            {
                currentDirector = new QuestDirectorMan0l001(this, 0x46080012);
            }
            else if (directorType.Equals("QuestDirectorMan0g001"))
            {
                currentDirector = new QuestDirectorMan0g001(this, 0x46080012);
            }
            else if (directorType.Equals("QuestDirectorMan0u001"))
            {
                currentDirector = new QuestDirectorMan0u001(this, 0x46080012);
            }

            if (sendPackets)
            {
                queuePacket(RemoveActorPacket.buildPacket(actorId, 0x46080012));
                queuePacket(currentDirector.getSpawnPackets(actorId));
                queuePacket(currentDirector.getInitPackets(actorId));
                //queuePacket(currentDirector.getSetEventStatusPackets(actorId));
                //currentDirector.getSpawnPackets(actorId).debugPrintPacket();
                //currentDirector.getInitPackets(actorId).debugPrintPacket();
            }
        }
コード例 #2
0
        public void updateInstance(List <Actor> list)
        {
            List <BasePacket> basePackets           = new List <BasePacket>();
            List <SubPacket>  removeActorSubpackets = new List <SubPacket>();
            List <SubPacket>  posUpdateSubpackets   = new List <SubPacket>();

            //Remove missing actors
            for (int i = 0; i < actorInstanceList.Count; i++)
            {
                if (!list.Contains(actorInstanceList[i]))
                {
                    getActor().queuePacket(RemoveActorPacket.buildPacket(playerActor.actorId, actorInstanceList[i].actorId));
                    actorInstanceList.RemoveAt(i);
                }
            }

            //Add new actors or move
            for (int i = 0; i < list.Count; i++)
            {
                Actor actor = list[i];

                if (actor.actorId == playerActor.actorId)
                {
                    continue;
                }

                if (actorInstanceList.Contains(actor))
                {
                    getActor().queuePacket(actor.createPositionUpdatePacket(playerActor.actorId));
                }
                else
                {
                    getActor().queuePacket(actor.getSpawnPackets(playerActor.actorId, 1));
                    getActor().queuePacket(actor.getInitPackets(playerActor.actorId));
                    getActor().queuePacket(actor.getSetEventStatusPackets(playerActor.actorId));
                    actorInstanceList.Add(actor);

                    if (actor is Npc)
                    {
                        LuaEngine.doActorOnSpawn(getActor(), (Npc)actor);
                    }
                }
            }
        }