void tagDataBlockWriteSet::AddToByteArray(const CGUID& guid)
{
	long size = sizeof(CGUID);
	if(guid == CGUID::GUID_INVALID)
	{
		size = 0;
	}
	AddBuff((uchar*)&size,1);
	AddBuff((uchar*)&guid,size);
}
Ejemplo n.º 2
0
bool CBuffPacket::WriteStream(const char* szData, uint32 u4Len)
{
	//ACE_Guard<ACE_Recursive_Thread_Mutex> WGuard(m_ThreadLock);
	if(u4Len + m_u4PacketLen >= MAX_PACKET_SIZE)
	{
		OUR_DEBUG((LM_ERROR, "[CBuffPacket::WriteStream] nSize = [%d] m_u4PacketLen = [%d] is more than MAX_PACKET_SIZE.\n", u4Len, m_u4PacketLen));
		sprintf_safe(m_szError, MAX_BUFF_500, "[CBuffPacket::WriteStream] nSize = [%d] m_u4PacketLen = [%d] is more than MAX_PACKET_SIZE.\n", u4Len, m_u4PacketLen);
		return false;
	}

	if(m_u4WritePtr + u4Len > m_u4PacketLen)
	{
		if(false == AddBuff(u4Len))
		{
			OUR_DEBUG((LM_ERROR, "[CBuffPacket::WriteStream] nSize = [%d] m_u4PacketLen = [%d] AddBuff false.\n", u4Len, m_u4PacketLen));
			return false;
		}

		//写入文本内容
		ACE_OS::memcpy(WritePtr(), szData, u4Len);
		WritePtr(u4Len);
		return true;
	}
	else
	{
		//写入文本内容
		ACE_OS::memcpy(WritePtr(), szData, u4Len);
		WritePtr(u4Len);
		return true;
	}
}
Ejemplo n.º 3
0
void cDuelSystem::WinnerBuff(LPOBJ lpObj)
{
    if(Utilits.gObjIsConnected(lpObj->m_Index))
    {
        AddBuff(lpObj,103,20,10,0,0,3600);

        if(Config.Logging)
        {
            Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System] Winner : [%s][%s] received a Gladiator Glory Buff",lpObj->AccountID, lpObj->Name);
        }
    }
}
Ejemplo n.º 4
0
int KHero::LuaAddBuff(Lua_State* L)
{
    BOOL            bResult     = false;
    BOOL            bRetCode    = false;
    DWORD           dwBuffID    = ERROR_ID;
    int             nTopIndex   = Lua_GetTopIndex(L);

    KGLOG_PROCESS_ERROR(nTopIndex == 1);

    dwBuffID  = (DWORD)Lua_ValueToNumber(L, 1);

    bRetCode = AddBuff(dwBuffID);
    KGLOG_PROCESS_ERROR(bRetCode);

Exit0:
    return 0;
}
Ejemplo n.º 5
0
BOOL KBuffList::Load(KBUFF_NODE_MAP& rmapBuffNode)
{
	BOOL bResult 	= false;
	BOOL bRetCode 	= false;
    KBUFF_NODE_MAP::iterator it = rmapBuffNode.begin();
    
    while (it != rmapBuffNode.end())
    {
        KBuffNode& rNode = it->second;

        bRetCode = AddBuff(it->first);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = SetBuffParam(it->first, g_pSO3World->m_nGameLoop + rNode.m_nLeftFrame, rNode.m_nActiveCount);
        KGLOG_PROCESS_ERROR(bRetCode);

        ++it;
    }

	bResult = true;
Exit0:
	return bResult;
}
void tagDataBlockWriteSet::AddToByteArray(const char* pStr)
{
	long size = lstrlen(pStr);
	AddBuff((uchar*)&size,sizeof(long));
	AddBuff((uchar*)pStr,size);
}
	// 添加数据
