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

📄 skillmgr.cpp

📁 国内著名网络游戏dragon的服务端完整源码 内附完整数据库结构
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	case	SKILL_REFINE							:
	case	SKILL_FISH_HOOKING						:
	case	SKILL_NETTING							:
	case	SKILL_CUTTING							:
	case	SKILL_LUMBERING							:
	case	SKILL_BUTCHERING						:
	case	SKILL_DIGGING							:
	case	SKILL_MAKEPOWDER						:
	case	SKILL_SHEAR								:
	case	SKILL_CARPENTRY							:
	case	SKILL_BLACKSMITHY						:
	case	SKILL_COOKING							:
	case	SKILL_CLOTHING							:
	case	SKILL_TAILORING							:
	case	SKILL_BOWCRAFTING						:
	case	SKILL_FLETCHING							:
	case	SKILL_MAKEPOTION						:
	case	SKILL_MAKEMETAL							:
	case	SKILL_MAKEBOTTLE						:
	case	SKILL_CANDLEMAKING						:
	case	SKILL_SNOOPING							:
	case	SKILL_MAKEFIRE							:
	case	SKILL_TAMING							:
	case	SKILL_EVALUATE_INTELIGENCE				:
	case	SKILL_EVALUATE_WISDOM					:
	case	SKILL_ANATOMY_JUDGEMENT					:
	case	SKILL_ITEM_IDENTIFICATION				:
	case	TACTICS_Crapple							:
	case	TACTICS_swordmanship					:
	case	TACTICS_Archery							:
	case	TACTICS_Fencing							:
	case	TACTICS_Mace_fighting					:
	case	TACTICS_Pierce							:
	case	TACTICS_Whirl							:
	case	TACTICS_Hurl							:
	case	TACTICS_Parrying						:
	case	TACTICS_Double_Swordmanship				:
	case	TACTICS_Double_MaceFighting				:
	case	TACTICS_Magery							:
	case	TACTICS_Orison							:
	case	SKILL_GHOST_RESURRECTION				:
	case	SKILL_GM_CARPENTER						:
	case	SKILL_GM_BLACKSMITH						:
	case	SKILL_GM_COOK							:
	case	SKILL_GM_TAILOR							:
	case	SKILL_GM_BOWCRAFT						:
	case	SKILL_GM_ALCHEMIST						:
	case	SKILL_GM_CANDLEMAKER					:
	default:break;
	}
	return;
}

//npc甫 磷栏搁 唱棵 酒捞袍阑 父甸绢 霖促.  角菩 : 0   己傍 : 父电 酒捞袍 肮荐 馆券
//Npc_Item_Table
//NPC_ITEM_TABLE_TOTAL_ITEM			60							//惑磊 救俊 乐绰 酒捞袍狼 荐// 
//NPC_ITEM_TABLE_START_ITEM_POS		2							//硅凯救狼 困摹
//NPC_ITEM_TABLE_PROBABILITY_POS	62							//硅凯救狼 困摹.角力肺绰 50锅掳 困摹.
//NPC_ITEM_TABLE_BETWEEN_POS		63							//硅凯救狼 困摹.
//NPC_ITEM_TABLE_LEVEL_POS			1							//硅凯救狼 困摹.
int CSkillMgr::GetItemFallPercentPos(const int iFallNo)
{
	const int iTotalPer = ItemFallPercent[iFallNo].per[0];
	
	if( !iTotalPer ){ return 0;}
	const int iNowPer =rand()%iTotalPer;
	
	int iDummy = 0;
	int i = 1;
	for(; i < 21 ; i++)
	{
		iDummy += ItemFallPercent[iFallNo].per[i];
		if( iNowPer < iDummy )
		{
			break;
		}
	}
	return i;
}

