• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ARCEMU_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ARCEMU_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ ARCEMU_ASSERT函数的具体用法?C++ ARCEMU_ASSERT怎么用?C++ ARCEMU_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ARCEMU_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetEntry

void Item::Create(uint32 itemid, Player* owner)
{
    SetEntry(itemid);

    if (owner)
    {
        uint64 OwnerGUID = owner->GetGUID();

        SetOwnerGUID(OwnerGUID);
        SetContainerGUID(OwnerGUID);
    }

    SetStackCount(1);

    m_itemProto = ItemPrototypeStorage.LookupEntry(itemid);

    ARCEMU_ASSERT(m_itemProto != NULL);

    SetCharges(0, m_itemProto->Spells[0].Charges);
    SetCharges(1, m_itemProto->Spells[1].Charges);
    SetCharges(2, m_itemProto->Spells[2].Charges);
    SetCharges(3, m_itemProto->Spells[3].Charges);
    SetCharges(4, m_itemProto->Spells[4].Charges);
    SetDurability(m_itemProto->MaxDurability);
    SetDurabilityMax(m_itemProto->MaxDurability);

    m_owner = owner;
    locked = m_itemProto->LockId ? true : false;
}
开发者ID:lev1976g,项目名称:easywow,代码行数:29,代码来源:Item.cpp


示例2: ARCEMU_ASSERT

void Container::LoadFromDB(Field* fields)
{

    uint32 itemid = fields[2].GetUInt32();
    m_itemProto = ItemPrototypeStorage.LookupEntry(itemid);

    ARCEMU_ASSERT(m_itemProto != NULL);
    SetEntry(itemid);


    SetCreatorGUID(fields[5].GetUInt32());
    SetStackCount(1);

    SetUInt32Value(ITEM_FIELD_FLAGS, fields[8].GetUInt32());
    SetItemRandomPropertyId(fields[9].GetUInt32());

    SetDurabilityMax(m_itemProto->MaxDurability);
    SetDurability(fields[12].GetUInt32());


    SetNumSlots(m_itemProto->ContainerSlots);

    m_Slot = new Item*[m_itemProto->ContainerSlots];
    memset(m_Slot, 0, sizeof(Item*) * (m_itemProto->ContainerSlots));

}
开发者ID:Nupper,项目名称:AscEmu,代码行数:26,代码来源:Container.cpp


示例3: va_start

void Guild::LogGuildEvent(uint8 iEvent, uint8 iStringCount, ...)
{
	if(!m_commandLogging)
		return;

	va_list ap;
	char* strs[4] = {NULL, NULL, NULL, NULL};

	va_start(ap, iStringCount);
	ARCEMU_ASSERT(iStringCount <= 4);

	WorldPacket data(SMSG_GUILD_EVENT, 100);
	uint32 i;
	data << iEvent;
	data << iStringCount;

	for(i = 0; i < iStringCount; ++i)
	{
		strs[i] = va_arg(ap, char*);
		data << strs[i];
	}

	va_end(ap);
	SendPacket(&data);
}
开发者ID:Antares84,项目名称:arcemu,代码行数:25,代码来源:Guild.cpp


示例4: ARCEMU_ASSERT

bool QuestLogEntry::LoadFromDB(Field* fields)
{
	// playerguid,questid,timeleft,area0,area1,area2,area3,kill0,kill1,kill2,kill3
	int f = 3;
	ARCEMU_ASSERT(m_plr && m_quest);
	expirytime = fields[f].GetUInt32();
	f++;
	for(int i = 0; i < 4; ++i)
	{
		m_explored_areas[i] = fields[f].GetUInt32();
		f++;
		CALL_QUESTSCRIPT_EVENT(this, OnExploreArea)(m_explored_areas[i], m_plr, this);
	}

	for(int i = 0; i < 4; ++i)
	{
		m_mobcount[i] = fields[f].GetUInt32();
		f++;
		if(GetQuest()->required_mobtype[i] == QUEST_MOB_TYPE_CREATURE)
		{
			CALL_QUESTSCRIPT_EVENT(this, OnCreatureKill)(GetQuest()->required_mob[i], m_plr, this);
		}
		else
		{
			CALL_QUESTSCRIPT_EVENT(this, OnGameObjectActivate)(GetQuest()->required_mob[i], m_plr, this);
		}
	}

	completed = fields[f].GetUInt32();

	mDirty = false;
	return true;
}
开发者ID:Antares84,项目名称:arcemu,代码行数:33,代码来源:Quest.cpp


