www.pudn.com > gamedata.rar > spell.c


#include "stdafx.h" 
 
extern struct OBJECT_INFO  object_info[MAX_NUM_OBJ]; 
extern long spell_code[MAX_NUM_SPELL][6]; 
extern int skill_code1[4][5]; 
extern int skill_code2[4][3]; 
 
int sendspellinfo(SOCKET s, BYTE code, int n1, int n2, int distance, BOOL broadcast) 
{ 
	// 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 
	// 74 01 00 00 6E 01 08 1B 27 00 00 67 65 00 00 
 
	BYTE lpSource[15]; 
	int ret; 
	BYTE buf[2]; 
	 
	memset(lpSource, 0x00, sizeof(lpSource)); 
 
	lpSource[0]  = 0x00; 
	lpSource[1]  = 0x00; 
	lpSource[2]  = 0x00; 
	lpSource[3]  = 0x00; 
	lpSource[4]  = 0x6E; 
	lpSource[5]  = 0x01; 
	lpSource[6]  = code; 
	Encode2(buf, object_info[n1].ServerID); 
	lpSource[7]  = buf[1]; 
	lpSource[8]  = buf[0]; 
	lpSource[9]  = 0x00; 
	lpSource[10] = 0x00; 
	Encode2(buf, object_info[n2].ServerID); 
	lpSource[11] = buf[1]; 
	lpSource[12] = buf[0]; 
	lpSource[13] = 0x00; 
	lpSource[14] = 0x00; 
 
	ret = add_pack_chain(s, lpSource, 15, distance, broadcast); 
 
	return ret; 
} 
 
int sendmovespellinfo(SOCKET s, int n, int x, int y, int now1, int now2, int distance, BOOL broadcast) 
{ 
	// 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 
	// 0A 01 00 00 73 01 00 1B 27 00 00 E3 00 43 05 01 00 
	// 00 00 00 00 73 01 00 00 00 00 00 B6 00 84 05 07 00  
 
	BYTE lpSource[17]; 
	int ret; 
 
	BYTE buf[2]; 
 
	memset(lpSource, 0x00, sizeof(lpSource)); 
 
	lpSource[0]  = 0x00; 
	lpSource[1]  = 0x00; 
	lpSource[2]  = 0x00; 
	lpSource[3]  = 0x00; 
	lpSource[4]  = 0x73; 
	lpSource[5]  = 0x01; 
	lpSource[6]  = 0x00; 
	Encode2(buf, object_info[n].ServerID); 
	lpSource[7]  = buf[1]; 
	lpSource[8]  = buf[0]; 
	lpSource[9]  = 0x00; 
	lpSource[10] = 0x00; 
	Encode2(buf, x); 
	lpSource[11] = buf[1]; 
	lpSource[12] = buf[0]; 
	Encode2(buf, y); 
	lpSource[13] = buf[1]; 
	lpSource[14] = buf[0]; 
	lpSource[15] = now1; 
	lpSource[16] = now2; 
 
	ret = add_pack_chain(s, lpSource, 17, distance, broadcast); 
 
	return ret; 
} 
 
BOOL getjobspell(int n, BYTE code) 
{ 
	int i, j; 
 
	for (i=0;i= spell_code[i][2]) &&  
			((spell_code[i][0] == object_info[n].job) || (spell_code[i][0] == 4))) 
		{ 
			for(j=0;j 15) || (abs(newy - object_info[n].now_y) > 15)) return; 
 
			senddisplaynovelity(s, object_info[n].now_x, object_info[n].now_y,  
				object_info[n].menow1, object_info[n].menow2, 
				newx, newy, object_info[n].menow1, object_info[n].menow2); 
 
			for (i=0;i= n2)  
	{ 
		object_info[n].mental_now -= n2; 
		gamemessage(s, 0x6C, object_info[n].mental_now, 65535); 
	} 
	else 
	{ 
		sysmessage(s, 0x02, "精神数值不够", 0, FALSE); return -1; 
	} 
 
	return 0;	 
}