POTION("sickness",	"white"),
	POTION("confusion",	"swirly"),
	POTION("gain strength",	"purple-red"),
	POTION("speed",		"ruby"),
	POTION("blindness",	"dark green"),
	POTION("gain level",	"emerald"),
	POTION("extra healing",	"sky blue"),
	POTION("levitation",	"brown"),
	POTION(NULL,	"brilliant blue"),
	POTION(NULL,	"clear"),
	POTION(NULL,	"magenta"),
	POTION(NULL,	"ebony"),

#define SCROLL(name,text,prob) { name, text, NULL, 0, 1,\
		SCROLL_SYM, prob, 0, 3, 0, 0, 0 }
	SCROLL("mail",	"KIRJE", 0),
	SCROLL("enchant armor", "ZELGO MER", 6),
	SCROLL("destroy armor", "JUYED AWK YACC", 5),
	SCROLL("confuse monster", "NR 9", 5),
	SCROLL("scare monster", "XIXAXA XOXAXA XUXAXA", 4),
	SCROLL("blank paper", "READ ME", 3),
	SCROLL("remove curse", "PRATYAVAYAH", 6),
	SCROLL("enchant weapon", "DAIYEN FOOELS", 6),
	SCROLL("damage weapon", "HACKEM MUCHE", 5),
	SCROLL("create monster", "LEP GEX VEN ZEA", 5),
	SCROLL("taming", "PRIRUTSENIE", 1),
	SCROLL("genocide", "ELBIB YLOH",2),
	SCROLL("light", "VERR YED HORRE", 10),
	SCROLL("teleportation", "VENZAR BORGAVVE", 5),
	SCROLL("gold detection", "THARR", 4),
	SCROLL("food detection", "YUM YUM", 1),
