Exemplo n.º 1
0
void drain(void)
{
    int sp_drain = random(5) + 1;

    if(shining)
    {
        if(ENV(TO) != user)
        {
            tell_object(ENV(TO),"The stone stops shining.\n");
            darken();
            return;
        }

        if(sp_drain > user->query_spell_points())
        {
            tell_object(user,"The stone grows dark as you have no more "+
                        "power to channel into it.\n");
            darken();
            return;
        }

        tell_object(user,"You channel some power into the stone to keep "+
                    "it shining.\n");
        user->reduce_spell_points(sp_drain);
        set_alarm(300.0 + itof(random(120)),0.0,"drain");
    }
}
Exemplo n.º 2
0
Arquivo: apkenv.c Projeto: thp/apkenv
static void *
read_file_to_jni_array_impl(const char *filename)
{
    char *buffer = NULL;
    size_t size = 0;

    if (apk_read_file(global.apklib_handle, filename, &buffer, &size) == APK_OK) {
        if(!global.use_dvm)
        {
            struct dummy_array *array = NULL;
            array = malloc(sizeof(*array));
            if (array == NULL)
                return NULL;
            array->data = buffer;
            array->length = size;
            array->element_size = 1;

            return array;
        }
        else
        {
            const struct JNINativeInterface *env = global._env->functions;
            jarray *array = env->NewByteArray(ENV((&global)), size);
            jbyte *elements = env->GetByteArrayElements(ENV((&global)), array, 0);
            memcpy(elements, buffer, size);
            free(buffer);
            env->ReleaseByteArrayElements(ENV((&global)), array, elements, JNI_ABORT);

            return array;
        }
    }

    return NULL;
}
Exemplo n.º 3
0
Arquivo: maps.c Projeto: felipensp/px
/**
 * Deallocs memory used to the mapped regions
 */
