Example #1
0
        void processSelectedAction(CreatureActions externalAction)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            if (worldServer != null && worldServer.IsConnected)
            {
                switch (externalAction)
                {
                case CreatureActions.DO_NOTHING:
                    // Do nothing as the own value says
                    break;

                case CreatureActions.ROTATE_CLOCKWISE:
                    worldServer.SendSetAngle(creatureId, 2, -2, 2);
                    break;

                case CreatureActions.GET_JEWEL:
                    worldServer.SendSackIt(creatureId, jewelToGet.Name);
                    break;

                case CreatureActions.GET_FOOD:
                    worldServer.SendEatIt(creatureId, foodToGet.Name);
                    break;

                case CreatureActions.GO_TO_JEWEL:
                    worldServer.SendSetAngle(creatureId, 0, 0, prad);
                    worldServer.SendSetGoTo(creatureId, 2, 2, jewelToGoTo.X1, jewelToGoTo.Y1);
                    break;

                case CreatureActions.GO_TO_FOOD:
                    worldServer.SendSetAngle(creatureId, 0, 0, prad);
                    worldServer.SendSetGoTo(creatureId, 2, 2, foodToGoTo.X1, foodToGoTo.Y1);
                    break;

                case CreatureActions.WANDER:
                    worldServer.SendSetAngle(creatureId, 2, -2, 2);
                    break;

                case CreatureActions.GO_TO_DELIVER:
                    // Send creature to the delivery spot.
                    worldServer.SendSetAngle(creatureId, 0, 0, prad);
                    worldServer.SendSetGoTo(creatureId, 2, 2, deliverySpot.X1, deliverySpot.Y1);
                    break;

                case CreatureActions.DELIVER:
                    // Deliver jewels
                    worldServer.SendDeliver(creatureId, leaflet1Id);
                    worldServer.SendDeliver(creatureId, leaflet2Id);
                    worldServer.SendDeliver(creatureId, leaflet3Id);
                    worldServer.SendStopCreature(creatureId);
                    // Delete the Agent
                    Abort(true);
                    break;

                default:
                    break;
                }
            }
        }