int CSkillMgr::SetNPCItem(const int iBagNo, const bool bIsBasic, ItemAttr *pItem,const int iCallType)
{
	int iFallNo = 0;
	if(bIsBasic)
	{
		iFallNo = BasicItemBag[iBagNo].iBasicItemPercentTableNo;
	}
	else
	{
		iFallNo = RareItemBag[iBagNo].iRareItemBagPercentTableNo;
	}
	
	const int i = GetItemFallPercentPos(iFallNo);

	if(bIsBasic)
	{
		if(iCallType)//1捞搁 饭傈靛 酒捞袍
		{
			*pItem = ItemMgr.GiveLegendItem(BasicItemBag[iBagNo].ItemNo[i]);
		}
		else // 0捞搁 畴富 酒捞袍
		{
			*pItem = ItemMgr.GenerateItem(BasicItemBag[iBagNo].ItemNo[i]);
		}
		return 1;
	}
	else
	{
		RareMain rare;
		t_RareItemBag RareBag = RareItemBag[iBagNo];
		const int iR = rand()%100;
		if( 20 > iR )//20捞窍绰 饭绢啊 唱柯促
		{
			*pItem = ItemMgr.GiveRareItem(RareBag.ItemNo[i],0,RARE_ABLE,1,RareBag.iGradeMin,RareBag.iGradeMax,rare,H_LV_NO_HIGH_ITEM);//020725 lsw
		}
		else
		{
			*pItem = ItemMgr.GiveRareItem(RareBag.ItemNo[i],0,RARE_ABLE,1,RareBag.iGradeMin,RareBag.iGradeMax,rare,H_LV_HIGH_ITEM);//020725 lsw
		}
		return 1;
	}
	return 0;
}

int CSkillMgr::SetNPCInventory(CHARLIST *NPC, const int iItemControlNo,ItemAttr* pItem, const int iCallType)
{
	int a = 0, b = 0, c = 0;
	
	const int iFallNo	= ItemControl[iItemControlNo].ItemControlPercentNo;
	const int iTotalPer = ItemControlPercent[iFallNo].per[0];
	
	if( !iTotalPer ){ return 0;}
	const int iNowPer =rand()%iTotalPer;
	
	int iDummy = 0;
	int i = 1;
	for(; i < 8 ; i++)
	{
		iDummy += ItemControlPercent[iFallNo].per[i];
		if( iNowPer < iDummy )
		{
			break;
		}
	}

	switch(i)
	{
	case 1://老馆 酒捞袍 归
	case 2:
	case 3:
	case 4:
	case 5:
		{
			return SetNPCItem(ItemControl[iItemControlNo].ItemGroup[i], true,pItem,iCallType);
		}break;
	case 6://饭绢 酒捞袍 归
	case 7:
		{
			return SetNPCItem(ItemControl[iItemControlNo].ItemGroup[i], false,pItem);
		}break;
	default:
		{
		}break;
	}
	return 0;
}