示例5: ARCEMU_ASSERT

void WorldSocket::Authenticate()
{
	ARCEMU_ASSERT(pAuthenticationPacket != NULL);
	mQueued = false;

	if(mSession == NULL)
		return;

	if(mSession->HasFlag(ACCOUNT_FLAG_XPACK_02))
		OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x02");
	else if(mSession->HasFlag(ACCOUNT_FLAG_XPACK_01))
		OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x01");
	else
		OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x00");

	sAddonMgr.SendAddonInfoPacket(pAuthenticationPacket, static_cast< uint32 >(pAuthenticationPacket->rpos()), mSession);
	mSession->_latency = _latency;

	delete pAuthenticationPacket;
	pAuthenticationPacket = NULL;

	sWorld.AddSession(mSession);
	sWorld.AddGlobalSession(mSession);

	if(mSession->HasGMPermissions())
		sWorld.gmList.insert(mSession);

}
开发者ID:dberga,项目名称:arcbliz,代码行数:28,代码来源:WorldSocket.cpp


示例6: ARCEMU_ASSERT

MapMgr* InstanceMgr::_CreateInstance(uint32 mapid, uint32 instanceid)
{
    MapInfo const* inf = sMySQLStore.GetWorldMapInfo(mapid);

    ARCEMU_ASSERT(inf != nullptr && inf->type == INSTANCE_NULL);
    ARCEMU_ASSERT(mapid < NUM_MAPS && m_maps[mapid] != NULL);

    LogNotice("InstanceMgr : Creating continent %s.", m_maps[mapid]->GetMapName().c_str());

    MapMgr* newMap = new MapMgr(m_maps[mapid], mapid, instanceid);

    ARCEMU_ASSERT(newMap != NULL);

    // Scheduling the new map for running
    ThreadPool.ExecuteTask(newMap);
    m_singleMaps[mapid] = newMap;

    return newMap;
}
开发者ID:master312,项目名称:AscEmu,代码行数:19,代码来源:WorldCreator.cpp


示例7: ARCEMU_ASSERT

MapMgr* InstanceMgr::_CreateInstance(uint32 mapid, uint32 instanceid)
{
	MapInfo* inf = WorldMapInfoStorage.LookupEntry(mapid);

	ARCEMU_ASSERT(inf != NULL && inf->type == INSTANCE_NULL);
	ARCEMU_ASSERT(mapid < NUM_MAPS && m_maps[ mapid ] != NULL);

	Log.Notice("InstanceMgr", "Creating continent %s.", m_maps[mapid]->GetName());

	MapMgr* newMap = new MapMgr(m_maps[mapid], mapid, instanceid);

	ARCEMU_ASSERT(newMap != NULL);

	// Scheduling the new map for running
	ThreadPool.ExecuteTask(newMap);
	m_singleMaps[mapid] = newMap;

	return newMap;
}
开发者ID:Selenah,项目名称:ArcEmu,代码行数:19,代码来源:WorldCreator.cpp


示例8: ARCEMU_ASSERT

AuctionHouse::AuctionHouse(uint32 ID)
{
    dbc = sAuctionHouseStore.LookupEntry(ID);
    ARCEMU_ASSERT(dbc != NULL);

    cut_percent = dbc->tax / 100.0f;
    deposit_percent = dbc->fee / 100.0f;

    enabled = true;
}
开发者ID:Lbniese,项目名称:AscEmu,代码行数:10,代码来源:AuctionHouse.cpp


示例9: ARCEMU_ASSERT

void Arena::HookOnPlayerDeath(Player* plr)
{
	ARCEMU_ASSERT(plr != NULL);

	if(plr->m_isGmInvisible == true) return;

	if(m_playersAlive.find(plr->GetLowGUID()) != m_playersAlive.end())
	{
		m_playersCount[plr->GetTeam()]--;
		UpdatePlayerCounts();
		m_playersAlive.erase(plr->GetLowGUID());
	}
}
开发者ID:DebugProject,项目名称:Lua-Other,代码行数:13,代码来源:Arenas.cpp


示例10: ARCEMU_ASSERT

