Esempio n. 1
0
BOOL NpcAdniel(LPOBJ lpNpc,LPOBJ lpObj )
{
	if ( bCanChaosBox == TRUE )
	{
		PMSG_TALKRESULT pMsg;

		pMsg.h.c = 0xC3;
		pMsg.h.headcode = 0x30;
		pMsg.h.size = sizeof(pMsg);
		
		if ( lpObj->m_bPShopOpen == true )
		{
			LogAdd("[%s][%s] is Already Opening PShop, ChaosBox Failed",
				lpObj->AccountID, lpObj->Name);
			GCServerMsgStringSend(lMsg.Get(MSGGET(4, 194)), lpObj->m_Index, 1);
			return TRUE;
		}

		lpObj->m_IfState.type = 7;
		lpObj->m_IfState.state = 0;
		lpObj->m_IfState.use = 1;
		

		// 39 - entering acheron
		// 40 - arca war npc
		// 41 - mix npc

		pMsg.result = 41;
		lpObj->bIsChaosMixCompleted = false;
		pMsg.level1 = gDQChaosSuccessRateLevel1;
		pMsg.level2 = gDQChaosSuccessRateLevel2;
		pMsg.level3 = gDQChaosSuccessRateLevel3;
		pMsg.level4 = gDQChaosSuccessRateLevel4;
		pMsg.level5 = gDQChaosSuccessRateLevel5;
		pMsg.level6 = gDQChaosSuccessRateLevel6;

		DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);

		GCAnsCsMapSvrTaxInfo(lpObj->m_Index, 1, g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index));
		gObjInventoryTrans(lpObj->m_Index);

		LogAddTD("[%s][%s] Open Chaos Box", lpObj->AccountID, lpObj->Name);
		gObjItemTextSave(lpObj);
		gObjWarehouseTextSave(lpObj);
	}
	return true;
}
Esempio n. 2
0
BOOL NpcElderCircle(LPOBJ lpNpc, LPOBJ lpObj)
{
if ( (lpObj->m_IfState.use ) > 0 )
	{
		return TRUE;
	}

#if(GS_CASTLE==1)
	if(g_CastleSiege.GetCastleState() == 7) //Good
	{
		ChatTargetSend(lpNpc,(lMsg.Get(MSGGET(6, 85))), lpObj->m_Index);
		return TRUE;
	}

	 //0001:001d2150       _strcmp                    005d3150 f   libcmt:strcmp.obj

	if(strcmp(lpObj->GuildName, "") == 0 ) //Good
	{
		ChatTargetSend(lpNpc,(lMsg.Get(MSGGET(6, 86))), lpObj->m_Index);
		return TRUE;
	}

	if(g_CastleSiege.CheckGuildOwnCastle(lpObj->GuildName)) //Good
	{
		if( lpObj->GuildStatus != 128 )
		{
			if ( lpObj->GuildStatus != 64 )
			{
				ChatTargetSend(lpNpc,(lMsg.Get(MSGGET(6, 86))), lpObj->m_Index);
				return TRUE;
			}
		}
	}
#endif

	PMSG_TALKRESULT pMsg;

	pMsg.h.c = 0xC3;
	pMsg.h.headcode = 0x30;
	pMsg.h.size = sizeof(pMsg);
	pMsg.result = 0x0C;

	lpObj->m_IfState.use = 1;
	lpObj->m_IfState.type = 12;

#if(GS_CASTLE==1)
	pMsg.level1 = 0;
	pMsg.level2 = 0;
	pMsg.level3 = 0;
	pMsg.level4 = 0;
	pMsg.level5 = 0;
	pMsg.level6 = 0;

	if( bCanChaosBox == TRUE) //Good
	{
		lpObj->m_IfState.type = 7;

		lpObj->bIsChaosMixCompleted = false;
		lpObj->m_bCsGuildInvolved = false; //Good

		pMsg.level1 = 1; //Good

		GCAnsCsMapSvrTaxInfo(lpObj->m_Index, 1, g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index));
		gObjInventoryTrans(lpObj->m_Index);

		LogAddTD("[%s][%s] Open Chaos Box", lpObj->AccountID, lpObj->Name);
		gObjItemTextSave(lpObj);
		gObjWarehouseTextSave(lpObj);
	}
