Exemple #1
0
 public Samurai_ChargeState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_ChargeState stateData, EnemySamurai enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
Exemple #2
0
            public ZoneEntities(byte[] data)
            {
                Data = data;

                using (BinaryReader br = new BinaryReader(new MemoryStream(data)))
                {
                    Length = br.ReadUInt32();
                    Furniture = new EntityFurniture[br.ReadByte()];
                    NPCs = new EntityNPC[br.ReadByte()];
                    Warps = new EntityWarp[br.ReadByte()];
                    Triggers = new EntityTrigger[br.ReadByte()];
                    for (int i = 0; i < Furniture.Length; i++)
                        Furniture[i] = new EntityFurniture(br.ReadBytes(Furniture.Length));
                    for (int i = 0; i < NPCs.Length; i++)
                        NPCs[i] = new EntityNPC(br.ReadBytes(NPCs.Length));
                    for (int i = 0; i < Warps.Length; i++)
                        Warps[i] = new EntityWarp(br.ReadBytes(Warps.Length));
                    for (int i = 0; i < Triggers.Length; i++)
                        Triggers[i] = new EntityTrigger(br.ReadBytes(Triggers.Length));
                    ScriptData = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position));
                }
            }
 public Martial_MoveState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_MoveState stateData, AllyMartial ally) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.ally = ally;
 }
Exemple #4
0
    protected override Vector3 GetPosition(EntityNPC ownerNPC, List <Vector2> usedPOILocations, int entityIDforQuests)
    {
        if (base.OwnerQuest.GetPositionData(out this.position, Quest.PositionDataTypes.POIPosition))
        {
            base.OwnerQuest.Position = this.position;
            Vector3 distanceOffset;
            base.OwnerQuest.GetPositionData(out distanceOffset, Quest.PositionDataTypes.POISize);
            this.SetDistanceOffset(distanceOffset);
            this.positionSet = true;
            base.OwnerQuest.HandleMapObject(Quest.PositionDataTypes.POIPosition, this.icon);
            base.CurrentValue = 2;
            return(this.position);
        }

        EntityAlive entityAlive = ownerNPC;

        if (ownerNPC == null)
        {
            entityAlive = base.OwnerQuest.OwnerJournal.OwnerPlayer;
        }

        Debug.Log("GetPosition");
        // if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
        {
            Debug.Log("Running on Server");
            //PrefabInstance randomPOINearWorldPos = GetRandomPOINearWorldPos(new Vector2(entityAlive.position.x, entityAlive.position.z), 1000, 50000000, base.OwnerQuest.QuestTags, base.OwnerQuest.QuestClass.DifficultyTier, usedPOILocations, entityIDforQuests);
            PrefabInstance randomPOINearWorldPos = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetPOIPrefabs().Find(instance => instance.filename == this.strPOIname);

            if (randomPOINearWorldPos != null)
            {
                Debug.Log("Random POI Near World Pos is not null");
                Vector2 vector = new Vector2((float)randomPOINearWorldPos.boundingBoxPosition.x + (float)randomPOINearWorldPos.boundingBoxSize.x / 2f, (float)randomPOINearWorldPos.boundingBoxPosition.z + (float)randomPOINearWorldPos.boundingBoxSize.z / 2f);
                if (vector.x == -0.1f && vector.y == -0.1f)
                {
                    return(Vector3.zero);
                }
                int num  = (int)vector.x;
                int num2 = (int)entityAlive.position.y;
                int num3 = (int)vector.y;
                this.position = new Vector3((float)num, (float)num2, (float)num3);
                if (GameManager.Instance.World.IsPositionInBounds(this.position))
                {
                    Debug.Log("Position is in bounds");
                    base.OwnerQuest.Position = this.position;
                    base.FinalizePoint(new Vector3((float)randomPOINearWorldPos.boundingBoxPosition.x, (float)randomPOINearWorldPos.boundingBoxPosition.y, (float)randomPOINearWorldPos.boundingBoxPosition.z), new Vector3((float)randomPOINearWorldPos.boundingBoxSize.x, (float)randomPOINearWorldPos.boundingBoxSize.y, (float)randomPOINearWorldPos.boundingBoxSize.z));
                    base.OwnerQuest.QuestPrefab = randomPOINearWorldPos;
                    base.OwnerQuest.DataVariables.Add("POIName", base.OwnerQuest.QuestPrefab.filename);
                    if (usedPOILocations != null)
                    {
                        Debug.Log("Adding to used POI Location.");
                        usedPOILocations.Add(new Vector2((float)randomPOINearWorldPos.boundingBoxPosition.x, (float)randomPOINearWorldPos.boundingBoxPosition.z));
                    }
                    base.OwnerQuest.HandleMapObject(Quest.PositionDataTypes.POIPosition, this.icon);
                    Debug.Log("Returning Position: " + this.position);
                    return(this.position);
                }
            }
            else
            {
                Debug.Log("Random POI Near World Pos is not null");
            }
        }
        //else
        //{
        //    Debug.Log("Server is client.");

        //    SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageQuestGotoPoint>().Setup(entityAlive.entityId, base.OwnerQuest.QuestTags, base.OwnerQuest.QuestCode, NetPackageQuestGotoPoint.QuestGotoTypes.RandomPOI, base.OwnerQuest.QuestClass.DifficultyTier, 0, -1, 0f, 0f, 0f, -1),false);
        //    base.CurrentValue = 1;
        //}
        return(Vector3.zero);
    }
 public AttackState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName) : base(entity, stateMachine, animBoolName)
 {
 }