bool Transporter::RemovePassenger(Player* passenger)
{
    ARCEMU_ASSERT(passenger != nullptr);

    m_passengers.erase(passenger->getGuidLow());
    LOG_DEBUG("Player %s removed from transport %u.", passenger->GetName(), this->GetGameObjectProperties()->entry);

    if (passenger->HasUnitMovementFlag(MOVEFLAG_TRANSPORT))
    {
        passenger->RemoveUnitMovementFlag(MOVEFLAG_TRANSPORT);
    }

    return true;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:14,代码来源:TransporterHandler.cpp


示例11: ARCEMU_ASSERT

void Guild::SetGuildMaster(PlayerInfo* pNewMaster)
{
	GuildMemberMap::iterator itr = m_members.find(pNewMaster);
	ARCEMU_ASSERT(m_ranks[0] != NULL);
	if(itr == m_members.end())
		return;

	itr->second->pRank = m_ranks[0];
	itr->first->guildRank = itr->second->pRank;
	CharacterDatabase.Execute("UPDATE guild_data SET guildRank = 0 WHERE playerid = %u AND guildid = %u", itr->first->guid, m_guildId);
	CharacterDatabase.Execute("UPDATE guilds SET leaderGuid = %u WHERE guildId = %u", itr->first->guid, m_guildId);
	m_guildLeader = itr->first->guid;
	LogGuildEvent(GUILD_EVENT_LEADER_CHANGED, 2, pNewMaster->name, pNewMaster->name);
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:14,代码来源:Guild.cpp


示例12: event_GetInstanceID

void EventableObject::event_AddEvent(TimedEvent* ptr)
{
    m_lock.Acquire();

    if(m_holder == NULL)
    {
        m_event_Instanceid = event_GetInstanceID();
        m_holder = sEventMgr.GetEventHolder(m_event_Instanceid);

        if(m_holder == NULL)
        {

            ///////////////////////////////////////// this is for me for debugging purposes - dfighter ////////////////////////////
            // ARCEMU_ASSERT( false );
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            // We still couldn't find an eventholder for us so let's run in WorldRunnable
            m_event_Instanceid = WORLD_INSTANCE;
            m_holder = sEventMgr.GetEventHolder(m_event_Instanceid);
        }
    }

    // We still couldn't find an event holder for ourselves :(
    ARCEMU_ASSERT(m_holder != NULL);

    // If we are flagged not to run in WorldRunnable then we won't!
    // This is much better than adding us to the eventholder and removing on an update
    if(m_event_Instanceid == WORLD_INSTANCE && (ptr->eventFlag & EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT))
    {
        delete ptr->cb;
        delete ptr;

        ///////////////////////////////////////// this is for me for debugging purposes - dfighter ////////////////////////////
        // ARCEMU_ASSERT( false );
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        m_lock.Release();
        return;
    }

    ptr->IncRef();
    ptr->instanceId = m_event_Instanceid;
    pair<uint32, TimedEvent*> p(ptr->eventType, ptr);
    m_events.insert(p);
    m_lock.Release();


    /* Add to event manager */
    m_holder->AddEvent(ptr);
}
开发者ID:Selenah,项目名称:ArcEmu,代码行数:49,代码来源:EventableObject.cpp


示例13: GetCell

void MapMgr::LoadAllCells()
{
	// eek
	MapCell* cellInfo;
	CellSpawns* spawns;

	for(uint32 x = 0 ; x < _sizeX ; x ++)
	{
		for(uint32 y = 0 ; y < _sizeY ; y ++)
		{
			cellInfo = GetCell(x , y);

			if(!cellInfo)
			{
				// Cell doesn't exist, create it.
				// There is no spoon. Err... cell.
				cellInfo = Create(x , y);
				cellInfo->Init(x , y , this);
				LOG_DETAIL("Created cell [%u,%u] on map %u (instance %u)." , x , y , _mapId , m_instanceID);
				cellInfo->SetActivity(true);
				_map->CellGoneActive(x , y);
				ARCEMU_ASSERT(!cellInfo->IsLoaded());

				spawns = _map->GetSpawnsList(x , y);
				if(spawns)
					cellInfo->LoadObjects(spawns);
			}
			else
			{
				// Cell exists, but is inactive
				if(!cellInfo->IsActive())
				{
					LOG_DETAIL("Activated cell [%u,%u] on map %u (instance %u).", x, y, _mapId, m_instanceID);
					_map->CellGoneActive(x , y);
					cellInfo->SetActivity(true);

					if(!cellInfo->IsLoaded())
					{
						//LOG_DETAIL("Loading objects for Cell [%u][%u] on map %u (instance %u)...",
						//	posX, posY, this->_mapId, m_instanceID);
						spawns = _map->GetSpawnsList(x , y);
						if(spawns)
							cellInfo->LoadObjects(spawns);
					}
				}
			}
		}
	}
}
开发者ID:Thomas195,项目名称:arcemu,代码行数:49,代码来源:MapMgr.cpp


示例14: ARCEMU_ASSERT

Creature* MapScriptInterface::SpawnCreature(uint32 Entry, float cX, float cY, float cZ, float cO, bool AddToWorld, bool tmplate, uint32 Misc1, uint32 Misc2, uint32 phase)
{
	CreatureProto* proto = CreatureProtoStorage.LookupEntry(Entry);
	CreatureInfo* info = CreatureNameStorage.LookupEntry(Entry);
	if(proto == NULL || info == NULL)
	{
		return 0;
	}

	CreatureSpawn* sp = new CreatureSpawn;
	sp->entry = Entry;
	uint32 DisplayID = 0;
	uint8 Gender = info->GenerateModelId(&DisplayID);
	sp->displayid = DisplayID;
	sp->form = 0;
	sp->id = 0;
	sp->movetype = 0;
	sp->x = cX;
	sp->y = cY;
	sp->z = cZ;
	sp->o = cO;
	sp->emote_state = 0;
	sp->flags = 0;
	sp->factionid = proto->Faction;
	sp->bytes0 = 0;
	sp->bytes1 = 0;
	sp->bytes2 = 0;
	//sp->respawnNpcLink = 0;
	sp->stand_state = 0;
	sp->death_state = 0;
	sp->channel_target_creature = sp->channel_target_go = sp->channel_spell = 0;
	sp->MountedDisplayID = 0;
	sp->Item1SlotDisplay = 0;
	sp->Item2SlotDisplay = 0;
	sp->Item3SlotDisplay = 0;
	sp->CanFly = 0;
	sp->phase = phase;

	Creature* p = this->mapMgr.CreateCreature(Entry);
	ARCEMU_ASSERT(p != NULL);
	p->Load(sp, (uint32)NULL, NULL);
	p->setGender(Gender);
	p->spawnid = 0;
	p->m_spawn = 0;
	delete sp;
	if(AddToWorld)
		p->PushToWorld(&mapMgr);
	return p;
}
开发者ID:Selenah,项目名称:ArcEmu,代码行数:49,代码来源:MapScriptInterface.cpp


示例15: FindHighestRank

void Guild::ChangeGuildMaster(PlayerInfo* pNewMaster, WorldSession* pClient)
{
	if(pClient->GetPlayer()->GetLowGUID() != m_guildLeader)
	{
		Guild::SendGuildCommandResult(pClient, GUILD_PROMOTE_S, "", GUILD_PERMISSIONS);
		return;
	}

	m_lock.Acquire();
	GuildRank* newRank = FindHighestRank();
	if(newRank == NULL)
	{
		m_lock.Release();
		return;
	}

	GuildMemberMap::iterator itr = m_members.find(pNewMaster);
	GuildMemberMap::iterator itr2 = m_members.find(pClient->GetPlayer()->getPlayerInfo());
	ARCEMU_ASSERT(m_ranks[0] != NULL);
	if(itr == m_members.end())
	{
		Guild::SendGuildCommandResult(pClient, GUILD_PROMOTE_S, pNewMaster->name, GUILD_PLAYER_NOT_IN_GUILD_S);
		m_lock.Release();
		return;
	}
	if(itr2 == m_members.end())
	{
		// wtf??
		Guild::SendGuildCommandResult(pClient, GUILD_PROMOTE_S, "", GUILD_INTERNAL);
		m_lock.Release();
		return;
	}

	itr->second->pRank = m_ranks[0];
	itr->first->guildRank = itr->second->pRank;
	itr2->second->pRank = newRank;
	itr2->first->guildRank = newRank;
	CharacterDatabase.Execute("UPDATE guild_data SET guildRank = 0 WHERE playerid = %u AND guildid = %u", itr->first->guid, m_guildId);
	CharacterDatabase.Execute("UPDATE guild_data SET guildRank = %u WHERE playerid = %u AND guildid = %u", newRank->iId, itr2->first->guid, m_guildId);
	CharacterDatabase.Execute("UPDATE guilds SET leaderGuid = %u WHERE guildId = %u", itr->first->guid, m_guildId);
	m_guildLeader = itr->first->guid;
	m_lock.Release();


	LogGuildEvent(GUILD_EVENT_LEADER_CHANGED, 2, pClient->GetPlayer()->GetName(), pNewMaster->name);
	//TODO: Figure out the GUILD_LOG_EVENT_LEADER_CHANGED code
}
开发者ID:Antares84,项目名称:arcemu,代码行数:47,代码来源:Guild.cpp


示例16: ARCEMU_ASSERT

void Summon::Load(CreatureProto* proto, Unit* owner, LocationVector & position, uint32 spellid, int32 summonslot)
{
    ARCEMU_ASSERT(owner != NULL);

    Creature::Load(proto, owner->GetMapMgr(), position.x, position.y, position.z, position.o);

    SetFaction(owner->GetFaction());
    Phase(PHASE_SET, owner->GetPhase());
    SetZoneId(owner->GetZoneId());
    SetCreatedBySpell(spellid);
    this->summonslot = summonslot;

    if (owner->IsPvPFlagged())
        SetPvPFlag();
    else
        RemovePvPFlag();

    if (owner->IsFFAPvPFlagged())
        SetFFAPvPFlag();
    else
        RemoveFFAPvPFlag();

    if (owner->IsSanctuaryFlagged())
        SetSanctuaryFlag();
    else
        RemoveSanctuaryFlag();

    SetCreatedByGUID(owner->GetGUID());

    if (owner->GetSummonedByGUID() == 0)
        SetSummonedByGUID(owner->GetGUID());
    else
        SetSummonedByGUID(owner->GetSummonedByGUID());

    this->owner = owner;

    if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE))
        SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
}
开发者ID:lev1976g,项目名称:easywow,代码行数:39,代码来源:Summon.cpp