#endif

	DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);
	return TRUE;
}
BOOL CJewelOfHarmonySystem::NpcJewelOfHarmony(LPOBJ lpNpc, LPOBJ lpObj)
{
	if ( lpObj->m_IfState.use > 0 )
		return TRUE;

	PMSG_TALKRESULT pResult;

	pResult.h.c = 0xC3;
	pResult.h.headcode = 0x30;
	pResult.h.size = sizeof(pResult);
	
	if ( lpNpc->Class == 368 )
	{
		pResult.result = 17;
		pResult.level1 = this->m_iRatePuritySuccess;

		if ( this->m_bSystemPrutiyJewel != TRUE )
		{
			GCServerMsgStringSend(lMsg.Get(MSGGET(13,50)), lpObj->m_Index, 1);
			return TRUE;
		}

		if ( !this->IsEnableToUsePuritySystem() )
		{
			GCServerMsgStringSend(lMsg.Get(MSGGET(13,50)), lpObj->m_Index, 1);
			CLog.LogAdd("[JewelOfHarmony][%s][%s] Not Purtiy Time ",
				lpObj->AccountID, lpObj->Name);

			return TRUE;
		}
	}
	else  if ( lpNpc->Class == 369 )
	{
		pResult.result = 18;
		pResult.level1 = this->m_iRateMixSmeltingStoneNor;
		pResult.level2 = this->m_iRateMixSmeltingStoneExt;

		if ( this->m_bSystemMixSmeltingStone != TRUE )
		{
			ChatTargetSend(lpNpc, lMsg.Get(MSGGET(13,53)), lpObj->m_Index);
			return TRUE;
		}
	}
	else if ( lpNpc->Class == 370 )
	{
		pResult.result = 19;

		if ( this->m_bSystemRestoreStrengthen != TRUE )
		{
			ChatTargetSend(lpNpc, lMsg.Get(MSGGET(13,54)), lpObj->m_Index);
			return TRUE;
		}
	}
	else
	{
		CLog.LogAdd("[JewelOfHarmony][%s][%s] Open Chaos Box Failed NpcType [%d]",
			lpObj->AccountID, lpObj->Name, lpNpc->Class);

		return TRUE;
	}

	if ( bCanChaosBox == TRUE )
	{
		if ( lpObj->m_bPShopOpen == true )
		{
			CLog.LogAdd("[JewelOfHarmony][%s][%s] is Already Opening PShop, ChaosBox Failed",
				lpObj->AccountID, lpObj->Name);

			GCServerMsgStringSend(lMsg.Get(MSGGET(4,194)), lpObj->m_Index, 1);
			return TRUE;
		}

		lpObj->m_IfState.type = 7;
		lpObj->m_IfState.state = 0;
		lpObj->m_IfState.use = 1;
		lpObj->bIsChaosMixCompleted = false;

		gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);
		gObjInventoryTrans(lpObj->m_Index);

		CLog.LogAdd("[JewelOfHarmony][%s][%s] Open Chaos Box",
			lpObj->AccountID, lpObj->Name);

		gObjItemTextSave(lpObj);
		gObjWarehouseTextSave(lpObj);
		GCAnsCsMapSvrTaxInfo(lpObj->m_Index, 1, g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index));
	}

	return TRUE;
}
Esempio n. 4
0
bool CShop::BuyShopItemAndDelete(int Pos, int aIndex,CShop *Shop)
{
	LPOBJ lpObj = &gObj[aIndex];
	if ( Shop->m_item[Pos].IsItem() == TRUE )
	{
		PMSG_BUYRESULT pResult;

		PHeadSetB((LPBYTE)&pResult, 0x32, sizeof(pResult));
		pResult.Result = -1;

		int iStoreTaxMoney = Shop->m_item[Pos].m_BuyMoney + (int)((__int64)Shop->m_item[Pos].m_BuyMoney * (__int64)g_CastleSiegeSync.GetTaxRateStore(lpObj->m_Index) / (__int64)100);

		if ( iStoreTaxMoney < 0 )
			iStoreTaxMoney  = 0;

		int iStoreTaxMoney2 = (int)((__int64)Shop->m_item[Pos].m_BuyMoney * (__int64)g_CastleSiegeSync.GetTaxRateStore(lpObj->m_Index) / (__int64)100);

		if ( iStoreTaxMoney2 < 0 )
			iStoreTaxMoney2  = 0;

		if ( lpObj->Money < iStoreTaxMoney )
			pResult.Result = -1;
		else
		{
			BOOL bNoItem = TRUE;

			if ( (Shop->m_item[Pos].m_Type >= ITEMGET(14,0) && Shop->m_item[Pos].m_Type <= ITEMGET(14,8)) ||
				(Shop->m_item[Pos].m_Type >= ITEMGET(14,35) && Shop->m_item[Pos].m_Type <= ITEMGET(14,40)))
			{
				int dur = (int)Shop->m_item[Pos].m_Durability;

				if ( dur == 0 )
					dur = 1;

				if ( ::gObjSearchItem(lpObj, Shop->m_item[Pos].m_Type,dur, Shop->m_item[Pos].m_Level) == TRUE )
				{
					bNoItem = FALSE;
					lpObj->Money -= iStoreTaxMoney;
					::g_CastleSiegeSync.AddTributeMoney(iStoreTaxMoney2);

					if ( lpObj->Money < 0 )
						lpObj->Money = 0;


					::GCMoneySend(lpObj->m_Index, lpObj->Money);
				}
			}

			if ( bNoItem != FALSE )
			{
				pResult.Result = gObjShopBuyInventoryInsertItem(lpObj->m_Index, Shop->m_item[Pos]);

				if ( pResult.Result != 0xFF )
				{
					ItemByteConvert((LPBYTE)&pResult.ItemInfo, Shop->m_item[Pos]);
					int lc64 = Shop->m_item[Pos].m_BuyMoney;
					lpObj->Money -= iStoreTaxMoney;
					::g_CastleSiegeSync.AddTributeMoney(iStoreTaxMoney2);

					if ( lpObj->Money < 0 )
						lpObj->Money = 0;

					GCMoneySend(lpObj->m_Index, lpObj->Money);
					int iTaxRate = g_CastleSiegeSync.GetTaxRateStore(lpObj->m_Index);

					for (int i = 0; i < Type.size(); i++)
					{
						int type = ITEMGET(Type[i],Index[i]); 
						if ( type == Shop->m_item[Pos].m_Type && Dur[i] == Shop->m_item[Pos].m_Durability && Level[i] == Shop->m_item[Pos].m_Level && 
							Opt1[i] == Shop->m_item[Pos].m_Option1 && Opt2[i] == Shop->m_item[Pos].m_Option2 && Opt3[i] == Shop->m_item[Pos].m_Option3 )
						{
							Type[i] = -1;
							Index[i] = -1;
							Dur[i] = -1;
							Level[i] = -1;
							Opt1[i] = -1;
							Opt2[i] = -1;
							Opt3[i] = -1;
							break;
						}
					}

					Shop->m_item[Pos].Clear();

					Shop->SendItemDataLen -= 8;
					Shop->ItemCount -- ;
					Shop->RefreshShopItems();
					DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);


					LogAdd("[%s][%s] (%d) Shop buy [%d][%d][%d][%s] LEV:%d, DUR:%d, OP:[%d][%d][%d]",
						lpObj->AccountID, lpObj->Name, 14, lc64, iTaxRate, lc64+iStoreTaxMoney2, Shop->m_item[Pos].GetName(),
						Shop->m_item[Pos].m_Level, Shop->m_item[Pos].m_Durability,
						Shop->m_item[Pos].m_Option1, Shop->m_item[Pos].m_Option2,
						Shop->m_item[Pos].m_Option3);


					if ( Shop->ItemCount < 1 )
					{
						PMSG_TALKRESULT pResult;
						lpObj->TargetShopNumber = -1;
						lpObj->m_IfState.use = 0;
						lpObj->m_IfState.type = 0;
						lpObj->m_ShopTime = 0;
						pResult.h.c = 0xC3;
						pResult.h.headcode = 0x30;
						pResult.h.size = sizeof(pResult);
						pResult.result = -1;
						DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);

						/*if ( Random(0,1) != 0 )
							ChatTargetSend(&gObj[DealerNumber], lMsg.Get(MSGGET(4, 119)), aIndex);//#info - ChatTargetSend - может что то интересненькое
						else
							ChatTargetSend(&gObj[DealerNumber], lMsg.Get(MSGGET(4, 120)), aIndex);*/

						return true;
					}
					else
					{
						lpObj->TargetShopNumber = 14;
						lpObj->m_IfState.use = 1;
						lpObj->m_IfState.type = 3;
						lpObj->m_ShopTime = 0;

						

						PMSG_SHOPITEMCOUNT pShopItemCount;
						BYTE SendByte[1024];
						int lOfs = 0;

						lOfs += sizeof(pShopItemCount );

						int size = lOfs + Shop->SendItemDataLen;
						PHeadSetW((LPBYTE)&pShopItemCount, 0x31, size);
						pShopItemCount.Type = 0;
						pShopItemCount.count = Shop->ItemCount;
						memcpy(SendByte, &pShopItemCount, sizeof(pShopItemCount));
						memcpy(&SendByte[lOfs], Shop->SendItemData, Shop->SendItemDataLen);

						DataSend(lpObj->m_Index, SendByte, size);
						GCAnsCsMapSvrTaxInfo(lpObj->m_Index,2,  ::g_CastleSiegeSync.GetTaxRateStore(lpObj->m_Index));

						return true;
					}

				}
			}
		}
	}

	return false;
}
Esempio n. 5
0
BOOL NpcElderCircle(LPOBJ lpNpc, LPOBJ lpObj)
{
#if (GS_CASTLE == 1)
	if ( (lpObj->m_IfState.use ) > 0 )
	{
		return TRUE;
	}

	if( g_CastleSiege.GetCastleState() == CASTLESIEGE_STATE_STARTSIEGE)
	{
		ChatTargetSend(lpNpc,lMsg.Get(MSGGET(6,85)),lpObj->m_Index);
		return TRUE;
	}

	if( strcmp(lpObj->GuildName,"") == NULL)
	{
		ChatTargetSend(lpNpc,lMsg.Get(MSGGET(6,86)),lpObj->m_Index);
		return TRUE;
	}

	if( g_CastleSiege.CheckGuildOwnCastle(lpObj->GuildName) == FALSE
		|| (lpObj->GuildStatus != G_MASTER && lpObj->GuildStatus != G_SUB_MASTER))
	{
		ChatTargetSend(lpNpc,lMsg.Get(MSGGET(6,86)),lpObj->m_Index);
		return TRUE;
	}

	PMSG_TALKRESULT pMsg;

	pMsg.h.c = 0xC3;
	pMsg.h.headcode = 0x30;
	pMsg.h.size = sizeof(pMsg);
	pMsg.result = 0x0C;

	lpObj->m_IfState.use = 1;
	lpObj->m_IfState.type = 12;

	pMsg.level1 = 0;
	pMsg.level2 = 0;
	pMsg.level3 = 0;
	pMsg.level4 = 0;
	pMsg.level5 = 0;
	pMsg.level6 = 0;

	if( bCanChaosBox == TRUE )
	{
		lpObj->m_IfState.type = 7;
		lpObj->bIsChaosMixCompleted = FALSE;
		pMsg.level1 = 1;

		GCAnsCsMapSvrTaxInfo(lpObj->m_Index,1,g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index));
		gObjInventoryTrans(lpObj->m_Index);
		LogAddTD("[%s][%s] Open Chaos Box",
			lpObj->AccountID,lpObj->Name);

		gObjItemTextSave(lpObj);
		gObjWarehouseTextSave(lpObj);
	}

	DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);
#endif



	return TRUE;
}