Exemple #6
0
 public Archer_DodgeState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_DodgeState stateData, EnemyArcher enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
Exemple #7
0
 public StunState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_StunState stateData) : base(entity, stateMachine, animBoolName)
 {
     this.stateData = stateData;
 }
 public Skeleton_MeleeAttackState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_MeleeAttackState stateData, EnemySkeleton enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
Exemple #9
0
            public ZoneEntities(byte[] data)
            {
                Data = data;

                using (BinaryReader br = new BinaryReader(new MemoryStream(data)))
                {
                    // Load Header
                    Length = br.ReadInt32();
                    Furniture = new EntityFurniture[FurnitureCount = br.ReadByte()];
                    NPCs = new EntityNPC[NPCCount = br.ReadByte()];
                    Warps = new EntityWarp[WarpCount = br.ReadByte()];
                    Triggers1 = new EntityTrigger1[TriggerCount = br.ReadByte()];
                    Triggers2 = new EntityTrigger2[UnknownCount = br.ReadInt32()]; // not sure if there's other types or if the remaining 3 bytes are padding.

                    // Load Entitites
                    for (int i = 0; i < FurnitureCount; i++)
                        Furniture[i] = new EntityFurniture(br.ReadBytes(EntityFurniture.Size));
                    for (int i = 0; i < NPCCount; i++)
                        NPCs[i] = new EntityNPC(br.ReadBytes(EntityNPC.Size));
                    for (int i = 0; i < WarpCount; i++)
                        Warps[i] = new EntityWarp(br.ReadBytes(EntityWarp.Size));
                    for (int i = 0; i < TriggerCount; i++)
                        Triggers1[i] = new EntityTrigger1(br.ReadBytes(EntityTrigger1.Size));
                    for (int i = 0; i < UnknownCount; i++)
                        Triggers2[i] = new EntityTrigger2(br.ReadBytes(EntityTrigger2.Size));

                    // Load Script Data
                    int len = br.ReadInt32();
                    br.BaseStream.Position -= 4;
                    Script = new Script(br.ReadBytes(len));
                }
            }
 public Skeleton_PlayerDetectedState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_PlayerDetectedState stateData, EnemySkeleton enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