void px_maps_clear(void)
{
	if (ENV(maps) != NULL) {
		free(ENV(maps));
		ENV(maps) = NULL;
	}
	ENV(nregions) = 0;
}
Exemplo n.º 4
0
static void mnpc_create()
{
  if (PO && member(inherit_list(PO), "/std/room.c")!=-1)
    Set(MNPC_HOME, object_name(PO));
  else if (PL && ENV(PL))
    Set(MNPC_HOME, object_name(ENV(PL)));
  else Set(MNPC_HOME, MNPC_DFLT_HOME);
  Set(P_MNPC, 1);
  Set(MNPC_AREA, ({}));
Exemplo n.º 5
0
void clear(void)
{
    tell_room(ENV(TO),"The smoke clears and you can see again.\n");
    // Set the long, short and skip_obvious back to what it was before
    ENV(TO)->set_short(short_desc);
    ENV(TO)->set_long(long_desc);
    ENV(TO)->set_skip_obvious(skip_obvious);
    destroy();
}
Exemplo n.º 6
0
static int
decode_string(void* ctx, const unsigned char* data, unsigned int size)
{
    ErlNifBinary bin;
    if(!enif_alloc_binary_compat(ENV(ctx), size, &bin))
    {
        return CANCEL;
    }
    memcpy(bin.data, data, size);
    add_to_head(ctx, enif_make_binary(ENV(ctx), &bin));
    return CONTINUE;
}
Exemplo n.º 7
0
int do_build(string str)
{
    object carrot = present("_scarecrow_quest_carrot_",TP),
           hay = present("_scarecrow_quest_hay_",TP),
           pumpkin = present("_scarecrow_quest_pumpkin_",TP),
           scarecrow;

    if(str == "scarecrow")
    {
        if(!carrot || !hay || !pumpkin)
        {
            W("You don't have everything you need to build a scarecrow. " +
              "You need enough hay to make the body, a suitable pumpkin " +
              "for the head and a suitable carrot for the nose.\n");
            return 1;
        }
        else if(!ENV(TP)->query_is_quest_shed())
        {
            W("You need to find a place where there are appropriate tools " +
              "for the job before you can make a scarecrow.\n");
            return 1;
        }
        W("You grab a rake and break it into sticks. You tie them " +
          "together with a leather strap you get from a hook on the " +
          "wall. You tie the hay to the frame and stick the pumpkin on " +
          "top of it. As a finishing touch, you stick the carrot into " +
          "the pumpkin to make a nose. You've just made a scarecrow!\n");
        S(TP->QN + " breaks a rake into twigs and grabs a leather " +
          "strap to tie them together, ties some hay to the frame, sticks " +
          "a pumpkin on top and, as a finishing touch, sticks a carrot " +
          "into the pumpking to make a nose.\n" + TP->QN + " has just " +
          "made a scarecrow!\n");
        scarecrow = make(OBJECT + "scarecrow",ENV(TP));

        // Things mess up here if we just destroy them, one item stays
        // in inventory sometimes, not always. So we use a junk room
        // where they're destroyed with a short delay instead so this
        // function has time to do what it's supposed to first
        transfer(carrot,ROOM + "dest_room");
        transfer(hay,ROOM + "dest_room");
        transfer(pumpkin,ROOM + "dest_room");

        if(transfer(scarecrow,TP))
        {
            W("It is too heavy for you to carry though.\n");
            S(TP->QN + " doesn't seem to be able to carry the " +
              "scarecrow.\n");
        }
        return 1;
    }
    return notify_fail(C(query_verb()) + " what?\n");
}
Exemplo n.º 8
0
Arquivo: maps.c Projeto: felipensp/px
/**
 * Finds a mapped region by address
 */
int px_maps_find_region(uintptr_t addr)
{
	int i = 0;

	while (i < ENV(nregions)) {
		if (ENV(maps)[i].start <= addr && ENV(maps)[i].end >= addr) {
			printf("Found... %s (%s)\n",
				ENV(maps)[i].filename, ENV(maps)[i].perms);
			return 1;
		}
		++i;
	}
	return 0;
}
Exemplo n.º 9
0
void tell_message(int index)
{
    if(index < sizeof(messages))
    {
        tell_object(ENV(TO),messages[index] + "\n");
        ++index;
        set_alarm(15.0 + itof(random(10)),0.0,"tell_message",index);
    }
    else
    {
        ENV(ENV(TO))->land(ENV(TO));
        destroy();
    }
}
Exemplo n.º 10
0
static int
decode_number(void * ctx, const char * numberVal, unsigned int numberLen)
{
    // scan in the input to see if it's a float or int

    int numberType = 0; // 0 means integer, 1 means float
    unsigned int i;
    ErlNifBinary bin;
    int missingDot = 1;
    unsigned int expPos;

    for(i=0; i<numberLen; i++) {
        switch (numberVal[i]) {
        case '.':
            missingDot = 0;
            numberType = 1; // it's  a float
            goto loopend;
        case 'E':
        case 'e':
            expPos = i;
            numberType = 1; // it's  a float
            goto loopend;
        }
    }
loopend:
    if ((numberType == 1) && missingDot)
    {
        if(!enif_alloc_binary_compat(ENV(ctx), numberLen + 2, &bin))
        {
            return CANCEL;
        }
        memcpy(bin.data, numberVal, expPos);
        bin.data[expPos] = '.';
        bin.data[expPos + 1] = '0';
        memcpy(bin.data + expPos + 2, numberVal + expPos, numberLen - expPos);
    }
    else
    {
        if(!enif_alloc_binary_compat(ENV(ctx), numberLen, &bin))
        {
            return CANCEL;
        }
        memcpy(bin.data, numberVal, numberLen);
    }
    add_to_head(ctx, enif_make_tuple(ENV(ctx), 2,
                        enif_make_int(ENV(ctx), numberType),
                        enif_make_binary(ENV(ctx), &bin)));
    return CONTINUE;
}
Exemplo n.º 11
0
/* Fill audio buffer */
void my_audio_callback(void *ud, void *stream, int len)
{
    JNIEnv *thread_env;
    JNIEnv ref_env;

    jarray *array;
    (*VM(global))->AttachCurrentThread(VM(global), &thread_env, NULL);

    /* here we need the original NewGlobalRef */
    if(global->use_dvm)
    {
        ref_env = &global->dalvik_copy_env;
    }
    else ref_env = *thread_env;

    array = (*thread_env)->NewShortArray(thread_env, len / 2);

    jobject *ref = ref_env->NewGlobalRef(thread_env, array);
    angrybirds_priv.native_mixdata(ENV(global), VM(global), audioHandle, ref, len);
    ref_env->DeleteGlobalRef(thread_env, ref);

    jshort *elements = (*thread_env)->GetShortArrayElements(thread_env, array, 0);
    memcpy(stream, elements, len);
    (*thread_env)->ReleaseShortArrayElements(thread_env, array, elements, JNI_ABORT);

    (*thread_env)->DeleteLocalRef(thread_env, array);

    (*VM(global))->DetachCurrentThread(VM(global));
}
Exemplo n.º 12
0
Arquivo: faid.c Projeto: nhaskins/eotl
int Aid(string target)
{
  object target_ob;
  
  if(!target)
  {
    return notify_fail("Aid who?");
  }
    
  if(target_ob = present(target, ENV(THISP)))
  {
      allowed_routine(target_ob);
      
        if(aid_routine(target_ob))
        {
          write("did some work on x good job\n");
          return(1);
        } else {
//refactor this, using another notification method, notify_fail is for syntax problems, not env issues.
          return notify_fail("no need, they are ok.\n");
        }          

   } else {  
      return notify_fail("Aid who?\n");
   }
}
Exemplo n.º 13
0
int do_light(string str)
{
    int sp_cost = 10 + random(10);

    if(str == "stone" && TP->QS("attune") > 20 && ENV(TO) == TP)
    {
        if(shining)
        {
            W("The stone is already shining!\n");
            return 1;
        }

        if(TP->query_spell_points() >= sp_cost)
        {
            W("You channel some power into the stone and make it shine "+
              "with a warm light.\n");
            S(TP->QN + " concentrates on a small stone and suddenly it "+
              "starts shining with a warm light.\n");
            TP->reduce_spell_points(sp_cost);
            user = TP;
            light();
            set_alarm(300.0 + itof(random(120)),0.0,"drain");
        }
        else
        {
            W("You don't have enough power to light the stone at the "+
              "moment.\n");
            S(TP->QN + " concentrates on a small stone but looks "+
              "disappointed.\n");
            return 1;
        }
    }
    // No mistake here. Don't want hints to people with attune < 20,
    // and don't want to mess up other light commands
}
Exemplo n.º 14
0
/* Fill audio buffer */
void my_audio_callback(void *ud, Uint8 *stream, int len)
{
    struct dummy_array array;
    array.data = stream;
    array.length = len;
    array.element_size = 1;
    angrybirds_priv.native_mixdata(ENV(global), VM(global), audioHandle, &array, len);
}
Exemplo n.º 15
0
jint
worldofgoo_AttachCurrentThread(JavaVM *vm, JNIEnv **env, void *args)
{
    printf("worldofgoo_AttachCurrentThread()\n");
    struct GlobalState *global = (*vm)->reserved0;
    *env = ENV(global);
    return 0;
}
Exemplo n.º 16
0
heart_beat()
{
    if(!present("muffins",ENV(THISO)))
    {
	if(find_player("muffins"))
	{
	    tell_room(ENV(THISO),"The orb suddenly winks out of existence.\n");
	    move_object(THISO,ENV(find_player("muffins")));
	    tell_room(ENV(THISO),"The orb winks into existence.\n");
	    return 1;

	}
	destruct(THISO);
	return 1;
    }
    return 0;
}
Exemplo n.º 17
0
static void
cuttherope_video_banner_finished()
{
    if (cuttherope_priv.videoBannerFinished!=0) {
        cuttherope_priv.videoBannerFinished(ENV(cuttherope_priv.global),
                cuttherope_priv.global);
    }
}
Exemplo n.º 18
0
Arquivo: pam.c Projeto: smokeless/eotl
int stare(string wow)
{
    if(wow == "at pamela" || wow == "at pamela's breasts" ||
       wow == "pamela" || wow == "pam" || wow == "at pam")
    {
       write("You just can't stand it anymore. You strip down to "
                "nothing and join in!\n");
       tell_room(ENV(THISP),PNAME+" stares at Pam and "
                "suddenly decides to join in.\n",({THISP}));
Exemplo n.º 19
0
void effect( object tripper )
{
    object vic = tripper;
    int nearBlastDam = random( ( vic->query_max_hp() )/ 10 ) + 10; 
    int splashDamage;
    object *vicArmor = vic->query_armor_worn();
    object *roomInventory = all_inventory( ENV( THISO ) );
    
    ansi_tell_room( ENV( THISO ), sprintf( "%s triggers an explosive trap! "
      "A loud *BANG* proceeds the flames that engulf you.", vic->query_name() ), 
      RED, ({ vic }) );
Exemplo n.º 20
0
int soulwell( object vic, object att )
{
    command( "say To me fiends! I crave your sustenence!" );
    
    ansi_tell_room( ENV( att ), "A black mist comprised of "
      "lost souls begins to rise from the ground. Rifrad breathes "
      "deeply.", HIK );
    
    att->add_hp( 30 + random( 30 ) );
    
    return 1;
}
Exemplo n.º 21
0
cmd_read(int x){
  if(!x){
    tell_player(THISP, "\n~~~ Table of Contents ~~~\n ");
    cmd_dir();
    tell_player(THISP, "\n~~~ Usage: read <#> ~~~");
  }
  else {
    x = x-1;
    mixed f = get_dir(to_string(CONTENT));
    if(x < sizeof(f)){
      THISP->more_string( read_file(to_string(CONTENT) + f[x]));
      tell_room(ENV(THISP), PNAME+" studies a book carefully.\n", ({THISP}));
    }
Exemplo n.º 22
0
int do_light(string str)
{
    if(str == "fire")
    {
        if(!telling_story)
        {
            if(!TP->test_flag(QUEST_FLAG))
	    {
                W("You light a fire in the fireplace. The old man sighs " +
                  "contentedly as the fire begins to catch and throw " +
                  "strange, long shadows on the walls. 'Now gather round " +
                  "and listen well', he says. 'A tale like this should not " +
                  "be told in too loud a voice. The walls in these parts " +
                  "really do have ears...'\n");
                S(TP->QN + " lights a fire in the fireplace. The old man " +
                  "sighs contentedly and begins the telling of a tale.\n");
                telling_story = 1;
                set_alarm(7.0,0.0,"tell_story",0);
                set_alarm(300.0,0.0,"my_reset");
                return 1;
	    }
            else
            {
                tell_room(ENV(TO),"The storyteller smiles and says: Oh " +
                          "'tis you, " + TP->QN + ". You have already " +
                          "heard my tale. Methinks I will save my voice " +
                          "for some other young adventurer. Godspeed! ");
                W("The storyteller waves happily in your direction.\n");
                S("The storyteller waves happily in " + TP->QN + "'s " +
                  "direction.\n");
                return 1;
	    }
        }
        else if(telling_story == 1)
        {
            W("There is already a fire burning in the fireplace.\n");
            S(TP->QN + " walks over to the fireplace to warm " + TP->QPO +
              " hands.\n");
            return 1;
        }
        else
        {
            W("You try to light a fire but you can't get it started.\n");
            S(TP->QN + " tries to light a fire, but can't get it started.\n");
            return 1;
        }
    }
    return 0;
}
Exemplo n.º 23
0
void fill_room(void)
{
    // Need an environment for this, so put it here and
    // call it with an alarm instead of doing it in create_object()
    tell_room(ENV(TO),"A thick, black smoke fills the room.\n");
    short_desc = ENV(TO)->query_short();
    long_desc = ENV(TO)->query_long_desc();
    skip_obvious = ENV(TO)->query_skip_obvious();

    ENV(TO)->set_short("A smoke filled room");
    ENV(TO)->set_long("The room is filled with a thick, black smoke. " +
                      "You can't see anything through it!\n");
    ENV(TO)->set_skip_obvious(1);
}
Exemplo n.º 24
0
Arquivo: NCCE.c Projeto: 8l/rose
int main(int argc, char const *argv[], char const *envp[]) {
  PRE();
  DCL();
  EXP();
  INT();
  FLP();
  ARR();
  STR();
  MEM();

  ENV(envp);
  SIG();
  ERR();
  MSC();
  POS();

  return 0;
}
Exemplo n.º 25
0
int do_darken(string str)
{
    if(str == "stone" && TP->QS("attune") > 20 && ENV(TO) == TP)
    {
        if(!shining)
        {
            W("The stone is already dark!\n");
            return 1;
        }

        W("You close off the flow of power into the stone and break the "+
          "bond.\n");
        darken();
        W("The stone stops shining.\nYou feel a strange longing...\n");
        S("The stone in " + TP->QN + "s hand stops shining.\n");
        return 1;
    }
}
Exemplo n.º 26
0
void annoy(int count)
{
    int i = 0;
    object *players = ENV(TO)->query_players_here();
    if(count >= 5)
    {
        clear();
    } else {
        // Smoke is irritating. It only does this for 5 seconds
        for(i = 0; i < sizeof(players); ++i)
        {
            if(players[i]->query_con() < 10 + random(20))
            {
                players[i]->command(commands[random(sizeof(commands))]);
            }
        }
        set_alarm(1.0,0.0,"annoy",++count);
    }
}
Exemplo n.º 27
0
int main( int argc, char** argv )
{
#ifdef AFOUTPUT
    if ( argc == 1)
    {
        printf("afcmd = '%s'\n", argv[0]);
#ifdef LINUX
        static const int bufsize = 1024;
        char buffer[bufsize];
        char link[] = "/proc/self/exe";
        int linksize = readlink( link, buffer, bufsize);
        buffer[linksize] = '\0';
        printf("%s='%s'\n", link, buffer);
#endif
/*
printf("Msg::SizeHeader       = %d\n", Msg::SizeHeader      );
//printf("Msg::SizeDataMin      = %d\n", Msg::SizeDataMin     );
printf("Msg::SizeBuffer       = %d\n", Msg::SizeBuffer      );
printf("Msg::SizeBufferLimit  = %d\n", Msg::SizeBufferLimit );
printf("Msg::SizeDataMax      = %d\n", Msg::SizeDataMax     );
*/
    }
#endif

    Verbose = false;
    Help = false;

	//
	// Initialize environment:
    uint32_t envflags = 0;
    if( argc == 1 )
	{
		// Just verbose environment and nothing else to do.
		envflags = af::Environment::Verbose;
	}
	else
	{
		// If we want to connect to server we should solve its name:
		envflags = af::Environment::SolveServerName;

		if( std::string( argv[1]) == "v" )
			envflags |= af::Environment::Verbose;
		else
			envflags |= af::Environment::Quiet;
	}

    af::Environment ENV( envflags, argc, argv);
    if( ENV.isValid() == false ) return 1;

    if( af::init( af::InitFarm | (argc == 1 ? af::InitVerbose : af::NoFlags)) == false) return 1;
    afsql::init();

    int return_value = 0;
//
// initialize command class
	Py_InitializeEx(0);
    AfCmd afcmd;
//
// generate message from command line arguments
    af::Msg msg;
    if( afcmd.processCommand( argc, argv, msg))
    {
        if( msg.isNull() == false)
        {
            if( Verbose ) msg.v_stdOut();

            bool ok;
            af::Msg * answer = af::sendToServer( &msg, ok, af::VerboseOn);

            if( false == ok )
                return_value = 1;

            if( answer)
            {
               // Print message information
               afcmd.msgOutput( *answer);
            }
        }
    }
    else return_value = 1;

    af::destroy();
	Py_Finalize();

    AFINFA("afcmd main: return value = %d\n", return_value)

    return return_value;
}
Exemplo n.º 28
0
void main()
{
	win7compat_init();
	log_init();
	fork_init();
	/* fork_init() will directly jump to restored thread context if we are a fork child */

	mm_init();
	flags_init();

	/* Parse command line */
	const char *cmdline = GetCommandLineA();
	int len = strlen(cmdline);
	if (len > BLOCK_SIZE) /* TODO: Test if there is sufficient space for argv[] array */
	{
		init_subsystems();
		kprintf("Command line too long.\n");
		process_exit(1, 0);
	}

	startup = mm_mmap(NULL, BLOCK_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS,
		INTERNAL_MAP_TOPDOWN | INTERNAL_MAP_NORESET | INTERNAL_MAP_VIRTUALALLOC, NULL, 0);
	*(uintptr_t*) startup = 1;
	char *current_startup_base = startup + sizeof(uintptr_t);
	memcpy(current_startup_base, cmdline, len + 1);
	char *envbuf = (char *)ALIGN_TO(current_startup_base + len + 1, sizeof(void*));
	char *env0 = envbuf;
	ENV("TERM=xterm");
	char *env1 = envbuf;
	ENV("HOME=/root");
	char *env2 = envbuf;
	ENV("DISPLAY=127.0.0.1:0");
	char *env3 = envbuf;
	ENV("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin");
	int argc = 0;
	char **argv = (char **)ALIGN_TO(envbuf, sizeof(void*));

	/* Parse command line */
	int in_quote = 0;
	char *j = current_startup_base;
	for (char *i = current_startup_base; i <= current_startup_base + len; i++)
		if (!in_quote && (*i == ' ' || *i == '\t' || *i == '\r' || *i == '\n' || *i == 0))
		{
			*i = 0;
			if (i > j)
				argv[argc++] = j;
			j = i + 1;
		}
		else if (*i == '"')
		{
			*i = 0;
			if (in_quote)
				argv[argc++] = j;
			in_quote = !in_quote;
			j = i + 1;
		}
	argv[argc] = NULL;
	char **envp = argv + argc + 1;
	int env_size = 4;
	envp[0] = env0;
	envp[1] = env1;
	envp[2] = env2;
	envp[3] = env3;
	envp[4] = NULL;
	char *buffer_base = (char*)(envp + env_size + 1);

	const char *filename = NULL;
	int arg_start;
	for (int i = 1; i < argc; i++)
	{
		if (!strcmp(argv[i], "--session-id"))
		{
			if (++i < argc)
			{
				int len = strlen(argv[i]);
				if (len >= MAX_SESSION_ID_LEN)
				{
					init_subsystems();
					kprintf("--session-id: Session ID too long.\n");
					process_exit(1, 0);
				}
				for (int j = 0; j < len; j++)
				{
					char ch = argv[i][j];
					if (!((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
						ch == '_' || ch == '-'))
					{
						init_subsystems();
						kprintf("--session-id: Invalid characters.\n");
						process_exit(1, 0);
					}
				}
				strcpy(cmdline_flags->global_session_id, argv[i]);
			}
			else
			{
				init_subsystems();
				kprintf("--session-id: No ID given.\n");
				process_exit(1, 0);
			}
		}
		else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
		{
			init_subsystems();
			print_help();
			process_exit(1, 0);
		}
		else if (!strcmp(argv[i], "--usage"))
		{
			init_subsystems();
			print_usage();
			process_exit(1, 0);
		}
		else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v"))
		{
			init_subsystems();
			print_version();
			process_exit(1, 0);
		}
		else if (!strcmp(argv[i], "--dbt-trace"))
			cmdline_flags->dbt_trace = true;
		else if (!strcmp(argv[i], "--dbt-trace-all"))
		{
			cmdline_flags->dbt_trace = true;
			cmdline_flags->dbt_trace_all = true;
		}
		else if (argv[i][0] == '-')
		{
			init_subsystems();
			kprintf("Unrecognized option: %s\n", argv[i]);
			process_exit(1, 0);
		}
		else if (!filename)
		{
			filename = argv[i];
			arg_start = i;
			break;
		}
	}

	init_subsystems();
	if (filename)
	{
		install_syscall_handler();
		int r = do_execve(filename, argc - arg_start, argv + arg_start, env_size, envp, buffer_base, NULL);
		if (r == -L_ENOENT)
		{
			kprintf("Executable not found.");
			process_exit(1, 0);
		}
	}
	print_usage();
	process_exit(1, 0);
}
Exemplo n.º 29
0
void tell_story(int step)
{
    switch(step)
    {
        case 0: tell_room(ENV(TO),"The storyteller lowers his voice...\n\n");
                set_alarm(3.0,0.0,"tell_story",1);
          break;
        case 1: tell_room(ENV(TO),"The storyteller says: Half a century " +
                          "ago this valley was ruled by the just and fair " +
                          "Duke Talanon, aided by his advisors, Alywin of " +
                          "the Cross, and Nirach of the Book. Nirach and " +
                          "Alywin were strong in magic, and the spells they " +
                          "worked together kept evil away from the valley " +
                          "and the people safe.\n");
                set_alarm(7.0,0.0,"tell_story",2);
          break;
        case 2: tell_room(ENV(TO),"The storyteller sighs heavily.\n\n");
                set_alarm(3.0,0.0,"tell_story",3);
          break;
        case 3: tell_room(ENV(TO),"The storyteller says: Times were good " +
                          "then, but that was soon to change. Talanon fell " +
                          "ill, and no healer could we find to save his " +
                          "life. We buried him in the shrine to the " +
                          "north...\n");
                set_alarm(5.0,0.0,"tell_story",4);
          break;
        case 4: tell_room(ENV(TO),"The storyteller stares blankly into " +
                          "space, seemingly lost in thought...\n\n");
                set_alarm(2.0,0.0,"tell_story",5);
          break;
        case 5: tell_room(ENV(TO),"The storyteller resumes: Talanon had no " +
                          "heir. It was decided that Alywin and Nirach " +
                          "would govern until a new duke had been found, " +
                          "as they both were loved and trusted by the " +
                          "people...'\n");
                set_alarm(4.0,0.0,"tell_story",6);
          break;
        case 6: tell_room(ENV(TO),"The storyteller shakes his head.\n\n");
                set_alarm(2.0,0.0,"tell_story",7);
          break;
        case 7: tell_room(ENV(TO),"The storyteller says: Oh, how he misled " +
                          "us. One night, but two weeks after Talanon was " +
                          "buried, Nirach left his tower in the castle to " +
                          "visit Alywin in the shrine. Oh, I remember that " +
                          "night. The moon was hidden behind dark clouds " +
                          "and the wolves howled like never before. Alywin " +
                          "greeted Nirach as a friend, but Nirach turned " +
                          "upon him. He bound Alywin's spirit within a " +
                          "magic orb he'd been crafting in secret, seeking " +
                          "to gain Alywin's powers for himself...\n");
                set_alarm(8.0,0.0,"tell_story",8);
          break;
        case 8: tell_room(ENV(TO),"The storyteller sighs heavily.\n\n");
                set_alarm(2.0,0.0,"tell_story",9);
          break;
        case 9: tell_room(ENV(TO),"The storyteller says: He turned the once " +
                          "beautiful castle into a dark fortress to " +
                          "practice his evil arts in. People in the " +
                          "village started disappearing and strange beasts " +
                          "roamed the forest at night. His darkling " +
                          "minions, a race he himself had created, began " +
                          "terrorizing the village, hunting down and " +
                          "killing all those who tried to leave. Nirach " +
                          "had not yet gained control over the orb, and " +
                          "he did not want the Kings to get word of his " +
                          "doings...\n");
                set_alarm(8.0,0.0,"tell_story",10);
          break;
        case 10: tell_room(ENV(TO),"The storyteller takes a deep " +
                           "breath.\n\n");
                 set_alarm(2.0,0.0,"tell_story",11);
          break;
        case 11: tell_room(ENV(TO),"The storyteller continues: But " +
                           "oppression breeds resistance. One night a band " +
                           "of brave young men gathered in the caves by " +
                           "the waterfall to the southeast. They followed " +
                           "a secret path into the castle dungeons, hoping " +
                           "to steal the orb and end Nirach's reign. They " +
                           "were betrayed. The one who led them to the " +
                           "chamber where the orb was kept was one of " +
                           "Nirach's men. In the chamber they encountered " +
                           "the guardian Nirach had summoned...\n");
                 set_alarm(8.0,0.0,"tell_story",12);
          break;
        case 12: tell_room(ENV(TO),"The storyteller shivers with " +
                           "fear...\n\n");
                 set_alarm(2.0,0.0,"tell_story",13);
          break;
        case 13: tell_room(ENV(TO),"The storyteller says: All but one of " +
                           "the brave men perished that night, and the sole " +
                           "survivor of the unfortunate raid was deprived " +
                           "of his sanity by what he saw. He is now to be " +
                           "found in our madhouse. The traitor serves " +
                           "Nirach still, Yzwul is his name.\n");
                 set_alarm(4.0,0.0,"tell_story",14);
          break;
        case 14: tell_room(ENV(TO),"The storyteller spits on the floor.\n\n");
                 set_alarm(2.0,0.0,"tell_story",15);
          break;
        case 15: tell_room(ENV(TO),"The storyteller finishes: These events " +
                           "occured some fifty years ago, and noone has " +
                           "stood up to Nirach since. We wait in terror " +
                           "for the day Nirach will gain control of the " +
                           "orb, for then he will bring death upon all of " +
                           "the Kingdoms. But one hope do we have. That " +
                           "someone will come here and steal the orb from " +
                           "Nirach and destroy it, for it is not only we " +
                           "who will suffer, should he gain it's powers, " +
                           "but the whole of the Kingdoms...\n\n");
                 set_alarm(10.0,0.0,"tell_story",16);
          break;
        case 16: tell_room(ENV(TO),"The storyteller goes quiet as his tale " +
                           "ends. Everything is silent. The fire in the " +
                           "fireplace has gone out. You notice the patrons " +
                           "in the tavern looking at you with hope in their " +
                           "eyes.\n");
                 telling_story = 2;
          break;
    }
}
Exemplo n.º 30
0
static int
decode_boolean(void* ctx, int val)
{
    add_to_head(ctx, enif_make_atom(ENV(ctx), val ? "true" : "false"));
    return CONTINUE;
}