int CSkillMgr::GenerateNPCItem2(CHARLIST *NPC, NPC_Generation *NPCGenerate)
{	
	//浚乔揪啊 积己 瞪锭 惑炔阑 魄窜 茄促
	//乞惑矫, 漂沥甘, 朝楼 , 捞亥飘 阁胶磐 
	int iItemControlNo = 0;

	if(rand()%2)//乞惑矫
	{
		iItemControlNo = NPCGenerate->Inventory[0];//0~14 鳖瘤聪鳖
	}
	else
	{
		iItemControlNo = NPCGenerate->Inventory[1];//0~14 鳖瘤聪鳖
	}

	const int iMyMapGroup = MapInfo[MapNumber].group;

	if(NPCGenerate->Inventory[2] && iMyMapGroup == NPCGenerate->Inventory[2] )//甘弊缝
	{//鞍篮 弊缝狼 甘捞搁
		iItemControlNo = NPCGenerate->Inventory[3];
	}

	if(NPCGenerate->Inventory[4] && iMyMapGroup == NPCGenerate->Inventory[4] )//甘弊缝
	{//鞍篮 弊缝狼 甘捞搁
		iItemControlNo = NPCGenerate->Inventory[5];
	}

	if(NPCGenerate->Inventory[6] && iMyMapGroup == NPCGenerate->Inventory[6] )//甘弊缝
	{//鞍篮 弊缝狼 甘捞搁
		iItemControlNo = NPCGenerate->Inventory[7];
	}

	//朝楼
	if(NPCGenerate->Inventory[8]/10000 && NPCGenerate->Inventory[8]%10000)
	{
		if(IsEquipAbleCheckAbleDay(NPCGenerate->Inventory[8]/10000,NPCGenerate->Inventory[8]%10000))
		{
			iItemControlNo = NPCGenerate->Inventory[9];//0~14 鳖瘤聪鳖
		}
	}
	
	if(GT_EVENT_MONSTER == NPC->generationtype)
	{
		switch(NPC->GainedFame)	//1捞搁 焊胶绊 0搁 妒付聪
		{
		case 0:
			{
				if( NPCGenerate->Inventory[10])
				{
					iItemControlNo = NPCGenerate->Inventory[10];//0~14 鳖瘤聪鳖
				}
			}break;
		default:
			{
				if( NPCGenerate->Inventory[11])
				{
					 iItemControlNo = NPCGenerate->Inventory[11];//0~14 鳖瘤聪鳖
				}
			}
		}
	}

	const int iMax= ItemControl[iItemControlNo].iFallItemCount;

	for(int iCount = 0; iMax > iCount ; iCount++)
	{
		ItemAttr *pItem = SearchInv(NPC);
		if(pItem)
		{
			SetNPCInventory(NPC,iItemControlNo,pItem);
		}
	}

	//021113 lsw
	const int iMyMapClass = MapInfo[MapNumber].Class;
	if(NPCGenerate->Inventory[12] && iMyMapClass == NPCGenerate->Inventory[12] )//甘努贰胶啊 鞍促
	{	//鞍篮 努贰胶狼 甘捞搁
		iItemControlNo = NPCGenerate->Inventory[13];

		const int iMax= ItemControl[iItemControlNo].iFallItemCount;

		for(int iCount = 0; iMax > iCount ; iCount++)
		{
			ItemAttr *pItem = SearchInv(NPC);
			if(pItem)
			{
				SetNPCInventory(NPC,iItemControlNo,pItem,1);
			}
		}
	}
	//捣 持扁
	if( (rand()%100) < 30 ) 
	{
		int iRandMoney = NPCGenerate->Money_Max - NPCGenerate->Money_min;
		if( iRandMoney > 0 ) 
		{
			iRandMoney = rand()%iRandMoney;
		}
		else 
		{
			iRandMoney = 0;
		}
		const int iMoney= NPCGenerate->Money_min + iRandMoney;
		ItemAttr item;
		if( iMoney> 0 )
		{
			if(LocalMgr.IsChangeMoney())//030102 lsw
			{
				if( iMoney > 5 ) 
				{
					item = GenerateItem( IN_NEW_COINS, IATTR_MUCH,iMoney);			// 010204 YGI
				}
				else// if( iMoney <= 5 ) 
				{
					item = GenerateItem( IN_NEW_COIN, IATTR_MUCH, iMoney);//020505 lsw
				}
			}
			else
			{
				if( iMoney > 5 ) 
				{
					item = GenerateItem( IN_COINS, IATTR_MUCH,iMoney);			// 010204 YGI
				}
				else// if( iMoney <= 5 ) 
				{
					item = GenerateItem( IN_COIN, IATTR_MUCH,iMoney);//020505 lsw
				}
			}
			ItemAttr* pItem = SearchInv(NPC);
			if(pItem)
			{
				*pItem = item;
			}
		}
	}

	return 0;
}