示例17: ARCEMU_ASSERT

void GameEventMgr::GameEventMgrThread::CleanupEntities()
{
    // DO NOT USE THIS FUNCTION UNLESS YOU KNOW WHAT YOU ARE DOING
    ARCEMU_ASSERT(FALSE);
    Log.Success("GameEventMgr", "Cleaning up entity remnants");
    // Better solution: don't have creatures save here in the first place
    for (auto gameEventPair : sGameEventMgr.mGameEvents)
    {
        auto gameEvent = gameEventPair.second;
        for (auto npc : gameEvent->npc_data)
        {
            const char* cleanCreaturesQuery = "DELETE FROM creature_spawns WHERE entry=%u";
            WorldDatabase.Execute(cleanCreaturesQuery, npc.entry);
        }
        for (auto gameobject : gameEvent->gameobject_data)
        {
            const char* cleanGameObjectsQuery = "DELETE FROM gameobject_spawns WHERE entry=%u";
            WorldDatabase.Execute(cleanGameObjectsQuery, gameobject.entry);
        }
    }
    Log.Success("GameEventMgr", "Entity remnants cleaned up, starting main thread");
}
开发者ID:Lbniese,项目名称:AscEmu,代码行数:22,代码来源:GameEventMgr.cpp


示例18: ARCEMU_ASSERT