Exemple #2
0
void add_line_buffer(struct session *ses, char *line, int more_output) {
  char linebuf[STRING_SIZE];
  char *pti, *pto;
  int lines;
  int sav_row, sav_col, cur_row, cur_col, top_row, bot_row;

  push_call("add_line_buffer(%p,%s,%d)", ses, line, more_output);

  if (ses->buffer == NULL || HAS_BIT(ses->flags, SES_FLAG_SCROLLSTOP)) {
    pop_call();
    return;
  }

  sav_row = ses->sav_row;
  sav_col = ses->sav_col;
  cur_row = ses->cur_row;
  cur_col = ses->cur_col;
  top_row = ses->top_row;
  bot_row = ses->bot_row;

  if (more_output == TRUE) {
    if (strlen(ses->more_output) < BUFFER_SIZE / 2) {
      strcat(ses->more_output, line);

      pop_call();
      return;
    }
  }

  strcat(ses->more_output, line);

  pti = pto = ses->more_output;

  while (*pti != 0) {
    while (skip_vt102_codes_non_graph(pti)) {
      interpret_vt102_codes(ses, pti, FALSE);

      pti += skip_vt102_codes_non_graph(pti);
    }

    if (*pti == 0) {
      break;
    }

    if (SCROLL(ses)) {
      *pto++ = *pti++;
    } else {
      pti++;
    }
  }
  *pto = 0;

  lines = word_wrap(ses, ses->more_output, linebuf, FALSE);

  ses->more_output[0] = 0;

  ses->buffer[ses->scroll_row] = str_hash(linebuf, lines);

  if (more_output == -1) {
    str_hash_grep(ses->buffer[ses->scroll_row], TRUE);
  }

  if (!HAS_BIT(ses->flags, SES_FLAG_LOGLEVEL)) {
    if (ses->logfile) {
      logit(ses, linebuf, ses->logfile, TRUE);
    }
  }

  if (gtd->chat) {
    chat_forward_session(ses, linebuf);
  }

  if (--ses->scroll_row < 0) {
    ses->scroll_row = ses->scroll_max - 1;
  }

  if (ses->buffer[ses->scroll_row]) {
    ses->buffer[ses->scroll_row] = str_unhash(ses->buffer[ses->scroll_row]);
  }

  ses->sav_row = sav_row;
  ses->sav_col = sav_col;
  ses->cur_row = cur_row;
  ses->cur_col = cur_col;
  ses->top_row = top_row;
  ses->bot_row = bot_row;

  pop_call();
  return;
}
Exemple #3
0
void
mouse_horizontal_scroll3(int amount, CGScrollEventUnit units, double duration)
{
  SCROLL(0, scroll);
}
Exemple #4
0
void
mouse_scroll3(int amount, CGScrollEventUnit units, double duration)
{
  SCROLL(scroll, 0);
}
Exemple #5
0
int word_wrap(struct session *ses, char *textin, char *textout, int display)
{
	char *pti, *pto, *lis, *los, *chi, *cho;
	int skip = 0, cnt = 0;

	push_call("word_wrap(%s,%p,%p)",ses->name, textin,textout);

	pti = chi = lis = textin;
	pto = cho = los = textout;

	ses->cur_col = 1;

	while (*pti != 0)
	{
		if (skip_vt102_codes(pti))
		{
			if (display)
			{
				interpret_vt102_codes(ses, pti, TRUE);
			}

			for (skip = skip_vt102_codes(pti) ; skip > 0 ; skip--)
			{
				*pto++ = *pti++;
			}
			continue;
		}

		if (*pti == '\n')
		{
			*pto++ = *pti++;
			cnt = cnt + 1;
			los = pto;
			lis = pti;

			ses->cur_col = 1;

			continue;
		}

		if (*pti == ' ')
		{
			los = pto;
			lis = pti;
		}

		if (ses->cur_col > ses->cols)
		{
			cnt++;
			ses->cur_col = 1;

			if (HAS_BIT(ses->flags, SES_FLAG_WORDWRAP))
			{
				if (pto - los > 15 || !SCROLL(ses))
				{
					*pto++ = '\n';
					los = pto;
					lis = pti;
				}
				else if (lis != chi) // infinite VT loop detection
				{
					pto = los;
					*pto++ = '\n';
					pti = chi = lis;
					pti++;
				}
				else if (los != cho)
				{
					pto = cho = los;
					pto++;
					pti = chi = lis;
					pti++;
				}
			}
		}
		else
		{
			if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0)
			{
				*pto++ = *pti++;
				*pto++ = *pti++;
			}
			else if (HAS_BIT(ses->flags, SES_FLAG_UTF8) && (*pti & 192) == 192)
			{
				*pto++ = *pti++;

				while ((*pti & 192) == 128)
				{
					*pto++ = *pti++;
				}
			}
			else
			{
				*pto++ = *pti++;
			}
			ses->cur_col++;
		}
	}
	*pto = 0;

	pop_call();
	return (cnt + 1);
}
Exemple #6
0
int word_wrap_split(struct session *ses, char *textin, char *textout, int skip, int keep)
{
	char *pti, *pto, *lis, *los, *chi, *cho, *ptb;
	int i = 0, cnt = 0;

	push_call("word_wrap_split(%s,%p,%p,%d,%d)",ses->name, textin,textout, skip, keep);

	pti = chi = lis = textin;
	pto = cho = los = textout;

	ses->cur_col = 1;

	while (*pti != 0)
	{
		if (skip_vt102_codes(pti))
		{
			if (cnt >= skip && cnt < keep)
			{
				for (i = skip_vt102_codes(pti) ; i > 0 ; i--)
				{
					*pto++ = *pti++;
				}
			}
			else
			{
				pti += skip_vt102_codes(pti);
			}
			continue;
		}

		if (*pti == '\n')
		{
			if (cnt >= skip && cnt < keep)
			{
				*pto++ = *pti++;
			}
			else
			{
				pti++;
			}
			cnt = cnt + 1;
			los = pto;
			lis = pti;

			ses->cur_col = 1;

			continue;
		}

		if (*pti == ' ')
		{
			los = pto;
			lis = pti;
		}

		if (ses->cur_col > ses->cols)
		{
			cnt++;
			ses->cur_col = 1;

			if (HAS_BIT(ses->flags, SES_FLAG_WORDWRAP))
			{
				if (pto - los > 15 || !SCROLL(ses))
				{
					if (cnt >= skip && cnt < keep)
					{
						*pto++ = '\n';
					}
					los = pto;
					lis = pti;
				}
				else if (lis != chi) // infinite VT loop detection
				{
					if (cnt >= skip && cnt < keep)
					{
						pto = los;
						*pto++ = '\n';
					}
					pti = chi = lis;
					pti++;
				}
				else if (los != cho)
				{
					if (cnt >= skip && cnt < keep)
					{
						pto = cho = los;
						pto++;
					}
					else
					{
						cho = los;
					}
					pti = chi = lis;
					pti++;
				}
			}
		}
		else
		{
			ptb = pto;

			if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0)
			{
				*pto++ = *pti++;
				*pto++ = *pti++;
			}
			else if (HAS_BIT(ses->flags, SES_FLAG_UTF8) && (*pti & 192) == 192)
			{
				*pto++ = *pti++;

				while ((*pti & 192) == 128)
				{
					*pto++ = *pti++;
				}
			}
			else
			{
				*pto++ = *pti++;
			}

			if (cnt < skip || cnt >= keep)
			{
				pto = ptb;
			}

			ses->cur_col++;
		}
	}
	*pto = 0;

	pop_call();
	return (cnt + 1);
}
POTION("enlightenment", "swirly",       1, 0,          20, 200, CLR_BROWN),
POTION("monster detection", "bubbly",   1, 0,          40, 150, CLR_WHITE),
POTION("object detection", "smoky",     1, 0,          42, 150, CLR_GRAY),
POTION("gain energy", "cloudy",         1, 0,          42, 150, CLR_WHITE),
POTION("sleeping",  "effervescent",     1, 0,          42, 100, CLR_GRAY),
POTION("full healing",  "black",        1, 0,          10, 200, CLR_BLACK),
POTION("polymorph", "golden",           1, 0,          10, 200, CLR_YELLOW),
POTION("booze", "brown",                0, 0,          42,  50, CLR_BROWN),
POTION("sickness", "fizzy",             0, 0,          42,  50, CLR_CYAN),
POTION("fruit juice", "dark",           0, 0,          42,  50, CLR_BLACK),
POTION("acid", "white",                 0, 0,          10, 250, CLR_WHITE),
POTION("oil", "murky",                  0, 0,          30, 250, CLR_BROWN),
POTION("water", "clear",                0, 0,          92, 100, CLR_CYAN),

