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

📄 px_ls_account.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>

#include "px_ls_charge.h"
#include "px_ls_char.h"

#define MAX_ACC_ONLINE						5000

#define STATE_ACC_CHARGE_FREE_USE			1
#define STATE_ACC_CHARGE_CHARGE				2
#define STATE_ACC_NO_ENOUGH_CHARGE			3
//以下为定义玩家账号状态值
#define STATE_ACC_CONNECT					1
#define STATE_ACC_DISCONNECT				2

#define STATE_ACC_REQUEST_CONNECT			1
#define STATE_ACC_REQUEST_CREATE_ACCOUNT	2
#define STATE_ACC_REQUEST_LOGIN				1					//一个新的CL申请login
#define STATE_ACC_VERSIONCHECK				2					//版本检验中
#define STATE_ACC_CHARLIST_MENU				3					//处于角色列表画面
#define STATE_ACC_INGAME					4					//已选择某一角色进入游戏
#define STATE_ACC_REQUEST_LOGOUT			5					//申请退出游戏
#define STATE_ACC_REQUEST_LOGOUT_TIMEOUT	6					//申请退出游戏超时
#define STATE_ACC_LOGOUT					7					//已退出游戏
#define STATE_ACC_REUSE_PROCESS				8					//处于重用过程中
#define STATE_ACC_FREEUSE					9					//可以再次使用
#define STATE_ACC_ERRORFOUND				10					//有错误发生
#define STATE_ACC_BAN_NO_CHARGE				11
#define STATE_ACC_BAN_AH_FOR_EVER			12
#define STATE_ACC_BAN_AH_LIMIT				13

//以下为定义玩家账号下角色列表状态及相关极小结构
typedef struct tagCHAR_LIST {
	char				name[MAX_CHAR_NAME_LEN];				//角色名称
	int					uid;									//角色UID
	byte				state;									//角色状态
	/************************************************************************
	以下为角色预览需要的信息,包括角色职业,等级,身上穿戴道具,及盟标等
	************************************************************************/
	byte				char_class;								//角色职业
	byte				level;									//角色等级
	int					item_helm;								//头盔
	int					item_eye;								//眼罩
	int					item_armor;								//衣服
	int					item_belt;								//腰带
	int					item_glove_left;						//左手手套
	int					item_glove_right;						//右手手套
	int					item_boot;								//靴子
	int					item_shield;							//盾牌
	int					item_amulet;							//项链
	int					item_ring_left;							//左手戒指
	int					item_ring_right;						//右手戒指
	int					item_ring_marriage;
	int					item_shirt;								//内衣
	int					item_wing;								//翅膀
	int					item_guardianship;						//守护
	int					item_mantle;							//披风
	byte				item_left_type;							//左手道具类型
	byte				item_right_type;						//右手道具类型
	int					item_left_item;							//左手道具	
	int					item_right_item;						//右手道具
	char				name_guid[MAX_WAR_GUID_NAME_LEN];		//战盟名称
	char				BattleName[MAX_BATTLE_GUID_NAME_LEN];	//血盟名称
	struct tagCHAR_LIST * pNext;

}CHAR_LIST, * LPCHAR_LIST;

typedef struct tagAccount_Original {
	int					acc_id;										/* 帐号id */
	char				name[MAX_ACCOUNT_NAME_LEN];					/* 帐号名称 */
	char				pass[MAX_ACCOUNT_PASS_LEN];					/* 密码 */
	char				email[MAX_ACCOUNT_EMAIL_NAME_LEN];			/* Email */
	char				occupation[MAX_ACCOUNT_OCCUPATION_LEN];		/* 职业 */
	char				address[MAX_ACCOUNT_ADDRESS_LEN];			/* 地址 */
	char				description[MAX_ACCOUNT_SELF_DESCRIP_LEN];	/* 描述 */
	char				mobile_tel[MAX_ACCOUNT_TEL_MOBILE_LEN];		/* 移动电话 */
	char				home_tel[MAX_ACCOUNT_CONTACT_HOME];			/* 家庭联系电话 */
	char				work_tel[MAX_ACCOUNT_CONTACT_WORK];			/* 工作联系电话 */
	int					regester_time;								/* 注册日前 */
	WORD				birthday_year;								/* 生日-年 */
	byte				birthday_month;								/* 生日-月 */
	byte				birthday_date;								/* 生日-日 */
	BOOL				agreeterm;									/* 是否接受许可协议 */
	byte				gender;										/* 性别 */
}ACCOUNT_ORIGINAL, * LPACCOUNT_ORIGINAL;