void CBattlegroundManager::RemovePlayerFromQueues(Player* plr)
{
    m_queueLock.Acquire();

    ARCEMU_ASSERT(plr->m_bgQueueType < BATTLEGROUND_NUM_TYPES);

    sEventMgr.RemoveEvents(plr, EVENT_BATTLEGROUND_QUEUE_UPDATE);

    uint32 lgroup = GetLevelGrouping(plr->getLevel());
    list<uint32>::iterator itr;

    itr = m_queuedPlayers[plr->m_bgQueueType][lgroup].begin();
    while (itr != m_queuedPlayers[plr->m_bgQueueType][lgroup].end())
    {
        if ((*itr) == plr->GetLowGUID())
        {
            Log.Debug("BattlegroundManager", "Removing player %u from queue instance %u type %u", plr->GetLowGUID(), plr->m_bgQueueInstanceId, plr->m_bgQueueType);
            m_queuedPlayers[plr->m_bgQueueType][lgroup].erase(itr);
            break;
        }

        ++itr;
    }

    plr->m_bgIsQueued = false;
    plr->m_bgTeam = plr->GetTeam();
    plr->m_pendingBattleground = NULL;
    SendBattlefieldStatus(plr, BGSTATUS_NOFLAGS, 0, 0, 0, 0, 0);
    m_queueLock.Release();

    Group* group;
    group = plr->GetGroup();
    if (group)  //if da niggas in a group, boot dis bitch ass' group outa da q
    {
        Log.Debug("BattlegroundManager", "Player %u removed whilst in a group. Removing players group %u from queue", plr->GetLowGUID(), group->GetID());
        RemoveGroupFromQueues(group);
    }
}
开发者ID:Declipe,项目名称:AscEmu,代码行数:38,代码来源:BattlegroundMgr.cpp