/* scrolls ... */
	SCROLL("enchant armor",         "ZELGO MER",            1,  63,  80),
	SCROLL("destroy armor",         "JUYED AWK YACC",       1,  45, 100),
	SCROLL("confuse monster",       "NR 9",                 1,  53, 100),
	SCROLL("scare monster",         "XIXAXA XOXAXA XUXAXA", 1,  35, 100),
	SCROLL("remove curse",          "PRATYAVAYAH",          1,  65,  80),
	SCROLL("enchant weapon",        "DAIYEN FOOELS",        1,  80,  60),
	SCROLL("create monster",        "LEP GEX VEN ZEA",      1,  45, 200),
	SCROLL("taming",                "PRIRUTSENIE",          1,  15, 200),
	SCROLL("genocide",              "ELBIB YLOH",           1,  15, 300),
	SCROLL("light",                 "VERR YED HORRE",       1,  90,  50),
	SCROLL("teleportation",         "VENZAR BORGAVVE",      1,  55, 100),
	SCROLL("gold detection",        "THARR",                1,  33, 100),
	SCROLL("food detection",        "YUM YUM",              1,  25, 100),
	SCROLL("identify",              "KERNOD WEL",           1, 180,  20),
	SCROLL("magic mapping",         "ELAM EBOW",            1,  45, 100),
	SCROLL("amnesia",               "DUAM XNAHT",           1,  35, 200),