typedef struct tagAccount_Particular {
	int					acc_id;										/* 帐号id */
	char				name[MAX_ACCOUNT_NAME_LEN];					/* 帐号名称 */
	char				pass[MAX_ACCOUNT_PASS_LEN];					/* 密码 */
	char				email[MAX_ACCOUNT_EMAIL_NAME_LEN];			/* Email */
	char				occupation[MAX_ACCOUNT_OCCUPATION_LEN];		/* 职业 */
	char				address[MAX_ACCOUNT_ADDRESS_LEN];			/* 地址 */
	char				description[MAX_ACCOUNT_SELF_DESCRIP_LEN];	/* 描述 */
	char				mobile_tel[MAX_ACCOUNT_TEL_MOBILE_LEN];		/* 移动电话 */
	char				home_tel[MAX_ACCOUNT_CONTACT_HOME];			/* 家庭联系电话 */
	char				work_tel[MAX_ACCOUNT_CONTACT_WORK];			/* 工作联系电话 */
	int					regester_time;								/* 注册日前 */
	WORD				birthday_year;								/* 生日-年 */
	byte				birthday_month;								/* 生日-月 */
	byte				birthday_date;								/* 生日-日 */
	BOOL				agreeterm;									/* 是否接受许可协议 */
	byte				gender;										/* 性别 */
}ACCOUNT_PARTICULAR, * LPACCOUNT_PARTICULAR;

//以下为定义玩家帐户结构
typedef struct tagAccount {	
	int					sessionid;									//会话id
	int					accuid;										//帐号id
	int					charuid;									//当前使用角色id
	char				name[MAX_ACCOUNT_NAME_LEN];					//账号名称	
	char				pass_md5[MAX_PASSWORD_MD5_CODE_LEN];		//密码MD5编码校验
	char				pass[MAX_ACCOUNT_PASS_LEN];
	unsigned int		ip;											//此客户端ip
	int					port;										//此客户端port
	CRITICAL_SECTION *	cts_state;
	CRITICAL_SECTION *	cts_recv;
	CRITICAL_SECTION *	cts_send;
	char			*	recv_buf;									/* 接受缓冲 */
	char			*	precv_start;								/* 接受缓冲-开始 */
	char			*	precv_end;									/* 接受缓冲-结束 */
	char			*	send_buf;									/* 发送缓冲 */
	char			*	psend_start;								/* 发送缓冲-开始 */
	char			*	psend_end;									/* 发送缓冲-结束 */
	char			*	precv_append;								/* 接受缓冲-附加存储 */
	char			*	psend_append;								/* 发送缓冲-附加存储 */	
	char			*	preserv_messagecode;						/* 被保存的mc */
	int					size_preserv_messagecode;					/* 被保存的mc大小 */
	int					size_recv_append;							/* 附加接受缓冲区大小 */
	int					size_send_append;							/* 附加发送缓冲区大小 */

	byte				charge_state;								//帐号收费状态
	byte				state;										//帐号状态
	int					state_persisit_time;						//帐号状态持续时间,以秒计
	int					last_handled_frame;
	int					curr_frame;
	int					offset_frame;
	int					num_char_in_account;	
	CHAR_LIST		*	pcharlist;									//角色列表
	CHARINFO		*	pcharInfo;									//角色信息,为核心结构
	CHARGE			*	pcharge;									//收费
	ACCOUNT_PARTICULAR * paccount_particular;						//帐号详细信息
	ACCOUNT_ORIGINAL *	paccount_original;
}ACCOUNT, * LPACCOUNT;

//以下定义用来提供快速搜索使用,仅使用单向搜索
typedef struct tagAccount_Key {
	byte		state;												//当前状态
	ACCOUNT	*	pacc;												//指向acc
}ACCOUNT_KEY, * LPACCOUNT_KEY;

//以下为定义在别的服务器登陆角色信息
typedef struct tagChar_IN_Grop{
	int					sessionid;									//会话id
	byte				state;
	char				name[MAX_CHAR_NAME_LEN];					//char名称
}CHAR_IN_GROP, * LPCHAR_IN_GROP;


typedef struct tagChar_Group_Info{
	int					lsuid;										//第三方LS服务器uid
	char				name[MAX_SERVERNAME_LEN];
	byte				state;
	CHAR_IN_GROP		cig[MAX_ACC_ONLINE];						//此LS服务器char在线
	struct tagChar_Group_Info *	pNext;
}CHAR_GROP_INFO, * LPCHAR_GROP_INFO;
















⌨️ 快捷键说明

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