int CSkillMgr::FallItemWhenNPCDie(CHARLIST *NPC)//酒捞袍 皋聪历肺 颗败具 且 巴 鞍促..
{
	for( int k = 0 ; k < 3 ; k ++)
	{
		for( int j = 0 ; j < 3 ; j ++)
		{
			for( int i = 0 ; i < 8 ; i ++)
			{	 	
				ItemAttr item = NPC->inv[k][j][i];
				if( item.item_no )
				{	
					DropItem( NPC->X + (rand()%100)-50, NPC->Y +(rand()%100)-50, &item);	
				}	
			}
		}
	}
	int Npcno = NPC->SprNo + NPC->mutant * 100;
	if( !(Npcno<0 || Npcno>400) )
	{
		GiveSpecialItem(Npcno,NPC->X,NPC->Y,MapNumber,0);
	}
	return 0;
}

void CSkillMgr::SendCMD_CONFORM_SADONIX(const int cn, const int iItemNo, const int kind,const int x , const int y)
{
	CHARLIST *ch = ::CheckServerId(cn);
	if(ch)
	{
		t_packet p;
		p.h.header.type = CMD_CONFORM_SADONIX;
		p.h.header.size = sizeof(t_ConformSadonix);

		p.u.ConformSadonix.cn = cn;
		
		memcpy (p.u.ConformSadonix.name,ch->Name,20);
		
		p.u.ConformSadonix.item.item_no= iItemNo;
		p.u.ConformSadonix.kind= kind;
		
		p.u.ConformSadonix.x = x;
		p.u.ConformSadonix.y = y;

		QueuePacket(connections,DB_DEMON,&p,1);
	}
}

void CSkillMgr::RecvCMD_CONFORM_SADONIX(const t_packet &p)
{
	const int cn		=	p.u.ConformSadonix.cn;
	const int item_no	=	p.u.ConformSadonix.item.item_no;
	const int kind		=	MapInfo[MapNumber].port;
	const int x			=	p.u.ConformSadonix.x;
	const int y			=	p.u.ConformSadonix.y;

	ItemAttr item		=	GenerateItem(item_no);
	CHARLIST *ch =	::CheckServerId(cn);
	if(!ch)
	{
		MyLog(2,"RecvCMD_CONFORM_SADONIX Receiver Is Fault!.");
		return;
	}

	switch(item_no)
	{
	case	SADONIX_NO:		{	ch->nSkillSadCount	= 0;	}break;//捞芭 瘤况具 且淀..
	case	BLESSLEAF_NO:	{	ch->nSkillBlessLeaf = 0;	}break;
	default:
		{	
			::MyLog(2,"RecvCMD_CONFORM_SADONIX Item No Is Wrong");
			return;
		}break;
	}

	::OutSound(ch,0,51);
	::OutMessage(ch,2,950);

	DropItem(x+rand()%50-25, y+rand()%50-25,&item);
	Send_RareItemMakeLog(	cn,	item_no,
							0,0,0,0,0,
							0,0,0,0,
							item.attr[IATTR_LIMIT],
							item.attr[IATTR_MUCH],
							0,3000,kind,//器飘//鸥涝档 3000
							0,0,0,0,
							3000,0
							);
}

// 辑滚俊辑 某腐磐狼 付过俊 狼茄 惑怕甫 檬扁拳窃.
// 檬扁拳窍搁辑 郴侩篮 Packet棵 努扼捞攫飘肺 傈价茄促. 
inline void Init_CharacterCondition(CHARLIST* ch)
{
  if (ch->GetState() != CON_NORMAL)//0x00 惑怕啊 沥惑捞 酒囱 版快
  { 
		ch->SetState(CON_NORMAL);
		SendCharacterCondition(ch, 0);
	}

  ch->Clear();
}

inline void aliveCharacter(CHARLIST *d)
{	
	d->bAlive = ALIVE_;	
	d->InitCurse();
	d->deadcount = 0;
	d->Peacests = 0;
	d->viewtype = VIEWTYPE_NORMAL_;
	Init_CharacterCondition( d );
}

⌨️ 快捷键说明

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