⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 px_ls_npc.h

📁 MMORPG游戏服务器端架构及函数
💻 H
字号:
#pragma	  once

/* must been first include begin */
#include "..\ProjectX_Common\ProjectX_Copyright.h"
#include "..\ProjectX_Common\ProjectX_Common.h"
/* must been first include end */

/* std and common include */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>


/************************************************************************
约定	:一个NPC最多允许同时拥有4种能力值,即最多可以同时提供4种服务,
同时在服务器方可以进行动态刷新的NPC,不提供类似出售/购买道具
的能力,在一般情况下,建议一个NPC仅提供一种能力值
所有具有攻击能力的npc对玩家/怪物等类似主体具有妙杀功能,本身可以
受到攻击,同时npc的攻击属于物理攻击,玩家或者类似主体的物理伤害减免
将不起作用,npc本身非攻击类型,不能受到第三方主体的攻击或者增益影射
************************************************************************/

#define MAX_NPC_NAME_LEN		20

typedef struct tagNpc_Sell_Cell {
	int item_int;
	int money;
	byte src_x;
	byte src_y;
}NPC_SELL_CELL, * LPNPC_SELL_CELL;

typedef struct tagNpc_Sell {
	int			sell_type;			//出售类别:普通道具,彩票,宠物,特殊道具等
	NPC_SELL_CELL sell_cell[8][8];
	struct tagNpc_Sell * pNext;
}NPC_SELL, * LPNPC_SELL;

typedef struct tagNPC_Base {
	int			index;
	char		name[MAX_NPC_NAME_LEN];
	int			level;								/* 等级 */
	float		drop_money;							/* 金钱掉落  */	
	WORD		hp;									/* hp  */
	WORD		mana;								/* mana  */
	WORD		damage_min;							/* 最小攻击力  */
	WORD		damage_max;							/* 最大攻击力  */
	WORD		defence;							/* 防御  */
	WORD		attack_veracity;					/* 攻击准确性  */
	byte		move_range;							/* 活动范围  */
	int			exp_give;							/* 经验 */	
	/* resist */
	byte		physic_resist;						/* 物理抵抗  */
	byte		magic_resist;						/* 魔法抵抗  */
	byte		cold_resist;						/* 冰系抵抗  */
	byte		poison_resist;						/* 毒系抵抗  */
	byte		ligthing_resist;					/* 电系抵抗  */
	byte		fire_resist;						/* 火系抵抗  */
	/* fast recovery and protect */
	byte		fbs;								/* 快速格挡速度			fbs(fast block speed) */
	byte		fce;								/* 快速施法速度 - 元素	fce(fast cast element skill) */
	byte		fcm;								/* 快速施法速度 - 魔法	fcm(fast cast magic skill) */
	byte		fcp;								/* 快速施法速度 - 物理	fcp(fast cast physic skill) */
	byte		fcr;								/* 快速冰冻恢复			fcr(fast colden recovery) */
	byte		fhr;								/* 快速打击恢复			fhr(fast hit recovery) */
	byte		flr;								/* 快速撕裂伤口恢复		flr(fast lancaster damage recovery) */
	byte		fmr;								/* 快速魔法伤害恢复		fmr(fast magic damage recvovery) */
	byte		fms;								/* 快速移动速度			fms(fast move speed) */
	byte		fpr;								/* 快速中毒恢复			fpr(fast poison recovery) */
	byte		fsr;								/* 快速打晕恢复			fsr(fast stun recovery) */
	byte		fss;								/* 快速召唤速度			fss(fast summon speed) */
	/* skill */
	int			skill[3];							/* 技能 */
}NPC_BASE,* LPNPC_BASE;

/*
*	npc 刷新
*/

typedef struct tagNpc_Refresh{
	int			baseid;								/* 此刷新NPC基id */
	int			mapid;								/* 刷新地图id */
	byte		mapx;								/* 坐标x */
	byte		mapy;								/* 坐标y */
	byte		num_refresh;						/* 刷新数量 */	
	byte		opeartion[3];						/* 此npc可以提供的功能 */
	byte		move_range;
	char		shop_filename[FILENAME_MAX];		/* 此npc商店配置文件名称,不允许有空字符等出现,care */
	int			session_start;						/* 会话开始id */
	int			interval_seconds;					/* 刷新间隔时间,以秒计 */
}NPC_REFRESH, * LPNPC_REFRESH;
//以下为定义NPC结构信息
typedef struct tagNPC {
	int			sessionid;
	int			last_handled_frame;
	int			skill[3];							/* 技能 */
	int			last_frame_fbs;
	int			last_frame_fce;
	int			last_frame_fcm;
	int			last_frame_fcp;
	int			last_frame_fcr;
	int			last_frame_fhr;
	int			last_frame_flr;
	int			last_frame_fmr;
	int			last_frame_fms;
	int			last_frame_fpr;
	int			last_frame_fsr;
	int			last_frame_fss;
	int			level;								/* 等级 */
	WORD		hp;									/* hp  */
	WORD		mana;								/* mana  */
	WORD		damage_min;							/* 最小攻击力  */
	WORD		damage_max;							/* 最大攻击力  */
	WORD		defence;							/* 防御  */
	WORD		attack_veracity;					/* 攻击准确性  */
	byte		state;
	byte		move_range;							/* 活动范围  */
	/* resist */
	byte		physic_resist;						/* 物理抵抗  */
	byte		magic_resist;						/* 魔法抵抗  */
	byte		cold_resist;						/* 冰系抵抗  */
	byte		poison_resist;						/* 毒系抵抗  */
	byte		ligthing_resist;					/* 电系抵抗  */
	byte		fire_resist;						/* 火系抵抗  */
	/* fast recovery and protect */
	byte		fbs;								/* 快速格挡速度			fbs(fast block speed) */
	byte		fce;								/* 快速施法速度 - 元素	fce(fast cast element skill) */
	byte		fcm;								/* 快速施法速度 - 魔法	fcm(fast cast magic skill) */
	byte		fcp;								/* 快速施法速度 - 物理	fcp(fast cast physic skill) */
	byte		fcr;								/* 快速冰冻恢复			fcr(fast colden recovery) */
	byte		fhr;								/* 快速打击恢复			fhr(fast hit recovery) */
	byte		flr;								/* 快速撕裂伤口恢复		flr(fast lancaster damage recovery) */
	byte		fmr;								/* 快速魔法伤害恢复		fmr(fast magic damage recvovery) */
	byte		fms;								/* 快速移动速度			fms(fast move speed) */
	byte		fpr;								/* 快速中毒恢复			fpr(fast poison recovery) */
	byte		fsr;								/* 快速打晕恢复			fsr(fast stun recovery) */
	byte		fss;								/* 快速召唤速度			fss(fast summon speed) */
	int			discharge_sessionid;
	int			passive_effect_sessionid;
	int			targetsessionid;
	NPC_SELL *	pnpc_sell;
}NPC, * LPNPC;


typedef struct tagNpc_Key {
	byte	state;
	NPC	*	pnpc;
}NPC_KEY, * LPNPC_KEY;

void handle_all_npc_staff(void);
void handle_all_npc_ai(void);
void refresh_npc(void);

BOOL valid_npc_has_ability(int sessionid,byte ability);//确定npc是否有此项能力

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -