1-- $Id: player-info.lua,v 1.18 2007/12/28 16:44:42 cblue Exp $
2
3--
4-- simple scripts to examine/modify players' status.
5--
6
7-- display some information about a specified player.
8function p_in(i)
9-- +1 offset
10local p = players(i)
11
12-- Ind is global.
13	msg_print(Ind, "location: ("..p.px..","..p.py..") of ["..(p.wpos.wx)..","..(p.wpos.wy).."], "..(p.wpos.wz*50).."ft  AU:"..p.au)
14	msg_print(Ind, "HP:"..p.chp.."/"..p.mhp.."  SP:"..p.csp.."/"..p.msp.."  SN:"..p.csane.."/"..p.msane.."  XP:"..p.exp.."/"..p.max_exp)
15	msg_print(Ind, "St:"..p.stat_cur[1].."/"..p.stat_max[1].." In:"..p.stat_cur[2].."/"..p.stat_max[2].." Wi:"..p.stat_cur[3].."/"..p.stat_max[3].." Dx:"..p.stat_cur[4].."/"..p.stat_max[4].." Co:"..p.stat_cur[5].."/"..p.stat_max[5].." Ch:"..p.stat_cur[6].."/"..p.stat_max[6])
16
17end
18
19-- display some information about a specified object in inventory.
20-- (prolly easier to use gdb..)
21function o_in(i, j)
22-- +1 offset
23local o = players(i).inventory[j+1]
24
25-- Ind is global.
26	msg_print(Ind, "location: ("..o.ix..","..o.iy..") of ["..(o.wpos.wx)..","..(o.wpos.wy).."], "..(o.wpos.wz*50).."ft")
27	msg_print(Ind, "k_idx:"..o.k_idx.." tval:"..o.tval.." sval:"..o.sval.." bpval:"..o.bpval.." pval:"..o.pval)
28	msg_print(Ind, "name1:"..o.name1.." name2:"..o.name2.." name3:"..o.name3.." xtra1:"..o.xtra1.." xtra2:"..o.xtra2)
29	msg_print(Ind, "timeout:"..o.timeout.." ident:"..o.ident.." note:"..o.note)
30
31end
32
33-- give knowledge about traps
34function trap_k()
35local i = 0
36local p = players(Ind)
37-- for(i=0;i<255;i++)
38	while (i < 256)
39	do
40		i = i + 1
41		p.trap_ident[i]=TRUE
42	end
43end
44
45-- namely.
46function adj_xp(i, amt)
47local p = players(i)
48
49	p.max_exp = amt
50	p.exp = amt
51end
52
53-- resurrect/exterminate all the uniques
54-- also nice to test mimics.
55function res_uni(state)
56local i = 0
57local p = players(Ind)
58-- for(i=0;i<255;i++)
59	while (i < 1152)
60	do
61		i = i + 1
62		p.r_killed[i]=state
63	end
64end
65
66-- make every item 'known'
67function id_all(state)
68local i = 0
69local p = players(Ind)
70-- for(i=0;i<255;i++)
71	while (i < 640)
72	do
73		i = i + 1
74		p.obj_aware[i]=state
75	end
76end
77
78-- lazy command for an admin :)
79function id_all2()
80	id_all(1)
81	trap_k()
82end
83
84-- namely.
85function healup(i)
86local p = players(i)
87local j = 0
88
89	p.exp = p.max_exp
90	p.chp = p.mhp
91	p.csp = p.msp
92	p.csane = p.msane
93	p.black_breath = 0
94	p.slow = 0
95	p.blind = 0
96	p.paralyzed = 0
97	p.confused = 0
98	p.afraid = 0
99	p.image = 0
100	p.poisoned = 0
101	p.cut = 0
102	p.stun = 0
103	p.food = 10000
104
105	while (j < 6)
106	do
107		j = j + 1
108		p.stat_cur[j] = p.stat_max[j]
109	end
110end
111
112-- reload lua files.
113--DEPRECATED AND BAD. use /initlua slash.c command instead!
114function init()
115	pern_dofile(Ind, "cblue.lua")
116--	pern_dofile(Ind, "dg.lua")
117--	pern_dofile(Ind, "evil.lua")
118--	pern_dofile(Ind, "zz.lua")
119--	pern_dofile(Ind, "jir.lua")
120	pern_dofile(Ind, "it.lua")
121	pern_dofile(Ind, "mikaelh.lua")
122
123	pern_dofile(Ind, "custom.lua")
124	pern_dofile(Ind, "player-info.lua")
125
126--	how about adding all the updatable luas here? we'd just need to include an erase-all function for schools etc.
127end
128
129-- get all the skills (cept antimagic)
130function learn()
131local i = 0
132local p = players(Ind)
133-- 0xffffffff
134	while (i < MAX_SKILLS)
135	do
136		i = i + 1
137--		if p.s_info[i].mod then
138			p.s_info[i].value = 50000
139--		end
140	end
141
142	antimagic(0)
143end
144
145-- set specified skill
146function skill(skill, val)
147local p = players(Ind)
148	p.s_info[skill + 1].value = val
149end
150
151-- set antimagic skill (you'll need it :)
152function antimagic(val)
153local p = players(Ind)
154	p.s_info[SKILL_ANTIMAGIC + 1].value = val
155end
156
157