void tagDataBlockWriteSet::AddToByteArray(void* pSource, long n)
{
	//AddBuff((uchar*)&n,sizeof(long));
	AddBuff((uchar*)pSource,n);
}
Ejemplo n.º 8
0
void cDuelSystem::Run()
{
    for(short i = 0; i < MAX_DUEL_ROOMS; ++i)
    {
        if(this->g_DuelRooms[i].RoomFree == FALSE)
        {
            if(GetTickCount() - this->g_DuelRooms[i].dwStartTime < 5000)
            {
                continue;
            }

            for(short u = 0; u < MAX_DUEL_SEPARATORS; u++)
            {
                if(this->g_DuelRooms[i].szSeparators[u] == NULL)
                {
                    continue;
                }

                if(Utilits.gObjIsConnected(this->g_DuelRooms[i].szSeparators[u]->m_Index))
                {

                    if(this->g_DuelRooms[i].szSeparators[u]->MapNumber != 0x40)
                    {
                        this->SendEndDuel(this->g_DuelRooms[i].szSeparators[u]);

                        AddBuff(this->g_DuelRooms[i].szSeparators[u], 18, 0, 0, 0, 0, 1);

                        gObjViewportListProtocolCreate(this->g_DuelRooms[i].szSeparators[u]);

                        GCStateInfoSendg(this->g_DuelRooms[i].szSeparators[u], 0, 98);


                        if(Config.Logging)
                        {
                            Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System] Spectator [%s] Leave [%d] Room",this->g_DuelRooms[i].szSeparators[u]->Name, i + 1);
                        }

                        this->SendSpectatorRemove(u, i);
                        this->g_DuelRooms[i].szSeparators[u] = NULL;
                    }
                }
                else
                {
                    if(Config.Logging)
                    {
                        Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System] Spectator Leave Room [%d]", i + 1);
                    }

                    this->g_DuelRooms[i].szSeparators[u] = NULL;
                    this->SendSpectatorList(i);
                }

                SendSpectatorList(i);
            }

            if(this->g_DuelRooms[i].szlpObjOne != NULL || this->g_DuelRooms[i].szlpObjTy != NULL)
            {
                if
                (
                    Utilits.gObjIsConnected(this->g_DuelRooms[i].szlpObjOne->m_Index) == FALSE ||
                    Utilits.gObjIsConnected(this->g_DuelRooms[i].szlpObjTy->m_Index)  == FALSE
                )
                {
                    this->RoomReset(i);

                    continue;
                }
                else if
                (
                    (this->g_DuelRooms[i].szlpObjOne->MapNumber != 0x40 || this->g_DuelRooms[i].szlpObjTy->MapNumber  != 0x40) && this->g_DuelRooms[i].szWinner == FALSE
                )
                {
                    this->RoomReset(i);

                    continue;
                }

                else if(this->g_DuelRooms[i].szlpObjOne->Connected < PLAYER_PLAYING || this->g_DuelRooms[i].szlpObjTy->Connected  < PLAYER_PLAYING)
                {
                    this->RoomReset(i);

                    continue;
                }
            }
            else
            {
                this->RoomReset(i);

                continue;
            }

            if(this->UpdateLifebarTime < GetTickCount())
            {
                this->SendLifebarStatus(i);
                this->UpdateLifebarTime = GetTickCount() + 2000;
            }

            if(this->g_DuelRooms[i].dwTicketCount != 0)
            {
                if(this->g_DuelRooms[i].dwTicketCount < GetTickCount())
                {
                    this->RoomReset(i);

                    if(Config.Logging)
                    {
                        Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System] Room [%d] Cleaned", i + 1);
                    }
                }
            }

            if(this->g_DuelRooms[i].RoomFree == FALSE && this->g_DuelRooms[i].DuelWaiting == FALSE && this->g_DuelRooms[i].szWinner == FALSE)
            {
                for(short s = 0; s < MAX_DUEL_SEPARATORS; s++)
                {
                    if(this->g_DuelRooms[i].szSeparators[s] != NULL)
                    {
                        if(AddTab[this->g_DuelRooms[i].szSeparators[s]->m_Index].DUEL_SpecVisible == 1)
                        {
                            AddBuff(this->g_DuelRooms[i].szSeparators[s], 18, 0, 0, 0, 0, -10);

                            gObjViewportListProtocolDestroy(this->g_DuelRooms[i].szSeparators[s]);

                            if(Config.Logging)
                            {
                                Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System] Character [%s] Added Invisible", this->g_DuelRooms[i].szSeparators[s]->Name);
                            }

                            AddTab[this->g_DuelRooms[i].szSeparators[s]->m_Index].DUEL_SpecVisible = 0;
                        }
                    }
                }
            }
        }
    }

    for(short n = 0; n < MAX_DUEL_ROOMS; n++)
    {
        if(this->g_DuelRooms[n].DuelWaiting == TRUE)
        {
            if(Utilits.gObjIsConnected(this->g_DuelRooms[n].szlpObjOne->m_Index) == FALSE || Utilits.gObjIsConnected(this->g_DuelRooms[n].szlpObjTy->m_Index)  == FALSE )
            {
                this->RoomReset(n);

                continue;
            }
            else if(this->g_DuelRooms[n].szlpObjOne->Connected < PLAYER_PLAYING || this->g_DuelRooms[n].szlpObjTy->Connected  < PLAYER_PLAYING)
            {
                this->RoomReset(n);

                continue;
            }
        }
    }

    if(this->UpdateTickCount < GetTickCount())
    {
        for(short i = 8000; i < OBJECT_MAX; ++i)
        {
            LPOBJ lpObj    = (LPOBJ)OBJECT_POINTER(i);

            if((lpObj->m_IfState.use) && lpObj->m_IfState.type == 20)
            {
                this->SendDuelStatus(lpObj);
            }
        }

        this->UpdateTickCount = GetTickCount() + 6000;
    }

    return;
}
Ejemplo n.º 9
0
void cDuelSystem::RoomReset(short iRoom, bool dontMove, bool dontSendEnd)
{
    if(this->g_DuelRooms[iRoom].szlpObjOne != NULL) // Player 1
    {
        if(Utilits.gObjIsConnected(this->g_DuelRooms[iRoom].szlpObjOne->m_Index))
        {
            if(dontSendEnd == false)
            {
                this->SendEndDuel(this->g_DuelRooms[iRoom].szlpObjOne);
            }

            if(this->g_DuelRooms[iRoom].szlpObjOne->MapNumber == 0x40)
            {
                if(dontMove == false)
                {
                    gObjMoveGate(this->g_DuelRooms[iRoom].szlpObjOne->m_Index, DuelSystem.Config.DuelGate);
                }
            }
        }

        this->UserDuelInfoReset(this->g_DuelRooms[iRoom].szlpObjOne);
    }

    if(this->g_DuelRooms[iRoom].szlpObjTy != NULL)  // Player 2
    {
        if(Utilits.gObjIsConnected(this->g_DuelRooms[iRoom].szlpObjTy->m_Index))
        {
            if(dontSendEnd == false)
            {
                this->SendEndDuel(this->g_DuelRooms[iRoom].szlpObjTy);
            }

            if(this->g_DuelRooms[iRoom].szlpObjTy->MapNumber == 0x40)
            {
                if(dontMove == false)
                {
                    gObjMoveGate(this->g_DuelRooms[iRoom].szlpObjTy->m_Index, DuelSystem.Config.DuelGate);
                }
            }
        }

        this->UserDuelInfoReset(this->g_DuelRooms[iRoom].szlpObjTy);
    }

    for(short i = 0; i < MAX_DUEL_SEPARATORS; ++i)
    {
        if(this->g_DuelRooms[iRoom].szSeparators[i] != NULL)
        {
            this->SendEndDuel(this->g_DuelRooms[iRoom].szSeparators[i]);

            AddBuff(this->g_DuelRooms[iRoom].szSeparators[i], 18, 0, 0, 0, 0, 1);

            gObjViewportListProtocolCreate(this->g_DuelRooms[iRoom].szSeparators[i]);

            GCStateInfoSendg(this->g_DuelRooms[iRoom].szSeparators[i], 0, 98);

            gObjMoveGate(this->g_DuelRooms[iRoom].szSeparators[i]->m_Index, DuelSystem.Config.DuelGate);
        }

        this->g_DuelRooms[iRoom].szSeparators[i] = NULL;
    }

    this->g_DuelRooms[iRoom].szlpObjOne   = NULL;
    this->g_DuelRooms[iRoom].szPointsOne  = 0;

    this->g_DuelRooms[iRoom].szlpObjTy    = NULL;
    this->g_DuelRooms[iRoom].szPointsTy   = 0;

    this->g_DuelRooms[iRoom].RoomFree	  = TRUE;
    this->g_DuelRooms[iRoom].DuelWaiting  = FALSE;
    this->g_DuelRooms[iRoom].szWinner	  = FALSE;

    this->g_DuelRooms[iRoom].dwTicketCount= 0;
    this->g_DuelRooms[iRoom].dwStartTime  = 0;

    if(Config.Logging)
    {
        Log.ConsoleOutPut(1, c_Blue, t_Duel,"[Duel System] Room [%d] Has Restarted", iRoom +1);
    }
}