示例19: strdup

bool Guild::LoadFromDB(Field* f)
{
	m_guildId = f[0].GetUInt32();
	m_guildName = strdup(f[1].GetString());
	m_guildLeader = f[2].GetUInt32();
	m_emblemStyle = f[3].GetUInt32();
	m_emblemColor = f[4].GetUInt32();
	m_borderStyle = f[5].GetUInt32();
	m_borderColor = f[6].GetUInt32();
	m_backgroundColor = f[7].GetUInt32();
	m_guildInfo = strlen(f[8].GetString()) ? strdup(f[8].GetString()) : NULL;
	m_motd = strlen(f[9].GetString()) ? strdup(f[9].GetString()) : NULL;
	m_creationTimeStamp = f[10].GetUInt32();
	m_bankBalance = f[11].GetUInt64();

	// load ranks
	uint32 j;
	QueryResult* result = CharacterDatabase.Query("SELECT * FROM guild_ranks WHERE guildId = %u ORDER BY rankId ASC", m_guildId);
	if(result == NULL)
		return false;

	uint32 sid = 0;

	do
	{
		GuildRank* r = new GuildRank;
		Field* f2 = result->Fetch();
		r->iId = f2[1].GetUInt32();
		if(r->iId != sid)
		{
			Log.Notice("Guild", "Renaming rank %u of guild %s to %u.", r->iId, m_guildName, sid);
			CharacterDatabase.Execute("UPDATE guild_ranks SET rankId = %u WHERE guildId = %u AND rankName = \'%s\'", r->iId,
			                          m_guildId, CharacterDatabase.EscapeString(string(f2[2].GetString())).c_str());

			r->iId = sid;
		}
		sid++;
		r->szRankName = strdup(f2[2].GetString());
		r->iRights = f2[3].GetUInt32();
		r->iGoldLimitPerDay = f2[4].GetUInt32();

		for(j = 0; j < MAX_GUILD_BANK_TABS; ++j)
		{
			r->iTabPermissions[j].iFlags = f2[5 + (j * 2)].GetUInt32();
			r->iTabPermissions[j].iStacksPerDay = f2[6 + (j * 2)].GetUInt32();
		}

		//m_ranks.push_back(r);
		ARCEMU_ASSERT(m_ranks[r->iId] == NULL);
		m_ranks[r->iId] = r;

	}
	while(result->NextRow());
	delete result;

	// load members
	result = CharacterDatabase.Query("SELECT * FROM guild_data WHERE guildid = %u", m_guildId);
	if(result == NULL)
		return false;

	do
	{
		Field* f3 = result->Fetch();
		GuildMember* gm = new GuildMember;
		gm->pPlayer = objmgr.GetPlayerInfo(f3[1].GetUInt32());
		if(gm->pPlayer == NULL)
		{
			delete gm;
			continue;
		}

		if(f3[2].GetUInt32() >= MAX_GUILD_RANKS || m_ranks[f3[2].GetUInt32()] == NULL)
		{
			delete gm;
			continue;
		}

		gm->pRank = m_ranks[f3[2].GetUInt32()];
		if(gm->pRank == NULL)
			gm->pRank = FindLowestRank();
		gm->pPlayer->guild = this;
		gm->pPlayer->guildRank = gm->pRank;
		gm->pPlayer->guildMember = gm;

		if(strlen(f3[3].GetString()))
			gm->szPublicNote = strdup(f3[3].GetString());
		else
			gm->szPublicNote = NULL;

		if(strlen(f3[4].GetString()))
			gm->szOfficerNote = strdup(f3[4].GetString());
		else
			gm->szOfficerNote = NULL;

		gm->uLastWithdrawReset = f3[5].GetUInt32();
		gm->uWithdrawlsSinceLastReset = f3[6].GetUInt32();
		for(j = 0; j < MAX_GUILD_BANK_TABS; ++j)
		{
			gm->uLastItemWithdrawReset[j] = f3[7 + (j * 2)].GetUInt32();
			gm->uItemWithdrawlsSinceLastReset[j] = f3[8 + (j * 2)].GetUInt32();
//.........这里部分代码省略.........
开发者ID:Antares84,项目名称:arcemu,代码行数:101,代码来源:Guild.cpp


示例20: OutPacket

void WorldSocket::InformationRetreiveCallback(WorldPacket & recvData, uint32 requestid)
{
	if(requestid != mRequestID)
		return;

	uint32 error;
	recvData >> error;

	if(error != 0 || pAuthenticationPacket == NULL)
	{
		// something happened wrong @ the logon server
		OutPacket(SMSG_AUTH_RESPONSE, 1, "\x0D");
		return;
	}

	// Extract account information from the packet.
	string AccountName;
	const string* ForcedPermissions;
	uint32 AccountID;
	string GMFlags;
	uint8 AccountFlags;
	string lang = "enUS";
	uint32 i;

	recvData >> AccountID >> AccountName >> GMFlags >> AccountFlags;
	ForcedPermissions = sLogonCommHandler.GetForcedPermissions(AccountName);
	if(ForcedPermissions != NULL)
		GMFlags.assign(ForcedPermissions->c_str());

	LOG_DEBUG(" >> got information packet from logon: `%s` ID %u (request %u)", AccountName.c_str(), AccountID, mRequestID);

	mRequestID = 0;

	// Pull the sessionkey we generated during the logon - client handshake
	uint8 K[40];
	recvData.read(K, 40);

	_crypt.Init(K);

	//checking if player is already connected
	//disconnect current player and login this one(blizzlike)

	if(recvData.rpos() != recvData.wpos())
		recvData.read((uint8*)lang.data(), 4);

	WorldSession* session = sWorld.FindSession(AccountID);
	if(session)
	{
		// AUTH_FAILED = 0x0D
		session->Disconnect();

		// clear the logout timer so he times out straight away
		session->SetLogoutTimer(1);

		// we must send authentication failed here.
		// the stupid newb can relog his client.
		// otherwise accounts dupe up and disasters happen.
		OutPacket(SMSG_AUTH_RESPONSE, 1, "\x15");
		return;
	}

	Sha1Hash sha;

	uint8 digest[20];
	pAuthenticationPacket->read(digest, 20);

	uint32 t = 0;
	if(m_fullAccountName == NULL)				// should never happen !
		sha.UpdateData(AccountName);
	else
	{
		sha.UpdateData(*m_fullAccountName);

		// this is unused now. we may as well free up the memory.
		delete m_fullAccountName;
		m_fullAccountName = NULL;
	}

	sha.UpdateData((uint8*)&t, 4);
	sha.UpdateData((uint8*)&mClientSeed, 4);
	sha.UpdateData((uint8*)&mSeed, 4);
	sha.UpdateData((uint8*)&K, 40);
	sha.Finalize();

	if(memcmp(sha.GetDigest(), digest, 20))
	{
		// AUTH_UNKNOWN_ACCOUNT = 21
		OutPacket(SMSG_AUTH_RESPONSE, 1, "\x15");
		return;
	}

	// Allocate session
	WorldSession* pSession = new WorldSession(AccountID, AccountName, this);
	mSession = pSession;
	ARCEMU_ASSERT(mSession != NULL);
	// aquire delete mutex
	pSession->deleteMutex.Acquire();

	// Set session properties
	pSession->SetClientBuild(mClientBuild);
//.........这里部分代码省略.........
开发者ID:dberga,项目名称:arcbliz,代码行数:101,代码来源:WorldSocket.cpp



注:本文中的ARCEMU_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ARCH_INDEX函数代码示例发布时间:2022-05-30
下一篇:
C++ AR5416DESC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap