1/*
2 *	Patch for Black Gate.
3 *	Written: 5/6/04.
4 *
5 *	To use, you need a 'patch' directory alongside 'static' and 'gamedat'
6 *	for BlackGate.  Then, inside 'patch', run:
7 *		ucc -o usecode <this file>
8 */
9
10#game "blackgate"
11
12const int avatar = -356;
13const int lordbrit_id = -23;		// LB's NPC #.
14extern var Ask_yes_no 0x90a();
15
16enum item_flags {			// Bit #'s of flags:
17		invisible = 0,
18		asleep = 1,
19		charmed = 2,
20		cursed = 3,
21		dead = 4,
22		in_party = 6,		// Guess, appears to be correct
23		paralyzed = 7,
24		poisoned = 8,
25		protection = 9,
26		on_moving_barge = 10,	// ??Guessing.
27		okay_to_take = 11,	// Okay to take??
28		might = 12,		// Double strength, dext, intel.
29		no_spell_casting = 13,
30		cant_die = 14,		// Test flag in Monster_info.
31		dancing = 15,		// ??Not sure.
32		dont_move = 16,		// User can't move.  In BG,
33					//   completely invisible.
34		si_on_moving_barge = 17,// SI's version of 10?
35		is_temporary = 18,	// Is temporary
36		okay_to_land = 21,	// Used for flying-carpet.
37		in_dungeon = 23,	// Pretty sure.  If set, you won't
38					//   be accused of stealing food.
39		confused = 25,		// ??Guessing.
40		in_motion = 26,		// ??Guessing (cart, boat)??
41		met = 28,			// Has the npc been met
42		si_tournament = 29,	// SI-Call usecode (eventid=7)
43		si_zombie = 30,		// Used for sick Neyobi.
44		// Flags > 31
45		polymorph = 32,		// SI.  Pretty sure about this.
46		tattooed = 33,			// Guess (SI).
47		read = 34,			// Guess (SI).
48		petra = 35,			// Guess
49		freeze = 37		// SI.  Pretty sure.
50	};
51
52/*
53 *	Example to enable LB to join your party.
54 */
55void LB_fun object#(0x417) ()
56	{
57	var inparty = get_item_flag(in_party);
58	static var count;
59
60	LB_fun.original();
61	count = count + 1;
62	if (!inparty)
63		{
64		if (count%3 != 1)
65			return;		// Just do it every 3rd time.
66		if (UI_get_array_size(UI_get_party_list()) > 7)
67			return;		// No room.
68		item.say("One moment, my long-time friend...");
69		say("My years here as sovereign have been pleasant, ",
70		    "but I feel my bones growing soft.  ",
71		    "Some days I yearn for our old times of adventure.");
72		say("Though my hair hast a bit of grey, my hand is ",
73		    "steady, and my eyes sharp.");
74		say("Couldst thou find a place for me on your Quest?");
75		if (Ask_yes_no())
76			{
77			add_to_party();
78			count = 0;
79			}
80		}
81	else
82		{
83		if (count%3 != 1)
84			return;
85		item.say("Mayest I continue to aid thee in thy quest, Avatar?");
86		if (!Ask_yes_no())
87			{
88			remove_from_party();
89			set_schedule_type(11);	// Loiter.
90			count = 0;
91			}
92		}
93	}
94