Exemple #11
0
    protected override Vector3 GetPosition(EntityNPC ownerNPC = null, EntityPlayer entityPlayer = null, List <Vector2> usedPOILocations = null, int entityIDforQuests = -1)
    {
        if (base.OwnerQuest.GetPositionData(out this.position, Quest.PositionDataTypes.POIPosition))
        {
            Vector3 vector;
            base.OwnerQuest.GetPositionData(out vector, Quest.PositionDataTypes.POISize);
            Vector2 vector2 = new Vector2(this.position.x + vector.x / 2f, this.position.z + vector.z / 2f);
            int     num     = (int)vector2.x;
            int     num2    = (int)vector2.y;
            int     num3    = (int)GameManager.Instance.World.GetHeightAt(vector2.x, vector2.y);
            this.position            = new Vector3((float)num, (float)num3, (float)num2);
            base.OwnerQuest.Position = this.position;
            this.SetDistanceOffset(vector);
            this.positionSet = true;
            base.OwnerQuest.HandleMapObject(Quest.PositionDataTypes.POIPosition, this.NavObjectName, -1);
            base.CurrentValue = 2;
            return(this.position);
        }

        EntityAlive entityAlive = ownerNPC;

        if (ownerNPC == null)
        {
            entityAlive = base.OwnerQuest.OwnerJournal.OwnerPlayer;
        }

        if (SingletonMonoBehaviour <ConnectionManager> .Instance.IsServer)
        {
            PrefabInstance randomPOINearWorldPos = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetPOIPrefabs().Find(instance => instance.name.Contains(this.strPOIname));

            if (randomPOINearWorldPos != null)
            {
                Vector2 vector = new Vector2((float)randomPOINearWorldPos.boundingBoxPosition.x + (float)randomPOINearWorldPos.boundingBoxSize.x / 2f, (float)randomPOINearWorldPos.boundingBoxPosition.z + (float)randomPOINearWorldPos.boundingBoxSize.z / 2f);
                if (vector.x == -0.1f && vector.y == -0.1f)
                {
                    return(Vector3.zero);
                }

                int num  = (int)vector.x;
                int num2 = (int)entityAlive.position.y;
                int num3 = (int)vector.y;
                this.position = new Vector3((float)num, (float)num2, (float)num3);
                if (GameManager.Instance.World.IsPositionInBounds(this.position))
                {
                    base.OwnerQuest.Position = this.position;
                    base.FinalizePoint(new Vector3((float)randomPOINearWorldPos.boundingBoxPosition.x, (float)randomPOINearWorldPos.boundingBoxPosition.y, (float)randomPOINearWorldPos.boundingBoxPosition.z), new Vector3((float)randomPOINearWorldPos.boundingBoxSize.x, (float)randomPOINearWorldPos.boundingBoxSize.y, (float)randomPOINearWorldPos.boundingBoxSize.z));
                    base.OwnerQuest.QuestPrefab = randomPOINearWorldPos;
                    base.OwnerQuest.DataVariables.Add("POIName", base.OwnerQuest.QuestPrefab.name);
                    if (usedPOILocations != null)
                    {
                        usedPOILocations.Add(new Vector2((float)randomPOINearWorldPos.boundingBoxPosition.x, (float)randomPOINearWorldPos.boundingBoxPosition.z));
                    }

                    base.OwnerQuest.HandleMapObject(Quest.PositionDataTypes.POIPosition, this.NavObjectName, -1);
                    return(this.position);
                }
            }
        }
        else
        {
            SingletonMonoBehaviour <ConnectionManager> .Instance.SendToServer(NetPackageManager.GetPackage <NetPackageQuestGotoPoint>().Setup(entityAlive.entityId, base.OwnerQuest.QuestTags, base.OwnerQuest.QuestCode, NetPackageQuestGotoPoint.QuestGotoTypes.RandomPOI, base.OwnerQuest.QuestClass.DifficultyTier, 0, -1, 0f, 0f, 0f, -1f, this.biomeFilterType, this.strPOIname), false);

            base.CurrentValue = 1;
        }
        return(Vector3.zero);
    }
Exemple #12
0
 private static void ProcessEntityNpc(EntityNPC entity)
 {
     Log.Out($"{Config.ModPrefix} Spawn Detected:{GetClassName(entity)}[{entity.entityId}]({entity.GetType()})@{(int)entity.position.x} {(int)entity.position.y} {(int)entity.position.z}");
 }
Exemple #13
0
 public Samurai_AttackSword3(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_MeleeAttackState stateData, EnemySamurai enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }